You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sa...@apache.org on 2025/05/16 04:44:18 UTC

(ignite-3) branch main updated: IGNITE-25381 Fix several ItDisasterRecoveryReconfigurationTest tests. (#5813)

This is an automated email from the ASF dual-hosted git repository.

sanpwc pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new 3b9e19d3778 IGNITE-25381 Fix several ItDisasterRecoveryReconfigurationTest tests. (#5813)
3b9e19d3778 is described below

commit 3b9e19d37783f96d9404bbb348340cdcfbe34f4e
Author: Alexander Lapin <la...@gmail.com>
AuthorDate: Fri May 16 07:44:12 2025 +0300

    IGNITE-25381 Fix several ItDisasterRecoveryReconfigurationTest tests. (#5813)
---
 .../ItDisasterRecoveryReconfigurationTest.java     | 25 ++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/modules/transactions/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoveryReconfigurationTest.java b/modules/transactions/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoveryReconfigurationTest.java
index 3de9d90320b..30f05f46ae9 100644
--- a/modules/transactions/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoveryReconfigurationTest.java
+++ b/modules/transactions/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoveryReconfigurationTest.java
@@ -945,6 +945,13 @@ public class ItDisasterRecoveryReconfigurationTest extends ClusterPerTestIntegra
 
         stopNode(4);
 
+        // Given block of assignment stable switch halts rebalances and thus provides an ability to verify pending and planned assignments.
+        // Without the block test may fail because rebalance may finish prior to corresponding check. In other words given block eliminates
+        // the race between rebalance and assignments verifications that we do below.
+        // Worth mentioning that assignments stable switch ignores force flag, thus within blocked assignments force = false is used.
+        Assignments assignmentToBlock = Assignments.of(Set.of(Assignment.forPeer(node(1).name())), timestamp);
+        blockRebalanceStableSwitch(partId, assignmentToBlock);
+
         DisasterRecoveryManager disasterRecoveryManager = node0.disasterRecoveryManager();
         CompletableFuture<Void> resetFuture =
                 TestDisasterRecoveryUtils.resetPartitions(disasterRecoveryManager, zoneName, SCHEMA_NAME, TABLE_NAME, emptySet(), false, 1);
@@ -1071,6 +1078,13 @@ public class ItDisasterRecoveryReconfigurationTest extends ClusterPerTestIntegra
         // Unblock raft.
         blockedNodes.clear();
 
+        // Given block of assignment stable switch halts rebalances and thus provides an ability to verify pending and planned assignments.
+        // Without the block test may fail because rebalance may finish prior to corresponding check. In other words given block eliminates
+        // the race between rebalance and assignments verifications that we do below.
+        // Worth mentioning that assignments stable switch ignores force flag, thus within blocked assignments force = false is used.
+        Assignments assignmentToBlock = Assignments.of(Set.of(Assignment.forPeer(leaderName)), timestamp);
+        blockRebalanceStableSwitch(partId, assignmentToBlock);
+
         DisasterRecoveryManager disasterRecoveryManager = node0.disasterRecoveryManager();
         CompletableFuture<?> updateFuture =
                 TestDisasterRecoveryUtils.resetPartitions(disasterRecoveryManager, zoneName, SCHEMA_NAME, TABLE_NAME, emptySet(), true, -1);
@@ -1201,13 +1215,20 @@ public class ItDisasterRecoveryReconfigurationTest extends ClusterPerTestIntegra
         List<String> nodesNamesForFinalAssignments = new ArrayList<>(clusterNodeNames);
         nodesNamesForFinalAssignments.removeAll(nodeNamesToStop);
 
+        String pendingNodeName = getPendingNodeName(nodesNamesForFinalAssignments, blockedNode);
+
+        // Given block of assignment stable switch halts rebalances and thus provides an ability to verify pending and planned assignments.
+        // Without the block test may fail because rebalance may finish prior to corresponding check. In other words given block eliminates
+        // the race between rebalance and assignments verifications that we do below.
+        // Worth mentioning that assignments stable switch ignores force flag, thus within blocked assignments force = false is used.
+        Assignments assignmentsToBlock = Assignments.of(Set.of(Assignment.forPeer(pendingNodeName)), timestamp);
+        blockRebalanceStableSwitch(partId, assignmentsToBlock);
+
         DisasterRecoveryManager disasterRecoveryManager = node0.disasterRecoveryManager();
         CompletableFuture<?> updateFuture =
                 TestDisasterRecoveryUtils.resetPartitions(disasterRecoveryManager, zoneName, SCHEMA_NAME, TABLE_NAME, emptySet(), false, 1);
         assertThat(updateFuture, willCompleteSuccessfully());
 
-        String pendingNodeName = getPendingNodeName(nodesNamesForFinalAssignments, blockedNode);
-
         // Pending is the one with the most up to date log index.
         Assignments assignmentPending = Assignments.forced(Set.of(Assignment.forPeer(pendingNodeName)), timestamp);