Cyrill commented on code in PR #4916: URL: https://github.com/apache/ignite-3/pull/4916#discussion_r1896550398
########## modules/table/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoveryReconfigurationTest.java: ########## @@ -589,6 +612,130 @@ public void testIncompleteRebalanceAfterResetPartitions() throws Exception { }); } + @Test + @ZoneParams(nodes = 5, replicas = 3, partitions = 1) + public void testNewResetOverwritesFlags() throws Exception { + int partId = 0; + + IgniteImpl node0 = igniteImpl(0); + + int catalogVersion = node0.catalogManager().latestCatalogVersion(); + long timestamp = node0.catalogManager().catalog(catalogVersion).time(); + + awaitPrimaryReplica(node0, partId); + + assertRealAssignments(node0, partId, 0, 1, 4); + + stopNodesInParallel(1, 4); + waitForScale(node0, 3); + + assertRealAssignments(node0, partId, 0, 2, 3); + + Assignments assignments = Assignments.of(timestamp, + Assignment.forPeer(node(0).name()), + Assignment.forPeer(node(2).name()), + Assignment.forPeer(node(3).name()) + ); + + blockRebalanceStableSwitch(partId, assignments); + + // Reset produces + // pending = [0, force] + // planned = [0, 2, 3] + CompletableFuture<Void> resetFuture = node0.disasterRecoveryManager().resetAllPartitions(zoneName, QUALIFIED_TABLE_NAME, true); + assertThat(resetFuture, willCompleteSuccessfully()); + + waitForPartitionState(node0, partId, GlobalPartitionStateEnum.AVAILABLE); + + // fromReset == true, assert force == false. + Assignments assignmentsPending = Assignments.of(Set.of( + Assignment.forPeer(node(0).name()), + Assignment.forPeer(node(2).name()), + Assignment.forPeer(node(3).name()) + ), timestamp, true); + + assertPendingAssignments(node0, partId, assignmentsPending); + + // Any of 3 can be chosen the node for the forced pending, so block them all. + Assignments blockedRebalance0 = Assignments.of(timestamp, + Assignment.forPeer(node(0).name()) + ); + blockRebalanceStableSwitch(partId, blockedRebalance0); + + Assignments blockedRebalance2 = Assignments.of(timestamp, + Assignment.forPeer(node(2).name()) + ); + blockRebalanceStableSwitch(partId, blockedRebalance2); + + Assignments blockedRebalance3 = Assignments.of(timestamp, + Assignment.forPeer(node(3).name()) + ); + blockRebalanceStableSwitch(partId, blockedRebalance3); + + CompletableFuture<Void> resetFuture2 = node0.disasterRecoveryManager().resetAllPartitions(zoneName, QUALIFIED_TABLE_NAME, true); + assertThat(resetFuture2, willCompleteSuccessfully()); + + Assignments pendingAssignments = getPendingAssignments(node0, partId); + + assertTrue(pendingAssignments.force()); + assertFalse(pendingAssignments.fromReset()); + } + + @Test + @ZoneParams(nodes = 5, replicas = 3, partitions = 1) + public void testPlanningIsOverwritten() throws Exception { 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