IGNITE-15376 Tests in HistoricalRebalanceTwoPartsInDifferentCheckpointsTest class are technically flaky. Fixes #9356
Signed-off-by: Slava Koptilin <slava.koptilin@gmail.com>
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/HistoricalRebalanceTwoPartsInDifferentCheckpointsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/HistoricalRebalanceTwoPartsInDifferentCheckpointsTest.java
index d31ec30..2b422d2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/HistoricalRebalanceTwoPartsInDifferentCheckpointsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/HistoricalRebalanceTwoPartsInDifferentCheckpointsTest.java
@@ -20,6 +20,7 @@
import java.util.LinkedHashSet;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
@@ -111,9 +112,12 @@
partKeys.addAll(partitionKeys(ignite0.cache(DEFAULT_CACHE_NAME), 0, 10, 0));
}
- IgniteCache cache = ignite0.cache(DEFAULT_CACHE_NAME);
-
- partKeys.forEach(key -> cache.put(key, key));
+ // Need to guarantee that all updates will be delivered to all nodes including backups.
+ // The reason for that requirement is the fact that historical rebalance is never used for "empty" partitions.
+ // It can be achieved by using full_sync write sync mode or by using a data streamer with allowOverwrite == false.
+ try (IgniteDataStreamer streamer = ignite0.dataStreamer(DEFAULT_CACHE_NAME)) {
+ partKeys.forEach(key -> streamer.addData(key, key));
+ }
info("Data preload completed.");
@@ -123,6 +127,8 @@
info("Node stopped.");
+ IgniteCache cache = ignite0.cache(DEFAULT_CACHE_NAME);
+
for (Integer key : partKeys) {
cache.put(key, key + 1);