sanpwc commented on code in PR #6053:
URL: https://github.com/apache/ignite-3/pull/6053#discussion_r2541499892
##########
modules/replicator/src/main/java/org/apache/ignite/internal/replicator/ReplicaManager.java:
##########
@@ -788,7 +794,73 @@ public CompletableFuture<Replica>
replica(ReplicationGroupId replicationGroupId)
*/
public void resetPeers(ReplicationGroupId replicaGrpId, PeersAndLearners
peersAndLearners, long sequenceToken) {
RaftNodeId raftNodeId = new RaftNodeId(replicaGrpId, new
Peer(localNodeConsistentId));
- ((Loza) raftManager).resetPeers(raftNodeId, peersAndLearners,
sequenceToken);
+ Loza loza = (Loza) raftManager;
+ Status status = loza.resetPeers(raftNodeId, peersAndLearners,
sequenceToken);
+
+ // Stale configuration change will not be retried.
+ if (!status.isOk() && status.getRaftError() == RaftError.ESTALE) {
+ // TODO: proper error.
+ throw new IgniteException(INTERNAL_ERR, new
RaftException(status.getRaftError(), status.getErrorMsg()));
+ }
+ }
+
+ /**
+ * Performs a {@code resetPeers} operation on raft node with retries.
+ *
+ * @param replicaGrpId Replication group ID.
+ * @param peersAndLearners New peers and learners.
+ * @param sequenceToken Sequence token.
+ */
+ public CompletableFuture<Void> resetWithRetry(ReplicationGroupId
replicaGrpId, PeersAndLearners peersAndLearners, long sequenceToken) {
+ var result = new CompletableFuture<Void>();
+
+ resetWithRetry(replicaGrpId, peersAndLearners, result, sequenceToken,
1);
+
+ return result;
+ }
+
+ private void resetWithRetry(
Review Comment:
Please add a comment explaining why it's safe to perform resetWithRetry in
async manner without awaiting the result.
--
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]