sashapolo commented on code in PR #5300: URL: https://github.com/apache/ignite-3/pull/5300#discussion_r1976585825
########## modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/PartitionReplicaLifecycleManager.java: ########## @@ -1316,45 +1331,51 @@ public CompletableFuture<Void> stopAsync(ComponentContext componentContext) { return Assignments.fromBytes(entry.value()); } - private CompletableFuture<Void> weakStopAndDestroyPartition(ZonePartitionId zonePartitionId, long revision) { - return replicaMgr.weakStopReplica( - zonePartitionId, - WeakReplicaStopReason.EXCLUDED_FROM_ASSIGNMENTS, - () -> stopPartition(zonePartitionId).thenCompose(replicaWasStopped -> { - if (!replicaWasStopped) { - return nullCompletedFuture(); - } - - zoneResourcesManager.destroyZonePartitionResources(zonePartitionId); - - return fireEvent( - LocalPartitionReplicaEvent.AFTER_REPLICA_DESTROYED, - new LocalPartitionReplicaEventParameters(zonePartitionId, revision) - ); - }) - ); - } - /** - * Stops all resources associated with a given partition, like replicas and partition trackers. + * Stops zone replica, executes a given action and fires a given local event after if are not null. + * + * @param zonePartitionId Zone's replication group identifier. + * @param afterReplicaStopAction A consumer that will be executed if it is not null after zone replica stop process will be finished and + * stopping result will be given to the consumer. + * @param afterReplicaStoppedEvent A local event type that if not null should be fired in the end of the method. + * @param afterReplicaStoppedEventRevision A revision parameter of the local event if the last is presented. Must not be null if the + * event isn't null too. * - * @param zonePartitionId Partition ID. - * @return Future that will be completed after all resources have been closed and the future's result answers was replica was stopped - * correctly or not. + * @return Future that will be completed after zone replica was stopped and all given non-null actions are done, the future's result + * answers was replica was stopped correctly or not. */ - private CompletableFuture<Boolean> stopPartition(ZonePartitionId zonePartitionId) { + private CompletableFuture<Boolean> stopPartitionInternal( + ZonePartitionId zonePartitionId, + @Nullable Consumer<Boolean> afterReplicaStopAction, Review Comment: yes -- 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