This is an automated email from the ASF dual-hosted git repository.
tanxinyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 881816265f6 Synchronize takeSnapshotAsync on RaftGroupID (#12767)
881816265f6 is described below
commit 881816265f6bb7ad26485836ecdd74c53b6409fe
Author: William Song <[email protected]>
AuthorDate: Thu Jun 20 10:02:52 2024 +0800
Synchronize takeSnapshotAsync on RaftGroupID (#12767)
---
.../iotdb/consensus/ratis/RatisConsensus.java | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git
a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/ratis/RatisConsensus.java
b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/ratis/RatisConsensus.java
index 90816ba6291..c8fbeea4ced 100644
---
a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/ratis/RatisConsensus.java
+++
b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/ratis/RatisConsensus.java
@@ -771,14 +771,22 @@ class RatisConsensus implements IConsensus {
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);
}
}