Skip to main content

remote_retention_prefix

Function remote_retention_prefix 

Source
pub fn remote_retention_prefix(
    deletes_allowed: bool,
    segments: &[RemoteRetentionSegment],
    size_debt: u64,
) -> usize
Expand description

Count the oldest finished remote segments that Kafka’s remote retention deletes.

size_debt is the total size minus retention.bytes, or zero when retention.bytes is unset or not exceeded. A tier that accepts no delete (deletes_allowed false) selects nothing. A blocked row stops the prefix even when its floor, time or size axis would otherwise select it.

The result equals remote_retention_model from the oldest segment. That fold states the Kafka rule. Independent bounds justify every selected row by a floor/time breach or a funded charged prefix, and require the first kept row to be blocked or fail all three axes. Zero debt cannot delete an unbreached empty row; an expired oversized row exhausts debt without restarting size deletion.