Skip to content
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-1390. Bootstrapping Peer should always try to install a snapshot the first time. #489

Merged
merged 4 commits into from
Aug 22, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix Netty install snapshot
  • Loading branch information
hanishakoneru committed Aug 10, 2021
commit 8d3a4763c7f24f53ef93e06e056196d725238912
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void setSnapshotIndex(long newSnapshotIndex) {

@Override
public void ackInstallSnapshotAttempt() {
LOG.info("----- Follower ack Install Snapshot old snapshotIndex: " + snapshotIndex.get());
LOG.info("Follower {} acknowledged installing snapshot", name);
ackInstallSnapshotAttempt = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,21 @@ public void run() throws InterruptedException, IOException {
this, getFollower().getNextIndex(), getRaftLog().getStartIndex(), snapshot);

final InstallSnapshotReplyProto r = installSnapshot(snapshot);
if (r != null && r.getResult() == InstallSnapshotResult.NOT_LEADER) {
onFollowerTerm(r.getTerm());
} // otherwise if r is null, retry the snapshot installation
if (r != null) {
switch (r.getResult()) {
case NOT_LEADER:
onFollowerTerm(r.getTerm());
break;
case SUCCESS:
case NULL_SNAPSHOT:
case ALREADY_INSTALLED:
getFollower().ackInstallSnapshotAttempt();
break;
default:
break;
}
}
// otherwise if r is null, retry the snapshot installation
} else {
final AppendEntriesReplyProto r = sendAppendEntriesWithRetries();
if (r != null) {
Expand Down