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/05/17 14:01:35 UTC
[1/9] ignite git commit: WIP.
Repository: ignite
Updated Branches:
refs/heads/ignite-5054-splitter-2 [created] 1455e5327
WIP.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/aa90badd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/aa90badd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/aa90badd
Branch: refs/heads/ignite-5054-splitter-2
Commit: aa90badd2278fa74fcc1d7a4f66dda740bfc2fc9
Parents: 00ff656
Author: devozerov <vo...@gridgain.com>
Authored: Tue May 16 11:04:27 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Tue May 16 11:04:27 2017 +0300
----------------------------------------------------------------------
.../cache/query/GridCacheTwoStepQuery.java | 15 ++--
.../processors/cache/query/QueryTable.java | 83 ++++++++++++++++++++
.../processors/query/h2/IgniteH2Indexing.java | 12 ++-
.../query/h2/sql/GridSqlQuerySplitter.java | 21 ++---
4 files changed, 109 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aa90badd/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
index 0e31dc0..2b723b3 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
@@ -55,7 +55,7 @@ public class GridCacheTwoStepQuery {
private Set<String> schemas;
/** */
- private Set<String> tbls;
+ private Set<QueryTable> tbls;
/** */
private boolean distributedJoins;
@@ -74,12 +74,10 @@ public class GridCacheTwoStepQuery {
/**
* @param originalSql Original query SQL.
- * @param schemas Schema names in query.
* @param tbls Tables in query.
*/
- public GridCacheTwoStepQuery(String originalSql, Set<String> schemas, Set<String> tbls) {
+ public GridCacheTwoStepQuery(String originalSql, Set<QueryTable> tbls) {
this.originalSql = originalSql;
- this.schemas = schemas;
this.tbls = tbls;
}
@@ -262,7 +260,7 @@ public class GridCacheTwoStepQuery {
public GridCacheTwoStepQuery copy() {
assert !explain;
- GridCacheTwoStepQuery cp = new GridCacheTwoStepQuery(originalSql, schemas, tbls);
+ GridCacheTwoStepQuery cp = new GridCacheTwoStepQuery(originalSql, tbls);
cp.caches = caches;
cp.extraCaches = extraCaches;
@@ -279,6 +277,13 @@ public class GridCacheTwoStepQuery {
}
/**
+ * @return Nuumber of tables.
+ */
+ public int tablesCount() {
+ return tbls.size();
+ }
+
+ /**
* @return Tables.
*/
public Set<String> tables() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/aa90badd/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryTable.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryTable.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryTable.java
new file mode 100644
index 0000000..81a6446
--- /dev/null
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryTable.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.query;
+
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+import java.io.Serializable;
+
+/**
+ * Query table descriptor.
+ */
+public class QueryTable implements Serializable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Schema. */
+ private final String schema;
+
+ /** Table. */
+ private final String tbl;
+
+ /**
+ * Constructor.
+ *
+ * @param schema Schema.
+ * @param tbl Table.
+ */
+ public QueryTable(String schema, String tbl) {
+ this.schema = schema;
+ this.tbl = tbl;
+ }
+
+ /**
+ * @return Schema.
+ */
+ public String schema() {
+ return schema;
+ }
+
+ /**
+ * @return Table.
+ */
+ public String table() {
+ return tbl;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return 31 * (schema != null ? schema.hashCode() : 0) + (tbl != null ? tbl.hashCode() : 0);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object obj) {
+ if (obj instanceof QueryTable) {
+ QueryTable other = (QueryTable)obj;
+
+ return F.eq(tbl, other.tbl) && F.eq(schema, other.schema);
+ }
+
+ return super.equals(obj);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(QueryTable.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/aa90badd/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index 1c49fc7..4de5adc 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -1676,9 +1676,15 @@ public class IgniteH2Indexing implements GridQueryIndexing {
List<Integer> extraCaches = null;
// Setup spaces from schemas.
- if (!twoStepQry.schemas().isEmpty()) {
- Collection<String> spaces = new ArrayList<>(twoStepQry.schemas().size());
- caches = new ArrayList<>(twoStepQry.schemas().size() + 1);
+ assert twoStepQry != null;
+
+ int tblCnt = twoStepQry.tablesCount();
+
+ if (tblCnt > 0) {
+ Collection<String> spaces = new ArrayList<>(tblCnt);
+
+ caches = new ArrayList<>(tblCnt + 1);
+
caches.add(cctx.cacheId());
for (String schema : twoStepQry.schemas()) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/aa90badd/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
index 26c6b08..b557e35 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
@@ -36,6 +36,7 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.internal.processors.cache.query.GridCacheSqlQuery;
import org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery;
+import org.apache.ignite.internal.processors.cache.query.QueryTable;
import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.F;
@@ -93,11 +94,8 @@ public class GridSqlQuerySplitter {
/** */
private int splitId = -1; // The first one will be 0.
- /** */
- private Set<String> schemas = new HashSet<>();
-
- /** */
- private Set<String> tbls = new HashSet<>();
+ /** Query tables. */
+ private Set<QueryTable> tbls = new HashSet<>();
/** */
private boolean rdcQrySimple;
@@ -224,7 +222,7 @@ public class GridSqlQuerySplitter {
}
// Setup resulting two step query and return it.
- GridCacheTwoStepQuery twoStepQry = new GridCacheTwoStepQuery(originalSql, splitter.schemas, splitter.tbls);
+ GridCacheTwoStepQuery twoStepQry = new GridCacheTwoStepQuery(originalSql, splitter.tbls);
twoStepQry.reduceQuery(splitter.rdcSqlQry);
@@ -1500,15 +1498,10 @@ public class GridSqlQuerySplitter {
if (from instanceof GridSqlTable) {
GridSqlTable tbl = (GridSqlTable)from;
- String schema = tbl.schema();
-
- boolean addSchema = tbls == null;
-
- if (tbls != null)
- addSchema = tbls.add(tbl.dataTable().identifier());
+ String schemaName = tbl.schema();
+ String tblName = tbl.dataTable().identifier();
- if (addSchema && schema != null && schemas != null)
- schemas.add(schema);
+ tbls.add(new QueryTable(schemaName, tblName));
// In case of alias parent we need to replace the alias itself.
if (!prntAlias)
[6/9] ignite git commit: Removing extra spaces.
Posted by vo...@apache.org.
Removing extra spaces.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/745b8ac0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/745b8ac0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/745b8ac0
Branch: refs/heads/ignite-5054-splitter-2
Commit: 745b8ac0b0631e8269a6809efc8f6bb0a33795be
Parents: 40571fa
Author: devozerov <vo...@gridgain.com>
Authored: Wed May 17 14:40:52 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed May 17 14:40:52 2017 +0300
----------------------------------------------------------------------
.../processors/cache/query/GridCacheTwoStepQuery.java | 1 -
.../query/h2/twostep/GridReduceQueryExecutor.java | 13 +++++--------
2 files changed, 5 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/745b8ac0/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
index 80ba0ff..b5d8381 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
@@ -228,7 +228,6 @@ public class GridCacheTwoStepQuery {
GridCacheTwoStepQuery cp = new GridCacheTwoStepQuery(originalSql, tbls);
cp.caches = caches;
- cp.extraCaches = extraCaches;
cp.rdc = rdc.copy();
cp.skipMergeTbl = skipMergeTbl;
cp.pageSize = pageSize;
http://git-wip-us.apache.org/repos/asf/ignite/blob/745b8ac0/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index 1e07fee..d275826 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
@@ -536,8 +536,6 @@ public class GridReduceQueryExecutor {
final boolean isReplicatedOnly = qry.isReplicatedOnly();
// Fail if all caches are replicated and explicit partitions are set.
-
-
for (int attempt = 0;; attempt++) {
if (attempt != 0) {
try {
@@ -571,19 +569,18 @@ public class GridReduceQueryExecutor {
Map<ClusterNode, IntArray> qryMap = null;
// Partitions are not supported for queries over all replicated caches.
- if (cctx.isReplicated() && parts != null) {
- boolean failIfReplicatedOnly = true;
+ if (parts != null) {
+ boolean replicatedOnly = true;
- // TOD: Use normal caches
- for (Integer cacheId : extraSpaces) {
+ for (Integer cacheId : qry.caches()) {
if (!cacheContext(cacheId).isReplicated()) {
- failIfReplicatedOnly = false;
+ replicatedOnly = false;
break;
}
}
- if (failIfReplicatedOnly)
+ if (replicatedOnly)
throw new CacheException("Partitions are not supported for replicated caches");
}
[9/9] ignite git commit: Fixed serialization problem.
Posted by vo...@apache.org.
Fixed serialization problem.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1455e532
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1455e532
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1455e532
Branch: refs/heads/ignite-5054-splitter-2
Commit: 1455e5327f1fa63ef485a104cd0630b641829c49
Parents: 1acf0b7
Author: devozerov <vo...@gridgain.com>
Authored: Wed May 17 17:01:28 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed May 17 17:01:28 2017 +0300
----------------------------------------------------------------------
.../communication/GridIoMessageFactory.java | 4 +-
.../cache/transactions/TxDeadlock.java | 7 +-
.../IgniteCacheObjectProcessorImpl.java | 6 +-
.../processors/cache/query/QueryTable.java | 89 +++++++++++++++++++-
.../h2/twostep/msg/GridH2QueryRequest.java | 6 +-
.../twostep/msg/GridH2ValueMessageFactory.java | 4 +
6 files changed, 102 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1455e532/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
index 17e4a01..fa1a3e2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
@@ -178,6 +178,8 @@ public class GridIoMessageFactory implements MessageFactory {
Message msg = null;
switch (type) {
+ // -54 is reserved for SQL.
+
case -53:
msg = new SchemaOperationStatusMessage();
@@ -875,7 +877,7 @@ public class GridIoMessageFactory implements MessageFactory {
// [-3..119] [124..127] [-23..-27] [-36..-47]- this
// [120..123] - DR
- // [-4..-22, -30..-35] - SQL
+ // [-4..-22, -30..-36] - SQL
default:
if (ext != null) {
for (MessageFactory factory : ext) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/1455e532/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlock.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlock.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlock.java
index 97db698..c3c992f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlock.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlock.java
@@ -22,6 +22,7 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.apache.ignite.internal.processors.cache.CacheObjectContext;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.typedef.T2;
@@ -133,15 +134,15 @@ public class TxDeadlock {
IgniteTxKey txKey = e.getKey();
try {
- CacheObjectContext objCtx = ctx.cacheObjectContext(txKey.cacheId());
+ GridCacheContext<?, ?> cctx = ctx.cacheContext(txKey.cacheId());
- Object val = txKey.key().value(objCtx, true);
+ Object val = txKey.key().value(cctx.cacheObjectContext(), true);
sb.append(e.getValue())
.append(" [key=")
.append(val)
.append(", cache=")
- .append(objCtx.cacheName())
+ .append(cctx.name())
.append("]\n");
}
catch (Exception ex) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/1455e532/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
index a8595fb..57ed7c5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
@@ -261,16 +261,16 @@ public class IgniteCacheObjectProcessorImpl extends GridProcessorAdapter impleme
}
/**
- * @param ctx Cache objects context.
+ * @param coCtx Cache objects context.
* @param cctx Cache context.
* @param obj Object.
* @return Object partition.
*/
- protected final int partition(CacheObjectContext ctx, @Nullable GridCacheContext cctx, Object obj) {
+ protected final int partition(CacheObjectContext coCtx, @Nullable GridCacheContext cctx, Object obj) {
try {
return cctx != null ?
cctx.affinity().partition(obj, false) :
- ctx.kernalContext().affinity().partition0(ctx.cacheName(), obj, null);
+ coCtx.kernalContext().affinity().partition0(coCtx.cacheName(), obj, null);
}
catch (IgniteCheckedException e) {
U.error(log, "Failed to get partition", e);
http://git-wip-us.apache.org/repos/asf/ignite/blob/1455e532/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryTable.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryTable.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryTable.java
index 81a6446..54f5f03 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryTable.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryTable.java
@@ -19,21 +19,31 @@ package org.apache.ignite.internal.processors.cache.query;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
-import java.io.Serializable;
+import java.nio.ByteBuffer;
/**
* Query table descriptor.
*/
-public class QueryTable implements Serializable {
+public class QueryTable implements Message {
/** */
private static final long serialVersionUID = 0L;
/** Schema. */
- private final String schema;
+ private String schema;
/** Table. */
- private final String tbl;
+ private String tbl;
+
+ /**
+ * Defalt constructor.
+ */
+ public QueryTable() {
+ // No-op.
+ }
/**
* Constructor.
@@ -61,6 +71,77 @@ public class QueryTable implements Serializable {
}
/** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+ writer.setBuffer(buf);
+
+ if (!writer.isHeaderWritten()) {
+ if (!writer.writeHeader(directType(), fieldsCount()))
+ return false;
+
+ writer.onHeaderWritten();
+ }
+
+ switch (writer.state()) {
+ case 0:
+ if (!writer.writeString("schema", schema))
+ return false;
+
+ writer.incrementState();
+
+ case 1:
+ if (!writer.writeString("tbl", tbl))
+ return false;
+
+ writer.incrementState();
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+ reader.setBuffer(buf);
+
+ if (!reader.beforeMessageRead())
+ return false;
+
+ switch (reader.state()) {
+ case 0:
+ schema = reader.readString("schema");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 1:
+ tbl = reader.readString("tbl");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+ }
+
+ return reader.afterMessageRead(QueryTable.class);
+ }
+
+ /** {@inheritDoc} */
+ @Override public short directType() {
+ return -54;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte fieldsCount() {
+ return 2;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onAckReceived() {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
@Override public int hashCode() {
return 31 * (schema != null ? schema.hashCode() : 0) + (tbl != null ? tbl.hashCode() : 0);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1455e532/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java
index 7ffb6bc..beb1ae2 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java
@@ -111,7 +111,7 @@ public class GridH2QueryRequest implements Message, GridCacheQueryMarshallable {
/** */
@GridToStringInclude
- @GridDirectCollection(QueryTable.class)
+ @GridDirectCollection(Message.class)
private Collection<QueryTable> tbls;
/** */
@@ -435,7 +435,7 @@ public class GridH2QueryRequest implements Message, GridCacheQueryMarshallable {
writer.incrementState();
case 7:
- if (!writer.writeCollection("tbls", tbls, MessageCollectionItemType.STRING))
+ if (!writer.writeCollection("tbls", tbls, MessageCollectionItemType.MSG))
return false;
writer.incrementState();
@@ -528,7 +528,7 @@ public class GridH2QueryRequest implements Message, GridCacheQueryMarshallable {
reader.incrementState();
case 7:
- tbls = reader.readCollection("tbls", MessageCollectionItemType.STRING);
+ tbls = reader.readCollection("tbls", MessageCollectionItemType.MSG);
if (!reader.isLastRead())
return false;
http://git-wip-us.apache.org/repos/asf/ignite/blob/1455e532/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessageFactory.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessageFactory.java
index 3a825f7..18b1afb 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessageFactory.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessageFactory.java
@@ -21,6 +21,7 @@ import java.util.Collection;
import java.util.Iterator;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.processors.cache.query.QueryTable;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2ValueCacheObject;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.plugin.extensions.communication.MessageFactory;
@@ -108,6 +109,9 @@ public class GridH2ValueMessageFactory implements MessageFactory {
case -35:
return new GridH2RowRangeBounds();
+
+ case -54:
+ return new QueryTable();
}
return null;
[8/9] ignite git commit: Minors.
Posted by vo...@apache.org.
Minors.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1acf0b7f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1acf0b7f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1acf0b7f
Branch: refs/heads/ignite-5054-splitter-2
Commit: 1acf0b7f6f7c580e55514feb4c794735da9ccf34
Parents: 4a26787
Author: devozerov <vo...@gridgain.com>
Authored: Wed May 17 16:28:53 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed May 17 16:28:53 2017 +0300
----------------------------------------------------------------------
.../h2/twostep/GridReduceQueryExecutor.java | 45 ++++++++++----------
1 file changed, 23 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1acf0b7f/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index 4b31ef6..75914ef 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
@@ -865,11 +865,14 @@ public class GridReduceQueryExecutor {
* @return The first partitioned cache context.
*/
private GridCacheContext<?,?> findFirstPartitioned(List<Integer> cacheIds) {
- for (Integer cacheId : cacheIds) {
- GridCacheContext<?, ?> extraCctx = cacheContext(cacheId);
+ for (int i = 0; i < cacheIds.size(); i++) {
+ GridCacheContext<?, ?> cctx = cacheContext(cacheIds.get(i));
+
+ if (i == 0 && cctx.isLocal())
+ throw new CacheException("Cache is LOCAL: " + cctx.name());
- if (!extraCctx.isReplicated() && !extraCctx.isLocal())
- return extraCctx;
+ if (!cctx.isReplicated() && !cctx.isLocal())
+ return cctx;
}
throw new IllegalStateException("Failed to find partitioned cache.");
@@ -982,10 +985,10 @@ public class GridReduceQueryExecutor {
* @return Collection of all data nodes owning all the caches or {@code null} for retry.
*/
private Collection<ClusterNode> replicatedUnstableDataNodes(List<Integer> cacheIds) {
- GridCacheContext<?, ?> cctx = cacheContext(cacheIds.get(0));
-
int i = 0;
+ GridCacheContext<?, ?> cctx = cacheContext(cacheIds.get(i++));
+
// The main cache is allowed to be partitioned.
if (!cctx.isReplicated()) {
assert cacheIds.size() > 1: "no extra replicated caches with partitioned main cache";
@@ -1001,28 +1004,26 @@ public class GridReduceQueryExecutor {
if (F.isEmpty(nodes))
return null; // Retry.
- if (cacheIds.size() > 1) {
- for (;i < cacheIds.size(); i++) {
- GridCacheContext<?, ?> extraCctx = cacheContext(cacheIds.get(i));
+ for (;i < cacheIds.size(); i++) {
+ GridCacheContext<?, ?> extraCctx = cacheContext(cacheIds.get(i));
- if (extraCctx.isLocal())
- continue;
+ if (extraCctx.isLocal())
+ continue;
- if (!extraCctx.isReplicated())
- throw new CacheException("Queries running on replicated cache should not contain JOINs " +
- "with tables in partitioned caches [replicatedCache=" + cctx.name() + ", " +
- "partitionedCache=" + extraCctx.name() + "]");
+ if (!extraCctx.isReplicated())
+ throw new CacheException("Queries running on replicated cache should not contain JOINs " +
+ "with tables in partitioned caches [replicatedCache=" + cctx.name() + ", " +
+ "partitionedCache=" + extraCctx.name() + "]");
- Set<ClusterNode> extraOwners = replicatedUnstableDataNodes(extraCctx);
+ Set<ClusterNode> extraOwners = replicatedUnstableDataNodes(extraCctx);
- if (F.isEmpty(extraOwners))
- return null; // Retry.
+ if (F.isEmpty(extraOwners))
+ return null; // Retry.
- nodes.retainAll(extraOwners);
+ nodes.retainAll(extraOwners);
- if (nodes.isEmpty())
- return null; // Retry.
- }
+ if (nodes.isEmpty())
+ return null; // Retry.
}
return nodes;
[7/9] ignite git commit: Removed extra caches.
Posted by vo...@apache.org.
Removed extra caches.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4a267879
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4a267879
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4a267879
Branch: refs/heads/ignite-5054-splitter-2
Commit: 4a26787928035c76769e73454d6878ba92d16f60
Parents: 745b8ac
Author: devozerov <vo...@gridgain.com>
Authored: Wed May 17 16:17:40 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed May 17 16:17:40 2017 +0300
----------------------------------------------------------------------
.../cache/query/GridCacheTwoStepQuery.java | 30 +--
.../processors/query/h2/IgniteH2Indexing.java | 2 +-
.../h2/twostep/GridReduceQueryExecutor.java | 201 +++++++++----------
3 files changed, 101 insertions(+), 132 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a267879/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
index b5d8381..9e9a875 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
@@ -57,10 +57,7 @@ public class GridCacheTwoStepQuery {
private boolean skipMergeTbl;
/** */
- private List<Integer> caches;
-
- /** */
- private List<Integer> extraCaches;
+ private List<Integer> cacheIds;
/** */
private boolean local;
@@ -148,8 +145,8 @@ public class GridCacheTwoStepQuery {
public boolean isReplicatedOnly() {
assert !mapQrys.isEmpty();
- for (int i = 0; i < mapQrys.size(); i++) {
- if (mapQrys.get(i).isPartitioned())
+ for (GridCacheSqlQuery mapQry : mapQrys) {
+ if (mapQry.isPartitioned())
return false;
}
@@ -178,24 +175,17 @@ public class GridCacheTwoStepQuery {
}
/**
- * @return Caches.
- */
- public List<Integer> caches() {
- return caches;
- }
-
- /**
- * @param caches Caches.
+ * @return Cache IDs.
*/
- public void caches(List<Integer> caches) {
- this.caches = caches;
+ public List<Integer> cacheIds() {
+ return cacheIds;
}
/**
- * @return Caches.
+ * @param cacheIds Cache IDs.
*/
- public List<Integer> extraCaches() {
- return extraCaches;
+ public void cacheIds(List<Integer> cacheIds) {
+ this.cacheIds = cacheIds;
}
/**
@@ -227,7 +217,7 @@ public class GridCacheTwoStepQuery {
GridCacheTwoStepQuery cp = new GridCacheTwoStepQuery(originalSql, tbls);
- cp.caches = caches;
+ cp.cacheIds = cacheIds;
cp.rdc = rdc.copy();
cp.skipMergeTbl = skipMergeTbl;
cp.pageSize = pageSize;
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a267879/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index 71935f4..443cd5d 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -1700,7 +1700,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
checkCacheIndexSegmentation(caches);
- twoStepQry.caches(caches);
+ twoStepQry.cacheIds(caches);
twoStepQry.local(qry.isLocal());
meta = meta(stmt.getMetaData());
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a267879/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index d275826..4b31ef6 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
@@ -347,19 +347,13 @@ public class GridReduceQueryExecutor {
}
/**
- * @param cctx Cache context for main space.
- * @param extraSpaces Extra spaces.
+ * @param cacheIds Cache IDs.
* @return {@code true} If preloading is active.
*/
- private boolean isPreloadingActive(final GridCacheContext<?, ?> cctx, List<Integer> extraSpaces) {
- if (hasMovingPartitions(cctx))
- return true;
-
- if (extraSpaces != null) {
- for (int i = 0; i < extraSpaces.size(); i++) {
- if (hasMovingPartitions(cacheContext(extraSpaces.get(i))))
- return true;
- }
+ private boolean isPreloadingActive(List<Integer> cacheIds) {
+ for (Integer cacheId : cacheIds) {
+ if (hasMovingPartitions(cacheContext(cacheId)))
+ return true;
}
return false;
@@ -438,17 +432,14 @@ public class GridReduceQueryExecutor {
/**
* @param isReplicatedOnly If we must only have replicated caches.
* @param topVer Topology version.
- * @param cctx Cache context for main space.
- * @param extraSpaces Extra spaces.
+ * @param cacheIds Participating cache IDs.
* @param parts Partitions.
* @return Data nodes or {@code null} if repartitioning started and we need to retry.
*/
- private Map<ClusterNode, IntArray> stableDataNodes(
- boolean isReplicatedOnly,
- AffinityTopologyVersion topVer,
- final GridCacheContext<?, ?> cctx,
- List<Integer> extraSpaces,
- int[] parts) {
+ private Map<ClusterNode, IntArray> stableDataNodes(boolean isReplicatedOnly, AffinityTopologyVersion topVer,
+ List<Integer> cacheIds, int[] parts) {
+ GridCacheContext<?, ?> cctx = cacheContext(cacheIds.get(0));
+
Map<ClusterNode, IntArray> map = stableDataNodesMap(topVer, cctx, parts);
Set<ClusterNode> nodes = map.keySet();
@@ -456,54 +447,53 @@ public class GridReduceQueryExecutor {
if (F.isEmpty(map))
throw new CacheException("Failed to find data nodes for cache: " + cctx.name());
- if (!F.isEmpty(extraSpaces)) {
- for (int i = 0; i < extraSpaces.size(); i++) {
- GridCacheContext<?,?> extraCctx = cacheContext(extraSpaces.get(i));
+ for (int i = 1; i < cacheIds.size(); i++) {
+ GridCacheContext<?,?> extraCctx = cacheContext(cacheIds.get(i));
- String extraSpace = extraCctx.name();
+ String extraCacheName = extraCctx.name();
- if (extraCctx.isLocal())
- continue; // No consistency guaranties for local caches.
+ if (extraCctx.isLocal())
+ continue; // No consistency guaranties for local caches.
- if (isReplicatedOnly && !extraCctx.isReplicated())
- throw new CacheException("Queries running on replicated cache should not contain JOINs " +
- "with partitioned tables [rCache=" + cctx.name() + ", pCache=" + extraSpace + "]");
+ if (isReplicatedOnly && !extraCctx.isReplicated())
+ throw new CacheException("Queries running on replicated cache should not contain JOINs " +
+ "with partitioned tables [replicatedCache=" + cctx.name() +
+ ", partitionedCache=" + extraCacheName + "]");
- Set<ClusterNode> extraNodes = stableDataNodesMap(topVer, extraCctx, parts).keySet();
+ Set<ClusterNode> extraNodes = stableDataNodesMap(topVer, extraCctx, parts).keySet();
- if (F.isEmpty(extraNodes))
- throw new CacheException("Failed to find data nodes for cache: " + extraSpace);
+ if (F.isEmpty(extraNodes))
+ throw new CacheException("Failed to find data nodes for cache: " + extraCacheName);
- if (isReplicatedOnly && extraCctx.isReplicated()) {
- nodes.retainAll(extraNodes);
+ if (isReplicatedOnly && extraCctx.isReplicated()) {
+ nodes.retainAll(extraNodes);
- if (map.isEmpty()) {
- if (isPreloadingActive(cctx, extraSpaces))
- return null; // Retry.
- else
- throw new CacheException("Caches have distinct sets of data nodes [cache1=" + cctx.name() +
- ", cache2=" + extraSpace + "]");
- }
- }
- else if (!isReplicatedOnly && extraCctx.isReplicated()) {
- if (!extraNodes.containsAll(nodes))
- if (isPreloadingActive(cctx, extraSpaces))
- return null; // Retry.
- else
- throw new CacheException("Caches have distinct sets of data nodes [cache1=" + cctx.name() +
- ", cache2=" + extraSpace + "]");
- }
- else if (!isReplicatedOnly && !extraCctx.isReplicated()) {
- if (!extraNodes.equals(nodes))
- if (isPreloadingActive(cctx, extraSpaces))
- return null; // Retry.
- else
- throw new CacheException("Caches have distinct sets of data nodes [cache1=" + cctx.name() +
- ", cache2=" + extraSpace + "]");
+ if (map.isEmpty()) {
+ if (isPreloadingActive(cacheIds))
+ return null; // Retry.
+ else
+ throw new CacheException("Caches have distinct sets of data nodes [cache1=" + cctx.name() +
+ ", cache2=" + extraCacheName + "]");
}
- else
- throw new IllegalStateException();
}
+ else if (!isReplicatedOnly && extraCctx.isReplicated()) {
+ if (!extraNodes.containsAll(nodes))
+ if (isPreloadingActive(cacheIds))
+ return null; // Retry.
+ else
+ throw new CacheException("Caches have distinct sets of data nodes [cache1=" + cctx.name() +
+ ", cache2=" + extraCacheName + "]");
+ }
+ else if (!isReplicatedOnly && !extraCctx.isReplicated()) {
+ if (!extraNodes.equals(nodes))
+ if (isPreloadingActive(cacheIds))
+ return null; // Retry.
+ else
+ throw new CacheException("Caches have distinct sets of data nodes [cache1=" + cctx.name() +
+ ", cache2=" + extraCacheName + "]");
+ }
+ else
+ throw new IllegalStateException();
}
return map;
@@ -558,7 +548,7 @@ public class GridReduceQueryExecutor {
AffinityTopologyVersion topVer = h2.readyTopologyVersion();
- List<Integer> extraSpaces = qry.extraCaches();
+ List<Integer> cacheIds = qry.cacheIds();
Collection<ClusterNode> nodes = null;
@@ -572,7 +562,7 @@ public class GridReduceQueryExecutor {
if (parts != null) {
boolean replicatedOnly = true;
- for (Integer cacheId : qry.caches()) {
+ for (Integer cacheId : cacheIds) {
if (!cacheContext(cacheId).isReplicated()) {
replicatedOnly = false;
@@ -587,14 +577,11 @@ public class GridReduceQueryExecutor {
if (qry.isLocal())
nodes = singletonList(ctx.discovery().localNode());
else {
- // TODO: Use normal caches
- if (isPreloadingActive(cctx, extraSpaces)) {
+ if (isPreloadingActive(cacheIds)) {
if (isReplicatedOnly)
- // TODO: Use normal caches
- nodes = replicatedUnstableDataNodes(cctx, extraSpaces);
+ nodes = replicatedUnstableDataNodes(cacheIds);
else {
- // TODO: Use normal caches
- partsMap = partitionedUnstableDataNodes(cctx, extraSpaces);
+ partsMap = partitionedUnstableDataNodes(cacheIds);
if (partsMap != null) {
qryMap = narrowForQuery(partsMap, parts);
@@ -602,8 +589,9 @@ public class GridReduceQueryExecutor {
nodes = qryMap == null ? null : qryMap.keySet();
}
}
- } else {
- qryMap = stableDataNodes(isReplicatedOnly, topVer, cctx, extraSpaces, parts);
+ }
+ else {
+ qryMap = stableDataNodes(isReplicatedOnly, topVer, cacheIds, parts);
if (qryMap != null)
nodes = qryMap.keySet();
@@ -632,9 +620,8 @@ public class GridReduceQueryExecutor {
final boolean skipMergeTbl = !qry.explain() && qry.skipMergeTable();
- // TODO: Use normal caches
final int segmentsPerIndex = qry.explain() || isReplicatedOnly ? 1 :
- findFirstPartitioned(cctx, extraSpaces).config().getQueryParallelism();
+ findFirstPartitioned(cacheIds).config().getQueryParallelism();
int replicatedQrysCnt = 0;
@@ -732,7 +719,7 @@ public class GridReduceQueryExecutor {
.requestId(qryReqId)
.topologyVersion(topVer)
.pageSize(r.pageSize)
- .caches(qry.caches())
+ .caches(qry.cacheIds())
.tables(distributedJoins ? qry.tables() : null)
.partitions(convert(partsMap))
.queries(mapQrys)
@@ -874,19 +861,12 @@ public class GridReduceQueryExecutor {
}
/**
- * @param cctx Cache context for main space.
- * @param extraSpaces Extra spaces.
+ * @param cacheIds Cache IDs.
* @return The first partitioned cache context.
*/
- private GridCacheContext<?,?> findFirstPartitioned(GridCacheContext<?,?> cctx, List<Integer> extraSpaces) {
- if (cctx.isLocal())
- throw new CacheException("Cache is LOCAL: " + cctx.name());
-
- if (!cctx.isReplicated())
- return cctx;
-
- for (int i = 0 ; i < extraSpaces.size(); i++) {
- GridCacheContext<?, ?> extraCctx = cacheContext(extraSpaces.get(i));
+ private GridCacheContext<?,?> findFirstPartitioned(List<Integer> cacheIds) {
+ for (Integer cacheId : cacheIds) {
+ GridCacheContext<?, ?> extraCctx = cacheContext(cacheId);
if (!extraCctx.isReplicated() && !extraCctx.isLocal())
return extraCctx;
@@ -998,20 +978,20 @@ public class GridReduceQueryExecutor {
/**
* Calculates data nodes for replicated caches on unstable topology.
*
- * @param cctx Cache context for main space.
- * @param extraSpaces Extra spaces.
+ * @param cacheIds Cache IDs.
* @return Collection of all data nodes owning all the caches or {@code null} for retry.
*/
- private Collection<ClusterNode> replicatedUnstableDataNodes(GridCacheContext<?, ?> cctx,
- List<Integer> extraSpaces) {
+ private Collection<ClusterNode> replicatedUnstableDataNodes(List<Integer> cacheIds) {
+ GridCacheContext<?, ?> cctx = cacheContext(cacheIds.get(0));
+
int i = 0;
// The main cache is allowed to be partitioned.
if (!cctx.isReplicated()) {
- assert !F.isEmpty(extraSpaces): "no extra replicated caches with partitioned main cache";
+ assert cacheIds.size() > 1: "no extra replicated caches with partitioned main cache";
// Just replace the main cache with the first one extra.
- cctx = cacheContext(extraSpaces.get(i++));
+ cctx = cacheContext(cacheIds.get(i++));
assert cctx.isReplicated(): "all the extra caches must be replicated here";
}
@@ -1021,16 +1001,17 @@ public class GridReduceQueryExecutor {
if (F.isEmpty(nodes))
return null; // Retry.
- if (!F.isEmpty(extraSpaces)) {
- for (;i < extraSpaces.size(); i++) {
- GridCacheContext<?, ?> extraCctx = cacheContext(extraSpaces.get(i));
+ if (cacheIds.size() > 1) {
+ for (;i < cacheIds.size(); i++) {
+ GridCacheContext<?, ?> extraCctx = cacheContext(cacheIds.get(i));
if (extraCctx.isLocal())
continue;
if (!extraCctx.isReplicated())
throw new CacheException("Queries running on replicated cache should not contain JOINs " +
- "with tables in partitioned caches [rCache=" + cctx.name() + ", pCache=" + extraCctx.name() + "]");
+ "with tables in partitioned caches [replicatedCache=" + cctx.name() + ", " +
+ "partitionedCache=" + extraCctx.name() + "]");
Set<ClusterNode> extraOwners = replicatedUnstableDataNodes(extraCctx);
@@ -1093,23 +1074,19 @@ public class GridReduceQueryExecutor {
/**
* Calculates partition mapping for partitioned cache on unstable topology.
*
- * @param cctx Cache context for main space.
- * @param extraSpaces Extra spaces.
+ * @param cacheIds Cache IDs.
* @return Partition mapping or {@code null} if we can't calculate it due to repartitioning and we need to retry.
*/
@SuppressWarnings("unchecked")
- private Map<ClusterNode, IntArray> partitionedUnstableDataNodes(GridCacheContext<?,?> cctx,
- List<Integer> extraSpaces) {
- assert !cctx.isLocal() : cctx.name() + " must not be LOCAL";
-
+ private Map<ClusterNode, IntArray> partitionedUnstableDataNodes(List<Integer> cacheIds) {
// If the main cache is replicated, just replace it with the first partitioned.
- cctx = findFirstPartitioned(cctx, extraSpaces);
+ GridCacheContext<?,?> cctx = findFirstPartitioned(cacheIds);
final int partsCnt = cctx.affinity().partitions();
- if (extraSpaces != null) { // Check correct number of partitions for partitioned caches.
- for (int i = 0; i < extraSpaces.size(); i++) {
- GridCacheContext<?, ?> extraCctx = cacheContext(extraSpaces.get(i));
+ if (cacheIds.size() > 1) { // Check correct number of partitions for partitioned caches.
+ for (Integer cacheId : cacheIds) {
+ GridCacheContext<?, ?> extraCctx = cacheContext(cacheId);
if (extraCctx.isReplicated() || extraCctx.isLocal())
continue;
@@ -1118,14 +1095,15 @@ public class GridReduceQueryExecutor {
if (parts != partsCnt)
throw new CacheException("Number of partitions must be the same for correct collocation [cache1=" +
- cctx.name() + ", parts1=" + partsCnt + ", cache2=" + extraCctx.name() + ", parts2=" + parts + "]");
+ cctx.name() + ", parts1=" + partsCnt + ", cache2=" + extraCctx.name() +
+ ", parts2=" + parts + "]");
}
}
Set<ClusterNode>[] partLocs = new Set[partsCnt];
// Fill partition locations for main cache.
- for (int p = 0, parts = cctx.affinity().partitions(); p < parts; p++) {
+ for (int p = 0; p < partsCnt; p++) {
List<ClusterNode> owners = cctx.topology().owners(p);
if (F.isEmpty(owners)) {
@@ -1144,11 +1122,11 @@ public class GridReduceQueryExecutor {
partLocs[p] = new HashSet<>(owners);
}
- if (extraSpaces != null) {
+ if (cacheIds.size() > 1) {
// Find owner intersections for each participating partitioned cache partition.
// We need this for logical collocation between different partitioned caches with the same affinity.
- for (int i = 0; i < extraSpaces.size(); i++) {
- GridCacheContext<?, ?> extraCctx = cacheContext(extraSpaces.get(i));
+ for (Integer cacheId : cacheIds) {
+ GridCacheContext<?, ?> extraCctx = cacheContext(cacheId);
// This is possible if we have replaced a replicated cache with a partitioned one earlier.
if (cctx == extraCctx)
@@ -1157,7 +1135,7 @@ public class GridReduceQueryExecutor {
if (extraCctx.isReplicated() || extraCctx.isLocal())
continue;
- for (int p = 0, parts = extraCctx.affinity().partitions(); p < parts; p++) {
+ for (int p = 0, parts = extraCctx.affinity().partitions(); p < parts; p++) {
List<ClusterNode> owners = extraCctx.topology().owners(p);
if (partLocs[p] == UNMAPPED_PARTS)
@@ -1167,7 +1145,8 @@ public class GridReduceQueryExecutor {
if (!F.isEmpty(dataNodes(extraCctx.name(), NONE)))
return null; // Retry.
- throw new CacheException("Failed to find data nodes [cache=" + extraCctx.name() + ", part=" + p + "]");
+ throw new CacheException("Failed to find data nodes [cache=" + extraCctx.name() +
+ ", part=" + p + "]");
}
if (partLocs[p] == null)
@@ -1182,8 +1161,8 @@ public class GridReduceQueryExecutor {
}
// Filter nodes where not all the replicated caches loaded.
- for (int i = 0; i < extraSpaces.size(); i++) {
- GridCacheContext<?,?> extraCctx = cacheContext(extraSpaces.get(i));
+ for (Integer cacheId : cacheIds) {
+ GridCacheContext<?, ?> extraCctx = cacheContext(cacheId);
if (!extraCctx.isReplicated())
continue;
[4/9] ignite git commit: Compilable.
Posted by vo...@apache.org.
Compilable.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f71dac50
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f71dac50
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f71dac50
Branch: refs/heads/ignite-5054-splitter-2
Commit: f71dac505f1c645f7f8a8baf224e7b60444b1a9a
Parents: 78259fe
Author: devozerov <vo...@gridgain.com>
Authored: Wed May 17 14:07:34 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed May 17 14:07:34 2017 +0300
----------------------------------------------------------------------
.../cache/query/GridCacheTwoStepQuery.java | 6 +-----
.../processors/query/h2/IgniteH2Indexing.java | 10 +---------
.../query/h2/twostep/GridMapQueryExecutor.java | 15 ++++++++-------
.../query/h2/twostep/GridReduceQueryExecutor.java | 1 -
.../query/h2/twostep/msg/GridH2QueryRequest.java | 9 +++++----
5 files changed, 15 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f71dac50/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
index cb4f06b..80ba0ff 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
@@ -250,11 +250,7 @@ public class GridCacheTwoStepQuery {
/**
* @return Tables.
*/
- public Set<String> tables() {
- return tbls;
- }
-
- public Set<QueryTable> tables0() {
+ public Set<QueryTable> tables() {
return tbls;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f71dac50/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index 122917c..f545fd8 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -1684,7 +1684,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
if (tblCnt > 0) {
caches0.add(cctx.cacheId());
- for (QueryTable table : twoStepQry.tables0()) {
+ for (QueryTable table : twoStepQry.tables()) {
String cacheName = cacheNameForSchemaAndTable(table.schema(), table.table());
int cacheId = CU.cacheId(cacheName);
@@ -2014,14 +2014,6 @@ public class IgniteH2Indexing implements GridQueryIndexing {
}
/**
- * @param identifier Table identifier.
- * @return Data table.
- */
- public GridH2Table dataTable(String identifier) {
- return dataTables.get(identifier);
- }
-
- /**
* Find table by name in given schema.
*
* @param schemaName Schema name.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f71dac50/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
index 45d8f50..80bad5c 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
@@ -56,6 +56,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridReservabl
import org.apache.ignite.internal.processors.cache.query.CacheQueryType;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryMarshallable;
import org.apache.ignite.internal.processors.cache.query.GridCacheSqlQuery;
+import org.apache.ignite.internal.processors.cache.query.QueryTable;
import org.apache.ignite.internal.processors.query.GridQueryCancel;
import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
import org.apache.ignite.internal.processors.query.h2.opt.DistributedJoinMode;
@@ -101,7 +102,7 @@ public class GridMapQueryExecutor {
/** */
private static final Field RESULT_FIELD;
- /**
+ /*
* Initialize.
*/
static {
@@ -514,7 +515,7 @@ public class GridMapQueryExecutor {
AffinityTopologyVersion topVer,
Map<UUID, int[]> partsMap,
int[] parts,
- Collection<String> tbls,
+ Collection<QueryTable> tbls,
int pageSize,
DistributedJoinMode distributedJoinMode,
boolean enforceJoinOrder,
@@ -567,14 +568,14 @@ public class GridMapQueryExecutor {
if (!F.isEmpty(tbls)) {
snapshotedTbls = new ArrayList<>(tbls.size());
- for (String identifier : tbls) {
- GridH2Table tbl = h2.dataTable(identifier);
+ for (QueryTable tbl : tbls) {
+ GridH2Table h2Tbl = h2.dataTable(tbl.schema(), tbl.table());
- Objects.requireNonNull(tbl, identifier);
+ Objects.requireNonNull(h2Tbl, tbl.toString());
- tbl.snapshotIndexes(qctx);
+ h2Tbl.snapshotIndexes(qctx);
- snapshotedTbls.add(tbl);
+ snapshotedTbls.add(h2Tbl);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f71dac50/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index 56fc090..1e07fee 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
@@ -83,7 +83,6 @@ import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiClosure;
import org.apache.ignite.lang.IgniteFuture;
-import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.h2.command.ddl.CreateTableData;
import org.h2.engine.Session;
http://git-wip-us.apache.org/repos/asf/ignite/blob/f71dac50/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java
index 17bb9f6..7ffb6bc 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java
@@ -33,6 +33,7 @@ import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryMarshallable;
import org.apache.ignite.internal.processors.cache.query.GridCacheSqlQuery;
+import org.apache.ignite.internal.processors.cache.query.QueryTable;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -110,8 +111,8 @@ public class GridH2QueryRequest implements Message, GridCacheQueryMarshallable {
/** */
@GridToStringInclude
- @GridDirectCollection(String.class)
- private Collection<String> tbls;
+ @GridDirectCollection(QueryTable.class)
+ private Collection<QueryTable> tbls;
/** */
private int timeout;
@@ -173,7 +174,7 @@ public class GridH2QueryRequest implements Message, GridCacheQueryMarshallable {
* @param tbls Tables.
* @return {@code this}.
*/
- public GridH2QueryRequest tables(Collection<String> tbls) {
+ public GridH2QueryRequest tables(Collection<QueryTable> tbls) {
this.tbls = tbls;
return this;
@@ -182,7 +183,7 @@ public class GridH2QueryRequest implements Message, GridCacheQueryMarshallable {
/**
* @return Tables.
*/
- public Collection<String> tables() {
+ public Collection<QueryTable> tables() {
return tbls;
}
[5/9] ignite git commit: Reworked table identifiers.
Posted by vo...@apache.org.
Reworked table identifiers.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/40571fad
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/40571fad
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/40571fad
Branch: refs/heads/ignite-5054-splitter-2
Commit: 40571fad4954d8560b112d416c9f0c82f4109e72
Parents: f71dac5
Author: devozerov <vo...@gridgain.com>
Authored: Wed May 17 14:32:28 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed May 17 14:32:28 2017 +0300
----------------------------------------------------------------------
.../processors/query/h2/IgniteH2Indexing.java | 19 +++++++++-----
.../query/h2/opt/GridH2IndexBase.java | 2 +-
.../processors/query/h2/opt/GridH2Table.java | 27 +++++++++++++++-----
.../query/h2/sql/GridSqlQuerySplitter.java | 4 +--
.../query/h2/twostep/GridMapQueryExecutor.java | 2 +-
5 files changed, 37 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/40571fad/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index f545fd8..71935f4 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -399,7 +399,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
private DdlStatementsProcessor ddlProc;
/** */
- private final ConcurrentMap<String, GridH2Table> dataTables = new ConcurrentHashMap8<>();
+ private final ConcurrentMap<QueryTable, GridH2Table> dataTables = new ConcurrentHashMap8<>();
/** Statement cache. */
private final ConcurrentHashMap<Thread, StatementCache> stmtCache = new ConcurrentHashMap<>();
@@ -2010,7 +2010,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
addInitialUserIndex(spaceName, tbl, usrIdx);
if (dataTables.putIfAbsent(h2Tbl.identifier(), h2Tbl) != null)
- throw new IllegalStateException("Table already exists: " + h2Tbl.identifier());
+ throw new IllegalStateException("Table already exists: " + h2Tbl.identifierString());
}
/**
@@ -2021,12 +2021,17 @@ public class IgniteH2Indexing implements GridQueryIndexing {
* @return Table or {@code null} if none found.
*/
public GridH2Table dataTable(String schemaName, String tblName) {
- for (GridH2Table tbl : dataTables.values()) {
- if (tbl.getSchema().getName().equals(schemaName) && tbl.getName().equals(tblName))
- return tbl;
- }
+ return dataTable(new QueryTable(schemaName, tblName));
+ }
- return null;
+ /**
+ * Find table by it's identifier.
+ *
+ * @param tbl Identifier.
+ * @return Table or {@code null} if none found.
+ */
+ public GridH2Table dataTable(QueryTable tbl) {
+ return dataTables.get(tbl);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/40571fad/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
index 623da09..12850f4 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
@@ -132,7 +132,7 @@ public abstract class GridH2IndexBase extends BaseIndex {
log = ctx.log(getClass());
- msgTopic = new IgniteBiTuple<>(GridTopic.TOPIC_QUERY, tbl.identifier() + '.' + getName());
+ msgTopic = new IgniteBiTuple<>(GridTopic.TOPIC_QUERY, tbl.identifierString() + '.' + getName());
msgLsnr = new GridMessageListener() {
@Override public void onMessage(UUID nodeId, Object msg) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/40571fad/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
index a00ea90..a9f1f7d 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
@@ -32,6 +32,7 @@ import org.apache.ignite.IgniteInterruptedException;
import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.query.QueryTable;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.processors.query.h2.database.H2RowFactory;
import org.apache.ignite.internal.processors.query.h2.database.H2TreeIndex;
@@ -47,7 +48,6 @@ import org.h2.message.DbException;
import org.h2.result.Row;
import org.h2.result.SearchRow;
import org.h2.result.SortOrder;
-import org.h2.table.Column;
import org.h2.table.IndexColumn;
import org.h2.table.TableBase;
import org.h2.table.TableType;
@@ -58,7 +58,6 @@ import org.jsr166.LongAdder8;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
import static org.apache.ignite.internal.processors.query.h2.opt.GridH2AbstractKeyValueRow.KEY_COL;
-import static org.apache.ignite.internal.processors.query.h2.opt.GridH2AbstractKeyValueRow.VAL_COL;
import static org.apache.ignite.internal.processors.query.h2.opt.GridH2QueryType.MAP;
/**
@@ -104,6 +103,12 @@ public class GridH2Table extends TableBase {
/** */
private volatile boolean rebuildFromHashInProgress;
+ /** Identifier. */
+ private final QueryTable identifier;
+
+ /** Identifier as string. */
+ private final String identifierStr;
+
/**
* Creates table.
*
@@ -171,6 +176,9 @@ public class GridH2Table extends TableBase {
snapshotEnabled = desc == null || desc.snapshotableIndex();
lock = new ReentrantReadWriteLock();
+
+ identifier = new QueryTable(getSchema().getName(), getName());
+ identifierStr = identifier.schema() + "." + identifier.table();
}
/**
@@ -221,7 +229,7 @@ public class GridH2Table extends TableBase {
if (destroyed) {
unlock(exclusive);
- throw new IllegalStateException("Table " + identifier() + " already destroyed.");
+ throw new IllegalStateException("Table " + identifierString() + " already destroyed.");
}
if (snapshotInLock())
@@ -293,8 +301,15 @@ public class GridH2Table extends TableBase {
/**
* @return Table identifier.
*/
- public String identifier() {
- return getSchema().getName() + '.' + getName();
+ public QueryTable identifier() {
+ return identifier;
+ }
+
+ /**
+ * @return Table identifier as string.
+ */
+ public String identifierString() {
+ return identifierStr;
}
/**
@@ -352,7 +367,7 @@ public class GridH2Table extends TableBase {
*/
private void ensureNotDestroyed() {
if (destroyed)
- throw new IllegalStateException("Table " + identifier() + " already destroyed.");
+ throw new IllegalStateException("Table " + identifierString() + " already destroyed.");
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/40571fad/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
index b557e35..9f01346 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
@@ -1498,8 +1498,8 @@ public class GridSqlQuerySplitter {
if (from instanceof GridSqlTable) {
GridSqlTable tbl = (GridSqlTable)from;
- String schemaName = tbl.schema();
- String tblName = tbl.dataTable().identifier();
+ String schemaName = tbl.dataTable().identifier().schema();
+ String tblName = tbl.dataTable().identifier().table();
tbls.add(new QueryTable(schemaName, tblName));
http://git-wip-us.apache.org/repos/asf/ignite/blob/40571fad/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
index 80bad5c..6570fc7 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
@@ -569,7 +569,7 @@ public class GridMapQueryExecutor {
snapshotedTbls = new ArrayList<>(tbls.size());
for (QueryTable tbl : tbls) {
- GridH2Table h2Tbl = h2.dataTable(tbl.schema(), tbl.table());
+ GridH2Table h2Tbl = h2.dataTable(tbl);
Objects.requireNonNull(h2Tbl, tbl.toString());
[2/9] ignite git commit: Merge branch 'master' into
ignite-5054-splitter
Posted by vo...@apache.org.
Merge branch 'master' into ignite-5054-splitter
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/df678925
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/df678925
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/df678925
Branch: refs/heads/ignite-5054-splitter-2
Commit: df678925a75022fa1c332344c1b47202deeabeab
Parents: aa90bad ccaed07
Author: devozerov <vo...@gridgain.com>
Authored: Wed May 17 13:36:49 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed May 17 13:36:49 2017 +0300
----------------------------------------------------------------------
assembly/LICENSE_FABRIC | 2 +-
assembly/LICENSE_HADOOP | 2 +-
.../DistributedRegressionExample.java | 149 +++++++
.../apache/ignite/internal/IgniteKernal.java | 14 +
.../stream/v2/DirectByteBufferStreamImplV2.java | 27 +-
.../managers/communication/GridIoManager.java | 206 +++++++++-
.../processors/cache/GridCacheAdapter.java | 212 +++++-----
.../cache/GridCacheConcurrentMap.java | 9 +-
.../cache/GridCacheConcurrentMapImpl.java | 35 +-
.../processors/cache/GridCacheContext.java | 12 +
.../processors/cache/GridCacheEventManager.java | 32 ++
.../processors/cache/GridCacheMapEntry.java | 14 +-
.../cache/GridCacheMapEntryFactory.java | 6 +-
.../processors/cache/GridCacheProxyImpl.java | 60 ---
.../processors/cache/GridNoStorageCacheMap.java | 15 +-
.../cache/IgniteCacheOffheapManager.java | 7 +
.../cache/IgniteCacheOffheapManagerImpl.java | 17 +
.../processors/cache/IgniteInternalCache.java | 61 ---
.../distributed/GridDistributedCacheEntry.java | 8 +-
.../dht/GridCachePartitionedConcurrentMap.java | 23 +-
.../distributed/dht/GridDhtCacheAdapter.java | 170 +-------
.../distributed/dht/GridDhtCacheEntry.java | 8 +-
.../distributed/dht/GridDhtLocalPartition.java | 8 +-
.../dht/GridDhtPartitionTopologyImpl.java | 2 +-
.../dht/GridPartitionedGetFuture.java | 158 +++++---
.../dht/GridPartitionedSingleGetFuture.java | 141 ++++---
.../dht/atomic/GridDhtAtomicCache.java | 226 ++++++-----
.../dht/atomic/GridDhtAtomicCacheEntry.java | 11 +-
.../dht/colocated/GridDhtColocatedCache.java | 222 ++++++-----
.../colocated/GridDhtColocatedCacheEntry.java | 11 +-
.../colocated/GridDhtDetachedCacheEntry.java | 10 +-
.../distributed/near/GridNearCacheAdapter.java | 23 +-
.../distributed/near/GridNearCacheEntry.java | 8 +-
.../cache/distributed/near/GridNearTxLocal.java | 7 +-
.../processors/cache/local/GridLocalCache.java | 6 +-
.../cache/local/GridLocalCacheEntry.java | 8 +-
.../local/atomic/GridLocalAtomicCache.java | 188 +++++----
.../GridCacheAtomicSequenceImpl.java | 101 +----
.../processors/hadoop/HadoopClasspathUtils.java | 3 +-
.../platform/cluster/PlatformClusterGroup.java | 20 +
.../utils/PlatformConfigurationUtils.java | 4 +-
.../ignite/internal/util/IgniteUtils.java | 49 +--
.../org/apache/ignite/mxbean/IgniteMXBean.java | 44 +++
.../communication/tcp/TcpCommunicationSpi.java | 17 +-
.../ignite/spi/discovery/tcp/ClientImpl.java | 20 +
.../ignite/spi/discovery/tcp/ServerImpl.java | 59 ++-
.../spi/discovery/tcp/TcpDiscoveryImpl.java | 7 +-
.../spi/discovery/tcp/TcpDiscoverySpi.java | 4 +
.../spi/discovery/tcp/TcpDiscoverySpiMBean.java | 22 ++
.../TcpDiscoveryRingLatencyCheckMessage.java | 77 ++++
.../processors/cache/GridCacheLeakTest.java | 4 +-
.../cache/IgniteCacheNoSyncForGetTest.java | 395 +++++++++++++++++++
.../GridCachePartitionedFullApiSelfTest.java | 18 -
.../cache/eviction/EvictionAbstractTest.java | 13 +-
.../IgniteCacheClientNearCacheExpiryTest.java | 2 +-
.../IgniteCacheExpiryPolicyAbstractTest.java | 2 +-
.../loadtests/hashmap/GridHashMapLoadTest.java | 4 +-
.../testsuites/IgniteCacheTestSuite2.java | 3 +
modules/hadoop/pom.xml | 2 +-
.../hadoop/jobtracker/HadoopJobTracker.java | 20 +-
.../cache/hibernate/HibernateCacheProxy.java | 25 --
.../query/h2/twostep/GridMergeIndexSorted.java | 3 +
.../query/IgniteSqlSplitterSelfTest.java | 68 ++++
.../apache/ignite/ml/math/util/MatrixUtil.java | 3 +-
.../org/apache/ignite/ml/IgniteMLTestSuite.java | 35 ++
.../ml/math/MathImplDistributedTestSuite.java | 2 +-
.../ignite/ml/math/MathImplLocalTestSuite.java | 7 +-
.../ignite/ml/math/MathImplMainTestSuite.java | 2 +-
.../OLSMultipleLinearRegressionTest.java | 7 +
.../ml/regressions/RegressionsTestSuite.java | 32 ++
.../ignite/impl/binary/binary_type_manager.h | 6 +-
.../src/impl/binary/binary_type_manager.cpp | 83 ++--
.../Apache.Ignite.Core.Tests.csproj | 2 +
.../Binary/BinaryBuilderSelfTest.cs | 21 +-
.../Binary/BinarySelfTest.cs | 33 +-
.../Binary/EnumsTest.cs | 276 +++++++++++++
.../Cache/MemoryMetricsTest.cs | 134 +++++++
.../Compute/ComputeApiTest.cs | 2 +-
.../IgniteConfigurationSerializerTest.cs | 6 +-
.../IgniteConfigurationTest.cs | 4 +-
.../IgniteStartStopTest.cs | 2 +
.../Apache.Ignite.Core.csproj | 2 +
.../Configuration/MemoryPolicyConfiguration.cs | 9 +
.../Apache.Ignite.Core/Cache/IMemoryMetrics.cs | 55 +++
.../dotnet/Apache.Ignite.Core/IIgnite.cs | 7 +
.../IgniteConfigurationSection.xsd | 5 +
.../dotnet/Apache.Ignite.Core/Ignition.cs | 16 +-
.../Impl/Binary/BinaryEnum.cs | 22 +-
.../Impl/Binary/BinaryObject.cs | 2 +-
.../Impl/Binary/BinaryProcessor.cs | 1 -
.../Impl/Binary/BinaryReflectiveActions.cs | 12 +-
.../BinaryReflectiveSerializerInternal.cs | 9 +-
.../Impl/Binary/BinarySystemHandlers.cs | 271 ++++++-------
.../Impl/Binary/BinaryUtils.cs | 39 --
.../Impl/Binary/BinaryWriter.cs | 48 ++-
.../Binary/DeserializationCallbackProcessor.cs | 11 +
.../Impl/Binary/SerializableSerializer.cs | 10 +-
.../Impl/Cache/MemoryMetrics.cs | 62 +++
.../Impl/Cluster/ClusterGroupImpl.cs | 27 +-
.../dotnet/Apache.Ignite.Core/Impl/Ignite.cs | 6 +
.../web-console/backend/app/agentsHandler.js | 28 +-
.../web-console/backend/app/browsersHandler.js | 24 +-
modules/web-console/frontend/app/app.js | 7 +-
.../activities-user-dialog.tpl.pug | 33 +-
.../cluster-select/cluster-select.pug | 6 +-
.../cluster-select/cluster-select.scss | 30 ++
.../app/components/cluster-select/index.js | 1 +
.../components/web-console-footer/component.js | 23 ++
.../app/components/web-console-footer/index.js | 23 ++
.../components/web-console-footer/style.scss | 55 +++
.../components/web-console-footer/template.pug | 19 +
.../components/web-console-header/component.js | 34 ++
.../app/components/web-console-header/index.js | 23 ++
.../components/web-console-header/style.scss | 127 ++++++
.../components/web-console-header/template.pug | 25 ++
.../app/modules/agent/AgentManager.service.js | 170 +++++---
.../app/modules/branding/branding.provider.js | 2 +-
.../modules/branding/header-title.directive.js | 6 +-
.../branding/powered-by-apache.directive.js | 3 +-
.../frontend/app/modules/sql/sql.controller.js | 2 +-
.../frontend/app/modules/states/signin.state.js | 2 +
.../frontend/app/primitives/btn/index.scss | 235 +++++++++++
.../frontend/app/primitives/index.js | 2 +
.../frontend/app/primitives/modal/index.scss | 180 +++++++++
.../frontend/app/primitives/table/index.scss | 91 +++++
.../frontend/gulpfile.babel.js/paths.js | 1 +
.../frontend/gulpfile.babel.js/tasks/bundle.js | 2 +-
.../webpack/environments/development.js | 5 +-
modules/web-console/frontend/package.json | 1 +
.../frontend/public/images/ignite-logo.png | Bin 1982 -> 0 bytes
.../frontend/public/images/ignite-logo.svg | 17 +
.../frontend/public/images/ignite-logo@2x.png | Bin 3325 -> 0 bytes
.../stylesheets/_bootstrap-variables.scss | 4 +-
.../frontend/public/stylesheets/style.scss | 167 +-------
.../frontend/public/stylesheets/variables.scss | 6 +
modules/web-console/frontend/views/403.tpl.pug | 8 +-
modules/web-console/frontend/views/404.tpl.pug | 8 +-
modules/web-console/frontend/views/base.pug | 8 +-
modules/web-console/frontend/views/base2.pug | 8 +-
.../frontend/views/includes/footer.pug | 23 --
.../frontend/views/includes/header-left.pug | 64 +++
.../frontend/views/includes/header-right.pug | 40 ++
.../frontend/views/includes/header.pug | 57 ---
modules/web-console/frontend/views/index.pug | 2 +-
.../web-console/frontend/views/reset.tpl.pug | 12 +-
.../web-console/frontend/views/signin.tpl.pug | 14 +-
.../console/agent/handlers/ClusterListener.java | 90 +++--
.../console/agent/handlers/RestListener.java | 7 +
.../ignite/console/agent/rest/RestExecutor.java | 19 +-
.../cache/IgniteGetFromComputeBenchmark.java | 167 ++++++++
parent/pom.xml | 3 +-
151 files changed, 4453 insertions(+), 1806 deletions(-)
----------------------------------------------------------------------
[3/9] ignite git commit: WIP on refactor.
Posted by vo...@apache.org.
WIP on refactor.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/78259fe8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/78259fe8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/78259fe8
Branch: refs/heads/ignite-5054-splitter-2
Commit: 78259fe87c0284c7d60502a25aa465122689a689
Parents: df67892
Author: devozerov <vo...@gridgain.com>
Authored: Wed May 17 13:58:14 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed May 17 13:58:14 2017 +0300
----------------------------------------------------------------------
.../cache/query/GridCacheTwoStepQuery.java | 40 ++-------------
.../processors/query/h2/IgniteH2Indexing.java | 53 +++++++++-----------
.../h2/twostep/GridReduceQueryExecutor.java | 5 ++
3 files changed, 34 insertions(+), 64 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/78259fe8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
index 2b723b3..cb4f06b 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.processors.cache.query;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
import java.util.Set;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
@@ -49,12 +48,6 @@ public class GridCacheTwoStepQuery {
private String originalSql;
/** */
- private Collection<String> spaces;
-
- /** */
- private Set<String> schemas;
-
- /** */
private Set<QueryTable> tbls;
/** */
@@ -206,13 +199,6 @@ public class GridCacheTwoStepQuery {
}
/**
- * @param extraCaches Caches.
- */
- public void extraCaches(List<Integer> extraCaches) {
- this.extraCaches = extraCaches;
- }
-
- /**
* @return Original query SQL.
*/
public String originalSql() {
@@ -220,27 +206,6 @@ public class GridCacheTwoStepQuery {
}
/**
- * @return Spaces.
- */
- public Collection<String> spaces() {
- return spaces;
- }
-
- /**
- * @param spaces Spaces.
- */
- public void spaces(Collection<String> spaces) {
- this.spaces = spaces;
- }
-
- /**
- * @return Schemas.
- */
- public Set<String> schemas() {
- return schemas;
- }
-
- /**
* @return {@code True} If query is local.
*/
public boolean isLocal() {
@@ -264,7 +229,6 @@ public class GridCacheTwoStepQuery {
cp.caches = caches;
cp.extraCaches = extraCaches;
- cp.spaces = spaces;
cp.rdc = rdc.copy();
cp.skipMergeTbl = skipMergeTbl;
cp.pageSize = pageSize;
@@ -290,6 +254,10 @@ public class GridCacheTwoStepQuery {
return tbls;
}
+ public Set<QueryTable> tables0() {
+ return tbls;
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(GridCacheTwoStepQuery.class, this);
http://git-wip-us.apache.org/repos/asf/ignite/blob/78259fe8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index 4de5adc..122917c 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -46,6 +46,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@@ -88,6 +89,7 @@ import org.apache.ignite.internal.processors.cache.database.tree.io.PageIO;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryMarshallable;
import org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery;
import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
+import org.apache.ignite.internal.processors.cache.query.QueryTable;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.processors.query.GridQueryCacheObjectsIterator;
import org.apache.ignite.internal.processors.query.GridQueryCancel;
@@ -289,7 +291,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
/** */
private GridTimeoutProcessor.CancelableTask stmtCacheCleanupTask;
- /**
+ /*
* Command in H2 prepared statement.
*/
static {
@@ -1672,8 +1674,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
}
}
- List<Integer> caches;
- List<Integer> extraCaches = null;
+ LinkedHashSet<Integer> caches0 = new LinkedHashSet<>();
// Setup spaces from schemas.
assert twoStepQry != null;
@@ -1681,41 +1682,25 @@ public class IgniteH2Indexing implements GridQueryIndexing {
int tblCnt = twoStepQry.tablesCount();
if (tblCnt > 0) {
- Collection<String> spaces = new ArrayList<>(tblCnt);
-
- caches = new ArrayList<>(tblCnt + 1);
-
- caches.add(cctx.cacheId());
-
- for (String schema : twoStepQry.schemas()) {
- String space0 = space(schema);
+ caches0.add(cctx.cacheId());
- spaces.add(space0);
+ for (QueryTable table : twoStepQry.tables0()) {
+ String cacheName = cacheNameForSchemaAndTable(table.schema(), table.table());
- if (!F.eq(space0, space)) {
- int cacheId = CU.cacheId(space0);
+ int cacheId = CU.cacheId(cacheName);
- caches.add(cacheId);
-
- if (extraCaches == null)
- extraCaches = new ArrayList<>();
-
- extraCaches.add(cacheId);
- }
+ caches0.add(cacheId);
}
-
- twoStepQry.spaces(spaces);
- }
- else {
- caches = Collections.singletonList(cctx.cacheId());
- extraCaches = null;
}
+ else
+ caches0.add(cctx.cacheId());
//Prohibit usage indices with different numbers of segments in same query.
+ List<Integer> caches = new ArrayList<>(caches0);
+
checkCacheIndexSegmentation(caches);
twoStepQry.caches(caches);
- twoStepQry.extraCaches(extraCaches);
twoStepQry.local(qry.isLocal());
meta = meta(stmt.getMetaData());
@@ -1756,6 +1741,18 @@ public class IgniteH2Indexing implements GridQueryIndexing {
}
/**
+ * Get cache for schema and table.
+ *
+ * @param schemaName Schema name.
+ * @param tblName Table name.
+ * @return Cache name.
+ */
+ private String cacheNameForSchemaAndTable(String schemaName, String tblName) {
+ // TODO: This need to be changed.
+ return space(schemaName);
+ }
+
+ /**
* @throws IllegalStateException if segmented indices used with non-segmented indices.
*/
private void checkCacheIndexSegmentation(List<Integer> caches) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/78259fe8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index 3d81cb5..56fc090 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
@@ -575,6 +575,7 @@ public class GridReduceQueryExecutor {
if (cctx.isReplicated() && parts != null) {
boolean failIfReplicatedOnly = true;
+ // TOD: Use normal caches
for (Integer cacheId : extraSpaces) {
if (!cacheContext(cacheId).isReplicated()) {
failIfReplicatedOnly = false;
@@ -590,10 +591,13 @@ public class GridReduceQueryExecutor {
if (qry.isLocal())
nodes = singletonList(ctx.discovery().localNode());
else {
+ // TODO: Use normal caches
if (isPreloadingActive(cctx, extraSpaces)) {
if (isReplicatedOnly)
+ // TODO: Use normal caches
nodes = replicatedUnstableDataNodes(cctx, extraSpaces);
else {
+ // TODO: Use normal caches
partsMap = partitionedUnstableDataNodes(cctx, extraSpaces);
if (partsMap != null) {
@@ -632,6 +636,7 @@ public class GridReduceQueryExecutor {
final boolean skipMergeTbl = !qry.explain() && qry.skipMergeTable();
+ // TODO: Use normal caches
final int segmentsPerIndex = qry.explain() || isReplicatedOnly ? 1 :
findFirstPartitioned(cctx, extraSpaces).config().getQueryParallelism();