Expand description
The split will follow the following rules:
- Ssts with
split_key
will be split into two separate ssts and theirkey_range
will be changedsst_1
: [sst.key_range.right
,split_key
)sst_2
: [split_key
,sst.key_range.right
]. - Currently only
vnode
0 andvnode
max is supported. - Due to the above rule,
vnode
max will be rewritten astable_id
+ 1, vnode 0
Enums§
Functions§
- generate a full key for convenience to get the
table_id
andvnode
- 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 thetable_ids
. In contrast tosplit_sst
, this function does not modify thekey_range
and does not guarantee that the split ssts can be merged, which needs to be guaranteed by the caller.