Skip to content

Commit

Permalink
RATIS-2111 Reinitialize should load the latest snapshot (#1111)
Browse files Browse the repository at this point in the history
  • Loading branch information
AngersZhuuuu authored and szetszwo committed Jun 16, 2024
1 parent e7e0c79 commit de2e777
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void initialize(RaftServer server, RaftGroupId groupId,
@Override
public void reinitialize() throws IOException {
close();
loadSnapshot(storage.getLatestSnapshot());
loadSnapshot(storage.loadLatestSnapshot());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void initialize(RaftServer server, RaftGroupId groupId, RaftStorage raftS
*/
@Override
public void reinitialize() throws IOException {
load(storage.getLatestSnapshot());
load(storage.loadLatestSnapshot());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ public SingleFileSnapshotInfo getLatestSnapshot() {
if (s != null) {
return s;
}
return loadLatestSnapshot();
}

public SingleFileSnapshotInfo loadLatestSnapshot() {
final File dir = stateMachineDir;
if (dir == null) {
return null;
Expand Down

0 comments on commit de2e777

Please sign in to comment.