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: Passing index state to indexing manager.
Date Wed, 15 Mar 2017 10:29:35 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-4565-ddl 86817195b -> 3fa1652e7


Passing index state to indexing manager.


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

Branch: refs/heads/ignite-4565-ddl
Commit: 5a2a436d4b495f8c37c44377f7dea302e081cb3c
Parents: 8681719
Author: devozerov <vozerov@gridgain.com>
Authored: Wed Mar 15 11:49:14 2017 +0300
Committer: devozerov <vozerov@gridgain.com>
Committed: Wed Mar 15 11:49:14 2017 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheProcessor.java     | 19 +++++++++++--------
 .../processors/query/GridQueryProcessor.java     | 10 +++++++---
 .../processors/query/QueryIndexState.java        | 13 ++++++++++++-
 .../processors/query/QueryIndexStates.java       |  5 +++--
 .../query/ddl/AbstractIndexOperation.java        | 14 +++++++++++++-
 .../query/ddl/CreateIndexOperation.java          | 13 +------------
 .../processors/query/ddl/DropIndexOperation.java |  5 +++--
 7 files changed, 50 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/5a2a436d/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 8a7c5e8..7060eaa 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
@@ -825,7 +825,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
                     caches.put(maskNull(name), cache);
 
-                    startCache(cache);
+                    startCache(cache, desc.indexStates());
 
                     jCacheProxies.put(maskNull(name), new IgniteCacheProxy(ctx, cache, null,
false));
                 }
@@ -1084,11 +1084,11 @@ public class GridCacheProcessor extends GridProcessorAdapter {
      * @throws IgniteCheckedException If failed to start cache.
      */
     @SuppressWarnings({"TypeMayBeWeakened", "unchecked"})
-    private void startCache(GridCacheAdapter<?, ?> cache) throws IgniteCheckedException
{
+    private void startCache(GridCacheAdapter<?, ?> cache, @Nullable QueryIndexStates
idxStates)
+        throws IgniteCheckedException {
         GridCacheContext<?, ?> cacheCtx = cache.context();
 
-        // TODO: Pass current index state to query processor.
-        ctx.query().onCacheStart(cacheCtx);
+        ctx.query().onCacheStart(cacheCtx, idxStates);
         ctx.continuous().onCacheStart(cacheCtx);
 
         CacheConfiguration cfg = cacheCtx.config();
@@ -1654,7 +1654,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
             req.clientStartOnly(),
             req.initiatingNodeId(),
             req.deploymentId(),
-            topVer
+            topVer,
+            req.indexStates()
         );
 
         DynamicCacheDescriptor desc = cacheDescriptor(req.cacheName());
@@ -1696,7 +1697,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
                         false,
                         null,
                         desc.deploymentId(),
-                        topVer
+                        topVer,
+                        desc.indexStates()
                     );
                 }
             }
@@ -1722,7 +1724,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
         boolean clientStartOnly,
         UUID initiatingNodeId,
         IgniteUuid deploymentId,
