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§

SstSplitType

Functions§

build_split_full_key
generate a full key for convenience to get the table_id and vnode
build_split_key
get_split_pos
get_sub_level_insert_hint
merge_levels
Merge the right levels into the left levels.
need_to_split
Determine whether the SST needs to be split, and if so, which side to split.
split_sst
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_sst_info_for_level_v2
Split the SSTs in the level according to the split key.
split_sst_with_table_ids
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.
split_table_ids_with_split_key
split_table_ids_with_table_id_and_vnode