ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [6/6] ignite git commit: ignite-5272
Date Wed, 14 Jun 2017 18:31:49 GMT
ignite-5272


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bdf074dc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bdf074dc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bdf074dc

Branch: refs/heads/ignite-5272
Commit: bdf074dcf99174a3fdbe6524f68e2d959dc81e61
Parents: 839d687
Author: sboikov <sboikov@gridgain.com>
Authored: Wed Jun 14 20:38:28 2017 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Wed Jun 14 21:31:34 2017 +0300

----------------------------------------------------------------------
 .../cache/CacheAffinitySharedManager.java       | 11 ++++++++-
 .../GridProjectionForCachesSelfTest.java        | 24 ++++++++++++++++----
 2 files changed, 30 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/bdf074dc/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 c5d4b8f..fbc5dea 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
@@ -776,6 +776,15 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
                 });
             }
         }
+
+        ClientCacheChangeDiscoveryMessage msg = clientCacheChanges.get();
+
+        if (msg != null) {
+            msg.checkCachesExist(caches.registeredCaches.keySet());
+
+            if (msg.empty())
+                clientCacheChanges.remove();
+        }
     }
 
     /**
@@ -2217,7 +2226,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
             }
 
             for (ExchangeActions.ActionData req : exchActions.cacheStopRequests())
-                registeredCaches.remove(req.descriptor().cacheName());
+                registeredCaches.remove(req.descriptor().cacheId());
 
             for (ExchangeActions.ActionData req : exchActions.cacheStartRequests())
                 registeredCaches.put(req.descriptor().cacheId(), req.descriptor());

http://git-wip-us.apache.org/repos/asf/ignite/blob/bdf074dc/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionForCachesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionForCachesSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionForCachesSelfTest.java
index eea1c92..222e58c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionForCachesSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionForCachesSelfTest.java
@@ -26,15 +26,16 @@ import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.spi.discovery.DiscoverySpi;
 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;
+import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 
@@ -131,10 +132,18 @@ public class GridProjectionForCachesSelfTest extends GridCommonAbstractTest
{
      * @throws Exception If failed.
      */
     public void testProjectionForDefaultCache() throws Exception {
-        ClusterGroup prj = ignite.cluster().forCacheNodes(DEFAULT_CACHE_NAME);
+        final ClusterGroup prj = ignite.cluster().forCacheNodes(DEFAULT_CACHE_NAME);
 
         assertNotNull(prj);
+
+        GridTestUtils.waitForCondition(new GridAbsPredicate() {
+            @Override public boolean apply() {
+                return prj.nodes().size() == 3;
+            }
+        }, 5000);
+
         assertEquals(3, prj.nodes().size());
+
         assertTrue(prj.nodes().contains(grid(0).localNode()));
         assertFalse(prj.nodes().contains(grid(1).localNode()));
         assertTrue(prj.nodes().contains(grid(2).localNode()));
@@ -146,9 +155,16 @@ public class GridProjectionForCachesSelfTest extends GridCommonAbstractTest
{
      * @throws Exception If failed.
      */
     public void testProjectionForNamedCache() throws Exception {
-        ClusterGroup prj = ignite.cluster().forCacheNodes(CACHE_NAME);
+        final ClusterGroup prj = ignite.cluster().forCacheNodes(CACHE_NAME);
+
+        assertNotNull(prj);
+
+        GridTestUtils.waitForCondition(new GridAbsPredicate() {
+            @Override public boolean apply() {
+                return prj.nodes().size() == 3;
+            }
+        }, 5000);
 
-        assert prj != null;
         assertEquals("Invalid projection: " + prj.nodes(), 3, prj.nodes().size());
         assert !prj.nodes().contains(grid(0).localNode());
         assert prj.nodes().contains(grid(1).localNode());


Mime
View raw message