ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [1/2] ignite git commit: Wired up new index state abstraction with propose callback.
Date Tue, 14 Mar 2017 13:54:56 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-4565-ddl cec52fd44 -> 4cc2b606b


Wired up new index state abstraction with propose callback.


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

Branch: refs/heads/ignite-4565-ddl
Commit: 440021a9b601cb5b6334572e8c0423c783d83297
Parents: cec52fd
Author: devozerov <vozerov@gridgain.com>
Authored: Tue Mar 14 16:53:14 2017 +0300
Committer: devozerov <vozerov@gridgain.com>
Committed: Tue Mar 14 16:53:14 2017 +0300

----------------------------------------------------------------------
 .../cache/CacheAffinitySharedManager.java       |  2 +-
 .../cache/DynamicCacheChangeRequest.java        | 26 +++++-----------
 .../cache/DynamicCacheDescriptor.java           | 18 +++++------
 .../processors/cache/GridCacheProcessor.java    | 32 ++++++++------------
 4 files changed, 29 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/440021a9/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 d8eb733..d2b09a8 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
@@ -352,7 +352,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
                     false,
                     req.deploymentId());
 
-                desc.indexProposeOperation(req.indexInitOperation());
+                desc.indexStates(req.indexStates());
 
                 DynamicCacheDescriptor old = registeredCaches.put(cacheId, desc);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/440021a9/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 5d274b4..bd2ea17 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
@@ -28,8 +28,6 @@ import org.apache.ignite.lang.IgniteUuid;
 import org.jetbrains.annotations.Nullable;
 
 import java.io.Serializable;
-import java.util.Collections;
-import java.util.Map;
 import java.util.UUID;
 
 /**
@@ -76,11 +74,8 @@ public class DynamicCacheChangeRequest implements Serializable {
     /** */
     private UUID rcvdFrom;
 
-    /** Index operation in init phase. */
-    private AbstractIndexOperation idxInitOp;
-
     /** Dynamic index states. */
-    private Map<String, QueryIndexStates> idxStates;
+    private QueryIndexStates idxStates;
 
     /** */
     private transient boolean exchangeNeeded;
@@ -296,24 +291,17 @@ public class DynamicCacheChangeRequest implements Serializable {
     }
 
     /**
-     * @return Pending index init operation.
-     */
-    public AbstractIndexOperation indexInitOperation() {
-        return idxInitOp;
-    }
-
-    /**
-     * @param idxInitOp Pending index init operation.
+     * @return Index states.
      */
