risingwave_hummock_sdk::compaction_group

Module group_split

source
Expand description

The split will follow the following rules:

  1. Ssts with split_key will be split into two separate ssts and their key_range will be changed sst_1: [sst.key_range.right, split_key) sst_2: [split_key, sst.key_range.right].
  2. Currently only vnode 0 and vnode max is supported.
  3. Due to the above rule, vnode max will be rewritten as table_id + 1, vnode 0

Enums§

Functions§

  • generate a full key for convenience to get the table_id and vnode
  • Merge the right levels into the left levels.
  • Determine whether the SST needs to be split, and if so, which side to split.
  • 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, }
  • Split the SSTs in the level according to the split key.
  • The old split sst logic with table_ids This function is used to split the sst into two parts based on the table_ids. In contrast to split_sst, this function does not modify the key_range and does not guarantee that the split ssts can be merged, which needs to be guaranteed by the caller.