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-5272
Date Wed, 14 Jun 2017 13:51:20 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-5272 f765fd82a -> bfce92519


ignite-5272


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

Branch: refs/heads/ignite-5272
Commit: bfce925198910d9016222bfd6cbb02a5a333c380
Parents: f765fd8
Author: sboikov <sboikov@gridgain.com>
Authored: Wed Jun 14 16:12:53 2017 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Wed Jun 14 16:51:13 2017 +0300

----------------------------------------------------------------------
 .../apache/ignite/IgniteSystemProperties.java   |  2 +-
 .../cache/CacheAffinitySharedManager.java       | 39 ++++++++++++--------
 .../ClientCacheChangeDiscoveryMessage.java      |  2 +-
 .../ClientCacheChangeDummyDiscoveryMessage.java |  2 +
 .../processors/cache/GridCacheProcessor.java    |  7 +---
 .../dht/ClientCacheDhtTopologyFuture.java       |  2 +-
 .../IgniteDynamicClientCacheStartSelfTest.java  | 38 +++++++++++++++++--
 7 files changed, 63 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/bfce9251/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index 2121f38..d9c112c 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -624,7 +624,7 @@ public final class IgniteSystemProperties {
     public static final String IGNITE_SECURITY_COMPATIBILITY_MODE = "IGNITE_SECURITY_COMPATIBILITY_MODE";
 
     /**
-     * When client cache is started or closed special discovery message is send to notify
cluster (for example this is
+     * When client cache is started or closed special discovery message is sent to notify
cluster (for example this is
      * needed for {@link ClusterGroup#forCacheNodes(String)} API. This timeout specifies
how long to wait
      * after client cache start/close before sending this message. If during this timeout
another client
      * cache changed, these events are combined into single message.

http://git-wip-us.apache.org/repos/asf/ignite/blob/bfce9251/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 16850e6..c5d4b8f 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
@@ -412,28 +412,29 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
                     assert grp.localStartVersion().equals(topVer) : grp.localStartVersion();
 
                     if (crd) {
-                        ClientCacheDhtTopologyFuture topFut = new ClientCacheDhtTopologyFuture(topVer);
+                        CacheGroupHolder grpHolder = grpHolders.get(grp.groupId());
 
-                        grp.topology().updateTopologyVersion(topFut,
-                            discoCache,
-                            -1,
-                            false);
+                        assert grpHolder != null && grpHolder.affinity().idealAssignment()
!= null;
 
-                        GridClientPartitionTopology clientTop = cctx.exchange().clearClientTopology(grp.groupId());
+                        if (grpHolder.client()) {
+                            ClientCacheDhtTopologyFuture topFut = new ClientCacheDhtTopologyFuture(topVer);
 
-                        if (clientTop != null) {
-                            grp.topology().update(topVer,
-                                clientTop.partitionMap(true),
-                                clientTop.updateCounters(false));
-                        }
+                            grp.topology().updateTopologyVersion(topFut, discoCache, -1,
false);
 
-                        CacheGroupHolder grpHolder = grpHolders.get(grp.groupId());
+                            GridClientPartitionTopology clientTop = cctx.exchange().clearClientTopology(grp.groupId());
 
-                        assert grpHolder != null && grpHolder.affinity().idealAssignment()
!= null;
+                            if (clientTop != null) {
+                                grp.topology().update(topVer,
+                                    clientTop.partitionMap(true),
+                                    clientTop.updateCounters(false));
+                            }
+
+                            grpHolder = new CacheGroupHolder1(grp, grpHolder.affinity());
 
-                        grpHolder = new CacheGroupHolder1(grp, grpHolder.affinity());
+                            grpHolders.put(grp.groupId(), grpHolder);
 
-                        grpHolders.put(grp.groupId(), grpHolder);
+                            assert grpHolder.affinity().lastVersion().equals(grp.affinity().lastVersion());
+                        }
                     }
                     else if (!fetchFuts.containsKey(grp.groupId())) {
                         GridDhtAssignmentFetchFuture fetchFut = new GridDhtAssignmentFetchFuture(cctx,
@@ -555,6 +556,8 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
     }
 
     /**
+     * Process client cache start/close requests, called from exchange thread.
+     *
      * @param msg Change request.
      */
     void processClientCachesChanges(ClientCacheChangeDummyDiscoveryMessage msg) {
@@ -573,11 +576,15 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
     }
 
     /**
-     * @param timeoutObj Timeout object.
+     * Sends discovery message about started/closed client caches, called from exchange thread.
+     *
+     * @param timeoutObj Timeout object initiated send.
      */
     void sendClientCacheChangesMessage(ClientCacheUpdateTimeout timeoutObj) {
         ClientCacheChangeDiscoveryMessage msg = clientCacheChanges.get();
 
+        // Timeout object was changed if one more client cache changed during timeout,
+        // another timeoutObj was scheduled.
         if (msg != null && msg.updateTimeoutObject() == timeoutObj) {
             assert !msg.empty() : msg;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/bfce9251/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClientCacheChangeDiscoveryMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClientCacheChangeDiscoveryMessage.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClientCacheChangeDiscoveryMessage.java
index b4a1696..3d120f7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClientCacheChangeDiscoveryMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClientCacheChangeDiscoveryMessage.java
@@ -30,7 +30,7 @@ import org.apache.ignite.lang.IgniteUuid;
 import org.jetbrains.annotations.Nullable;
 
 /**
- *
+ * Sent from cache client node to asynchronously notify about started.closed client caches.
  */
 public class ClientCacheChangeDiscoveryMessage implements DiscoveryCustomMessage {
     /** */

http://git-wip-us.apache.org/repos/asf/ignite/blob/bfce9251/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClientCacheChangeDummyDiscoveryMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClientCacheChangeDummyDiscoveryMessage.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClientCacheChangeDummyDiscoveryMessage.java
index 878be94..68bca27 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClientCacheChangeDummyDiscoveryMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClientCacheChangeDummyDiscoveryMessage.java
@@ -21,6 +21,7 @@ import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
 import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.lang.IgniteUuid;
 import org.jetbrains.annotations.Nullable;
@@ -40,6 +41,7 @@ public class ClientCacheChangeDummyDiscoveryMessage implements DiscoveryCustomMe
     private final Map<String, DynamicCacheChangeRequest> startReqs;
 
     /** */
+    @GridToStringInclude
     private final Set<String> cachesToClose;
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/bfce9251/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 b1e6b7e..fb03f06 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
@@ -2015,9 +2015,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
     /**
      * @param cacheName Cache name.
      * @param stop {@code True} for stop cache, {@code false} for close cache.
-     * @return Cache context if cache found.
      */
-    @Nullable GridCacheContext blockGateway(String cacheName, boolean stop) {
+    void blockGateway(String cacheName, boolean stop) {
         // Break the proxy before exchange future is done.
         IgniteCacheProxy<?, ?> proxy = jCacheProxies.get(cacheName);
 
@@ -2026,11 +2025,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
                 proxy.gate().stopped();
             else
                 proxy.closeProxy();
-
-            return proxy.context();
         }
-
-        return null;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/bfce9251/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/ClientCacheDhtTopologyFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/ClientCacheDhtTopologyFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/ClientCacheDhtTopologyFuture.java
index ac0efa7..3166159 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/ClientCacheDhtTopologyFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/ClientCacheDhtTopologyFuture.java
@@ -25,7 +25,7 @@ import org.apache.ignite.internal.processors.cache.CacheGroupContext;
 import org.apache.ignite.internal.util.typedef.internal.U;
 
 /**
- *
+ * Topology future created for client cache start.
  */
 public class ClientCacheDhtTopologyFuture extends GridDhtTopologyFutureAdapter
     implements GridDhtTopologyFuture {

http://git-wip-us.apache.org/repos/asf/ignite/blob/bfce9251/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicClientCacheStartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicClientCacheStartSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicClientCacheStartSelfTest.java
index 974feb5..0cb0856 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicClientCacheStartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicClientCacheStartSelfTest.java
@@ -44,6 +44,7 @@ import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.jetbrains.annotations.Nullable;
 
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
 import static org.apache.ignite.cache.CacheMode.REPLICATED;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_IGNITE_INSTANCE_NAME;
@@ -302,7 +303,7 @@ public class IgniteDynamicClientCacheStartSelfTest extends GridCommonAbstractTes
 
         Ignite client = startGrid(SRVS);
 
-        for (CacheAtomicityMode atomicityMode : CacheAtomicityMode.values()) {
+        for (CacheAtomicityMode atomicityMode : values()) {
             for (boolean batch : new boolean[]{false, true})
                 startCachesForGroup(srv, client, grp, atomicityMode, batch);
         }
@@ -381,7 +382,7 @@ public class IgniteDynamicClientCacheStartSelfTest extends GridCommonAbstractTes
 
         Ignite srv = startGrids(SRVS);
 
-        srv.createCaches(cacheConfigurations(null, CacheAtomicityMode.ATOMIC));
+        srv.createCaches(cacheConfigurations(null, ATOMIC));
 
         ccfg = null;
 
@@ -391,8 +392,8 @@ public class IgniteDynamicClientCacheStartSelfTest extends GridCommonAbstractTes
 
         List<CacheConfiguration> cfgs = new ArrayList<>();
 
-        cfgs.addAll(cacheConfigurations(null, CacheAtomicityMode.ATOMIC));
-        cfgs.addAll(cacheConfigurations(null, CacheAtomicityMode.TRANSACTIONAL));
+        cfgs.addAll(cacheConfigurations(null, ATOMIC));
+        cfgs.addAll(cacheConfigurations(null, TRANSACTIONAL));
 
         assertEquals(6, cfgs.size());
 
@@ -548,6 +549,35 @@ public class IgniteDynamicClientCacheStartSelfTest extends GridCommonAbstractTes
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    public void testStartClientCachesOnCoordinatorWithGroup() throws Exception {
+        startGrids(3);
+
+        List<CacheConfiguration> ccfgs = cacheConfigurations("testGrp", ATOMIC);
+
+        for (CacheConfiguration ccfg : ccfgs)
+            ccfg.setNodeFilter(new CachePredicate(F.asList(getTestIgniteInstanceName(0))));
+
+        ignite(1).createCaches(ccfgs);
+
+        ccfgs = cacheConfigurations("testGrp", ATOMIC);
+
+        for (CacheConfiguration ccfg : ccfgs)
+            ccfg.setNodeFilter(new CachePredicate(F.asList(getTestIgniteInstanceName(0))));
+
+        for (IgniteCache<Object, Object> cache : ignite(0).getOrCreateCaches(ccfgs))
{
+            cache.put(1, 1);
+
+            assertEquals(1, cache.get(1));
+
+            cache.close();
+        }
+
+        startGrid(4);
+    }
+
+    /**
      *
      */
     static class CachePredicate implements IgnitePredicate<ClusterNode> {


Mime
View raw message