-    public void indexInitOperation(AbstractIndexOperation idxInitOp) {
-        this.idxInitOp = idxInitOp;
+    public QueryIndexStates indexStates() {
+        return idxStates;
     }
 
     /**
-     * @return Dynamic index states.
+     * @param idxStates Index states.
      */
-    public Map<String, QueryIndexStates> indexStates() {
-        return idxStates == null ? Collections.<String, QueryIndexStates>emptyMap()
: idxStates;
+    public void indexStates(QueryIndexStates idxStates) {
+        this.idxStates = idxStates;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/440021a9/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 a8febef..f628e76 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
@@ -24,7 +24,7 @@ import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.plugin.CachePluginManager;
-import org.apache.ignite.internal.processors.query.ddl.AbstractIndexOperation;
+import org.apache.ignite.internal.processors.query.QueryIndexStates;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.S;
@@ -82,8 +82,8 @@ public class DynamicCacheDescriptor {
     /** */
     private AffinityTopologyVersion rcvdFromVer;
 
-    /** Pending index operation in propose phase. */
-    private AbstractIndexOperation idxProposeOp;
+    /** Dynamic index states. */
+    private QueryIndexStates idxStates;
 
     /**
      * @param ctx Context.
@@ -307,17 +307,17 @@ public class DynamicCacheDescriptor {
     }
 
     /**
-     * @return Pending index propose operation.
+     * @return Index states.
      */
-    public AbstractIndexOperation indexProposeOperation() {
-        return idxProposeOp;
+    public QueryIndexStates indexStates() {
+        return idxStates;
     }
 
     /**
-     * @param idxProposeOp Pending index propose operation.
+     * @param idxStates Index states.
      */
-    public void indexProposeOperation(AbstractIndexOperation idxProposeOp) {
-        this.idxProposeOp = idxProposeOp;
+    public void indexStates(QueryIndexStates idxStates) {
+        this.idxStates = idxStates;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/440021a9/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 6a9f838..482cf47 100755
--- 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
@@ -64,6 +64,7 @@ import org.apache.ignite.configuration.NearCacheConfiguration;
 import org.apache.ignite.configuration.TransactionConfiguration;
 import org.apache.ignite.events.EventType;
 import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.processors.query.QueryIndexStates;
 import org.apache.ignite.internal.processors.query.QueryUtils;
 import org.apache.ignite.internal.processors.query.ddl.AbstractIndexOperation;
 import org.apache.ignite.internal.processors.query.ddl.IndexAbstractDiscoveryMessage;
@@ -1985,7 +1986,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
             req.cacheType(desc.cacheType());
             req.deploymentId(desc.deploymentId());
             req.receivedFrom(desc.receivedFrom());
-            req.indexInitOperation(desc.indexProposeOperation());
+            req.indexStates(desc.indexStates());
 
             reqs.add(req);
         }
@@ -2023,7 +2024,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
             req.cacheType(desc.cacheType());
             req.deploymentId(desc.deploymentId());
             req.receivedFrom(desc.receivedFrom());
-            req.indexInitOperation(desc.indexProposeOperation());
+            req.indexStates(desc.indexStates());
 
             reqs.add(req);
 
@@ -2129,7 +2130,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
                                     ccfg.getCacheMode());
                         }
 
-                        existing.indexProposeOperation(req.indexInitOperation());
+                        existing.indexStates(req.indexStates());
                     }
                     else {
                         assert req.cacheType() != null : req;
@@ -2141,7 +2142,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
                                 false,
                                 req.deploymentId());
 
-                        desc.indexProposeOperation(req.indexInitOperation());
+                        desc.indexStates(req.indexStates());
 
                         // Received statically configured cache.
                         if (req.initiatingNodeId() == null)
@@ -2743,22 +2744,13 @@ public class GridCacheProcessor extends GridProcessorAdapter {
         }
 
         // Validate request at descriptor level.
-        AbstractIndexOperation oldOp = desc.indexProposeOperation();
+        QueryIndexStates idxStates = desc.indexStates();
 
-        if (oldOp != null) {
-            msg.onError(locNodeId, "Failed to create/drop cache index because another pending
operation is in " +
-                "progress [cacheName=" + op.space() + ". newOp=" + op + ", oldOp=" + oldOp
+ ']');
+        if (idxStates == null)
+            idxStates = new QueryIndexStates();
 
-            return;
-        }
-
-        // For already started cache we must make sure that indexing manager will be able
to accommodate it.
-        if (!isMissingQueryCache(desc))
-            cache(op.space()).context().queries().onIndexProposeMessage(msg);
-
-        // Finally, set init operation to cache descriptor.
-        if (!msg.hasError())
-            desc.indexProposeOperation(op);
+        if (idxStates.propose(ctx.localNodeId(), msg))
+            desc.indexStates(idxStates);
     }
 
     /**
@@ -2856,7 +2848,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
                         DynamicCacheDescriptor startDesc =
                             new DynamicCacheDescriptor(ctx, ccfg, req.cacheType(), false,
req.deploymentId());
 
-                        startDesc.indexProposeOperation(req.indexInitOperation());
+                        startDesc.indexStates(req.indexStates());
 
                         if (newTopVer == null) {
                             newTopVer = new AffinityTopologyVersion(topVer.topologyVersion(),
@@ -3920,7 +3912,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
                     req.deploymentId(desc.deploymentId());
                     req.startCacheConfiguration(descCfg);
-                    req.indexInitOperation(desc.indexProposeOperation());
+                    req.indexStates(desc.indexStates());
                 }
             }
             else {


Mime
View raw message