From 424dfd52dbf7f3aa75d4ea043bfcaef3ea20847c Mon Sep 17 00:00:00 2001 From: Li0k Date: Fri, 5 Jan 2024 14:11:56 +0800 Subject: [PATCH] chore(storage): rename --- src/meta/src/hummock/compactor_manager.rs | 18 +++++++++--------- src/meta/src/hummock/manager/mod.rs | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/meta/src/hummock/compactor_manager.rs b/src/meta/src/hummock/compactor_manager.rs index 4b2377c362254..8b9b5d0a985d4 100644 --- a/src/meta/src/hummock/compactor_manager.rs +++ b/src/meta/src/hummock/compactor_manager.rs @@ -234,16 +234,16 @@ impl CompactorManagerInner { ret } - pub fn get_expired_tasks(&self) -> Vec { + pub fn get_heartbeat_expired_tasks(&self) -> Vec { 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, heartbeat_expiry_ts: u64, ) -> Vec { @@ -436,8 +436,8 @@ impl CompactorManager { .check_tasks_status(tasks, slow_task_duration) } - pub fn get_expired_tasks(&self) -> Vec { - self.inner.read().get_expired_tasks() + pub fn get_heartbeat_expired_tasks(&self) -> Vec { + self.inner.read().get_heartbeat_expired_tasks() } pub fn initiate_task_heartbeat(&self, task: CompactTask) { @@ -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 { @@ -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 { @@ -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); diff --git a/src/meta/src/hummock/manager/mod.rs b/src/meta/src/hummock/manager/mod.rs index ad26d1c7148f0..c71403f898356 100644 --- a/src/meta/src/hummock/manager/mod.rs +++ b/src/meta/src/hummock/manager/mod.rs @@ -2059,7 +2059,7 @@ impl HummockManager { GroupSplit, CheckDeadTask, Report, - CompactionHeartBeat, + CompactionHeartBeatExpiredCheck, DynamicCompactionTrigger, SpaceReclaimCompactionTrigger, @@ -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, @@ -2270,7 +2270,7 @@ impl HummockManager { } } - HummockTimerEvent::CompactionHeartBeat => { + HummockTimerEvent::CompactionHeartBeatExpiredCheck => { let compactor_manager = hummock_manager.compactor_manager.clone(); @@ -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,