Search in sources :

Example 1 with CommunicationSpi

use of org.apache.ignite.spi.communication.CommunicationSpi in project ignite by apache.

the class GridDiscoveryManager method initCommunicationErrorResolveConfiguration.

/**
 * @param cfg Configuration.
 * @throws IgniteCheckedException If configuration is not valid.
 */
public static void initCommunicationErrorResolveConfiguration(IgniteConfiguration cfg) throws IgniteCheckedException {
    CommunicationFailureResolver rslvr = cfg.getCommunicationFailureResolver();
    CommunicationSpi commSpi = cfg.getCommunicationSpi();
    DiscoverySpi discoverySpi = cfg.getDiscoverySpi();
    if (rslvr != null) {
        if (!supportsCommunicationErrorResolve(commSpi)) {
            throw new IgniteCheckedException("CommunicationFailureResolver is configured, but CommunicationSpi does not support communication" + "problem resolve: " + commSpi.getClass().getName());
        }
        if (!supportsCommunicationErrorResolve(discoverySpi)) {
            throw new IgniteCheckedException("CommunicationFailureResolver is configured, but DiscoverySpi does not support communication" + "problem resolve: " + discoverySpi.getClass().getName());
        }
    } else {
        if (supportsCommunicationErrorResolve(commSpi) && supportsCommunicationErrorResolve(discoverySpi))
            cfg.setCommunicationFailureResolver(new DefaultCommunicationFailureResolver());
    }
}
Also used : TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi) CommunicationSpi(org.apache.ignite.spi.communication.CommunicationSpi) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) DefaultCommunicationFailureResolver(org.apache.ignite.configuration.DefaultCommunicationFailureResolver) CommunicationFailureResolver(org.apache.ignite.configuration.CommunicationFailureResolver) DiscoverySpi(org.apache.ignite.spi.discovery.DiscoverySpi) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi) DefaultCommunicationFailureResolver(org.apache.ignite.configuration.DefaultCommunicationFailureResolver)

Example 2 with CommunicationSpi

use of org.apache.ignite.spi.communication.CommunicationSpi in project ignite by apache.

the class GridifySingleSplitLoadTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration() throws Exception {
    IgniteConfiguration cfg = super.getConfiguration();
    /* Uncomment following code if you start it manually. */
    CommunicationSpi commSpi = new TcpCommunicationSpi();
    cfg.setCommunicationSpi(commSpi);
    DiscoverySpi discoSpi = new TcpDiscoverySpi();
    cfg.setDiscoverySpi(discoSpi);
    /*
         */
    @SuppressWarnings("TypeMayBeWeakened") Log4JLogger log = (Log4JLogger) cfg.getGridLogger();
    log.getLogger("org.apache.ignite").setLevel(Level.INFO);
    return cfg;
}
Also used : CommunicationSpi(org.apache.ignite.spi.communication.CommunicationSpi) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) Log4JLogger(org.apache.ignite.logger.log4j.Log4JLogger) DiscoverySpi(org.apache.ignite.spi.discovery.DiscoverySpi) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 3 with CommunicationSpi

use of org.apache.ignite.spi.communication.CommunicationSpi in project ignite by apache.

the class GridSingleSplitsRedeployLoadTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration() throws Exception {
    IgniteConfiguration cfg = super.getConfiguration();
    CommunicationSpi commSpi = new TcpCommunicationSpi();
    cfg.setCommunicationSpi(commSpi);
    DiscoverySpi discoSpi = new TcpDiscoverySpi();
    cfg.setDiscoverySpi(discoSpi);
    cfg.setDeploymentMode(DeploymentMode.CONTINUOUS);
    return cfg;
}
Also used : CommunicationSpi(org.apache.ignite.spi.communication.CommunicationSpi) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) DiscoverySpi(org.apache.ignite.spi.discovery.DiscoverySpi) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 4 with CommunicationSpi

use of org.apache.ignite.spi.communication.CommunicationSpi in project ignite by apache.

the class GridMultiSplitsLoadTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration() throws Exception {
    IgniteConfiguration cfg = super.getConfiguration();
    CommunicationSpi commSpi = new TcpCommunicationSpi();
    cfg.setCommunicationSpi(commSpi);
    DiscoverySpi discoSpi = new TcpDiscoverySpi();
    cfg.setDiscoverySpi(discoSpi);
    return cfg;
}
Also used : CommunicationSpi(org.apache.ignite.spi.communication.CommunicationSpi) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) DiscoverySpi(org.apache.ignite.spi.discovery.DiscoverySpi) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 5 with CommunicationSpi

use of org.apache.ignite.spi.communication.CommunicationSpi in project ignite by apache.

the class TooManyOpenFilesTcpCommunicationSpiTest method testTooManyOpenFilesErr.

/**
 * Test checks that node will fail in case of error "Too many open files" in {@link TcpCommunicationSpi}.
 *
 * @throws Exception If failed.
 */
@Test
public void testTooManyOpenFilesErr() throws Exception {
    IgniteEx crd = startGrids(3);
    crd.cluster().state(ClusterState.ACTIVE);
    IgniteEx stopNode = grid(2);
    CommunicationSpi stopNodeSpi = stopNode.context().config().getCommunicationSpi();
    ConnectionClientPool connPool = U.field(stopNodeSpi, "clientPool");
    GridNioServerWrapper nioSrvWrapper = U.field(stopNodeSpi, "nioSrvWrapper");
    IgniteEx txNode = grid(1);
    try (Transaction tx = txNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ, 60_000, 4)) {
        IgniteCache<Object, Object> cache = txNode.cache(DEFAULT_CACHE_NAME);
        cache.put(0, 1);
        nioSrvWrapper.socketChannelFactory(() -> {
            throw new SocketException("Too many open files");
        });
        connPool.forceCloseConnection(txNode.localNode().id());
        cache.put(1, 2);
        cache.put(2, 3);
        cache.put(3, 4);
        // hungs here.
        tx.commit();
    } catch (ClusterTopologyException e) {
        log.error("Error wait commit", e);
    }
    assertTrue(waitForCondition(((IgniteKernal) stopNode)::isStopping, 60_000));
}
Also used : SocketException(java.net.SocketException) IgniteKernal(org.apache.ignite.internal.IgniteKernal) CommunicationSpi(org.apache.ignite.spi.communication.CommunicationSpi) Transaction(org.apache.ignite.transactions.Transaction) IgniteEx(org.apache.ignite.internal.IgniteEx) ConnectionClientPool(org.apache.ignite.spi.communication.tcp.internal.ConnectionClientPool) GridNioServerWrapper(org.apache.ignite.spi.communication.tcp.internal.GridNioServerWrapper) ClusterTopologyException(org.apache.ignite.cluster.ClusterTopologyException) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Aggregations

CommunicationSpi (org.apache.ignite.spi.communication.CommunicationSpi)19 TcpCommunicationSpi (org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi)9 UUID (java.util.UUID)7 Test (org.junit.Test)6 GridCommunicationClient (org.apache.ignite.internal.util.nio.GridCommunicationClient)5 ArrayList (java.util.ArrayList)4 Map (java.util.Map)4 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)4 DiscoverySpi (org.apache.ignite.spi.discovery.DiscoverySpi)4 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)4 ConcurrentMap (java.util.concurrent.ConcurrentMap)3 ClusterNode (org.apache.ignite.cluster.ClusterNode)3 Message (org.apache.ignite.plugin.extensions.communication.Message)3 BitSet (java.util.BitSet)2 HashMap (java.util.HashMap)2 CyclicBarrier (java.util.concurrent.CyclicBarrier)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 IgniteException (org.apache.ignite.IgniteException)2 IgniteInternalFuture (org.apache.ignite.internal.IgniteInternalFuture)2 ConnectionClientPool (org.apache.ignite.spi.communication.tcp.internal.ConnectionClientPool)2