Structsยง
- Candidate ๐
- Metrics of a candidate compaction input, accumulated incrementally as the candidate interval expands one file at a time.
- Candidate
Score ๐ - Score of a candidate compaction input. Higher is better: first by the predicted net file count reduction, then by the number of files participating in an overlap, then by smaller input bytes.
- Ordered
File ๐ - Twcs
Picker TwcsPickerpicks files of which the max timestamp are in the same time window as compaction candidates.- Window ๐
Constantsยง
- DEFAULT_
MAX_ ๐INPUT_ FILES - Default maximum number of input SST files in one compaction input.
- LEVEL_
COMPACTED ๐ - MAX_
INPUT_ ๐FILES_ ENV - MAX_
L1_ ๐L0_ ROW_ RATIO - A mixed L0/L1 compaction may rewrite at most this many L1 rows per L0 row.
Staticsยง
- MAX_
INPUT_ ๐FILES - Maximum number of input SST files in one compaction input.
Configurable via
MAX_INPUT_FILES_ENV.
Functionsยง
- assign_
to_ ๐windows - Assigns files to windows with predefined window size (in seconds) by their max timestamps.
- find_
latest_ ๐window_ in_ seconds - Finds the latest active writing window among all files.
Returns
Nonewhen there are no files or all files are corrupted. - log_
pick_ ๐result - ordered_
files ๐ - Flattens sorted runs into files ordered by
(start asc, end desc), breaking ties by run and position to keep the order deterministic. - parse_
max_ ๐input_ files - pick_
candidate_ ๐files - pick_
count_ ๐first - Picks a contiguous (in global time order) interval of files to compact.
- pick_
count_ ๐first_ where - pick_
mixed_ ๐count_ first - selected_
overlaps_ ๐unselected - time_
window_ ๐intersects_ range - window_
has_ ๐overlap