SammyVimes commented on code in PR #1579:
URL: https://github.com/apache/ignite-3/pull/1579#discussion_r1087816407
##########
modules/replicator/src/main/java/org/apache/ignite/internal/replicator/ReplicaManager.java:
##########
@@ -217,20 +217,24 @@ private Replica startReplicaInternal(
ReplicationGroupId replicaGrpId,
ReplicaListener listener
) {
+ Replica newReplica = new Replica(replicaGrpId, listener);
+
replicas.compute(replicaGrpId, (replicationGroupId, replicaFut) -> {
if (replicaFut == null) {
- replicaFut = CompletableFuture.completedFuture(new
Replica(replicaGrpId, listener));
-
- return replicaFut;
+ return CompletableFuture.completedFuture(newReplica);
} else {
- replicaFut.complete(new Replica(replicaGrpId, listener));
+ if (replicaFut.isDone() && !replicaFut.isCancelled() &&
!replicaFut.isCompletedExceptionally()) {
Review Comment:
Sure: if we are doing rebalancing and `STABLE_ASSIGNMENTS_*` key changed in
metastorage, then we need to decide if replica must be stopped. We will stop it
only if the node is not in stableAssignments and not in pendingAssignments. We
do start replica on `PENDING_ASSIGNMENTS_*` change and in
`updateAssignmentInternal()` (which is called before rebalance), so the replica
may be not stopped.
--
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]