Skip to main content

leader_high_watermark

Function leader_high_watermark 

Source
pub fn leader_high_watermark(
    facts: HighWatermarkFacts,
    replicas: &[HwmReplica],
) -> i64
Expand description

Compute the leader’s next high watermark.

While the ISR is below the effective min.insync.replicas the watermark stays where it is, so every record below it reached the HWM with at least min ISR replicas holding it – the fact KIP-966 builds the eligible-leader set on. Otherwise it is the lowest log end among the leader, the ISR and every caught-up ISR-eligible replica outside it, if that is higher than the current watermark. A replica that has not fetched from this leader (log end -1) in the ISR holds it where it is.

The caller keeps current at or below the leader’s log end, as Kafka’s UnifiedLog.truncateTo does when it truncates.