alievmirza commented on code in PR #5716:
URL: https://github.com/apache/ignite-3/pull/5716#discussion_r2066129099


##########
modules/table/src/integrationTest/java/org/apache/ignite/internal/table/distributed/disaster/AbstractHighAvailablePartitionsRecoveryTest.java:
##########
@@ -155,9 +155,15 @@ private void assertRecoveryRequestForZoneTable(IgniteImpl 
node, String zoneName,
         int zoneId = catalog.zone(zoneName).id();
         int tableId = catalog.table(SCHEMA_NAME, tableName).id();
 
-        assertEquals(zoneId, request.zoneId());
-        assertEquals(of(tableId, PARTITION_IDS), request.partitionIds());
-        assertFalse(request.manualUpdate());
+        if (enabledColocation()) {
+            assertEquals(zoneId, request.zoneId());
+            assertEquals(of(zoneId, PARTITION_IDS), request.partitionIds());
+            assertFalse(request.manualUpdate());
+        } else {
+            assertEquals(zoneId, request.zoneId());
+            assertEquals(of(tableId, PARTITION_IDS), request.partitionIds());
+            assertFalse(request.manualUpdate());

Review Comment:
   done



##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/disaster/DisasterRecoveryManager.java:
##########
@@ -309,9 +315,46 @@ private CompletableFuture<Boolean> 
onHaZoneTopologyReduce(HaZoneTopologyUpdateEv
         }
     }
 
-    private Set<Assignment> 
stableAssignmentsWithOnlyAliveNodes(TablePartitionId partitionId, long 
revision) {
-        Set<Assignment> stableAssignments = Assignments.fromBytes(
-                
metaStorageManager.getLocally(stablePartAssignmentsKey(partitionId), 
revision).value()).nodes();
+    private CompletableFuture<Boolean> 
onHaZonePartitionTopologyReduce(HaZoneTopologyUpdateEventParams params) {
+        int zoneId = params.zoneId();
+        long revision = params.causalityToken();
+        long timestamp = 
metaStorageManager.timestampByRevisionLocally(revision).longValue();
+
+        Catalog catalog = catalogManager.activeCatalog(timestamp);
+        CatalogZoneDescriptor zoneDescriptor = catalog.zone(zoneId);
+
+        Set<Integer> partitionsToReset = new HashSet<>();
+
+        for (int partId = 0; partId < zoneDescriptor.partitions(); partId++) {
+            ZonePartitionId partitionId = new ZonePartitionId(zoneId, partId);
+
+            if (stableAssignmentsWithOnlyAliveNodes(partitionId, revision, 
true).size() < calculateQuorum(zoneDescriptor.replicas())) {
+                partitionsToReset.add(partId);
+            }
+        }
+
+        if (!partitionsToReset.isEmpty()) {
+            return resetPartitions(zoneDescriptor.name(), Map.of(zoneId, 
partitionsToReset), false, revision, true).thenApply(r -> false);
+        } else {
+            return falseCompletedFuture();
+        }
+    }
+
+    private Set<Assignment> 
stableAssignmentsWithOnlyAliveNodes(ReplicationGroupId partitionId, long 
revision, boolean colocationEnabled) {
+        Set<Assignment> stableAssignments;
+
+        if (colocationEnabled) {
+            stableAssignments = Assignments.fromBytes(
+                    metaStorageManager.getLocally(
+                            
ZoneRebalanceUtil.stablePartAssignmentsKey((ZonePartitionId) partitionId),
+                            revision
+                    ).value()
+            ).nodes();
+        } else {
+            stableAssignments = Assignments.fromBytes(
+                    
metaStorageManager.getLocally(stablePartAssignmentsKey((TablePartitionId) 
partitionId), revision).value()

Review Comment:
   done



-- 
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

Reply via email to