JackieTien97 commented on code in PR #7133:
URL: https://github.com/apache/iotdb/pull/7133#discussion_r957914646


##########
consensus/src/main/java/org/apache/iotdb/consensus/ratis/RatisConsensus.java:
##########
@@ -256,6 +257,12 @@ public ConsensusGenericResponse 
createPeer(ConsensusGroupId groupId, List<Peer>
     if (!group.getPeers().contains(myself)) {
       return failed(new ConsensusGroupNotExistException(groupId));
     }
+    RaftGroupId raftGroupId = Utils.fromConsensusGroupIdToRaftGroupId(groupId);
+    RaftGroup existGroup = getGroupInfo(raftGroupId);
+    // pre-conditions: the new group not exists
+    if (existGroup != null) {
+      return failed(new ConsensusGroupAlreadyExistException(groupId));
+    }

Review Comment:
   It seems that even if you do this check, it could not totally prevent this 
problem because this checking and creating are not atomically.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to