You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2017/03/16 12:10:15 UTC
[2/2] ignite git commit: Added copy routines to query index state.
Added copy routines to query index state.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4d1f7107
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4d1f7107
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4d1f7107
Branch: refs/heads/ignite-4565-ddl
Commit: 4d1f7107e2008ba8eda21a5fabc2758cc1aec93a
Parents: d652036
Author: devozerov <vo...@gridgain.com>
Authored: Thu Mar 16 15:10:05 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Mar 16 15:10:05 2017 +0300
----------------------------------------------------------------------
.../query/QueryIndexActiveOperation.java | 13 +++++++++
.../processors/query/QueryIndexState.java | 9 +++++++
.../processors/query/QueryIndexStates.java | 28 ++++++++++++++++++--
3 files changed, 48 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4d1f7107/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryIndexActiveOperation.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryIndexActiveOperation.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryIndexActiveOperation.java
index 77262b6..dd3e8ae 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryIndexActiveOperation.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryIndexActiveOperation.java
@@ -42,6 +42,19 @@ public class QueryIndexActiveOperation {
}
/**
+ * Copy object.
+ *
+ * @return Copy.
+ */
+ public QueryIndexActiveOperation copy() {
+ QueryIndexActiveOperation copy = new QueryIndexActiveOperation(op);
+
+ copy.accepted = accepted;
+
+ return copy;
+ }
+
+ /**
* @return Operation.
*/
public AbstractIndexOperation operation() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/4d1f7107/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 b91d687..71fd3d8 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
@@ -54,6 +54,15 @@ public class QueryIndexState implements Serializable {
}
/**
+ * Copy object.
+ *
+ * @return Copy.
+ */
+ public QueryIndexState copy() {
+ return new QueryIndexState(tblName, idxName, idx);
+ }
+
+ /**
* @return Table name.
*/
public String tableName() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/4d1f7107/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 90788ca..7e8e699 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
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.processors.query;
import org.apache.ignite.cache.QueryIndex;
-import org.apache.ignite.cache.query.Query;
import org.apache.ignite.internal.processors.query.ddl.AbstractIndexOperation;
import org.apache.ignite.internal.processors.query.ddl.CreateIndexOperation;
import org.apache.ignite.internal.processors.query.ddl.DropIndexOperation;
@@ -29,7 +28,6 @@ import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.S;
import java.io.Serializable;
-import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@@ -51,6 +49,32 @@ public class QueryIndexStates implements Serializable {
private final Object mux = new Object();
/**
+ * Default constructor.
+ */
+ public QueryIndexStates() {
+ // No-op.
+ }
+
+ /**
+ * Copy object.
+ *
+ * @return Copy.
+ */
+ public QueryIndexStates copy() {
+ synchronized (mux) {
+ QueryIndexStates res = new QueryIndexStates();
+
+ for (Map.Entry<String, QueryIndexActiveOperation> activeOpEntry : activeOps.entrySet())
+ res.activeOps.put(activeOpEntry.getKey(), activeOpEntry.getValue().copy());
+
+ for (Map.Entry<String, QueryIndexState> readyOpEntry : readyOps.entrySet())
+ res.readyOps.put(readyOpEntry.getKey(), readyOpEntry.getValue().copy());
+
+ return res;
+ }
+ }
+
+ /**
* Try propose new index operation.
*
* @param locNodeId Local node ID.