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

wernerdv pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new 427cb85215b IGNITE-28886 Fix flaky 
IgniteWalRebalanceTest.testWithLocalWalChange and testWithGlobalWalChange 
(#13361)
427cb85215b is described below

commit 427cb85215b530860f028505572c45d1eff61d11
Author: Dmitry Werner <[email protected]>
AuthorDate: Wed Aug 26 17:59:13 2026 +0500

    IGNITE-28886 Fix flaky IgniteWalRebalanceTest.testWithLocalWalChange and 
testWithGlobalWalChange (#13361)
---
 .../persistence/db/wal/IgniteWalRebalanceTest.java | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRebalanceTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRebalanceTest.java
index 61144f41598..9fc56f1395b 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRebalanceTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRebalanceTest.java
@@ -116,6 +116,16 @@ public class IgniteWalRebalanceTest extends 
GridCommonAbstractTest {
     /** Partitions count. */
     private static final int PARTS_CNT = 32;
 
+    /**
+     * Minimal delay in seconds to wait before starting a new cluster 
incarnation so that its
+     * cache version offset (derived from the grid start time with 1-second 
precision, see
+     * GridCacheVersionManager#onLocalJoin) exceeds the offset of the previous 
incarnation,
+     * keeping cache versions monotonic across incarnations. The new 
incarnation writes at a
+     * lower topology version (2) than the previous one reached (4 or 3), so 
the offset must
+     * exceed the previous one by at least 3 seconds; 5 is a safe margin.
+     */
+    private static final int TOP_VER_OFFSET_WAIT_SECS = 5;
+
     /** Block message predicate to set to Communication SPI in node 
configuration. */
     private IgniteBiPredicate<ClusterNode, Message> blockMsgPred;
 
@@ -318,8 +328,15 @@ public class IgniteWalRebalanceTest extends 
GridCommonAbstractTest {
 
         forceCheckpoint();
 
+        long prevGridStart = crd.context().discovery().gridStartTime();
+
         stopAllGrids();
 
+        // Wait for the new incarnation to satisfy the delay required for 
cache version
+        // monotonicity across incarnations (see TOP_VER_OFFSET_WAIT_SECS).
+        GridTestUtils.waitForCondition(() -> (System.currentTimeMillis() - 
prevGridStart) / 1000 >= TOP_VER_OFFSET_WAIT_SECS,
+            getTestTimeout());
+
         IgniteEx ig0 = startGrids(2);
 
         ig0.cluster().state(ACTIVE);
@@ -413,8 +430,15 @@ public class IgniteWalRebalanceTest extends 
GridCommonAbstractTest {
 
         forceCheckpoint();
 
+        long prevGridStart = crd.context().discovery().gridStartTime();
+
         stopAllGrids();
 
+        // Wait for the new incarnation to satisfy the delay required for 
cache version
+        // monotonicity across incarnations (see TOP_VER_OFFSET_WAIT_SECS).
+        GridTestUtils.waitForCondition(() -> (System.currentTimeMillis() - 
prevGridStart) / 1000 >= TOP_VER_OFFSET_WAIT_SECS,
+            getTestTimeout());
+
         // Rewrite data with globally disabled WAL.
         crd = startGrids(2);
 

Reply via email to