Skip to main content

Module compaction

Module compaction 

Source
Expand description

Segment compaction: merge segments, drop deleted rows, re-encode.

Compaction reads one or more source segments along with their delete bitmaps, filters out deleted rows, and writes a new compacted segment. The caller is responsible for the atomic metadata swap (WAL commit marker → swap segment references → delete old files).

Triggered when a segment’s delete ratio exceeds the threshold (default 20%) or when the segment count exceeds a limit.

Structs§

CompactionResult
Result of a compaction operation.

Constants§

DEFAULT_DELETE_RATIO_THRESHOLD
Default compaction threshold: compact when >20% of rows are deleted.

Functions§

compact_segment
Compact a single segment by removing deleted rows.
compact_segments
Compact multiple segments into a single merged segment.