Search in sources :

Example 6 with IgniteClusterEx

use of org.apache.ignite.internal.cluster.IgniteClusterEx in project ignite by apache.

the class ClientClusterGroupGetNodeIdsRequest method process.

/**
 * {@inheritDoc}
 */
@Override
public ClientResponse process(ClientConnectionContext ctx) {
    IgniteClusterEx cluster = ctx.kernalContext().grid().cluster();
    long curTopVer = cluster.topologyVersion();
    // No topology changes, return false.
    if (curTopVer <= topVer)
        return new ClientBooleanResponse(requestId(), false);
    ClusterGroup clusterGrp = prj.apply(cluster);
    UUID[] nodeIds = getNodeIds(clusterGrp);
    return new ClientClusterGroupGetNodeIdsResponse(requestId(), curTopVer, nodeIds);
}
Also used : IgniteClusterEx(org.apache.ignite.internal.cluster.IgniteClusterEx) ClientBooleanResponse(org.apache.ignite.internal.processors.platform.client.ClientBooleanResponse) ClusterGroup(org.apache.ignite.cluster.ClusterGroup) UUID(java.util.UUID)

Example 7 with IgniteClusterEx

use of org.apache.ignite.internal.cluster.IgniteClusterEx in project ignite by apache.

the class ClientClusterGroupGetNodesDetailsRequest method process.

/**
 * {@inheritDoc}
 */
@Override
public ClientResponse process(ClientConnectionContext ctx) {
    IgniteClusterEx cluster = ctx.kernalContext().grid().cluster();
    ClusterGroup clusterGrp = cluster.forNodeIds(Arrays.asList(nodeIds));
    return new ClientClusterGroupGetNodesDetailsResponse(requestId(), clusterGrp.nodes());
}
Also used : IgniteClusterEx(org.apache.ignite.internal.cluster.IgniteClusterEx) ClusterGroup(org.apache.ignite.cluster.ClusterGroup)

Example 8 with IgniteClusterEx

use of org.apache.ignite.internal.cluster.IgniteClusterEx in project ignite by apache.

the class IgniteClientFailuresTest method testFailedClientLeavesTopologyAfterTimeout.

/**
 * Test verifies that when client node failed but not yet cleaned up from topology
 * (because {@link IgniteConfiguration#clientFailureDetectionTimeout} has not been reached yet)
 * it doesn't affect new client connected from the same address.
 *
 * @throws Exception If failed.
 */
@Test
public void testFailedClientLeavesTopologyAfterTimeout() throws Exception {
    IgniteEx srv0 = (IgniteEx) startGridsMultiThreaded(3);
    IgniteEx client00 = startGrid("client00");
    IgniteEx client01 = startGrid("client01");
    client00.getOrCreateCache(new CacheConfiguration<>("cache0"));
    client01.getOrCreateCache(new CacheConfiguration<>("cache1"));
    IgniteInternalFuture f1 = GridTestUtils.runAsync(() -> breakClient(client00));
    IgniteInternalFuture f2 = GridTestUtils.runAsync(() -> breakClient(client01));
    f1.get();
    f2.get();
    final IgniteClusterEx cl = srv0.cluster();
    assertEquals(5, cl.topology(cl.topologyVersion()).size());
    IgniteEx client02 = startGrid("client02");
    assertEquals(6, cl.topology(cl.topologyVersion()).size());
    boolean waitRes = GridTestUtils.waitForCondition(() -> (cl.topology(cl.topologyVersion()).size() == 4), 20_000);
    assertTrue(waitRes);
    checkCacheOperations(client02.cache("cache0"));
    assertEquals(4, srv0.context().discovery().allNodes().size());
    // Cluster metrics.
    ClusterMetricsMXBean mxBeanCluster = GridCommonAbstractTest.getMxBean(srv0.name(), "Kernal", ClusterMetricsMXBeanImpl.class.getSimpleName(), ClusterMetricsMXBean.class);
    assertEquals(1, mxBeanCluster.getTotalClientNodes());
}
Also used : IgniteClusterEx(org.apache.ignite.internal.cluster.IgniteClusterEx) ClusterMetricsMXBean(org.apache.ignite.mxbean.ClusterMetricsMXBean) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Example 9 with IgniteClusterEx

