You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/05/31 12:47:11 UTC
[01/13] ignite git commit: cc
Repository: ignite
Updated Branches:
refs/heads/ignite-5075 6250119ef -> 4ef76013b
cc
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ae93227d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ae93227d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ae93227d
Branch: refs/heads/ignite-5075
Commit: ae93227d2745854d6fefbabaa2d9e8ec6f41abf1
Parents: 7fc0168
Author: sboikov <sb...@gridgain.com>
Authored: Thu May 25 17:04:26 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu May 25 17:04:26 2017 +0300
----------------------------------------------------------------------
.../CacheContinuousQueryFailoverAbstractSelfTest.java | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ae93227d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
index befd1d7..0ba9652 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
@@ -2243,13 +2243,11 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
* @throws Exception If failed.
*/
public void testNoEventLossOnTopologyChange() throws Exception {
- final int stableNodeCnt = 1;
-
final int batchLoadSize = 2000;
final int restartCycles = 5;
- Ignite qryClient = startGridsMultiThreaded(stableNodeCnt);
+ Ignite qryClient = startGrid(0);
final CacheEventListener4 lsnr = new CacheEventListener4(atomicityMode() == CacheAtomicityMode.ATOMIC);
@@ -2282,7 +2280,7 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
log.info("Batch loaded. Iteration: " + iteration);
- final long expCnt = putCnt * stableNodeCnt + ignoredDupEvts;
+ final long expCnt = putCnt + ignoredDupEvts;
GridTestUtils.waitForCondition(new GridAbsPredicate() {
@Override public boolean apply() {
@@ -2316,7 +2314,6 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
String msg = sb.toString();
// In atomic mode CQ can receive duplicate update events if update retried after fails.
- // E.g. topology change
if (atomicityMode() == CacheAtomicityMode.ATOMIC && msg.isEmpty() && cnt > expCnt)
ignoredDupEvts += cnt - expCnt;
else
[09/13] ignite git commit: IGNITE-5320: Introduced "PUBLIC" SQL
schema. This closes #2044.
Posted by sb...@apache.org.
IGNITE-5320: Introduced "PUBLIC" SQL schema. This closes #2044.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/738451c1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/738451c1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/738451c1
Branch: refs/heads/ignite-5075
Commit: 738451c16ec75b84c36bff7cd9dfbcf094c5b8ee
Parents: c71b7c2
Author: devozerov <vo...@gridgain.com>
Authored: Wed May 31 14:52:47 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed May 31 14:52:47 2017 +0300
----------------------------------------------------------------------
.../ignite/cache/query/SqlFieldsQuery.java | 24 ++++
.../configuration/CacheConfiguration.java | 6 +
.../configuration/IgniteConfiguration.java | 28 +++++
.../ignite/internal/jdbc2/JdbcConnection.java | 45 ++++---
.../ignite/internal/jdbc2/JdbcQueryTask.java | 11 +-
.../ignite/internal/jdbc2/JdbcResultSet.java | 5 +-
.../ignite/internal/jdbc2/JdbcStatement.java | 12 +-
.../jdbc2/JdbcStreamedPreparedStatement.java | 3 +-
.../processors/query/GridQueryIndexing.java | 27 +----
.../processors/query/GridQueryProcessor.java | 32 ++---
.../internal/processors/query/QueryUtils.java | 2 +
.../processors/query/h2/H2RowDescriptor.java | 35 ++++--
.../internal/processors/query/h2/H2Schema.java | 65 ++++-------
.../processors/query/h2/H2TableDescriptor.java | 25 ++--
.../processors/query/h2/H2TableEngine.java | 2 +-
.../internal/processors/query/h2/H2Utils.java | 2 +-
.../processors/query/h2/IgniteH2Indexing.java | 117 ++++++++++---------
.../query/h2/opt/GridH2RowDescriptor.java | 5 -
.../processors/query/h2/opt/GridH2Table.java | 25 ++--
.../query/IgniteSqlSchemaIndexingTest.java | 2 +-
.../h2/GridIndexingSpiAbstractSelfTest.java | 7 +-
21 files changed, 265 insertions(+), 215 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/738451c1/modules/core/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java b/modules/core/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java
index 9a7211b..93910dc 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java
@@ -74,6 +74,9 @@ public class SqlFieldsQuery extends Query<List<?>> {
/** Partitions for query */
private int[] parts;
+ /** Schema. */
+ private String schema;
+
/**
* Constructs SQL fields query.
*
@@ -287,6 +290,27 @@ public class SqlFieldsQuery extends Query<List<?>> {
return this;
}
+ /**
+ * Get schema.
+ *
+ * @return Schema.
+ */
+ @Nullable public String getSchema() {
+ return schema;
+ }
+
+ /**
+ * Set schema.
+ *
+ * @param schema Schema.
+ * @return {@code this} for chaining.
+ */
+ public SqlFieldsQuery setSchema(@Nullable String schema) {
+ this.schema = schema;
+
+ return this;
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(SqlFieldsQuery.class, this);
http://git-wip-us.apache.org/repos/asf/ignite/blob/738451c1/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
index 7269086..21f2fba 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
@@ -180,6 +180,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
public static final IgnitePredicate<ClusterNode> ALL_NODES = new IgniteAllNodesPredicate();
/** Default timeout after which long query warning will be printed. */
+ @Deprecated
public static final long DFLT_LONG_QRY_WARN_TIMEOUT = 3000;
/** Default number of queries detail metrics to collect. */
@@ -320,6 +321,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
private Class<?>[] sqlFuncCls;
/** */
+ @Deprecated
private long longQryWarnTimeout = DFLT_LONG_QRY_WARN_TIMEOUT;
/** */
@@ -1550,7 +1552,9 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* Gets timeout in milliseconds after which long query warning will be printed.
*
* @return Timeout in milliseconds.
+ * @deprecated Use {@link IgniteConfiguration#getLongQueryWarningTimeout()} instead.
*/
+ @Deprecated
public long getLongQueryWarningTimeout() {
return longQryWarnTimeout;
}
@@ -1560,7 +1564,9 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
*
* @param longQryWarnTimeout Timeout in milliseconds.
* @return {@code this} for chaining.
+ * @deprecated Use {@link IgniteConfiguration#setLongQueryWarningTimeout(long)} instead.
*/
+ @Deprecated
public CacheConfiguration<K, V> setLongQueryWarningTimeout(long longQryWarnTimeout) {
this.longQryWarnTimeout = longQryWarnTimeout;
http://git-wip-us.apache.org/repos/asf/ignite/blob/738451c1/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
index 9f68399..89ab43e 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
@@ -204,6 +204,9 @@ public class IgniteConfiguration {
@SuppressWarnings("UnnecessaryBoxing")
public static final Long DFLT_CLIENT_FAILURE_DETECTION_TIMEOUT = new Long(30_000);
+ /** Default timeout after which long query warning will be printed. */
+ public static final long DFLT_LONG_QRY_WARN_TIMEOUT = 3000;
+
/** Optional local Ignite instance name. */
private String igniteInstanceName;
@@ -457,6 +460,9 @@ public class IgniteConfiguration {
/** Active on start flag. */
private boolean activeOnStart = DFLT_ACTIVE_ON_START;
+ /** */
+ private long longQryWarnTimeout = DFLT_LONG_QRY_WARN_TIMEOUT;
+
/**
* Creates valid grid configuration with all default values.
*/
@@ -520,6 +526,7 @@ public class IgniteConfiguration {
lifecycleBeans = cfg.getLifecycleBeans();
locHost = cfg.getLocalHost();
log = cfg.getGridLogger();
+ longQryWarnTimeout = cfg.getLongQueryWarningTimeout();
lsnrs = cfg.getLocalEventListeners();
marsh = cfg.getMarshaller();
marshLocJobs = cfg.isMarshalLocalJobs();
@@ -2714,6 +2721,27 @@ public class IgniteConfiguration {
return this;
}
+ /**
+ * Gets timeout in milliseconds after which long query warning will be printed.
+ *
+ * @return Timeout in milliseconds.
+ */
+ public long getLongQueryWarningTimeout() {
+ return longQryWarnTimeout;
+ }
+
+ /**
+ * Sets timeout in milliseconds after which long query warning will be printed.
+ *
+ * @param longQryWarnTimeout Timeout in milliseconds.
+ * @return {@code this} for chaining.
+ */
+ public IgniteConfiguration setLongQueryWarningTimeout(long longQryWarnTimeout) {
+ this.longQryWarnTimeout = longQryWarnTimeout;
+
+ return this;
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(IgniteConfiguration.class, this);
http://git-wip-us.apache.org/repos/asf/ignite/blob/738451c1/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcConnection.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcConnection.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcConnection.java
index 9385d7d..1bf51f2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcConnection.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcConnection.java
@@ -53,19 +53,17 @@ import org.apache.ignite.IgniteJdbcDriver;
import org.apache.ignite.Ignition;
import org.apache.ignite.cluster.ClusterGroup;
import org.apache.ignite.compute.ComputeTaskTimeoutException;
-import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.IgnitionEx;
-import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
+import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
import org.apache.ignite.internal.processors.query.GridQueryIndexing;
import org.apache.ignite.internal.processors.query.IgniteSQLException;
+import org.apache.ignite.internal.processors.query.QueryUtils;
import org.apache.ignite.internal.processors.resource.GridSpringResourceContext;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteCallable;
import org.apache.ignite.resources.IgniteInstanceResource;
@@ -111,7 +109,10 @@ public class JdbcConnection implements Connection {
private final String cfg;
/** Cache name. */
- private String cacheName;
+ private final String cacheName;
+
+ /** Schema name. */
+ private String schemaName;
/** Closed flag. */
private boolean closed;
@@ -162,6 +163,7 @@ public class JdbcConnection implements Connection {
* @param props Additional properties.
* @throws SQLException In case Ignite node failed to start.
*/
+ @SuppressWarnings("unchecked")
public JdbcConnection(String url, Properties props) throws SQLException {
assert url != null;
assert props != null;
@@ -175,6 +177,10 @@ public class JdbcConnection implements Connection {
txAllowed = Boolean.parseBoolean(props.getProperty(PROP_TX_ALLOWED));
stream = Boolean.parseBoolean(props.getProperty(PROP_STREAMING));
+
+ if (stream && cacheName == null)
+ throw new SQLException("Cache name cannot be null when streaming is enabled.");
+
streamAllowOverwrite = Boolean.parseBoolean(props.getProperty(PROP_STREAMING_ALLOW_OVERWRITE));
streamFlushTimeout = Long.parseLong(props.getProperty(PROP_STREAMING_FLUSH_FREQ, "0"));
streamNodeBufSize = Integer.parseInt(props.getProperty(PROP_STREAMING_PER_NODE_BUF_SIZE,
@@ -196,6 +202,17 @@ public class JdbcConnection implements Connection {
if (!isValid(2))
throw new SQLException("Client is invalid. Probably cache name is wrong.");
+
+ if (cacheName != null) {
+ DynamicCacheDescriptor cacheDesc = ignite().context().cache().cacheDescriptor(cacheName);
+
+ if (cacheDesc == null)
+ throw new SQLException("Cache doesn't exist: " + cacheName);
+
+ schemaName = QueryUtils.normalizeSchemaName(cacheName, cacheDesc.cacheConfiguration().getSqlSchema());
+ }
+ else
+ schemaName = QueryUtils.DFLT_SCHEMA;
}
catch (Exception e) {
close();
@@ -722,18 +739,21 @@ public class JdbcConnection implements Connection {
}
/** {@inheritDoc} */
- @Override public void setSchema(String schema) throws SQLException {
- assert ignite instanceof IgniteEx;
-
- cacheName = ((IgniteEx)ignite).context().query().cacheName(schema);
+ @Override public void setSchema(String schemaName) throws SQLException {
+ this.schemaName = schemaName;
}
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public String getSchema() throws SQLException {
- String sqlSchema = ignite.cache(cacheName).getConfiguration(CacheConfiguration.class).getSqlSchema();
+ return schemaName;
+ }
- return U.firstNotNull(sqlSchema, cacheName, "");
+ /**
+ * @return Normalized schema name.
+ */
+ public String schemaName() {
+ return F.isEmpty(schemaName) ? QueryUtils.DFLT_SCHEMA : schemaName;
}
/** {@inheritDoc} */
@@ -830,8 +850,7 @@ public class JdbcConnection implements Connection {
* @return {@link PreparedStatement} from underlying engine to supply metadata to Prepared - most likely H2.
*/
PreparedStatement prepareNativeStatement(String sql) throws SQLException {
- return ((IgniteCacheProxy) ignite().cache(cacheName())).context()
- .kernalContext().query().prepareNativeStatement(getSchema(), sql);
+ return ignite().context().query().prepareNativeStatement(schemaName(), sql);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/738451c1/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcQueryTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcQueryTask.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcQueryTask.java
index 68ea4c2..7ae6ea2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcQueryTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcQueryTask.java
@@ -74,6 +74,9 @@ class JdbcQueryTask implements IgniteCallable<JdbcQueryTask.QueryResult> {
/** Cache name. */
private final String cacheName;
+ /** Schema name. */
+ private final String schemaName;
+
/** Sql. */
private final String sql;
@@ -101,6 +104,7 @@ class JdbcQueryTask implements IgniteCallable<JdbcQueryTask.QueryResult> {
/**
* @param ignite Ignite.
* @param cacheName Cache name.
+ * @param schemaName Schema name.
* @param sql Sql query.
* @param isQry Operation type flag - query or not - to enforce query type check.
* @param loc Local execution flag.
@@ -111,13 +115,13 @@ class JdbcQueryTask implements IgniteCallable<JdbcQueryTask.QueryResult> {
* @param collocatedQry Collocated query flag.
* @param distributedJoins Distributed joins flag.
*/
- public JdbcQueryTask(Ignite ignite, String cacheName, String sql,
- Boolean isQry, boolean loc, Object[] args, int fetchSize, UUID uuid,
- boolean locQry, boolean collocatedQry, boolean distributedJoins) {
+ public JdbcQueryTask(Ignite ignite, String cacheName, String schemaName, String sql, Boolean isQry, boolean loc,
+ Object[] args, int fetchSize, UUID uuid, boolean locQry, boolean collocatedQry, boolean distributedJoins) {
this.ignite = ignite;
this.args = args;
this.uuid = uuid;
this.cacheName = cacheName;
+ this.schemaName = schemaName;
this.sql = sql;
this.isQry = isQry;
this.fetchSize = fetchSize;
@@ -160,6 +164,7 @@ class JdbcQueryTask implements IgniteCallable<JdbcQueryTask.QueryResult> {
qry.setLocal(locQry);
qry.setCollocated(collocatedQry);
qry.setDistributedJoins(distributedJoins);
+ qry.setSchema(schemaName);
QueryCursorImpl<List<?>> qryCursor = (QueryCursorImpl<List<?>>)cache.withKeepBinary().query(qry);
http://git-wip-us.apache.org/repos/asf/ignite/blob/738451c1/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcResultSet.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcResultSet.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcResultSet.java
index 10cf17a..01c6386 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcResultSet.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcResultSet.java
@@ -146,8 +146,9 @@ public class JdbcResultSet implements ResultSet {
boolean loc = nodeId == null;
// Connections from new clients send queries with new tasks, so we have to continue in the same manner
- JdbcQueryTask qryTask = new JdbcQueryTask(loc ? ignite : null, conn.cacheName(), null, true, loc, null,
- fetchSize, uuid, conn.isLocalQuery(), conn.isCollocatedQuery(), conn.isDistributedJoins());
+ JdbcQueryTask qryTask = new JdbcQueryTask(loc ? ignite : null, conn.cacheName(), conn.schemaName(), null,
+ true, loc, null, fetchSize, uuid, conn.isLocalQuery(), conn.isCollocatedQuery(),
+ conn.isDistributedJoins());
try {
JdbcQueryTask.QueryResult res =
http://git-wip-us.apache.org/repos/asf/ignite/blob/738451c1/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcStatement.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcStatement.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcStatement.java
index 81045b8..89a80ca 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcStatement.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcStatement.java
@@ -108,8 +108,8 @@ public class JdbcStatement implements Statement {
boolean loc = nodeId == null;
- JdbcQueryTask qryTask = new JdbcQueryTask(loc ? ignite : null, conn.cacheName(), sql, true, loc, getArgs(),
- fetchSize, uuid, conn.isLocalQuery(), conn.isCollocatedQuery(), conn.isDistributedJoins());
+ JdbcQueryTask qryTask = new JdbcQueryTask(loc ? ignite : null, conn.cacheName(), conn.schemaName(), sql, true,
+ loc, getArgs(), fetchSize, uuid, conn.isLocalQuery(), conn.isCollocatedQuery(), conn.isDistributedJoins());
try {
JdbcQueryTask.QueryResult res =
@@ -165,8 +165,8 @@ public class JdbcStatement implements Statement {
if (!conn.isDmlSupported())
throw new SQLException("Failed to query Ignite: DML operations are supported in versions 1.8.0 and newer");
- JdbcQueryTask qryTask = new JdbcQueryTask(loc ? ignite : null, conn.cacheName(), sql, false, loc, args,
- fetchSize, uuid, conn.isLocalQuery(), conn.isCollocatedQuery(), conn.isDistributedJoins());
+ JdbcQueryTask qryTask = new JdbcQueryTask(loc ? ignite : null, conn.cacheName(), conn.schemaName(), sql, false,
+ loc, args, fetchSize, uuid, conn.isLocalQuery(), conn.isCollocatedQuery(), conn.isDistributedJoins());
try {
JdbcQueryTask.QueryResult qryRes =
@@ -332,8 +332,8 @@ public class JdbcStatement implements Statement {
boolean loc = nodeId == null;
- JdbcQueryTask qryTask = new JdbcQueryTask(loc ? ignite : null, conn.cacheName(), sql, null, loc, getArgs(),
- fetchSize, uuid, conn.isLocalQuery(), conn.isCollocatedQuery(), conn.isDistributedJoins());
+ JdbcQueryTask qryTask = new JdbcQueryTask(loc ? ignite : null, conn.cacheName(), conn.schemaName(), sql, null,
+ loc, getArgs(), fetchSize, uuid, conn.isLocalQuery(), conn.isCollocatedQuery(), conn.isDistributedJoins());
try {
JdbcQueryTask.QueryResult res =
http://git-wip-us.apache.org/repos/asf/ignite/blob/738451c1/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcStreamedPreparedStatement.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcStreamedPreparedStatement.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcStreamedPreparedStatement.java
index 019923f..9f76700 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcStreamedPreparedStatement.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcStreamedPreparedStatement.java
@@ -54,6 +54,7 @@ class JdbcStreamedPreparedStatement extends JdbcPreparedStatement {
/** {@inheritDoc} */
@Override long doUpdate(String sql, Object[] args) throws SQLException {
- return ((IgniteEx)conn.ignite()).context().query().streamUpdateQuery(conn.cacheName(), streamer, sql, args);
+ return conn.ignite().context().query().streamUpdateQuery(conn.cacheName(), conn.schemaName(),
+ streamer, sql, args);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/738451c1/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
index 4429058..031b5dd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
@@ -28,7 +28,6 @@ import org.apache.ignite.cache.query.FieldsQueryCursor;
import org.apache.ignite.cache.query.QueryCursor;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.SqlQuery;
-import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheObject;
@@ -171,11 +170,10 @@ public interface GridQueryIndexing {
* @param cacheName Cache name.
* @param schemaName Schema name.
* @param cctx Cache context.
- * @param ccfg Cache configuration.
* @throws IgniteCheckedException If failed.
*/
- public void registerCache(String cacheName, String schemaName, GridCacheContext<?,?> cctx,
- CacheConfiguration<?,?> ccfg) throws IgniteCheckedException;
+ public void registerCache(String cacheName, String schemaName, GridCacheContext<?,?> cctx)
+ throws IgniteCheckedException;
/**
* Unregisters cache.
@@ -188,21 +186,12 @@ public interface GridQueryIndexing {
/**
* Registers type if it was not known before or updates it otherwise.
*
- * @param cacheName Cache name.
+ * @param cctx Cache context.
* @param desc Type descriptor.
* @throws IgniteCheckedException If failed.
* @return {@code True} if type was registered, {@code false} if for some reason it was rejected.
*/
- public boolean registerType(String cacheName, GridQueryTypeDescriptor desc) throws IgniteCheckedException;
-
- /**
- * Unregisters type and removes all corresponding data.
- *
- * @param schemaName Schema name.
- * @param typeName Type name.
- * @throws IgniteCheckedException If failed.
- */
- public void unregisterType(String schemaName, String typeName) throws IgniteCheckedException;
+ public boolean registerType(GridCacheContext cctx, GridQueryTypeDescriptor desc) throws IgniteCheckedException;
/**
* Updates index. Note that key is unique for cache, so if cache contains multiple indexes
@@ -275,14 +264,6 @@ public interface GridQueryIndexing {
public PreparedStatement prepareNativeStatement(String schemaName, String sql) throws SQLException;
/**
- * Gets cache name from database schema.
- *
- * @param schemaName Schema name. Could not be null. Could be empty.
- * @return Cache name. Could be null.
- */
- public String cacheName(String schemaName);
-
- /**
* Collect queries that already running more than specified duration.
*
* @param duration Duration to check.
http://git-wip-us.apache.org/repos/asf/ignite/blob/738451c1/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 990226e..fef7d4c 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
@@ -1336,7 +1336,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
Collection<QueryTypeCandidate> cands) throws IgniteCheckedException {
synchronized (stateMux) {
if (idx != null)
- idx.registerCache(cacheName, schemaName, cctx, cctx.config());
+ idx.registerCache(cacheName, schemaName, cctx);
try {
for (QueryTypeCandidate cand : cands) {
@@ -1367,7 +1367,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}
if (idx != null)
- idx.registerType(cacheName, desc);
+ idx.registerType(cctx, desc);
}
cacheNames.add(CU.mask(cacheName));
@@ -1732,7 +1732,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
throw new IllegalStateException("Failed to execute query (grid is stopping).");
try {
- final String schemaName = idx.schema(cctx.name());
+ final String schemaName = qry.getSchema() != null ? qry.getSchema() : idx.schema(cctx.name());
final int mainCacheId = CU.cacheId(cctx.name());
IgniteOutClosureX<FieldsQueryCursor<List<?>>> clo;
@@ -1782,13 +1782,11 @@ public class GridQueryProcessor extends GridProcessorAdapter {
/**
* Query SQL fields without strict dependency on concrete cache.
*
- * @param schemaName Schema name.
* @param qry Query.
* @param keepBinary Keep binary flag.
- * @return Cursot.
+ * @return Cursor.
*/
- public FieldsQueryCursor<List<?>> querySqlFieldsNoCache(final String schemaName, final SqlFieldsQuery qry,
- final boolean keepBinary) {
+ public FieldsQueryCursor<List<?>> querySqlFieldsNoCache(final SqlFieldsQuery qry, final boolean keepBinary) {
checkxEnabled();
validateSqlFieldsQuery(qry);
@@ -1796,6 +1794,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
if (qry.isLocal())
throw new IgniteException("Local query is not supported without specific cache.");
+ if (qry.getSchema() == null)
+ throw new IgniteException("Query schema is not set.");
+
if (!busyLock.enterBusy())
throw new IllegalStateException("Failed to execute query (grid is stopping).");
@@ -1804,7 +1805,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
@Override public FieldsQueryCursor<List<?>> applyx() throws IgniteCheckedException {
GridQueryCancel cancel = new GridQueryCancel();
- return idx.queryDistributedSqlFields(schemaName, qry, keepBinary, cancel, null);
+ return idx.queryDistributedSqlFields(qry.getSchema(), qry, keepBinary, cancel, null);
}
};
@@ -1833,11 +1834,12 @@ public class GridQueryProcessor extends GridProcessorAdapter {
/**
* @param cacheName Cache name.
+ * @param schemaName Schema name.
* @param streamer Data streamer.
* @param qry Query.
* @return Iterator.
*/
- public long streamUpdateQuery(@Nullable final String cacheName,
+ public long streamUpdateQuery(@Nullable final String cacheName, final String schemaName,
final IgniteDataStreamer<?, ?> streamer, final String qry, final Object[] args) {
assert streamer != null;
@@ -1847,8 +1849,6 @@ public class GridQueryProcessor extends GridProcessorAdapter {
try {
GridCacheContext cctx = ctx.cache().cache(cacheName).context();
- final String schemaName = idx.schema(cacheName);
-
return executeQuery(GridCacheQueryType.SQL_FIELDS, qry, cctx, new IgniteOutClosureX<Long>() {
@Override public Long applyx() throws IgniteCheckedException {
return idx.streamUpdateQuery(schemaName, qry, args, streamer);
@@ -2106,16 +2106,6 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}
/**
- * @param schema Schema name.
- * @return Cache name from schema name.
- */
- public String cacheName(String schema) throws SQLException {
- checkxEnabled();
-
- return idx.cacheName(schema);
- }
-
- /**
* @param cacheName Cache name.
* @param key Key.
* @throws IgniteCheckedException Thrown in case of any errors.
http://git-wip-us.apache.org/repos/asf/ignite/blob/738451c1/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
index b4feea4..51648e5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
@@ -63,6 +63,8 @@ import static org.apache.ignite.IgniteSystemProperties.getInteger;
* Utility methods for queries.
*/
public class QueryUtils {
+ /** Default schema. */
+ public static final String DFLT_SCHEMA = "PUBLIC";
/** Field name for key. */
public static final String KEY_FIELD_NAME = "_KEY";
http://git-wip-us.apache.org/repos/asf/ignite/blob/738451c1/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2RowDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2RowDescriptor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2RowDescriptor.java
index 327ca14..a9bbd23 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2RowDescriptor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2RowDescriptor.java
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.processors.query.h2;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
@@ -34,6 +33,7 @@ import org.apache.ignite.internal.processors.query.h2.opt.GridH2ValueCacheObject
import org.apache.ignite.internal.util.offheap.unsafe.GridUnsafeGuard;
import org.apache.ignite.internal.util.offheap.unsafe.GridUnsafeMemory;
import org.h2.message.DbException;
+import org.h2.mvstore.cache.CacheLongKeyLIRS;
import org.h2.result.SearchRow;
import org.h2.result.SimpleRow;
import org.h2.value.DataType;
@@ -56,6 +56,7 @@ import org.h2.value.ValueString;
import org.h2.value.ValueTime;
import org.h2.value.ValueTimestamp;
import org.h2.value.ValueUuid;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.math.BigDecimal;
@@ -80,6 +81,9 @@ public class H2RowDescriptor implements GridH2RowDescriptor {
/** Indexing SPI. */
private final IgniteH2Indexing idx;
+ /** Table descriptor. */
+ private final H2TableDescriptor tbl;
+
/** */
private final GridQueryTypeDescriptor type;
@@ -114,14 +118,19 @@ public class H2RowDescriptor implements GridH2RowDescriptor {
private final int valueAliasColumnId;
/**
+ * Constructor.
+ *
+ * @param idx Indexing.
+ * @param tbl Table.
* @param type Type descriptor.
* @param schema Schema.
*/
- H2RowDescriptor(IgniteH2Indexing idx, GridQueryTypeDescriptor type, H2Schema schema) {
+ H2RowDescriptor(IgniteH2Indexing idx, H2TableDescriptor tbl, GridQueryTypeDescriptor type, H2Schema schema) {
assert type != null;
assert schema != null;
this.idx = idx;
+ this.tbl = tbl;
this.type = type;
this.schema = schema;
@@ -177,12 +186,7 @@ public class H2RowDescriptor implements GridH2RowDescriptor {
/** {@inheritDoc} */
@Override public GridCacheContext<?, ?> context() {
- return schema.cacheContext();
- }
-
- /** {@inheritDoc} */
- @Override public CacheConfiguration configuration() {
- return schema.cacheContext().config();
+ return tbl.cache();
}
/** {@inheritDoc} */
@@ -196,12 +200,12 @@ public class H2RowDescriptor implements GridH2RowDescriptor {
assert ptr > 0 : ptr;
- schema.rowCache().put(ptr, row);
+ rowCache().put(ptr, row);
}
/** {@inheritDoc} */
@Override public void uncache(long ptr) {
- schema.rowCache().remove(ptr);
+ rowCache().remove(ptr);
}
/** {@inheritDoc} */
@@ -348,7 +352,7 @@ public class H2RowDescriptor implements GridH2RowDescriptor {
/** {@inheritDoc} */
@Override public GridH2KeyValueRowOffheap createPointer(long ptr) {
- GridH2KeyValueRowOffheap row = (GridH2KeyValueRowOffheap)schema.rowCache().get(ptr);
+ GridH2KeyValueRowOffheap row = (GridH2KeyValueRowOffheap)rowCache().get(ptr);
if (row != null) {
assert row.pointer() == ptr : ptr + " " + row.pointer();
@@ -361,7 +365,7 @@ public class H2RowDescriptor implements GridH2RowDescriptor {
/** {@inheritDoc} */
@Override public GridH2Row cachedRow(long link) {
- return schema.rowCache().get(link);
+ return rowCache().get(link);
}
/** {@inheritDoc} */
@@ -475,4 +479,11 @@ public class H2RowDescriptor implements GridH2RowDescriptor {
return colId;
}
+
+ /**
+ * @return Row cache.
+ */
+ @NotNull private CacheLongKeyLIRS<GridH2Row> rowCache() {
+ throw new UnsupportedOperationException(); // TODO: Unused for not.
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/738451c1/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Schema.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Schema.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Schema.java
index 8dd87c0..deca4b2 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Schema.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Schema.java
@@ -17,10 +17,7 @@
package org.apache.ignite.internal.processors.query.h2;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.query.h2.opt.GridH2Row;
import org.apache.ignite.internal.util.offheap.unsafe.GridUnsafeMemory;
-import org.h2.mvstore.cache.CacheLongKeyLIRS;
import org.jsr166.ConcurrentHashMap8;
import java.util.Collection;
@@ -31,9 +28,6 @@ import java.util.concurrent.ConcurrentMap;
*/
public class H2Schema {
/** */
- private final String cacheName;
-
- /** */
private final String schemaName;
/** */
@@ -45,37 +39,13 @@ public class H2Schema {
/** */
private final ConcurrentMap<String, H2TableDescriptor> typeToTbl = new ConcurrentHashMap8<>();
- /** Cache for deserialized offheap rows. */
- private final CacheLongKeyLIRS<GridH2Row> rowCache;
-
- /** */
- private final GridCacheContext<?, ?> cctx;
-
/**
- * @param cacheName Cache name.
+ * Constructor.
+ *
* @param schemaName Schema name.
- * @param cctx Cache context.
*/
- public H2Schema(String cacheName, String schemaName, GridCacheContext<?, ?> cctx) {
- this.cacheName = cacheName;
- this.cctx = cctx;
+ public H2Schema(String schemaName) {
this.schemaName = schemaName;
-
- rowCache = null;
- }
-
- /**
- * @return Cache context.
- */
- public GridCacheContext cacheContext() {
- return cctx;
- }
-
- /**
- * @return Cache name.
- */
- public String cacheName() {
- return cacheName;
}
/**
@@ -93,13 +63,6 @@ public class H2Schema {
}
/**
- * @return Row cache.
- */
- public CacheLongKeyLIRS<GridH2Row> rowCache() {
- return rowCache;
- }
-
- /**
* @return Tables.
*/
public Collection<H2TableDescriptor> tables() {
@@ -138,14 +101,30 @@ public class H2Schema {
*/
public void remove(H2TableDescriptor tbl) {
tbls.remove(tbl.tableName());
+
+ typeToTbl.remove(tbl.typeName());
+ }
+
+ /**
+ * Drop table.
+ *
+ * @param tbl Table to be removed.
+ */
+ public void drop(H2TableDescriptor tbl) {
+ tbl.onDrop();
+
+ tbls.remove(tbl.tableName());
typeToTbl.remove(tbl.typeName());
}
/**
* Called after the schema was dropped.
*/
- public void onDrop() {
- for (H2TableDescriptor tblDesc : tbls.values())
- tblDesc.onDrop();
+ public void dropAll() {
+ for (H2TableDescriptor tbl : tbls.values())
+ tbl.onDrop();
+
+ tbls.clear();
+ typeToTbl.clear();
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/738451c1/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2TableDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2TableDescriptor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2TableDescriptor.java
index eedfc3a..589f90e 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2TableDescriptor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2TableDescriptor.java
@@ -59,8 +59,8 @@ public class H2TableDescriptor implements GridH2SystemIndexFactory {
/** */
private final H2Schema schema;
- /** Cache name. */
- private final String cacheName;
+ /** Cache context. */
+ private final GridCacheContext cctx;
/** */
private GridH2Table tbl;
@@ -77,13 +77,14 @@ public class H2TableDescriptor implements GridH2SystemIndexFactory {
* @param idx Indexing.
* @param schema Schema.
* @param type Type descriptor.
- * @param cacheName Cache name.
+ * @param cctx Cache context.
*/
- H2TableDescriptor(IgniteH2Indexing idx, H2Schema schema, GridQueryTypeDescriptor type, String cacheName) {
+ public H2TableDescriptor(IgniteH2Indexing idx, H2Schema schema, GridQueryTypeDescriptor type,
+ GridCacheContext cctx) {
this.idx = idx;
this.type = type;
this.schema = schema;
- this.cacheName = cacheName;
+ this.cctx = cctx;
fullTblName = H2Utils.withQuotes(schema.schemaName()) + "." + H2Utils.withQuotes(type.tableName());
}
@@ -145,10 +146,10 @@ public class H2TableDescriptor implements GridH2SystemIndexFactory {
}
/**
- * @return Cache name.
+ * @return Cache context.
*/
- String cacheName() {
- return cacheName;
+ GridCacheContext cache() {
+ return cctx;
}
/**
@@ -177,8 +178,6 @@ public class H2TableDescriptor implements GridH2SystemIndexFactory {
* @return H2 row factory.
*/
H2RowFactory rowFactory(GridH2RowDescriptor rowDesc) {
- GridCacheContext cctx = schema.cacheContext();
-
if (cctx.affinityNode())
return new H2RowFactory(rowDesc, cctx);
@@ -198,7 +197,6 @@ public class H2TableDescriptor implements GridH2SystemIndexFactory {
GridH2RowDescriptor desc = tbl.rowDescriptor();
Index hashIdx = createHashIndex(
- schema,
tbl,
"_key_PK_hash",
H2Utils.treeIndexColumns(desc, new ArrayList<IndexColumn>(2), keyCol, affCol)
@@ -322,15 +320,12 @@ public class H2TableDescriptor implements GridH2SystemIndexFactory {
/**
* Create hash index.
*
- * @param schema Schema.
* @param tbl Table.
* @param idxName Index name.
* @param cols Columns.
* @return Index.
*/
- private Index createHashIndex(H2Schema schema, GridH2Table tbl, String idxName, List<IndexColumn> cols) {
- GridCacheContext cctx = schema.cacheContext();
-
+ private Index createHashIndex(GridH2Table tbl, String idxName, List<IndexColumn> cols) {
if (cctx.affinityNode()) {
assert pkHashIdx == null : pkHashIdx;
http://git-wip-us.apache.org/repos/asf/ignite/blob/738451c1/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2TableEngine.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2TableEngine.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2TableEngine.java
index db34064..57b7ba0 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2TableEngine.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2TableEngine.java
@@ -82,7 +82,7 @@ public class H2TableEngine implements TableEngine {
/** {@inheritDoc} */
@Override public TableBase createTable(CreateTableData createTblData) {
- resTbl0 = new GridH2Table(createTblData, rowDesc0, rowFactory0, tblDesc0, tblDesc0.cacheName());
+ resTbl0 = new GridH2Table(createTblData, rowDesc0, rowFactory0, tblDesc0, tblDesc0.cache());
return resTbl0;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/738451c1/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java
index a4fdb53..ee88acf 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java
@@ -173,7 +173,7 @@ public class H2Utils {
if (!ctor.isAccessible())
ctor.setAccessible(true);
- final int segments = tbl.rowDescriptor().configuration().getQueryParallelism();
+ final int segments = tbl.rowDescriptor().context().config().getQueryParallelism();
return (GridH2IndexBase)ctor.newInstance(tbl, idxName, segments, cols);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/738451c1/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 bd611f6..e192008 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
@@ -54,7 +54,6 @@ import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.SqlQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlFunction;
import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.GridTopic;
import org.apache.ignite.internal.IgniteInternalFuture;
@@ -90,6 +89,7 @@ import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
import org.apache.ignite.internal.processors.query.IgniteSQLException;
import org.apache.ignite.internal.processors.query.QueryIndexDescriptorImpl;
+import org.apache.ignite.internal.processors.query.QueryUtils;
import org.apache.ignite.internal.processors.query.h2.ddl.DdlStatementsProcessor;
import org.apache.ignite.internal.processors.query.h2.opt.DistributedJoinMode;
import org.apache.ignite.internal.processors.query.h2.database.H2PkHashIndex;
@@ -581,7 +581,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
* @param tbl Table to unregister.
* @throws IgniteCheckedException If failed to unregister.
*/
- private void removeTable(H2TableDescriptor tbl) throws IgniteCheckedException {
+ private void dropTable(H2TableDescriptor tbl) throws IgniteCheckedException {
assert tbl != null;
if (log.isDebugEnabled())
@@ -614,10 +614,6 @@ public class IgniteH2Indexing implements GridQueryIndexing {
finally {
U.close(stmt, log);
}
-
- tbl.onDrop();
-
- tbl.schema().remove(tbl);
}
/**
@@ -743,12 +739,12 @@ public class IgniteH2Indexing implements GridQueryIndexing {
public GridH2IndexBase createSortedIndex(H2Schema schema, String name, GridH2Table tbl, boolean pk,
List<IndexColumn> cols, int inlineSize) {
try {
- GridCacheContext cctx = schema.cacheContext();
+ GridCacheContext cctx = tbl.cache();
if (log.isDebugEnabled())
log.debug("Creating cache index [cacheId=" + cctx.cacheId() + ", idxName=" + name + ']');
- final int segments = tbl.rowDescriptor().configuration().getQueryParallelism();
+ final int segments = tbl.rowDescriptor().context().config().getQueryParallelism();
return new H2TreeIndex(cctx, tbl, name, pk, cols, inlineSize, segments);
}
@@ -779,15 +775,6 @@ public class IgniteH2Indexing implements GridQueryIndexing {
return new GridEmptyCloseableIterator<>();
}
- /** {@inheritDoc} */
- @Override public void unregisterType(String schemaName, String typeName)
- throws IgniteCheckedException {
- H2TableDescriptor tbl = tableDescriptor(schemaName, typeName);
-
- if (tbl != null)
- removeTable(tbl);
- }
-
/**
* Queries individual fields (generally used by JDBC drivers).
*
@@ -1001,7 +988,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
long time = U.currentTimeMillis() - start;
- long longQryExecTimeout = schemas.get(schema).cacheContext().config().getLongQueryWarningTimeout();
+ long longQryExecTimeout = ctx.config().getLongQueryWarningTimeout();
if (time > longQryExecTimeout) {
String msg = "Query execution is too long (" + time + " ms): " + sql;
@@ -1519,15 +1506,15 @@ public class IgniteH2Indexing implements GridQueryIndexing {
* @param type Type description.
* @throws IgniteCheckedException In case of error.
*/
- @Override public boolean registerType(String cacheName, GridQueryTypeDescriptor type)
+ @Override public boolean registerType(GridCacheContext cctx, GridQueryTypeDescriptor type)
throws IgniteCheckedException {
validateTypeDescriptor(type);
- String schemaName = schema(cacheName);
+ String schemaName = schema(cctx.name());
H2Schema schema = schemas.get(schemaName);
- H2TableDescriptor tbl = new H2TableDescriptor(this, schema, type, cacheName);
+ H2TableDescriptor tbl = new H2TableDescriptor(this, schema, type, cctx);
try {
Connection conn = connectionForThread(schemaName);
@@ -1609,7 +1596,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
if (log.isDebugEnabled())
log.debug("Creating DB table with SQL: " + sql);
- GridH2RowDescriptor rowDesc = new H2RowDescriptor(this, tbl.type(), schema);
+ GridH2RowDescriptor rowDesc = new H2RowDescriptor(this, tbl, tbl.type(), schema);
H2RowFactory rowFactory = tbl.rowFactory(rowDesc);
@@ -1732,17 +1719,6 @@ public class IgniteH2Indexing implements GridQueryIndexing {
}
/** {@inheritDoc} */
- @Override public String cacheName(String schemaName) {
- assert schemaName != null;
-
- H2Schema schema = schemas.get(schemaName);
-
- assert schema != null;
-
- return schema.cacheName();
- }
-
- /** {@inheritDoc} */
@SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter")
@Override public void rebuildIndexesFromHash(GridCacheContext cctx, String schemaName, String typeName)
throws IgniteCheckedException {
@@ -1886,6 +1862,8 @@ public class IgniteH2Indexing implements GridQueryIndexing {
else {
this.ctx = ctx;
+ schemas.put(QueryUtils.DFLT_SCHEMA, new H2Schema(QueryUtils.DFLT_SCHEMA));
+
valCtx = new CacheQueryObjectValueContext(ctx);
nodeId = ctx.localNodeId();
@@ -2081,7 +2059,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
// unregisterMBean(); TODO https://issues.apache.org/jira/browse/IGNITE-2139
if (ctx != null && !ctx.cache().context().database().persistenceEnabled()) {
for (H2Schema schema : schemas.values())
- schema.onDrop();
+ schema.dropAll();
}
for (Connection c : conns)
@@ -2091,8 +2069,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
schemas.clear();
cacheName2schema.clear();
- try (Connection c = DriverManager.getConnection(dbUrl);
- Statement s = c.createStatement()) {
+ try (Connection c = DriverManager.getConnection(dbUrl); Statement s = c.createStatement()) {
s.execute("SHUTDOWN");
}
catch (SQLException e) {
@@ -2108,41 +2085,75 @@ public class IgniteH2Indexing implements GridQueryIndexing {
log.debug("Cache query index stopped.");
}
+ /**
+ * Whether this is default schema.
+ *
+ * @param schemaName Schema name.
+ * @return {@code True} if default.
+ */
+ private boolean isDefaultSchema(String schemaName) {
+ return F.eq(schemaName, QueryUtils.DFLT_SCHEMA);
+ }
+
/** {@inheritDoc} */
- @Override public void registerCache(String cacheName, String schemaName, GridCacheContext<?, ?> cctx,
- CacheConfiguration<?, ?> ccfg) throws IgniteCheckedException {
- if (schemas.putIfAbsent(schemaName, new H2Schema(cacheName, schemaName, cctx)) != null)
- throw new IgniteCheckedException("Cache already registered: " + U.maskName(cacheName));
+ @Override public void registerCache(String cacheName, String schemaName, GridCacheContext<?, ?> cctx)
+ throws IgniteCheckedException {
+ if (!isDefaultSchema(schemaName)) {
+ if (schemas.putIfAbsent(schemaName, new H2Schema(schemaName)) != null)
+ throw new IgniteCheckedException("Schema already registered: " + U.maskName(schemaName));
- cacheName2schema.put(cacheName, schemaName);
+ createSchema(schemaName);
+ }
- createSchema(schemaName);
+ cacheName2schema.put(cacheName, schemaName);
- createSqlFunctions(schemaName, ccfg.getSqlFunctionClasses());
+ createSqlFunctions(schemaName, cctx.config().getSqlFunctionClasses());
}
/** {@inheritDoc} */
@Override public void unregisterCache(String cacheName) {
- String schema = schema(cacheName);
- H2Schema rmv = schemas.remove(schema);
+ String schemaName = schema(cacheName);
- if (rmv != null) {
+ boolean dflt = isDefaultSchema(schemaName);
+
+ H2Schema schema = dflt ? schemas.get(schemaName) : schemas.remove(schemaName);
+
+ if (schema != null) {
cacheName2schema.remove(cacheName);
mapQryExec.onCacheStop(cacheName);
dmlProc.onCacheStop(cacheName);
- rmv.onDrop();
+ // Drop tables.
+ Collection<H2TableDescriptor> rmvTbls = new HashSet<>();
- try {
- dropSchema(schema);
+ for (H2TableDescriptor tbl : schema.tables()) {
+ if (F.eq(tbl.cache().name(), cacheName)) {
+ try {
+ dropTable(tbl);
+ }
+ catch (IgniteCheckedException e) {
+ U.error(log, "Failed to drop table on cache stop (will ignore): " + tbl.fullTableName(), e);
+ }
+
+ schema.drop(tbl);
+
+ rmvTbls.add(tbl);
+ }
}
- catch (IgniteCheckedException e) {
- U.error(log, "Failed to drop schema on cache stop (will ignore): " + cacheName, e);
+
+ if (!dflt) {
+ try {
+ dropSchema(schemaName);
+ }
+ catch (IgniteCheckedException e) {
+ U.error(log, "Failed to drop schema on cache stop (will ignore): " + cacheName, e);
+ }
}
- for (H2TableDescriptor tblDesc : rmv.tables())
- for (Index idx : tblDesc.table().getIndexes())
+ for (H2TableDescriptor tbl : rmvTbls) {
+ for (Index idx : tbl.table().getIndexes())
idx.close(null);
+ }
int cacheId = CU.cacheId(cacheName);
http://git-wip-us.apache.org/repos/asf/ignite/blob/738451c1/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java
index 778ebfb..ce73010 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java
@@ -58,11 +58,6 @@ public interface GridH2RowDescriptor extends GridOffHeapSmartPointerFactory<Grid
public GridCacheContext<?, ?> context();
/**
- * @return Cache configuration.
- */
- public CacheConfiguration configuration();
-
- /**
* Creates new row.
*
* @param key Key.
http://git-wip-us.apache.org/repos/asf/ignite/blob/738451c1/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 a85cd93..d656cc3 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
@@ -64,8 +64,8 @@ import static org.apache.ignite.internal.processors.query.h2.opt.GridH2QueryType
* H2 Table implementation.
*/
public class GridH2Table extends TableBase {
- /** */
- private final String cacheName;
+ /** Cache context. */
+ private final GridCacheContext cctx;
/** */
private final GridH2RowDescriptor desc;
@@ -119,16 +119,16 @@ public class GridH2Table extends TableBase {
* @param desc Row descriptor.
* @param rowFactory Row factory.
* @param idxsFactory Indexes factory.
- * @param cacheName Cache name.
+ * @param cctx Cache context.
*/
public GridH2Table(CreateTableData createTblData, @Nullable GridH2RowDescriptor desc, H2RowFactory rowFactory,
- GridH2SystemIndexFactory idxsFactory, String cacheName) {
+ GridH2SystemIndexFactory idxsFactory, GridCacheContext cctx) {
super(createTblData);
assert idxsFactory != null;
this.desc = desc;
- this.cacheName = cacheName;
+ this.cctx = cctx;
if (desc != null && desc.context() != null && !desc.context().customAffinityMapper()) {
boolean affinityColExists = true;
@@ -184,7 +184,7 @@ public class GridH2Table extends TableBase {
pkIndexPos = hasHashIndex ? 2 : 1;
- final int segments = desc != null ? desc.configuration().getQueryParallelism() :
+ final int segments = desc != null ? desc.context().config().getQueryParallelism() :
// Get index segments count from PK index. Null desc can be passed from tests.
index(pkIndexPos).segmentsCount();
@@ -197,7 +197,7 @@ public class GridH2Table extends TableBase {
* @return {@code true} If this is a partitioned table.
*/
public boolean isPartitioned() {
- return desc != null && desc.configuration().getCacheMode() == PARTITIONED;
+ return desc != null && desc.context().config().getCacheMode() == PARTITIONED;
}
/**
@@ -222,8 +222,15 @@ public class GridH2Table extends TableBase {
/**
* @return Cache name.
*/
- @Nullable public String cacheName() {
- return cacheName;
+ public String cacheName() {
+ return cctx.name();
+ }
+
+ /**
+ * @return Cache context.
+ */
+ public GridCacheContext cache() {
+ return cctx;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/738451c1/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSchemaIndexingTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSchemaIndexingTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSchemaIndexingTest.java
index 3d994c2..3cecbc8 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSchemaIndexingTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSchemaIndexingTest.java
@@ -105,7 +105,7 @@ public class IgniteSqlSchemaIndexingTest extends GridCommonAbstractTest {
return null;
}
- }, IgniteException.class, "Cache already registered: ");
+ }, IgniteException.class, "Schema already registered: ");
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/738451c1/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
index 7b0cbf8..99246eb 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
@@ -367,11 +367,6 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
// Remove
cacheA.remove(2);
cacheB.remove(1);
-
- // Unregister.
- spi.unregisterType(spi.schema(typeAA.cacheName()), typeAA.name());
- spi.unregisterType(spi.schema(typeAB.cacheName()), typeAB.name());
- spi.unregisterType(spi.schema(typeBA.cacheName()), typeBA.name());
}
/**
@@ -384,7 +379,7 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
ignite0.createCache(cacheACfg());
- long longQryExecTime = CacheConfiguration.DFLT_LONG_QRY_WARN_TIMEOUT;
+ long longQryExecTime = IgniteConfiguration.DFLT_LONG_QRY_WARN_TIMEOUT;
GridStringLogger log = new GridStringLogger(false, this.log);
[03/13] ignite git commit: .NET: Fix PeerAssemblyLoadingAllApisTest
Posted by sb...@apache.org.
.NET: Fix PeerAssemblyLoadingAllApisTest
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0feadac5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0feadac5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0feadac5
Branch: refs/heads/ignite-5075
Commit: 0feadac5fa19b3eb7270cf735268f290fc4994c6
Parents: 6f8577f
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed May 31 10:34:36 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Wed May 31 10:34:36 2017 +0300
----------------------------------------------------------------------
.../Deployment/PeerAssemblyLoadingAllApisTest.cs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0feadac5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Deployment/PeerAssemblyLoadingAllApisTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Deployment/PeerAssemblyLoadingAllApisTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Deployment/PeerAssemblyLoadingAllApisTest.cs
index 29abda9..7338b7f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Deployment/PeerAssemblyLoadingAllApisTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Deployment/PeerAssemblyLoadingAllApisTest.cs
@@ -21,7 +21,7 @@ namespace Apache.Ignite.Core.Tests.Deployment
using System.Linq;
using Apache.Ignite.Core.Tests.Compute;
using Apache.Ignite.Core.Tests.Process;
- using Apache.Ignite.Log4Net;
+ using Apache.Ignite.NLog;
using NUnit.Framework;
using Address = ExamplesDll::Apache.Ignite.ExamplesDll.Binary.Address;
@@ -127,13 +127,13 @@ namespace Apache.Ignite.Core.Tests.Deployment
PeerAssemblyLoadingTest.TestDeployment(remoteCompute =>
{
// Argument requires additional assembly.
- var taskArg = new IgniteLog4NetLogger();
+ var taskArg = new IgniteNLogLogger();
var results = async
? remoteCompute.BroadcastAsync(new ProcessNameArgFunc(), taskArg).Result
: remoteCompute.Broadcast(new ProcessNameArgFunc(), taskArg);
- Assert.AreEqual("Apache.IgniteApache.Ignite.Log4Net.IgniteLog4NetLogger", results.Single());
+ Assert.AreEqual("Apache.IgniteApache.Ignite.NLog.IgniteNLogLogger", results.Single());
});
}
[10/13] ignite git commit: Merge remote-tracking branch
'remotes/origin/master' into ignite-5075
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-5075
# Conflicts:
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
# modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
# modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoClassQuerySelfTest.java
# modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/56af0611
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/56af0611
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/56af0611
Branch: refs/heads/ignite-5075
Commit: 56af06118f53af39e72638dfecba771055f19abe
Parents: ae93227 b0e49ad
Author: sboikov <sb...@gridgain.com>
Authored: Wed May 31 15:32:34 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed May 31 15:32:34 2017 +0300
----------------------------------------------------------------------
doap_Ignite.rdf | 2 +
examples/config/filesystem/example-igfs.xml | 4 +
.../datagrid/CacheClientBinaryQueryExample.java | 4 +-
.../examples/datagrid/CacheQueryExample.java | 2 +-
modules/clients/src/test/config/jdbc-config.xml | 6 -
.../jdbc2/JdbcAbstractDmlStatementSelfTest.java | 50 +-
.../JdbcAbstractUpdateStatementSelfTest.java | 11 +-
.../ignite/internal/jdbc2/JdbcBlobTest.java | 485 ++++
.../jdbc2/JdbcInsertStatementSelfTest.java | 16 +-
.../jdbc2/JdbcMergeStatementSelfTest.java | 16 +-
.../internal/jdbc2/JdbcMetadataSelfTest.java | 5 +-
.../internal/jdbc2/JdbcNoDefaultCacheTest.java | 2 -
.../jdbc2/JdbcPreparedStatementSelfTest.java | 47 +
.../internal/jdbc2/JdbcResultSetSelfTest.java | 24 +-
.../ignite/jdbc/JdbcMetadataSelfTest.java | 4 +-
.../ignite/jdbc/JdbcResultSetSelfTest.java | 121 +-
.../jdbc/suite/IgniteJdbcDriverTestSuite.java | 10 +-
.../jdbc/thin/JdbcConnectionSelfTest.java | 195 ++
.../src/main/java/org/apache/ignite/Ignite.java | 18 +-
.../java/org/apache/ignite/IgniteBinary.java | 23 +-
.../java/org/apache/ignite/IgniteCache.java | 13 +
.../org/apache/ignite/IgniteJdbcThinDriver.java | 312 +++
.../apache/ignite/IgniteSystemProperties.java | 2 +-
.../ignite/binary/BinaryBasicNameMapper.java | 2 +-
.../org/apache/ignite/binary/BinaryObject.java | 8 +
.../org/apache/ignite/binary/BinaryType.java | 5 +
.../ignite/binary/BinaryTypeConfiguration.java | 26 +
.../cache/affinity/AffinityKeyMapper.java | 3 +
.../ignite/cache/query/FieldsQueryCursor.java | 39 +
.../configuration/AtomicConfiguration.java | 25 +
.../configuration/CacheConfiguration.java | 16 +-
.../configuration/MemoryConfiguration.java | 3 +-
.../MemoryPolicyConfiguration.java | 100 +-
.../ignite/internal/GridKernalContext.java | 9 +-
.../ignite/internal/GridKernalContextImpl.java | 13 +-
.../org/apache/ignite/internal/IgniteEx.java | 27 +
.../apache/ignite/internal/IgniteKernal.java | 44 +-
.../org/apache/ignite/internal/IgnitionEx.java | 1 +
.../binary/BinaryCachingMetadataHandler.java | 5 +
.../internal/binary/BinaryClassDescriptor.java | 5 +-
.../ignite/internal/binary/BinaryContext.java | 118 +-
.../internal/binary/BinaryEnumObjectImpl.java | 41 +-
.../internal/binary/BinaryFieldAccessor.java | 10 +
.../ignite/internal/binary/BinaryMetadata.java | 93 +-
.../internal/binary/BinaryMetadataHandler.java | 9 +
.../binary/BinaryNoopMetadataHandler.java | 5 +
.../internal/binary/BinaryObjectExImpl.java | 5 +
.../internal/binary/BinaryObjectImpl.java | 24 +-
.../binary/BinaryObjectOffheapImpl.java | 9 +-
.../internal/binary/BinaryReaderExImpl.java | 18 +
.../ignite/internal/binary/BinaryTypeImpl.java | 15 +
.../ignite/internal/binary/BinaryTypeProxy.java | 6 +
.../ignite/internal/binary/BinaryUtils.java | 104 +-
.../internal/binary/BinaryWriterExImpl.java | 34 +-
.../internal/binary/GridBinaryMarshaller.java | 3 +
.../binary/builder/BinaryBuilderSerializer.java | 10 +-
.../binary/builder/BinaryObjectBuilderImpl.java | 2 +-
.../GridClientOptimizedMarshaller.java | 2 +-
.../GridClientZipOptimizedMarshaller.java | 2 +-
.../internal/jdbc/thin/JdbcConnection.java | 529 ++++
.../ignite/internal/jdbc/thin/JdbcTcpIo.java | 207 ++
.../apache/ignite/internal/jdbc2/JdbcBlob.java | 191 ++
.../ignite/internal/jdbc2/JdbcConnection.java | 5 +-
.../internal/jdbc2/JdbcPreparedStatement.java | 4 +-
.../ignite/internal/jdbc2/JdbcResultSet.java | 8 +-
.../managers/communication/GridIoManager.java | 380 ++-
.../communication/IgniteIoTestMessage.java | 362 ++-
.../managers/indexing/GridIndexingManager.java | 19 +-
.../optimized/OptimizedClassDescriptor.java | 2 +-
.../optimized/OptimizedMarshaller.java | 2 +-
.../marshaller/optimized/package-info.java | 22 +
.../mem/unsafe/UnsafeMemoryProvider.java | 18 +-
.../pagemem/impl/PageMemoryNoStoreImpl.java | 22 +-
.../internal/processors/cache/CacheObject.java | 8 +-
.../processors/cache/CacheObjectAdapter.java | 4 +-
.../cache/CacheObjectByteArrayImpl.java | 8 +-
.../processors/cache/CacheObjectContext.java | 197 +-
.../processors/cache/CacheObjectImpl.java | 31 +-
.../processors/cache/CacheObjectUtils.java | 173 ++
.../cache/CacheObjectValueContext.java | 50 +
.../processors/cache/ClusterCachesInfo.java | 19 +-
.../processors/cache/ExchangeActions.java | 2 +-
.../processors/cache/GridCacheContext.java | 12 +-
.../processors/cache/GridCacheEventManager.java | 2 +-
.../processors/cache/GridCacheIoManager.java | 6 +-
.../processors/cache/GridCacheMapEntry.java | 13 +-
.../GridCachePartitionExchangeManager.java | 2 +-
.../processors/cache/GridCacheProcessor.java | 67 +-
.../processors/cache/IgniteCacheProxy.java | 24 +-
.../processors/cache/KeyCacheObjectImpl.java | 10 +-
.../processors/cache/QueryCursorImpl.java | 19 +-
.../cache/binary/CacheObjectBinaryContext.java | 6 +-
.../binary/CacheObjectBinaryProcessor.java | 21 +-
.../binary/CacheObjectBinaryProcessorImpl.java | 100 +-
.../cache/binary/IgniteBinaryImpl.java | 26 +
.../cache/database/CacheDataRowAdapter.java | 8 +-
.../IgniteCacheDatabaseSharedManager.java | 91 +-
.../cache/database/MemoryMetricsImpl.java | 31 +-
.../cache/database/tree/BPlusTree.java | 64 +-
.../dht/GridClientPartitionTopology.java | 31 +-
.../dht/GridDhtPartitionTopology.java | 9 +-
.../dht/GridDhtPartitionTopologyImpl.java | 59 +-
.../GridDhtPartitionsExchangeFuture.java | 50 +-
.../cache/distributed/near/GridNearTxLocal.java | 3 +-
.../cache/query/GridCacheQueryManager.java | 32 +-
.../cache/query/GridCacheQueryRequest.java | 14 +-
.../CacheContinuousQueryAcknowledgeBuffer.java | 120 +
.../CacheContinuousQueryDeployableObject.java | 110 +
.../continuous/CacheContinuousQueryEntry.java | 117 +-
.../CacheContinuousQueryEventBuffer.java | 483 ++++
.../continuous/CacheContinuousQueryHandler.java | 733 +-----
.../CacheContinuousQueryHandlerV2.java | 6 +-
.../continuous/CacheContinuousQueryManager.java | 16 +-
.../CacheContinuousQueryPartitionRecovery.java | 267 +++
.../cache/transactions/TxDeadlock.java | 7 +-
.../cacheobject/IgniteCacheObjectProcessor.java | 6 +-
.../IgniteCacheObjectProcessorImpl.java | 39 +-
.../processors/cacheobject/NoOpBinary.java | 12 +
.../continuous/GridContinuousBatchAdapter.java | 2 +-
.../continuous/GridContinuousProcessor.java | 19 +-
.../continuous/GridContinuousQueryBatch.java | 16 +-
.../processors/odbc/OdbcNioListener.java | 242 --
.../internal/processors/odbc/OdbcProcessor.java | 199 --
.../odbc/SqlListenerAbstractMessageParser.java | 265 +++
.../odbc/SqlListenerAbstractObjectReader.java | 137 ++
.../odbc/SqlListenerAbstractObjectWriter.java | 111 +
.../processors/odbc/SqlListenerNioListener.java | 263 ++
.../processors/odbc/SqlListenerProcessor.java | 191 ++
.../odbc/SqlListenerRequestHandlerImpl.java | 494 ++++
.../processors/odbc/jdbc/JdbcMessageParser.java | 50 +
.../processors/odbc/jdbc/JdbcObjectReader.java | 33 +
.../processors/odbc/jdbc/JdbcObjectWriter.java | 33 +
.../processors/odbc/odbc/OdbcMessageParser.java | 249 +-
.../processors/odbc/odbc/OdbcObjectReader.java | 33 +
.../processors/odbc/odbc/OdbcObjectWriter.java | 32 +
.../odbc/odbc/OdbcRequestHandler.java | 513 ----
.../platform/PlatformContextImpl.java | 29 +-
.../binary/PlatformBinaryProcessor.java | 25 +
.../query/CacheQueryObjectValueContext.java | 64 +
.../query/GridQueryCacheObjectsIterator.java | 16 +-
.../processors/query/GridQueryIndexing.java | 107 +-
.../processors/query/GridQueryProcessor.java | 408 ++--
.../query/GridQueryTypeDescriptor.java | 15 +
.../processors/query/GridRunningQueryInfo.java | 16 +-
.../processors/query/QueryIndexKey.java | 28 +-
.../internal/processors/query/QuerySchema.java | 2 +-
.../query/QueryTypeDescriptorImpl.java | 25 +-
.../processors/query/QueryTypeIdKey.java | 26 +-
.../processors/query/QueryTypeNameKey.java | 12 +-
.../internal/processors/query/QueryUtils.java | 294 ++-
.../query/property/QueryBinaryProperty.java | 2 +-
.../schema/SchemaIndexCacheVisitorImpl.java | 12 +-
.../processors/query/schema/SchemaKey.java | 59 -
.../message/SchemaProposeDiscoveryMessage.java | 7 +-
.../operation/SchemaAbstractOperation.java | 27 +-
.../operation/SchemaIndexAbstractOperation.java | 7 +-
.../operation/SchemaIndexCreateOperation.java | 8 +-
.../operation/SchemaIndexDropOperation.java | 7 +-
.../handlers/GridRestCommandHandlerAdapter.java | 3 +
.../handlers/cache/GridCacheCommandHandler.java | 10 +-
.../handlers/query/QueryCommandHandler.java | 13 +-
.../ignite/internal/util/IgniteUtils.java | 17 +
.../query/VisorRunningQueriesCollectorTask.java | 2 +-
.../apache/ignite/marshaller/Marshaller.java | 3 -
.../ignite/marshaller/jdk/JdkMarshaller.java | 5 +-
.../communication/tcp/TcpCommunicationSpi.java | 4 +-
.../ignite/spi/discovery/DiscoverySpi.java | 9 +-
.../spi/discovery/tcp/TcpDiscoverySpi.java | 8 +-
.../spi/indexing/IndexingQueryFilter.java | 8 +-
.../apache/ignite/spi/indexing/IndexingSpi.java | 17 +-
.../spi/indexing/noop/NoopIndexingSpi.java | 6 +-
modules/core/src/test/config/example-cache.xml | 5 +-
.../src/test/config/spring-start-nodes-attr.xml | 4 +-
.../core/src/test/config/spring-start-nodes.xml | 4 +-
.../config/websession/example-cache-base.xml | 5 +-
.../IgniteExternalizableAbstractTest.java | 15 +-
...dbcPojoStoreOptimizedMarshallerSelfTest.java | 31 -
...ptimizedMarshallerWithSqlEscapeSelfTest.java | 28 -
.../apache/ignite/igfs/IgfsPathSelfTest.java | 7 +-
.../internal/GridAffinityNoCacheSelfTest.java | 10 +-
.../internal/GridLifecycleAwareSelfTest.java | 3 +-
.../internal/binary/BinaryEnumsSelfTest.java | 146 +-
.../BinarySimpleNameTestPropertySelfTest.java | 17 +
.../binary/TestCachingMetadataHandler.java | 5 +
.../managers/GridManagerStopSelfTest.java | 3 +-
.../GridDiscoveryManagerAttributesSelfTest.java | 2 +-
.../optimized/OptimizedMarshallerTest.java | 8 +
.../marshaller/optimized/package-info.java | 22 +
.../pagemem/impl/PageMemoryNoLoadSelfTest.java | 31 +-
.../AtomicCacheAffinityConfigurationTest.java | 175 ++
.../CacheStartupInDeploymentModesTest.java | 37 -
.../cache/GridCacheEntryMemorySizeSelfTest.java | 2 +-
...ridCacheStoreManagerDeserializationTest.java | 4 +-
.../cache/GridCacheVersionSelfTest.java | 7 +-
.../IgniteIncompleteCacheObjectSelfTest.java | 10 +-
...iteMarshallerCacheClassNameConflictTest.java | 9 +-
.../IgniteTxExceptionAbstractSelfTest.java | 6 +-
.../cache/MemoryPolicyConfigValidationTest.java | 62 +-
.../BinaryAtomicCacheLocalEntriesSelfTest.java | 30 +
.../BinaryTxCacheLocalEntriesSelfTest.java | 84 +
.../distributed/CacheAffinityEarlyTest.java | 7 +-
.../CacheGetFutureHangsSelfTest.java | 6 +-
.../IgniteCacheCreatePutMultiNodeSelfTest.java | 7 +-
.../distributed/IgniteCacheCreatePutTest.java | 7 +-
.../IgniteCachePartitionLossPolicySelfTest.java | 1 +
.../paged/PageEvictionMultinodeTest.java | 22 +-
.../BinaryAtomicCacheLocalEntriesSelfTest.java | 30 -
.../BinaryTxCacheLocalEntriesSelfTest.java | 84 -
.../cache/query/IndexingSpiQuerySelfTest.java | 14 +-
.../cache/query/IndexingSpiQueryTxSelfTest.java | 6 +-
...tinuousQueryAsyncFailoverAtomicSelfTest.java | 1 -
...nuousQueryConcurrentPartitionUpdateTest.java | 304 +++
.../CacheContinuousQueryEventBufferTest.java | 217 ++
...ContinuousQueryFailoverAbstractSelfTest.java | 79 +-
.../CacheEntryProcessorNonSerializableTest.java | 5 +-
...niteCacheContinuousQueryBackupQueueTest.java | 13 +-
...eCacheContinuousQueryImmutableEntryTest.java | 6 +-
.../database/FreeListImplSelfTest.java | 10 +-
.../igfs/IgfsAbstractBaseSelfTest.java | 10 -
.../processors/igfs/IgfsFileInfoSelfTest.java | 16 +-
.../processors/igfs/IgfsIgniteMock.java | 24 +
.../IgfsPrimaryOptimziedMarshallerSelfTest.java | 28 -
.../odbc/OdbcProcessorValidationSelfTest.java | 182 --
.../SqlListenerProcessorValidationSelfTest.java | 184 ++
.../service/ClosureServiceClientsNodesTest.java | 4 +-
...namicProxySerializationMultiJvmSelfTest.java | 13 -
.../GridMarshallerPerformanceTest.java | 8 +-
.../IgniteMessagingWithClientTest.java | 4 +-
.../platform/PlatformComputeEchoTask.java | 13 +
...pClientDiscoveryMarshallerCheckSelfTest.java | 4 +-
.../TcpDiscoveryMarshallerCheckSelfTest.java | 4 +-
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 4 +-
.../ignite/testframework/GridTestUtils.java | 8 +-
.../config/GridTestProperties.java | 4 +-
.../configvariations/ConfigVariations.java | 14 +-
.../testframework/junits/GridAbstractTest.java | 33 +
.../ignite/testframework/junits/IgniteMock.java | 5 +
.../junits/IgniteTestResources.java | 8 +-
.../multijvm/IgniteCacheProcessProxy.java | 8 +
.../junits/multijvm/IgniteProcessProxy.java | 18 +
...naryObjectsTxDeadlockDetectionTestSuite.java | 37 -
.../ignite/testsuites/IgniteBasicTestSuite.java | 17 +-
.../testsuites/IgniteBinaryBasicTestSuite.java | 75 +-
.../IgniteBinaryCacheFullApiTestSuite.java | 37 -
.../testsuites/IgniteBinaryCacheTestSuite.java | 4 -
...ObjectsCacheDataStructuresSelfTestSuite.java | 42 -
...BinaryObjectsCacheExpiryPolicyTestSuite.java | 38 -
...gniteBinaryObjectsCacheRestartTestSuite.java | 37 -
.../IgniteBinaryObjectsCacheTestSuite2.java | 37 -
.../IgniteBinaryObjectsCacheTestSuite3.java | 2 -
.../IgniteBinaryObjectsCacheTestSuite4.java | 37 -
...IgniteBinaryObjectsComputeGridTestSuite.java | 4 -
.../IgniteBinaryObjectsTestSuite.java | 4 +-
...iteBinarySimpleNameMapperBasicTestSuite.java | 3 +-
.../IgniteCacheDataStructuresSelfTestSuite.java | 3 +
.../ignite/testsuites/IgniteCacheTestSuite.java | 4 -
...teBasicConfigVariationsFullApiTestSuite.java | 2 +-
.../ignite/testsuites/IgniteIgfsTestSuite.java | 3 -
.../testsuites/IgniteKernalSelfTestSuite.java | 4 -
.../IgniteMarshallerSelfTestSuite.java | 8 +-
...essagingConfigVariationFullApiTestSuite.java | 2 +-
...ServiceConfigVariationsFullApiTestSuite.java | 2 +-
.../webapp/META-INF/ignite-webapp-config.xml | 15 +-
.../query/h2/H2IndexingAbstractGeoSelfTest.java | 26 +-
.../query/h2/H2IndexingBinaryGeoSelfTest.java | 30 -
.../H2IndexingBinarySegmentedGeoSelfTest.java | 30 -
.../query/h2/H2IndexingGeoSelfTest.java | 2 +-
.../h2/H2IndexingSegmentedGeoSelfTest.java | 2 +-
.../testsuites/GeoSpatialIndexingTestSuite.java | 5 -
.../test/config/hadoop-fs-open-test/grid-0.xml | 3 +-
.../test/config/hadoop-fs-open-test/grid-1.xml | 3 +-
.../test/config/hadoop-fs-open-test/grid-2.xml | 3 +-
.../test/config/igfs-cli-config-dual-async.xml | 3 +-
.../test/config/igfs-cli-config-dual-sync.xml | 3 +-
.../src/test/config/igfs-cli-config-primary.xml | 3 +-
.../src/test/config/igfs-cli-config-proxy.xml | 3 +-
.../IgniteHadoopFileSystemAbstractSelfTest.java | 4 +-
.../collections/HadoopSkipListSelfTest.java | 37 -
.../query/h2/DmlStatementsProcessor.java | 89 +-
.../query/h2/GridH2ResultSetIterator.java | 191 --
.../query/h2/H2ConnectionWrapper.java | 67 +
.../processors/query/h2/H2DatabaseType.java | 161 ++
.../processors/query/h2/H2DmlPlanKey.java | 66 +
.../processors/query/h2/H2FieldsIterator.java | 50 +
.../processors/query/h2/H2KeyValueIterator.java | 48 +
.../query/h2/H2ResultSetIterator.java | 189 ++
.../processors/query/h2/H2RowDescriptor.java | 478 ++++
.../internal/processors/query/h2/H2Schema.java | 151 ++
.../processors/query/h2/H2SqlFieldMetadata.java | 111 +
.../processors/query/h2/H2StatementCache.java | 73 +
.../processors/query/h2/H2TableDescriptor.java | 355 +++
.../processors/query/h2/H2TableEngine.java | 89 +
.../query/h2/H2TwoStepCachedQuery.java | 63 +
.../query/h2/H2TwoStepCachedQueryKey.java | 100 +
.../internal/processors/query/h2/H2Utils.java | 244 ++
.../processors/query/h2/IgniteH2Indexing.java | 2249 +++---------------
.../query/h2/database/H2PkHashIndex.java | 4 +-
.../query/h2/database/H2TreeIndex.java | 4 +-
.../query/h2/ddl/DdlStatementsProcessor.java | 112 +-
.../query/h2/opt/GridH2CollocationModel.java | 6 +-
.../query/h2/opt/GridH2IndexBase.java | 12 +-
.../processors/query/h2/opt/GridH2Table.java | 155 +-
.../query/h2/opt/GridH2TreeIndex.java | 2 +-
.../query/h2/opt/GridH2ValueCacheObject.java | 32 +-
.../query/h2/opt/GridLuceneIndex.java | 17 +-
.../query/h2/sql/GridSqlCreateTable.java | 153 ++
.../query/h2/sql/GridSqlDropIndex.java | 14 +-
.../query/h2/sql/GridSqlDropTable.java | 79 +
.../query/h2/sql/GridSqlQueryParser.java | 262 +-
.../query/h2/sql/GridSqlQuerySplitter.java | 4 +-
.../query/h2/twostep/GridMapQueryExecutor.java | 28 +-
.../h2/twostep/GridReduceQueryExecutor.java | 182 +-
.../query/h2/twostep/ReduceQueryRun.java | 157 ++
.../query/h2/twostep/msg/GridH2CacheObject.java | 39 +-
.../cache/GridCacheCrossCacheQuerySelfTest.java | 12 +-
.../IgniteCacheInsertSqlQuerySelfTest.java | 27 +-
.../cache/IgniteCacheNoClassQuerySelfTest.java | 4 +-
.../cache/SqlFieldsQuerySelfTest.java | 12 +-
.../cache/index/AbstractSchemaSelfTest.java | 123 +-
.../DynamicIndexAbstractBasicSelfTest.java | 93 +-
.../DynamicIndexAbstractConcurrentSelfTest.java | 102 +-
.../index/DynamicIndexAbstractSelfTest.java | 30 +-
.../index/H2DynamicIndexAbstractSelfTest.java | 48 +-
.../cache/index/H2DynamicTableSelfTest.java | 320 +++
.../cache/index/SchemaExchangeSelfTest.java | 13 +-
.../query/IgniteQueryDedicatedPoolTest.java | 6 +-
.../query/IgniteSqlSchemaIndexingTest.java | 18 +-
.../query/IgniteSqlSegmentedIndexSelfTest.java | 25 +
.../query/IgniteSqlSplitterSelfTest.java | 59 +-
.../h2/GridIndexingSpiAbstractSelfTest.java | 159 +-
.../h2/sql/AbstractH2CompareQueryTest.java | 4 +-
.../query/h2/sql/BaseH2CompareQueryTest.java | 12 +-
.../query/h2/sql/GridQueryParsingTest.java | 292 ++-
.../query/h2/sql/H2CompareBigQueryTest.java | 2 +-
.../FetchingQueryCursorStressTest.java | 4 +-
.../IgniteBinaryCacheQueryTestSuite.java | 4 -
.../IgniteBinaryCacheQueryTestSuite2.java | 4 -
.../IgniteBinaryCacheQueryTestSuite3.java | 39 -
.../IgniteBinaryCacheQueryTestSuite4.java | 39 -
.../IgniteCacheQuerySelfTestSuite.java | 2 +
.../IgniteCacheQuerySelfTestSuite3.java | 5 +
.../processors/query/h2/sql/bigQuery.sql | 8 +-
modules/platforms/cpp/binary/Makefile.am | 67 +-
.../platforms/cpp/binary/include/Makefile.am | 55 +-
.../binary/include/ignite/binary/binary_type.h | 2 +-
.../ignite/impl/binary/binary_type_impl.h | 61 +
.../ignite/impl/binary/binary_writer_impl.h | 4 +-
.../cpp/binary/project/vs/binary.vcxproj | 2 +
.../binary/project/vs/binary.vcxproj.filters | 6 +
.../binary/src/impl/binary/binary_type_impl.cpp | 61 +
modules/platforms/cpp/common/Makefile.am | 54 +-
.../platforms/cpp/common/include/Makefile.am | 1 +
.../common/include/ignite/common/cancelable.h | 65 +
.../cpp/common/include/ignite/common/promise.h | 18 +
.../common/include/ignite/common/shared_state.h | 51 +
.../cpp/common/include/ignite/future.h | 60 +-
.../cpp/common/include/ignite/ignite_error.h | 3 +
.../cpp/common/project/vs/common.vcxproj | 1 +
.../common/project/vs/common.vcxproj.filters | 3 +
modules/platforms/cpp/core-test/Makefile.am | 101 +-
.../cpp/core-test/include/ignite/test_utils.h | 24 +-
.../cpp/core-test/project/vs/core-test.vcxproj | 1 +
.../project/vs/core-test.vcxproj.filters | 10 +-
.../cpp/core-test/src/cache_invoke_test.cpp | 2 +-
.../cpp/core-test/src/cluster_test.cpp | 2 +-
.../cpp/core-test/src/compute_test.cpp | 337 +++
.../cpp/core-test/src/continuous_query_test.cpp | 2 +-
.../platforms/cpp/core-test/src/test_utils.cpp | 9 +
modules/platforms/cpp/core/Makefile.am | 82 +-
modules/platforms/cpp/core/include/Makefile.am | 107 +-
.../cpp/core/include/ignite/cache/cache.h | 4 +-
.../cpp/core/include/ignite/cache/query/query.h | 1 -
.../cpp/core/include/ignite/compute/compute.h | 136 ++
.../core/include/ignite/compute/compute_func.h | 65 +
.../platforms/cpp/core/include/ignite/ignite.h | 19 +-
.../cpp/core/include/ignite/ignite_binding.h | 25 +
.../include/ignite/ignite_binding_context.h | 2 +-
.../cpp/core/include/ignite/impl/bindings.h | 24 +
.../ignite/impl/cluster/cluster_group_impl.h | 31 +-
.../ignite/impl/compute/cancelable_impl.h | 70 +
.../include/ignite/impl/compute/compute_impl.h | 118 +
.../ignite/impl/compute/compute_job_holder.h | 139 ++
.../ignite/impl/compute/compute_job_result.h | 161 ++
.../ignite/impl/compute/compute_task_holder.h | 213 ++
.../include/ignite/impl/ignite_binding_impl.h | 2 +
.../include/ignite/impl/ignite_environment.h | 69 +
.../cpp/core/include/ignite/impl/ignite_impl.h | 23 +-
.../ignite/impl/interop/interop_target.h | 11 +-
.../platforms/cpp/core/project/vs/core.vcxproj | 9 +
.../cpp/core/project/vs/core.vcxproj.filters | 33 +
modules/platforms/cpp/core/src/ignite.cpp | 5 +
.../src/impl/cluster/cluster_group_impl.cpp | 23 +-
.../core/src/impl/compute/cancelable_impl.cpp | 59 +
.../cpp/core/src/impl/compute/compute_impl.cpp | 35 +
.../cpp/core/src/impl/ignite_environment.cpp | 260 +-
.../platforms/cpp/core/src/impl/ignite_impl.cpp | 15 +-
.../core/src/impl/interop/interop_target.cpp | 20 +
.../src/impl/transactions/transactions_impl.cpp | 10 -
.../platforms/cpp/jni/include/ignite/jni/java.h | 1 +
modules/platforms/cpp/jni/src/java.cpp | 10 +
.../cpp/odbc/include/ignite/odbc/message.h | 10 +
.../Apache.Ignite.Core.Tests.csproj | 10 +
.../Binary/BinaryBuilderSelfTest.cs | 88 +-
.../Binary/TypeNameParserTest.cs | 8 +-
.../Cache/CacheConfigurationTest.cs | 6 +-
.../Cache/Query/CacheLinqTest.cs | 199 +-
.../Cache/Query/CacheLinqTestSqlEscapeAll.cs | 34 +
.../Compute/BinarizableClosureTaskTest.cs | 7 +-
.../Compute/ClosureTaskTest.cs | 6 +-
.../Compute/ComputeApiTest.cs | 45 +-
.../Compute/IgniteExceptionTaskSelfTest.cs | 8 +-
.../Compute/SerializableClosureTaskTest.cs | 5 +-
.../Deployment/GetAddressFunc.cs | 35 +
.../PeerAssemblyLoadingAllApisTest.cs | 167 ++
.../Deployment/PeerAssemblyLoadingTest.cs | 192 ++
.../PeerAssemblyLoadingVersioningTest.cs | 164 ++
.../Deployment/ProcessNameFunc.cs | 50 +
.../Deployment/ProcessNameTask.cs | 74 +
.../Deployment/peer_assembly_app.config | 35 +
.../IgniteConfigurationSerializerTest.cs | 10 +-
.../Log/CustomLoggerTest.cs | 5 +-
.../Apache.Ignite.Core.Tests/MarshallerTest.cs | 2 +-
.../Process/IgniteProcess.cs | 12 +-
.../Apache.Ignite.Core.csproj | 10 +
.../Binary/BinaryTypeConfiguration.cs | 3 +-
.../dotnet/Apache.Ignite.Core/Binary/IBinary.cs | 24 +
.../Apache.Ignite.Core/Binary/IBinaryObject.cs | 8 +
.../Apache.Ignite.Core/Binary/IBinaryType.cs | 6 +
.../Cache/Configuration/QueryEntity.cs | 64 +-
.../Deployment/PeerAssemblyLoadingMode.cs | 55 +
.../Apache.Ignite.Core/IgniteConfiguration.cs | 16 +
.../IgniteConfigurationSection.xsd | 12 +
.../dotnet/Apache.Ignite.Core/Ignition.cs | 18 +-
.../Impl/Binary/BinarizableSerializer.cs | 5 +-
.../Apache.Ignite.Core/Impl/Binary/Binary.cs | 68 +-
.../Impl/Binary/BinaryEnum.cs | 11 +-
.../Binary/BinaryEqualityComparerSerializer.cs | 1 -
.../Impl/Binary/BinaryObject.cs | 13 +-
.../Impl/Binary/BinaryProcessor.cs | 67 +-
.../Impl/Binary/BinaryReader.cs | 76 +-
.../Impl/Binary/BinaryReflectiveActions.cs | 7 +-
.../BinaryReflectiveSerializerInternal.cs | 5 +-
.../Impl/Binary/BinarySystemHandlers.cs | 25 +-
.../Impl/Binary/BinarySystemTypeSerializer.cs | 2 +-
.../Impl/Binary/BinaryUtils.cs | 19 +
.../Impl/Binary/BinaryWriter.cs | 28 +-
.../Impl/Binary/BinaryWriterExtensions.cs | 9 +-
.../Impl/Binary/IBinarySerializerInternal.cs | 10 +-
.../Impl/Binary/Marshaller.cs | 117 +-
.../Impl/Binary/Metadata/BinaryType.cs | 179 +-
.../Impl/Binary/Metadata/BinaryTypeHolder.cs | 44 +-
.../Impl/Binary/SerializableSerializer.cs | 14 +-
.../Impl/Binary/TypeResolver.cs | 6 +-
.../Impl/Binary/UserSerializerProxy.cs | 5 +-
.../Impl/Cache/IQueryEntityInternal.cs | 31 +
.../Common/CopyOnWriteConcurrentDictionary.cs | 8 -
.../Apache.Ignite.Core/Impl/Common/Future.cs | 13 +-
.../Impl/Common/LoadedAssembliesResolver.cs | 8 +-
.../Impl/Compute/Closure/ComputeActionJob.cs | 7 +-
.../Impl/Compute/Closure/ComputeFuncJob.cs | 5 +-
.../Impl/Compute/ComputeFunc.cs | 5 +-
.../Impl/Compute/ComputeImpl.cs | 1 -
.../Impl/Compute/ComputeJob.cs | 3 +-
.../Impl/Compute/ComputeOutFunc.cs | 3 +-
.../Impl/Deployment/AssemblyLoader.cs | 105 +
.../Impl/Deployment/AssemblyRequest.cs | 68 +
.../Impl/Deployment/AssemblyRequestResult.cs | 80 +
.../Impl/Deployment/GetAssemblyFunc.cs | 77 +
.../Impl/Deployment/PeerAssemblyResolver.cs | 189 ++
.../Impl/Deployment/PeerLoadingExtensions.cs | 65 +
.../Impl/Deployment/PeerLoadingObjectHolder.cs | 90 +
.../PeerLoadingObjectHolderSerializer.cs | 49 +
modules/platforms/dotnet/Apache.Ignite.FxCop | 3 +-
.../Apache.Ignite.Linq.csproj | 3 +
.../Apache.Ignite.Linq/CacheExtensions.cs | 65 +
.../Impl/CacheFieldsQueryExecutor.cs | 39 -
.../Impl/CacheFieldsQueryProvider.cs | 9 +
.../Impl/CacheQueryExpressionVisitor.cs | 76 +-
.../Impl/CacheQueryModelVisitor.cs | 73 +-
.../Apache.Ignite.Linq/Impl/CacheQueryParser.cs | 21 +-
.../Impl/CacheQueryableBase.cs | 14 +-
.../Impl/Dml/RemoveAllExpressionNode.cs | 88 +
.../Impl/Dml/RemoveAllResultOperator.cs | 61 +
.../Apache.Ignite.Linq/Impl/ExpressionWalker.cs | 7 +-
.../Impl/ICacheQueryableInternal.cs | 6 -
.../Apache.Ignite.Linq/Impl/MethodVisitor.cs | 7 +-
.../dotnet/Apache.Ignite.Linq/Impl/QueryData.cs | 17 +-
.../dotnet/Apache.Ignite.sln.DotSettings | 1 +
.../dotnet/Apache.Ignite/Apache.Ignite.csproj | 1 -
.../Apache.Ignite/Service/ServiceDescription.cs | 32 -
modules/spring/pom.xml | 7 +
.../org/apache/ignite/IgniteSpringBean.java | 7 +
.../apache/ignite/cache/spring/SpringCache.java | 60 +-
.../ignite/cache/spring/SpringCacheManager.java | 51 +-
.../GridSpringCacheManagerMultiJvmSelfTest.java | 134 ++
.../GridSpringDynamicCacheTestService.java | 13 +
.../ignite/cache/spring/SpringCacheTest.java | 2 +-
.../ignite/cache/spring/spring-caching1.xml | 56 +
.../ignite/cache/spring/spring-caching2.xml | 56 +
.../GridSpringBeanSerializationSelfTest.java | 15 +-
modules/web-console/frontend/.babelrc | 9 +-
modules/web-console/frontend/.gitignore | 1 -
modules/web-console/frontend/app/app.js | 18 +-
.../components/web-console-header/component.js | 6 +-
.../app/modules/agent/AgentManager.service.js | 2 -
.../frontend/gulpfile.babel.js/index.js | 26 -
.../frontend/gulpfile.babel.js/paths.js | 64 -
.../frontend/gulpfile.babel.js/tasks/build.js | 21 -
.../frontend/gulpfile.babel.js/tasks/bundle.js | 36 -
.../frontend/gulpfile.babel.js/tasks/clean.js | 32 -
.../frontend/gulpfile.babel.js/tasks/copy.js | 33 -
.../gulpfile.babel.js/tasks/ignite-modules.js | 55 -
.../frontend/gulpfile.babel.js/tasks/watch.js | 30 -
.../gulpfile.babel.js/webpack/common.js | 205 --
.../webpack/environments/development.js | 60 -
.../webpack/environments/production.js | 41 -
.../webpack/environments/test.js | 44 -
.../frontend/gulpfile.babel.js/webpack/index.js | 36 -
.../frontend/ignite_modules/index.js | 7 +-
modules/web-console/frontend/package.json | 104 +-
.../frontend/test/karma.conf.babel.js | 13 +-
modules/web-console/frontend/test/karma.conf.js | 2 +-
.../frontend/webpack/webpack.common.js | 188 ++
.../frontend/webpack/webpack.dev.babel.js | 100 +
.../frontend/webpack/webpack.prod.babel.js | 64 +
.../frontend/webpack/webpack.test.js | 33 +
.../webapp2/META-INF/ignite-webapp-config.xml | 15 +-
.../ignite-int-max-values-onheap-config.xml | 4 +-
modules/yardstick/config/ignite-jdbc-config.xml | 4 +-
.../yardstick/IgniteBenchmarkArguments.java | 4 +
.../org/apache/ignite/yardstick/IgniteNode.java | 5 +
.../apache/ignite/yardstick/io/FileUtils.java | 64 +
532 files changed, 20829 insertions(+), 8649 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/56af0611/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/56af0611/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/56af0611/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/56af0611/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/56af0611/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/56af0611/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEventManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/56af0611/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/56af0611/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/56af0611/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index 96ae0b9,2eec8f6..5c466f4
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@@ -1300,15 -1306,15 +1300,15 @@@ public class GridCachePartitionExchange
GridDhtPartitionTopology top = null;
- if (cacheCtx == null)
- top = clientTops.get(cacheId);
- else if (!cacheCtx.isLocal())
- top = cacheCtx.topology();
+ if (grp == null)
+ top = clientTops.get(grpId);
+ else if (!grp.isLocal())
+ top = grp.topology();
if (top != null) {
- updated |= top.update(null, entry.getValue(), null) != null;
+ updated |= top.update(null, entry.getValue()) != null;
- cctx.affinity().checkRebalanceState(top, cacheId);
+ cctx.affinity().checkRebalanceState(top, grpId);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/56af0611/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index a5f6f1e,9a25672..eb04711
--- 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
@@@ -1222,12 -1174,10 +1232,8 @@@ public class GridCacheProcessor extend
cacheCtx.onStarted();
- if (log.isInfoEnabled()) {
- log.info("Started cache [name=" + cfg.getName() +
- (cfg.getGroupName() != null ? ", group=" + cfg.getGroupName() : "") +
- ", memoryPolicyName=" + cfg.getMemoryPolicyName() +
- ", mode=" + cfg.getCacheMode() + ']');
- }
- if (log.isInfoEnabled())
- log.info("Started cache [name=" + U.maskName(cfg.getName()) +
- ", memoryPolicyName=" + cfg.getMemoryPolicyName() + ", mode=" + cfg.getCacheMode() +
- ", atomicity=" + cfg.getAtomicityMode() + ']');
++ if (log.isInfoEnabled()){
++ log.info("Started cache [name=" + cfg.getName() +(cfg.getGroupName() != null ? ", group=" + cfg.getGroupName() : "") + ", memoryPolicyName=" + cfg.getMemoryPolicyName() + ", mode=" + cfg.getCacheMode() +", atomicity=" + cfg.getAtomicityMode() + ']');}
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/56af0611/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/CacheDataRowAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/56af0611/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/BPlusTree.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/56af0611/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/56af0611/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/56af0611/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/56af0611/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index 6725773,72c5bbc..bc6f8c7
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@@ -55,11 -55,10 +55,11 @@@ import org.apache.ignite.internal.pagem
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.affinity.GridAffinityAssignmentCache;
import org.apache.ignite.internal.processors.cache.CacheAffinityChangeMessage;
+import org.apache.ignite.internal.processors.cache.CacheGroupInfrastructure;
import org.apache.ignite.internal.processors.cache.CacheInvalidStateException;
+ import org.apache.ignite.internal.processors.cache.CachePartitionExchangeWorkerTask;
import org.apache.ignite.internal.processors.cache.ClusterState;
import org.apache.ignite.internal.processors.cache.DynamicCacheChangeBatch;
- import org.apache.ignite.internal.processors.cache.CachePartitionExchangeWorkerTask;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
import org.apache.ignite.internal.processors.cache.ExchangeActions;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
@@@ -1138,9 -1111,21 +1145,21 @@@ public class GridDhtPartitionsExchangeF
@Override public boolean onDone(@Nullable AffinityTopologyVersion res, @Nullable Throwable err) {
boolean realExchange = !dummy && !forcePreload;
+ if (err == null &&
+ realExchange &&
+ !cctx.kernalContext().clientNode() &&
+ (serverNodeDiscoveryEvent() || affChangeMsg != null)) {
+ for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
+ if (!cacheCtx.affinityNode() || cacheCtx.isLocal())
+ continue;
+
+ cacheCtx.continuousQueries().flushBackupQueue(exchId.topologyVersion());
+ }
+ }
+
if (err == null && realExchange) {
- for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
- if (cacheCtx.isLocal())
+ for (CacheGroupInfrastructure grp : cctx.cache().cacheGroups()) {
+ if (grp.isLocal())
continue;
try {
@@@ -1824,13 -1816,13 +1862,13 @@@
msgs.put(node.id(), msg);
for (Map.Entry<Integer, GridDhtPartitionMap> entry : msg.partitions().entrySet()) {
- Integer cacheId = entry.getKey();
- GridCacheContext cacheCtx = cctx.cacheContext(cacheId);
+ Integer grpId = entry.getKey();
+ CacheGroupInfrastructure grp = cctx.cache().cacheGroup(grpId);
- GridDhtPartitionTopology top = cacheCtx != null ? cacheCtx.topology() :
- cctx.exchange().clientTopology(cacheId, this);
+ GridDhtPartitionTopology top = grp != null ? grp.topology() :
+ cctx.exchange().clientTopology(grpId, this);
- top.update(exchId, entry.getValue(), msg.partitionUpdateCounters(grpId));
+ top.update(exchId, entry.getValue());
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/56af0611/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/56af0611/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/56af0611/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/56af0611/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/56af0611/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePartitionLossPolicySelfTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/56af0611/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/56af0611/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/56af0611/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2PkHashIndex.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/56af0611/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index bba5fca,5c8870e..55238d4
--- 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
@@@ -1049,12 -1046,12 +1046,12 @@@ public class GridReduceQueryExecutor
private Set<ClusterNode> replicatedUnstableDataNodes(GridCacheContext<?,?> cctx) {
assert cctx.isReplicated() : cctx.name() + " must be replicated";
- String space = cctx.name();
+ String cacheName = cctx.name();
- Set<ClusterNode> dataNodes = new HashSet<>(dataNodes(cacheName, NONE));
+ Set<ClusterNode> dataNodes = new HashSet<>(dataNodes(cctx.groupId(), NONE));
if (dataNodes.isEmpty())
- throw new CacheException("Failed to find data nodes for cache: " + space);
+ throw new CacheException("Failed to find data nodes for cache: " + cacheName);
// Find all the nodes owning all the partitions for replicated cache.
for (int p = 0, parts = cctx.affinity().partitions(); p < parts; p++) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/56af0611/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoClassQuerySelfTest.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoClassQuerySelfTest.java
index d50cb4c,e0148b3..770770e
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoClassQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoClassQuerySelfTest.java
@@@ -24,7 -26,8 +24,7 @@@ import org.apache.ignite.cache.QueryEnt
import org.apache.ignite.cache.QueryIndex;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
- import org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller;
-import org.apache.ignite.configuration.NearCacheConfiguration;
+ import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
http://git-wip-us.apache.org/repos/asf/ignite/blob/56af0611/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/56af0611/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
----------------------------------------------------------------------
[07/13] ignite git commit: IGNITE-5232
GridDhtPartitionDemander.requestPartitions invokes sendMessages consequently,
which lead to significant increase of node start time on large clusters with
ssl
Posted by sb...@apache.org.
IGNITE-5232 GridDhtPartitionDemander.requestPartitions invokes sendMessages consequently, which lead to significant increase of node start time on large clusters with ssl
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4c460b78
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4c460b78
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4c460b78
Branch: refs/heads/ignite-5075
Commit: 4c460b78f7b0febc37940c8d65f91cb449fa4d54
Parents: 8476a19
Author: Anton Vinogradov <av...@apache.org>
Authored: Thu May 25 16:27:46 2017 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Wed May 31 13:50:29 2017 +0300
----------------------------------------------------------------------
.../dht/preloader/GridDhtPartitionDemander.java | 103 ++++++++++---------
1 file changed, 52 insertions(+), 51 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4c460b78/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
index 838ccc8..cdbae1a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
@@ -328,41 +328,21 @@ public class GridDhtPartitionDemander {
return new Runnable() {
@Override public void run() {
- try {
- if (next != null)
- fut.listen(new CI1<IgniteInternalFuture<Boolean>>() {
- @Override public void apply(IgniteInternalFuture<Boolean> f) {
- try {
- if (f.get()) // Not cancelled.
- next.run(); // Starts next cache rebalancing (according to the order).
- }
- catch (IgniteCheckedException e) {
- if (log.isDebugEnabled())
- log.debug(e.getMessage());
- }
+ if (next != null)
+ fut.listen(new CI1<IgniteInternalFuture<Boolean>>() {
+ @Override public void apply(IgniteInternalFuture<Boolean> f) {
+ try {
+ if (f.get()) // Not cancelled.
+ next.run(); // Starts next cache rebalancing (according to the order).
}
- });
-
- requestPartitions(fut, assigns);
- }
- catch (IgniteCheckedException e) {
- ClusterTopologyCheckedException cause = e.getCause(ClusterTopologyCheckedException.class);
-
- if (cause != null)
- log.warning("Failed to send initial demand request to node. " + e.getMessage());
- else
- log.error("Failed to send initial demand request to node.", e);
-
- fut.cancel();
- }
- catch (Throwable th) {
- log.error("Runtime error caught during initial demand request sending.", th);
-
- fut.cancel();
+ catch (IgniteCheckedException e) {
+ if (log.isDebugEnabled())
+ log.debug(e.getMessage());
+ }
+ }
+ });
- if (th instanceof Error)
- throw th;
- }
+ requestPartitions(fut, assigns);
}
};
}
@@ -399,10 +379,7 @@ public class GridDhtPartitionDemander {
* @param assigns Assignments.
* @throws IgniteCheckedException If failed.
*/
- private void requestPartitions(
- RebalanceFuture fut,
- GridDhtPreloaderAssignments assigns
- ) throws IgniteCheckedException {
+ private void requestPartitions(final RebalanceFuture fut, GridDhtPreloaderAssignments assigns) {
assert fut != null;
if (topologyChanged(fut)) {
@@ -411,7 +388,7 @@ public class GridDhtPartitionDemander {
return;
}
- synchronized (fut) {
+ synchronized (fut) { // Synchronized to prevent consistency issues in case of parallel cancellation.
if (fut.isDone())
return;
@@ -443,7 +420,7 @@ public class GridDhtPartitionDemander {
int lsnrCnt = cctx.gridConfig().getRebalanceThreadPoolSize();
- List<Set<Integer>> sParts = new ArrayList<>(lsnrCnt);
+ final List<Set<Integer>> sParts = new ArrayList<>(lsnrCnt);
for (int cnt = 0; cnt < lsnrCnt; cnt++)
sParts.add(new HashSet<Integer>());
@@ -458,26 +435,50 @@ public class GridDhtPartitionDemander {
for (cnt = 0; cnt < lsnrCnt; cnt++) {
if (!sParts.get(cnt).isEmpty()) {
// Create copy.
- GridDhtPartitionDemandMessage initD = createDemandMessage(d, sParts.get(cnt));
+ final GridDhtPartitionDemandMessage initD = createDemandMessage(d, sParts.get(cnt));
initD.topic(rebalanceTopics.get(cnt));
initD.updateSequence(fut.updateSeq);
initD.timeout(cctx.config().getRebalanceTimeout());
- synchronized (fut) {
- if (fut.isDone())
- return;// Future can be already cancelled at this moment and all failovers happened.
+ final int finalCnt = cnt;
- // New requests will not be covered by failovers.
- cctx.io().sendOrderedMessage(node,
- rebalanceTopics.get(cnt), initD, cctx.ioPolicy(), initD.timeout());
- }
+ cctx.kernalContext().closure().runLocalSafe(new Runnable() {
+ @Override public void run() {
+ try {
+ if (!fut.isDone()) {
+ cctx.io().sendOrderedMessage(node,
+ rebalanceTopics.get(finalCnt), initD, cctx.ioPolicy(), initD.timeout());
+
+ // Cleanup required in case partitions demanded in parallel with cancellation.
+ synchronized (fut) {
+ if (fut.isDone())
+ fut.cleanupRemoteContexts(node.id());
+ }
+
+ if (log.isDebugEnabled())
+ log.debug("Requested rebalancing [from node=" + node.id() + ", listener index=" +
+ finalCnt + ", partitions count=" + sParts.get(finalCnt).size() +
+ " (" + partitionsList(sParts.get(finalCnt)) + ")]");
+ }
+ }
+ catch (IgniteCheckedException e) {
+ ClusterTopologyCheckedException cause = e.getCause(ClusterTopologyCheckedException.class);
+ if (cause != null)
+ log.warning("Failed to send initial demand request to node. " + e.getMessage());
+ else
+ log.error("Failed to send initial demand request to node.", e);
- if (log.isDebugEnabled())
- log.debug("Requested rebalancing [from node=" + node.id() + ", listener index=" +
- cnt + ", partitions count=" + sParts.get(cnt).size() +
- " (" + partitionsList(sParts.get(cnt)) + ")]");
+ fut.cancel();
+ }
+ catch (Throwable th) {
+ log.error("Runtime error caught during initial demand request sending.", th);
+
+ fut.cancel();
+ }
+ }
+ }, /*system pool*/true);
}
}
}
[12/13] ignite git commit: Merge remote-tracking branch
'remotes/origin/master' into ignite-5075
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-5075
# Conflicts:
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
# modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
# modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d429c3e4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d429c3e4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d429c3e4
Branch: refs/heads/ignite-5075
Commit: d429c3e4720886ef32ab5802486d441f5a42f75d
Parents: a36d186 738451c
Author: sboikov <sb...@gridgain.com>
Authored: Wed May 31 15:39:10 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed May 31 15:39:10 2017 +0300
----------------------------------------------------------------------
.../apache/ignite/IgniteSystemProperties.java | 12 +-
.../ignite/cache/query/SqlFieldsQuery.java | 24 ++
.../configuration/CacheConfiguration.java | 6 +
.../configuration/IgniteConfiguration.java | 28 ++
.../ignite/internal/IgniteNodeAttributes.java | 6 +
.../ignite/internal/jdbc2/JdbcConnection.java | 71 +++-
.../ignite/internal/jdbc2/JdbcQueryTask.java | 11 +-
.../ignite/internal/jdbc2/JdbcResultSet.java | 5 +-
.../ignite/internal/jdbc2/JdbcStatement.java | 12 +-
.../jdbc2/JdbcStreamedPreparedStatement.java | 3 +-
.../discovery/GridDiscoveryManager.java | 39 ++
.../dht/preloader/GridDhtPartitionDemander.java | 101 ++---
.../platform/cluster/PlatformClusterGroup.java | 45 +-
.../utils/PlatformConfigurationUtils.java | 6 +-
.../processors/query/GridQueryIndexing.java | 94 ++---
.../processors/query/GridQueryProcessor.java | 175 +++++---
.../internal/processors/query/QueryUtils.java | 3 +
.../top/GridTopologyCommandHandler.java | 4 +-
.../processors/security/SecurityUtils.java | 92 ++++
.../security/SecurityBasicPermissionSet.java | 41 +-
.../ignite/spi/discovery/tcp/ServerImpl.java | 99 ++++-
.../GridDiscoveryManagerAttributesSelfTest.java | 70 +++-
.../discovery/tcp/TestReconnectProcessor.java | 47 ++-
.../query/h2/DmlStatementsProcessor.java | 45 +-
.../processors/query/h2/H2RowDescriptor.java | 35 +-
.../internal/processors/query/h2/H2Schema.java | 65 +--
.../processors/query/h2/H2TableDescriptor.java | 25 +-
.../processors/query/h2/H2TableEngine.java | 2 +-
.../internal/processors/query/h2/H2Utils.java | 2 +-
.../processors/query/h2/IgniteH2Indexing.java | 417 ++++++++-----------
.../query/h2/opt/GridH2RowDescriptor.java | 5 -
.../processors/query/h2/opt/GridH2Table.java | 25 +-
.../query/IgniteSqlSchemaIndexingTest.java | 2 +-
.../h2/GridIndexingSpiAbstractSelfTest.java | 122 ++----
.../Cache/MemoryMetricsTest.cs | 20 +
.../PeerAssemblyLoadingAllApisTest.cs | 6 +-
.../IgniteConfigurationSerializerTest.cs | 8 +-
.../IgniteConfigurationTest.cs | 6 +-
.../Configuration/MemoryPolicyConfiguration.cs | 45 +-
.../dotnet/Apache.Ignite.Core/IIgnite.cs | 9 +
.../IgniteConfigurationSection.xsd | 10 +
.../Impl/Cluster/ClusterGroupImpl.cs | 12 +
.../dotnet/Apache.Ignite.Core/Impl/Ignite.cs | 8 +
.../dotnet/Apache.Ignite/Config/Configurator.cs | 9 +-
.../frontend/webpack/webpack.common.js | 7 +-
45 files changed, 1189 insertions(+), 690 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d429c3e4/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d429c3e4/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d429c3e4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
index 9882a32,cdbae1a..78da020
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
@@@ -439,7 -418,9 +416,7 @@@ public class GridDhtPartitionDemander
", fromNode=" + node.id() + ", partitionsCount=" + parts.size() +
", topology=" + fut.topologyVersion() + ", updateSeq=" + fut.updateSeq + "]");
- List<Set<Integer>> sParts = new ArrayList<>(lsnrCnt);
- int lsnrCnt = cctx.gridConfig().getRebalanceThreadPoolSize();
-
+ final List<Set<Integer>> sParts = new ArrayList<>(lsnrCnt);
for (int cnt = 0; cnt < lsnrCnt; cnt++)
sParts.add(new HashSet<Integer>());
@@@ -458,22 -439,46 +435,46 @@@
initD.topic(rebalanceTopics.get(cnt));
initD.updateSequence(fut.updateSeq);
- initD.timeout(cctx.config().getRebalanceTimeout());
+ initD.timeout(cfg.getRebalanceTimeout());
- synchronized (fut) {
- if (fut.isDone())
- return;// Future can be already cancelled at this moment and all failovers happened.
+ final int finalCnt = cnt;
- // New requests will not be covered by failovers.
- cctx.kernalContext().closure().runLocalSafe(new Runnable() {
- @Override public void run() {
- try {
++ cctx.kernalContext().closure().runLocalSafe(new Runnable() {
++@Override public void run() {
++ try {
+ if (!fut.isDone()) {
- cctx.io().sendOrderedMessage(node,
- rebalanceTopics.get(finalCnt), initD, cctx.ioPolicy(), initD.timeout());
+ ctx.io().sendOrderedMessage(node,
- rebalanceTopics.get(cnt), initD, grp.ioPolicy(), initD.timeout());
- }
++ rebalanceTopics.get(finalCnt), initD, grp.ioPolicy(), initD.timeout());
+
- // Cleanup required in case partitions demanded in parallel with cancellation.
++// Cleanup required in case partitions demanded in parallel with cancellation.
+ synchronized (fut) {
+ if (fut.isDone())
+ fut.cleanupRemoteContexts(node.id());
+ }
+ if (log.isDebugEnabled())
+ log.debug("Requested rebalancing [from node=" + node.id() + ", listener index=" +
+ finalCnt + ", partitions count=" + sParts.get(finalCnt).size() +
+ " (" + partitionsList(sParts.get(finalCnt)) + ")]");
+ }
+ }
+ catch (IgniteCheckedException e) {
+ ClusterTopologyCheckedException cause = e.getCause(ClusterTopologyCheckedException.class);
- if (log.isDebugEnabled())
- log.debug("Requested rebalancing [from node=" + node.id() + ", listener index=" +
- cnt + ", partitions count=" + sParts.get(cnt).size() +
- " (" + partitionsList(sParts.get(cnt)) + ")]");
+ if (cause != null)
+ log.warning("Failed to send initial demand request to node. " + e.getMessage());
+ else
+ log.error("Failed to send initial demand request to node.", e);
+
+ fut.cancel();
+ }
+ catch (Throwable th) {
+ log.error("Runtime error caught during initial demand request sending.", th);
+
+ fut.cancel();
+ }
+ }
+ }, /*system pool*/true);
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d429c3e4/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index a3633dc,fef7d4c..37cce73
--- 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
@@@ -1533,8 -1536,7 +1536,8 @@@ public class GridQueryProcessor extend
fut.onDone(e);
}
catch (Throwable e) {
- log.error("Failed to rebuild indexes for type: " + typeName, e);
+ U.error(log, "Failed to rebuild indexes for type [cache=" + cacheName +
- ", name=" + desc.name() + ']', e);
++ ", name=" + typeName + ']', e);
fut.onDone(e);
http://git-wip-us.apache.org/repos/asf/ignite/blob/d429c3e4/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
----------------------------------------------------------------------
[13/13] ignite git commit: Merge remote-tracking branch
'remotes/origin/master' into ignite-5075
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-5075
# Conflicts:
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
# modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
# modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4ef76013
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4ef76013
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4ef76013
Branch: refs/heads/ignite-5075
Commit: 4ef76013b161ed6f238fd79a48d4986896eaf81b
Parents: d429c3e
Author: sboikov <sb...@gridgain.com>
Authored: Wed May 31 15:47:00 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed May 31 15:47:00 2017 +0300
----------------------------------------------------------------------
.../dht/preloader/GridDhtPartitionDemander.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4ef76013/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
index 78da020..c4c628f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
@@ -395,7 +395,7 @@ public class GridDhtPartitionDemander {
Collection<Integer> parts= e.getValue().partitions();
- assert parts != null : "Partitions are null [grp=" + grp.name() + ", fromNode=" + nodeId + "]";
+ assert parts != null : "Partitions are null [grp=" + grp.cacheOrGroupName() + ", fromNode=" + nodeId + "]";
fut.remaining.put(nodeId, new T2<>(U.currentTimeMillis(), parts));
}
@@ -439,14 +439,14 @@ public class GridDhtPartitionDemander {
final int finalCnt = cnt;
- cctx.kernalContext().closure().runLocalSafe(new Runnable() {
-@Override public void run() {
- try {
+ ctx.kernalContext().closure().runLocalSafe(new Runnable() {
+ @Override public void run() {
+ try {
if (!fut.isDone()) {
- ctx.io().sendOrderedMessage(node,
- rebalanceTopics.get(finalCnt), initD, grp.ioPolicy(), initD.timeout());
+ ctx.io().sendOrderedMessage(node,
+ rebalanceTopics.get(finalCnt), initD, grp.ioPolicy(), initD.timeout());
-// Cleanup required in case partitions demanded in parallel with cancellation.
+ // Cleanup required in case partitions demanded in parallel with cancellation.
synchronized (fut) {
if (fut.isDone())
fut.cleanupRemoteContexts(node.id());
[11/13] ignite git commit: Merge remote-tracking branch
'origin/ignite-5075' into ignite-5075
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-5075' into ignite-5075
# Conflicts:
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
# modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a36d186d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a36d186d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a36d186d
Branch: refs/heads/ignite-5075
Commit: a36d186d24dd651535a7e32f0fbcb1eaa7683685
Parents: 56af061 6250119
Author: sboikov <sb...@gridgain.com>
Authored: Wed May 31 15:35:28 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed May 31 15:35:28 2017 +0300
----------------------------------------------------------------------
.../org/apache/ignite/internal/IgniteEx.java | 9 +-
.../apache/ignite/internal/IgniteKernal.java | 19 +-
.../ignite/internal/pagemem/PageSupport.java | 2 +-
.../affinity/GridAffinityProcessor.java | 2 +-
.../cache/CacheAffinitySharedManager.java | 2 +-
.../internal/processors/cache/CacheData.java | 13 +
.../cache/CacheGroupInfrastructure.java | 175 ++++-
.../cache/CacheJoinNodeDiscoveryData.java | 15 +-
.../cache/CacheOffheapEvictionManager.java | 11 +-
.../processors/cache/ClusterCachesInfo.java | 61 +-
.../cache/DynamicCacheChangeRequest.java | 21 +-
.../cache/DynamicCacheDescriptor.java | 13 +
.../processors/cache/GridCacheAdapter.java | 4 +-
.../cache/GridCacheAffinityManager.java | 2 +-
.../processors/cache/GridCacheAttributes.java | 21 +-
.../cache/GridCacheConcurrentMap.java | 32 +-
.../cache/GridCacheConcurrentMapImpl.java | 56 +-
.../processors/cache/GridCacheContext.java | 20 +-
.../cache/GridCacheLocalConcurrentMap.java | 23 +-
.../processors/cache/GridCacheMapEntry.java | 51 +-
.../processors/cache/GridCacheProcessor.java | 86 ++-
.../processors/cache/GridNoStorageCacheMap.java | 4 +-
.../cache/IgniteCacheOffheapManagerImpl.java | 25 +-
.../processors/cache/IgniteCacheProxy.java | 2 +-
.../cache/database/CacheDataRowAdapter.java | 21 +-
.../processors/cache/database/RowStore.java | 5 +
.../cache/database/tree/BPlusTree.java | 2 +
.../GridDistributedCacheAdapter.java | 8 +-
.../dht/GridCachePartitionedConcurrentMap.java | 8 +-
.../distributed/dht/GridDhtCacheEntry.java | 10 +-
.../distributed/dht/GridDhtGetSingleFuture.java | 30 +-
.../distributed/dht/GridDhtLocalPartition.java | 248 +++----
.../dht/GridDhtPartitionTopologyImpl.java | 1 -
.../dht/GridPartitionedSingleGetFuture.java | 4 +-
.../dht/preloader/GridDhtPartitionDemander.java | 5 +-
.../GridDhtPartitionsExchangeFuture.java | 10 +-
.../near/GridNearOptimisticTxPrepareFuture.java | 21 +-
.../CacheContinuousQueryEventBuffer.java | 5 +-
.../continuous/CacheContinuousQueryHandler.java | 106 ++-
.../CacheContinuousQueryListener.java | 17 +
.../continuous/CacheContinuousQueryManager.java | 51 +-
.../query/continuous/CounterSkipContext.java | 78 ++
.../cluster/GridClusterStateProcessor.java | 2 +-
.../datastructures/DataStructuresProcessor.java | 1 +
.../datastructures/GridCacheLockImpl.java | 10 +-
.../processors/query/GridQueryProcessor.java | 7 +-
.../internal/processors/query/QueryUtils.java | 30 +-
.../handlers/cache/GridCacheCommandHandler.java | 2 +-
.../processors/cache/IgniteCacheGroupsTest.java | 717 +++++++++++++++++--
.../cache/IgniteDynamicCacheStartSelfTest.java | 4 +-
...nuousQueryConcurrentPartitionUpdateTest.java | 137 +++-
.../processors/igfs/IgfsIgniteMock.java | 4 +-
.../junits/multijvm/IgniteProcessProxy.java | 4 +-
.../processors/query/h2/database/H2Tree.java | 6 +-
.../query/h2/database/H2TreeIndex.java | 7 +-
.../cache/index/H2DynamicTableSelfTest.java | 79 +-
modules/platforms/cpp/examples/Makefile.am | 2 +-
modules/platforms/cpp/examples/configure.ac | 2 +-
.../cpp/examples/odbc-example/Makefile.am | 12 +-
.../cpp/examples/project/vs/ignite-examples.sln | 12 +-
.../cpp/examples/put-get-example/Makefile.am | 58 ++
.../put-get-example/config/example-cache.xml | 67 ++
.../project/vs/put-get-example.vcxproj | 110 +++
.../project/vs/put-get-example.vcxproj.filters | 38 +
.../put-get-example/src/put_get_example.cpp | 126 ++++
.../cpp/examples/putget-example/Makefile.am | 58 --
.../putget-example/config/example-cache.xml | 67 --
.../project/vs/putget-example.vcxproj | 110 ---
.../project/vs/putget-example.vcxproj.filters | 38 -
.../putget-example/src/putget_example.cpp | 126 ----
.../cpp/examples/query-example/Makefile.am | 12 +-
.../StartupTest.cs | 78 ++
.../Apache.Ignite.Core.Tests.NuGet/TestUtil.cs | 30 +
.../Deployment/PeerAssemblyLoadingTest.cs | 8 +-
.../Apache.Ignite.Core.nuspec | 7 +-
.../Impl/Common/IgniteHome.cs | 3 +-
.../platforms/dotnet/Apache.Ignite/App.config | 11 +
.../yardstick/IgniteBenchmarkArguments.java | 21 +
.../cache/IgniteCacheAbstractBenchmark.java | 142 ++++
.../yardstick/cache/IgniteGetAllBenchmark.java | 3 +
.../cache/IgniteGetAllPutAllTxBenchmark.java | 2 +
.../cache/IgniteGetAndPutBenchmark.java | 2 +
.../cache/IgniteGetAndPutTxBenchmark.java | 2 +
.../yardstick/cache/IgniteGetBenchmark.java | 18 +-
.../IgniteGetEntriesPutAllTxBenchmark.java | 2 +
.../yardstick/cache/IgniteInvokeBenchmark.java | 2 +
.../cache/IgniteInvokeTxBenchmark.java | 2 +
.../IgniteInvokeWithInjectionBenchmark.java | 2 +
.../yardstick/cache/IgnitePutAllBenchmark.java | 2 +
.../IgnitePutAllSerializableTxBenchmark.java | 2 +
.../yardstick/cache/IgnitePutBenchmark.java | 2 +
.../cache/IgnitePutGetBatchBenchmark.java | 2 +
.../yardstick/cache/IgnitePutGetBenchmark.java | 2 +
.../cache/IgnitePutGetEntryBenchmark.java | 2 +
.../cache/IgnitePutGetEntryTxBenchmark.java | 2 +
.../cache/IgnitePutGetTxBatchBenchmark.java | 2 +
.../cache/IgnitePutGetTxBenchmark.java | 2 +
...IgnitePutIfAbsentIndexedValue1Benchmark.java | 2 +
.../cache/IgnitePutIndexedValue1Benchmark.java | 2 +
.../cache/IgnitePutIndexedValue2Benchmark.java | 2 +
.../cache/IgnitePutIndexedValue8Benchmark.java | 2 +
.../cache/IgnitePutObjectKeyBenchmark.java | 125 ++++
.../IgnitePutRandomValueSizeBenchmark.java | 2 +
.../cache/IgnitePutRemoveBenchmark.java | 2 +
.../yardstick/cache/IgnitePutTxBenchmark.java | 2 +
.../cache/IgnitePutTxImplicitBenchmark.java | 2 +
.../cache/IgnitePutTxPrimaryOnlyBenchmark.java | 2 +
.../IgnitePutTxSkipLocalBackupBenchmark.java | 2 +
.../cache/IgnitePutValue8Benchmark.java | 2 +
.../IgniteReplaceIndexedValue1Benchmark.java | 2 +
.../cache/IgniteSqlQueryBenchmark.java | 16 +-
.../IgniteSqlQueryDistributedJoinBenchmark.java | 24 +-
.../cache/IgniteSqlQueryJoinBenchmark.java | 14 +-
.../cache/IgniteSqlQueryPutBenchmark.java | 8 +-
.../IgniteSqlQueryPutSeparatedBenchmark.java | 4 +
.../IgniteCacheRandomOperationBenchmark.java | 42 +-
116 files changed, 2789 insertions(+), 968 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a36d186d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index eb04711,245e688..f9b5655
--- 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
@@@ -1232,8 -1236,13 +1236,14 @@@ public class GridCacheProcessor extend
cacheCtx.onStarted();
- if (log.isInfoEnabled()){
- log.info("Started cache [name=" + cfg.getName() +(cfg.getGroupName() != null ? ", group=" + cfg.getGroupName() : "") + ", memoryPolicyName=" + cfg.getMemoryPolicyName() + ", mode=" + cfg.getCacheMode() +", atomicity=" + cfg.getAtomicityMode() + ']');}
++
+ if (log.isInfoEnabled()) {
+ log.info("Started cache [name=" + cfg.getName() +
+ (cfg.getGroupName() != null ? ", group=" + cfg.getGroupName() : "") +
+ ", memoryPolicyName=" + cfg.getMemoryPolicyName() +
+ ", mode=" + cfg.getCacheMode() +
+ ", atomicity=" + cfg.getAtomicityMode() + ']');
- }
++}
}
/**
[08/13] ignite git commit: IGNITE-5259 Minor serialization fix
Posted by sb...@apache.org.
IGNITE-5259 Minor serialization fix
(cherry picked from commit b2040b7)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c71b7c26
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c71b7c26
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c71b7c26
Branch: refs/heads/ignite-5075
Commit: c71b7c26d0a43acb8e5f433e48da1adfd4f9ba14
Parents: 4c460b7
Author: dkarachentsev <dk...@gridgain.com>
Authored: Wed May 31 14:01:18 2017 +0300
Committer: dkarachentsev <dk...@gridgain.com>
Committed: Wed May 31 14:01:18 2017 +0300
----------------------------------------------------------------------
.../apache/ignite/IgniteSystemProperties.java | 12 ++-
.../ignite/internal/IgniteNodeAttributes.java | 6 ++
.../discovery/GridDiscoveryManager.java | 39 ++++++++
.../top/GridTopologyCommandHandler.java | 4 +-
.../processors/security/SecurityUtils.java | 92 ++++++++++++++++++
.../security/SecurityBasicPermissionSet.java | 41 +++++++-
.../ignite/spi/discovery/tcp/ServerImpl.java | 99 +++++++++++++++++---
.../GridDiscoveryManagerAttributesSelfTest.java | 70 +++++++++++++-
.../discovery/tcp/TestReconnectProcessor.java | 47 +++++++++-
9 files changed, 389 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c71b7c26/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index 75fa3f0..ea4b690 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -553,7 +553,7 @@ public final class IgniteSystemProperties {
/**
* Whether Ignite can access unaligned memory addresses.
* <p>
- * Defaults to {@code} false, meaning that unaligned access will be performed only on x86 architecture.
+ * Defaults to {@code false}, meaning that unaligned access will be performed only on x86 architecture.
*/
public static final String IGNITE_MEMORY_UNALIGNED_ACCESS = "IGNITE_MEMORY_UNALIGNED_ACCESS";
@@ -603,6 +603,16 @@ public final class IgniteSystemProperties {
}
};
+ /**
+ * When set to {@code true}, Ignite switches to compatibility mode with versions that don't
+ * support service security permissions. In this case security permissions will be ignored
+ * (if they set).
+ * <p>
+ * Default is {@code false}, which means that service security permissions will be respected.
+ * </p>
+ */
+ public static final String IGNITE_SECURITY_COMPATIBILITY_MODE = "IGNITE_SECURITY_COMPATIBILITY_MODE";
+
/**
* Enforces singleton.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/c71b7c26/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
index a990ca2..a45f991 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
@@ -144,6 +144,9 @@ public final class IgniteNodeAttributes {
/** Security subject for authenticated node. */
public static final String ATTR_SECURITY_SUBJECT = ATTR_PREFIX + ".security.subject";
+ /** V2 security subject for authenticated node. */
+ public static final String ATTR_SECURITY_SUBJECT_V2 = ATTR_PREFIX + ".security.subject.v2";
+
/** Client mode flag. */
public static final String ATTR_CLIENT_MODE = ATTR_PREFIX + ".cache.client";
@@ -171,6 +174,9 @@ public final class IgniteNodeAttributes {
/** Late affinity assignment mode. */
public static final String ATTR_ACTIVE_ON_START = ATTR_PREFIX + ".active.on.start";
+ /** Ignite security compatibility mode. */
+ public static final String ATTR_SECURITY_COMPATIBILITY_MODE = ATTR_PREFIX + ".security.compatibility.enabled";
+
/**
* Enforces singleton.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/c71b7c26/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index 7b066e8..b47f4fa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -117,6 +117,7 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_BINARY_MARSHALLER_USE_STRING_SERIALIZATION_VER_2;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_DISCOVERY_HISTORY_SIZE;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_OPTIMIZED_MARSHALLER_USE_DEFAULT_SUID;
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_SECURITY_COMPATIBILITY_MODE;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_SERVICES_COMPATIBILITY_MODE;
import static org.apache.ignite.IgniteSystemProperties.getInteger;
import static org.apache.ignite.events.EventType.EVT_CLIENT_NODE_DISCONNECTED;
@@ -133,9 +134,12 @@ import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MACS;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER_USE_BINARY_STRING_SER_VER_2;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER_USE_DFLT_SUID;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PEER_CLASSLOADING;
+import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_SECURITY_COMPATIBILITY_MODE;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_SERVICES_COMPATIBILITY_MODE;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_USER_NAME;
import static org.apache.ignite.internal.IgniteVersionUtils.VER;
+import static org.apache.ignite.internal.processors.security.SecurityUtils.SERVICE_PERMISSIONS_SINCE;
+import static org.apache.ignite.internal.processors.security.SecurityUtils.isSecurityCompatibilityMode;
import static org.apache.ignite.plugin.segmentation.SegmentationPolicy.NOOP;
/**
@@ -449,6 +453,9 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
spi.setMetricsProvider(createMetricsProvider());
if (ctx.security().enabled()) {
+ if (isSecurityCompatibilityMode())
+ ctx.addNodeAttribute(ATTR_SECURITY_COMPATIBILITY_MODE, true);
+
spi.setAuthenticator(new DiscoverySpiNodeAuthenticator() {
@Override public SecurityContext authenticateNode(ClusterNode node, SecurityCredentials cred) {
try {
@@ -1072,6 +1079,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
boolean locActiveOnStart = locNode.attribute(ATTR_ACTIVE_ON_START);
Boolean locSrvcCompatibilityEnabled = locNode.attribute(ATTR_SERVICES_COMPATIBILITY_MODE);
+ Boolean locSecurityCompatibilityEnabled = locNode.attribute(ATTR_SECURITY_COMPATIBILITY_MODE);
for (ClusterNode n : nodes) {
int rmtJvmMajVer = nodeJavaMajorVersion(n);
@@ -1181,6 +1189,37 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
", rmtNodeAddrs=" + U.addressesAsString(n) +
", locNodeId=" + locNode.id() + ", rmtNodeId=" + n.id() + ']');
}
+
+ if (n.version().compareToIgnoreTimestamp(SERVICE_PERMISSIONS_SINCE) >= 0
+ && ctx.security().enabled() // Matters only if security enabled.
+ ) {
+ Boolean rmtSecurityCompatibilityEnabled = n.attribute(ATTR_SECURITY_COMPATIBILITY_MODE);
+
+ if (!F.eq(locSecurityCompatibilityEnabled, rmtSecurityCompatibilityEnabled)) {
+ throw new IgniteCheckedException("Local node's " + IGNITE_SECURITY_COMPATIBILITY_MODE +
+ " property value differs from remote node's value " +
+ "(to make sure all nodes in topology have identical Ignite security compatibility mode enabled, " +
+ "configure system property explicitly) " +
+ "[locSecurityCompatibilityEnabled=" + locSecurityCompatibilityEnabled +
+ ", rmtSecurityCompatibilityEnabled=" + rmtSecurityCompatibilityEnabled +
+ ", locNodeAddrs=" + U.addressesAsString(locNode) +
+ ", rmtNodeAddrs=" + U.addressesAsString(n) +
+ ", locNodeId=" + locNode.id() + ", rmtNodeId=" + n.id() + ']');
+ }
+ }
+
+ if (n.version().compareToIgnoreTimestamp(SERVICE_PERMISSIONS_SINCE) < 0
+ && ctx.security().enabled() // Matters only if security enabled.
+ && (locSecurityCompatibilityEnabled == null || !locSecurityCompatibilityEnabled)) {
+ throw new IgniteCheckedException("Remote node does not support service security permissions. " +
+ "To be able to join to it, local node must be started with " + IGNITE_SECURITY_COMPATIBILITY_MODE +
+ " system property set to \"true\". " +
+ "[locSecurityCompatibilityEnabled=" + locSecurityCompatibilityEnabled +
+ ", locNodeAddrs=" + U.addressesAsString(locNode) +
+ ", rmtNodeAddrs=" + U.addressesAsString(n) +
+ ", locNodeId=" + locNode.id() + ", rmtNodeId=" + n.id() + ", " +
+ ", rmtNodeVer" + n.version() + ']');
+ }
}
if (log.isDebugEnabled())
http://git-wip-us.apache.org/repos/asf/ignite/blob/c71b7c26/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java
index 536ec88..d9e023d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java
@@ -39,8 +39,8 @@ import org.apache.ignite.internal.processors.port.GridPortRecord;
import org.apache.ignite.internal.processors.rest.GridRestCommand;
import org.apache.ignite.internal.processors.rest.GridRestProtocol;
import org.apache.ignite.internal.processors.rest.GridRestResponse;
-import org.apache.ignite.internal.processors.rest.client.message.GridClientNodeBean;
import org.apache.ignite.internal.processors.rest.client.message.GridClientCacheBean;
+import org.apache.ignite.internal.processors.rest.client.message.GridClientNodeBean;
import org.apache.ignite.internal.processors.rest.client.message.GridClientNodeMetricsBean;
import org.apache.ignite.internal.processors.rest.handlers.GridRestCommandHandlerAdapter;
import org.apache.ignite.internal.processors.rest.request.GridRestRequest;
@@ -60,6 +60,7 @@ import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_REST_TCP_HOST
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_REST_TCP_PORT;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_SECURITY_CREDENTIALS;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_SECURITY_SUBJECT;
+import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_SECURITY_SUBJECT_V2;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_TX_CONFIG;
import static org.apache.ignite.internal.processors.rest.GridRestCommand.NODE;
import static org.apache.ignite.internal.processors.rest.GridRestCommand.TOPOLOGY;
@@ -292,6 +293,7 @@ public class GridTopologyCommandHandler extends GridRestCommandHandlerAdapter {
attrs.remove(ATTR_CACHE);
attrs.remove(ATTR_TX_CONFIG);
attrs.remove(ATTR_SECURITY_SUBJECT);
+ attrs.remove(ATTR_SECURITY_SUBJECT_V2);
attrs.remove(ATTR_SECURITY_CREDENTIALS);
attrs.remove(ATTR_BINARY_CONFIGURATION);
attrs.remove(ATTR_NODE_CONSISTENT_ID);
http://git-wip-us.apache.org/repos/asf/ignite/blob/c71b7c26/modules/core/src/main/java/org/apache/ignite/internal/processors/security/SecurityUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/security/SecurityUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/security/SecurityUtils.java
new file mode 100644
index 0000000..1016335
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/security/SecurityUtils.java
@@ -0,0 +1,92 @@
+/*
+ * 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.security;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.ignite.IgniteSystemProperties;
+import org.apache.ignite.lang.IgniteProductVersion;
+import org.apache.ignite.plugin.security.SecurityPermission;
+
+/**
+ * Security utilities.
+ */
+public class SecurityUtils {
+ /** Version since service security supported. */
+ public static final IgniteProductVersion SERVICE_PERMISSIONS_SINCE = IgniteProductVersion.fromString("1.7.11");
+
+ /** Default serialization version. */
+ private final static int DFLT_SERIALIZE_VERSION = isSecurityCompatibilityMode() ? 1 : 2;
+
+ /** Current serialization version. */
+ private static final ThreadLocal<Integer> SERIALIZE_VERSION = new ThreadLocal<Integer>(){
+ @Override protected Integer initialValue() {
+ return DFLT_SERIALIZE_VERSION;
+ }
+ };
+
+ /**
+ * Private constructor.
+ */
+ private SecurityUtils() {
+ }
+
+ /**
+ * @return Security compatibility mode flag.
+ */
+ public static boolean isSecurityCompatibilityMode() {
+ return IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_SECURITY_COMPATIBILITY_MODE, false);
+ }
+
+ /**
+ * @param ver Serialize version.
+ */
+ public static void serializeVersion(int ver) {
+ SERIALIZE_VERSION.set(ver);
+ }
+
+ /**
+ * @return Serialize version.
+ */
+ public static int serializeVersion() {
+ return SERIALIZE_VERSION.get();
+ }
+
+ /**
+ * Sets default serialize version {@link #DFLT_SERIALIZE_VERSION}.
+ */
+ public static void restoreDefaultSerializeVersion() {
+ serializeVersion(DFLT_SERIALIZE_VERSION);
+ }
+
+ /**
+ * @return Allow all service permissions.
+ */
+ public static Map<String, Collection<SecurityPermission>> compatibleServicePermissions() {
+ Map<String, Collection<SecurityPermission>> srvcPerms = new HashMap<>();
+
+ srvcPerms.put("*", Arrays.asList(
+ SecurityPermission.SERVICE_CANCEL,
+ SecurityPermission.SERVICE_DEPLOY,
+ SecurityPermission.SERVICE_INVOKE));
+
+ return srvcPerms;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c71b7c26/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityBasicPermissionSet.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityBasicPermissionSet.java b/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityBasicPermissionSet.java
index 44166d9..370eadd 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityBasicPermissionSet.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityBasicPermissionSet.java
@@ -17,15 +17,24 @@
package org.apache.ignite.plugin.security;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
import org.jetbrains.annotations.Nullable;
+import static org.apache.ignite.internal.processors.security.SecurityUtils.compatibleServicePermissions;
+import static org.apache.ignite.internal.processors.security.SecurityUtils.isSecurityCompatibilityMode;
+import static org.apache.ignite.internal.processors.security.SecurityUtils.serializeVersion;
+
/**
* Simple implementation of {@link SecurityPermissionSet} interface. Provides
* convenient way to specify permission set in the XML configuration.
@@ -44,7 +53,9 @@ public class SecurityBasicPermissionSet implements SecurityPermissionSet {
/** Service permissions. */
@GridToStringInclude
- private Map<String, Collection<SecurityPermission>> servicePermissions = new HashMap<>();
+ private transient Map<String, Collection<SecurityPermission>> servicePermissions = isSecurityCompatibilityMode()
+ ? compatibleServicePermissions()
+ : new HashMap<String, Collection<SecurityPermission>>();
/** System permissions. */
@GridToStringInclude
@@ -158,6 +169,34 @@ public class SecurityBasicPermissionSet implements SecurityPermissionSet {
return res;
}
+ /**
+ * @param out Out.
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+
+ if (serializeVersion() >= 2)
+ U.writeMap(out, servicePermissions);
+ }
+
+ /**
+ * @param in In.
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+
+ if (serializeVersion() >= 2)
+ servicePermissions = U.readMap(in);
+
+ if (servicePermissions == null) {
+ // Allow all for compatibility mode
+ if (serializeVersion() < 2)
+ servicePermissions = compatibleServicePermissions();
+ else
+ servicePermissions = Collections.emptyMap();
+ }
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(SecurityBasicPermissionSet.class, this);
http://git-wip-us.apache.org/repos/asf/ignite/blob/c71b7c26/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index fce6fe2..c253a6d 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -70,6 +70,7 @@ import org.apache.ignite.internal.IgniteNodeAttributes;
import org.apache.ignite.internal.IgnitionEx;
import org.apache.ignite.internal.events.DiscoveryCustomEvent;
import org.apache.ignite.internal.processors.security.SecurityContext;
+import org.apache.ignite.internal.processors.security.SecurityUtils;
import org.apache.ignite.internal.util.GridBoundedLinkedHashSet;
import org.apache.ignite.internal.util.GridConcurrentHashSet;
import org.apache.ignite.internal.util.IgniteUtils;
@@ -116,9 +117,9 @@ import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryDiscardMessage;
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryDuplicateIdMessage;
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryHandshakeRequest;
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryHandshakeResponse;
-import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryMetricsUpdateMessage;
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryJoinRequestMessage;
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryLoopbackProblemMessage;
+import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryMetricsUpdateMessage;
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeAddFinishedMessage;
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeAddedMessage;
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeFailedMessage;
@@ -957,7 +958,8 @@ class ServerImpl extends TcpDiscoveryImpl {
Map<String, Object> attrs = new HashMap<>(locNode.attributes());
- attrs.put(IgniteNodeAttributes.ATTR_SECURITY_SUBJECT, U.marshal(spi.marshaller(), subj));
+ attrs.put(IgniteNodeAttributes.ATTR_SECURITY_SUBJECT_V2, U.marshal(spi.marshaller(), subj));
+ attrs.put(IgniteNodeAttributes.ATTR_SECURITY_SUBJECT, marshalWithSecurityVersion(subj, 1));
locNode.setAttributes(attrs);
@@ -995,7 +997,16 @@ class ServerImpl extends TcpDiscoveryImpl {
try {
IgniteSpiOperationTimeoutHelper timeoutHelper = new IgniteSpiOperationTimeoutHelper(spi, true);
- Integer res = sendMessageDirectly(joinReq, addr, timeoutHelper);
+ Integer res;
+
+ try {
+ SecurityUtils.serializeVersion(1);
+
+ res = sendMessageDirectly(joinReq, addr, timeoutHelper);
+ }
+ finally {
+ SecurityUtils.restoreDefaultSerializeVersion();
+ }
assert res != null;
@@ -1944,6 +1955,39 @@ class ServerImpl extends TcpDiscoveryImpl {
}
/**
+ * @param obj Object.
+ * @param ver Security serialize version.
+ * @return Marshaled object.
+ */
+ private byte[] marshalWithSecurityVersion(Object obj, int ver) throws IgniteCheckedException {
+ try {
+ SecurityUtils.serializeVersion(ver);
+
+ return U.marshal(spi.marshaller(), obj);
+ }
+ finally {
+ SecurityUtils.restoreDefaultSerializeVersion();
+ }
+ }
+
+ /**
+ * @param bytes Marshaled object.
+ * @param ver Security serialize version.
+ * @return Unmarshaled object.
+ */
+ private <T> T unmarshalWithSecurityVersion(byte[] bytes, int ver) throws IgniteCheckedException {
+ try {
+ if (ver > 0)
+ SecurityUtils.serializeVersion(ver);
+
+ return spi.marshaller().unmarshal(bytes, U.resolveClassLoader(spi.ignite().configuration()));
+ }
+ finally {
+ SecurityUtils.restoreDefaultSerializeVersion();
+ }
+ }
+
+ /**
* Discovery messages history used for client reconnect.
*/
private class EnsuredMessageHistory {
@@ -2974,6 +3018,8 @@ class ServerImpl extends TcpDiscoveryImpl {
pendingMsgs.customDiscardId);
try {
+ SecurityUtils.serializeVersion(1);
+
long tstamp = U.currentTimeMillis();
if (timeoutHelper == null)
@@ -3020,6 +3066,8 @@ class ServerImpl extends TcpDiscoveryImpl {
}
}
finally {
+ SecurityUtils.restoreDefaultSerializeVersion();
+
clearNodeAddedMessage(msg);
}
@@ -3410,7 +3458,8 @@ class ServerImpl extends TcpDiscoveryImpl {
// Stick in authentication subject to node (use security-safe attributes for copy).
Map<String, Object> attrs = new HashMap<>(node.getAttributes());
- attrs.put(IgniteNodeAttributes.ATTR_SECURITY_SUBJECT, U.marshal(spi.marshaller(), subj));
+ attrs.put(IgniteNodeAttributes.ATTR_SECURITY_SUBJECT_V2, U.marshal(spi.marshaller(), subj));
+ attrs.put(IgniteNodeAttributes.ATTR_SECURITY_SUBJECT, marshalWithSecurityVersion(subj, 1));
node.setAttributes(attrs);
}
@@ -4066,9 +4115,22 @@ class ServerImpl extends TcpDiscoveryImpl {
else {
SecurityContext subj = spi.nodeAuth.authenticateNode(node, cred);
- SecurityContext coordSubj = U.unmarshal(spi.marshaller(),
- node.<byte[]>attribute(IgniteNodeAttributes.ATTR_SECURITY_SUBJECT),
- U.resolveClassLoader(spi.ignite().configuration()));
+ byte[] subjBytes = node.attribute(IgniteNodeAttributes.ATTR_SECURITY_SUBJECT);
+ byte[] subjBytesV2 = node.attribute(IgniteNodeAttributes.ATTR_SECURITY_SUBJECT_V2);
+
+ SecurityContext coordSubj;
+
+ try {
+ if (subjBytesV2 == null)
+ SecurityUtils.serializeVersion(1);
+
+ coordSubj = U.unmarshal(spi.marshaller(),
+ subjBytesV2 != null ? subjBytesV2 : subjBytes,
+ U.resolveClassLoader(spi.ignite().configuration()));
+ }
+ finally {
+ SecurityUtils.restoreDefaultSerializeVersion();
+ }
if (!permissionsEqual(coordSubj.subject().permissions(), subj.subject().permissions())) {
// Node has not pass authentication.
@@ -4152,13 +4214,23 @@ class ServerImpl extends TcpDiscoveryImpl {
new TcpDiscoveryAuthFailedMessage(locNodeId, spi.locHost);
try {
- ClassLoader cl = U.resolveClassLoader(spi.ignite().configuration());
-
byte[] rmSubj = node.attribute(IgniteNodeAttributes.ATTR_SECURITY_SUBJECT);
byte[] locSubj = locNode.attribute(IgniteNodeAttributes.ATTR_SECURITY_SUBJECT);
- SecurityContext rmCrd = spi.marshaller().unmarshal(rmSubj, cl);
- SecurityContext locCrd = spi.marshaller().unmarshal(locSubj, cl);
+ byte[] rmSubjV2 = node.attribute(IgniteNodeAttributes.ATTR_SECURITY_SUBJECT_V2);
+ byte[] locSubjV2 = locNode.attribute(IgniteNodeAttributes.ATTR_SECURITY_SUBJECT_V2);
+
+ int ver = 1; // Compatible version.
+
+ if (rmSubjV2 != null && locSubjV2 != null) {
+ rmSubj = rmSubjV2;
+ locSubj = locSubjV2;
+
+ ver = 0; // Default version.
+ }
+
+ SecurityContext rmCrd = unmarshalWithSecurityVersion(rmSubj, ver);
+ SecurityContext locCrd = unmarshalWithSecurityVersion(locSubj, ver);
if (!permissionsEqual(locCrd.subject().permissions(),
rmCrd.subject().permissions())) {
@@ -5835,6 +5907,8 @@ class ServerImpl extends TcpDiscoveryImpl {
while (!isInterrupted()) {
try {
+ SecurityUtils.serializeVersion(1);
+
TcpDiscoveryAbstractMessage msg = U.unmarshal(spi.marshaller(), in,
U.resolveClassLoader(spi.ignite().configuration()));
@@ -6091,6 +6165,9 @@ class ServerImpl extends TcpDiscoveryImpl {
return;
}
+ finally {
+ SecurityUtils.restoreDefaultSerializeVersion();
+ }
}
}
finally {
http://git-wip-us.apache.org/repos/asf/ignite/blob/c71b7c26/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java
index 2345dd6..6ec8046 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java
@@ -21,15 +21,19 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.configuration.DeploymentMode;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.TestReconnectPluginProvider;
+import org.apache.ignite.spi.discovery.tcp.TestReconnectProcessor;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_BINARY_MARSHALLER_USE_STRING_SERIALIZATION_VER_2;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_OPTIMIZED_MARSHALLER_USE_DEFAULT_SUID;
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_SECURITY_COMPATIBILITY_MODE;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_SERVICES_COMPATIBILITY_MODE;
import static org.apache.ignite.configuration.DeploymentMode.CONTINUOUS;
import static org.apache.ignite.configuration.DeploymentMode.SHARED;
@@ -258,18 +262,69 @@ public abstract class GridDiscoveryManagerAttributesSelfTest extends GridCommonA
* @throws Exception If failed.
*/
private void doTestServiceCompatibilityEnabled(Object first, Object second, boolean fail) throws Exception {
+ doTestCompatibilityEnabled(IGNITE_SERVICES_COMPATIBILITY_MODE, first, second, fail);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSecurityCompatibilityEnabled() throws Exception {
+ TestReconnectPluginProvider.enabled = true;
+ TestReconnectProcessor.enabled = true;
+
+ try {
+ doTestSecurityCompatibilityEnabled(true, null, true);
+ doTestSecurityCompatibilityEnabled(true, false, true);
+ doTestSecurityCompatibilityEnabled(false, true, true);
+ doTestSecurityCompatibilityEnabled(null, true, true);
+
+ doTestSecurityCompatibilityEnabled(null, null, false);
+ doTestSecurityCompatibilityEnabled(null, false, false);
+ doTestSecurityCompatibilityEnabled(false, false, false);
+ doTestSecurityCompatibilityEnabled(false, null, false);
+ doTestSecurityCompatibilityEnabled(true, true, false);
+ }
+ finally {
+ TestReconnectPluginProvider.enabled = false;
+ TestReconnectProcessor.enabled = false;
+ }
+ }
+
+ /**
+ * @param first Service compatibility enabled flag for first node.
+ * @param second Service compatibility enabled flag for second node.
+ * @param fail Fail flag.
+ * @throws Exception If failed.
+ */
+ private void doTestSecurityCompatibilityEnabled(Object first, Object second, boolean fail) throws Exception {
+ doTestCompatibilityEnabled(IGNITE_SECURITY_COMPATIBILITY_MODE, first, second, fail);
+ }
+
+ /**
+ * @param prop System property.
+ * @param first Service compatibility enabled flag for first node.
+ * @param second Service compatibility enabled flag for second node.
+ * @param fail Fail flag.
+ * @throws Exception If failed.
+ */
+ private void doTestCompatibilityEnabled(String prop, Object first, Object second, boolean fail) throws Exception {
+ String backup = System.getProperty(prop);
try {
if (first != null)
- System.setProperty(IGNITE_SERVICES_COMPATIBILITY_MODE, String.valueOf(first));
+ System.setProperty(prop, String.valueOf(first));
else
- System.clearProperty(IGNITE_SERVICES_COMPATIBILITY_MODE);
+ System.clearProperty(prop);
- startGrid(0);
+ IgniteEx ignite = startGrid(0);
+
+ // Ignore if disabled security plugin used.
+ if (IGNITE_SECURITY_COMPATIBILITY_MODE.equals(prop) && !ignite.context().security().enabled())
+ return;
if (second != null)
- System.setProperty(IGNITE_SERVICES_COMPATIBILITY_MODE, String.valueOf(second));
+ System.setProperty(prop, String.valueOf(second));
else
- System.clearProperty(IGNITE_SERVICES_COMPATIBILITY_MODE);
+ System.clearProperty(prop);
try {
startGrid(1);
@@ -284,6 +339,11 @@ public abstract class GridDiscoveryManagerAttributesSelfTest extends GridCommonA
}
finally {
stopAllGrids();
+
+ if (backup != null)
+ System.setProperty(prop, backup);
+ else
+ System.clearProperty(prop);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c71b7c26/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TestReconnectProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TestReconnectProcessor.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TestReconnectProcessor.java
index f0ed35c..d15ddf9 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TestReconnectProcessor.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TestReconnectProcessor.java
@@ -17,11 +17,13 @@
package org.apache.ignite.spi.discovery.tcp;
+import java.io.Serializable;
import java.util.Collection;
import java.util.UUID;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.IgniteNodeAttributes;
import org.apache.ignite.internal.processors.GridProcessorAdapter;
import org.apache.ignite.internal.processors.security.GridSecurityProcessor;
import org.apache.ignite.internal.processors.security.SecurityContext;
@@ -37,6 +39,9 @@ import org.jetbrains.annotations.Nullable;
* Updates node attributes on disconnect.
*/
public class TestReconnectProcessor extends GridProcessorAdapter implements GridSecurityProcessor {
+ /** Enabled flag. */
+ public static boolean enabled;
+
/**
* @param ctx Kernal context.
*/
@@ -45,9 +50,14 @@ public class TestReconnectProcessor extends GridProcessorAdapter implements Grid
}
/** {@inheritDoc} */
+ @Override public void start(boolean activeOnStart) throws IgniteCheckedException {
+ ctx.addNodeAttribute(IgniteNodeAttributes.ATTR_SECURITY_CREDENTIALS, new SecurityCredentials());
+ }
+
+ /** {@inheritDoc} */
@Override public SecurityContext authenticateNode(ClusterNode node,
SecurityCredentials cred) throws IgniteCheckedException {
- return null;
+ return new TestSecurityContext();
}
/** {@inheritDoc} */
@@ -83,11 +93,44 @@ public class TestReconnectProcessor extends GridProcessorAdapter implements Grid
/** {@inheritDoc} */
@Override public boolean enabled() {
- return false;
+ return enabled;
}
/** {@inheritDoc} */
@Override public void onDisconnected(IgniteFuture<?> reconnectFut) throws IgniteCheckedException {
ctx.addNodeAttribute("test", "2");
}
+
+ /**
+ *
+ */
+ private static class TestSecurityContext implements SecurityContext, Serializable {
+ /** Serial version uid. */
+ private static final long serialVersionUID = 0L;
+
+ /** {@inheritDoc} */
+ @Override public SecuritySubject subject() {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean taskOperationAllowed(String taskClsName, SecurityPermission perm) {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean cacheOperationAllowed(String cacheName, SecurityPermission perm) {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean serviceOperationAllowed(String srvcName, SecurityPermission perm) {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean systemOperationAllowed(SecurityPermission perm) {
+ return true;
+ }
+ }
}
[06/13] ignite git commit: IGNITE-5354 .NET: Fix command line args
preference over config file
Posted by sb...@apache.org.
IGNITE-5354 .NET: Fix command line args preference over config file
This closes #2042
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8476a195
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8476a195
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8476a195
Branch: refs/heads/ignite-5075
Commit: 8476a1958a1778a6b48dea55a81e8e954f243179
Parents: e36c02c
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed May 31 12:10:58 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Wed May 31 12:10:58 2017 +0300
----------------------------------------------------------------------
.../platforms/dotnet/Apache.Ignite/Config/Configurator.cs | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/8476a195/modules/platforms/dotnet/Apache.Ignite/Config/Configurator.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite/Config/Configurator.cs b/modules/platforms/dotnet/Apache.Ignite/Config/Configurator.cs
index 785334a..4c43841 100644
--- a/modules/platforms/dotnet/Apache.Ignite/Config/Configurator.cs
+++ b/modules/platforms/dotnet/Apache.Ignite/Config/Configurator.cs
@@ -176,9 +176,12 @@ namespace Apache.Ignite.Config
/// </summary>
private static string FindValue(IEnumerable<Tuple<string, string>> args, string name)
{
- return args.Where(x => name.Equals(x.Item1, StringComparison.OrdinalIgnoreCase))
- .Select(x => x.Item2)
- .FirstOrDefault();
+ // Search in reverse so that command line has preference over config file.
+ return args
+ .Reverse()
+ .Where(x => name.Equals(x.Item1, StringComparison.OrdinalIgnoreCase))
+ .Select(x => x.Item2)
+ .FirstOrDefault();
}
}
}
[04/13] ignite git commit: IGNITE-5317: Added method to execute SQL
fields query without concrete cache. This closes #2024.
Posted by sb...@apache.org.
IGNITE-5317: Added method to execute SQL fields query without concrete cache. This closes #2024.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c45de168
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c45de168
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c45de168
Branch: refs/heads/ignite-5075
Commit: c45de1681110e42b88c84d82507b8bc9286182ec
Parents: 0feadac
Author: devozerov <vo...@gridgain.com>
Authored: Wed May 31 10:36:13 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed May 31 10:36:13 2017 +0300
----------------------------------------------------------------------
.../ignite/internal/jdbc2/JdbcConnection.java | 26 +-
.../processors/query/GridQueryIndexing.java | 71 +++--
.../processors/query/GridQueryProcessor.java | 161 ++++++----
.../query/h2/DmlStatementsProcessor.java | 45 +--
.../processors/query/h2/IgniteH2Indexing.java | 306 +++++++------------
.../h2/GridIndexingSpiAbstractSelfTest.java | 121 ++------
6 files changed, 327 insertions(+), 403 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c45de168/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcConnection.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcConnection.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcConnection.java
index ee8b605..9385d7d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcConnection.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcConnection.java
@@ -56,8 +56,12 @@ import org.apache.ignite.compute.ComputeTaskTimeoutException;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.IgnitionEx;
import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
+import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
+import org.apache.ignite.internal.processors.query.GridQueryIndexing;
+import org.apache.ignite.internal.processors.query.IgniteSQLException;
import org.apache.ignite.internal.processors.resource.GridSpringResourceContext;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
import org.apache.ignite.internal.util.typedef.F;
@@ -544,10 +548,24 @@ public class JdbcConnection implements Connection {
if (!stream)
stmt = new JdbcPreparedStatement(this, sql);
else {
+ GridQueryIndexing idx = ignite().context().query().getIndexing();
+
PreparedStatement nativeStmt = prepareNativeStatement(sql);
- IgniteDataStreamer<?, ?> streamer = ((IgniteEx) ignite).context().query().createStreamer(cacheName,
- nativeStmt, streamFlushTimeout, streamNodeBufSize, streamNodeParOps, streamAllowOverwrite);
+ if (!idx.isInsertStatement(nativeStmt))
+ throw new IgniteSQLException("Only INSERT operations are supported in streaming mode",
+ IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
+
+ IgniteDataStreamer streamer = ignite().dataStreamer(cacheName);
+
+ streamer.autoFlushFrequency(streamFlushTimeout);
+ streamer.allowOverwrite(streamAllowOverwrite);
+
+ if (streamNodeBufSize > 0)
+ streamer.perNodeBufferSize(streamNodeBufSize);
+
+ if (streamNodeParOps > 0)
+ streamer.perNodeParallelOperations(streamNodeParOps);
stmt = new JdbcStreamedPreparedStatement(this, sql, streamer, nativeStmt);
}
@@ -736,8 +754,8 @@ public class JdbcConnection implements Connection {
/**
* @return Ignite node.
*/
- Ignite ignite() {
- return ignite;
+ IgniteKernal ignite() {
+ return (IgniteKernal)ignite;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/c45de168/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
index 9d66c0a..4429058 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
@@ -66,77 +66,79 @@ public interface GridQueryIndexing {
/**
* Parses SQL query into two step query and executes it.
*
- * @param cctx Cache context.
+ * @param schemaName Schema name.
* @param qry Query.
* @param keepBinary Keep binary flag.
+ * @param mainCacheId Main cache ID.
* @return Cursor.
* @throws IgniteCheckedException If failed.
*/
- public <K, V> QueryCursor<Cache.Entry<K, V>> queryDistributedSql(GridCacheContext<?,?> cctx, SqlQuery qry,
- boolean keepBinary) throws IgniteCheckedException;
+ public <K, V> QueryCursor<Cache.Entry<K, V>> queryDistributedSql(String schemaName, SqlQuery qry,
+ boolean keepBinary, int mainCacheId) throws IgniteCheckedException;
/**
* Parses SQL query into two step query and executes it.
*
- * @param cctx Cache context.
+ * @param schemaName Schema name.
* @param qry Query.
* @param keepBinary Keep binary flag.
* @param cancel Query cancel.
+ * @param mainCacheId Main cache ID.
* @return Cursor.
* @throws IgniteCheckedException If failed.
*/
- public FieldsQueryCursor<List<?>> queryDistributedSqlFields(GridCacheContext<?, ?> cctx, SqlFieldsQuery qry,
- boolean keepBinary, GridQueryCancel cancel) throws IgniteCheckedException;
+ public FieldsQueryCursor<List<?>> queryDistributedSqlFields(String schemaName, SqlFieldsQuery qry,
+ boolean keepBinary, GridQueryCancel cancel, @Nullable Integer mainCacheId) throws IgniteCheckedException;
/**
* Perform a MERGE statement using data streamer as receiver.
*
- * @param cacheName Cache name.
+ * @param schemaName Schema name.
* @param qry Query.
* @param params Query parameters.
* @param streamer Data streamer to feed data to.
* @return Query result.
* @throws IgniteCheckedException If failed.
*/
- public long streamUpdateQuery(String cacheName, String qry, @Nullable Object[] params,
+ public long streamUpdateQuery(String schemaName, String qry, @Nullable Object[] params,
IgniteDataStreamer<?, ?> streamer) throws IgniteCheckedException;
/**
* Executes regular query.
*
- * @param cctx Cache context.
+ * @param schemaName Schema name.
* @param qry Query.
* @param filter Cache name and key filter.
* @param keepBinary Keep binary flag.
* @return Cursor.
*/
- public <K, V> QueryCursor<Cache.Entry<K,V>> queryLocalSql(GridCacheContext<?, ?> cctx, SqlQuery qry,
+ public <K, V> QueryCursor<Cache.Entry<K,V>> queryLocalSql(String schemaName, SqlQuery qry,
IndexingQueryFilter filter, boolean keepBinary) throws IgniteCheckedException;
/**
* Queries individual fields (generally used by JDBC drivers).
*
- * @param cctx Cache context.
+ * @param schemaName Schema name.
* @param qry Query.
* @param keepBinary Keep binary flag.
* @param filter Cache name and key filter.
* @param cancel Query cancel.
* @return Cursor.
*/
- public FieldsQueryCursor<List<?>> queryLocalSqlFields(GridCacheContext<?, ?> cctx, SqlFieldsQuery qry,
+ public FieldsQueryCursor<List<?>> queryLocalSqlFields(String schemaName, SqlFieldsQuery qry,
boolean keepBinary, IndexingQueryFilter filter, GridQueryCancel cancel) throws IgniteCheckedException;
/**
* Executes text query.
*
- * @param cacheName Cache name.
+ * @param schemaName Schema name.
* @param qry Text query.
* @param typeName Type name.
* @param filter Cache name and key filter.
* @return Queried rows.
* @throws IgniteCheckedException If failed.
*/
- public <K, V> GridCloseableIterator<IgniteBiTuple<K, V>> queryLocalText(String cacheName, String qry,
+ public <K, V> GridCloseableIterator<IgniteBiTuple<K, V>> queryLocalText(String schemaName, String qry,
String typeName, IndexingQueryFilter filter) throws IgniteCheckedException;
/**
@@ -196,11 +198,11 @@ public interface GridQueryIndexing {
/**
* Unregisters type and removes all corresponding data.
*
- * @param cacheName Cache name.
+ * @param schemaName Schema name.
* @param typeName Type name.
* @throws IgniteCheckedException If failed.
*/
- public void unregisterType(String cacheName, String typeName) throws IgniteCheckedException;
+ public void unregisterType(String schemaName, String typeName) throws IgniteCheckedException;
/**
* Updates index. Note that key is unique for cache, so if cache contains multiple indexes
@@ -231,19 +233,21 @@ public interface GridQueryIndexing {
/**
* Rebuilds all indexes of given type from hash index.
*
- * @param cacheName Cache name.
- * @param type Type descriptor.
+ * @param cctx Cache context.
+ * @param schemaName Schema name.
+ * @param typeName Type name.
* @throws IgniteCheckedException If failed.
*/
- public void rebuildIndexesFromHash(String cacheName, GridQueryTypeDescriptor type) throws IgniteCheckedException;
+ public void rebuildIndexesFromHash(GridCacheContext cctx, String schemaName, String typeName)
+ throws IgniteCheckedException;
/**
* Marks all indexes of given type for rebuild from hash index, making them unusable until rebuild finishes.
*
* @param cacheName Cache name.
- * @param type Type descriptor.
+ * @param typeName Type name.
*/
- public void markForRebuildFromHash(String cacheName, GridQueryTypeDescriptor type);
+ public void markForRebuildFromHash(String cacheName, String typeName);
/**
* Returns backup filter.
@@ -264,11 +268,11 @@ public interface GridQueryIndexing {
/**
* Prepare native statement to retrieve JDBC metadata from.
*
- * @param cacheName Cache name.
+ * @param schemaName Schema name.
* @param sql Query.
* @return {@link PreparedStatement} from underlying engine to supply metadata to Prepared - most likely H2.
*/
- public PreparedStatement prepareNativeStatement(String cacheName, String sql) throws SQLException;
+ public PreparedStatement prepareNativeStatement(String schemaName, String sql) throws SQLException;
/**
* Gets cache name from database schema.
@@ -299,15 +303,18 @@ public interface GridQueryIndexing {
public void cancelAllQueries();
/**
- * @param cacheName Cache name.
+ * Gets database schema from cache name.
+ *
+ * @param cacheName Cache name. {@code null} would be converted to an empty string.
+ * @return Schema name. Should not be null since we should not fail for an invalid cache name.
+ */
+ public String schema(String cacheName);
+
+ /**
+ * Check if passed statement is insert statemtn.
+ *
* @param nativeStmt Native statement.
- * @param autoFlushFreq Automatic data flushing frequency, disabled if {@code 0}.
- * @param nodeBufSize Per node buffer size - see {@link IgniteDataStreamer#perNodeBufferSize(int)}
- * @param nodeParOps Per node parallel ops count - see {@link IgniteDataStreamer#perNodeParallelOperations(int)}
- * @param allowOverwrite Overwrite existing cache values on key duplication.
- * @return {@link IgniteDataStreamer} tailored to specific needs of given native statement based on its metadata;
- * {@code null} if given statement is a query.
+ * @return {@code True} if insert.
*/
- public IgniteDataStreamer<?,?> createStreamer(String cacheName, PreparedStatement nativeStmt, long autoFlushFreq,
- int nodeBufSize, int nodeParOps, boolean allowOverwrite);
+ public boolean isInsertStatement(PreparedStatement nativeStmt);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c45de168/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 320c90b..990226e 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
@@ -44,11 +44,9 @@ import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.QueryCursorImpl;
import org.apache.ignite.internal.processors.cache.query.CacheQueryFuture;
import org.apache.ignite.internal.processors.cache.query.CacheQueryType;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryType;
-import org.apache.ignite.internal.processors.cache.query.QueryCursorEx;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitor;
import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitorImpl;
@@ -1508,10 +1506,8 @@ public class GridQueryProcessor extends GridProcessorAdapter {
* @param desc Type descriptor.
* @return Future that will be completed when rebuilding of all indexes is finished.
*/
- private IgniteInternalFuture<Object> rebuildIndexesFromHash(
- @Nullable final String cacheName,
- @Nullable final QueryTypeDescriptorImpl desc
- ) {
+ private IgniteInternalFuture<Object> rebuildIndexesFromHash(@Nullable final String cacheName,
+ @Nullable final QueryTypeDescriptorImpl desc) {
if (idx == null)
return new GridFinishedFuture<>(new IgniteCheckedException("Indexing is disabled."));
@@ -1520,12 +1516,19 @@ public class GridQueryProcessor extends GridProcessorAdapter {
final GridWorkerFuture<Object> fut = new GridWorkerFuture<>();
- idx.markForRebuildFromHash(cacheName, desc);
+ final String schemaName = idx.schema(cacheName);
+ final String typeName = desc.name();
+
+ idx.markForRebuildFromHash(schemaName, typeName);
GridWorker w = new GridWorker(ctx.igniteInstanceName(), "index-rebuild-worker", log) {
@Override protected void body() {
try {
- idx.rebuildIndexesFromHash(cacheName, desc);
+ int cacheId = CU.cacheId(cacheName);
+
+ GridCacheContext cctx = ctx.cache().context().cacheContext(cacheId);
+
+ idx.rebuildIndexesFromHash(cctx, schemaName, typeName);
fut.onDone();
}
@@ -1533,7 +1536,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
fut.onDone(e);
}
catch (Throwable e) {
- log.error("Failed to rebuild indexes for type: " + desc.name(), e);
+ log.error("Failed to rebuild indexes for type: " + typeName, e);
fut.onDone(e);
@@ -1721,12 +1724,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
final boolean keepBinary) {
checkxEnabled();
- if (qry.isReplicatedOnly() && qry.getPartitions() != null)
- throw new CacheException("Partitions are not supported in replicated only mode.");
-
- if (qry.isDistributedJoins() && qry.getPartitions() != null)
- throw new CacheException(
- "Using both partitions and distributed JOINs is not supported for the same query");
+ validateSqlFieldsQuery(qry);
boolean loc = (qry.isReplicatedOnly() && cctx.isReplicatedAffinityNode()) || cctx.isLocal() || qry.isLocal();
@@ -1734,6 +1732,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
throw new IllegalStateException("Failed to execute query (grid is stopping).");
try {
+ final String schemaName = idx.schema(cctx.name());
+ final int mainCacheId = CU.cacheId(cctx.name());
+
IgniteOutClosureX<FieldsQueryCursor<List<?>>> clo;
if (loc) {
@@ -1741,32 +1742,29 @@ public class GridQueryProcessor extends GridProcessorAdapter {
@Override public FieldsQueryCursor<List<?>> applyx() throws IgniteCheckedException {
GridQueryCancel cancel = new GridQueryCancel();
- final FieldsQueryCursor<List<?>> cursor = idx.queryLocalSqlFields(cctx, qry, keepBinary,
- idx.backupFilter(requestTopVer.get(), qry.getPartitions()), cancel);
+ FieldsQueryCursor<List<?>> cur;
- Iterable<List<?>> iterExec = new Iterable<List<?>>() {
- @Override public Iterator<List<?>> iterator() {
- sendQueryExecutedEvent(qry.getSql(), qry.getArgs(), cctx.name());
+ if (cctx.config().getQueryParallelism() > 1) {
+ qry.setDistributedJoins(true);
- return cursor.iterator();
- }
- };
+ cur = idx.queryDistributedSqlFields(schemaName, qry, keepBinary, cancel, mainCacheId);
+ }
+ else {
+ IndexingQueryFilter filter = idx.backupFilter(requestTopVer.get(), qry.getPartitions());
- return new QueryCursorImpl<List<?>>(iterExec, cancel) {
- @Override public List<GridQueryFieldMetadata> fieldsMeta() {
- if (cursor instanceof QueryCursorImpl)
- return ((QueryCursorEx)cursor).fieldsMeta();
+ cur = idx.queryLocalSqlFields(schemaName, qry, keepBinary, filter, cancel);
+ }
- return super.fieldsMeta();
- }
- };
+ sendQueryExecutedEvent(qry.getSql(), qry.getArgs(), cctx.name());
+
+ return cur;
}
};
}
else {
clo = new IgniteOutClosureX<FieldsQueryCursor<List<?>>>() {
@Override public FieldsQueryCursor<List<?>> applyx() throws IgniteCheckedException {
- return idx.queryDistributedSqlFields(cctx, qry, keepBinary, null);
+ return idx.queryDistributedSqlFields(schemaName, qry, keepBinary, null, mainCacheId);
}
};
}
@@ -1782,6 +1780,58 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}
/**
+ * Query SQL fields without strict dependency on concrete cache.
+ *
+ * @param schemaName Schema name.
+ * @param qry Query.
+ * @param keepBinary Keep binary flag.
+ * @return Cursot.
+ */
+ public FieldsQueryCursor<List<?>> querySqlFieldsNoCache(final String schemaName, final SqlFieldsQuery qry,
+ final boolean keepBinary) {
+ checkxEnabled();
+
+ validateSqlFieldsQuery(qry);
+
+ if (qry.isLocal())
+ throw new IgniteException("Local query is not supported without specific cache.");
+
+ if (!busyLock.enterBusy())
+ throw new IllegalStateException("Failed to execute query (grid is stopping).");
+
+ try {
+ IgniteOutClosureX<FieldsQueryCursor<List<?>>> clo = new IgniteOutClosureX<FieldsQueryCursor<List<?>>>() {
+ @Override public FieldsQueryCursor<List<?>> applyx() throws IgniteCheckedException {
+ GridQueryCancel cancel = new GridQueryCancel();
+
+ return idx.queryDistributedSqlFields(schemaName, qry, keepBinary, cancel, null);
+ }
+ };
+
+ return executeQuery(GridCacheQueryType.SQL_FIELDS, qry.getSql(), null, clo, true);
+ }
+ catch (IgniteCheckedException e) {
+ throw new CacheException(e);
+ }
+ finally {
+ busyLock.leaveBusy();
+ }
+ }
+
+ /**
+ * Validate SQL fields query.
+ *
+ * @param qry Query.
+ */
+ private static void validateSqlFieldsQuery(SqlFieldsQuery qry) {
+ if (qry.isReplicatedOnly() && qry.getPartitions() != null)
+ throw new CacheException("Partitions are not supported in replicated only mode.");
+
+ if (qry.isDistributedJoins() && qry.getPartitions() != null)
+ throw new CacheException("Using both partitions and distributed JOINs is not supported for the same query");
+ }
+
+ /**
* @param cacheName Cache name.
* @param streamer Data streamer.
* @param qry Query.
@@ -1797,9 +1847,11 @@ public class GridQueryProcessor extends GridProcessorAdapter {
try {
GridCacheContext cctx = ctx.cache().cache(cacheName).context();
+ final String schemaName = idx.schema(cacheName);
+
return executeQuery(GridCacheQueryType.SQL_FIELDS, qry, cctx, new IgniteOutClosureX<Long>() {
@Override public Long applyx() throws IgniteCheckedException {
- return idx.streamUpdateQuery(cacheName, qry, args, streamer);
+ return idx.streamUpdateQuery(schemaName, qry, args, streamer);
}
}, true);
}
@@ -1848,10 +1900,13 @@ public class GridQueryProcessor extends GridProcessorAdapter {
throw new IllegalStateException("Failed to execute query (grid is stopping).");
try {
+ final String schemaName = idx.schema(cctx.name());
+ final int mainCacheId = CU.cacheId(cctx.name());
+
return executeQuery(GridCacheQueryType.SQL, qry.getSql(), cctx,
new IgniteOutClosureX<QueryCursor<Cache.Entry<K, V>>>() {
@Override public QueryCursor<Cache.Entry<K, V>> applyx() throws IgniteCheckedException {
- return idx.queryDistributedSql(cctx, qry, keepBinary);
+ return idx.queryDistributedSql(schemaName, qry, keepBinary, mainCacheId);
}
}, true);
}
@@ -1874,6 +1929,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
if (!busyLock.enterBusy())
throw new IllegalStateException("Failed to execute query (grid is stopping).");
+ final String schemaName = idx.schema(cctx.name());
+ final int mainCacheId = CU.cacheId(cctx.name());
+
try {
return executeQuery(GridCacheQueryType.SQL, qry.getSql(), cctx,
new IgniteOutClosureX<QueryCursor<Cache.Entry<K, V>>>() {
@@ -1889,8 +1947,14 @@ public class GridQueryProcessor extends GridProcessorAdapter {
qry.getArgs(),
cctx.name());
- return idx.queryLocalSql(cctx, qry, idx.backupFilter(requestTopVer.get(), qry.getPartitions()),
- keepBinary);
+ if (cctx.config().getQueryParallelism() > 1) {
+ qry.setDistributedJoins(true);
+
+ return idx.queryDistributedSql(schemaName, qry, keepBinary, mainCacheId);
+ }
+ else
+ return idx.queryLocalSql(schemaName, qry, idx.backupFilter(requestTopVer.get(),
+ qry.getPartitions()), keepBinary);
}
}, true);
}
@@ -2036,7 +2100,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
public PreparedStatement prepareNativeStatement(String cacheName, String sql) throws SQLException {
checkxEnabled();
- return idx.prepareNativeStatement(cacheName, sql);
+ String schemaName = idx.schema(cacheName);
+
+ return idx.prepareNativeStatement(schemaName, sql);
}
/**
@@ -2051,21 +2117,6 @@ public class GridQueryProcessor extends GridProcessorAdapter {
/**
* @param cacheName Cache name.
- * @param nativeStmt Native statement.
- * @param autoFlushFreq Automatic data flushing frequency, disabled if {@code 0}.
- * @param nodeBufSize Per node buffer size - see {@link IgniteDataStreamer#perNodeBufferSize(int)}
- * @param nodeParOps Per node parallel ops count - see {@link IgniteDataStreamer#perNodeParallelOperations(int)}
- * @param allowOverwrite Overwrite existing cache values on key duplication.
- * @see IgniteDataStreamer#allowOverwrite
- * @return {@link IgniteDataStreamer} tailored to specific needs of given native statement based on its metadata.
- */
- public IgniteDataStreamer<?, ?> createStreamer(String cacheName, PreparedStatement nativeStmt, long autoFlushFreq,
- int nodeBufSize, int nodeParOps, boolean allowOverwrite) {
- return idx.createStreamer(cacheName, nativeStmt, autoFlushFreq, nodeBufSize, nodeParOps, allowOverwrite);
- }
-
- /**
- * @param cacheName Cache name.
* @param key Key.
* @throws IgniteCheckedException Thrown in case of any errors.
*/
@@ -2122,8 +2173,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
new IgniteOutClosureX<GridCloseableIterator<IgniteBiTuple<K, V>>>() {
@Override public GridCloseableIterator<IgniteBiTuple<K, V>> applyx() throws IgniteCheckedException {
String typeName = typeName(cacheName, resType);
+ String schemaName = idx.schema(cacheName);
- return idx.queryLocalText(cacheName, clause, typeName, filters);
+ return idx.queryLocalText(schemaName, clause, typeName, filters);
}
}, true);
}
@@ -2191,7 +2243,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
* @param complete Complete.
*/
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
- public <R> R executeQuery(GridCacheQueryType qryType, String qry, GridCacheContext<?, ?> cctx,
+ public <R> R executeQuery(GridCacheQueryType qryType, String qry, @Nullable GridCacheContext<?, ?> cctx,
IgniteOutClosureX<R> clo, boolean complete) throws IgniteCheckedException {
final long startTime = U.currentTimeMillis();
@@ -2231,7 +2283,8 @@ public class GridQueryProcessor extends GridProcessorAdapter {
long duration = U.currentTimeMillis() - startTime;
if (complete || failed) {
- cctx.queries().collectMetrics(qryType, qry, startTime, duration, failed);
+ if (cctx != null)
+ cctx.queries().collectMetrics(qryType, qry, startTime, duration, failed);
if (log.isTraceEnabled())
log.trace("Query execution [startTime=" + startTime + ", duration=" + duration +
http://git-wip-us.apache.org/repos/asf/ignite/blob/c45de168/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
index d48c373..98d123f 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
@@ -68,6 +68,7 @@ import org.apache.ignite.internal.util.GridBoundedConcurrentLinkedHashMap;
import org.apache.ignite.internal.util.lang.IgniteSingletonIterator;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.X;
+import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteInClosure;
@@ -138,7 +139,7 @@ public class DmlStatementsProcessor {
/**
* Execute DML statement, possibly with few re-attempts in case of concurrent data modifications.
*
- * @param schema Schema.
+ * @param schemaName Schema.
* @param stmt JDBC statement.
* @param fieldsQry Original query.
* @param loc Query locality flag.
@@ -147,13 +148,13 @@ public class DmlStatementsProcessor {
* @return Update result (modified items count and failed keys).
* @throws IgniteCheckedException if failed.
*/
- private UpdateResult updateSqlFields(String schema, PreparedStatement stmt, SqlFieldsQuery fieldsQry,
+ private UpdateResult updateSqlFields(String schemaName, PreparedStatement stmt, SqlFieldsQuery fieldsQry,
boolean loc, IndexingQueryFilter filters, GridQueryCancel cancel) throws IgniteCheckedException {
Object[] errKeys = null;
long items = 0;
- UpdatePlan plan = getPlanForStatement(schema, stmt, null);
+ UpdatePlan plan = getPlanForStatement(schemaName, stmt, null);
GridCacheContext<?, ?> cctx = plan.tbl.rowDescriptor().context();
@@ -177,7 +178,7 @@ public class DmlStatementsProcessor {
UpdateResult r;
try {
- r = executeUpdateStatement(cctx, stmt, fieldsQry, loc, filters, cancel, errKeys);
+ r = executeUpdateStatement(schemaName, cctx, stmt, fieldsQry, loc, filters, cancel, errKeys);
}
finally {
cctx.operationContextPerCall(opCtx);
@@ -201,7 +202,7 @@ public class DmlStatementsProcessor {
}
/**
- * @param schema Schema.
+ * @param schemaName Schema.
* @param stmt Prepared statement.
* @param fieldsQry Initial query
* @param cancel Query cancel.
@@ -209,12 +210,12 @@ public class DmlStatementsProcessor {
* @throws IgniteCheckedException if failed.
*/
@SuppressWarnings("unchecked")
- QueryCursorImpl<List<?>> updateSqlFieldsDistributed(String schema, PreparedStatement stmt,
+ QueryCursorImpl<List<?>> updateSqlFieldsDistributed(String schemaName, PreparedStatement stmt,
SqlFieldsQuery fieldsQry, GridQueryCancel cancel) throws IgniteCheckedException {
- UpdateResult res = updateSqlFields(schema, stmt, fieldsQry, false, null, cancel);
+ UpdateResult res = updateSqlFields(schemaName, stmt, fieldsQry, false, null, cancel);
QueryCursorImpl<List<?>> resCur = (QueryCursorImpl<List<?>>)new QueryCursorImpl(Collections.singletonList
- (Collections.singletonList(res.cnt)), null, false);
+ (Collections.singletonList(res.cnt)), cancel, false);
resCur.fieldsMeta(UPDATE_RESULT_META);
@@ -224,7 +225,7 @@ public class DmlStatementsProcessor {
/**
* Execute DML statement on local cache.
*
- * @param schema Schema.
+ * @param schemaName Schema.
* @param stmt Prepared statement.
* @param fieldsQry Fields query.
* @param filters Cache name and key filter.
@@ -233,10 +234,10 @@ public class DmlStatementsProcessor {
* @throws IgniteCheckedException if failed.
*/
@SuppressWarnings("unchecked")
- GridQueryFieldsResult updateSqlFieldsLocal(String schema, PreparedStatement stmt,
+ GridQueryFieldsResult updateSqlFieldsLocal(String schemaName, PreparedStatement stmt,
SqlFieldsQuery fieldsQry, IndexingQueryFilter filters, GridQueryCancel cancel)
throws IgniteCheckedException {
- UpdateResult res = updateSqlFields(schema, stmt, fieldsQry, true, filters, cancel);
+ UpdateResult res = updateSqlFields(schemaName, stmt, fieldsQry, true, filters, cancel);
return new GridQueryFieldsResultAdapter(UPDATE_RESULT_META,
new IgniteSingletonIterator(Collections.singletonList(res.cnt)));
@@ -276,8 +277,8 @@ public class DmlStatementsProcessor {
final ArrayList<List<?>> data = new ArrayList<>(plan.rowsNum);
- final GridQueryFieldsResult res = idx.queryLocalSqlFields(cctx.name(), plan.selectQry, F.asList(args),
- null, false, 0, null);
+ final GridQueryFieldsResult res = idx.queryLocalSqlFields(idx.schema(cctx.name()), plan.selectQry,
+ F.asList(args), null, false, 0, null);
QueryCursorImpl<List<?>> stepCur = new QueryCursorImpl<>(new Iterable<List<?>>() {
@Override public Iterator<List<?>> iterator() {
@@ -327,6 +328,7 @@ public class DmlStatementsProcessor {
/**
* Actually perform SQL DML operation locally.
*
+ * @param schemaName Schema name.
* @param cctx Cache context.
* @param prepStmt Prepared statement for DML query.
* @param fieldsQry Fields query.
@@ -336,12 +338,14 @@ public class DmlStatementsProcessor {
* @throws IgniteCheckedException if failed.
*/
@SuppressWarnings({"ConstantConditions", "unchecked"})
- private UpdateResult executeUpdateStatement(final GridCacheContext cctx, PreparedStatement prepStmt,
- SqlFieldsQuery fieldsQry, boolean loc, IndexingQueryFilter filters, GridQueryCancel cancel,
- Object[] failedKeys) throws IgniteCheckedException {
+ private UpdateResult executeUpdateStatement(String schemaName, final GridCacheContext cctx,
+ PreparedStatement prepStmt, SqlFieldsQuery fieldsQry, boolean loc, IndexingQueryFilter filters,
+ GridQueryCancel cancel, Object[] failedKeys) throws IgniteCheckedException {
+ int mainCacheId = CU.cacheId(cctx.name());
+
Integer errKeysPos = null;
- UpdatePlan plan = getPlanForStatement(idx.schema(cctx.name()), prepStmt, errKeysPos);
+ UpdatePlan plan = getPlanForStatement(schemaName, prepStmt, errKeysPos);
if (plan.fastUpdateArgs != null) {
assert F.isEmpty(failedKeys) && errKeysPos == null;
@@ -364,16 +368,17 @@ public class DmlStatementsProcessor {
.setPageSize(fieldsQry.getPageSize())
.setTimeout(fieldsQry.getTimeout(), TimeUnit.MILLISECONDS);
- cur = (QueryCursorImpl<List<?>>) idx.queryDistributedSqlFields(cctx, newFieldsQry, true, cancel);
+ cur = (QueryCursorImpl<List<?>>) idx.queryDistributedSqlFields(schemaName, newFieldsQry, true, cancel,
+ mainCacheId);
}
else {
- final GridQueryFieldsResult res = idx.queryLocalSqlFields(cctx.name(), plan.selectQry,
+ final GridQueryFieldsResult res = idx.queryLocalSqlFields(schemaName, plan.selectQry,
F.asList(fieldsQry.getArgs()), filters, fieldsQry.isEnforceJoinOrder(), fieldsQry.getTimeout(), cancel);
cur = new QueryCursorImpl<>(new Iterable<List<?>>() {
@Override public Iterator<List<?>> iterator() {
try {
- return new GridQueryCacheObjectsIterator(res.iterator(), idx.objectContext(), cctx.keepBinary());
+ return new GridQueryCacheObjectsIterator(res.iterator(), idx.objectContext(), true);
}
catch (IgniteCheckedException e) {
throw new IgniteException(e);
http://git-wip-us.apache.org/repos/asf/ignite/blob/c45de168/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 1e19954..bd611f6 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
@@ -62,6 +62,7 @@ import org.apache.ignite.internal.jdbc2.JdbcSqlFieldsQuery;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheEntryImpl;
import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.CacheObjectUtils;
import org.apache.ignite.internal.processors.cache.CacheObjectValueContext;
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
import org.apache.ignite.internal.processors.cache.GridCacheAffinityManager;
@@ -398,35 +399,10 @@ public class IgniteH2Indexing implements GridQueryIndexing {
}
/** {@inheritDoc} */
- @Override public PreparedStatement prepareNativeStatement(String cacheName, String sql) throws SQLException {
- String schemaName = schema(cacheName);
-
- return prepareStatement(connectionForSchema(schemaName), sql, true);
- }
-
- /** {@inheritDoc} */
- @SuppressWarnings("unchecked")
- @Override public IgniteDataStreamer<?, ?> createStreamer(String cacheName, PreparedStatement nativeStmt,
- long autoFlushFreq, int nodeBufSize, int nodeParOps, boolean allowOverwrite) {
- Prepared prep = GridSqlQueryParser.prepared(nativeStmt);
-
- if (!(prep instanceof Insert))
- throw new IgniteSQLException("Only INSERT operations are supported in streaming mode",
- IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
-
- IgniteDataStreamer streamer = ctx.grid().dataStreamer(cacheName);
-
- streamer.autoFlushFrequency(autoFlushFreq);
-
- streamer.allowOverwrite(allowOverwrite);
-
- if (nodeBufSize > 0)
- streamer.perNodeBufferSize(nodeBufSize);
-
- if (nodeParOps > 0)
- streamer.perNodeParallelOperations(nodeParOps);
+ @Override public PreparedStatement prepareNativeStatement(String schemaName, String sql) throws SQLException {
+ Connection conn = connectionForSchema(schemaName);
- return streamer;
+ return prepareStatement(conn, sql, true);
}
/**
@@ -564,7 +540,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
GridCacheVersion ver,
long expirationTime,
long link) throws IgniteCheckedException {
- H2TableDescriptor tbl = tableDescriptor(type.name(), cacheName);
+ H2TableDescriptor tbl = tableDescriptor(schema(cacheName), type.name());
if (tbl == null)
return; // Type was rejected.
@@ -588,7 +564,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
if (log.isDebugEnabled())
log.debug("Removing key from cache query index [locId=" + nodeId + ", key=" + key + ", val=" + val + ']');
- H2TableDescriptor tbl = tableDescriptor(type.name(), cacheName);
+ H2TableDescriptor tbl = tableDescriptor(schema(cacheName), type.name());
if (tbl == null)
return;
@@ -782,13 +758,12 @@ public class IgniteH2Indexing implements GridQueryIndexing {
}
@SuppressWarnings("unchecked")
- @Override public <K, V> GridCloseableIterator<IgniteBiTuple<K, V>> queryLocalText(
- String cacheName, String qry, String typeName,
- IndexingQueryFilter filters) throws IgniteCheckedException {
- H2TableDescriptor tbl = tableDescriptor(typeName, cacheName);
+ @Override public <K, V> GridCloseableIterator<IgniteBiTuple<K, V>> queryLocalText(String schemaName, String qry,
+ String typeName, IndexingQueryFilter filters) throws IgniteCheckedException {
+ H2TableDescriptor tbl = tableDescriptor(schemaName, typeName);
if (tbl != null && tbl.luceneIndex() != null) {
- GridRunningQueryInfo run = new GridRunningQueryInfo(qryIdGen.incrementAndGet(), qry, TEXT, cacheName,
+ GridRunningQueryInfo run = new GridRunningQueryInfo(qryIdGen.incrementAndGet(), qry, TEXT, schemaName,
U.currentTimeMillis(), null, true);
try {
@@ -805,9 +780,9 @@ public class IgniteH2Indexing implements GridQueryIndexing {
}
/** {@inheritDoc} */
- @Override public void unregisterType(String cacheName, String typeName)
+ @Override public void unregisterType(String schemaName, String typeName)
throws IgniteCheckedException {
- H2TableDescriptor tbl = tableDescriptor(typeName, cacheName);
+ H2TableDescriptor tbl = tableDescriptor(schemaName, typeName);
if (tbl != null)
removeTable(tbl);
@@ -816,7 +791,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
/**
* Queries individual fields (generally used by JDBC drivers).
*
- * @param cacheName Cache name.
+ * @param schemaName Schema name.
* @param qry Query.
* @param params Query parameters.
* @param filter Cache name and key filter.
@@ -827,12 +802,10 @@ public class IgniteH2Indexing implements GridQueryIndexing {
* @throws IgniteCheckedException If failed.
*/
@SuppressWarnings("unchecked")
- public GridQueryFieldsResult queryLocalSqlFields(final String cacheName, final String qry,
+ public GridQueryFieldsResult queryLocalSqlFields(final String schemaName, final String qry,
@Nullable final Collection<Object> params, final IndexingQueryFilter filter, boolean enforceJoinOrder,
final int timeout, final GridQueryCancel cancel) throws IgniteCheckedException {
- final String schema = schema(cacheName);
-
- final Connection conn = connectionForSchema(schema);
+ final Connection conn = connectionForSchema(schemaName);
H2Utils.setupConnection(conn, false, enforceJoinOrder);
@@ -849,7 +822,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
fldsQry.setEnforceJoinOrder(enforceJoinOrder);
fldsQry.setTimeout(timeout, TimeUnit.MILLISECONDS);
- return dmlProc.updateSqlFieldsLocal(schema, stmt, fldsQry, filter, cancel);
+ return dmlProc.updateSqlFieldsLocal(schemaName, stmt, fldsQry, filter, cancel);
}
else if (DdlStatementsProcessor.isDdlStatement(p))
throw new IgniteSQLException("DDL statements are supported for the whole cluster only",
@@ -874,12 +847,12 @@ public class IgniteH2Indexing implements GridQueryIndexing {
GridH2QueryContext.set(ctx);
GridRunningQueryInfo run = new GridRunningQueryInfo(qryIdGen.incrementAndGet(), qry, SQL_FIELDS,
- cacheName, U.currentTimeMillis(), cancel, true);
+ schemaName, U.currentTimeMillis(), cancel, true);
runs.putIfAbsent(run.id(), run);
try {
- ResultSet rs = executeSqlQueryWithTimer(schema, stmt, conn, qry, params, timeout, cancel);
+ ResultSet rs = executeSqlQueryWithTimer(schemaName, stmt, conn, qry, params, timeout, cancel);
return new H2FieldsIterator(rs);
}
@@ -893,10 +866,8 @@ public class IgniteH2Indexing implements GridQueryIndexing {
}
/** {@inheritDoc} */
- @Override public long streamUpdateQuery(String cacheName, String qry,
+ @Override public long streamUpdateQuery(String schemaName, String qry,
@Nullable Object[] params, IgniteDataStreamer<?, ?> streamer) throws IgniteCheckedException {
- String schemaName = schema(cacheName);
-
final Connection conn = connectionForSchema(schemaName);
final PreparedStatement stmt;
@@ -1074,97 +1045,76 @@ public class IgniteH2Indexing implements GridQueryIndexing {
}
/** {@inheritDoc} */
- @Override public FieldsQueryCursor<List<?>> queryLocalSqlFields(final GridCacheContext<?, ?> cctx,
- final SqlFieldsQuery qry, final boolean keepBinary, final IndexingQueryFilter filter,
- final GridQueryCancel cancel) throws IgniteCheckedException {
-
- if (cctx.config().getQueryParallelism() > 1) {
- qry.setDistributedJoins(true);
+ @Override public FieldsQueryCursor<List<?>> queryLocalSqlFields(String schemaName, SqlFieldsQuery qry,
+ final boolean keepBinary, IndexingQueryFilter filter, GridQueryCancel cancel) throws IgniteCheckedException {
+ String sql = qry.getSql();
+ Object[] args = qry.getArgs();
- assert qry.isLocal();
+ final GridQueryFieldsResult res = queryLocalSqlFields(schemaName, sql, F.asList(args), filter,
+ qry.isEnforceJoinOrder(), qry.getTimeout(), cancel);
- return queryDistributedSqlFields(cctx, qry, keepBinary, cancel);
- }
- else {
- final String cacheName = cctx.name();
- final String sql = qry.getSql();
- final Object[] args = qry.getArgs();
-
- final GridQueryFieldsResult res = queryLocalSqlFields(cacheName, sql, F.asList(args), filter,
- qry.isEnforceJoinOrder(), qry.getTimeout(), cancel);
-
- QueryCursorImpl<List<?>> cursor = new QueryCursorImpl<>(new Iterable<List<?>>() {
- @Override public Iterator<List<?>> iterator() {
- try {
- return new GridQueryCacheObjectsIterator(res.iterator(), objectContext(), keepBinary);
- }
- catch (IgniteCheckedException e) {
- throw new IgniteException(e);
- }
+ QueryCursorImpl<List<?>> cursor = new QueryCursorImpl<>(new Iterable<List<?>>() {
+ @Override public Iterator<List<?>> iterator() {
+ try {
+ return new GridQueryCacheObjectsIterator(res.iterator(), objectContext(), keepBinary);
+ }
+ catch (IgniteCheckedException e) {
+ throw new IgniteException(e);
}
- }, cancel);
+ }
+ }, cancel);
- cursor.fieldsMeta(res.metaData());
+ cursor.fieldsMeta(res.metaData());
- return cursor;
- }
+ return cursor;
}
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
- @Override public <K, V> QueryCursor<Cache.Entry<K,V>> queryLocalSql(final GridCacheContext<?, ?> cctx,
+ @Override public <K, V> QueryCursor<Cache.Entry<K,V>> queryLocalSql(String schemaName,
final SqlQuery qry, final IndexingQueryFilter filter, final boolean keepBinary) throws IgniteCheckedException {
- if (cctx.config().getQueryParallelism() > 1) {
- qry.setDistributedJoins(true);
+ String type = qry.getType();
+ String sqlQry = qry.getSql();
+ String alias = qry.getAlias();
+ Object[] params = qry.getArgs();
- assert qry.isLocal();
+ GridQueryCancel cancel = new GridQueryCancel();
- return queryDistributedSql(cctx, qry, keepBinary);
- }
- else {
- String cacheName = cctx.name();
- String type = qry.getType();
- String sqlQry = qry.getSql();
- String alias = qry.getAlias();
- Object[] params = qry.getArgs();
-
- GridQueryCancel cancel = new GridQueryCancel();
-
- final GridCloseableIterator<IgniteBiTuple<K, V>> i = queryLocalSql(cacheName, sqlQry, alias,
- F.asList(params), type, filter, cancel);
-
- return new QueryCursorImpl<>(new Iterable<Cache.Entry<K, V>>() {
- @Override public Iterator<Cache.Entry<K, V>> iterator() {
- return new ClIter<Cache.Entry<K, V>>() {
- @Override public void close() throws Exception {
- i.close();
- }
+ final GridCloseableIterator<IgniteBiTuple<K, V>> i = queryLocalSql(schemaName, sqlQry, alias,
+ F.asList(params), type, filter, cancel);
- @Override public boolean hasNext() {
- return i.hasNext();
- }
+ return new QueryCursorImpl<>(new Iterable<Cache.Entry<K, V>>() {
+ @Override public Iterator<Cache.Entry<K, V>> iterator() {
+ return new ClIter<Cache.Entry<K, V>>() {
+ @Override public void close() throws Exception {
+ i.close();
+ }
- @Override public Cache.Entry<K, V> next() {
- IgniteBiTuple<K, V> t = i.next();
+ @Override public boolean hasNext() {
+ return i.hasNext();
+ }
- return new CacheEntryImpl<>(
- (K)cctx.unwrapBinaryIfNeeded(t.get1(), keepBinary, false),
- (V)cctx.unwrapBinaryIfNeeded(t.get2(), keepBinary, false));
- }
+ @Override public Cache.Entry<K, V> next() {
+ IgniteBiTuple<K, V> t = i.next();
- @Override public void remove() {
- throw new UnsupportedOperationException();
- }
- };
- }
- }, cancel);
- }
+ K key = (K)CacheObjectUtils.unwrapBinaryIfNeeded(objectContext(), t.get1(), keepBinary, false);
+ V val = (V)CacheObjectUtils.unwrapBinaryIfNeeded(objectContext(), t.get2(), keepBinary, false);
+
+ return new CacheEntryImpl<>(key, val);
+ }
+
+ @Override public void remove() {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
+ }, cancel);
}
/**
* Executes regular query.
*
- * @param cacheName Cache name.
+ * @param schemaName Schema name.
* @param qry Query.
* @param alias Table alias.
* @param params Query parameters.
@@ -1174,10 +1124,10 @@ public class IgniteH2Indexing implements GridQueryIndexing {
* @throws IgniteCheckedException If failed.
*/
@SuppressWarnings("unchecked")
- public <K, V> GridCloseableIterator<IgniteBiTuple<K, V>> queryLocalSql(String cacheName,
+ public <K, V> GridCloseableIterator<IgniteBiTuple<K, V>> queryLocalSql(String schemaName,
final String qry, String alias, @Nullable final Collection<Object> params, String type,
final IndexingQueryFilter filter, GridQueryCancel cancel) throws IgniteCheckedException {
- final H2TableDescriptor tbl = tableDescriptor(type, cacheName);
+ final H2TableDescriptor tbl = tableDescriptor(schemaName, type);
if (tbl == null)
throw new IgniteSQLException("Failed to find SQL table for type: " + type,
@@ -1192,13 +1142,13 @@ public class IgniteH2Indexing implements GridQueryIndexing {
GridH2QueryContext.set(new GridH2QueryContext(nodeId, nodeId, 0, LOCAL).filter(filter)
.distributedJoinMode(OFF));
- GridRunningQueryInfo run = new GridRunningQueryInfo(qryIdGen.incrementAndGet(), qry, SQL, cacheName,
+ GridRunningQueryInfo run = new GridRunningQueryInfo(qryIdGen.incrementAndGet(), qry, SQL, schemaName,
U.currentTimeMillis(), null, true);
runs.put(run.id(), run);
try {
- ResultSet rs = executeSqlQueryWithTimer(schema(cacheName), conn, sql, params, true, 0, cancel);
+ ResultSet rs = executeSqlQueryWithTimer(schemaName, conn, sql, params, true, 0, cancel);
return new H2KeyValueIterator(rs);
}
@@ -1237,12 +1187,11 @@ public class IgniteH2Indexing implements GridQueryIndexing {
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
- @Override public <K, V> QueryCursor<Cache.Entry<K, V>> queryDistributedSql(GridCacheContext<?, ?> cctx,
- SqlQuery qry, boolean keepBinary) {
+ @Override public <K, V> QueryCursor<Cache.Entry<K, V>> queryDistributedSql(String schemaName, SqlQuery qry,
+ boolean keepBinary, int mainCacheId) {
String type = qry.getType();
- String cacheName = cctx.name();
- H2TableDescriptor tblDesc = tableDescriptor(type, cacheName);
+ H2TableDescriptor tblDesc = tableDescriptor(schemaName, type);
if (tblDesc == null)
throw new IgniteSQLException("Failed to find SQL table for type: " + type,
@@ -1268,7 +1217,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
if (qry.getTimeout() > 0)
fqry.setTimeout(qry.getTimeout(), TimeUnit.MILLISECONDS);
- final QueryCursor<List<?>> res = queryDistributedSqlFields(cctx, fqry, keepBinary, null);
+ final QueryCursor<List<?>> res = queryDistributedSqlFields(schemaName, fqry, keepBinary, null, mainCacheId);
final Iterable<Cache.Entry<K, V>> converted = new Iterable<Cache.Entry<K, V>>() {
@Override public Iterator<Cache.Entry<K, V>> iterator() {
@@ -1301,12 +1250,10 @@ public class IgniteH2Indexing implements GridQueryIndexing {
}
/** {@inheritDoc} */
- @Override public FieldsQueryCursor<List<?>> queryDistributedSqlFields(GridCacheContext<?, ?> cctx,
- SqlFieldsQuery qry, boolean keepBinary, GridQueryCancel cancel) {
+ @Override public FieldsQueryCursor<List<?>> queryDistributedSqlFields(String schemaName,
+ SqlFieldsQuery qry, boolean keepBinary, GridQueryCancel cancel, @Nullable Integer mainCacheId) {
final String sqlQry = qry.getSql();
- String schemaName = schema(cctx.name());
-
Connection c = connectionForSchema(schemaName);
final boolean enforceJoinOrder = qry.isEnforceJoinOrder();
@@ -1413,14 +1360,14 @@ public class IgniteH2Indexing implements GridQueryIndexing {
LinkedHashSet<Integer> caches0 = new LinkedHashSet<>();
- // Setup caches from schemas.
assert twoStepQry != null;
int tblCnt = twoStepQry.tablesCount();
- if (tblCnt > 0) {
- caches0.add(cctx.cacheId());
+ if (mainCacheId != null)
+ caches0.add(mainCacheId);
+ if (tblCnt > 0) {
for (QueryTable tblKey : twoStepQry.tables()) {
GridH2Table tbl = dataTable(tblKey);
@@ -1429,8 +1376,9 @@ public class IgniteH2Indexing implements GridQueryIndexing {
caches0.add(cacheId);
}
}
- else
- caches0.add(cctx.cacheId());
+
+ if (caches0.isEmpty())
+ throw new IgniteSQLException("Failed to find at least one cache for SQL statement: " + sqlQry);
//Prohibit usage indices with different numbers of segments in same query.
List<Integer> cacheIds = new ArrayList<>(caches0);
@@ -1470,6 +1418,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
if (cachedQry == null && !twoStepQry.explain()) {
cachedQry = new H2TwoStepCachedQuery(meta, twoStepQry.copy());
+
twoStepCache.putIfAbsent(cachedQryKey, cachedQry);
}
@@ -1732,30 +1681,24 @@ public class IgniteH2Indexing implements GridQueryIndexing {
}
/**
- * Gets table descriptor by type and cache names.
+ * Get table descriptor.
*
+ * @param schemaName Schema name.
* @param type Type name.
- * @param cacheName Cache name.
- * @return Table descriptor.
+ * @return Descriptor.
*/
- @Nullable private H2TableDescriptor tableDescriptor(String type, String cacheName) {
- String schemaName = schema(cacheName);
-
+ @Nullable private H2TableDescriptor tableDescriptor(String schemaName, String type) {
H2Schema schema = schemas.get(schemaName);
if (schema == null)
return null;
return schema.tableByTypeName(type);
- }
+ };
- /**
- * Gets database schema from cache name.
- *
- * @param cacheName Cache name. {@code null} would be converted to an empty string.
- * @return Schema name. Should not be null since we should not fail for an invalid cache name.
- */
- public String schema(String cacheName) {
+
+ /** {@inheritDoc} */
+ @Override public String schema(String cacheName) {
String res = cacheName2schema.get(cacheName);
if (res == null)
@@ -1764,6 +1707,13 @@ public class IgniteH2Indexing implements GridQueryIndexing {
return res;
}
+ /** {@inheritDoc} */
+ @Override public boolean isInsertStatement(PreparedStatement nativeStmt) {
+ Prepared prep = GridSqlQueryParser.prepared(nativeStmt);
+
+ return prep instanceof Insert;
+ }
+
/**
* Called periodically by {@link GridTimeoutProcessor} to clean up the {@link #stmtCache}.
*/
@@ -1792,17 +1742,11 @@ public class IgniteH2Indexing implements GridQueryIndexing {
return schema.cacheName();
}
- /**
- * Rebuild indexes from hash index.
- *
- * @param cacheName Cache name.
- * @param type Type descriptor.
- * @throws IgniteCheckedException If failed.
- */
+ /** {@inheritDoc} */
@SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter")
- @Override public void rebuildIndexesFromHash(String cacheName,
- GridQueryTypeDescriptor type) throws IgniteCheckedException {
- H2TableDescriptor tbl = tableDescriptor(type.name(), cacheName);
+ @Override public void rebuildIndexesFromHash(GridCacheContext cctx, String schemaName, String typeName)
+ throws IgniteCheckedException {
+ H2TableDescriptor tbl = tableDescriptor(schemaName, typeName);
if (tbl == null)
return;
@@ -1815,10 +1759,6 @@ public class IgniteH2Indexing implements GridQueryIndexing {
Cursor cursor = hashIdx.find((Session)null, null, null);
- int cacheId = CU.cacheId(cacheName);
-
- GridCacheContext cctx = ctx.cache().context().cacheContext(cacheId);
-
while (cursor.next()) {
CacheDataRow dataRow = (CacheDataRow)cursor.get();
@@ -1859,8 +1799,8 @@ public class IgniteH2Indexing implements GridQueryIndexing {
}
/** {@inheritDoc} */
- @Override public void markForRebuildFromHash(String cacheName, GridQueryTypeDescriptor type) {
- H2TableDescriptor tbl = tableDescriptor(type.name(), cacheName);
+ @Override public void markForRebuildFromHash(String schemaName, String typeName) {
+ H2TableDescriptor tbl = tableDescriptor(schemaName, typeName);
if (tbl == null)
return;
@@ -1871,40 +1811,6 @@ public class IgniteH2Indexing implements GridQueryIndexing {
}
/**
- * Gets size (for tests only).
- *
- * @param cacheName Cache name.
- * @param typeName Type name.
- * @return Size.
- * @throws IgniteCheckedException If failed or {@code -1} if the type is unknown.
- */
- long size(String cacheName, String typeName) throws IgniteCheckedException {
- String schemaName = schema(cacheName);
-
- H2TableDescriptor tbl = tableDescriptor(typeName, cacheName);
-
- if (tbl == null)
- return -1;
-
- Connection conn = connectionForSchema(schemaName);
-
- H2Utils.setupConnection(conn, false, false);
-
- try {
- ResultSet rs = executeSqlQuery(conn, prepareStatement(conn, "SELECT COUNT(*) FROM " + tbl.fullTableName(),
- false), 0, null);
-
- if (!rs.next())
- throw new IllegalStateException();
-
- return rs.getLong(1);
- }
- catch (SQLException e) {
- throw new IgniteCheckedException(e);
- }
- }
-
- /**
* @return Busy lock.
*/
public GridSpinBusyLock busyLock() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/c45de168/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
index 73a7191..7b0cbf8 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
@@ -247,33 +247,25 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
public void testSpi() throws Exception {
IgniteH2Indexing spi = getIndexing();
- assertEquals(-1, spi.size(typeAA.cacheName(), typeAA.name()));
- assertEquals(-1, spi.size(typeAB.cacheName(), typeAB.name()));
- assertEquals(-1, spi.size(typeBA.cacheName(), typeBA.name()));
-
IgniteCache<Integer, BinaryObject> cacheA = ignite0.createCache(cacheACfg());
- assertEquals(0, spi.size(typeAA.cacheName(), typeAA.name()));
- assertEquals(0, spi.size(typeAB.cacheName(), typeAB.name()));
- assertEquals(-1, spi.size(typeBA.cacheName(), typeBA.name()));
-
IgniteCache<Integer, BinaryObject> cacheB = ignite0.createCache(cacheBCfg());
- // Initially all is empty.
- assertEquals(0, spi.size(typeAA.cacheName(), typeAA.name()));
- assertEquals(0, spi.size(typeAB.cacheName(), typeAB.name()));
- assertEquals(0, spi.size(typeBA.cacheName(), typeBA.name()));
+ assertFalse(spi.queryLocalSql(spi.schema(typeAA.cacheName()), "select * from A.A", null, Collections.emptySet(),
+ typeAA.name(), null, null).hasNext());
- assertFalse(spi.queryLocalSql(typeAA.cacheName(), "select * from A.A", null, Collections.emptySet(), typeAA.name(), null, null).hasNext());
- assertFalse(spi.queryLocalSql(typeAB.cacheName(), "select * from A.B", null, Collections.emptySet(), typeAB.name(), null, null).hasNext());
- assertFalse(spi.queryLocalSql(typeBA.cacheName(), "select * from B.A", null, Collections.emptySet(), typeBA.name(), null, null).hasNext());
+ assertFalse(spi.queryLocalSql(spi.schema(typeAB.cacheName()), "select * from A.B", null, Collections.emptySet(),
+ typeAB.name(), null, null).hasNext());
- assertFalse(spi.queryLocalSql(typeBA.cacheName(), "select * from B.A, A.B, A.A", null,
+ assertFalse(spi.queryLocalSql(spi.schema(typeBA.cacheName()), "select * from B.A", null, Collections.emptySet(),
+ typeBA.name(), null, null).hasNext());
+
+ assertFalse(spi.queryLocalSql(spi.schema(typeBA.cacheName()), "select * from B.A, A.B, A.A", null,
Collections.emptySet(), typeBA.name(), null, null).hasNext());
try {
- spi.queryLocalSql(typeBA.cacheName(), "select aa.*, ab.*, ba.* from A.A aa, A.B ab, B.A ba", null,
- Collections.emptySet(), typeBA.name(), null, null).hasNext();
+ spi.queryLocalSql(spi.schema(typeBA.cacheName()), "select aa.*, ab.*, ba.* from A.A aa, A.B ab, B.A ba",
+ null, Collections.emptySet(), typeBA.name(), null, null).hasNext();
fail("Enumerations of aliases in select block must be prohibited");
}
@@ -281,60 +273,23 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
// all fine
}
- assertFalse(spi.queryLocalSql(typeAB.cacheName(), "select ab.* from A.B ab", null,
+ assertFalse(spi.queryLocalSql(spi.schema(typeAB.cacheName()), "select ab.* from A.B ab", null,
Collections.emptySet(), typeAB.name(), null, null).hasNext());
- assertFalse(spi.queryLocalSql(typeBA.cacheName(), "select ba.* from B.A as ba", null,
+ assertFalse(spi.queryLocalSql(spi.schema(typeBA.cacheName()), "select ba.* from B.A as ba", null,
Collections.emptySet(), typeBA.name(), null, null).hasNext());
cacheA.put(1, aa("A", 1, "Vasya", 10).build());
-
- assertEquals(1, spi.size(typeAA.cacheName(), typeAA.name()));
- assertEquals(0, spi.size(typeAB.cacheName(), typeAB.name()));
- assertEquals(0, spi.size(typeBA.cacheName(), typeBA.name()));
-
cacheA.put(1, ab(1, "Vasya", 20, "Some text about Vasya goes here.").build());
-
- // In one cache all keys must be unique.
- assertEquals(0, spi.size(typeAA.cacheName(), typeAA.name()));
- assertEquals(1, spi.size(typeAB.cacheName(), typeAB.name()));
- assertEquals(0, spi.size(typeBA.cacheName(), typeBA.name()));
-
cacheB.put(1, ba(2, "Petya", 25, true).build());
-
- // No replacement because of different cache.
- assertEquals(0, spi.size(typeAA.cacheName(), typeAA.name()));
- assertEquals(1, spi.size(typeAB.cacheName(), typeAB.name()));
- assertEquals(1, spi.size(typeBA.cacheName(), typeBA.name()));
-
cacheB.put(1, ba(2, "Kolya", 25, true).build());
-
- // Replacement in the same table.
- assertEquals(0, spi.size(typeAA.cacheName(), typeAA.name()));
- assertEquals(1, spi.size(typeAB.cacheName(), typeAB.name()));
- assertEquals(1, spi.size(typeBA.cacheName(), typeBA.name()));
-
cacheA.put(2, aa("A", 2, "Valera", 19).build());
-
- assertEquals(1, spi.size(typeAA.cacheName(), typeAA.name()));
- assertEquals(1, spi.size(typeAB.cacheName(), typeAB.name()));
- assertEquals(1, spi.size(typeBA.cacheName(), typeBA.name()));
-
cacheA.put(3, aa("A", 3, "Borya", 18).build());
-
- assertEquals(2, spi.size(typeAA.cacheName(), typeAA.name()));
- assertEquals(1, spi.size(typeAB.cacheName(), typeAB.name()));
- assertEquals(1, spi.size(typeBA.cacheName(), typeBA.name()));
-
cacheA.put(4, ab(4, "Vitalya", 20, "Very Good guy").build());
- assertEquals(2, spi.size(typeAA.cacheName(), typeAA.name()));
- assertEquals(2, spi.size(typeAB.cacheName(), typeAB.name()));
- assertEquals(1, spi.size(typeBA.cacheName(), typeBA.name()));
-
// Query data.
- Iterator<IgniteBiTuple<Integer, BinaryObjectImpl>> res =
- spi.queryLocalSql(typeAA.cacheName(), "from a order by age", null, Collections.emptySet(), typeAA.name(), null, null);
+ Iterator<IgniteBiTuple<Integer, BinaryObjectImpl>> res = spi.queryLocalSql(spi.schema(typeAA.cacheName()),
+ "from a order by age", null, Collections.emptySet(), typeAA.name(), null, null);
assertTrue(res.hasNext());
assertEquals(aa("A", 3, "Borya", 18).build(), value(res.next()));
@@ -342,7 +297,7 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
assertEquals(aa("A", 2, "Valera", 19).build(), value(res.next()));
assertFalse(res.hasNext());
- res = spi.queryLocalSql(typeAA.cacheName(), "select aa.* from a aa order by aa.age", null,
+ res = spi.queryLocalSql(spi.schema(typeAA.cacheName()), "select aa.* from a aa order by aa.age", null,
Collections.emptySet(), typeAA.name(), null, null);
assertTrue(res.hasNext());
@@ -351,7 +306,8 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
assertEquals(aa("A", 2, "Valera", 19).build(), value(res.next()));
assertFalse(res.hasNext());
- res = spi.queryLocalSql(typeAB.cacheName(), "from b order by name", null, Collections.emptySet(), typeAB.name(), null, null);
+ res = spi.queryLocalSql(spi.schema(typeAB.cacheName()), "from b order by name", null, Collections.emptySet(),
+ typeAB.name(), null, null);
assertTrue(res.hasNext());
assertEquals(ab(1, "Vasya", 20, "Some text about Vasya goes here.").build(), value(res.next()));
@@ -359,7 +315,7 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
assertEquals(ab(4, "Vitalya", 20, "Very Good guy").build(), value(res.next()));
assertFalse(res.hasNext());
- res = spi.queryLocalSql(typeAB.cacheName(), "select bb.* from b as bb order by bb.name", null,
+ res = spi.queryLocalSql(spi.schema(typeAB.cacheName()), "select bb.* from b as bb order by bb.name", null,
Collections.emptySet(), typeAB.name(), null, null);
assertTrue(res.hasNext());
@@ -368,16 +324,16 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
assertEquals(ab(4, "Vitalya", 20, "Very Good guy").build(), value(res.next()));
assertFalse(res.hasNext());
-
- res = spi.queryLocalSql(typeBA.cacheName(), "from a", null, Collections.emptySet(), typeBA.name(), null, null);
+ res = spi.queryLocalSql(spi.schema(typeBA.cacheName()), "from a", null, Collections.emptySet(), typeBA.name(),
+ null, null);
assertTrue(res.hasNext());
assertEquals(ba(2, "Kolya", 25, true).build(), value(res.next()));
assertFalse(res.hasNext());
// Text queries
- Iterator<IgniteBiTuple<Integer, BinaryObjectImpl>> txtRes = spi.queryLocalText(typeAB.cacheName(), "good",
- typeAB.name(), null);
+ Iterator<IgniteBiTuple<Integer, BinaryObjectImpl>> txtRes = spi.queryLocalText(spi.schema(typeAB.cacheName()),
+ "good", typeAB.name(), null);
assertTrue(txtRes.hasNext());
assertEquals(ab(4, "Vitalya", 20, "Very Good guy").build(), value(txtRes.next()));
@@ -385,7 +341,7 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
// Fields query
GridQueryFieldsResult fieldsRes =
- spi.queryLocalSqlFields("A", "select a.a.name n1, a.a.age a1, b.a.name n2, " +
+ spi.queryLocalSqlFields(spi.schema("A"), "select a.a.name n1, a.a.age a1, b.a.name n2, " +
"b.a.age a2 from a.a, b.a where a.a.id = b.a.id ", Collections.emptySet(), null, false, 0, null);
String[] aliases = {"N1", "A1", "N2", "A2"};
@@ -410,33 +366,12 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
// Remove
cacheA.remove(2);
-
- assertEquals(1, spi.size(typeAA.cacheName(), typeAA.name()));
- assertEquals(2, spi.size(typeAB.cacheName(), typeAB.name()));
- assertEquals(1, spi.size(typeBA.cacheName(), typeBA.name()));
-
cacheB.remove(1);
- assertEquals(1, spi.size(typeAA.cacheName(), typeAA.name()));
- assertEquals(2, spi.size(typeAB.cacheName(), typeAB.name()));
- assertEquals(0, spi.size(typeBA.cacheName(), typeBA.name()));
-
// Unregister.
- spi.unregisterType(typeAA.cacheName(), typeAA.name());
-
- assertEquals(-1, spi.size(typeAA.cacheName(), typeAA.name()));
- assertEquals(2, spi.size(typeAB.cacheName(), typeAB.name()));
- assertEquals(0, spi.size(typeBA.cacheName(), typeBA.name()));
-
- spi.unregisterType(typeAB.cacheName(), typeAB.name());
-
- assertEquals(-1, spi.size(typeAA.cacheName(), typeAA.name()));
- assertEquals(-1, spi.size(typeAB.cacheName(), typeAB.name()));
- assertEquals(0, spi.size(typeBA.cacheName(), typeBA.name()));
-
- spi.unregisterType(typeBA.cacheName(), typeBA.name());
-
- assertEquals(-1, spi.size(typeAA.cacheName(), typeAA.name()));
+ spi.unregisterType(spi.schema(typeAA.cacheName()), typeAA.name());
+ spi.unregisterType(spi.schema(typeAB.cacheName()), typeAB.name());
+ spi.unregisterType(spi.schema(typeBA.cacheName()), typeBA.name());
}
/**
@@ -469,8 +404,8 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
time = now;
range *= 3;
- GridQueryFieldsResult res = spi.queryLocalSqlFields("A", sql, Arrays.<Object>asList(1, range),
- null, false, 0, null);
+ GridQueryFieldsResult res = spi.queryLocalSqlFields(spi.schema("A"), sql, Arrays.<Object>asList(1,
+ range), null, false, 0, null);
assert res.iterator().hasNext();
[02/13] ignite git commit: IGNITE-5273 .NET: MemoryMetrics API
improvements
Posted by sb...@apache.org.
IGNITE-5273 .NET: MemoryMetrics API improvements
This closes #2039
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6f8577f3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6f8577f3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6f8577f3
Branch: refs/heads/ignite-5075
Commit: 6f8577f34c6b9b9de21629bba30adbdac86d8126
Parents: 10a0a84
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed May 31 10:29:27 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Wed May 31 10:29:48 2017 +0300
----------------------------------------------------------------------
.../platform/cluster/PlatformClusterGroup.java | 45 +++++++++++++++++---
.../utils/PlatformConfigurationUtils.java | 6 ++-
.../Cache/MemoryMetricsTest.cs | 20 +++++++++
.../IgniteConfigurationSerializerTest.cs | 8 +++-
.../IgniteConfigurationTest.cs | 6 ++-
.../Configuration/MemoryPolicyConfiguration.cs | 45 +++++++++++++++++++-
.../dotnet/Apache.Ignite.Core/IIgnite.cs | 9 ++++
.../IgniteConfigurationSection.xsd | 10 +++++
.../Impl/Cluster/ClusterGroupImpl.cs | 12 ++++++
.../dotnet/Apache.Ignite.Core/Impl/Ignite.cs | 8 ++++
10 files changed, 158 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f8577f3/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java
index 5a5ebfd..cd8d9b8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java
@@ -25,6 +25,7 @@ import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteCluster;
import org.apache.ignite.MemoryMetrics;
+import org.apache.ignite.binary.BinaryRawWriter;
import org.apache.ignite.cluster.ClusterMetrics;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.cluster.ClusterGroupEx;
@@ -112,6 +113,9 @@ public class PlatformClusterGroup extends PlatformAbstractTarget {
/** */
private static final int OP_MEMORY_METRICS = 26;
+ /** */
+ private static final int OP_MEMORY_METRICS_BY_NAME = 27;
+
/** Projection. */
private final ClusterGroupEx prj;
@@ -142,12 +146,7 @@ public class PlatformClusterGroup extends PlatformAbstractTarget {
writer.writeInt(metrics.size());
for (MemoryMetrics m : metrics) {
- writer.writeString(m.getName());
- writer.writeLong(m.getTotalAllocatedPages());
- writer.writeFloat(m.getAllocationRate());
- writer.writeFloat(m.getEvictionRate());
- writer.writeFloat(m.getLargeEntriesPagesPercentage());
- writer.writeFloat(m.getPagesFillFactor());
+ writeMemoryMetrics(writer, m);
}
break;
@@ -236,6 +235,22 @@ public class PlatformClusterGroup extends PlatformAbstractTarget {
break;
}
+ case OP_MEMORY_METRICS_BY_NAME: {
+ String plcName = reader.readString();
+
+ MemoryMetrics metrics = platformCtx.kernalContext().grid().memoryMetrics(plcName);
+
+ if (metrics != null) {
+ writer.writeBoolean(true);
+ writeMemoryMetrics(writer, metrics);
+ }
+ else {
+ writer.writeBoolean(false);
+ }
+
+ break;
+ }
+
default:
super.processInStreamOutStream(type, reader, writer);
}
@@ -399,4 +414,22 @@ public class PlatformClusterGroup extends PlatformAbstractTarget {
return ((IgniteCluster)prj).topology(topVer);
}
+
+ /**
+ * Writes the memory metrics.
+ *
+ * @param writer Writer.
+ * @param metrics Metrics.
+ */
+ private static void writeMemoryMetrics(BinaryRawWriter writer, MemoryMetrics metrics) {
+ assert writer != null;
+ assert metrics != null;
+
+ writer.writeString(metrics.getName());
+ writer.writeLong(metrics.getTotalAllocatedPages());
+ writer.writeFloat(metrics.getAllocationRate());
+ writer.writeFloat(metrics.getEvictionRate());
+ writer.writeFloat(metrics.getLargeEntriesPagesPercentage());
+ writer.writeFloat(metrics.getPagesFillFactor());
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f8577f3/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
index 6ba88d9..dca6960 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
@@ -1351,7 +1351,9 @@ public class PlatformConfigurationUtils {
.setPageEvictionMode(DataPageEvictionMode.values()[in.readInt()])
.setEvictionThreshold(in.readDouble())
.setEmptyPagesPoolSize(in.readInt())
- .setMetricsEnabled(in.readBoolean());
+ .setMetricsEnabled(in.readBoolean())
+ .setSubIntervals(in.readInt())
+ .setRateTimeInterval((int) (in.readLong() / 1000));
plcs[i] = cfg;
}
@@ -1396,6 +1398,8 @@ public class PlatformConfigurationUtils {
w.writeDouble(plc.getEvictionThreshold());
w.writeInt(plc.getEmptyPagesPoolSize());
w.writeBoolean(plc.isMetricsEnabled());
+ w.writeInt(plc.getSubIntervals());
+ w.writeLong(plc.getRateTimeInterval() * 1000);
}
}
else {
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f8577f3/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/MemoryMetricsTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/MemoryMetricsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/MemoryMetricsTest.cs
index 0aba377..1aad823 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/MemoryMetricsTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/MemoryMetricsTest.cs
@@ -60,6 +60,26 @@ namespace Apache.Ignite.Core.Tests.Cache
var sysMetrics = metrics[2];
Assert.AreEqual("sysMemPlc", sysMetrics.Name);
AssertMetricsAreEmpty(sysMetrics);
+
+ // Metrics by name.
+ emptyMetrics = ignite.GetMemoryMetrics(MemoryPolicyNoMetrics);
+ Assert.AreEqual(MemoryPolicyNoMetrics, emptyMetrics.Name);
+ AssertMetricsAreEmpty(emptyMetrics);
+
+ memMetrics = ignite.GetMemoryMetrics(MemoryPolicyWithMetrics);
+ Assert.AreEqual(MemoryPolicyWithMetrics, memMetrics.Name);
+ Assert.Greater(memMetrics.AllocationRate, 0);
+ Assert.AreEqual(0, memMetrics.EvictionRate);
+ Assert.AreEqual(0, memMetrics.LargeEntriesPagesPercentage);
+ Assert.Greater(memMetrics.PageFillFactor, 0);
+ Assert.Greater(memMetrics.TotalAllocatedPages, 1000);
+
+ sysMetrics = ignite.GetMemoryMetrics("sysMemPlc");
+ Assert.AreEqual("sysMemPlc", sysMetrics.Name);
+ AssertMetricsAreEmpty(sysMetrics);
+
+ // Invalid name.
+ Assert.IsNull(ignite.GetMemoryMetrics("boo"));
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f8577f3/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
index a90eae5..c726f85 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
@@ -137,7 +137,7 @@ namespace Apache.Ignite.Core.Tests
<eventStorageSpi type='MemoryEventStorageSpi' expirationTimeout='00:00:23.45' maxEventCount='129' />
<memoryConfiguration concurrencyLevel='3' defaultMemoryPolicyName='dfPlc' pageSize='45' systemCacheInitialSize='67' systemCacheMaxSize='68'>
<memoryPolicies>
- <memoryPolicyConfiguration emptyPagesPoolSize='1' evictionThreshold='0.2' name='dfPlc' pageEvictionMode='RandomLru' initialSize='89' maxSize='98' swapFilePath='abc' metricsEnabled='true' />
+ <memoryPolicyConfiguration emptyPagesPoolSize='1' evictionThreshold='0.2' name='dfPlc' pageEvictionMode='RandomLru' initialSize='89' maxSize='98' swapFilePath='abc' metricsEnabled='true' rateTimeInterval='0:1:2' subIntervals='9' />
</memoryPolicies>
</memoryConfiguration>
</igniteConfig>";
@@ -274,6 +274,8 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(89, memPlc.InitialSize);
Assert.AreEqual(98, memPlc.MaxSize);
Assert.IsTrue(memPlc.MetricsEnabled);
+ Assert.AreEqual(9, memPlc.SubIntervals);
+ Assert.AreEqual(TimeSpan.FromSeconds(62), memPlc.RateTimeInterval);
Assert.AreEqual(PeerAssemblyLoadingMode.CurrentAppDomain, cfg.PeerAssemblyLoadingMode);
}
@@ -822,7 +824,9 @@ namespace Apache.Ignite.Core.Tests
MaxSize = 345 * 1024 * 1024,
EvictionThreshold = 0.88,
EmptyPagesPoolSize = 77,
- SwapFilePath = "myPath1"
+ SwapFilePath = "myPath1",
+ RateTimeInterval = TimeSpan.FromSeconds(22),
+ SubIntervals = 99
},
new MemoryPolicyConfiguration
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f8577f3/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
index ae82d8a..80b271d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
@@ -262,6 +262,8 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(MemoryPolicyConfiguration.DefaultEvictionThreshold, plc.EvictionThreshold);
Assert.AreEqual(MemoryPolicyConfiguration.DefaultInitialSize, plc.InitialSize);
Assert.AreEqual(MemoryPolicyConfiguration.DefaultMaxSize, plc.MaxSize);
+ Assert.AreEqual(MemoryPolicyConfiguration.DefaultSubIntervals, plc.SubIntervals);
+ Assert.AreEqual(MemoryPolicyConfiguration.DefaultRateTimeInterval, plc.RateTimeInterval);
}
}
@@ -598,7 +600,9 @@ namespace Apache.Ignite.Core.Tests
MaxSize = 345 * 1024 * 1024,
EvictionThreshold = 0.88,
EmptyPagesPoolSize = 77,
- SwapFilePath = "myPath1"
+ SwapFilePath = "myPath1",
+ RateTimeInterval = TimeSpan.FromSeconds(35),
+ SubIntervals = 7
},
new MemoryPolicyConfiguration
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f8577f3/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryPolicyConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryPolicyConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryPolicyConfiguration.cs
index 1db9ea9..c1fcaa2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryPolicyConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryPolicyConfiguration.cs
@@ -17,9 +17,12 @@
namespace Apache.Ignite.Core.Cache.Configuration
{
+ using System;
using System.ComponentModel;
+ using System.Diagnostics.CodeAnalysis;
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Impl;
+ using Apache.Ignite.Core.Impl.Binary;
/// <summary>
/// Defines page memory policy configuration. See <see cref="MemoryConfiguration.MemoryPolicies"/>.
@@ -47,6 +50,18 @@ namespace Apache.Ignite.Core.Cache.Configuration
public static readonly long DefaultMaxSize = (long) ((long) NativeMethods.GetTotalPhysicalMemory() * 0.8);
/// <summary>
+ /// The default sub intervals.
+ /// </summary>
+ [SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly",
+ Justification = "Consistency with Java config")]
+ public const int DefaultSubIntervals = 5;
+
+ /// <summary>
+ /// The default rate time interval.
+ /// </summary>
+ public static readonly TimeSpan DefaultRateTimeInterval = TimeSpan.FromSeconds(60);
+
+ /// <summary>
/// Initializes a new instance of the <see cref="MemoryPolicyConfiguration"/> class.
/// </summary>
public MemoryPolicyConfiguration()
@@ -56,6 +71,8 @@ namespace Apache.Ignite.Core.Cache.Configuration
Name = MemoryConfiguration.DefaultDefaultMemoryPolicyName;
InitialSize = DefaultInitialSize;
MaxSize = DefaultMaxSize;
+ SubIntervals = DefaultSubIntervals;
+ RateTimeInterval = DefaultRateTimeInterval;
}
/// <summary>
@@ -72,6 +89,8 @@ namespace Apache.Ignite.Core.Cache.Configuration
EvictionThreshold = reader.ReadDouble();
EmptyPagesPoolSize = reader.ReadInt();
MetricsEnabled = reader.ReadBoolean();
+ SubIntervals = reader.ReadInt();
+ RateTimeInterval = reader.ReadLongAsTimespan();
}
/// <summary>
@@ -87,6 +106,8 @@ namespace Apache.Ignite.Core.Cache.Configuration
writer.WriteDouble(EvictionThreshold);
writer.WriteInt(EmptyPagesPoolSize);
writer.WriteBoolean(MetricsEnabled);
+ writer.WriteInt(SubIntervals);
+ writer.WriteTimeSpanAsLong(RateTimeInterval);
}
/// <summary>
@@ -146,8 +167,30 @@ namespace Apache.Ignite.Core.Cache.Configuration
/// <summary>
/// Gets or sets a value indicating whether memory metrics should be enabled.
/// <para />
- /// Metrics can be retrieved with <see cref="IIgnite.GetMemoryMetrics"/> method.
+ /// Metrics can be retrieved with <see cref="IIgnite.GetMemoryMetrics()"/> method.
/// </summary>
public bool MetricsEnabled { get; set; }
+
+ /// <summary>
+ /// Gets or sets the rate time interval for <see cref="IMemoryMetrics.AllocationRate"/>
+ /// and <see cref="IMemoryMetrics.EvictionRate"/> monitoring purposes.
+ /// <para />
+ /// For instance, after setting the interval to 60 seconds, subsequent calls
+ /// to <see cref="IMemoryMetrics.AllocationRate"/> will return average allocation
+ /// rate (pages per second) for the last minute.
+ /// </summary>
+ [DefaultValue(typeof(TimeSpan), "00:01:00")]
+ public TimeSpan RateTimeInterval { get; set; }
+
+ /// <summary>
+ /// Gets or sets the number of sub intervals to split <see cref="RateTimeInterval"/> into to calculate
+ /// <see cref="IMemoryMetrics.AllocationRate"/> and <see cref="IMemoryMetrics.EvictionRate"/>.
+ /// <para />
+ /// Bigger value results in more accurate metrics.
+ /// </summary>
+ [DefaultValue(DefaultSubIntervals)]
+ [SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly",
+ Justification = "Consistency with Java config")]
+ public int SubIntervals { get; set; }
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f8577f3/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs
index 863952b..acf2064 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs
@@ -337,5 +337,14 @@ namespace Apache.Ignite.Core
/// Memory metrics should be enabled with <see cref="MemoryPolicyConfiguration.MetricsEnabled"/>.
/// </summary>
ICollection<IMemoryMetrics> GetMemoryMetrics();
+
+ /// <summary>
+ /// Gets the memory metrics for the specified memory policy.
+ /// <para />
+ /// To get metrics for the default memory region,
+ /// use <see cref="MemoryConfiguration.DefaultMemoryPolicyName"/>.
+ /// </summary>
+ /// <param name="memoryPolicyName">Name of the memory policy.</param>
+ IMemoryMetrics GetMemoryMetrics(string memoryPolicyName);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f8577f3/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
index bdfa8db..fae4ebb 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
@@ -1205,6 +1205,16 @@
<xs:documentation>Enable memory metrics.</xs:documentation>
</xs:annotation>
</xs:attribute>
+ <xs:attribute name="subIntervals" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Number of sub intervals to split RateTimeInterval into.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="rateTimeInterval" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Rate time interval for AllocationRate and EvictionRate monitoring.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f8577f3/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs
index ad180ee..d6947b2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs
@@ -121,6 +121,9 @@ namespace Apache.Ignite.Core.Impl.Cluster
/** */
private const int OpMemoryMetrics = 26;
+ /** */
+ private const int OpMemoryMetricsByName = 27;
+
/** Initial Ignite instance. */
private readonly Ignite _ignite;
@@ -578,6 +581,15 @@ namespace Apache.Ignite.Core.Impl.Cluster
}
/// <summary>
+ /// Gets the memory metrics.
+ /// </summary>
+ public IMemoryMetrics GetMemoryMetrics(string memoryPolicyName)
+ {
+ return DoOutInOp(OpMemoryMetricsByName, w => w.WriteString(memoryPolicyName),
+ stream => stream.ReadBool() ? new MemoryMetrics(Marshaller.StartUnmarshal(stream, false)) : null);
+ }
+
+ /// <summary>
/// Creates new Cluster Group from given native projection.
/// </summary>
/// <param name="prj">Native projection.</param>
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f8577f3/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
index b392f9c..000968c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
@@ -737,6 +737,14 @@ namespace Apache.Ignite.Core.Impl
return _prj.GetMemoryMetrics();
}
+ /** <inheritdoc /> */
+ public IMemoryMetrics GetMemoryMetrics(string memoryPolicyName)
+ {
+ IgniteArgumentCheck.NotNullOrEmpty(memoryPolicyName, "memoryPolicyName");
+
+ return _prj.GetMemoryMetrics(memoryPolicyName);
+ }
+
/// <summary>
/// Gets or creates near cache.
/// </summary>
[05/13] ignite git commit: IGNITE-5200 Fixed eslint-loader options.
Posted by sb...@apache.org.
IGNITE-5200 Fixed eslint-loader options.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e36c02ce
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e36c02ce
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e36c02ce
Branch: refs/heads/ignite-5075
Commit: e36c02cebbca90899e0a5b3a6ec437f0c62a6dcb
Parents: c45de16
Author: Andrey Novikov <an...@gridgain.com>
Authored: Wed May 31 14:54:13 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Wed May 31 14:54:13 2017 +0700
----------------------------------------------------------------------
modules/web-console/frontend/webpack/webpack.common.js | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e36c02ce/modules/web-console/frontend/webpack/webpack.common.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/webpack/webpack.common.js b/modules/web-console/frontend/webpack/webpack.common.js
index ca7f672..5fefd59 100644
--- a/modules/web-console/frontend/webpack/webpack.common.js
+++ b/modules/web-console/frontend/webpack/webpack.common.js
@@ -27,6 +27,8 @@ import ExtractTextPlugin from 'extract-text-webpack-plugin';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import ProgressBarPlugin from 'progress-bar-webpack-plugin';
+import eslintFormatter from 'eslint-friendly-formatter';
+
const basedir = path.resolve('./');
const contentBase = path.resolve('public');
const node_modules = path.resolve('node_modules');
@@ -103,7 +105,7 @@ export default {
options: {
failOnWarning: false,
failOnError: false,
- formatter: 'eslint-friendly-formatter'
+ formatter: eslintFormatter
}
}]
},
@@ -159,6 +161,9 @@ export default {
pug: {
basedir
},
+ eslint: {
+ configFile: path.join(basedir, '.eslintrc')
+ },
target: 'web'
}
}),