http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java index 0129d11..3d8ae3f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java @@ -226,14 +226,18 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr Ignite ignite1 = startGrid(1); - waitForTopologyUpdate(2, 2); + boolean lateAff = ignite1.configuration().isLateAffinityAssignment(); + + int minorVer = lateAff ? 1 : 0; + + waitForTopologyUpdate(2, new AffinityTopologyVersion(2, minorVer)); TestCommunicationSpi spi1 = (TestCommunicationSpi)ignite1.configuration().getCommunicationSpi(); assertEquals(0, spi0.partitionsSingleMessages()); - assertEquals(1, spi0.partitionsFullMessages()); + assertEquals(lateAff ? 2 : 1, spi0.partitionsFullMessages()); - assertEquals(1, spi1.partitionsSingleMessages()); + assertEquals(lateAff ? 2 : 1, spi1.partitionsSingleMessages()); assertEquals(0, spi1.partitionsFullMessages()); spi0.reset(); @@ -293,23 +297,23 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr Ignite ignite4 = startGrid(4); - waitForTopologyUpdate(5, 5); + waitForTopologyUpdate(5, new AffinityTopologyVersion(5, lateAff ? 1 : 0)); TestCommunicationSpi spi4 = (TestCommunicationSpi)ignite4.configuration().getCommunicationSpi(); assertEquals(0, spi0.partitionsSingleMessages()); - assertEquals(4, spi0.partitionsFullMessages()); + assertEquals(lateAff ? 8 : 4, spi0.partitionsFullMessages()); - assertEquals(1, spi1.partitionsSingleMessages()); + assertEquals(lateAff ? 2 : 1, spi1.partitionsSingleMessages()); assertEquals(0, spi1.partitionsFullMessages()); - assertEquals(1, spi2.partitionsSingleMessages()); + assertEquals(lateAff ? 2 : 1, spi2.partitionsSingleMessages()); assertEquals(0, spi2.partitionsFullMessages()); - assertEquals(1, spi3.partitionsSingleMessages()); + assertEquals(lateAff ? 2 : 1, spi3.partitionsSingleMessages()); assertEquals(0, spi3.partitionsFullMessages()); - assertEquals(1, spi4.partitionsSingleMessages()); + assertEquals(lateAff ? 2 : 1, spi4.partitionsSingleMessages()); assertEquals(0, spi4.partitionsFullMessages()); spi0.reset(); @@ -319,21 +323,42 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr log.info("Stop server node."); - ignite4.close(); + ignite4.close(); // With late affinity exchange on server leave is completed by discovery message. - waitForTopologyUpdate(4, 6); + if (lateAff) { + // With FairAffinityFunction affinity calculation is different, this causes one more topology change. + boolean exchangeAfterRebalance = fairAffinity; - assertEquals(0, spi0.partitionsSingleMessages()); - assertEquals(3, spi0.partitionsFullMessages()); + waitForTopologyUpdate(4, + exchangeAfterRebalance ? new AffinityTopologyVersion(6, 1) : new AffinityTopologyVersion(6, 0)); - assertEquals(1, spi1.partitionsSingleMessages()); - assertEquals(0, spi1.partitionsFullMessages()); + assertEquals(0, spi0.partitionsSingleMessages()); + assertEquals(exchangeAfterRebalance ? 3 : 0, spi0.partitionsFullMessages()); - assertEquals(1, spi2.partitionsSingleMessages()); - assertEquals(0, spi2.partitionsFullMessages()); + assertEquals(exchangeAfterRebalance ? 2 : 1, spi1.partitionsSingleMessages()); + assertEquals(0, spi1.partitionsFullMessages()); - assertEquals(1, spi3.partitionsSingleMessages()); - assertEquals(0, spi3.partitionsFullMessages()); + assertEquals(exchangeAfterRebalance ? 1 : 0, spi2.partitionsSingleMessages()); + assertEquals(0, spi2.partitionsFullMessages()); + + assertEquals(exchangeAfterRebalance ? 1 : 0, spi3.partitionsSingleMessages()); + assertEquals(0, spi3.partitionsFullMessages()); + } + else { + waitForTopologyUpdate(4, 6); + + assertEquals(0, spi0.partitionsSingleMessages()); + assertEquals(3, spi0.partitionsFullMessages()); + + assertEquals(1, spi1.partitionsSingleMessages()); + assertEquals(0, spi1.partitionsFullMessages()); + + assertEquals(1, spi2.partitionsSingleMessages()); + assertEquals(0, spi2.partitionsFullMessages()); + + assertEquals(1, spi3.partitionsSingleMessages()); + assertEquals(0, spi3.partitionsFullMessages()); + } spi0.reset(); spi1.reset(); @@ -483,7 +508,9 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr Ignite ignite0 = startGrid(0); Ignite ignite1 = startGrid(1); - waitForTopologyUpdate(2, 2); + boolean lateAff = ignite1.configuration().isLateAffinityAssignment(); + + waitForTopologyUpdate(2, new AffinityTopologyVersion(2, lateAff ? 1 : 0)); final String CACHE_NAME1 = "cache1"; @@ -500,7 +527,9 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr Ignite ignite2 = startGrid(2); - waitForTopologyUpdate(3, 3); + int minorVer = !client && lateAff ? 1 : 0; + + waitForTopologyUpdate(3, new AffinityTopologyVersion(3, minorVer)); TestCommunicationSpi spi0 = (TestCommunicationSpi)ignite0.configuration().getCommunicationSpi(); TestCommunicationSpi spi1 = (TestCommunicationSpi)ignite1.configuration().getCommunicationSpi(); @@ -517,7 +546,7 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr else ignite2.cache(CACHE_NAME1); - waitForTopologyUpdate(3, new AffinityTopologyVersion(3, 1)); + waitForTopologyUpdate(3, new AffinityTopologyVersion(3, ++minorVer)); GridCacheAdapter cache = ((IgniteKernal)ignite2).context().cache().context().cache().internalCache(CACHE_NAME1); @@ -545,8 +574,6 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr spi1.reset(); spi2.reset(); - AffinityTopologyVersion topVer; - if (!srvNode) { log.info("Close client cache: " + CACHE_NAME1); @@ -554,7 +581,7 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr assertNull(((IgniteKernal)ignite2).context().cache().context().cache().internalCache(CACHE_NAME1)); - waitForTopologyUpdate(3, new AffinityTopologyVersion(3, 2)); + waitForTopologyUpdate(3, new AffinityTopologyVersion(3, ++minorVer)); assertEquals(0, spi0.partitionsSingleMessages()); assertEquals(0, spi0.partitionsFullMessages()); @@ -562,11 +589,7 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr assertEquals(0, spi1.partitionsFullMessages()); assertEquals(0, spi2.partitionsSingleMessages()); assertEquals(0, spi2.partitionsFullMessages()); - - topVer = new AffinityTopologyVersion(3, 3); } - else - topVer = new AffinityTopologyVersion(3, 2); final String CACHE_NAME2 = "cache2"; @@ -574,9 +597,11 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr ccfg.setName(CACHE_NAME2); + log.info("Create new cache: " + CACHE_NAME2); + ignite2.createCache(ccfg); - waitForTopologyUpdate(3, topVer); + waitForTopologyUpdate(3, new AffinityTopologyVersion(3, ++minorVer)); assertEquals(0, spi0.partitionsSingleMessages()); assertEquals(2, spi0.partitionsFullMessages());
http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientReconnectTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientReconnectTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientReconnectTest.java index 37c5a6b..07ca1db 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientReconnectTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientReconnectTest.java @@ -36,6 +36,7 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import static java.util.concurrent.TimeUnit.MILLISECONDS; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.PARTITIONED; +import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; /** * Test for customer scenario. @@ -74,6 +75,7 @@ public class IgniteCacheClientReconnectTest extends GridCommonAbstractTest { ccfg.setAtomicityMode(TRANSACTIONAL); ccfg.setBackups(1); ccfg.setName("cache-" + i); + ccfg.setWriteSynchronizationMode(FULL_SYNC); ccfgs[i] = ccfg; } http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheNearRestartRollbackSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheNearRestartRollbackSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheNearRestartRollbackSelfTest.java index 6c27a46..a48497d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheNearRestartRollbackSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheNearRestartRollbackSelfTest.java @@ -77,9 +77,12 @@ public class IgniteCacheNearRestartRollbackSelfTest extends GridCommonAbstractTe cfg.setCacheConfiguration(cacheConfiguration(gridName)); - if (getTestGridName(3).equals(gridName)) + if (getTestGridName(3).equals(gridName)) { cfg.setClientMode(true); + discoSpi.setForceServerMode(true); + } + TcpCommunicationSpi commSpi = new TcpCommunicationSpi(); commSpi.setSharedMemoryPort(-1); @@ -158,19 +161,28 @@ public class IgniteCacheNearRestartRollbackSelfTest extends GridCommonAbstractTe boolean invoke = false; while (!fut.isDone()) { - updateCache(tester, currVal, invoke, false, keys); + try { + updateCache(tester, currVal, invoke, false, keys); + + updateCache(tester, currVal + 1, invoke, true, keys); - updateCache(tester, currVal + 1, invoke, true, keys); + invoke = !invoke; + currVal++; - invoke = !invoke; - currVal++; + synchronized (lastUpdateTs) { + lastUpdateTs.set(System.currentTimeMillis()); - synchronized (lastUpdateTs) { - lastUpdateTs.set(System.currentTimeMillis()); + lastUpdateTs.notifyAll(); + } + } + catch (Throwable e) { + log.error("Update failed: " + e, e); - lastUpdateTs.notifyAll(); + throw e; } } + + fut.get(); } finally { stopAllGrids(); http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedPreloadEventsSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedPreloadEventsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedPreloadEventsSelfTest.java index f1de28c..69dd0c2 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedPreloadEventsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedPreloadEventsSelfTest.java @@ -31,6 +31,7 @@ import org.apache.ignite.cache.affinity.AffinityFunction; import org.apache.ignite.cache.affinity.AffinityFunctionContext; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.configuration.CacheConfiguration; +import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.events.Event; import org.apache.ignite.internal.processors.cache.distributed.GridCachePreloadEventsAbstractSelfTest; import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysFuture; @@ -50,6 +51,16 @@ public class GridCachePartitionedPreloadEventsSelfTest extends GridCachePreloadE private long rebalanceDelay; /** {@inheritDoc} */ + @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { + IgniteConfiguration cfg = super.getConfiguration(gridName); + + // 'testForcePreload' is not valid with late assignment. + cfg.setLateAffinityAssignment(false); + + return cfg; + } + + /** {@inheritDoc} */ @Override protected CacheConfiguration cacheConfiguration() { CacheConfiguration cacheCfg = super.cacheConfiguration(); http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedUnloadEventsSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedUnloadEventsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedUnloadEventsSelfTest.java index 82bbccb..98f3cd7 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedUnloadEventsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedUnloadEventsSelfTest.java @@ -89,6 +89,8 @@ public class GridCachePartitionedUnloadEventsSelfTest extends GridCommonAbstract Ignite g2 = startGrid("g2"); + awaitPartitionMapExchange(); + Map<ClusterNode, Collection<Object>> keysMap = g1.affinity(null).mapKeysToNodes(allKeys); Collection<Object> g2Keys = keysMap.get(g2.cluster().localNode()); http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java index 7532354..e611723 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java @@ -486,9 +486,9 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCommonAbst while (!finished.get()) { stopGrid(3); - U.sleep(300); - startGrid(3); + + awaitPartitionMapExchange(); } return null; http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicLateAffDisabledPrimaryWriteOrderMultiNodeFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicLateAffDisabledPrimaryWriteOrderMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicLateAffDisabledPrimaryWriteOrderMultiNodeFullApiSelfTest.java new file mode 100644 index 0000000..c0fbb7b --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicLateAffDisabledPrimaryWriteOrderMultiNodeFullApiSelfTest.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache.distributed.near; + +import org.apache.ignite.configuration.IgniteConfiguration; + +/** + * + */ +public class GridCacheAtomicLateAffDisabledPrimaryWriteOrderMultiNodeFullApiSelfTest extends + GridCacheAtomicPrimaryWriteOrderMultiNodeFullApiSelfTest { + /** {@inheritDoc} */ + @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { + IgniteConfiguration cfg = super.getConfiguration(gridName); + + cfg.setLateAffinityAssignment(false); + + return cfg; + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearJobExecutionSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearJobExecutionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearJobExecutionSelfTest.java index 2c8bafc..097278a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearJobExecutionSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearJobExecutionSelfTest.java @@ -34,8 +34,6 @@ public class GridCacheNearJobExecutionSelfTest extends GridCacheAbstractJobExecu @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration c = super.getConfiguration(gridName); - c.getTransactionConfiguration().setTxSerializableEnabled(true); - CacheConfiguration cc = defaultCacheConfiguration(); cc.setCacheMode(CacheMode.PARTITIONED); http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java index c3c319a..4d12954 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java @@ -147,6 +147,8 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest { /** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { startGrids(GRID_CNT); + + awaitPartitionMapExchange(); } /** {@inheritDoc} */ @@ -670,7 +672,7 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest { lock.lock(); try { - AffinityTopologyVersion topVer = new AffinityTopologyVersion(grid(0).cluster().topologyVersion()); + AffinityTopologyVersion topVer = grid(0).context().discovery().topologyVersionEx(); GridNearCacheEntry nearEntry1 = nearEntry(0, key); http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java index 2247acf..661b12a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java @@ -115,6 +115,8 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest { assert aff.backups() >= 0; startGrids(grids); + + awaitPartitionMapExchange(); } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxForceKeyTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxForceKeyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxForceKeyTest.java index 84886d3..80b447c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxForceKeyTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxForceKeyTest.java @@ -22,6 +22,7 @@ import org.apache.ignite.IgniteCache; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; +import org.apache.ignite.marshaller.optimized.OptimizedMarshaller; import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; @@ -70,10 +71,13 @@ public class GridCacheNearTxForceKeyTest extends GridCommonAbstractTest { Ignite ignite1 = startGrid(1); - final Integer key = primaryKey(ignite1.cache(null)); + // This key should become primary for ignite1. + final Integer key = ignite0.configuration().getMarshaller() instanceof OptimizedMarshaller ? 2 : 7; assertNull(cache.getAndPut(key, key)); + awaitPartitionMapExchange(); + assertTrue(ignite0.affinity(null).isPrimary(ignite1.cluster().localNode(), key)); } } http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLateAffDisabledMultiNodeFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLateAffDisabledMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLateAffDisabledMultiNodeFullApiSelfTest.java new file mode 100644 index 0000000..d309505 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLateAffDisabledMultiNodeFullApiSelfTest.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache.distributed.near; + +import org.apache.ignite.configuration.IgniteConfiguration; + +/** + * + */ +public class GridCachePartitionedLateAffDisabledMultiNodeFullApiSelfTest extends GridCachePartitionedMultiNodeFullApiSelfTest { + /** {@inheritDoc} */ + @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { + IgniteConfiguration cfg = super.getConfiguration(gridName); + + cfg.setLateAffinityAssignment(false); + + return cfg; + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeCounterSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeCounterSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeCounterSelfTest.java index 8034f44..f2b8923 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeCounterSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeCounterSelfTest.java @@ -131,6 +131,13 @@ public class GridCachePartitionedMultiNodeCounterSelfTest extends GridCommonAbst backups = DFLT_BACKUPS; } + /** {@inheritDoc} */ + @Override protected void afterTest() throws Exception { + stopAllGrids(); + + super.afterTest(); + } + /** * @param g Grid. * @return Near cache. @@ -191,14 +198,9 @@ public class GridCachePartitionedMultiNodeCounterSelfTest extends GridCommonAbst int priThreads = 2; int nearThreads = 2; - startGrids(gridCnt); + startGridsMultiThreaded(gridCnt, true); - try { - checkNearAndPrimary(gridCnt, priThreads, nearThreads); - } - finally { - stopAllGrids(); - } + checkNearAndPrimary(gridCnt, priThreads, nearThreads); } /** @throws Exception If failed. */ @@ -211,14 +213,9 @@ public class GridCachePartitionedMultiNodeCounterSelfTest extends GridCommonAbst int priThreads = 5; int nearThreads = 5; - startGrids(gridCnt); + startGridsMultiThreaded(gridCnt, true); - try { - checkNearAndPrimary(gridCnt, priThreads, nearThreads); - } - finally { - stopAllGrids(); - } + checkNearAndPrimary(gridCnt, priThreads, nearThreads); } /** @@ -521,28 +518,18 @@ public class GridCachePartitionedMultiNodeCounterSelfTest extends GridCommonAbst public void testMultiNearAndPrimaryMultiNode() throws Exception { int gridCnt = 4; - startGrids(gridCnt); + startGridsMultiThreaded(gridCnt, true); - try { - checkNearAndPrimaryMultiNode(gridCnt); - } - finally { - stopAllGrids(); - } + checkNearAndPrimaryMultiNode(gridCnt); } /** @throws Exception If failed. */ public void testOneNearAndPrimaryMultiNode() throws Exception { int gridCnt = 2; - startGrids(gridCnt); + startGridsMultiThreaded(gridCnt, true); - try { - checkNearAndPrimaryMultiNode(gridCnt); - } - finally { - stopAllGrids(); - } + checkNearAndPrimaryMultiNode(gridCnt); } /** http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java index ad51600..71b14eb 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java @@ -133,6 +133,8 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti for (int i = 0; i < size; i++) putMap.put(i, i * i); + atomicClockModeDelay(prj0); + info(">>> Before second put."); prj1.putAll(putMap); http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheRendezvousAffinityClientSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheRendezvousAffinityClientSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheRendezvousAffinityClientSelfTest.java index 91afb79..ab5f480 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheRendezvousAffinityClientSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheRendezvousAffinityClientSelfTest.java @@ -75,6 +75,8 @@ public class GridCacheRendezvousAffinityClientSelfTest extends GridCommonAbstrac startGrid(2); startGrid(3); + awaitPartitionMapExchange(); + Map<Integer, Collection<UUID>> mapping = new HashMap<>(); for (int i = 0; i < 4; i++) { http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java index f1e5687..5716d59 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java @@ -32,7 +32,6 @@ import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.IgniteInterruptedCheckedException; import org.apache.ignite.internal.IgniteKernal; import org.apache.ignite.internal.managers.communication.GridIoMessage; import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; @@ -47,6 +46,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.Gri import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage; import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleMessage; import org.apache.ignite.internal.util.typedef.G; +import org.apache.ignite.internal.util.typedef.PA; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteInClosure; import org.apache.ignite.plugin.extensions.communication.Message; @@ -93,7 +93,7 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest { private volatile boolean concurrentStartFinished3; /** */ - private volatile boolean record = false; + private volatile boolean record; /** */ private final ConcurrentHashMap<Class, AtomicInteger> map = new ConcurrentHashMap<>(); @@ -209,9 +209,8 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest { log.info("<" + name + "> Checked " + (i + 1) * 100 / (TEST_SIZE) + "% entries. [count=" + TEST_SIZE + ", iteration=" + iter + ", cache=" + name + "]"); - assertTrue(i + " value " + (i + name.hashCode() + iter) + " does not match (" + ignite.cache(name).get(i) + ")", - ignite.cache(name).get(i) != null && ignite.cache(name).get(i).equals(i + name.hashCode() + iter)); - + assertEquals("Value does not match [key=" + i + ", cache=" + name + ']', + ignite.cache(name).get(i), i + name.hashCode() + iter); } } @@ -236,8 +235,10 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest { startGrid(1); - waitForRebalancing(0, 2); - waitForRebalancing(1, 2); + int waitMinorVer = ignite.configuration().isLateAffinityAssignment() ? 1 : 0; + + waitForRebalancing(0, new AffinityTopologyVersion(2, waitMinorVer)); + waitForRebalancing(1, new AffinityTopologyVersion(2, waitMinorVer)); awaitPartitionMapExchange(true, true); @@ -257,8 +258,8 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest { startGrid(2); - waitForRebalancing(1, 4); - waitForRebalancing(2, 4); + waitForRebalancing(1, new AffinityTopologyVersion(4, waitMinorVer)); + waitForRebalancing(2, new AffinityTopologyVersion(4, waitMinorVer)); awaitPartitionMapExchange(true, true); @@ -377,44 +378,71 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest { protected void waitForRebalancing(int id, AffinityTopologyVersion top) throws IgniteCheckedException { boolean finished = false; - while (!finished) { + long stopTime = System.currentTimeMillis() + 60_000; + + while (!finished && (System.currentTimeMillis() < stopTime)) { finished = true; for (GridCacheAdapter c : grid(id).context().cache().internalCaches()) { GridDhtPartitionDemander.RebalanceFuture fut = (GridDhtPartitionDemander.RebalanceFuture)c.preloader().rebalanceFuture(); - if (fut.topologyVersion() == null || !fut.topologyVersion().equals(top)) { + if (fut.topologyVersion() == null || fut.topologyVersion().compareTo(top) < 0) { finished = false; + log.info("Unexpected future version, will retry [futVer=" + fut.topologyVersion() + + ", expVer=" + top + ']'); + + U.sleep(1000); + break; } - else if (!fut.get()) { - finished = false; + else { + finished = fut.get(); - log.warning("Rebalancing finished with missed partitions."); + if (!finished) { + log.warning("Rebalancing finished with missed partitions: " + fut.topologyVersion()); + + U.sleep(100); + } + else + break; } } } + + assertTrue(finished); } /** - * + * @throws Exception If failed. */ @SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter") - protected void checkSupplyContextMapIsEmpty() { + protected void checkSupplyContextMapIsEmpty() throws Exception { for (Ignite g : G.allGrids()) { for (GridCacheAdapter c : ((IgniteEx)g).context().cache().internalCaches()) { - Object supplier = U.field(c.preloader(), "supplier"); - Map map = U.field(supplier, "scMap"); + final Map map = U.field(supplier, "scMap"); + + GridTestUtils.waitForCondition(new PA() { + @Override public boolean apply() { + synchronized (map) { + return map.isEmpty(); + } + } + }, 15_000); synchronized (map) { - assertTrue(map.isEmpty()); + assertTrue("Map is not empty [cache=" + c.name() + + ", node=" + g.name() + + ", map=" + map + ']', map.isEmpty()); } } } } + /** + * + */ protected void checkPartitionMapExchangeFinished() { for (Ignite g : G.allGrids()) { IgniteKernal g0 = (IgniteKernal)g; @@ -457,16 +485,18 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest { entry.getValue() == GridDhtPartitionState.OWNING); } - for (GridDhtLocalPartition loc : locs) { + for (GridDhtLocalPartition loc : locs) assertTrue(pMap.containsKey(loc.id())); - } } } } } } - protected void checkPartitionMapMessagesAbsent() throws IgniteInterruptedCheckedException { + /** + * @throws Exception If failed. + */ + protected void checkPartitionMapMessagesAbsent() throws Exception { map.clear(); record = true; @@ -478,8 +508,11 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest { AtomicInteger iF = map.get(GridDhtPartitionsFullMessage.class); AtomicInteger iS = map.get(GridDhtPartitionsSingleMessage.class); - assertTrue(iF == null || iF.get() == 1); // 1 message can be sent right after all checks passed. - assertTrue(iS == null); + Integer fullMap = iF != null ? iF.get() : null; + Integer singleMap = iS != null ? iS.get() : null; + + assertTrue("Unexpected full map messages: " + fullMap, fullMap == null || fullMap.equals(1)); // 1 message can be sent right after all checks passed. + assertNull("Unexpected single map messages", singleMap); } /** {@inheritDoc} */ @@ -662,7 +695,7 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest { } /** - * @param msg + * @param msg Message. */ private void recordMessage(Object msg) { if (record) { http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedJobExecutionTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedJobExecutionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedJobExecutionTest.java index e00e827..6d27be1 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedJobExecutionTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedJobExecutionTest.java @@ -32,8 +32,6 @@ public class GridCacheReplicatedJobExecutionTest extends GridCacheAbstractJobExe @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration c = super.getConfiguration(gridName); - c.getTransactionConfiguration().setTxSerializableEnabled(true); - CacheConfiguration cc = defaultCacheConfiguration(); cc.setCacheMode(CacheMode.REPLICATED); http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java index 32add4f..4226537 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java @@ -258,6 +258,9 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC */ public void testRebalanceVersion() throws Exception { Ignite ignite0 = startGrid(0); + + int minorVer = ignite0.configuration().isLateAffinityAssignment() ? 1 : 0; + GridDhtPartitionTopology top0 = ((IgniteKernal)ignite0).context().cache().context().cacheContext(1).topology(); assertTrue(top0.rebalanceFinished(new AffinityTopologyVersion(1))); @@ -266,8 +269,8 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC Ignite ignite1 = startGrid(1); GridDhtPartitionTopology top1 = ((IgniteKernal)ignite1).context().cache().context().cacheContext(1).topology(); - waitRebalanceFinished(ignite0, 2); - waitRebalanceFinished(ignite1, 2); + waitRebalanceFinished(ignite0, 2, minorVer); + waitRebalanceFinished(ignite1, 2, minorVer); assertFalse(top0.rebalanceFinished(new AffinityTopologyVersion(3))); assertFalse(top1.rebalanceFinished(new AffinityTopologyVersion(3))); @@ -275,9 +278,9 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC Ignite ignite2 = startGrid(2); GridDhtPartitionTopology top2 = ((IgniteKernal)ignite2).context().cache().context().cacheContext(1).topology(); - waitRebalanceFinished(ignite0, 3); - waitRebalanceFinished(ignite1, 3); - waitRebalanceFinished(ignite2, 3); + waitRebalanceFinished(ignite0, 3, minorVer); + waitRebalanceFinished(ignite1, 3, minorVer); + waitRebalanceFinished(ignite2, 3, minorVer); assertFalse(top0.rebalanceFinished(new AffinityTopologyVersion(4))); assertFalse(top1.rebalanceFinished(new AffinityTopologyVersion(4))); @@ -295,9 +298,9 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC stopGrid(1); - waitRebalanceFinished(ignite0, 5); - waitRebalanceFinished(ignite2, 5); - waitRebalanceFinished(ignite3, 5); + waitRebalanceFinished(ignite0, 5, 0); + waitRebalanceFinished(ignite2, 5, 0); + waitRebalanceFinished(ignite3, 5, 0); } /** @@ -305,8 +308,8 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC * @param topVer Topology version. * @throws Exception If failed. */ - private void waitRebalanceFinished(Ignite ignite, long topVer) throws Exception { - final AffinityTopologyVersion topVer0 = new AffinityTopologyVersion(topVer); + private void waitRebalanceFinished(Ignite ignite, long topVer, int minorVer) throws Exception { + final AffinityTopologyVersion topVer0 = new AffinityTopologyVersion(topVer, minorVer); final GridDhtPartitionTopology top = ((IgniteKernal)ignite).context().cache().context().cacheContext(1).topology(); @@ -1187,15 +1190,22 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC * @param cache Cache. * @param parts Number of partitions. * @return Keys. + * @throws Exception If failed. */ - private List<Integer> testKeys(IgniteCache<Object, Object> cache, int parts) { + private List<Integer> testKeys(IgniteCache<Object, Object> cache, int parts) throws Exception { Ignite ignite = cache.unwrap(Ignite.class); List<Integer> res = new ArrayList<>(); - Affinity<Object> aff = ignite.affinity(cache.getName()); + final Affinity<Object> aff = ignite.affinity(cache.getName()); - ClusterNode node = ignite.cluster().localNode(); + final ClusterNode node = ignite.cluster().localNode(); + + assertTrue(GridTestUtils.waitForCondition(new GridAbsPredicate() { + @Override public boolean apply() { + return aff.primaryPartitions(node).length > 0; + } + }, 5000)); int[] nodeParts = aff.primaryPartitions(node); http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStorePartitionedMultiNodeSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStorePartitionedMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStorePartitionedMultiNodeSelfTest.java index c010439..777c350 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStorePartitionedMultiNodeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStorePartitionedMultiNodeSelfTest.java @@ -22,6 +22,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; import org.apache.ignite.IgniteCache; import org.apache.ignite.cache.CacheMode; import org.apache.ignite.cache.store.CacheStore; @@ -58,7 +59,7 @@ public class GridCacheWriteBehindStorePartitionedMultiNodeSelfTest extends GridC private GridCacheTestStore[] stores = new GridCacheTestStore[GRID_CNT]; /** Start grid counter. */ - private int idx; + private AtomicInteger idx = new AtomicInteger(); /** {@inheritDoc} */ @SuppressWarnings("unchecked") @@ -79,7 +80,7 @@ public class GridCacheWriteBehindStorePartitionedMultiNodeSelfTest extends GridC cc.setAtomicityMode(TRANSACTIONAL); cc.setNearConfiguration(new NearCacheConfiguration()); - CacheStore store = stores[idx] = new GridCacheTestStore(); + CacheStore store = stores[idx.getAndIncrement()] = new GridCacheTestStore(); cc.setCacheStoreFactory(singletonFactory(store)); cc.setReadThrough(true); @@ -88,8 +89,6 @@ public class GridCacheWriteBehindStorePartitionedMultiNodeSelfTest extends GridC c.setCacheConfiguration(cc); - idx++; - return c; } @@ -104,9 +103,7 @@ public class GridCacheWriteBehindStorePartitionedMultiNodeSelfTest extends GridC * @throws Exception If failed. */ private void prepare() throws Exception { - idx = 0; - - startGrids(GRID_CNT); + startGridsMultiThreaded(GRID_CNT, true); } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java b/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java index 88605b4..fb82e20 100644 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java +++ b/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java @@ -21,6 +21,7 @@ import java.util.IdentityHashMap; import org.apache.ignite.cache.store.CacheStore; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.internal.processors.cache.CacheOsConflictResolutionManager; +import org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager; import org.apache.ignite.internal.processors.cache.CacheType; import org.apache.ignite.internal.processors.cache.GridCacheAffinityManager; import org.apache.ignite.internal.processors.cache.GridCacheContext; @@ -65,6 +66,7 @@ public class GridCacheTestContext<K, V> extends GridCacheContext<K, V> { new GridCacheMvccManager(), new GridCacheDeploymentManager<K, V>(), new GridCachePartitionExchangeManager<K, V>(), + new CacheAffinitySharedManager<K, V>(), new GridCacheIoManager(), new CacheNoopJtaManager(), null http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java index 2f8155c..170e9cf 100644 --- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java @@ -774,7 +774,8 @@ public abstract class GridAbstractTest extends TestCase { log.info("Node started with the following configuration [id=" + node.cluster().localNode().id() + ", marshaller=" + nodeCfg.getMarshaller() - + ", binaryCfg=" + nodeCfg.getBinaryConfiguration() + "]"); + + ", binaryCfg=" + nodeCfg.getBinaryConfiguration() + + ", lateAff=" + nodeCfg.isLateAffinityAssignment() + "]"); return node; } http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java index e53ec56..5b03f8e 100644 --- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java @@ -75,10 +75,12 @@ import org.apache.ignite.internal.processors.cache.local.GridLocalCache; import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.G; +import org.apache.ignite.internal.util.typedef.PA; import org.apache.ignite.internal.util.typedef.internal.LT; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteFuture; import org.apache.ignite.lang.IgnitePredicate; +import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.GridAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; @@ -459,7 +461,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest { if (readyVer.topologyVersion() > 0 && c.context().started()) { // Must map on updated version of topology. Collection<ClusterNode> affNodes = - g0.affinity(cfg.getName()).mapPartitionToPrimaryAndBackups(p); + dht.context().affinity().assignment(readyVer).idealAssignment().get(p); int exp = affNodes.size(); @@ -479,12 +481,12 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest { ", cache=" + cfg.getName() + ", cacheId=" + dht.context().cacheId() + ", topVer=" + top.topologyVersion() + - ", topFut=" + topFut + ", p=" + p + ", affNodesCnt=" + exp + ", ownersCnt=" + actual + - ", affNodes=" + affNodes + - ", owners=" + owners + + ", affNodes=" + F.nodeIds(affNodes) + + ", owners=" + F.nodeIds(owners) + + ", topFut=" + topFut + ", locNode=" + g.cluster().localNode() + ']'); } else @@ -631,27 +633,67 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest { * @return Collection of keys for which given cache is primary. */ @SuppressWarnings("unchecked") - protected List<Integer> primaryKeys(IgniteCache<?, ?> cache, int cnt, int startFrom) { + protected List<Integer> primaryKeys(IgniteCache<?, ?> cache, final int cnt, final int startFrom) { + return findKeys(cache, cnt, startFrom, 0); + } + + /** + * @param cache Cache. + * @param cnt Keys count. + * @param startFrom Start value for keys search. + * @return Collection of keys for which given cache is primary. + */ + @SuppressWarnings("unchecked") + protected List<Integer> findKeys(IgniteCache<?, ?> cache, final int cnt, final int startFrom, final int type) { assert cnt > 0 : cnt; - List<Integer> found = new ArrayList<>(cnt); + final List<Integer> found = new ArrayList<>(cnt); - ClusterNode locNode = localNode(cache); + final ClusterNode locNode = localNode(cache); - Affinity<Integer> aff = (Affinity<Integer>)affinity(cache); + final Affinity<Integer> aff = (Affinity<Integer>)affinity(cache); - for (int i = startFrom; i < startFrom + 100_000; i++) { - Integer key = i; + try { + GridTestUtils.waitForCondition(new PA() { + @Override public boolean apply() { + for (int i = startFrom; i < startFrom + 100_000; i++) { + Integer key = i; - if (aff.isPrimary(locNode, key)) { - found.add(key); + boolean ok; - if (found.size() == cnt) - return found; - } + if (type == 0) + ok = aff.isPrimary(locNode, key); + else if (type == 1) + ok = aff.isBackup(locNode, key); + else if (type == 2) + ok = !aff.isPrimaryOrBackup(locNode, key); + else { + fail(); + + return false; + } + + if (ok) { + if (!found.contains(key)) + found.add(key); + + if (found.size() == cnt) + return true; + } + } + + return false; + } + }, 5000); + } + catch (IgniteCheckedException e) { + throw new IgniteException(e); } - throw new IgniteException("Unable to find " + cnt + " keys as primary for cache."); + if (found.size() != cnt) + throw new IgniteException("Unable to find " + cnt + " requied keys."); + + return found; } /** @@ -684,26 +726,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest { */ @SuppressWarnings("unchecked") protected List<Integer> backupKeys(IgniteCache<?, ?> cache, int cnt, int startFrom) { - assert cnt > 0 : cnt; - - List<Integer> found = new ArrayList<>(cnt); - - ClusterNode locNode = localNode(cache); - - Affinity<Integer> aff = affinity((IgniteCache<Integer, ?>)cache); - - for (int i = startFrom; i < startFrom + 100_000; i++) { - Integer key = i; - - if (aff.isBackup(locNode, key)) { - found.add(key); - - if (found.size() == cnt) - return found; - } - } - - throw new IgniteException("Unable to find " + cnt + " keys as backup for cache."); + return findKeys(cache, cnt, startFrom, 1); } /** @@ -716,26 +739,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest { @SuppressWarnings("unchecked") protected List<Integer> nearKeys(IgniteCache<?, ?> cache, int cnt, int startFrom) throws IgniteCheckedException { - assert cnt > 0 : cnt; - - List<Integer> found = new ArrayList<>(cnt); - - ClusterNode locNode = localNode(cache); - - Affinity<Integer> aff = affinity((IgniteCache<Integer, ?>)cache); - - for (int i = startFrom; i < startFrom + 100_000; i++) { - Integer key = i; - - if (!aff.isPrimaryOrBackup(locNode, key)) { - found.add(key); - - if (found.size() == cnt) - return found; - } - } - - throw new IgniteCheckedException("Unable to find " + cnt + " keys as near for cache."); + return findKeys(cache, cnt, startFrom, 2); } /** http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java index 29109be..8414461 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java @@ -41,6 +41,7 @@ import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAto import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicClientOnlyMultiNodeP2PDisabledFullApiSelfTest; import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicCopyOnReadDisabledMultiNodeFullApiSelfTest; import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicFairAffinityMultiNodeFullApiSelfTest; +import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicLateAffDisabledPrimaryWriteOrderMultiNodeFullApiSelfTest; import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicMultiNodeFullApiSelfTest; import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicMultiNodeP2PDisabledFullApiSelfTest; import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicNearEnabledFairAffinityMultiNodeFullApiSelfTest; @@ -69,6 +70,7 @@ import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePar import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedFilteredPutSelfTest; import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedFullApiMultithreadedSelfTest; import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedFullApiSelfTest; +import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedLateAffDisabledMultiNodeFullApiSelfTest; import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedMultiNodeCounterSelfTest; import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedMultiNodeFullApiSelfTest; import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedMultiNodeP2PDisabledFullApiSelfTest; @@ -213,6 +215,10 @@ public class IgniteCacheFullApiSelfTestSuite extends TestSuite { suite.addTestSuite(GridCachePartitionedNearDisabledOffHeapTieredMultiNodeFullApiSelfTest.class); suite.addTestSuite(GridCachePartitionedNearDisabledAtomicOffHeapTieredMultiNodeFullApiSelfTest.class); + // Old affinity assignment mode. + suite.addTestSuite(GridCachePartitionedLateAffDisabledMultiNodeFullApiSelfTest.class); + suite.addTestSuite(GridCacheAtomicLateAffDisabledPrimaryWriteOrderMultiNodeFullApiSelfTest.class); + // Multithreaded. suite.addTestSuite(GridCacheLocalFullApiMultithreadedSelfTest.class); suite.addTestSuite(GridCacheReplicatedFullApiMultithreadedSelfTest.class); http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java index 3e8d66a..652643d 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java @@ -35,6 +35,7 @@ import org.apache.ignite.internal.processors.cache.GridCachePartitionedProjectio import org.apache.ignite.internal.processors.cache.GridCacheVariableTopologySelfTest; import org.apache.ignite.internal.processors.cache.IgniteAtomicCacheEntryProcessorNodeJoinTest; import org.apache.ignite.internal.processors.cache.IgniteCacheEntryProcessorNodeJoinTest; +import org.apache.ignite.internal.processors.cache.IgniteCacheIncrementTxTest; import org.apache.ignite.internal.processors.cache.IgniteCachePartitionMapUpdateTest; import org.apache.ignite.internal.processors.cache.IgniteDynamicCacheAndNodeStop; import org.apache.ignite.internal.processors.cache.distributed.CacheLoadingConcurrentGridStartSelfTest; @@ -112,6 +113,7 @@ import org.apache.ignite.internal.processors.cache.distributed.near.GridPartitio import org.apache.ignite.internal.processors.cache.distributed.near.NearCacheSyncUpdateTest; import org.apache.ignite.internal.processors.cache.distributed.near.NoneRebalanceModeSelfTest; import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedEvictionSelfTest; +import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedJobExecutionTest; import org.apache.ignite.internal.processors.cache.local.GridCacheLocalAtomicBasicStoreSelfTest; import org.apache.ignite.internal.processors.cache.local.GridCacheLocalAtomicGetAndTransformStoreSelfTest; import org.apache.ignite.internal.processors.cache.local.GridCacheLocalBasicApiSelfTest; @@ -162,6 +164,7 @@ public class IgniteCacheTestSuite2 extends TestSuite { suite.addTest(new TestSuite(GridCacheNearMultiGetSelfTest.class)); suite.addTest(new TestSuite(NoneRebalanceModeSelfTest.class)); suite.addTest(new TestSuite(GridCacheNearJobExecutionSelfTest.class)); + suite.addTest(new TestSuite(GridCacheReplicatedJobExecutionTest.class)); suite.addTest(new TestSuite(GridCacheNearOneNodeSelfTest.class)); suite.addTest(new TestSuite(GridCacheNearMultiNodeSelfTest.class)); suite.addTest(new TestSuite(GridCacheAtomicNearMultiNodeSelfTest.class)); @@ -254,6 +257,7 @@ public class IgniteCacheTestSuite2 extends TestSuite { suite.addTest(new TestSuite(CacheConfigurationLeakTest.class)); suite.addTest(new TestSuite(CacheEnumOperationsSingleNodeTest.class)); suite.addTest(new TestSuite(CacheEnumOperationsTest.class)); + suite.addTest(new TestSuite(IgniteCacheIncrementTxTest.class)); return suite; } http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java index d82f0b7..8f3cf12 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java @@ -33,6 +33,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheValueBytesPreloading import org.apache.ignite.internal.processors.cache.GridCacheValueConsistencyTransactionalNearEnabledSelfTest; import org.apache.ignite.internal.processors.cache.GridCacheValueConsistencyTransactionalSelfTest; import org.apache.ignite.internal.processors.cache.GridCacheVersionSelfTest; +import org.apache.ignite.internal.processors.cache.GridCacheVersionTopologyChangeTest; import org.apache.ignite.internal.processors.cache.IgniteCacheInterceptorSelfTestSuite; import org.apache.ignite.internal.processors.cache.IgniteCacheScanPredicateDeploymentSelfTest; import org.apache.ignite.internal.processors.cache.distributed.CacheAsyncOperationsTest; @@ -175,6 +176,7 @@ public class IgniteCacheTestSuite3 extends TestSuite { suite.addTestSuite(GridCacheEntryVersionSelfTest.class); suite.addTestSuite(GridCacheVersionSelfTest.class); + suite.addTestSuite(GridCacheVersionTopologyChangeTest.class); // Memory leak tests. suite.addTestSuite(GridCacheReferenceCleanupSelfTest.class); http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java index 305f5cd..0c24425 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java @@ -23,6 +23,8 @@ import org.apache.ignite.internal.processors.cache.CacheSerializableTransactions import org.apache.ignite.internal.processors.cache.GridCacheSwapSpaceSpiConsistencySelfTest; import org.apache.ignite.internal.processors.cache.IgniteCachePutStackOverflowSelfTest; import org.apache.ignite.internal.processors.cache.IgniteCacheStoreCollectionTest; +import org.apache.ignite.internal.processors.cache.distributed.CacheLateAffinityAssignmentFairAffinityTest; +import org.apache.ignite.internal.processors.cache.distributed.CacheLateAffinityAssignmentTest; import org.apache.ignite.internal.processors.cache.store.IgniteCacheWriteBehindNoUpdateSelfTest; /** @@ -43,6 +45,9 @@ public class IgniteCacheTestSuite5 extends TestSuite { suite.addTestSuite(IgniteCachePutStackOverflowSelfTest.class); suite.addTestSuite(GridCacheSwapSpaceSpiConsistencySelfTest.class); + suite.addTestSuite(CacheLateAffinityAssignmentTest.class); + suite.addTestSuite(CacheLateAffinityAssignmentFairAffinityTest.class); + return suite; } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopContext.java ---------------------------------------------------------------------- diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopContext.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopContext.java index b81b9f5..42a3d72 100644 --- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopContext.java +++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopContext.java @@ -122,8 +122,7 @@ public class HadoopContext { * @return Hadoop-enabled nodes. */ public Collection<ClusterNode> nodes() { - return ctx.discovery().cacheNodes(CU.SYS_CACHE_HADOOP_MR, - new AffinityTopologyVersion(ctx.discovery().topologyVersion())); + return ctx.discovery().cacheNodes(CU.SYS_CACHE_HADOOP_MR, ctx.discovery().topologyVersionEx()); } /** http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/child/HadoopChildProcessRunner.java ---------------------------------------------------------------------- diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/child/HadoopChildProcessRunner.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/child/HadoopChildProcessRunner.java index 550c3ba..a949141 100644 --- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/child/HadoopChildProcessRunner.java +++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/child/HadoopChildProcessRunner.java @@ -147,7 +147,7 @@ public class HadoopChildProcessRunner { log.debug("External process initialized [initWaitTime=" + (U.currentTimeMillis() - startTime) + ']'); - initFut.onDone(null, null); + initFut.onDone(); } catch (IgniteCheckedException e) { U.error(log, "Failed to initialize process: " + req, e); http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/hadoop/src/test/java/org/apache/ignite/igfs/HadoopIgfs20FileSystemAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/hadoop/src/test/java/org/apache/ignite/igfs/HadoopIgfs20FileSystemAbstractSelfTest.java b/modules/hadoop/src/test/java/org/apache/ignite/igfs/HadoopIgfs20FileSystemAbstractSelfTest.java index 9c301c9..93a924c 100644 --- a/modules/hadoop/src/test/java/org/apache/ignite/igfs/HadoopIgfs20FileSystemAbstractSelfTest.java +++ b/modules/hadoop/src/test/java/org/apache/ignite/igfs/HadoopIgfs20FileSystemAbstractSelfTest.java @@ -226,6 +226,8 @@ public abstract class HadoopIgfs20FileSystemAbstractSelfTest extends IgfsCommonA } startGrids(4); + + awaitPartitionMapExchange(); } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/hadoop/src/test/java/org/apache/ignite/igfs/IgniteHadoopFileSystemAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/hadoop/src/test/java/org/apache/ignite/igfs/IgniteHadoopFileSystemAbstractSelfTest.java b/modules/hadoop/src/test/java/org/apache/ignite/igfs/IgniteHadoopFileSystemAbstractSelfTest.java index 6617127..083ee54 100644 --- a/modules/hadoop/src/test/java/org/apache/ignite/igfs/IgniteHadoopFileSystemAbstractSelfTest.java +++ b/modules/hadoop/src/test/java/org/apache/ignite/igfs/IgniteHadoopFileSystemAbstractSelfTest.java @@ -1608,6 +1608,8 @@ public abstract class IgniteHadoopFileSystemAbstractSelfTest extends IgfsCommonA IgfsFile fileInfo = igfs.info(filePath); + awaitPartitionMapExchange(); + Collection<IgfsBlockLocation> locations = igfs.affinity(filePath, 0, fileInfo.length()); assertEquals(1, locations.size()); http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java index 47ab083..6a079f0 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java @@ -389,7 +389,7 @@ public class GridReduceQueryExecutor { ) { String space = cctx.name(); - Set<ClusterNode> nodes = new HashSet<>(dataNodes(space, topVer)); + Set<ClusterNode> nodes = new HashSet<>(cctx.affinity().assignment(topVer).primaryPartitionNodes()); if (F.isEmpty(nodes)) throw new CacheException("Failed to find data nodes for cache: " + space); @@ -405,7 +405,7 @@ public class GridReduceQueryExecutor { throw new CacheException("Queries running on replicated cache should not contain JOINs " + "with partitioned tables [rCache=" + cctx.name() + ", pCache=" + extraSpace + "]"); - Collection<ClusterNode> extraNodes = dataNodes(extraSpace, topVer); + Collection<ClusterNode> extraNodes = extraCctx.affinity().assignment(topVer).primaryPartitionNodes(); if (F.isEmpty(extraNodes)) throw new CacheException("Failed to find data nodes for cache: " + extraSpace); http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientReconnectQueriesTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientReconnectQueriesTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientReconnectQueriesTest.java index ad04a51..dfbc2ff 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientReconnectQueriesTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientReconnectQueriesTest.java @@ -336,7 +336,7 @@ public class IgniteClientReconnectQueriesTest extends IgniteClientReconnectAbstr */ private void blockMessage(Class<?> clazz) { for (int i = 0; i < serverCount(); i++) { - BlockTpcCommunicationSpi commSpi = commSpi(grid(i)); + BlockTcpCommunicationSpi commSpi = commSpi(grid(i)); commSpi.blockMessage(clazz); } @@ -347,7 +347,7 @@ public class IgniteClientReconnectQueriesTest extends IgniteClientReconnectAbstr */ private void unblockMessage() { for (int i = 0; i < serverCount(); i++) { - BlockTpcCommunicationSpi commSpi = commSpi(grid(i)); + BlockTcpCommunicationSpi commSpi = commSpi(grid(i)); commSpi.unblockMessage(); } http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java index e00611b..2fa4750 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java @@ -238,6 +238,9 @@ public class IgniteCacheQueryNodeRestartSelfTest2 extends GridCommonAbstractTest assertEquals(pRes, cache.query(qry).getAll()); } catch (CacheException e) { + if (!smallPageSize) + e.printStackTrace(); + assertTrue("On large page size must retry.", smallPageSize); boolean failedOnRemoteFetch = false; http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs index 0036abd..296b348 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs @@ -992,20 +992,25 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous List<int> keys = new List<int>(cnt); - for (int i = startFrom; i < startFrom + 100000; i++) - { - if (aff.IsPrimary(node, i)) + Assert.IsTrue( + TestUtils.WaitForCondition(() => { - keys.Add(i); + for (int i = startFrom; i < startFrom + 100000; i++) + { + if (aff.IsPrimary(node, i)) + { + keys.Add(i); - if (keys.Count == cnt) - return keys; - } - } + if (keys.Count == cnt) + return true; + } + } + + return false; + }, 5000), "Failed to find " + cnt + " primary keys."); - Assert.Fail("Failed to find " + cnt + " primary keys."); - return null; + return keys; } /// <summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/e7e223f7/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs index 50ecfac..0ecd9fe 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs @@ -21,6 +21,7 @@ namespace Apache.Ignite.Core.Tests using System.IO; using System.Linq; using System.Runtime.Serialization.Formatters.Binary; + using System.Threading; using System.Threading.Tasks; using Apache.Ignite.Core.Binary; using Apache.Ignite.Core.Cache; @@ -254,9 +255,13 @@ namespace Apache.Ignite.Core.Tests while (true) { + Thread.Sleep(1000); + Ignition.Stop("grid_2", true); StartGrid("grid_2"); + Thread.Sleep(1000); + if (putTask.Exception != null) throw putTask.Exception;
