ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject incubator-ignite git commit: #sberb-27: incorrect adding flag.
Date Thu, 11 Jun 2015 13:57:31 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/sberb-27 003dd6cc3 -> bfe9f0025


#sberb-27: incorrect adding flag.


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

Branch: refs/heads/sberb-27
Commit: bfe9f0025b70e9e6b4f10d54706a181b09fa80c9
Parents: 003dd6c
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Thu Jun 11 16:55:57 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Thu Jun 11 16:55:57 2015 +0300

----------------------------------------------------------------------
 .../cache/DynamicCacheChangeRequest.java        | 17 +++++++
 .../cache/DynamicCacheDescriptor.java           | 49 ++++++++++++++++++++
 .../processors/cache/GridCacheProcessor.java    | 14 ++++--
 3 files changed, 77 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bfe9f002/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
index c08a179..c035615 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
@@ -63,6 +63,9 @@ public class DynamicCacheChangeRequest implements Serializable {
     /** Template configuration flag. */
     private boolean template;
 
+    /** Local store flag. */
+    private boolean localStore;
+
     /**
      * Constructor creates cache stop request.
      *
@@ -220,6 +223,20 @@ public class DynamicCacheChangeRequest implements Serializable {
         this.failIfExists = failIfExists;
     }
 
+    /**
+     * @param localStore Local store flag.
+     */
+    public void localStore(boolean localStore) {
+        this.localStore = localStore;
+    }
+
+    /**
+     * @return Local store flag.
+     */
+    public boolean localStore() {
+        return localStore;
+    }
+
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(DynamicCacheChangeRequest.class, this, "cacheName", cacheName());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bfe9f002/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java
index 9c6cc43..8f729b0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java
@@ -17,8 +17,10 @@
 
 package org.apache.ignite.internal.processors.cache;
 
+import org.apache.ignite.cache.store.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.processors.cache.store.*;
 import org.apache.ignite.internal.processors.plugin.*;
 import org.apache.ignite.internal.util.tostring.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
@@ -55,6 +57,9 @@ public class DynamicCacheDescriptor {
     /** */
     private volatile Map<UUID, CacheConfiguration> rmtCfgs;
 
+    /** */
+    private volatile Map<UUID, Boolean> rmtLocStore;
+
     /** Template configuration flag. */
     private boolean template;
 
@@ -64,6 +69,9 @@ public class DynamicCacheDescriptor {
     /** */
     private boolean updatesAllowed = true;
 
+    /** Local store flag. */
+    private boolean localStore;
+
     /**
      * @param ctx Context.
      * @param cacheCfg Cache configuration.
@@ -81,6 +89,11 @@ public class DynamicCacheDescriptor {
         this.template = template;
         this.deploymentId = deploymentId;
 
+        if (cacheCfg.getCacheStoreFactory() != null) {
+            CacheStore store = (CacheStore)cacheCfg.getCacheStoreFactory().create();
+            localStore = U.hasAnnotation(store, CacheLocalStore.class);
+        }
+
         pluginMgr = new CachePluginManager(ctx, cacheCfg);
     }
 
@@ -205,6 +218,28 @@ public class DynamicCacheDescriptor {
     }
 
     /**
+     * @param nodeId Remote node ID.
+     * @param localStore Remote local store flag.
+     */
+    public void addRemoteLocalStore(UUID nodeId, Boolean localStore) {
+        Map<UUID, Boolean> cfgs = rmtLocStore;
+
+        if (cfgs == null)
+            rmtLocStore = cfgs = new HashMap<>();
+
+        cfgs.put(nodeId, localStore);
+    }
+
+    /**
+     * @param nodeId Remote node ID.
+     */
+    public boolean remoteLocalStore(UUID nodeId) {
+        Map<UUID, Boolean> cfgs = rmtLocStore;
+
+        return cfgs == null ? null : cfgs.get(nodeId);
+    }
+
+    /**
      *
      */
     public void clearRemoteConfigurations() {
@@ -225,6 +260,20 @@ public class DynamicCacheDescriptor {
         this.updatesAllowed = updatesAllowed;
     }
 
+    /**
+     * @return Local store flag.
+     */
+    public boolean localStore() {
+        return localStore;
+    }
+
+    /**
+     * @param localStore Local store flag.
+     */
+    public void localStore(boolean localStore) {
+        this.localStore = localStore;
+    }
+
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(DynamicCacheDescriptor.class, this, "cacheName", U.maskName(cacheCfg.getName()));

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bfe9f002/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 5582ba7..ab7662d 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
@@ -691,7 +691,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
                         if (rmtCfg != null) {
                             CacheConfiguration locCfg = desc.cacheConfiguration();
 
-                            checkCache(locCfg, rmtCfg, n, desc);
+                            checkCache(locCfg, rmtCfg, n, desc, desc.remoteLocalStore(n.id()));
 
                             // Check plugin cache configurations.
                             CachePluginManager pluginMgr = desc.pluginManager();
@@ -1634,6 +1634,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
                 req.cacheType(desc.cacheType());
 
+                req.localStore(desc.localStore());
+
                 req.deploymentId(desc.deploymentId());
 
                 reqs.add(req);
@@ -1696,6 +1698,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
                             existing.deploymentId(req.deploymentId());
 
                             existing.addRemoteConfiguration(rmtNodeId, req.startCacheConfiguration());
+                            existing.addRemoteLocalStore(rmtNodeId, req.localStore());
 
                             ctx.discovery().setCacheFilter(
                                 req.cacheName(),
@@ -1962,6 +1965,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
         req.cacheType(cacheType);
 
+        req.localStore(cache(cacheName).context().store().isLocal());
+
         return F.first(initiateCacheChanges(F.asList(req), failIfExists));
     }
 
@@ -2253,10 +2258,11 @@ public class GridCacheProcessor extends GridProcessorAdapter {
      * @param rmtCfg Remote configuration.
      * @param rmtNode Remote node.
      * @param desc Cache descriptor.
+     * @param rmtLocalStore Rempte local store flag.
      * @throws IgniteCheckedException If check failed.
      */
     private void checkCache(CacheConfiguration locCfg, CacheConfiguration rmtCfg, ClusterNode
rmtNode,
-        DynamicCacheDescriptor desc) throws IgniteCheckedException {
+        DynamicCacheDescriptor desc, boolean rmtLocalStore) throws IgniteCheckedException
{
         ClusterNode locNode = ctx.discovery().localNode();
 
         UUID rmt = rmtNode.id();
@@ -2282,7 +2288,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
             boolean checkStore;
 
-            if (!isLocAff && isRmtAff && locCfg.getAtomicityMode() == TRANSACTIONAL)
{
+            if (!isLocAff && isRmtAff && locCfg.getAtomicityMode() == TRANSACTIONAL
&& !rmtLocalStore) {
                 checkStore = locAttr.storeFactoryClassName() != null;
 
                 if (locAttr.storeFactoryClassName() == null && rmtAttr.storeFactoryClassName()
!= null)
@@ -2678,6 +2684,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
         req.cacheType(desc.cacheType());
 
+        req.localStore(cache(cacheName).context().store().isLocal());
+
         req.clientStartOnly(true);
 
         F.first(initiateCacheChanges(F.asList(req), false)).get();


Mime
View raw message