You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "FMX (via GitHub)" <gi...@apache.org> on 2026/07/14 08:38:45 UTC

[PR] RATIS-2605. Avoid advancing matchIndex from heartbeat AppendEntries success [ratis]

FMX opened a new pull request, #1519:
URL: https://github.com/apache/ratis/pull/1519

    ## What changes were proposed in this pull request?
   
     This patch fixes leader-side AppendEntries success handling for heartbeat requests.
   
     A follower returns its local `nextIndex` for successful heartbeat AppendEntries replies. That value describes the follower's local log tail, but it does not prove that all entries
     up to `nextIndex - 1` match the leader's log. If the follower has a divergent uncommitted tail from an old leader, trusting the heartbeat reply `nextIndex` may incorrectly advance
     the leader-side `matchIndex`.
   
     Once `matchIndex` is polluted, later `INCONSISTENCY` handling can use `matchIndex + 1` as a lower bound and prevent `nextIndex` from backing off to the real common prefix.
   
     This patch preserves the AppendEntries request metadata together with the reply. For successful heartbeat replies, the leader advances only to `request.previousLog.index + 1`. For
     successful append replies, the existing behavior is preserved and `reply.nextIndex` is still used.
   
     Unit tests are added for:
   
     1. Heartbeat `SUCCESS` with `previousLog` advances only to `previousLog.index + 1`.
     2. Heartbeat `SUCCESS` without `previousLog` does not advance `matchIndex`.
     3. Append `SUCCESS` still advances using `reply.nextIndex`.
   
     ## What is the link to the Apache JIRA
   
     https://issues.apache.org/jira/browse/RATIS-2605
   
     ## How was this patch tested?
   
     ```bash
     ./mvnw -pl ratis-server -am -Dtest=TestLogAppenderDefault test


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ratis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] RATIS-2605. Avoid advancing matchIndex from heartbeat AppendEntries success [ratis]

Posted by "szetszwo (via GitHub)" <gi...@apache.org>.
szetszwo merged PR #1519:
URL: https://github.com/apache/ratis/pull/1519


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ratis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org