Tests in HistoricalRebalanceTwoPartsInDifferentCheckpointsTest class are technically flaky. Fixes
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache.distributed.dht.preloader;
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 @@ public class HistoricalRebalanceTwoPartsInDifferentCheckpointsTest extends GridC
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 @@ public class HistoricalRebalanceTwoPartsInDifferentCheckpointsTest extends GridC
info("Node stopped.");
+ IgniteCache cache = ignite0.cache(DEFAULT_CACHE_NAME);
+
for (Integer key : partKeys) {
cache.put(key, key + 1);
