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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]