-
Notifications
You must be signed in to change notification settings - Fork 420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RATIS-2166. Update nextChunkIndex when snapshot is ALREADY_INSTALLED #1159
RATIS-2166. Update nextChunkIndex when snapshot is ALREADY_INSTALLED #1159
Conversation
@szetszwo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 the change looks good.
@133tosakarin , on a second thought, let's change the @@ -192,8 +193,12 @@ class SnapshotInstallationHandler {
//TODO: We should only update State with installed snapshot once the request is done.
state.installSnapshot(request);
- int idx = nextChunkIndex.getAndIncrement();
- Preconditions.assertEquals(snapshotChunkRequest.getRequestIndex(), idx, "nextChunkIndex");
+ final int expectedChunkIndex = nextChunkIndex.getAndIncrement();
+ if (snapshotChunkRequest.getRequestIndex() != expectedChunkIndex) {
+ throw new IOException("Unexpected request chunk index: " + snapshotChunkRequest.getRequestIndex()
+ + " (the expected index is " + expectedChunkIndex + ")");
+ }
+
// update the committed index
// re-load the state machine if this is the last chunk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@133tosakarin , thanks of the update!
@133tosakarin , you are right that the failures does not seem related; see #1156 . Let's merge this without further retries. |
What changes were proposed in this pull request?
Fix legacy problems with #1145
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/RATIS-2166