From a9ed85a975e8ab61b526aff4520e29e3bcd62eb7 Mon Sep 17 00:00:00 2001 From: Li0k Date: Fri, 6 Sep 2024 15:57:03 +0800 Subject: [PATCH] fix(storage): cherry-pick fix duplicated sst_id generated by split_sst function (#18432) --- src/meta/src/hummock/manager/commit_epoch.rs | 2 +- .../hummock_sdk/src/compaction_group/hummock_version_ext.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/meta/src/hummock/manager/commit_epoch.rs b/src/meta/src/hummock/manager/commit_epoch.rs index 0c07ca6f09fb..812e102f579f 100644 --- a/src/meta/src/hummock/manager/commit_epoch.rs +++ b/src/meta/src/hummock/manager/commit_epoch.rs @@ -402,7 +402,7 @@ impl HummockManager { } } - new_sst_id_number += group_table_ids.len(); + new_sst_id_number += group_table_ids.len() * 2; sst_to_cg_vec.push((commit_sst, group_table_ids)); } diff --git a/src/storage/hummock_sdk/src/compaction_group/hummock_version_ext.rs b/src/storage/hummock_sdk/src/compaction_group/hummock_version_ext.rs index 13a0bcc08adf..ab5f8b8cea7a 100644 --- a/src/storage/hummock_sdk/src/compaction_group/hummock_version_ext.rs +++ b/src/storage/hummock_sdk/src/compaction_group/hummock_version_ext.rs @@ -1330,7 +1330,8 @@ pub fn validate_version(version: &HummockVersion) -> Vec { pub fn split_sst(sst_info: &mut SstableInfo, new_sst_id: &mut u64) -> SstableInfo { let mut branch_table_info = sst_info.clone(); branch_table_info.sst_id = *new_sst_id; - sst_info.sst_id = *new_sst_id + 1; + *new_sst_id += 1; + sst_info.sst_id = *new_sst_id; *new_sst_id += 1; branch_table_info