Skip to main content

pick_count_first

Function pick_count_first 

Source
fn pick_count_first(
    sorted_runs: Vec<SortedRun<FileHandle>>,
    max_output_file_size: Option<u64>,
    mapper: &PrimaryKeyRangeMapper,
) -> Vec<FileHandle>
Expand description

Picks a contiguous (in global time order) interval of files to compact.

The picker reorders all files from all sorted runs by (start asc, end desc) and enumerates every interval of at most MAX_INPUT_FILES files as a Candidate. An interval is eligible when it

  • holds at least 2 files,
  • passes the caller-supplied eligibility predicate (e.g. the byte- and row-balance checks for regular picks, the rewrite budget for inactive window fallbacks),
  • makes progress on at least one axis: it reduces the physical file count given the output split threshold max_output_file_size, or it resolves at least one overlap between sorted runs.

The best interval wins by CandidateScore; ties keep the earliest interval.