mergeExchangeWaitVersion(srv0, initNodes + threads);
/** * @param nodes Number of nodes to start. * @param withClients If {@code true} starts both servers and clients. * @throws Exception If failed. */ private void startCacheOnJoinAndJoinMerge1(int nodes, boolean withClients) throws Exception { cfgCache = false; final IgniteEx srv0 = startGrid(0); mergeExchangeWaitVersion(srv0, nodes + 1); if (withClients) { clientC = new IgniteClosure<String, Boolean>() { @Override public Boolean apply(String nodeName) { return getTestIgniteInstanceIndex(nodeName) % 2 == 0; } }; } cfgCache = true; IgniteInternalFuture fut = startGridsAsync(srv0, 1, nodes); fut.get(); checkCaches(); }
mergeExchangeWaitVersion(srv0, topVer + 3); mergeExchangeWaitVersion(srv0, topVer + 2);
/** * @throws Exception If failed. */ @Test public void testStartCacheOnJoinAndCoordinatorFailed1() throws Exception { cfgCache = false; final Ignite srv0 = startGrids(2); mergeExchangeWaitVersion(srv0, 5); cfgCache = true; IgniteInternalFuture fut = startGridsAsync(srv0, 2, 2); stopGrid(0); fut.get(); checkCaches(); }
/** * @throws Exception If failed. */ @Test public void testStartCacheOnJoinAndCoordinatorFailed2() throws Exception { cfgCache = false; final Ignite srv0 = startGrid(0); mergeExchangeWaitVersion(srv0, 3); cfgCache = true; IgniteInternalFuture fut = startGridsAsync(srv0, 1, 2); stopGrid(0); fut.get(); checkCaches(); }
/** * @throws Exception If failed. */ @Test public void testMergeAndNewCoordinator() throws Exception { final Ignite srv0 = startGrids(3); mergeExchangeWaitVersion(srv0, 6); IgniteInternalFuture fut = startGridsAsync(srv0, 3, 3); fut.get(); checkCaches(); stopGrid(0); checkCaches(); }
/** * @param srvs Number of server nodes. * @param startNodes Number of nodes to start. * @param blockNodes Nodes which do not receive messages. * @param waitMsgNodes Nodes which should receive messages. * @throws Exception If failed. */ private void mergeJoinExchangeCoordinatorChange2(final int srvs, final int startNodes, List<Integer> blockNodes, List<Integer> waitMsgNodes) throws Exception { testSpi = true; Ignite srv0 = startGrids(srvs); mergeExchangeWaitVersion(srv0, srvs + startNodes); CountDownLatch latch = blockExchangeFinish(srv0, srvs + 1, blockNodes, waitMsgNodes); IgniteInternalFuture<?> fut = startGridsAsync(srv0, srvs, startNodes); if (latch != null && !latch.await(WAIT_SECONDS, TimeUnit.SECONDS)) fail("Failed to wait for expected messages."); stopGrid(getTestIgniteInstanceName(0), true, false); fut.get(); checkCaches(); }
/** * @throws Exception If failed. */ @Test public void testMergeExchangeCoordinatorChange4() throws Exception { testSpi = true; final int srvs = 4; Ignite srv0 = startGrids(srvs); mergeExchangeWaitVersion(srv0, 6); final AtomicInteger idx = new AtomicInteger(srvs); CountDownLatch latch = blockExchangeFinish(srv0, 5, F.asList(1, 2, 3, 4), F.asList(5)); IgniteInternalFuture<?> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() { @Override public Void call() throws Exception { startGrid(idx.getAndIncrement()); return null; } }, 2, "start-node"); if (latch != null && !latch.await(WAIT_SECONDS, TimeUnit.SECONDS)) fail("Failed to wait for expected messages."); stopGrid(getTestIgniteInstanceName(0), true, false); fut.get(); checkCaches(); }
mergeExchangeWaitVersion(srv0, initNodes + threads);
/** * @throws Exception If failed. */ @Test public void testMergeServersJoin1() throws Exception { IgniteEx srv0 = startGrid(0); mergeExchangeWaitVersion(srv0, 3); final AtomicInteger idx = new AtomicInteger(1); IgniteInternalFuture<?> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() { @Override public Void call() throws Exception { startGrid(idx.getAndIncrement()); return null; } }, 2, "start-node"); fut.get(); checkCaches(); checkExchanges(srv0, 1, 3); checkExchanges(ignite(1), 3); checkExchanges(ignite(2), 3); }
/** * @throws Exception If failed. */ @Test public void testMergeServerJoin1ClientsInTopology() throws Exception { IgniteEx srv0 = startGrid(0); client.set(true); startGrid(1); client.set(true); startGrid(2); mergeExchangeWaitVersion(srv0, 5); final AtomicInteger idx = new AtomicInteger(3); IgniteInternalFuture<?> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() { @Override public Void call() throws Exception { startGrid(idx.getAndIncrement()); return null; } }, 2, "start-node"); fut.get(); checkCaches(); checkExchanges(srv0, 1, 2, 3, 5); checkExchanges(ignite(1), 2, 3, 5); checkExchanges(ignite(2), 3, 5); checkExchanges(ignite(3), 5); checkExchanges(ignite(4), 5); }
/** * @param waitRebalance Wait for rebalance end before start tested topology change. * @throws Exception If failed. */ private void mergeServersAndClientsFail(boolean waitRebalance) throws Exception { clientC = new IgniteClosure<String, Boolean>() { @Override public Boolean apply(String nodeName) { return nodeName.equals(getTestIgniteInstanceName(2)) || nodeName.equals(getTestIgniteInstanceName(3)); } }; final Ignite srv0 = startGrids(6); if (waitRebalance) awaitPartitionMapExchange(); mergeExchangeWaitVersion(srv0, 10); stopGrid(getTestIgniteInstanceName(1), true, false); stopGrid(getTestIgniteInstanceName(2), true, false); stopGrid(getTestIgniteInstanceName(3), true, false); stopGrid(getTestIgniteInstanceName(4), true, false); checkAffinity(); mergeExchangeWaitVersion(srv0, 12); IgniteInternalFuture fut = startGridsAsync(srv0, 6, 2); fut.get(); checkCaches(); }
/** * @param waitRebalance Wait for rebalance end before start tested topology change. * @throws Exception If failed. */ private void mergeServersFail1(boolean waitRebalance) throws Exception { final Ignite srv0 = startGrids(5); if (waitRebalance) awaitPartitionMapExchange(); final List<DiscoveryEvent> mergedEvts = new ArrayList<>(); mergeExchangeWaitVersion(srv0, 8, mergedEvts); UUID grid3Id = grid(3).localNode().id(); UUID grid2Id = grid(2).localNode().id(); stopGrid(getTestIgniteInstanceName(4), true, false); stopGrid(getTestIgniteInstanceName(3), true, false); stopGrid(getTestIgniteInstanceName(2), true, false); checkCaches(); awaitPartitionMapExchange(); assertTrue("Unexpected number of merged disco events: " + mergedEvts.size(), mergedEvts.size() == 2); for (DiscoveryEvent discoEvt : mergedEvts) { ClusterNode evtNode = discoEvt.eventNode(); assertTrue("eventNode is null for DiscoEvent " + discoEvt, evtNode != null); assertTrue("Unexpected eventNode ID: " + evtNode.id() + " while expecting " + grid2Id + " or " + grid3Id, evtNode.id().equals(grid2Id) || evtNode.id().equals(grid3Id)); } }
/** * @throws Exception If failed. */ @Test public void testStartCacheOnJoinAndMergeWithFail() throws Exception { cfgCache = false; final Ignite srv0 = startGrids(2); mergeExchangeWaitVersion(srv0, 5); cfgCache = true; IgniteInternalFuture fut = startGridsAsync(srv0, 2, 2); stopGrid(1); fut.get(); checkCaches(); checkExchanges(srv0, 1, 2, 3, 5); checkExchanges(ignite(2), 3, 5); checkExchanges(ignite(3), 5); }
/** * @throws Exception If failed. */ @Ignore("https://issues.apache.org/jira/browse/IGNITE-10186") @Test public void testMergeServerAndClientJoin1() throws Exception { final IgniteEx srv0 = startGrid(0); mergeExchangeWaitVersion(srv0, 3); IgniteInternalFuture<?> fut1 = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() { @Override public Void call() throws Exception { startGrid(1); return null; } }, 1, "start-srv"); waitForExchangeStart(srv0, 2); IgniteInternalFuture<?> fut2 = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() { @Override public Void call() throws Exception { client.set(true); startGrid(2); return null; } }, 1, "start-client"); fut1.get(); fut2.get(); checkCaches(); checkExchanges(srv0, 1, 3); checkExchanges(ignite(1), 3); checkExchanges(ignite(2), 3); }