alievmirza commented on code in PR #5598: URL: https://github.com/apache/ignite-3/pull/5598#discussion_r2039697249
########## modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/PartitionReplicaLifecycleManager.java: ########## @@ -1542,6 +1558,42 @@ public void unloadTableResourcesFromZoneReplica(ZonePartitionId zonePartitionId, zoneResourcesManager.removeTableResources(zonePartitionId, tableId); } + /** + * Restarts the zone's partition including the replica and raft node. + * + * @param zonePartitionId Zone's partition that needs to be restarted. + * @param revision Metastore revision. + * @return Operation future. + */ + public CompletableFuture<?> restartPartition(ZonePartitionId zonePartitionId, long revision, long assignmentsTimestamp) { + return inBusyLockAsync(busyLock, () -> stopPartitionForRestart(zonePartitionId, revision).thenComposeAsync(unused -> { + Assignments stableAssignments = zoneStableAssignmentsGetLocally(metaStorageMgr, zonePartitionId, revision); + + assert stableAssignments != null : "zonePartitionId=" + zonePartitionId + ", revision=" + revision; + + return waitForMetadataCompleteness(assignmentsTimestamp).thenCompose(unused2 -> inBusyLockAsync(busyLock, () -> { + Assignment localMemberAssignment = localMemberAssignment(stableAssignments); + + if (localMemberAssignment == null) { + // (0) in case if node not in the assignments Review Comment: nullCompletedFuture ########## modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/PartitionReplicaLifecycleManager.java: ########## @@ -1591,6 +1643,15 @@ private CompletableFuture<Void> stopAndDestroyPartition(ZonePartitionId zonePart ).thenApply(replicaWasStopped -> null); } + private CompletableFuture<Void> stopPartition(ZonePartitionId zonePartitionId, long revision) { Review Comment: done ########## modules/table/src/main/java/org/apache/ignite/internal/table/distributed/disaster/DisasterRecoveryManager.java: ########## @@ -460,6 +465,44 @@ public CompletableFuture<Void> restartPartitions( } } + /** + * Restarts replica service and raft group of passed partitions. + * + * @param nodeNames Names specifying nodes to restart partitions. Case-sensitive, empty set means "all nodes". + * @param zoneName Name of the distribution zone. Case-sensitive, without quotes. + * @param partitionIds IDs of partitions to restart. If empty, restart all zone's partitions. + * @return Future that completes when partitions are restarted. + */ + public CompletableFuture<Void> restartPartitions( + Set<String> nodeNames, + String zoneName, + Set<Integer> partitionIds + ) { + try { + // Validates passed node names. + getNodes(nodeNames); + + Catalog catalog = catalogLatestVersion(); + + CatalogZoneDescriptor zone = zoneDescriptor(catalog, zoneName); + + checkPartitionsRange(partitionIds, Set.of(zone)); + + return processNewRequest(new ManualGroupRestartRequest( + UUID.randomUUID(), + zone.id(), + // We pass here -1 as table id because it is not used for zone-based partitions. + // We expect that the field will be removed once colocation track is finished. + -1, Review Comment: added -- 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