-        AffinityTopologyVersion topVer
+        AffinityTopologyVersion topVer,
+        @Nullable QueryIndexStates idxStates
     ) throws IgniteCheckedException {
         CacheConfiguration ccfg = new CacheConfiguration(cfg);
 
@@ -1756,7 +1759,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
             caches.put(maskNull(cacheCtx.name()), cacheCtx.cache());
 
-            startCache(cacheCtx.cache());
+            startCache(cacheCtx.cache(), idxStates);
             onKernalStart(cacheCtx.cache());
         }
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/5a2a436d/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 3bdfbdb..f96552d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -167,10 +167,12 @@ public class GridQueryProcessor extends GridProcessorAdapter {
 
     /**
      * @param cctx Cache context.
+     * @param idxStates Index states.
      * @throws IgniteCheckedException If failed.
      */
     @SuppressWarnings("deprecation")
-    private void initializeCache(GridCacheContext<?, ?> cctx) throws IgniteCheckedException
{
+    private void initializeCache(GridCacheContext<?, ?> cctx, @Nullable QueryIndexStates
idxStates)
+        throws IgniteCheckedException {
         String space = cctx.name();
 
         CacheConfiguration<?,?> ccfg = cctx.config();
@@ -250,9 +252,11 @@ public class GridQueryProcessor extends GridProcessorAdapter {
 
     /**
      * @param cctx Cache context.
+     * @param idxStates Index states.
      * @throws IgniteCheckedException If failed.
      */
-    public void onCacheStart(GridCacheContext cctx) throws IgniteCheckedException {
+    public void onCacheStart(GridCacheContext cctx, @Nullable QueryIndexStates idxStates)
+        throws IgniteCheckedException {
         if (idx == null)
             return;
 
@@ -260,7 +264,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
             return;
 
         try {
-            initializeCache(cctx);
+            initializeCache(cctx, idxStates);
         }
         finally {
             busyLock.leaveBusy();

http://git-wip-us.apache.org/repos/asf/ignite/blob/5a2a436d/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryIndexState.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryIndexState.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryIndexState.java
index 63ad8d4..b91d687 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryIndexState.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryIndexState.java
@@ -31,6 +31,9 @@ public class QueryIndexState implements Serializable {
     /** */
     private static final long serialVersionUID = 0L;
 
+    /** Table name. */
+    private final String tblName;
+
     /** Index name. */
     private final String idxName;
 
@@ -44,12 +47,20 @@ public class QueryIndexState implements Serializable {
      * @param idxName Index name.
      * @param idx Index.
      */
-    public QueryIndexState(String idxName, QueryIndex idx) {
+    public QueryIndexState(String tblName, String idxName, QueryIndex idx) {
+        this.tblName = tblName;
         this.idxName = idxName;
         this.idx = idx;
     }
 
     /**
+     * @return Table name.
+     */
+    public String tableName() {
+        return tblName;
+    }
+
+    /**
      * @return Index name.
      */
     public String indexName() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/5a2a436d/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryIndexStates.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryIndexStates.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryIndexStates.java
index b775dc0..1b05e5b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryIndexStates.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryIndexStates.java
@@ -103,6 +103,7 @@ public class QueryIndexStates implements Serializable {
     public boolean finish(IndexFinishDiscoveryMessage msg) {
         AbstractIndexOperation op = msg.operation();
 
+        String tblName = op.tableName();
         String idxName = op.indexName();
 
         QueryIndexActiveOperation curOp = activeOps.remove(idxName);
@@ -113,11 +114,11 @@ public class QueryIndexStates implements Serializable {
                     QueryIndexState state;
 
                     if (op instanceof CreateIndexOperation)
-                        state = new QueryIndexState(idxName, ((CreateIndexOperation)op).index());
+                        state = new QueryIndexState(tblName, idxName, ((CreateIndexOperation)op).index());
                     else {
                         assert op instanceof DropIndexOperation;
 
-                        state = new QueryIndexState(idxName, null);
+                        state = new QueryIndexState(tblName, idxName, null);
                     }
 
                     readyOps.put(idxName, state);

http://git-wip-us.apache.org/repos/asf/ignite/blob/5a2a436d/modules/core/src/main/java/org/apache/ignite/internal/processors/query/ddl/AbstractIndexOperation.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/ddl/AbstractIndexOperation.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/ddl/AbstractIndexOperation.java
index 11e7966..6f5e35e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/ddl/AbstractIndexOperation.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/ddl/AbstractIndexOperation.java
@@ -36,17 +36,22 @@ public abstract class AbstractIndexOperation implements Serializable {
     /** Space. */
     private final String space;
 
+    /** Table name. */
+    private final String tblName;
+
     /**
      * Constructor.
      *
      * @param cliNodeId Client node ID.
      * @param opId Operation ID.
      * @param space Space.
+     * @param tblName Table name.
      */
-    public AbstractIndexOperation(UUID cliNodeId, UUID opId, String space) {
+    public AbstractIndexOperation(UUID cliNodeId, UUID opId, String space, String tblName)
{
         this.cliNodeId = cliNodeId;
         this.opId = opId;
         this.space = space;
+        this.tblName = tblName;
     }
 
     /**
@@ -71,6 +76,13 @@ public abstract class AbstractIndexOperation implements Serializable {
     }
 
     /**
+     * @return Table name.
+     */
+    public String tableName() {
+        return tblName;
+    }
+
+    /**
      * @return Index name.
      */
     public abstract String indexName();

http://git-wip-us.apache.org/repos/asf/ignite/blob/5a2a436d/modules/core/src/main/java/org/apache/ignite/internal/processors/query/ddl/CreateIndexOperation.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/ddl/CreateIndexOperation.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/ddl/CreateIndexOperation.java
index 4127c2a..efbbb25 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/ddl/CreateIndexOperation.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/ddl/CreateIndexOperation.java
@@ -30,9 +30,6 @@ public class CreateIndexOperation extends AbstractIndexOperation {
     /** */
     private static final long serialVersionUID = 0L;
 
-    /** Table name. */
-    private final String tblName;
-
     /** Index. */
     @GridToStringInclude
     private final QueryIndex idx;
@@ -52,9 +49,8 @@ public class CreateIndexOperation extends AbstractIndexOperation {
      */
     public CreateIndexOperation(UUID cliNodeId, UUID opId, String space, String tblName,
QueryIndex idx,
         boolean ifNotExists) {
-        super(cliNodeId, opId, space);
+        super(cliNodeId, opId, space, tblName);
 
-        this.tblName = tblName;
         this.idx = idx;
         this.ifNotExists = ifNotExists;
     }
@@ -72,13 +68,6 @@ public class CreateIndexOperation extends AbstractIndexOperation {
     }
 
     /**
-     * @return Table name.
-     */
-    public String tableName() {
-        return tblName;
-    }
-
-    /**
      * @return Ignore operation if index exists.
      */
     public boolean ifNotExists() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/5a2a436d/modules/core/src/main/java/org/apache/ignite/internal/processors/query/ddl/DropIndexOperation.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/ddl/DropIndexOperation.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/ddl/DropIndexOperation.java
index 88d6aab..a8d646d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/ddl/DropIndexOperation.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/ddl/DropIndexOperation.java
@@ -40,11 +40,12 @@ public class DropIndexOperation extends AbstractIndexOperation {
      * @param cliNodeId Client node ID.
      * @param opId Operation id.
      * @param space Space.
+     * @param tblName Table name.
      * @param idxName Index name.
      * @param ifExists Ignore operation if index doesn't exist.
      */
-    DropIndexOperation(UUID cliNodeId, UUID opId, String space, String idxName, boolean ifExists)
{
-        super(cliNodeId, opId, space);
+    DropIndexOperation(UUID cliNodeId, UUID opId, String space, String tblName, String idxName,
boolean ifExists) {
+        super(cliNodeId, opId, space, tblName);
 
         this.idxName = idxName;
         this.ifExists = ifExists;


Mime
View raw message