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;
}
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());
}
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();
}
}
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()));
}
Aggregations