Search in sources :

Example 6 with REPLICATED

use of org.apache.ignite.cache.CacheMode.REPLICATED in project ignite by apache.

the class CacheBlockOnReadAbstractTest method testUpdateBaselineTopologyTransactionalReplicated.

/**
 * @throws Exception If failed.
 */
@Params(timeout = 5000L, atomicityMode = TRANSACTIONAL, cacheMode = REPLICATED)
@Test
public void testUpdateBaselineTopologyTransactionalReplicated() throws Exception {
    doTest(asMessagePredicate(discoEvt -> {
        if (discoEvt instanceof DiscoveryCustomEvent) {
            DiscoveryCustomEvent discoCustomEvt = (DiscoveryCustomEvent) discoEvt;
            DiscoveryCustomMessage customMsg = discoCustomEvt.customMessage();
            return customMsg instanceof ChangeGlobalStateMessage;
        }
        return false;
    }), () -> {
        startNodesInClientMode(false);
        IgniteEx ignite = startGrid(UUID.randomUUID().toString());
        baseline.get(0).cluster().setBaselineTopology(baseline.get(0).context().discovery().topologyVersion());
        baseline.add(ignite);
    });
}
Also used : CacheAtomicityMode(org.apache.ignite.cache.CacheAtomicityMode) IgniteInternalFuture(org.apache.ignite.internal.IgniteInternalFuture) DiscoveryCustomEvent(org.apache.ignite.internal.events.DiscoveryCustomEvent) Arrays(java.util.Arrays) TcpDiscoveryNodeAddFinishedMessage(org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeAddFinishedMessage) IgniteEx(org.apache.ignite.internal.IgniteEx) RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) X(org.apache.ignite.internal.util.typedef.X) PARTITIONED(org.apache.ignite.cache.CacheMode.PARTITIONED) TcpDiscoveryNodeLeftMessage(org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeLeftMessage) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) EventType(org.apache.ignite.events.EventType) Predicate(java.util.function.Predicate) TestTcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TestTcpDiscoverySpi) Collection(java.util.Collection) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) IgniteException(org.apache.ignite.IgniteException) Set(java.util.Set) UUID(java.util.UUID) TcpDiscoveryAbstractMessage(org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage) IgniteCache(org.apache.ignite.IgniteCache) GridTestUtils(org.apache.ignite.testframework.GridTestUtils) Objects(java.util.Objects) CountDownLatch(java.util.concurrent.CountDownLatch) ExchangeActions(org.apache.ignite.internal.processors.cache.ExchangeActions) List(java.util.List) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) IgniteFutureTimeoutCheckedException(org.apache.ignite.internal.IgniteFutureTimeoutCheckedException) Message(org.apache.ignite.plugin.extensions.communication.Message) RunnableX(org.apache.ignite.testframework.GridTestUtils.RunnableX) TestRecordingCommunicationSpi(org.apache.ignite.internal.TestRecordingCommunicationSpi) NotNull(org.jetbrains.annotations.NotNull) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) TcpDiscoveryIpFinder(org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder) DiscoveryEvent(org.apache.ignite.events.DiscoveryEvent) IgniteBiPredicate(org.apache.ignite.lang.IgniteBiPredicate) U(org.apache.ignite.internal.util.typedef.internal.U) Retention(java.lang.annotation.Retention) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) ClusterNode(org.apache.ignite.cluster.ClusterNode) DiscoveryCustomMessage(org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage) BiConsumer(java.util.function.BiConsumer) IgniteInterruptedException(org.apache.ignite.IgniteInterruptedException) DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) IgniteInterruptedCheckedException(org.apache.ignite.internal.IgniteInterruptedCheckedException) CacheActionData(org.apache.ignite.internal.processors.cache.ExchangeActions.CacheActionData) TcpDiscoveryVmIpFinder(org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder) ClusterTopologyCheckedException(org.apache.ignite.internal.cluster.ClusterTopologyCheckedException) Target(java.lang.annotation.Target) Test(org.junit.Test) ElementType(java.lang.annotation.ElementType) TRANSACTIONAL(org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL) REPLICATED(org.apache.ignite.cache.CacheMode.REPLICATED) TimeUnit(java.util.concurrent.TimeUnit) AtomicLong(java.util.concurrent.atomic.AtomicLong) ChangeGlobalStateMessage(org.apache.ignite.internal.processors.cluster.ChangeGlobalStateMessage) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) GridDhtPartitionsFullMessage(org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage) IgniteDataStreamer(org.apache.ignite.IgniteDataStreamer) ATOMIC(org.apache.ignite.cache.CacheAtomicityMode.ATOMIC) GridDhtPartitionExchangeId(org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionExchangeId) Collections(java.util.Collections) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) RetentionPolicy(java.lang.annotation.RetentionPolicy) CacheMode(org.apache.ignite.cache.CacheMode) DynamicCacheChangeBatch(org.apache.ignite.internal.processors.cache.DynamicCacheChangeBatch) IgniteEx(org.apache.ignite.internal.IgniteEx) ChangeGlobalStateMessage(org.apache.ignite.internal.processors.cluster.ChangeGlobalStateMessage) DiscoveryCustomEvent(org.apache.ignite.internal.events.DiscoveryCustomEvent) DiscoveryCustomMessage(org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Example 7 with REPLICATED

use of org.apache.ignite.cache.CacheMode.REPLICATED in project ignite by apache.

the class CacheBlockOnReadAbstractTest method testRestartBaselineTransactionalReplicated.

/**
 * @throws Exception If failed.
 */
@Params(baseline = 4, atomicityMode = TRANSACTIONAL, cacheMode = REPLICATED)
@Test
public void testRestartBaselineTransactionalReplicated() throws Exception {
    doTest(asMessagePredicate(discoEvt -> discoEvt.type() == EventType.EVT_NODE_JOINED), () -> {
        IgniteEx node = baseline.get(baseline.size() - 1);
        TestRecordingCommunicationSpi.spi(node).stopBlock();
        stopGrid(node.name());
        for (int i = 0; i < baselineServersCount() - 2; i++) cntFinishedReadOperations.countDown();
        startGrid(node.name());
    });
}
Also used : CacheAtomicityMode(org.apache.ignite.cache.CacheAtomicityMode) IgniteInternalFuture(org.apache.ignite.internal.IgniteInternalFuture) DiscoveryCustomEvent(org.apache.ignite.internal.events.DiscoveryCustomEvent) Arrays(java.util.Arrays) TcpDiscoveryNodeAddFinishedMessage(org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeAddFinishedMessage) IgniteEx(org.apache.ignite.internal.IgniteEx) RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) X(org.apache.ignite.internal.util.typedef.X) PARTITIONED(org.apache.ignite.cache.CacheMode.PARTITIONED) TcpDiscoveryNodeLeftMessage(org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeLeftMessage) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) EventType(org.apache.ignite.events.EventType) Predicate(java.util.function.Predicate) TestTcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TestTcpDiscoverySpi) Collection(java.util.Collection) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) IgniteException(org.apache.ignite.IgniteException) Set(java.util.Set) UUID(java.util.UUID) TcpDiscoveryAbstractMessage(org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage) IgniteCache(org.apache.ignite.IgniteCache) GridTestUtils(org.apache.ignite.testframework.GridTestUtils) Objects(java.util.Objects) CountDownLatch(java.util.concurrent.CountDownLatch) ExchangeActions(org.apache.ignite.internal.processors.cache.ExchangeActions) List(java.util.List) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) IgniteFutureTimeoutCheckedException(org.apache.ignite.internal.IgniteFutureTimeoutCheckedException) Message(org.apache.ignite.plugin.extensions.communication.Message) RunnableX(org.apache.ignite.testframework.GridTestUtils.RunnableX) TestRecordingCommunicationSpi(org.apache.ignite.internal.TestRecordingCommunicationSpi) NotNull(org.jetbrains.annotations.NotNull) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) TcpDiscoveryIpFinder(org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder) DiscoveryEvent(org.apache.ignite.events.DiscoveryEvent) IgniteBiPredicate(org.apache.ignite.lang.IgniteBiPredicate) U(org.apache.ignite.internal.util.typedef.internal.U) Retention(java.lang.annotation.Retention) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) ClusterNode(org.apache.ignite.cluster.ClusterNode) DiscoveryCustomMessage(org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage) BiConsumer(java.util.function.BiConsumer) IgniteInterruptedException(org.apache.ignite.IgniteInterruptedException) DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) IgniteInterruptedCheckedException(org.apache.ignite.internal.IgniteInterruptedCheckedException) CacheActionData(org.apache.ignite.internal.processors.cache.ExchangeActions.CacheActionData) TcpDiscoveryVmIpFinder(org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder) ClusterTopologyCheckedException(org.apache.ignite.internal.cluster.ClusterTopologyCheckedException) Target(java.lang.annotation.Target) Test(org.junit.Test) ElementType(java.lang.annotation.ElementType) TRANSACTIONAL(org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL) REPLICATED(org.apache.ignite.cache.CacheMode.REPLICATED) TimeUnit(java.util.concurrent.TimeUnit) AtomicLong(java.util.concurrent.atomic.AtomicLong) ChangeGlobalStateMessage(org.apache.ignite.internal.processors.cluster.ChangeGlobalStateMessage) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) GridDhtPartitionsFullMessage(org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage) IgniteDataStreamer(org.apache.ignite.IgniteDataStreamer) ATOMIC(org.apache.ignite.cache.CacheAtomicityMode.ATOMIC) GridDhtPartitionExchangeId(org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionExchangeId) Collections(java.util.Collections) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) RetentionPolicy(java.lang.annotation.RetentionPolicy) CacheMode(org.apache.ignite.cache.CacheMode) DynamicCacheChangeBatch(org.apache.ignite.internal.processors.cache.DynamicCacheChangeBatch) IgniteEx(org.apache.ignite.internal.IgniteEx) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Aggregations

REPLICATED (org.apache.ignite.cache.CacheMode.REPLICATED)7 IgniteEx (org.apache.ignite.internal.IgniteEx)7 IgniteCache (org.apache.ignite.IgniteCache)6 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)6 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)6 Collection (java.util.Collection)5 Collections (java.util.Collections)5 List (java.util.List)5 UUID (java.util.UUID)5 CountDownLatch (java.util.concurrent.CountDownLatch)5 ATOMIC (org.apache.ignite.cache.CacheAtomicityMode.ATOMIC)5 PARTITIONED (org.apache.ignite.cache.CacheMode.PARTITIONED)5 ClusterNode (org.apache.ignite.cluster.ClusterNode)5 EventType (org.apache.ignite.events.EventType)5 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)5 ArrayList (java.util.ArrayList)4 Arrays (java.util.Arrays)4 Objects (java.util.Objects)4 TimeUnit (java.util.concurrent.TimeUnit)4 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)4