Skip to main content

majority_watermark

Function majority_watermark 

Source
pub fn majority_watermark(
    log_end: i64,
    follower_offsets: &[i64],
    majority: usize,
    current: i64,
) -> i64
Expand description

The watermark a majority has acknowledged, never below current.

This is recompute_high_watermark with the leader’s log end always counted and no leader-epoch gate. The result is the greater of current and the majority frontier: the greatest member of {log_end} U follower_offsets that at least majority members reach. Passing current as both the gate and the floor is what makes it that: the frontier is taken only when it passes current, and current otherwise.

A caller that needs Raft’s current-term rule, the gate on the leader’s first record of its own epoch, uses recompute_high_watermark instead.