sanpwc commented on code in PR #6053:
URL: https://github.com/apache/ignite-3/pull/6053#discussion_r2166019992


##########
modules/replicator/src/main/java/org/apache/ignite/internal/replicator/ReplicaManager.java:
##########
@@ -790,9 +794,49 @@ public CompletableFuture<Replica> 
replica(ReplicationGroupId replicationGroupId)
      * @param replicaGrpId Replication group ID.
      * @param peersAndLearners New node configuration.
      */
-    public void resetPeers(ReplicationGroupId replicaGrpId, PeersAndLearners 
peersAndLearners) {
+    public boolean resetPeers(ReplicationGroupId replicaGrpId, 
PeersAndLearners peersAndLearners) {
         RaftNodeId raftNodeId = new RaftNodeId(replicaGrpId, new 
Peer(localNodeConsistentId));
-        ((Loza) raftManager).resetPeers(raftNodeId, peersAndLearners);
+        return ((Loza) raftManager).resetPeers(raftNodeId, peersAndLearners);
+    }
+
+    /**
+     * Performs a {@code resetPeers} operation on raft node with retries.
+     *
+     * @param replicaGrpId Replication group ID.
+     * @param assignments New assignments.
+     */
+    public CompletableFuture<Void> resetWithRetry(ReplicationGroupId 
replicaGrpId, Assignments assignments) {
+        return supplyAsync(() -> inBusyLock(busyLock, () -> {
+            assert isReplicaStarted(replicaGrpId) : "The local node is outside 
of the replication group: " + replicaGrpId;
+
+            return resetPeers(replicaGrpId, 
fromAssignments(assignments.nodes()));
+        }), replicaStartStopExecutor)
+                .handleAsync((resetSuccessful, ex) -> {
+                    if (ex != null) {
+                        if (isRetriable(ex)) {
+                            LOG.debug("Failed to reset peers. Retrying 
[groupId={}]. ", replicaGrpId, ex);

Review Comment:
   I'd also add a counter and add warn logging on each 100 or 1000, just in 
case.



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to