sashapolo commented on code in PR #5179:
URL: https://github.com/apache/ignite-3/pull/5179#discussion_r1948645004
##########
modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/PartitionReplicaLifecycleManager.java:
##########
@@ -491,27 +512,43 @@ private CompletableFuture<?>
createZonePartitionReplicationNode(
);
Supplier<CompletableFuture<Boolean>> startReplicaSupplier = () -> {
- try {
- return replicaMgr.startReplica(
- zonePartitionId,
- raftClient -> new ZonePartitionReplicaListener(
- new
ExecutorInclinedRaftCommandRunner(raftClient, partitionOperationsExecutor)),
- new FailFastSnapshotStorageFactory(),
- stablePeersAndLearners,
- raftGroupListener,
- raftGroupEventsListener,
- busyLock
- ).thenCompose(replica ->
executeUnderZoneWriteLock(zonePartitionId.zoneId(), () -> {
- replicationGroupIds.add(zonePartitionId);
-
- var eventParams = new
LocalPartitionReplicaEventParameters(zonePartitionId, revision);
-
- return
fireEvent(LocalPartitionReplicaEvent.AFTER_REPLICA_STARTED, eventParams);
- }))
- .thenApply(unused -> false);
- } catch (NodeStoppingException e) {
- return failedFuture(e);
- }
+ var eventParams = new
LocalPartitionReplicaEventParameters(zonePartitionId, revision);
+
+ return
fireEvent(LocalPartitionReplicaEvent.BEFORE_REPLICA_STARTED, eventParams)
+ .thenCompose(v -> {
+ try {
+ return replicaMgr.startReplica(
+ zonePartitionId,
+ raftClient -> {
+ var runner = new
ExecutorInclinedRaftCommandRunner(raftClient, partitionOperationsExecutor);
+
+ var replicaListener = new
ZonePartitionReplicaListener(runner);
+
+
listeners.replicaListenerFuture.complete(replicaListener);
+
+ return replicaListener;
+ },
+ new FailFastSnapshotStorageFactory(),
+ stablePeersAndLearners,
+ raftGroupListener,
+ raftGroupEventsListener,
+ busyLock
+ );
+ } catch (NodeStoppingException e) {
+ return failedFuture(e);
+ }
+ })
+ .thenCompose(replica ->
executeUnderZoneWriteLock(zonePartitionId.zoneId(), () -> {
+ replicationGroupIds.add(zonePartitionId);
+
+ return
fireEvent(LocalPartitionReplicaEvent.AFTER_REPLICA_STARTED, eventParams);
+ }))
+ .whenComplete((v, e) -> {
+ if (e != null) {
+ listenersByZonePartitionId.remove(zonePartitionId);
Review Comment:
Thank you for the clarification. I don't really know how to deal with this
case correctly. What is the expected behavior? I think that now the node will
simply die immediately, because we will have an exception in the meta storage
thread and `loadTableListenerToZoneReplica` will not be called at all. Overall,
I added this code just as a safety measure and most likely not needed at all.
What do you think, shall I remove it?
--
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]