Skip to content

Commit

Permalink
chore(storage): rename
Browse files Browse the repository at this point in the history
  • Loading branch information
Li0k committed Jan 5, 2024
1 parent c9a8fb2 commit 424dfd5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
18 changes: 9 additions & 9 deletions src/meta/src/hummock/compactor_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,16 +234,16 @@ impl CompactorManagerInner {
ret
}

pub fn get_expired_tasks(&self) -> Vec<CompactTask> {
pub fn get_heartbeat_expired_tasks(&self) -> Vec<CompactTask> {
let heartbeat_expiry_ts: u64 = SystemTime::now()
.duration_since(SystemTime::UNIX_EPOCH)
.expect("Clock may have gone backwards")
.as_secs()
- self.heartbeat_expiry_seconds;
Self::get_heartbeat_expired_tasks(&self.task_heartbeats, heartbeat_expiry_ts)
Self::get_heartbeat_expired_tasks_impl(&self.task_heartbeats, heartbeat_expiry_ts)
}

fn get_heartbeat_expired_tasks(
fn get_heartbeat_expired_tasks_impl(
task_heartbeats: &HashMap<HummockCompactionTaskId, TaskHeartbeat>,
heartbeat_expiry_ts: u64,
) -> Vec<CompactTask> {
Expand Down Expand Up @@ -436,8 +436,8 @@ impl CompactorManager {
.check_tasks_status(tasks, slow_task_duration)
}

pub fn get_expired_tasks(&self) -> Vec<CompactTask> {
self.inner.read().get_expired_tasks()
pub fn get_heartbeat_expired_tasks(&self) -> Vec<CompactTask> {
self.inner.read().get_heartbeat_expired_tasks()
}

pub fn initiate_task_heartbeat(&self, task: CompactTask) {
Expand Down Expand Up @@ -512,11 +512,11 @@ mod tests {

// Ensure task is expired.
tokio::time::sleep(Duration::from_secs(2)).await;
let expired = compactor_manager.get_expired_tasks();
let expired = compactor_manager.get_heartbeat_expired_tasks();
assert_eq!(expired.len(), 1);

// Mimic no-op compaction heartbeat
assert_eq!(compactor_manager.get_expired_tasks().len(), 1);
assert_eq!(compactor_manager.get_heartbeat_expired_tasks().len(), 1);

// Mimic compaction heartbeat with invalid task id
compactor_manager.update_task_heartbeats(&vec![CompactTaskProgress {
Expand All @@ -525,7 +525,7 @@ mod tests {
num_ssts_uploaded: 1,
..Default::default()
}]);
assert_eq!(compactor_manager.get_expired_tasks().len(), 1);
assert_eq!(compactor_manager.get_heartbeat_expired_tasks().len(), 1);

// Mimic effective compaction heartbeat
compactor_manager.update_task_heartbeats(&vec![CompactTaskProgress {
Expand All @@ -536,7 +536,7 @@ mod tests {
num_write_io: 100,
..Default::default()
}]);
assert_eq!(compactor_manager.get_expired_tasks().len(), 0);
assert_eq!(compactor_manager.get_heartbeat_expired_tasks().len(), 0);

// Test add
assert_eq!(compactor_manager.compactor_num(), 0);
Expand Down
8 changes: 4 additions & 4 deletions src/meta/src/hummock/manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2059,7 +2059,7 @@ impl HummockManager {
GroupSplit,
CheckDeadTask,
Report,
CompactionHeartBeat,
CompactionHeartBeatExpiredCheck,

DynamicCompactionTrigger,
SpaceReclaimCompactionTrigger,
Expand Down Expand Up @@ -2091,7 +2091,7 @@ impl HummockManager {
.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Delay);
compaction_heartbeat_interval.reset();
let compaction_heartbeat_trigger = IntervalStream::new(compaction_heartbeat_interval)
.map(|_| HummockTimerEvent::CompactionHeartBeat);
.map(|_| HummockTimerEvent::CompactionHeartBeatExpiredCheck);

let mut min_trigger_interval = tokio::time::interval(Duration::from_secs(
hummock_manager.env.opts.periodic_compaction_interval_sec,
Expand Down Expand Up @@ -2270,7 +2270,7 @@ impl HummockManager {
}
}

HummockTimerEvent::CompactionHeartBeat => {
HummockTimerEvent::CompactionHeartBeatExpiredCheck => {
let compactor_manager =
hummock_manager.compactor_manager.clone();

Expand All @@ -2280,7 +2280,7 @@ impl HummockManager {
// progress (meta + compactor)
// 2. meta periodically scans the task and performs a cancel on
// the meta side for tasks that are not updated by heartbeat
for task in compactor_manager.get_expired_tasks() {
for task in compactor_manager.get_heartbeat_expired_tasks() {
if let Err(e) = hummock_manager
.cancel_compact_task(
task.task_id,
Expand Down

0 comments on commit 424dfd5

Please sign in to comment.