/** * Activates grid if necessary and wait for partition map exchange. */ private void afterGridStarted() throws InterruptedException { G.allGrids().stream() .filter(g -> !g.cluster().node().isClient()) .findAny() .filter(g -> !g.cluster().active()) .ifPresent(g -> g.cluster().active(true)); awaitPartitionMapExchange(); }
/** * @param groupName Group name. * @throws Exception If failed. */ private void testStopCachesOnDeactivation(String groupName) throws Exception { Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-10582", MvccFeatureChecker.forcedMvcc()); performTest(ig -> { ig.cluster().active(false); // Add to escape possible long waiting in awaitPartitionMapExchange due to {@link CacheAffinityChangeMessage}. ig.cluster().active(true); return null; }, groupName); }
/** * Test deactivation works via control.sh * * @throws Exception If failed. */ @Test public void testDeactivate() throws Exception { Ignite ignite = startGrids(1); assertFalse(ignite.cluster().active()); ignite.cluster().active(true); assertTrue(ignite.cluster().active()); assertEquals(EXIT_CODE_OK, execute("--deactivate")); assertFalse(ignite.cluster().active()); }
/** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { cleanPersistenceDir(); super.beforeTestsStarted(); clientGrid().cluster().active(true); }
/** * Test baseline collect works via control.sh * * @throws Exception If failed. */ @Test public void testBaselineCollect() throws Exception { Ignite ignite = startGrids(1); assertFalse(ignite.cluster().active()); ignite.cluster().active(true); assertEquals(EXIT_CODE_OK, execute("--baseline")); assertEquals(1, ignite.cluster().currentBaselineTopology().size()); }
/** * */ @Test public void testCacheResetLostPartitions() throws Exception { Ignite ignite = startGrids(2); ignite.cluster().active(true); createCacheAndPreload(ignite, 100); injectTestSystemOut(); assertEquals(EXIT_CODE_OK, execute("--cache", "reset_lost_partitions", "ignite-sys-cache,default")); final String log = testOut.toString(); assertTrue(log.contains("Reset LOST-partitions performed successfully. Cache group (name = 'ignite-sys-cache'")); assertTrue(log.contains("Reset LOST-partitions performed successfully. Cache group (name = 'default'")); }
/** * Test cluster active state works via control.sh * * @throws Exception If failed. */ @Test public void testState() throws Exception { Ignite ignite = startGrids(1); assertFalse(ignite.cluster().active()); assertEquals(EXIT_CODE_OK, execute("--state")); ignite.cluster().active(true); assertEquals(EXIT_CODE_OK, execute("--state")); }
/** * Test destroy grouped caches. * * @throws Exception If failed. */ @Test public void testDestroyGroupCaches() throws Exception { Ignite ignite = startGrids(NODES); ignite.cluster().active(true); startGroupCachesDynamically(ignite); checkDestroyCaches(ignite); }
/** * Test destroy non grouped caches. * * @throws Exception If failed. */ @Test public void testDestroyCaches() throws Exception { Ignite ignite = startGrids(NODES); ignite.cluster().active(true); startCachesDynamically(ignite); checkDestroyCaches(ignite); }
/** * Test destroy caches abruptly with checkpoints. * * @throws Exception If failed. */ @Test public void testDestroyCachesAbruptly() throws Exception { Ignite ignite = startGrids(NODES); ignite.cluster().active(true); startCachesDynamically(ignite); checkDestroyCachesAbruptly(ignite); }
/** * Test destroy group caches abruptly with checkpoints. * * @throws Exception If failed. */ @Test public void testDestroyGroupCachesAbruptly() throws Exception { Ignite ignite = startGrids(NODES); ignite.cluster().active(true); startGroupCachesDynamically(ignite); checkDestroyCachesAbruptly(ignite); } }
/** * @throws Exception If failed. */ @Test public void testVacuumNotStartedWithoutMvccPersistence() throws Exception { persistence = true; IgniteConfiguration cfg = getConfiguration("grid1"); Ignite node = startGrid(cfg); ensureNoVacuum(node); node.cluster().active(true); ensureNoVacuum(node); }
/** * Test baseline set by topology version works via control.sh * * @throws Exception If failed. */ @Test public void testBaselineVersion() throws Exception { Ignite ignite = startGrids(1); assertFalse(ignite.cluster().active()); ignite.cluster().active(true); startGrid(2); assertEquals(EXIT_CODE_OK, execute("--baseline")); assertEquals(EXIT_CODE_OK, execute("--baseline", "version", String.valueOf(ignite.cluster().topologyVersion()))); assertEquals(2, ignite.cluster().currentBaselineTopology().size()); }
/** * Test destroy group caches with disabled checkpoints. * * @throws Exception If failed. */ @Test public void testDestroyGroupCachesAbruptlyWithoutCheckpoints() throws Exception { Ignite ignite = startGrids(NODES); ignite.cluster().active(true); startGroupCachesDynamically(ignite); disableCheckpoints(); checkDestroyCachesAbruptly(ignite); }
/** * Test destroy caches with disabled checkpoints. * * @throws Exception If failed. */ @Test public void testDestroyCachesAbruptlyWithoutCheckpoints() throws Exception { Ignite ignite = startGrids(NODES); ignite.cluster().active(true); startCachesDynamically(ignite); disableCheckpoints(); checkDestroyCachesAbruptly(ignite); }
/** * Test baseline add items works via control.sh * * @throws Exception If failed. */ @Test public void testBaselineAdd() throws Exception { Ignite ignite = startGrids(1); assertFalse(ignite.cluster().active()); ignite.cluster().active(true); Ignite other = startGrid(2); assertEquals(EXIT_CODE_OK, execute("--baseline", "add", consistentIds(other))); assertEquals(EXIT_CODE_OK, execute("--baseline", "add", consistentIds(other))); assertEquals(2, ignite.cluster().currentBaselineTopology().size()); }
/** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { super.beforeTest(); cleanPersistenceDir(); Ignite ig = startGrid(); ig.cluster().active(true); try (IgniteDataStreamer<Integer, byte[]> st = ig.dataStreamer(DEFAULT_CACHE_NAME)){ st.allowOverwrite(true); byte[] payload = new byte[1024]; // Generate WAL segment files. for (int i = 0; i < 100 * 1024; i++) st.addData(i, payload); } }
/** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { cleanPersistenceDir(); startGrid(config(SRV_1, false, filterOnCrd)); startGrid(config(SRV_2, false, false)); startGrid(config(SRV_3, false, !filterOnCrd)); Ignite cli = startGrid(config(CLI, true, false)); cli.cluster().active(true); }
/** * @throws Exception If failed. */ @Test public void testNonPersistentCachesIgnoreBaselineTopology() throws Exception { Ignite ig = startGrids(4); ig.cluster().active(true); IgniteCache persistentCache = ig.createCache(CACHE_NAME); IgniteCache inMemoryCache = ig.createCache( new CacheConfiguration<>().setName(CACHE_NAME + 2).setDataRegionName("memory")); Ignite newNode = startGrid(4); awaitPartitionMapExchange(); assertEquals(0, ig.affinity(persistentCache.getName()).allPartitions(newNode.cluster().localNode()).length); assertTrue(ig.affinity(inMemoryCache.getName()).allPartitions(newNode.cluster().localNode()).length > 0); }