IGNITE-28105 Ensure new leader clock is not lower than last applied cmd#7731
Open
EgorKuts wants to merge 2 commits intoapache:mainfrom
Open
IGNITE-28105 Ensure new leader clock is not lower than last applied cmd#7731EgorKuts wants to merge 2 commits intoapache:mainfrom
EgorKuts wants to merge 2 commits intoapache:mainfrom
Conversation
ascherbakoff
reviewed
Mar 9, 2026
modules/raft/src/integrationTest/java/org/apache/ignite/raft/server/ItNewLeaderClockTest.java
Outdated
Show resolved
Hide resolved
| this.currTerm | ||
| ); | ||
| if (request.timestamp() != null) { | ||
| clock.update(request.timestamp()); |
Contributor
There was a problem hiding this comment.
Propagating HLC in each AppendEntry request creates additinal contention on HLC.
For this reason it was removed earlier.
Could we instead do it in RequestVoteRequest ?
Contributor
Author
There was a problem hiding this comment.
No. If the leader has the most advanced clock, it is possible for the new leader to have a stale clock value. This scenario is shown in the reproducer (2 out of 3 nodes have a lower HLC).
If we need to address the contention, I propose creating a separate clock per partition. This clock would be updated on each appendEntry and merged with the main clock when the node becomes a leader.
Co-authored-by: Aleksei Scherbakov <alexey.scherbakoff@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It's possible that new elected leader would have a lower clock's value than the last applied command(see ItNewLeaderClockTest).
Such behavior breaks state machine invariants and causes all nodes in the replication group to fail.