sanpwc commented on a change in pull request #399:
URL: https://github.com/apache/ignite-3/pull/399#discussion_r732573328



##########
File path: modules/raft/src/main/java/org/apache/ignite/internal/raft/Loza.java
##########
@@ -120,32 +126,35 @@ public Loza(ClusterService clusterNetSvc, Path dataPath) {
      * @param groupId Raft group id.
      * @param nodes Raft group nodes.
      * @param lsnrSupplier Raft group listener supplier.
-     * @param clientTimeout Client retry timeout.
-     * @param networkTimeout Client network timeout.
      * @return Future representing pending completion of the operation.
      */
     @Experimental
     public CompletableFuture<RaftGroupService> prepareRaftGroup(
         String groupId,
         List<ClusterNode> nodes,
-        Supplier<RaftGroupListener> lsnrSupplier,
-        int clientTimeout,
-        int networkTimeout) {
+        Supplier<RaftGroupListener> lsnrSupplier
+    ) {
         assert !nodes.isEmpty();
 
         List<Peer> peers = nodes.stream().map(n -> new 
Peer(n.address())).collect(Collectors.toList());
 
         String locNodeName = 
clusterNetSvc.topologyService().localMember().name();
 
-        if (nodes.stream().anyMatch(n -> locNodeName.equals(n.name())))
-            raftServer.startRaftGroup(groupId, lsnrSupplier.get(), peers);
+        boolean hasLocalRaft = nodes.stream().anyMatch(n -> 
locNodeName.equals(n.name()));
+
+        if (hasLocalRaft && !localGroups.contains(groupId)) {
+            if (raftServer.startRaftGroup(groupId, lsnrSupplier.get(), peers))
+                localGroups.add(groupId);
+            else
+                LOG.error("Failed to start raft group on the node [node={}, 
raftGrp={}]", locNodeName, groupId);

Review comment:
       I believe that we should throw an exception here, probably an assertion 
one if `startRaftGroup` returns false. I'd also change startRaftGroup contract 
a bit, specifying that it returns false if raftGroup with given name already 
exists. Currently it's true both for `JRaftServerImpl` and `RaftServerImpl`.




-- 
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