You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "Cyrill (via GitHub)" <gi...@apache.org> on 2025/11/13 16:10:43 UTC

Re: [PR] IGNITE-25543 Implement retry mechanism for reset [ignite-3]

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


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

Review Comment:
   renamed it



##########
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, () -> {

Review Comment:
   Fixed by introducing sequence tokens



-- 
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-unsubscribe@ignite.apache.org

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