Repository: ignite Updated Branches: refs/heads/ignite-5272 e4259ce3f -> 791088dff
ignite-5272 Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/791088df Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/791088df Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/791088df Branch: refs/heads/ignite-5272 Commit: 791088dffb5e7379bbefc853f28e8af7bcc06365 Parents: e4259ce Author: sboikov <[email protected]> Authored: Wed Jun 14 10:43:49 2017 +0300 Committer: sboikov <[email protected]> Committed: Wed Jun 14 11:04:38 2017 +0300 ---------------------------------------------------------------------- .../cache/CacheAffinitySharedManager.java | 2 +- .../cache/CacheStopAndDestroySelfTest.java | 38 ++++++++++---------- .../CacheLateAffinityAssignmentTest.java | 8 ++--- ...teCacheClientNodePartitionsExchangeTest.java | 23 ++++++------ 4 files changed, 36 insertions(+), 35 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/791088df/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java index 5dafa36..37a53b9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java @@ -396,7 +396,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap CacheGroupContext grp = cctx.cache().cacheGroup(desc.groupId()); assert grp != null : desc.groupId(); - assert !grp.affinityNode() : grp.cacheOrGroupName(); + assert !grp.affinityNode() || grp.isLocal() : grp.cacheOrGroupName(); if (!grp.isLocal() && grp.affinity().lastVersion().equals(AffinityTopologyVersion.NONE)) { assert grp.localStartVersion().equals(topVer) : grp.localStartVersion(); http://git-wip-us.apache.org/repos/asf/ignite/blob/791088df/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java index 1a7e76a..f67e247 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java @@ -30,6 +30,7 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.configuration.MemoryConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; +import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.managers.communication.GridIoMessage; import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareRequest; @@ -50,24 +51,25 @@ import static org.apache.ignite.cache.CacheMode.PARTITIONED; /** * Checks stop and destroy methods behavior. */ +@SuppressWarnings("unchecked") public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest { /** */ private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); - /** key-value used at test. */ - protected static String KEY_VAL = "1"; + /** Key-value used at test. */ + private static String KEY_VAL = "1"; - /** cache name 1. */ - protected static String CACHE_NAME_DHT = "cache"; + /** Cache name 1. */ + private static String CACHE_NAME_DHT = "cache"; - /** cache name 2. */ - protected static String CACHE_NAME_CLIENT = "cache_client"; + /** Cache name 2. */ + private static String CACHE_NAME_CLIENT = "cache_client"; - /** near cache name. */ - protected static String CACHE_NAME_NEAR = "cache_near"; + /** Near cache name. */ + private static String CACHE_NAME_NEAR = "cache_near"; - /** local cache name. */ - protected static String CACHE_NAME_LOC = "cache_local"; + /** Local cache name. */ + private static String CACHE_NAME_LOC = "cache_local"; /** Memory configuration to be used on client nodes with local caches. */ private static MemoryConfiguration memCfg; @@ -121,12 +123,12 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest { public static AtomicInteger cnt = new AtomicInteger(); /** Node filter. */ - public static UUID nodeFilter; + static UUID nodeFilter; /** {@inheritDoc} */ - @Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackClosure) + @Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackC) throws IgniteSpiException { - super.sendMessage(node, msg, ackClosure); + super.sendMessage(node, msg, ackC); if (nodeFilter != null && node.id().equals(nodeFilter) && @@ -557,8 +559,6 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testNearClose() throws Exception { - fail("https://issues.apache.org/jira/browse/IGNITE-2189"); - startGridsMultiThreaded(gridCount()); IgniteCache<String, String> cache0 = grid(0).getOrCreateCache(getNearConfig()); @@ -596,9 +596,6 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest { U.sleep(1000); - // Ensure near cache was NOT automatically updated. - assert CountingTxRequestsToClientNodeTcpCommunicationSpi.cnt.get() == 0; - assert cache0.get(KEY_VAL).equals(KEY_VAL + 0);// Not affected. assert cache1.get(KEY_VAL).equals(KEY_VAL + 0);// Not affected. @@ -702,7 +699,10 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest { AffinityTopologyVersion topVer = grid(1).context().cache().context().exchange().lastTopologyFuture().get(); - grid(0).context().cache().context().exchange().affinityReadyFuture(topVer).get(); + IgniteInternalFuture<?> fut = grid(0).context().cache().context().exchange().affinityReadyFuture(topVer); + + if (fut != null) + fut.get(); grid(0).getOrCreateCache(getLocalConfig()); http://git-wip-us.apache.org/repos/asf/ignite/blob/791088df/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java index db76147..db3f5cd 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java @@ -832,11 +832,11 @@ public class CacheLateAffinityAssignmentTest extends GridCommonAbstractTest { assertNotNull(client.cache(CACHE_NAME1)); - checkAffinity(4, topVer(4, 1), false); + checkAffinity(4, topVer(4, 0), false); spi.stopBlock(); - checkAffinity(4, topVer(4, 2), true); + checkAffinity(4, topVer(4, 1), true); } /** @@ -1274,11 +1274,11 @@ public class CacheLateAffinityAssignmentTest extends GridCommonAbstractTest { client.cache(CACHE_NAME2); - checkAffinity(4, topVer(4, 2), true); + checkAffinity(4, topVer(4, 1), true); client.destroyCache(CACHE_NAME2); - checkAffinity(4, topVer(4, 3), true); + checkAffinity(4, topVer(4, 2), true); } /** http://git-wip-us.apache.org/repos/asf/ignite/blob/791088df/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 0885b1a..1f850b2 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 @@ -530,26 +530,31 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr else ignite2.cache(CACHE_NAME1); - waitForTopologyUpdate(3, new AffinityTopologyVersion(3, ++minorVer)); - GridCacheAdapter cache = ((IgniteKernal)ignite2).context().cache().context().cache().internalCache(CACHE_NAME1); assertNotNull(cache); assertEquals(nearCache, cache.context().isNear()); assertEquals(0, spi0.partitionsSingleMessages()); - assertEquals(1, spi0.partitionsFullMessages()); + assertEquals(0, spi0.partitionsFullMessages()); assertEquals(0, spi1.partitionsSingleMessages()); assertEquals(0, spi1.partitionsFullMessages()); - assertEquals(1, spi2.partitionsSingleMessages()); + assertEquals(0, spi2.partitionsSingleMessages()); assertEquals(0, spi2.partitionsFullMessages()); - ClusterNode clientNode = ((IgniteKernal)ignite2).localNode(); + final ClusterNode clientNode = ((IgniteKernal)ignite2).localNode(); for (Ignite ignite : Ignition.allGrids()) { - GridDiscoveryManager disco = ((IgniteKernal)ignite).context().discovery(); + final GridDiscoveryManager disco = ((IgniteKernal)ignite).context().discovery(); + + GridTestUtils.waitForCondition(new GridAbsPredicate() { + @Override public boolean apply() { + return disco.cacheNode(clientNode, CACHE_NAME1); + } + }, 5000); assertTrue(disco.cacheNode(clientNode, CACHE_NAME1)); + assertFalse(disco.cacheAffinityNode(clientNode, CACHE_NAME1)); assertEquals(nearCache, disco.cacheNearNode(clientNode, CACHE_NAME1)); } @@ -565,8 +570,6 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr assertNull(((IgniteKernal)ignite2).context().cache().context().cache().internalCache(CACHE_NAME1)); - waitForTopologyUpdate(3, new AffinityTopologyVersion(3, ++minorVer)); - assertEquals(0, spi0.partitionsSingleMessages()); assertEquals(0, spi0.partitionsFullMessages()); assertEquals(0, spi1.partitionsSingleMessages()); @@ -577,9 +580,7 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr final String CACHE_NAME2 = "cache2"; - ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); - - ccfg.setName(CACHE_NAME2); + ccfg = new CacheConfiguration(CACHE_NAME2); log.info("Create new cache: " + CACHE_NAME2);
