Skip to main content

compact_segment

Function compact_segment 

Source
pub fn compact_segment(
    segment_data: &[u8],
    deletes: &DeleteBitmap,
    schema: &ColumnarSchema,
    profile_tag: u8,
    memory: &ScopedMemory,
    kek: Option<&WalEncryptionKey>,
) -> Result<CompactionResult, ColumnarError>
Expand description

Compact a single segment by removing deleted rows.

Reads the segment, skips rows marked in the delete bitmap, and writes a new segment with only live rows. Returns None segment if all rows were deleted.

When kek is Some, the output segment is wrapped in an AES-256-GCM SEGC envelope. The input segment must be plaintext (the caller is responsible for decrypting before passing to this function).

memory tracks working-buffer allocations against the bound database, tenant, and engine budget.