use of org.apache.ignite.internal.cluster.IgniteClusterEx in project ignite by apache.

the class IgniteClientFailuresTest method testNoMessagesFromFailureProcessor.

/**
 * Test verifies that FailureProcessor doesn't treat tcp-comm-worker thread as blocked when
 * the thread handles situation of failed client node and thus doesn't print full thread dump into logs.
 *
 * @throws Exception If failed.
 */
@Test
public void testNoMessagesFromFailureProcessor() throws Exception {
    GridStringLogger strLog = new GridStringLogger(false, new GridTestLog4jLogger());
    strLog.logLength(1024 * 1024);
    inMemoryLog = strLog;
    IgniteEx srv = startGrid(0);
    inMemoryLog = null;
    IgniteEx client00 = startGrid("client00");
    client00.getOrCreateCache(new CacheConfiguration<>("cache0"));
    breakClient(client00);
    boolean waitRes = GridTestUtils.waitForCondition(() -> {
        IgniteClusterEx cl = srv.cluster();
        return (cl.topology(cl.topologyVersion()).size() == 1);
    }, 30_000);
    assertTrue(waitRes);
    assertFalse(strLog.toString().contains("name=tcp-comm-worker"));
}
Also used : IgniteClusterEx(org.apache.ignite.internal.cluster.IgniteClusterEx) GridStringLogger(org.apache.ignite.testframework.GridStringLogger) GridTestLog4jLogger(org.apache.ignite.testframework.junits.logger.GridTestLog4jLogger) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Example 10 with IgniteClusterEx

use of org.apache.ignite.internal.cluster.IgniteClusterEx in project ignite by apache.

the class IgniteClientFailuresTest method testExchangeWorkerIsNotTreatedAsBlockedWhenClientNodeFails.

/**
 * Test verifies that when some sys thread (on server node) tries to re-establish connection to failed client
 * and exchange-worker gets blocked waiting for it (e.g. to send partitions full map)
 * it is not treated as {@link FailureType#SYSTEM_WORKER_BLOCKED}
 * because this waiting is finite and part of normal operations.
 *
 * @throws Exception If failed.
 */
@Test
public void testExchangeWorkerIsNotTreatedAsBlockedWhenClientNodeFails() throws Exception {
    GridStringLogger strLog = new GridStringLogger(false, new GridTestLog4jLogger());
    strLog.logLength(1024 * 1024);
    inMemoryLog = strLog;
    IgniteEx srv0 = startGrid(0);
    inMemoryLog = null;
    IgniteEx client00 = startGrid("client00");
    client00.getOrCreateCache(new CacheConfiguration<>("cache0"));
    startGrid(1);
    breakClient(client00);
    final IgniteClusterEx cl = srv0.cluster();
    assertEquals(3, cl.topology(cl.topologyVersion()).size());
    startGrid("client01");
    boolean waitRes = GridTestUtils.waitForCondition(() -> (cl.topology(cl.topologyVersion()).size() == 3), 20_000);
    assertTrue(waitRes);
    String logRes = strLog.toString();
    assertFalse(logRes.contains(EXCHANGE_WORKER_BLOCKED_MSG));
}
Also used : IgniteClusterEx(org.apache.ignite.internal.cluster.IgniteClusterEx) GridStringLogger(org.apache.ignite.testframework.GridStringLogger) GridTestLog4jLogger(org.apache.ignite.testframework.junits.logger.GridTestLog4jLogger) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Aggregations

IgniteClusterEx (org.apache.ignite.internal.cluster.IgniteClusterEx)18 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)7 Test (org.junit.Test)7 ClusterGroup (org.apache.ignite.cluster.ClusterGroup)5 ClusterNode (org.apache.ignite.cluster.ClusterNode)5 ArrayList (java.util.ArrayList)4 CommandHandler (org.apache.ignite.internal.commandline.CommandHandler)3 IgniteClusterNode (org.apache.ignite.internal.managers.discovery.IgniteClusterNode)3 UUID (java.util.UUID)2 GridStringLogger (org.apache.ignite.testframework.GridStringLogger)2 GridTestLog4jLogger (org.apache.ignite.testframework.junits.logger.GridTestLog4jLogger)2 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1