pub fn diskless_retention_prefix(
max_timestamps: &[i64],
byte_lens: &[u64],
last_offsets: &[i64],
policy: DisklessRetentionPolicy,
) -> usizeExpand description
Select the oldest contiguous prefix of one diskless partition’s committed WAL index ranges that retention allows to expire.
Kafka runs three walks oldest first, each stopping at the first segment it
must keep: the log-start-offset walk, then the size walk over what is left,
then the time walk over what is left after that. The first two predicates
only ever hold on a prefix (the size one because sizes are nonnegative, the
floor one because the host supplies ranges in offset order), so the three
walks together expire exactly the longest prefix on which one of the three
holds at every range. That prefix is what this returns, capped one short of
the newest range; see expirable.
The ranges arrive oldest first, one entry per index range, and the three slices are parallel.
The newest range never expires. Kafka keeps the active segment for the same
reason, and here it is also what keeps the flusher’s flushed_frontier
pointing past the last flushed offset: an empty index would send the next
tick back to the local log start and re-upload a prefix the bucket holds.