use of org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.PARTITION_STATE_FAILED_MSG in project ignite by apache.
the class DiagnosticLogForPartitionStatesTest method doTest.
/**
* @param cfgs Cache configurations.
* @param msgExp {@code true} if warning message is expected.
* @throws Exception If failed.
*/
private void doTest(List<CacheConfiguration<Integer, Integer>> cfgs, boolean msgExp) throws Exception {
String name = (cfgs.size() == 1) ? cfgs.get(0).getName() : cfgs.get(0).getGroupName();
LogListener lsnr = LogListener.matches(s -> s.startsWith(String.format(PARTITION_STATE_FAILED_MSG, name, ANY_MSG))).times(msgExp ? 1 : 0).build();
log.registerListener(lsnr);
IgniteEx node1 = startGrid(0);
IgniteEx node2 = startGrid(1);
node1.cluster().active(true);
List<IgniteCache<Integer, Integer>> caches = cfgs.stream().map(cfg -> node1.getOrCreateCache(cfg)).collect(Collectors.toList());
Map<String, Set<Integer>> clearKeys = new HashMap<>();
for (IgniteCache<Integer, Integer> cache : caches) {
String cacheName = cache.getName();
Set<Integer> clr = new HashSet<>();
for (int i = 0; i < 100; i++) {
cache.put(i, i);
if (node2.affinity(cacheName).isPrimary(node2.localNode(), i))
clr.add(i);
}
clearKeys.put(cacheName, clr);
}
for (IgniteCache<Integer, Integer> c : caches) {
node2.context().cache().cache(c.getName()).clearLocallyAll(clearKeys.get(c.getName()), true, true, true);
}
// Trigger partition map exchange and therefore trigger partitions validation.
startGrid(2);
awaitPartitionMapExchange();
assertTrue(lsnr.check());
}
Aggregations