use of org.apache.ignite.internal.processors.cache.verify.IdleVerifyResultV2 in project ignite by apache.
the class IgniteClusterSnapshotCheckTest method testClusterSnapshotCheckMissedGroup.
/**
* @throws Exception If fails.
*/
@Test
public void testClusterSnapshotCheckMissedGroup() throws Exception {
IgniteEx ignite = startGridsWithCache(3, dfltCacheCfg, CACHE_KEYS_RANGE);
ignite.snapshot().createSnapshot(SNAPSHOT_NAME).get();
Path dir = Files.walk(snp(ignite).snapshotLocalDir(SNAPSHOT_NAME).toPath()).filter(d -> d.toFile().getName().equals(cacheDirName(dfltCacheCfg))).findFirst().orElseThrow(() -> new RuntimeException("Cache directory not found"));
assertTrue(dir.toString(), dir.toFile().exists());
assertTrue(U.delete(dir));
IdleVerifyResultV2 res = snp(ignite).checkSnapshot(SNAPSHOT_NAME).get();
StringBuilder b = new StringBuilder();
res.print(b::append, true);
assertFalse(F.isEmpty(res.exceptions()));
assertContains(log, b.toString(), "Snapshot data doesn't contain required cache groups");
}
use of org.apache.ignite.internal.processors.cache.verify.IdleVerifyResultV2 in project ignite by apache.
the class IgniteClusterSnapshotCheckTest method testClusterSnapshotCheckMissedMeta.
/**
* @throws Exception If fails.
*/
@Test
public void testClusterSnapshotCheckMissedMeta() throws Exception {
IgniteEx ignite = startGridsWithCache(3, dfltCacheCfg, CACHE_KEYS_RANGE);
ignite.snapshot().createSnapshot(SNAPSHOT_NAME).get();
File[] smfs = snp(ignite).snapshotLocalDir(SNAPSHOT_NAME).listFiles((dir, name) -> name.toLowerCase().endsWith(SNAPSHOT_METAFILE_EXT));
assertNotNull(smfs);
assertTrue(smfs[0].toString(), smfs[0].exists());
assertTrue(U.delete(smfs[0]));
IdleVerifyResultV2 res = snp(ignite).checkSnapshot(SNAPSHOT_NAME).get();
StringBuilder b = new StringBuilder();
res.print(b::append, true);
assertFalse(F.isEmpty(res.exceptions()));
assertContains(log, b.toString(), "Some metadata is missing from the snapshot");
}
use of org.apache.ignite.internal.processors.cache.verify.IdleVerifyResultV2 in project ignite by apache.
the class IgniteClusterSnapshotCheckTest method testClusterSnapshotCheckWithNodeFilter.
/**
* @throws Exception If fails.
*/
@Test
public void testClusterSnapshotCheckWithNodeFilter() throws Exception {
IgniteEx ig0 = startGridsWithoutCache(3);
for (int i = 0; i < CACHE_KEYS_RANGE; i++) {
ig0.getOrCreateCache(txCacheConfig(new CacheConfiguration<Integer, Integer>(DEFAULT_CACHE_NAME)).setNodeFilter(node -> node.consistentId().toString().endsWith("0"))).put(i, i);
}
ig0.snapshot().createSnapshot(SNAPSHOT_NAME).get();
IdleVerifyResultV2 res = snp(ig0).checkSnapshot(SNAPSHOT_NAME).get();
StringBuilder b = new StringBuilder();
res.print(b::append, true);
assertTrue(F.isEmpty(res.exceptions()));
assertPartitionsSame(res);
assertContains(log, b.toString(), "The check procedure has finished, no conflicts have been found");
}
use of org.apache.ignite.internal.processors.cache.verify.IdleVerifyResultV2 in project ignite by apache.
the class IgniteClusterSnapshotCheckTest method testClusterSnapshotCheckOtherCluster.
/**
* @throws Exception If fails.
*/
@Test
public void testClusterSnapshotCheckOtherCluster() throws Exception {
IgniteEx ig0 = startGridsWithCache(3, dfltCacheCfg.setAffinity(new RendezvousAffinityFunction(false, 1)), CACHE_KEYS_RANGE);
ig0.snapshot().createSnapshot(SNAPSHOT_NAME).get();
stopAllGrids();
// Cleanup persistence directory except created snapshots.
Arrays.stream(new File(U.defaultWorkDirectory()).listFiles()).filter(f -> !f.getName().equals(DFLT_SNAPSHOT_DIRECTORY)).forEach(U::delete);
Set<UUID> assigns = Collections.newSetFromMap(new ConcurrentHashMap<>());
for (int i = 4; i < 7; i++) {
startGrid(optimize(getConfiguration(getTestIgniteInstanceName(i)).setCacheConfiguration()));
UUID locNodeId = grid(i).localNode().id();
grid(i).context().io().addMessageListener(GridTopic.TOPIC_JOB, new GridMessageListener() {
@Override
public void onMessage(UUID nodeId, Object msg, byte plc) {
if (msg instanceof GridJobExecuteRequest) {
GridJobExecuteRequest msg0 = (GridJobExecuteRequest) msg;
if (msg0.getTaskName().contains(SnapshotPartitionsVerifyTask.class.getName()))
assigns.add(locNodeId);
}
}
});
}
IgniteEx ignite = grid(4);
ignite.cluster().baselineAutoAdjustEnabled(false);
ignite.cluster().state(ACTIVE);
IdleVerifyResultV2 res = snp(ignite).checkSnapshot(SNAPSHOT_NAME).get();
StringBuilder b = new StringBuilder();
res.print(b::append, true);
// GridJobExecuteRequest is not send to the local node.
assertTrue("Number of jobs must be equal to the cluster size (except local node): " + assigns + ", count: " + assigns.size(), waitForCondition(() -> assigns.size() == 2, 5_000L));
assertTrue(F.isEmpty(res.exceptions()));
assertPartitionsSame(res);
assertContains(log, b.toString(), "The check procedure has finished, no conflicts have been found");
}
use of org.apache.ignite.internal.processors.cache.verify.IdleVerifyResultV2 in project ignite by apache.
the class IgniteClusterSnapshotCheckTest method testClusterSnapshotCheckCRCFail.
/**
* @throws Exception If fails.
*/
@Test
public void testClusterSnapshotCheckCRCFail() throws Exception {
IgniteEx ignite = startGridsWithCache(3, dfltCacheCfg.setAffinity(new RendezvousAffinityFunction(false, 1)), CACHE_KEYS_RANGE);
ignite.snapshot().createSnapshot(SNAPSHOT_NAME).get();
corruptPartitionFile(ignite, SNAPSHOT_NAME, dfltCacheCfg, PART_ID);
IdleVerifyResultV2 res = snp(ignite).checkSnapshot(SNAPSHOT_NAME).get();
StringBuilder b = new StringBuilder();
res.print(b::append, true);
assertEquals(1, res.exceptions().size());
assertContains(log, b.toString(), "The check procedure failed on 1 node.");
Exception ex = res.exceptions().values().iterator().next();
assertTrue(X.hasCause(ex, IgniteDataIntegrityViolationException.class));
}
Aggregations