ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject ignite git commit: ignite-5075
Date Fri, 12 May 2017 09:01:27 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-5075 d1c71ef42 -> 0a98fc657


ignite-5075


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

Branch: refs/heads/ignite-5075
Commit: 0a98fc6570f3b1e21e6c8004ea173f1563f021a4
Parents: d1c71ef
Author: sboikov <sboikov@gridgain.com>
Authored: Fri May 12 12:01:20 2017 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Fri May 12 12:01:20 2017 +0300

----------------------------------------------------------------------
 .../discovery/GridDiscoveryManager.java         |  3 +--
 .../cache/CacheAffinitySharedManager.java       | 14 ++++++-----
 .../cache/CacheGroupInfrastructure.java         |  4 ++-
 .../processors/cache/GridCacheProcessor.java    | 26 ++++++++++++++++++--
 .../processors/cache/IgniteCacheGroupsTest.java | 26 ++++++++++++++++++++
 5 files changed, 62 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/0a98fc65/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index aef01f4..bf48cf3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -70,7 +70,6 @@ import org.apache.ignite.internal.managers.communication.GridIoManager;
 import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.CacheGroupDescriptor;
-import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
 import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
 import org.apache.ignite.internal.processors.jobmetrics.GridJobMetrics;
 import org.apache.ignite.internal.processors.security.SecurityContext;
@@ -2039,7 +2038,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi>
{
                 CacheGroupAffinity grpAff = e.getValue();
                 Integer grpId = e.getKey();
 
-                if (grpAff.cacheFilter.apply(node)) {
+                if (CU.affinityNode(node, grpAff.cacheFilter)) {
                     List<ClusterNode> nodes = cacheGrpAffNodes.get(grpId);
 
                     if (nodes == null)

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a98fc65/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 15fe7f2..11253fc 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
@@ -438,14 +438,16 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
                 if (grpClosed) {
                     CacheGroupHolder grpHolder = grpHolders.remove(grp.groupId());
 
-                    assert !grpHolder.client() : grpHolder;
+                    if (grpHolder != null) {
+                        assert !grpHolder.client() : grpHolder;
 
-                    grpHolder = CacheGroupHolder2.create(cctx,
-                        registeredGrps.get(grp.groupId()),
-                        fut,
-                        grp.affinity());
+                        grpHolder = CacheGroupHolder2.create(cctx,
+                            registeredGrps.get(grp.groupId()),
+                            fut,
+                            grp.affinity());
 
-                    grpHolders.put(grp.groupId(), grpHolder);
+                        grpHolders.put(grp.groupId(), grpHolder);
+                    }
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a98fc65/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupInfrastructure.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupInfrastructure.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupInfrastructure.java
index d8752d4..1b5187e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupInfrastructure.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupInfrastructure.java
@@ -131,6 +131,7 @@ public class CacheGroupInfrastructure {
         AffinityTopologyVersion locStartVer) {
         assert grpId != 0 : "Invalid group ID [cache=" + ccfg.getName() + ", grpName=" +
ccfg.getGroupName() + ']';
         assert ccfg != null;
+        assert memPlc != null || !affNode;
 
         this.grpId = grpId;
         this.rcvdFrom = rcvdFrom;
@@ -147,7 +148,8 @@ public class CacheGroupInfrastructure {
 
         depEnabled = ctx.kernalContext().deploy().enabled() && !ctx.kernalContext().cacheObjects().isBinaryEnabled(ccfg);
 
-        storeCacheId = sharedGroup() || memPlc.config().getPageEvictionMode() != DataPageEvictionMode.DISABLED;
+        storeCacheId = affNode &&
+            (sharedGroup() || memPlc.config().getPageEvictionMode() != DataPageEvictionMode.DISABLED);
 
         log = ctx.kernalContext().log(getClass());
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a98fc65/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 2176dfc..6abe09f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -1974,8 +1974,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
     /**
      * @param req Stop request.
+     * @return Cache group for stopped cache.
      */
-    private void prepareCacheStop(DynamicCacheChangeRequest req) {
+    private CacheGroupInfrastructure prepareCacheStop(DynamicCacheChangeRequest req) {
         assert req.stop() || req.close() : req;
 
         GridCacheAdapter<?, ?> cache = caches.remove(req.cacheName());
@@ -1988,7 +1989,11 @@ public class GridCacheProcessor extends GridProcessorAdapter {
             onKernalStop(cache, req.destroy());
 
             stopCache(cache, true, req.destroy());
+
+            return ctx.group();
         }
+
+        return null;
     }
 
     /**
@@ -2043,7 +2048,24 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
                         proxy.context().gate().onStopped();
 
-                        prepareCacheStop(req.request());
+                        CacheGroupInfrastructure grp = prepareCacheStop(req.request());
+
+                        if (grp != null) {
+                            boolean stopGrp = true;
+
+                            if (!grp.sharedGroup()) {
+                                for (GridCacheContext cctx : sharedCtx.cacheContexts()) {
+                                    if (cctx.group() == grp) {
+                                        stopGrp = false;
+
+                                        break;
+                                    }
+                                }
+                            }
+
+                            if (stopGrp)
+                                stopCacheGroup(grp.groupId());
+                        }
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a98fc65/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
index 5933833..bf99013 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
@@ -51,6 +51,9 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
     /** */
     private static final String GROUP2 = "grp2";
 
+    /** */
+    private boolean client;
+
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception
{
         IgniteConfiguration cfg = super.getConfiguration(gridName);
@@ -59,6 +62,8 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
 
         //cfg.setLateAffinityAssignment(false);
 
+        cfg.setClientMode(client);
+
         return cfg;
     }
 
@@ -72,6 +77,27 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
     /**
      * @throws Exception If failed.
      */
+    public void testCloseCache1() throws Exception {
+        startGrid(0);
+
+        client = true;
+
+        Ignite client = startGrid(1);
+
+        IgniteCache c1 = client.createCache(cacheConfiguration(GROUP1, "c1", ATOMIC, 0));
+
+        checkCacheGroup(0, GROUP1, true);
+        checkCacheGroup(0, GROUP1, true);
+
+        c1.close();
+
+        checkCacheGroup(0, GROUP1, true);
+        checkCacheGroup(1, GROUP1, false);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
     public void testCreateDestroyCaches1() throws Exception {
         createDestroyCaches(1);
     }


Mime
View raw message