Skip to content

Commit

Permalink
Synchronize takeSnapshotAsync on RaftGroupID (apache#12767)
Browse files Browse the repository at this point in the history
  • Loading branch information
SzyWilliam committed Nov 22, 2024
1 parent 9af6f15 commit 9f079ee
Showing 1 changed file with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -771,14 +771,22 @@ public void triggerSnapshot(ConsensusGroupId groupId, boolean force) throws Cons
300000,
force ? 1 : 0);

final RaftClientReply reply;
try {
reply = server.get().snapshotManagement(request);
if (!reply.isSuccess()) {
throw new RatisRequestFailedException(reply.getException());
synchronized (raftGroupId) {
final RaftClientReply reply;
try {
reply = server.get().snapshotManagement(request);
if (!reply.isSuccess()) {
throw new RatisRequestFailedException(reply.getException());
}
logger.info(
"{} group {}: successfully taken snapshot at index {} with force = {}",
this,
raftGroupId,
reply.getLogIndex(),
force);
} catch (IOException ioException) {
throw new RatisRequestFailedException(ioException);
}
} catch (IOException ioException) {
throw new RatisRequestFailedException(ioException);
}
}

Expand Down

0 comments on commit 9f079ee

Please sign in to comment.