From ce1d7cce861894ebe1af5b2a612d1942af6184a6 Mon Sep 17 00:00:00 2001 From: Li0k Date: Thu, 5 Sep 2024 12:04:17 +0800 Subject: [PATCH] fix(storage): fix commit_epoch correct_sst --- src/meta/src/hummock/manager/commit_epoch.rs | 7 ++++--- .../manager/compaction/compaction_group_schedule.rs | 8 +++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/meta/src/hummock/manager/commit_epoch.rs b/src/meta/src/hummock/manager/commit_epoch.rs index 8d872813989e..cc06f65ffc8b 100644 --- a/src/meta/src/hummock/manager/commit_epoch.rs +++ b/src/meta/src/hummock/manager/commit_epoch.rs @@ -18,7 +18,7 @@ use std::sync::Arc; use risingwave_common::catalog::TableId; use risingwave_hummock_sdk::change_log::ChangeLogDelta; -use risingwave_hummock_sdk::compaction_group::group_split::split_sst; +use risingwave_hummock_sdk::compaction_group::group_split::{self, split_sst}; use risingwave_hummock_sdk::sstable_info::SstableInfo; use risingwave_hummock_sdk::table_stats::{ add_prost_table_stats_map, purge_prost_table_stats, to_prost_table_stats_map, PbTableStatsMap, @@ -477,7 +477,9 @@ impl HummockManager { for (mut sst, group_table_ids) in sst_to_cg_vec { for (group_id, match_ids) in group_table_ids { let group_members_table_ids = group_members_table_ids.get(&group_id).unwrap(); - if match_ids + if sst + .sst_info + .table_ids .iter() .all(|id| group_members_table_ids.contains(&TableId::new(*id))) { @@ -504,7 +506,6 @@ impl HummockManager { split_key, origin_sst_size - new_sst_size, new_sst_size, - // match_ids, ); commit_sstables diff --git a/src/meta/src/hummock/manager/compaction/compaction_group_schedule.rs b/src/meta/src/hummock/manager/compaction/compaction_group_schedule.rs index 9f14bfc54e56..391b0431a25c 100644 --- a/src/meta/src/hummock/manager/compaction/compaction_group_schedule.rs +++ b/src/meta/src/hummock/manager/compaction/compaction_group_schedule.rs @@ -824,9 +824,11 @@ pub fn is_table_low_write_throughput( if let Some(history) = table_write_throughput.get(&table_id) { // Determine if 2/3 of the values in the interval below the threshold. let mut low_write_throughput_count = 0; - for throughput in history.iter().skip(history.len() - window_size) { - if *throughput / checkpoint_secs < threshold { - low_write_throughput_count += 1; + if history.len() >= window_size { + for throughput in history.iter().skip(history.len() - window_size) { + if *throughput / checkpoint_secs < threshold { + low_write_throughput_count += 1; + } } }