use of org.apache.ignite.internal.util.distributed.FullMessage in project ignite by apache.
the class IgniteClusterSnapshotSelfTest method testBltChangeDuringClusterSnapshot.
/**
* @throws Exception If fails.
*/
@Test
public void testBltChangeDuringClusterSnapshot() throws Exception {
IgniteEx ignite = startGridsWithCache(3, dfltCacheCfg, CACHE_KEYS_RANGE);
startGrid(3);
long topVer = ignite.cluster().topologyVersion();
BlockingCustomMessageDiscoverySpi spi = discoSpi(ignite);
spi.block((msg) -> msg instanceof FullMessage);
IgniteFuture<Void> fut = ignite.snapshot().createSnapshot(SNAPSHOT_NAME);
spi.waitBlocked(10_000L);
// Not baseline node joins successfully.
String grid4Dir = folderName(startGrid(4));
// Not blt node left the cluster and snapshot not affected.
stopGrid(4);
// Client node must connect successfully.
startClientGrid(4);
// Changing baseline complete successfully.
ignite.cluster().setBaselineTopology(topVer);
spi.unblock();
fut.get();
assertTrue("Snapshot directory must be empty for node 0 due to snapshot future fail: " + grid4Dir, !searchDirectoryRecursively(snp(ignite).snapshotLocalDir(SNAPSHOT_NAME).toPath(), grid4Dir).isPresent());
}
use of org.apache.ignite.internal.util.distributed.FullMessage in project ignite by apache.
the class IgniteClusterSnapshotSelfTest method testRejectCacheStopDuringClusterSnapshot.
/**
* @throws Exception If fails.
*/
@Test
public void testRejectCacheStopDuringClusterSnapshot() throws Exception {
// Block the full message, so cluster-wide snapshot operation would not be fully completed.
IgniteEx ignite = startGridsWithCache(3, dfltCacheCfg, CACHE_KEYS_RANGE);
BlockingCustomMessageDiscoverySpi spi = discoSpi(ignite);
spi.block((msg) -> {
if (msg instanceof FullMessage) {
FullMessage<?> msg0 = (FullMessage<?>) msg;
assertEquals("Snapshot distributed process must be used", DistributedProcess.DistributedProcessType.START_SNAPSHOT.ordinal(), msg0.type());
assertTrue("Snapshot has to be finished successfully on all nodes", msg0.error().isEmpty());
return true;
}
return false;
});
IgniteFuture<Void> fut = ignite.snapshot().createSnapshot(SNAPSHOT_NAME);
spi.waitBlocked(10_000L);
// Creating of new caches should not be blocked.
ignite.getOrCreateCache(dfltCacheCfg.setName("default2")).put(1, 1);
forceCheckpoint();
assertThrowsAnyCause(log, () -> {
ignite.destroyCache(DEFAULT_CACHE_NAME);
return 0;
}, IgniteCheckedException.class, SNP_IN_PROGRESS_ERR_MSG);
spi.unblock();
fut.get();
}
use of org.apache.ignite.internal.util.distributed.FullMessage in project ignite by apache.
the class IgniteClusterSnapshotSelfTest method testClusterSnapshotExOnInitiatorLeft.
/**
* @throws Exception If fails.
*/
@Test
public void testClusterSnapshotExOnInitiatorLeft() throws Exception {
IgniteEx ignite = startGridsWithCache(2, dfltCacheCfg, CACHE_KEYS_RANGE);
BlockingCustomMessageDiscoverySpi spi = discoSpi(ignite);
spi.block((msg) -> msg instanceof FullMessage);
IgniteFuture<Void> fut = ignite.snapshot().createSnapshot(SNAPSHOT_NAME);
spi.waitBlocked(10_000L);
ignite.close();
assertThrowsAnyCause(log, fut::get, NodeStoppingException.class, SNP_NODE_STOPPING_ERR_MSG);
}
Aggregations