Search in sources :

Example 1 with ZookeeperDiscoverySpiMBean

use of org.apache.ignite.spi.discovery.zk.ZookeeperDiscoverySpiMBean in project ignite by apache.

the class ZookeeperDiscoveryRandomStopOrFailConcurrentTest method getMbean.

/**
 */
private DiscoverySpiMBean getMbean(IgniteEx grid) {
    ZookeeperDiscoverySpiMBean bean = getMxBean(grid.context().igniteInstanceName(), "SPIs", ZookeeperDiscoverySpi.class, ZookeeperDiscoverySpiMBean.class);
    assertNotNull(bean);
    return bean;
}
Also used : ZookeeperDiscoverySpiMBean(org.apache.ignite.spi.discovery.zk.ZookeeperDiscoverySpiMBean)

Example 2 with ZookeeperDiscoverySpiMBean

use of org.apache.ignite.spi.discovery.zk.ZookeeperDiscoverySpiMBean in project ignite by apache.

the class ZookeeperDiscoveryClientDisconnectTest method testClientReconnects.

/**
 * Test reproduces failure in case of client resolution failure
 * {@link org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi#createTcpClient} from server side, further
 * client reconnect and proper grid work.
 *
 * @throws Exception If failed.
 */
@Test
public void testClientReconnects() throws Exception {
    blockCommSpi = true;
    Ignite srv1 = startGrid("server1-block");
    IgniteEx cli = startClientGrid("client-block");
    IgniteCache<Object, Object> cache = cli.getOrCreateCache(DEFAULT_CACHE_NAME);
    cache.put(1, 1);
    assertEquals(cache.get(1), 1);
    assertEquals(1, srv1.cluster().forClients().nodes().size());
    ZookeeperDiscoverySpiMBean bean = getMxBean(srv1.name(), "SPIs", ZookeeperDiscoverySpi.class, ZookeeperDiscoverySpiMBean.class);
    assertNotNull(bean);
    assertEquals(0, bean.getCommErrorProcNum());
}
Also used : ZookeeperDiscoverySpiMBean(org.apache.ignite.spi.discovery.zk.ZookeeperDiscoverySpiMBean) IgniteEx(org.apache.ignite.internal.IgniteEx) Ignite(org.apache.ignite.Ignite) Test(org.junit.Test)

Example 3 with ZookeeperDiscoverySpiMBean

use of org.apache.ignite.spi.discovery.zk.ZookeeperDiscoverySpiMBean in project ignite by apache.

the class ZookeeperDiscoveryMiscTest method testMbean.

/**
 * @throws Exception if failed.
 */
@Test
public void testMbean() throws Exception {
    int cnt = 3;
    startGrids(cnt);
    UUID crdNodeId = grid(0).localNode().id();
    try {
        for (int i = 0; i < cnt; i++) {
            IgniteEx grid = grid(i);
            ZookeeperDiscoverySpiMBean bean = getMxBean(grid.context().igniteInstanceName(), "SPIs", ZookeeperDiscoverySpi.class, ZookeeperDiscoverySpiMBean.class);
            MetricRegistry discoReg = grid.context().metric().registry(DISCO_METRICS);
            assertNotNull(bean);
            assertEquals(String.valueOf(grid.cluster().node(crdNodeId)), bean.getCoordinatorNodeFormatted());
            assertEquals(String.valueOf(grid.cluster().localNode()), bean.getLocalNodeFormatted());
            assertEquals(zkCluster.getConnectString(), bean.getZkConnectionString());
            assertEquals((long) grid.configuration().getFailureDetectionTimeout(), bean.getZkSessionTimeout());
            assertEquals(grid.cluster().topologyVersion(), discoReg.<LongMetric>findMetric("CurrentTopologyVersion").value());
            assertEquals(grid.cluster().node(crdNodeId).id(), discoReg.<ObjectMetric<UUID>>findMetric("Coordinator").value());
            assertEquals(cnt - i - 1, bean.getNodesJoined());
            assertEquals(cnt - i - 1, discoReg.<LongMetric>findMetric("JoinedNodes").value());
            Arrays.asList("LeftNodes", "FailedNodes", "CommunicationErrors").forEach(name -> {
                assertEquals(0, discoReg.<LongMetric>findMetric(name).value());
            });
            assertEquals(0, bean.getNodesLeft());
            assertEquals(0, bean.getNodesFailed());
            assertEquals(0, bean.getCommErrorProcNum());
        }
    } finally {
        stopAllGrids();
    }
}
Also used : ZookeeperDiscoverySpiMBean(org.apache.ignite.spi.discovery.zk.ZookeeperDiscoverySpiMBean) ObjectMetric(org.apache.ignite.spi.metric.ObjectMetric) IgniteEx(org.apache.ignite.internal.IgniteEx) MetricRegistry(org.apache.ignite.internal.processors.metric.MetricRegistry) LongMetric(org.apache.ignite.spi.metric.LongMetric) UUID(java.util.UUID) Test(org.junit.Test)

Example 4 with ZookeeperDiscoverySpiMBean

use of org.apache.ignite.spi.discovery.zk.ZookeeperDiscoverySpiMBean in project ignite by apache.

the class ZookeeperDiscoveryMiscTest method testMbeanGetCoordinator.

/**
 * @throws Exception If failed.
 */
@Test
public void testMbeanGetCoordinator() throws Exception {
    startGrid(0);
    startClientGrid(1);
    IgniteEx srv2 = startGrid(2);
    ZookeeperDiscoverySpiMBean mbean = getMxBean(srv2.context().igniteInstanceName(), "SPIs", ZookeeperDiscoverySpi.class, ZookeeperDiscoverySpiMBean.class);
    stopGrid(0);
    waitForTopology(2);
    assertEquals(mbean.getCoordinator(), srv2.localNode().id());
    assertEquals(mbean.getCoordinatorNodeFormatted(), String.valueOf(srv2.localNode()));
}
Also used : ZookeeperDiscoverySpiMBean(org.apache.ignite.spi.discovery.zk.ZookeeperDiscoverySpiMBean) IgniteEx(org.apache.ignite.internal.IgniteEx) Test(org.junit.Test)

Aggregations

ZookeeperDiscoverySpiMBean (org.apache.ignite.spi.discovery.zk.ZookeeperDiscoverySpiMBean)4 IgniteEx (org.apache.ignite.internal.IgniteEx)3 Test (org.junit.Test)3 UUID (java.util.UUID)1 Ignite (org.apache.ignite.Ignite)1 MetricRegistry (org.apache.ignite.internal.processors.metric.MetricRegistry)1 LongMetric (org.apache.ignite.spi.metric.LongMetric)1 ObjectMetric (org.apache.ignite.spi.metric.ObjectMetric)1