risingwave_hummock_sdk::compaction_group::group_split

Function split_sst

source
pub fn split_sst(
    origin_sst_info: SstableInfo,
    new_sst_id: &mut u64,
    split_key: Bytes,
    left_size: u64,
    right_size: u64,
) -> (Option<SstableInfo>, Option<SstableInfo>)
Expand description

Split the SST into two parts based on the split key. The left part is the original SST, and the right part is the new SST. The split key is exclusive for the left part and inclusive for the right part. The table_ids of the new SST are calculated based on the split key. e.g. sst.table_ids = [1, 2, 3, 4, 5, 6, 7, 8, 9], split_key = (table_id = 5, vnode = 0) then the result: sst1 { sst_id: new_sst_id + 1, table_ids: [1, 2, 3, 4], key_range: [left, split_key), sst_size: left_size, } sst2 { sst_id: new_sst_id, table_ids: [5, 6, 7, 8, 9], key_range: [split_key, right], sst_size: right_size, }