RATIS-1369. When there is no snapshot, the return snapshotIndex should be -1, not 0.#473
Merged
szetszwo merged 3 commits intoapache:masterfrom Apr 26, 2021
Merged
Conversation
Contributor
Author
|
@bshashikant @bharatviswa504 @szetszwo Can you please take a look ? |
Contributor
|
@szetszwo , can you please check this one? |
szetszwo
approved these changes
Apr 26, 2021
Contributor
szetszwo
left a comment
There was a problem hiding this comment.
+1
The change looks good. Good catch on the bug.
Let's use RaftLog.INVALID_LOG_INDEX instead of hard coding it. Since it is very minor, I will change it before merging.
ratis-server/src/main/java/org/apache/ratis/server/impl/ServerState.java
Outdated
Show resolved
Hide resolved
ratis-server/src/main/java/org/apache/ratis/server/impl/ServerState.java
Outdated
Show resolved
Hide resolved
symious
pushed a commit
to symious/ratis
that referenced
this pull request
Feb 20, 2024
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.
What changes were proposed in this pull request?
For now, if there is no snapshot existed, the returned snapshotIndex is 0.
It is not correctly, since the raft log starts from index 0 (BTW, in raft paper, the first valid log index is 1, but in ratis, it is 0), a snapshot taken at snapshotIndex 0 should contain the log entry 0. The snapshotIndex indicating an empty/fake snapshot should be -1.
This issue is found in the test of bootstrap SCM in SCM HA. For details, please check the jira.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/RATIS-1369
How was this patch tested?
CI