You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2017/06/09 14:20:39 UTC
[01/42] ignite git commit: IGNITE-5376: JDBC thin: added "collocated"
and "replicatedOnly" flags (3).
Repository: ignite
Updated Branches:
refs/heads/ignite-5267-merge-ea 4b89ae019 -> ffe1a010c
IGNITE-5376: JDBC thin: added "collocated" and "replicatedOnly" flags (3).
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/915ea32e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/915ea32e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/915ea32e
Branch: refs/heads/ignite-5267-merge-ea
Commit: 915ea32e5fbe73fbc58255328081003251706850
Parents: db85d16
Author: devozerov <vo...@gridgain.com>
Authored: Tue Jun 6 14:47:39 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Tue Jun 6 14:47:39 2017 +0300
----------------------------------------------------------------------
.../ignite/internal/processors/odbc/SqlListenerNioListener.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/915ea32e/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java
index fb3359a..bff5519 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java
@@ -243,7 +243,7 @@ public class SqlListenerNioListener extends GridNioServerListenerAdapter<byte[]>
SqlListenerRequestHandler handler = new OdbcRequestHandler(ctx, busyLock, maxCursors, distributedJoins,
enforceJoinOrder);
- SqlListenerMessageParser parser = new JdbcMessageParser(ctx);
+ SqlListenerMessageParser parser = new OdbcMessageParser(ctx);
return new SqlListenerConnectionContext(handler, parser);
}
[05/42] ignite git commit: ignite-5125 Do not limit number of hanging
objects dumps, instead increase time between dumps.
Posted by ag...@apache.org.
ignite-5125 Do not limit number of hanging objects dumps, instead increase time between dumps.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/808ad9fe
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/808ad9fe
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/808ad9fe
Branch: refs/heads/ignite-5267-merge-ea
Commit: 808ad9fe4b339dbe86ae96c1915c5aa5ea0521c7
Parents: ec5c3a2
Author: Evgeny Stanilovskiy <es...@gridgain.com>
Authored: Tue Jun 6 17:58:44 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jun 6 17:58:44 2017 +0300
----------------------------------------------------------------------
.../apache/ignite/IgniteSystemProperties.java | 3 +
.../GridCachePartitionExchangeManager.java | 129 ++++++++++---------
.../dht/GridDhtPartitionTopologyImpl.java | 6 +-
.../GridDhtPartitionsExchangeFuture.java | 56 +++++---
4 files changed, 117 insertions(+), 77 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/808ad9fe/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 ea4b690..84f3732 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -451,6 +451,9 @@ public final class IgniteSystemProperties {
/** Cache operations that take more time than value of this property will be output to log. Set to {@code 0} to disable. */
public static final String IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT = "IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT";
+ /** Upper time limit between long running/hanging operations debug dumps. */
+ public static final String IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT_LIMIT = "IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT_LIMIT";
+
/** JDBC driver cursor remove delay. */
public static final String IGNITE_JDBC_DRIVER_CURSOR_REMOVE_DELAY = "IGNITE_JDBC_DRIVER_CURSOR_RMV_DELAY";
http://git-wip-us.apache.org/repos/asf/ignite/blob/808ad9fe/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git 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
index 2d1aa05..2be4d0f 100644
--- 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
@@ -110,6 +110,7 @@ import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
import static org.apache.ignite.internal.GridTopic.TOPIC_CACHE;
import static org.apache.ignite.internal.events.DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT;
import static org.apache.ignite.internal.managers.communication.GridIoPolicy.SYSTEM_POOL;
+import static org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.*;
import static org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader.DFLT_PRELOAD_RESEND_TIMEOUT;
/**
@@ -175,7 +176,10 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
private volatile IgniteCheckedException stopErr;
/** */
- private int longRunningOpsDumpCnt;
+ private long nextLongRunningOpsDumpTime;
+
+ /** */
+ private int longRunningOpsDumpStep;
/** */
private DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss.SSS");
@@ -1405,84 +1409,83 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
/**
* @param timeout Operation timeout.
+ * @return {@code True} if found long running operations.
*/
- public void dumpLongRunningOperations(long timeout) {
- try {
- GridDhtPartitionsExchangeFuture lastFut = lastInitializedFut;
+ private boolean dumpLongRunningOperations0(long timeout) {
+ long curTime = U.currentTimeMillis();
- // If exchange is in progress it will dump all hanging operations if any.
- if (lastFut != null && !lastFut.isDone())
- return;
-
- long curTime = U.currentTimeMillis();
+ boolean found = false;
- boolean found = false;
+ IgniteTxManager tm = cctx.tm();
- IgniteTxManager tm = cctx.tm();
+ GridCacheMvccManager mvcc = cctx.mvcc();
- if (tm != null) {
- for (IgniteInternalTx tx : tm.activeTransactions()) {
- if (curTime - tx.startTime() > timeout) {
- found = true;
+ if (tm != null) {
+ for (IgniteInternalTx tx : tm.activeTransactions()) {
+ if (curTime - tx.startTime() > timeout) {
+ found = true;
- if (longRunningOpsDumpCnt < GridDhtPartitionsExchangeFuture.DUMP_PENDING_OBJECTS_THRESHOLD) {
- U.warn(log, "Found long running transaction [startTime=" + formatTime(tx.startTime()) +
- ", curTime=" + formatTime(curTime) + ", tx=" + tx + ']');
- }
- else
- break;
- }
+ U.warn(log, "Found long running transaction [startTime=" + formatTime(tx.startTime()) +
+ ", curTime=" + formatTime(curTime) + ", tx=" + tx + ']');
}
}
+ }
- GridCacheMvccManager mvcc = cctx.mvcc();
-
- if (mvcc != null) {
- for (GridCacheFuture<?> fut : mvcc.activeFutures()) {
- if (curTime - fut.startTime() > timeout) {
- found = true;
+ if (mvcc != null) {
+ for (GridCacheFuture<?> fut : mvcc.activeFutures()) {
+ if (curTime - fut.startTime() > timeout) {
+ found = true;
- if (longRunningOpsDumpCnt < GridDhtPartitionsExchangeFuture.DUMP_PENDING_OBJECTS_THRESHOLD) {
- U.warn(log, "Found long running cache future [startTime=" + formatTime(fut.startTime()) +
- ", curTime=" + formatTime(curTime) + ", fut=" + fut + ']');
- }
- else
- break;
- }
+ U.warn(log, "Found long running cache future [startTime=" + formatTime(fut.startTime()) +
+ ", curTime=" + formatTime(curTime) + ", fut=" + fut + ']');
}
+ }
- for (GridCacheFuture<?> fut : mvcc.atomicFutures()) {
- if (curTime - fut.startTime() > timeout) {
- found = true;
+ for (GridCacheFuture<?> fut : mvcc.atomicFutures()) {
+ if (curTime - fut.startTime() > timeout) {
+ found = true;
- if (longRunningOpsDumpCnt < GridDhtPartitionsExchangeFuture.DUMP_PENDING_OBJECTS_THRESHOLD) {
- U.warn(log, "Found long running cache future [startTime=" + formatTime(fut.startTime()) +
- ", curTime=" + formatTime(curTime) + ", fut=" + fut + ']');
- }
- else
- break;
- }
+ U.warn(log, "Found long running cache future [startTime=" + formatTime(fut.startTime()) +
+ ", curTime=" + formatTime(curTime) + ", fut=" + fut + ']');
}
}
+ }
- if (found) {
- if (longRunningOpsDumpCnt < GridDhtPartitionsExchangeFuture.DUMP_PENDING_OBJECTS_THRESHOLD) {
- longRunningOpsDumpCnt++;
+ return found;
+ }
- if (IgniteSystemProperties.getBoolean(IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT, false)) {
- U.warn(log, "Found long running cache operations, dump threads.");
+ /**
+ * @param timeout Operation timeout.
+ */
+ public void dumpLongRunningOperations(long timeout) {
+ try {
+ GridDhtPartitionsExchangeFuture lastFut = lastInitializedFut;
- U.dumpThreads(log);
- }
+ // If exchange is in progress it will dump all hanging operations if any.
+ if (lastFut != null && !lastFut.isDone())
+ return;
- U.warn(log, "Found long running cache operations, dump IO statistics.");
+ if (U.currentTimeMillis() < nextLongRunningOpsDumpTime)
+ return;
- // Dump IO manager statistics.
- cctx.gridIO().dumpStats();
+ if (dumpLongRunningOperations0(timeout)) {
+ nextLongRunningOpsDumpTime = U.currentTimeMillis() + nextDumpTimeout(longRunningOpsDumpStep++, timeout);
+
+ if (IgniteSystemProperties.getBoolean(IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT, false)) {
+ U.warn(log, "Found long running cache operations, dump threads.");
+
+ U.dumpThreads(log);
}
+
+ U.warn(log, "Found long running cache operations, dump IO statistics.");
+
+ // Dump IO manager statistics.
+ cctx.gridIO().dumpStats();
+ }
+ else {
+ nextLongRunningOpsDumpTime = 0;
+ longRunningOpsDumpStep = 0;
}
- else
- longRunningOpsDumpCnt = 0;
}
catch (Exception e) {
U.error(log, "Failed to dump debug information: " + e, e);
@@ -1774,11 +1777,15 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
exchFut.init();
- int dumpedObjects = 0;
+ int dumpCnt = 0;
+
+ final long futTimeout = 2 * cctx.gridConfig().getNetworkTimeout();
+
+ long nextDumpTime = 0;
while (true) {
try {
- exchFut.get(2 * cctx.gridConfig().getNetworkTimeout(), TimeUnit.MILLISECONDS);
+ exchFut.get(futTimeout, TimeUnit.MILLISECONDS);
break;
}
@@ -1788,7 +1795,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
", node=" + cctx.localNodeId() + "]. " +
"Dumping pending objects that might be the cause: ");
- if (dumpedObjects < GridDhtPartitionsExchangeFuture.DUMP_PENDING_OBJECTS_THRESHOLD) {
+ if (nextDumpTime <= U.currentTimeMillis()) {
try {
dumpDebugInfo(exchFut.topologyVersion());
}
@@ -1799,7 +1806,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
if (IgniteSystemProperties.getBoolean(IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT, false))
U.dumpThreads(log);
- dumpedObjects++;
+ nextDumpTime = U.currentTimeMillis() + nextDumpTimeout(dumpCnt++, futTimeout);
}
}
catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/808ad9fe/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
index 248d44e..89554f3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
@@ -80,6 +80,10 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
private static final boolean FULL_MAP_DEBUG = false;
/** */
+ private static final int DUMP_PENDING_OBJECTS_THRESHOLD =
+ IgniteSystemProperties.getInteger(IgniteSystemProperties.IGNITE_DUMP_PENDING_OBJECTS_THRESHOLD, 10);
+
+ /** */
private static final Long ZERO = 0L;
/** */
@@ -234,7 +238,7 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
break;
}
catch (IgniteFutureTimeoutCheckedException ignored) {
- if (dumpCnt++ < GridDhtPartitionsExchangeFuture.DUMP_PENDING_OBJECTS_THRESHOLD) {
+ if (dumpCnt++ < DUMP_PENDING_OBJECTS_THRESHOLD) {
U.warn(log, "Failed to wait for partition eviction [" +
"topVer=" + topVer +
", group=" + grp.cacheOrGroupName() +
http://git-wip-us.apache.org/repos/asf/ignite/blob/808ad9fe/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git 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
index 0c5cdd9..26406c6 100644
--- 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
@@ -35,7 +35,6 @@ import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.ReadWriteLock;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.cache.PartitionLossPolicy;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.events.CacheEvent;
@@ -90,7 +89,10 @@ import org.apache.ignite.lang.IgniteRunnable;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT_LIMIT;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT;
+import static org.apache.ignite.IgniteSystemProperties.getBoolean;
+import static org.apache.ignite.IgniteSystemProperties.getLong;
import static org.apache.ignite.cache.PartitionLossPolicy.READ_ONLY_ALL;
import static org.apache.ignite.cache.PartitionLossPolicy.READ_ONLY_SAFE;
import static org.apache.ignite.cache.PartitionLossPolicy.READ_WRITE_ALL;
@@ -107,10 +109,6 @@ import static org.apache.ignite.internal.managers.communication.GridIoPolicy.SYS
@SuppressWarnings({"TypeMayBeWeakened", "unchecked"})
public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityTopologyVersion>
implements Comparable<GridDhtPartitionsExchangeFuture>, GridDhtTopologyFuture, CachePartitionExchangeWorkerTask {
- /** */
- public static final int DUMP_PENDING_OBJECTS_THRESHOLD =
- IgniteSystemProperties.getInteger(IgniteSystemProperties.IGNITE_DUMP_PENDING_OBJECTS_THRESHOLD, 10);
-
/** Dummy flag. */
private final boolean dummy;
@@ -880,20 +878,24 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
if (log.isDebugEnabled())
log.debug("Before waiting for partition release future: " + this);
- int dumpedObjects = 0;
+ int dumpCnt = 0;
+
+ long nextDumpTime = 0;
+
+ long futTimeout = 2 * cctx.gridConfig().getNetworkTimeout();
while (true) {
try {
- partReleaseFut.get(2 * cctx.gridConfig().getNetworkTimeout(), TimeUnit.MILLISECONDS);
+ partReleaseFut.get(futTimeout, TimeUnit.MILLISECONDS);
break;
}
catch (IgniteFutureTimeoutCheckedException ignored) {
// Print pending transactions and locks that might have led to hang.
- if (dumpedObjects < DUMP_PENDING_OBJECTS_THRESHOLD) {
+ if (nextDumpTime <= U.currentTimeMillis()) {
dumpPendingObjects();
- dumpedObjects++;
+ nextDumpTime = U.currentTimeMillis() + nextDumpTimeout(dumpCnt++, futTimeout);
}
}
}
@@ -903,16 +905,17 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
IgniteInternalFuture<?> locksFut = cctx.mvcc().finishLocks(exchId.topologyVersion());
- dumpedObjects = 0;
+ nextDumpTime = 0;
+ dumpCnt = 0;
while (true) {
try {
- locksFut.get(2 * cctx.gridConfig().getNetworkTimeout(), TimeUnit.MILLISECONDS);
+ locksFut.get(futTimeout, TimeUnit.MILLISECONDS);
break;
}
catch (IgniteFutureTimeoutCheckedException ignored) {
- if (dumpedObjects < DUMP_PENDING_OBJECTS_THRESHOLD) {
+ if (nextDumpTime <= U.currentTimeMillis()) {
U.warn(log, "Failed to wait for locks release future. " +
"Dumping pending objects that might be the cause: " + cctx.localNodeId());
@@ -930,9 +933,9 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
for (Map.Entry<IgniteTxKey, Collection<GridCacheMvccCandidate>> e : locks.entrySet())
U.warn(log, "Awaited locked entry [key=" + e.getKey() + ", mvcc=" + e.getValue() + ']');
- dumpedObjects++;
+ nextDumpTime = U.currentTimeMillis() + nextDumpTimeout(dumpCnt++, futTimeout);
- if (IgniteSystemProperties.getBoolean(IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT, false))
+ if (getBoolean(IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT, false))
U.dumpThreads(log);
}
}
@@ -1026,7 +1029,7 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
U.error(log, "Failed to dump debug information: " + e, e);
}
- if (IgniteSystemProperties.getBoolean(IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT, false))
+ if (getBoolean(IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT, false))
U.dumpThreads(log);
}
@@ -2195,4 +2198,27 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
return S.toString(CounterWithNodes.class, this);
}
}
+
+ /**
+ * @param step Exponent coefficient.
+ * @param timeout Base timeout.
+ * @return Time to wait before next debug dump.
+ */
+ public static long nextDumpTimeout(int step, long timeout) {
+ long limit = getLong(IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT_LIMIT, 30 * 60_000);
+
+ if (limit <= 0)
+ limit = 30 * 60_000;
+
+ assert step >= 0 : step;
+
+ long dumpFactor = Math.round(Math.pow(2, step));
+
+ long nextTimeout = timeout * dumpFactor;
+
+ if (nextTimeout <= 0)
+ return limit;
+
+ return nextTimeout <= limit ? nextTimeout : limit;
+ }
}
[25/42] ignite git commit: Web Console: Added yarn.lock to gitignore.
Posted by ag...@apache.org.
Web Console: Added yarn.lock to gitignore.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0a0ddbc0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0a0ddbc0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0a0ddbc0
Branch: refs/heads/ignite-5267-merge-ea
Commit: 0a0ddbc01fb70cce248aa75431b18f8206885a59
Parents: e238d56
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Thu Jun 8 19:39:51 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Thu Jun 8 19:39:51 2017 +0700
----------------------------------------------------------------------
modules/web-console/backend/.gitignore | 1 +
modules/web-console/frontend/.gitignore | 1 +
2 files changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0a0ddbc0/modules/web-console/backend/.gitignore
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/.gitignore b/modules/web-console/backend/.gitignore
index 1074aff..08090a1 100644
--- a/modules/web-console/backend/.gitignore
+++ b/modules/web-console/backend/.gitignore
@@ -4,3 +4,4 @@
node_modules
agent_dists/*.zip
config/*.json
+yarn.lock
http://git-wip-us.apache.org/repos/asf/ignite/blob/0a0ddbc0/modules/web-console/frontend/.gitignore
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/.gitignore b/modules/web-console/frontend/.gitignore
index 296d61c..1439664 100644
--- a/modules/web-console/frontend/.gitignore
+++ b/modules/web-console/frontend/.gitignore
@@ -5,3 +5,4 @@
build/*
node_modules
public/stylesheets/*.css
+yarn.lock
[04/42] ignite git commit: IGNITE-5410: Fixed assertion in
HadoopDataOutStream. This closes #2084.
Posted by ag...@apache.org.
IGNITE-5410: Fixed assertion in HadoopDataOutStream. This closes #2084.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ec5c3a2d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ec5c3a2d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ec5c3a2d
Branch: refs/heads/ignite-5267-merge-ea
Commit: ec5c3a2de426ccdea619548821472291e900f28d
Parents: f3c6b3c
Author: Ivan Veselovskiy <iv...@gridgain.com>
Authored: Tue Jun 6 16:56:09 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Tue Jun 6 16:56:09 2017 +0300
----------------------------------------------------------------------
.../processors/hadoop/shuffle/streams/HadoopOffheapBuffer.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec5c3a2d/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/streams/HadoopOffheapBuffer.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/streams/HadoopOffheapBuffer.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/streams/HadoopOffheapBuffer.java
index d15e7eb..ed6feae 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/streams/HadoopOffheapBuffer.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/streams/HadoopOffheapBuffer.java
@@ -92,7 +92,7 @@ public class HadoopOffheapBuffer {
* @return Old position pointer or {@code 0} if move goes beyond the end of the buffer.
*/
public long move(long size) {
- assert size > 0 : size;
+ assert size >= 0 : size;
long oldPos = posPtr;
long newPos = oldPos + size;
[34/42] ignite git commit: Fixed headers.
Posted by ag...@apache.org.
Fixed headers.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c63988ab
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c63988ab
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c63988ab
Branch: refs/heads/ignite-5267-merge-ea
Commit: c63988ab276cbedfac1dc5943987c94d25870f9d
Parents: 0fb6d2f
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Jun 9 15:05:47 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Jun 9 15:05:47 2017 +0700
----------------------------------------------------------------------
.../ml/math/impls/matrix/SparseDistributedMatrix.java | 9 ---------
.../ml/math/impls/matrix/SparseDistributedMatrixTest.java | 9 ---------
2 files changed, 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c63988ab/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrix.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrix.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrix.java
index cebacc5..50c7da8 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrix.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrix.java
@@ -1,12 +1,3 @@
-// @java.file.header
-
-/* _________ _____ __________________ _____
- * __ ____/___________(_)______ /__ ____/______ ____(_)_______
- * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
- * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
- * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
- */
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
http://git-wip-us.apache.org/repos/asf/ignite/blob/c63988ab/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrixTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrixTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrixTest.java
index 5ee2e7d..54975f0 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrixTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrixTest.java
@@ -1,12 +1,3 @@
-// @java.file.header
-
-/* _________ _____ __________________ _____
- * __ ____/___________(_)______ /__ ____/______ ____(_)_______
- * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
- * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
- * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
- */
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
[19/42] ignite git commit: IGNITE-5436 .NET:
CacheConfiguration.GroupName
Posted by ag...@apache.org.
IGNITE-5436 .NET: CacheConfiguration.GroupName
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5c77dab5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5c77dab5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5c77dab5
Branch: refs/heads/ignite-5267-merge-ea
Commit: 5c77dab546f1eded908fd74a51eaef59054e038c
Parents: bd5065b
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Jun 8 12:33:13 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Jun 8 12:33:13 2017 +0300
----------------------------------------------------------------------
.../platform/utils/PlatformConfigurationUtils.java | 2 ++
.../Cache/CacheConfigurationTest.cs | 2 ++
.../IgniteConfigurationSerializerTest.cs | 6 ++++--
.../Cache/Configuration/CacheConfiguration.cs | 14 ++++++++++++++
.../Apache.Ignite.Core/IgniteConfigurationSection.xsd | 5 +++++
5 files changed, 27 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c77dab5/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 40dafbd..176d77b 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
@@ -178,6 +178,7 @@ public class PlatformConfigurationUtils {
ccfg.setMemoryPolicyName(memoryPolicyName);
ccfg.setPartitionLossPolicy(PartitionLossPolicy.fromOrdinal((byte)in.readInt()));
+ ccfg.setGroupName(in.readString());
Object storeFactory = in.readObjectDetached();
@@ -829,6 +830,7 @@ public class PlatformConfigurationUtils {
writer.writeBoolean(ccfg.isStatisticsEnabled());
writer.writeString(ccfg.getMemoryPolicyName());
writer.writeInt(ccfg.getPartitionLossPolicy().ordinal());
+ writer.writeString(ccfg.getGroupName());
if (ccfg.getCacheStoreFactory() instanceof PlatformDotNetCacheStoreFactoryNative)
writer.writeObject(((PlatformDotNetCacheStoreFactoryNative)ccfg.getCacheStoreFactory()).getNativeFactory());
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c77dab5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
index 7935cc3..b674b0e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
@@ -247,6 +247,7 @@ namespace Apache.Ignite.Core.Tests.Cache
Assert.AreEqual(x.EnableStatistics, y.EnableStatistics);
Assert.AreEqual(x.MemoryPolicyName, y.MemoryPolicyName);
Assert.AreEqual(x.PartitionLossPolicy, y.PartitionLossPolicy);
+ Assert.AreEqual(x.GroupName, y.GroupName);
if (x.ExpiryPolicyFactory != null)
Assert.AreEqual(x.ExpiryPolicyFactory.CreateInstance().GetType(),
@@ -512,6 +513,7 @@ namespace Apache.Ignite.Core.Tests.Cache
ReadThrough = true,
WriteThrough = true,
WriteBehindCoalescing = false,
+ GroupName = "someGroup",
QueryEntities = new[]
{
new QueryEntity
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c77dab5/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 7ba4ed2..3229de9 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
@@ -92,7 +92,7 @@ namespace Apache.Ignite.Core.Tests
<iLifecycleHandler type='Apache.Ignite.Core.Tests.IgniteConfigurationSerializerTest+LifecycleBean' foo='15' />
</lifecycleHandlers>
<cacheConfiguration>
- <cacheConfiguration cacheMode='Replicated' readThrough='true' writeThrough='true' enableStatistics='true' writeBehindCoalescing='false' partitionLossPolicy='ReadWriteAll'>
+ <cacheConfiguration cacheMode='Replicated' readThrough='true' writeThrough='true' enableStatistics='true' writeBehindCoalescing='false' partitionLossPolicy='ReadWriteAll' groupName='fooGroup'>
<queryEntities>
<queryEntity keyType='System.Int32' valueType='System.String' tableName='myTable'>
<fields>
@@ -179,6 +179,7 @@ namespace Apache.Ignite.Core.Tests
Assert.IsTrue(cacheCfg.EnableStatistics);
Assert.IsFalse(cacheCfg.WriteBehindCoalescing);
Assert.AreEqual(PartitionLossPolicy.ReadWriteAll, cacheCfg.PartitionLossPolicy);
+ Assert.AreEqual("fooGroup", cacheCfg.GroupName);
var queryEntity = cacheCfg.QueryEntities.Single();
Assert.AreEqual(typeof(int), queryEntity.KeyType);
@@ -725,7 +726,8 @@ namespace Apache.Ignite.Core.Tests
new MyPluginConfiguration()
},
MemoryPolicyName = "somePolicy",
- PartitionLossPolicy = PartitionLossPolicy.ReadOnlyAll
+ PartitionLossPolicy = PartitionLossPolicy.ReadOnlyAll,
+ GroupName = "abc"
}
},
ClientMode = true,
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c77dab5/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
index 1ee7c97..04198dd 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
@@ -236,6 +236,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
EnableStatistics = reader.ReadBoolean();
MemoryPolicyName = reader.ReadString();
PartitionLossPolicy = (PartitionLossPolicy) reader.ReadInt();
+ GroupName = reader.ReadString();
CacheStoreFactory = reader.ReadObject<IFactory<ICacheStore>>();
var count = reader.ReadInt();
@@ -293,6 +294,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
writer.WriteBoolean(EnableStatistics);
writer.WriteString(MemoryPolicyName);
writer.WriteInt((int) PartitionLossPolicy);
+ writer.WriteString(GroupName);
writer.WriteObject(CacheStoreFactory);
if (QueryEntities != null)
@@ -643,5 +645,17 @@ namespace Apache.Ignite.Core.Cache.Configuration
/// </summary>
[DefaultValue(DefaultPartitionLossPolicy)]
public PartitionLossPolicy PartitionLossPolicy { get; set; }
+
+ /// <summary>
+ /// Gets or sets the cache group name. Caches with the same group name share single underlying 'physical'
+ /// cache (partition set), but are logically isolated.
+ /// <para />
+ /// Since underlying cache is shared, the following configuration properties should be the same within group:
+ /// <see cref="AffinityFunction"/>, <see cref="CacheMode"/>, <see cref="PartitionLossPolicy"/>,
+ /// <see cref="MemoryPolicyName"/>
+ /// <para />
+ /// Grouping caches reduces overall overhead, since internal data structures are shared.
+ /// </summary>
+ public string GroupName { get;set; }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c77dab5/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 0cd58ed..f0b7f44 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
@@ -743,6 +743,11 @@
<xs:documentation>Partition loss policy defines how Ignite will react to a situation when all nodes for some partition leave the cluster.</xs:documentation>
</xs:annotation>
</xs:attribute>
+ <xs:attribute name="groupName" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Cache group name. Caches with the same group name share single underlying 'physical' cache (partition set), but are logically isolated.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
[39/42] ignite git commit: IGNITE-5306 - Persist SQL context along
with cache configuration
Posted by ag...@apache.org.
IGNITE-5306 - Persist SQL context along with cache configuration
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/87551427
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/87551427
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/87551427
Branch: refs/heads/ignite-5267-merge-ea
Commit: 87551427c5796a5d48f60a412a770b810269b797
Parents: fffad68
Author: Konstantin Dudkov <kd...@ya.ru>
Authored: Fri Jun 9 16:21:31 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Jun 9 16:21:31 2017 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheProcessor.java | 138 +++++++++----------
.../processors/cache/StoredCacheData.java | 17 +++
.../IgnitePersistentStoreSchemaLoadTest.java | 2 +-
3 files changed, 82 insertions(+), 75 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/87551427/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index e968074..8dc6026 100644
--- 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
@@ -270,7 +270,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
if (cfg.getCacheMode() == REPLICATED)
cfg.setBackups(Integer.MAX_VALUE);
- if( cfg.getQueryParallelism() > 1 && cfg.getCacheMode() != PARTITIONED)
+ if (cfg.getQueryParallelism() > 1 && cfg.getCacheMode() != PARTITIONED)
throw new IgniteCheckedException("Segmented indices are supported for PARTITIONED mode only.");
if (cfg.getAffinityMapper() == null)
@@ -502,12 +502,12 @@ public class GridCacheProcessor extends GridProcessorAdapter {
else if (cc.getRebalanceMode() == SYNC) {
if (delay < 0) {
U.warn(log, "Ignoring SYNC rebalance mode with manual rebalance start (node will not wait for " +
- "rebalancing to be finished): " + U.maskName(cc.getName()),
+ "rebalancing to be finished): " + U.maskName(cc.getName()),
"Node will not wait for rebalance in SYNC mode: " + U.maskName(cc.getName()));
}
else {
U.warn(log, "Using SYNC rebalance mode with rebalance delay (node will wait until rebalancing is " +
- "initiated for " + delay + "ms) for cache: " + U.maskName(cc.getName()),
+ "initiated for " + delay + "ms) for cache: " + U.maskName(cc.getName()),
"Node will wait until rebalancing is initiated for " + delay + "ms for cache: " + U.maskName(cc.getName()));
}
}
@@ -646,7 +646,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
if (!F.isEmpty(ctx.config().getCacheConfiguration())) {
if (depMode != CONTINUOUS && depMode != SHARED)
U.warn(log, "Deployment mode for cache is not CONTINUOUS or SHARED " +
- "(it is recommended that you change deployment mode and restart): " + depMode,
+ "(it is recommended that you change deployment mode and restart): " + depMode,
"Deployment mode for cache is not CONTINUOUS or SHARED.");
}
@@ -690,12 +690,11 @@ public class GridCacheProcessor extends GridProcessorAdapter {
/**
* @param cacheData Cache data.
- * @param sql SQL flag - {@code true} if cache was created with {@code CREATE TABLE}.
* @param caches Caches map.
* @param templates Templates map.
* @throws IgniteCheckedException If failed.
*/
- private void addCacheOnJoin(StoredCacheData cacheData, boolean sql,
+ private void addCacheOnJoin(StoredCacheData cacheData,
Map<String, CacheJoinNodeDiscoveryData.CacheInfo> caches,
Map<String, CacheJoinNodeDiscoveryData.CacheInfo> templates) throws IgniteCheckedException {
CacheConfiguration<?, ?> cfg = cacheData.config();
@@ -734,7 +733,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
else
stopSeq.addFirst(cfg.getName());
- caches.put(cfg.getName(), new CacheJoinNodeDiscoveryData.CacheInfo(cacheData, cacheType, sql, 0));
+ caches.put(cfg.getName(), new CacheJoinNodeDiscoveryData.CacheInfo(cacheData, cacheType, cacheData.sql(), 0));
}
else
templates.put(cfg.getName(), new CacheJoinNodeDiscoveryData.CacheInfo(cacheData, CacheType.USER, false, 0));
@@ -757,8 +756,10 @@ public class GridCacheProcessor extends GridProcessorAdapter {
CacheConfiguration<?, ?> cfg = new CacheConfiguration(cfgs[i]);
cfgs[i] = cfg; // Replace original configuration value.
+ StoredCacheData cacheData = new StoredCacheData(cfg);
+ cacheData.sql(false);
- addCacheOnJoin(new StoredCacheData(cfg), false, caches, templates);
+ addCacheOnJoin(cacheData, caches, templates);
}
}
@@ -774,21 +775,20 @@ public class GridCacheProcessor extends GridProcessorAdapter {
assert !ctx.config().isDaemon();
if (sharedCtx.pageStore() != null && sharedCtx.database().persistenceEnabled()) {
- Map<String, StoredCacheData> ccfgs = sharedCtx.pageStore().readCacheConfigurations();
+ Map<String, StoredCacheData> cacheDataMap = sharedCtx.pageStore().readCacheConfigurations();
for (String cache : caches.keySet())
- ccfgs.remove(cache);
+ cacheDataMap.remove(cache);
for (String cache : internalCaches)
- ccfgs.remove(cache);
+ cacheDataMap.remove(cache);
- if (!F.isEmpty(ccfgs)) {
+ if (!F.isEmpty(cacheDataMap)) {
if (log.isInfoEnabled())
- log.info("Register persistent caches: " + ccfgs.keySet());
+ log.info("Register persistent caches: " + cacheDataMap.keySet());
- // TODO IGNITE-5306 - set correct SQL flag below.
- for (StoredCacheData ccfg : ccfgs.values())
- addCacheOnJoin(ccfg, false, caches, templates);
+ for (StoredCacheData cacheData : cacheDataMap.values())
+ addCacheOnJoin(cacheData, caches, templates);
}
}
}
@@ -981,7 +981,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
/**
* @param cancel Cancel.
*/
- public void stopCaches(boolean cancel){
+ public void stopCaches(boolean cancel) {
for (String cacheName : stopSeq) {
GridCacheAdapter<?, ?> cache = stoppedCaches.remove(cacheName);
@@ -1040,7 +1040,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
/**
* @param cancel Cancel.
*/
- public void onKernalStopCaches(boolean cancel){
+ public void onKernalStopCaches(boolean cancel) {
IgniteCheckedException affErr =
new IgniteCheckedException("Failed to wait for topology update, node is stopping.");
@@ -1235,14 +1235,13 @@ public class GridCacheProcessor extends GridProcessorAdapter {
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() + ']');
-}
+ }
}
/**
@@ -1773,26 +1772,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
/**
- * @param cacheDesc Cache start request.
- * @param nearCfg Near cache configuration.
- * @param exchTopVer Current exchange version.
- * @throws IgniteCheckedException If failed.
- */
- void prepareCacheStart(DynamicCacheDescriptor cacheDesc,
- @Nullable NearCacheConfiguration nearCfg,
- AffinityTopologyVersion exchTopVer)
- throws IgniteCheckedException {
- prepareCacheStart(
- cacheDesc.groupDescriptor(),
- cacheDesc.cacheConfiguration(),
- nearCfg,
- cacheDesc,
- exchTopVer,
- cacheDesc.schema()
- );
- }
-
- /**
* @param exchTopVer Current exchange version.
* @throws IgniteCheckedException If failed.
*/
@@ -1804,12 +1783,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
DynamicCacheDescriptor desc = t.get1();
prepareCacheStart(
- desc.groupDescriptor(),
- desc.cacheConfiguration(),
- t.get2(),
desc,
- exchTopVer,
- desc.schema()
+ t.get2(),
+ exchTopVer
);
}
}
@@ -1833,12 +1809,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
if (CU.affinityNode(ctx.discovery().localNode(), filter)) {
prepareCacheStart(
- desc.groupDescriptor(),
- desc.cacheConfiguration(),
- null,
desc,
- exchTopVer,
- desc.schema()
+ null,
+ exchTopVer
);
}
}
@@ -1848,22 +1821,17 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
/**
- * @param grpDesc Cache group descriptor.
- * @param startCfg Start configuration.
- * @param reqNearCfg Near configuration if specified for client cache start request.
* @param desc Cache descriptor.
+ * @param reqNearCfg Near configuration if specified for client cache start request.
* @param exchTopVer Current exchange version.
- * @param schema Query schema.
* @throws IgniteCheckedException If failed.
*/
- private void prepareCacheStart(
- CacheGroupDescriptor grpDesc,
- CacheConfiguration startCfg,
- @Nullable NearCacheConfiguration reqNearCfg,
+ public void prepareCacheStart(
DynamicCacheDescriptor desc,
- AffinityTopologyVersion exchTopVer,
- @Nullable QuerySchema schema
+ @Nullable NearCacheConfiguration reqNearCfg,
+ AffinityTopologyVersion exchTopVer
) throws IgniteCheckedException {
+ CacheConfiguration startCfg = desc.cacheConfiguration();
assert !caches.containsKey(startCfg.getName()) : startCfg.getName();
CacheConfiguration ccfg = new CacheConfiguration(startCfg);
@@ -1881,7 +1849,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
ccfg.setNearConfiguration(null);
}
- else if (CU.affinityNode(ctx.discovery().localNode(), grpDesc.config().getNodeFilter()))
+ else if (CU.affinityNode(ctx.discovery().localNode(), desc.groupDescriptor().config().getNodeFilter()))
affNode = true;
else {
affNode = false;
@@ -1889,8 +1857,10 @@ public class GridCacheProcessor extends GridProcessorAdapter {
ccfg.setNearConfiguration(reqNearCfg);
}
- if (sharedCtx.pageStore() != null && affNode)
- sharedCtx.pageStore().initializeForCache(grpDesc, new StoredCacheData(startCfg));
+ StoredCacheData cacheData = toStoredData(desc);
+
+ if (sharedCtx.pageStore() != null && affNode)
+ sharedCtx.pageStore().initializeForCache(desc.groupDescriptor(), cacheData);
String grpName = startCfg.getGroupName();
@@ -1906,7 +1876,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
if (grp == null) {
- grp = startCacheGroup(grpDesc,
+ grp = startCacheGroup(desc.groupDescriptor(),
desc.cacheType(),
affNode,
cacheObjCtx,
@@ -1914,7 +1884,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
}
else {
- grp = startCacheGroup(grpDesc,
+ grp = startCacheGroup(desc.groupDescriptor(),
desc.cacheType(),
affNode,
cacheObjCtx,
@@ -1938,7 +1908,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
caches.put(cacheCtx.name(), cache);
- startCache(cache, schema != null ? schema : new QuerySchema());
+ startCache(cache, desc.schema() != null ? desc.schema() : new QuerySchema());
grp.onCacheStarted(cacheCtx);
@@ -2079,7 +2049,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
final ExchangeActions.ActionData act,
Throwable err
) {
- ExchangeActions actions = new ExchangeActions(){
+ ExchangeActions actions = new ExchangeActions() {
@Override List<ActionData> closeRequests(UUID nodeId) {
return Collections.singletonList(act);
}
@@ -2168,7 +2138,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
GridCacheContext<?, ?> stopCtx = prepareCacheStop(req.request(), forceClose);
if (stopCtx != null && !stopCtx.group().hasCaches()) {
- assert !stopCtx.group().affinityNode() : stopCtx.name();
+ assert !stopCtx.group().affinityNode() : stopCtx.name();
stopCacheGroup(stopCtx.groupId());
}
@@ -2631,12 +2601,13 @@ public class GridCacheProcessor extends GridProcessorAdapter {
/**
* @param cacheName Cache name to destroy.
- * @param sql If the cache needs to be destroyed only if it was created as the result
- * of SQL {@code CREATE TABLE} command.
+ * @param sql If the cache needs to be destroyed only if it was created as the result of SQL {@code CREATE TABLE}
+ * command.
* @param checkThreadTx If {@code true} checks that current thread does not have active transactions.
* @return Future that will be completed when cache is destroyed.
*/
- public IgniteInternalFuture<Boolean> dynamicDestroyCache(String cacheName, boolean sql, boolean checkThreadTx, boolean restart) {
+ public IgniteInternalFuture<Boolean> dynamicDestroyCache(String cacheName, boolean sql, boolean checkThreadTx,
+ boolean restart) {
assert cacheName != null;
if (checkThreadTx)
@@ -2770,7 +2741,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
/**
*
*/
- public Collection<DynamicCacheChangeRequest> stopAllCachesRequests(){
+ public Collection<DynamicCacheChangeRequest> stopAllCachesRequests() {
List<DynamicCacheChangeRequest> reqs = new ArrayList<>();
for (String cacheName : cacheNames()) {
@@ -2794,7 +2765,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
cloneCheckSerializable(cfg);
- if (needInit){
+ if (needInit) {
CacheObjectContext cacheObjCtx = ctx.cacheObjects().contextForCache(cfg);
initialize(cfg, cacheObjCtx);
@@ -2821,6 +2792,25 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
/**
+ * Form a {@link StoredCacheData} with all data to correctly restore cache params when its configuration
+ * is read from page store. Essentially, this method takes from {@link DynamicCacheDescriptor} all that's
+ * needed to start cache correctly, leaving out everything else.
+ *
+ * @param desc Cache descriptor to process.
+ * @return {@link StoredCacheData} based on {@code desc}.
+ */
+ private static StoredCacheData toStoredData(DynamicCacheDescriptor desc) {
+ A.notNull(desc, "desc");
+
+ StoredCacheData res = new StoredCacheData(desc.cacheConfiguration());
+
+ res.queryEntities(desc.schema() == null ? Collections.<QueryEntity>emptyList() : desc.schema().entities());
+ res.sql(desc.sql());
+
+ return res;
+ }
+
+ /**
* @param reqs Requests.
* @param failIfExists Fail if exists flag.
* @return Collection of futures.
@@ -3213,7 +3203,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
/**
* @param cacheName Cache name.
* @param failIfNotStarted If {@code true} throws {@link IllegalArgumentException} if cache is not started,
- * otherwise returns {@code null} in this case.
+ * otherwise returns {@code null} in this case.
* @param checkThreadTx If {@code true} checks that current thread does not have active transactions.
* @return Cache instance for given name.
* @throws IgniteCheckedException If failed.
http://git-wip-us.apache.org/repos/asf/ignite/blob/87551427/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StoredCacheData.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StoredCacheData.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StoredCacheData.java
index 2b3dcdc..39c3cd1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StoredCacheData.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StoredCacheData.java
@@ -41,6 +41,9 @@ public class StoredCacheData implements Serializable {
/** Query entities. */
private Collection<QueryEntity> qryEntities;
+ /** SQL flag - {@code true} if cache was created with {@code CREATE TABLE}. */
+ private boolean sql;
+
/**
* Constructor.
*
@@ -73,4 +76,18 @@ public class StoredCacheData implements Serializable {
public void queryEntities(Collection<QueryEntity> qryEntities) {
this.qryEntities = qryEntities;
}
+
+ /**
+ * @return SQL flag - {@code true} if cache was created with {@code CREATE TABLE}.
+ */
+ public boolean sql() {
+ return sql;
+ }
+
+ /**
+ * @param sql SQL flag - {@code true} if cache was created with {@code CREATE TABLE}.
+ */
+ public void sql(boolean sql) {
+ this.sql = sql;
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/87551427/modules/pds/src/test/java/org/apache/ignite/cache/database/IgnitePersistentStoreSchemaLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/pds/src/test/java/org/apache/ignite/cache/database/IgnitePersistentStoreSchemaLoadTest.java b/modules/pds/src/test/java/org/apache/ignite/cache/database/IgnitePersistentStoreSchemaLoadTest.java
index bdf64bb..7719f1a 100644
--- a/modules/pds/src/test/java/org/apache/ignite/cache/database/IgnitePersistentStoreSchemaLoadTest.java
+++ b/modules/pds/src/test/java/org/apache/ignite/cache/database/IgnitePersistentStoreSchemaLoadTest.java
@@ -64,7 +64,7 @@ public class IgnitePersistentStoreSchemaLoadTest extends GridCommonAbstractTest
private static final String TBL_NAME = Person.class.getSimpleName();
/** Schema name. */
- private static final String SCHEMA_NAME = TBL_NAME;
+ private static final String SCHEMA_NAME = "PUBLIC";
/** Cache name. */
private static final String CACHE_NAME = TBL_NAME;
[36/42] ignite git commit: Fixed GridH2IndexRangeRequest
serialization.
Posted by ag...@apache.org.
Fixed GridH2IndexRangeRequest serialization.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/03ec1075
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/03ec1075
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/03ec1075
Branch: refs/heads/ignite-5267-merge-ea
Commit: 03ec10757f62118753a7bfa02749c21c6eea3d51
Parents: 7ceb201
Author: devozerov <vo...@gridgain.com>
Authored: Fri Jun 9 14:41:52 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Fri Jun 9 14:41:52 2017 +0300
----------------------------------------------------------------------
.../processors/query/h2/twostep/msg/GridH2IndexRangeRequest.java | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/03ec1075/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2IndexRangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2IndexRangeRequest.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2IndexRangeRequest.java
index b030632..7024884 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2IndexRangeRequest.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2IndexRangeRequest.java
@@ -174,6 +174,8 @@ public class GridH2IndexRangeRequest implements Message {
if (!writer.writeInt("segmentId", segmentId))
return false;
+ writer.incrementState();
+
case 5:
if (!writer.writeInt("originSegId", originSegmentId))
return false;
[13/42] ignite git commit: IGNITE-5397: JDBC thin driver: avoid
sending JdbcQueryCloseRequest message whenever possible. This closes #2095.
Posted by ag...@apache.org.
IGNITE-5397: JDBC thin driver: avoid sending JdbcQueryCloseRequest message whenever possible. This closes #2095.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ecba1acc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ecba1acc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ecba1acc
Branch: refs/heads/ignite-5267-merge-ea
Commit: ecba1acc80ec395d312d7e70be53fdafb3ff6fc5
Parents: 5120a24
Author: Sergey Kalashnikov <sk...@gridgain.com>
Authored: Wed Jun 7 15:29:28 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Jun 7 15:29:28 2017 +0300
----------------------------------------------------------------------
.../jdbc/suite/IgniteJdbcDriverTestSuite.java | 2 +
.../thin/JdbcThinAutoCloseServerCursorTest.java | 359 +++++++++++++++++++
.../jdbc/thin/JdbcThinConnectionSelfTest.java | 36 ++
.../internal/jdbc/thin/JdbcThinConnection.java | 4 +-
.../internal/jdbc/thin/JdbcThinResultSet.java | 18 +-
.../internal/jdbc/thin/JdbcThinStatement.java | 2 +-
.../internal/jdbc/thin/JdbcThinTcpIo.java | 17 +-
.../internal/jdbc/thin/JdbcThinUtils.java | 7 +-
.../processors/odbc/SqlListenerNioListener.java | 3 +-
.../processors/odbc/jdbc/JdbcQueryCursor.java | 9 +-
.../odbc/jdbc/JdbcRequestHandler.java | 21 +-
11 files changed, 462 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ecba1acc/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
index 121b8df..9ca3582 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
@@ -31,6 +31,7 @@ import org.apache.ignite.jdbc.JdbcPojoQuerySelfTest;
import org.apache.ignite.jdbc.JdbcPreparedStatementSelfTest;
import org.apache.ignite.jdbc.JdbcResultSetSelfTest;
import org.apache.ignite.jdbc.JdbcStatementSelfTest;
+import org.apache.ignite.jdbc.thin.JdbcThinAutoCloseServerCursorTest;
import org.apache.ignite.jdbc.thin.JdbcThinComplexQuerySelfTest;
import org.apache.ignite.jdbc.thin.JdbcThinDeleteStatementSelfTest;
import org.apache.ignite.jdbc.thin.JdbcThinDynamicIndexAtomicPartitionedNearSelfTest;
@@ -116,6 +117,7 @@ public class IgniteJdbcDriverTestSuite extends TestSuite {
suite.addTest(new TestSuite(JdbcThinUpdateStatementSelfTest.class));
suite.addTest(new TestSuite(JdbcThinMergeStatementSelfTest.class));
suite.addTest(new TestSuite(JdbcThinDeleteStatementSelfTest.class));
+ suite.addTest(new TestSuite(JdbcThinAutoCloseServerCursorTest.class));
// New thin JDBC driver, DDL tests
suite.addTest(new TestSuite(JdbcThinDynamicIndexAtomicPartitionedNearSelfTest.class));
http://git-wip-us.apache.org/repos/asf/ignite/blob/ecba1acc/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAutoCloseServerCursorTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAutoCloseServerCursorTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAutoCloseServerCursorTest.java
new file mode 100644
index 0000000..eff504b
--- /dev/null
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAutoCloseServerCursorTest.java
@@ -0,0 +1,359 @@
+/*
+ * 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.jdbc.thin;
+
+import java.io.Serializable;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.concurrent.Callable;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.jdbc.thin.JdbcThinUtils;
+import org.apache.ignite.internal.util.typedef.F;
+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;
+import org.apache.ignite.testframework.GridTestUtils;
+
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ * Tests an optional optimization that server cursor is closed automatically
+ * when last result set page is transmitted.
+ */
+public class JdbcThinAutoCloseServerCursorTest extends JdbcThinAbstractSelfTest {
+ /** IP finder. */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** Cache name. */
+ private static final String CACHE_NAME = "cache";
+
+ /** URL. */
+ private static final String URL = "jdbc:ignite:thin://127.0.0.1/?" +
+ JdbcThinUtils.PARAM_AUTO_CLOSE_SERVER_CURSOR + "=true";
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+ CacheConfiguration cache = defaultCacheConfiguration();
+
+ cache.setName(CACHE_NAME);
+ cache.setCacheMode(PARTITIONED);
+ cache.setBackups(1);
+ cache.setWriteSynchronizationMode(FULL_SYNC);
+ cache.setIndexedTypes(Integer.class, Person.class);
+
+ cfg.setCacheConfiguration(cache);
+
+ TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+ disco.setIpFinder(IP_FINDER);
+
+ cfg.setDiscoverySpi(disco);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ super.beforeTestsStarted();
+
+ startGridsMultiThreaded(3);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ IgniteCache<Integer, Person> cache = grid(0).cache(CACHE_NAME);
+
+ cache.clear();
+ }
+
+ /**
+ * Ensure that server cursor is implicitly closed on last page.
+ *
+ * @throws Exception If failed.
+ */
+ @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
+ public void testQuery() throws Exception {
+ IgniteCache<Integer, Person> cache = grid(0).cache(CACHE_NAME);
+
+ Person persons[] = new Person[] {
+ new Person(1, "John", 25),
+ new Person(2, "Mary", 23)
+ };
+
+ for (Person person: persons)
+ cache.put(person.id, person);
+
+ try (Connection conn = DriverManager.getConnection(URL)) {
+ conn.setSchema(CACHE_NAME);
+
+ String sqlText = "select * from Person";
+
+ try (Statement stmt = conn.createStatement()) {
+ // Ensure that result set fits into one page
+ stmt.setFetchSize(2);
+
+ try (ResultSet rs = stmt.executeQuery(sqlText)) {
+ // Attempt to get query metadata when server cursor is already closed
+ GridTestUtils.assertThrows(log(), new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ return rs.getMetaData();
+ }
+ },
+ SQLException.class,
+ "Server cursor is already closed"
+ );
+
+ GridTestUtils.assertThrows(log(), new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ return rs.findColumn("id");
+ }
+ },
+ SQLException.class,
+ "Server cursor is already closed"
+ );
+
+ checkResultSet(rs, persons);
+ }
+ }
+
+ try (Statement stmt = conn.createStatement()) {
+ // Ensure multiple page result set
+ stmt.setFetchSize(1);
+
+ try (ResultSet rs = stmt.executeQuery(sqlText)) {
+ // Getting result set metadata is OK here
+ assertEquals(3, rs.getMetaData().getColumnCount());
+
+ assertEquals(1, rs.findColumn("id"));
+
+ checkResultSet(rs, persons);
+ }
+ }
+
+ try (Statement stmt = conn.createStatement()) {
+ // Ensure multiple page result set
+ stmt.setFetchSize(1);
+
+ try (ResultSet rs = stmt.executeQuery(sqlText)) {
+ checkResultSet(rs, persons);
+
+ // Server cursor is closed now
+ GridTestUtils.assertThrows(log(), new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ return rs.getMetaData();
+ }
+ },
+ SQLException.class,
+ "Server cursor is already closed"
+ );
+
+ GridTestUtils.assertThrows(log(), new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ return rs.findColumn("id");
+ }
+ },
+ SQLException.class,
+ "Server cursor is already closed"
+ );
+ }
+ }
+ }
+ }
+
+ /**
+ * Ensure that insert works when auto close of server cursor is enabled.
+ *
+ * @throws Exception If failed.
+ */
+ public void testInsert() throws Exception {
+ try (Connection conn = DriverManager.getConnection(URL)) {
+ conn.setSchema(CACHE_NAME);
+
+ String sqlText = "insert into Person (_key, id, name, age) values (?, ?, ?, ?)";
+
+ Person p = new Person(1, "John", 25);
+
+ try (PreparedStatement prepared = conn.prepareStatement(sqlText)) {
+ prepared.setInt(1, p.id);
+ prepared.setInt(2, p.id);
+ prepared.setString(3, p.name);
+ prepared.setInt(4, p.age);
+
+ assertFalse(prepared.execute());
+ assertEquals(1, prepared.getUpdateCount());
+ }
+
+ IgniteCache<Integer, Person> cache = grid(0).cache(CACHE_NAME);
+
+ assertEquals(p, cache.get(1));
+ }
+ }
+
+ /**
+ * Ensure that update works when auto close of server cursor is enabled.
+ *
+ * @throws Exception If failed.
+ */
+ public void testUpdate() throws Exception {
+ IgniteCache<Integer, Person> cache = grid(0).cache(CACHE_NAME);
+
+ Person p = new Person(1, "John", 25);
+
+ cache.put(1, p);
+
+ try (Connection conn = DriverManager.getConnection(URL)) {
+ conn.setSchema(CACHE_NAME);
+
+ String sqlText = "update Person set age = age + 1";
+
+ try (Statement stmt = conn.createStatement()) {
+ assertEquals(1, stmt.executeUpdate(sqlText));
+ }
+
+ assertEquals(p.age + 1, cache.get(1).age);
+ }
+ }
+
+ /**
+ * Ensure that delete works when auto close of server cursor is enabled.
+ *
+ * @throws Exception If failed.
+ */
+ public void testDelete() throws Exception {
+ IgniteCache<Integer, Person> cache = grid(0).cache(CACHE_NAME);
+
+ Person p = new Person(1, "John", 25);
+
+ cache.put(1, p);
+
+ try (Connection conn = DriverManager.getConnection(URL)) {
+ conn.setSchema(CACHE_NAME);
+
+ String sqlText = "delete Person where age = ?";
+
+ try (PreparedStatement prepared = conn.prepareStatement(sqlText)) {
+ prepared.setInt(1, p.age);
+
+ assertEquals(1, prepared.executeUpdate());
+ }
+
+ assertNull(cache.get(1));
+ }
+ }
+
+ /**
+ * Checks result set against array of Person.
+ *
+ * @param rs Result set.
+ * @param persons Array of Person.
+ * @throws Exception If failed.
+ */
+ private void checkResultSet(ResultSet rs, Person[] persons) throws Exception {
+ while (rs.next()) {
+ Person p = new Person(
+ rs.getInt(1),
+ rs.getString(2),
+ rs.getInt(3));
+
+ assert p.id > 0 && p.id <= persons.length;
+
+ assertEquals(persons[p.id - 1], p);
+ }
+ }
+
+ /**
+ * Person.
+ */
+ @SuppressWarnings("UnusedDeclaration")
+ static class Person implements Serializable {
+ /** ID. */
+ @QuerySqlField
+ private final int id;
+
+ /** First name. */
+ @QuerySqlField
+ private final String name;
+
+ /** Last name. */
+ @QuerySqlField
+ private final int age;
+
+ /**
+ * @param id ID.
+ * @param name Name.
+ * @param age Age.
+ */
+ Person(int id, String name, int age) {
+ assert !F.isEmpty(name);
+ assert age > 0;
+
+ this.id = id;
+ this.name = name;
+ this.age = age;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("SimplifiableIfStatement")
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ Person person = (Person) o;
+
+ if (id != person.id)
+ return false;
+
+ if (name == null ^ person.name == null)
+ return false;
+
+ if (name != null && !name.equals(person.name))
+ return false;
+
+ return age == person.age;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ int result = id;
+
+ result = 31 * result + (name != null ? name.hashCode() : 0);
+ result = 31 * result + age;
+
+ return result;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ecba1acc/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java
index 7ea22d5..8f1285b 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java
@@ -237,6 +237,42 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
}
/**
+ * Test autoCloseServerCursor property handling.
+ *
+ * @throws Exception If failed.
+ */
+ public void testAutoCloseServerCursorProperty() throws Exception {
+ String url = "jdbc:ignite:thin://127.0.0.1?" + JdbcThinUtils.PARAM_AUTO_CLOSE_SERVER_CURSOR;
+
+ String err = "Failed to parse boolean property [name=" + JdbcThinUtils.PARAM_AUTO_CLOSE_SERVER_CURSOR;
+
+ assertInvalid(url + "=0", err);
+ assertInvalid(url + "=1", err);
+ assertInvalid(url + "=false1", err);
+ assertInvalid(url + "=true1", err);
+
+ try (Connection conn = DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1")) {
+ assertFalse(io(conn).autoCloseServerCursor());
+ }
+
+ try (Connection conn = DriverManager.getConnection(url + "=true")) {
+ assertTrue(io(conn).autoCloseServerCursor());
+ }
+
+ try (Connection conn = DriverManager.getConnection(url + "=True")) {
+ assertTrue(io(conn).autoCloseServerCursor());
+ }
+
+ try (Connection conn = DriverManager.getConnection(url + "=false")) {
+ assertFalse(io(conn).autoCloseServerCursor());
+ }
+
+ try (Connection conn = DriverManager.getConnection(url + "=False")) {
+ assertFalse(io(conn).autoCloseServerCursor());
+ }
+ }
+
+ /**
* Get client socket for connection.
*
* @param conn Connection.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ecba1acc/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java
index b372085..14c34ee 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java
@@ -44,6 +44,7 @@ import static java.sql.ResultSet.CONCUR_READ_ONLY;
import static java.sql.ResultSet.HOLD_CURSORS_OVER_COMMIT;
import static java.sql.ResultSet.TYPE_FORWARD_ONLY;
+import static org.apache.ignite.internal.jdbc.thin.JdbcThinUtils.PROP_AUTO_CLOSE_SERVER_CURSORS;
import static org.apache.ignite.internal.jdbc.thin.JdbcThinUtils.PROP_HOST;
import static org.apache.ignite.internal.jdbc.thin.JdbcThinUtils.PROP_PORT;
import static org.apache.ignite.internal.jdbc.thin.JdbcThinUtils.PROP_DISTRIBUTED_JOINS;
@@ -106,6 +107,7 @@ public class JdbcThinConnection implements Connection {
boolean enforceJoinOrder = extractBoolean(props, PROP_ENFORCE_JOIN_ORDER, false);
boolean collocated = extractBoolean(props, PROP_COLLOCATED, false);
boolean replicatedOnly = extractBoolean(props, PROP_REPLICATED_ONLY, false);
+ boolean autoCloseServerCursor = extractBoolean(props, PROP_AUTO_CLOSE_SERVER_CURSORS, false);
int sockSndBuf = extractIntNonNegative(props, PROP_SOCK_SND_BUF, 0);
int sockRcvBuf = extractIntNonNegative(props, PROP_SOCK_RCV_BUF, 0);
@@ -114,7 +116,7 @@ public class JdbcThinConnection implements Connection {
try {
cliIo = new JdbcThinTcpIo(host, port, distributedJoins, enforceJoinOrder, collocated, replicatedOnly,
- sockSndBuf, sockRcvBuf, tcpNoDelay);
+ autoCloseServerCursor, sockSndBuf, sockRcvBuf, tcpNoDelay);
cliIo.start();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ecba1acc/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinResultSet.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinResultSet.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinResultSet.java
index 87bc526..5c61e23 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinResultSet.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinResultSet.java
@@ -94,6 +94,9 @@ public class JdbcThinResultSet implements ResultSet {
/** Is query flag. */
private boolean isQuery;
+ /** Auto close server cursors flag. */
+ private boolean autoClose;
+
/** Update count. */
private long updCnt;
@@ -105,11 +108,13 @@ public class JdbcThinResultSet implements ResultSet {
* @param fetchSize Fetch size.
* @param finished Finished flag.
* @param rows Rows.
- * @param isQuery Is Result ser for Select query
+ * @param isQuery Is Result ser for Select query.
+ * @param autoClose Is automatic close of server cursors enabled.
+ * @param updCnt Update count.
*/
@SuppressWarnings("OverlyStrongTypeCast")
JdbcThinResultSet(JdbcThinStatement stmt, long qryId, int fetchSize, boolean finished,
- List<List<Object>> rows, boolean isQuery, long updCnt) {
+ List<List<Object>> rows, boolean isQuery, boolean autoClose, long updCnt) {
assert stmt != null;
assert fetchSize > 0;
@@ -118,6 +123,7 @@ public class JdbcThinResultSet implements ResultSet {
this.fetchSize = fetchSize;
this.finished = finished;
this.isQuery = isQuery;
+ this.autoClose = autoClose;
if (isQuery) {
this.fetchSize = fetchSize;
@@ -134,7 +140,7 @@ public class JdbcThinResultSet implements ResultSet {
@Override public boolean next() throws SQLException {
ensureNotClosed();
- if (rowsIter == null && !finished) {
+ if ((rowsIter == null || !rowsIter.hasNext()) && !finished) {
try {
JdbcQueryFetchResult res = stmt.connection().io().queryFetch(qryId, fetchSize);
@@ -178,7 +184,8 @@ public class JdbcThinResultSet implements ResultSet {
return;
try {
- stmt.connection().io().queryClose(qryId);
+ if (!finished || (isQuery && !autoClose))
+ stmt.connection().io().queryClose(qryId);
closed = true;
}
@@ -1616,6 +1623,9 @@ public class JdbcThinResultSet implements ResultSet {
* @throws SQLException On error.
*/
private List<JdbcColumnMeta> meta() throws SQLException {
+ if (finished && (!isQuery || autoClose))
+ throw new SQLException("Server cursor is already closed.");
+
if (!metaInit) {
try {
JdbcQueryMetadataResult res = stmt.connection().io().queryMeta(qryId);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ecba1acc/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinStatement.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinStatement.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinStatement.java
index a0b7ee6..2cad223 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinStatement.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinStatement.java
@@ -112,7 +112,7 @@ public class JdbcThinStatement implements Statement {
assert res != null;
rs = new JdbcThinResultSet(this, res.getQueryId(), pageSize, res.last(), res.items(),
- res.isQuery(), res.updateCount());
+ res.isQuery(), conn.io().autoCloseServerCursor(), res.updateCount());
}
catch (IOException e) {
conn.close();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ecba1acc/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinTcpIo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinTcpIo.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinTcpIo.java
index 1905ea4..be62a8d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinTcpIo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinTcpIo.java
@@ -53,7 +53,7 @@ public class JdbcThinTcpIo {
private static final SqlListenerProtocolVersion CURRENT_VER = SqlListenerProtocolVersion.create(2, 1, 0);
/** Initial output stream capacity for handshake. */
- private static final int HANDSHAKE_MSG_SIZE = 12;
+ private static final int HANDSHAKE_MSG_SIZE = 13;
/** Initial output for query message. */
private static final int QUERY_EXEC_MSG_INIT_CAP = 256;
@@ -85,6 +85,9 @@ public class JdbcThinTcpIo {
/** Replicated only flag. */
private final boolean replicatedOnly;
+ /** Flag to automatically close server cursor. */
+ private final boolean autoCloseServerCursor;
+
/** Socket send buffer. */
private final int sockSndBuf;
@@ -115,18 +118,20 @@ public class JdbcThinTcpIo {
* @param enforceJoinOrder Enforce join order flag.
* @param collocated Collocated flag.
* @param replicatedOnly Replicated only flag.
+ * @param autoCloseServerCursor Flag to automatically close server cursors.
* @param sockSndBuf Socket send buffer.
* @param sockRcvBuf Socket receive buffer.
* @param tcpNoDelay TCP no delay flag.
*/
JdbcThinTcpIo(String host, int port, boolean distributedJoins, boolean enforceJoinOrder, boolean collocated,
- boolean replicatedOnly, int sockSndBuf, int sockRcvBuf, boolean tcpNoDelay) {
+ boolean replicatedOnly, boolean autoCloseServerCursor, int sockSndBuf, int sockRcvBuf, boolean tcpNoDelay) {
this.host = host;
this.port = port;
this.distributedJoins = distributedJoins;
this.enforceJoinOrder = enforceJoinOrder;
this.collocated = collocated;
this.replicatedOnly = replicatedOnly;
+ this.autoCloseServerCursor = autoCloseServerCursor;
this.sockSndBuf = sockSndBuf;
this.sockRcvBuf = sockRcvBuf;
this.tcpNoDelay = tcpNoDelay;
@@ -182,6 +187,7 @@ public class JdbcThinTcpIo {
writer.writeBoolean(enforceJoinOrder);
writer.writeBoolean(collocated);
writer.writeBoolean(replicatedOnly);
+ writer.writeBoolean(autoCloseServerCursor);
send(writer.array());
@@ -382,6 +388,13 @@ public class JdbcThinTcpIo {
}
/**
+ * @return Auto close server cursors flag.
+ */
+ public boolean autoCloseServerCursor() {
+ return autoCloseServerCursor;
+ }
+
+ /**
* @return Socket send buffer size.
*/
public int socketSendBuffer() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ecba1acc/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinUtils.java
index aa9b011..78e8c8f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinUtils.java
@@ -17,7 +17,6 @@
package org.apache.ignite.internal.jdbc.thin;
-import org.apache.ignite.configuration.OdbcConfiguration;
import org.apache.ignite.configuration.SqlConnectorConfiguration;
import java.sql.Time;
@@ -76,6 +75,9 @@ public class JdbcThinUtils {
/** Parameter: TCP no-delay flag. */
public static final String PARAM_TCP_NO_DELAY = "tcpNoDelay";
+ /** Parameter: Automatically close server cursor. */
+ public static final String PARAM_AUTO_CLOSE_SERVER_CURSOR = "autoCloseServerCursor";
+
/** Distributed joins property name. */
public static final String PROP_DISTRIBUTED_JOINS = PROP_PREFIX + PARAM_DISTRIBUTED_JOINS;
@@ -97,6 +99,9 @@ public class JdbcThinUtils {
/** TCP no delay property name. */
public static final String PROP_TCP_NO_DELAY = PROP_PREFIX + PARAM_TCP_NO_DELAY;
+ /** Automatically close server cursor. */
+ public static final String PROP_AUTO_CLOSE_SERVER_CURSORS = PROP_PREFIX + PARAM_AUTO_CLOSE_SERVER_CURSOR;
+
/** Default port. */
public static final int DFLT_PORT = SqlConnectorConfiguration.DFLT_PORT;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ecba1acc/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java
index bff5519..6bb4e29 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java
@@ -252,9 +252,10 @@ public class SqlListenerNioListener extends GridNioServerListenerAdapter<byte[]>
boolean enforceJoinOrder = reader.readBoolean();
boolean collocated = reader.readBoolean();
boolean replicatedOnly = reader.readBoolean();
+ boolean autoCloseCursors = reader.readBoolean();
SqlListenerRequestHandler handler = new JdbcRequestHandler(ctx, busyLock, maxCursors, distributedJoins,
- enforceJoinOrder, collocated, replicatedOnly);
+ enforceJoinOrder, collocated, replicatedOnly, autoCloseCursors);
SqlListenerMessageParser parser = new JdbcMessageParser(ctx);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ecba1acc/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcQueryCursor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcQueryCursor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcQueryCursor.java
index b8edb8d..830daea 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcQueryCursor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcQueryCursor.java
@@ -65,13 +65,16 @@ class JdbcQueryCursor {
* @return List of the rows.
*/
List<List<Object>> fetchRows() {
- List<List<Object>> items = new ArrayList<>();
+ int fetchSize = (maxRows > 0) ? (int)Math.min(pageSize, maxRows - fetched) : pageSize;
- int fetchSize0 = (maxRows > 0) ? (int)Math.min(pageSize, maxRows - fetched) : pageSize;
+ List<List<Object>> items = new ArrayList<>(fetchSize);
- for (; fetched < fetchSize0 && iter.hasNext(); ++fetched)
+ for (int i = 0; i < fetchSize && iter.hasNext(); i++) {
items.add(iter.next());
+ fetched++;
+ }
+
return items;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ecba1acc/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandler.java
index 0796cfc..94ac433 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandler.java
@@ -74,6 +74,9 @@ public class JdbcRequestHandler implements SqlListenerRequestHandler {
/** Replicated only flag. */
private final boolean replicatedOnly;
+ /** Automatic close of cursors. */
+ private final boolean autoCloseCursors;
+
/**
* Constructor.
*
@@ -84,9 +87,11 @@ public class JdbcRequestHandler implements SqlListenerRequestHandler {
* @param enforceJoinOrder Enforce join order flag.
* @param collocated Collocated flag.
* @param replicatedOnly Replicated only flag.
+ * @param autoCloseCursors Flag to automatically close server cursors.
*/
public JdbcRequestHandler(GridKernalContext ctx, GridSpinBusyLock busyLock, int maxCursors,
- boolean distributedJoins, boolean enforceJoinOrder, boolean collocated, boolean replicatedOnly) {
+ boolean distributedJoins, boolean enforceJoinOrder, boolean collocated, boolean replicatedOnly,
+ boolean autoCloseCursors) {
this.ctx = ctx;
this.busyLock = busyLock;
this.maxCursors = maxCursors;
@@ -94,6 +99,7 @@ public class JdbcRequestHandler implements SqlListenerRequestHandler {
this.enforceJoinOrder = enforceJoinOrder;
this.collocated = collocated;
this.replicatedOnly = replicatedOnly;
+ this.autoCloseCursors = autoCloseCursors;
log = ctx.log(getClass());
}
@@ -183,8 +189,6 @@ public class JdbcRequestHandler implements SqlListenerRequestHandler {
JdbcQueryCursor cur = new JdbcQueryCursor(qryId, req.pageSize(), req.maxRows(), (QueryCursorImpl)qryCur);
- qryCursors.put(qryId, cur);
-
JdbcQueryExecuteResult res;
if (cur.isQuery())
@@ -200,6 +204,11 @@ public class JdbcRequestHandler implements SqlListenerRequestHandler {
res = new JdbcQueryExecuteResult(qryId, (Long)items.get(0).get(0));
}
+ if (res.last() && (!res.isQuery() || autoCloseCursors))
+ cur.close();
+ else
+ qryCursors.put(qryId, cur);
+
return new JdbcResponse(res);
}
catch (Exception e) {
@@ -260,6 +269,12 @@ public class JdbcRequestHandler implements SqlListenerRequestHandler {
JdbcQueryFetchResult res = new JdbcQueryFetchResult(cur.fetchRows(), !cur.hasNext());
+ if (res.last() && (!cur.isQuery() || autoCloseCursors)) {
+ qryCursors.remove(req.queryId());
+
+ cur.close();
+ }
+
return new JdbcResponse(res);
}
catch (Exception e) {
[02/42] ignite git commit: Fixed hang in GridServiceProcessor.stop in
deactivated state.
Posted by ag...@apache.org.
Fixed hang in GridServiceProcessor.stop in deactivated state.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/98cdcfdf
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/98cdcfdf
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/98cdcfdf
Branch: refs/heads/ignite-5267-merge-ea
Commit: 98cdcfdff72aa5a7ec9efb9b7f06a67b56c4ab0d
Parents: 915ea32
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jun 6 15:44:38 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jun 6 15:44:38 2017 +0300
----------------------------------------------------------------------
.../service/GridServiceProcessor.java | 32 +++++++++++++++-----
1 file changed, 25 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/98cdcfdf/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
index fd8141c..e3d365f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
@@ -149,7 +149,7 @@ public class GridServiceProcessor extends GridProcessorAdapter implements Ignite
private volatile ExecutorService depExe;
/** Busy lock. */
- private final GridSpinBusyLock busyLock = new GridSpinBusyLock();
+ private volatile GridSpinBusyLock busyLock = new GridSpinBusyLock();
/** Thread factory. */
private ThreadFactory threadFactory = new IgniteThreadFactory(ctx.igniteInstanceName());
@@ -281,8 +281,14 @@ public class GridServiceProcessor extends GridProcessorAdapter implements Ignite
if (ctx.isDaemon())
return;
+ GridSpinBusyLock busyLock = this.busyLock;
+
// Will not release it.
- busyLock.block();
+ if (busyLock != null) {
+ busyLock.block();
+
+ this.busyLock = null;
+ }
U.shutdownNow(GridServiceProcessor.class, depExe, log);
@@ -338,6 +344,8 @@ public class GridServiceProcessor extends GridProcessorAdapter implements Ignite
log.debug("Activate service processor [nodeId=" + ctx.localNodeId() +
" topVer=" + ctx.discovery().topologyVersionEx() + " ]");
+ busyLock = new GridSpinBusyLock();
+
depExe = Executors.newSingleThreadExecutor(new IgniteThreadFactory(ctx.igniteInstanceName(), "srvc-deploy"));
start(true);
@@ -1338,7 +1346,9 @@ public class GridServiceProcessor extends GridProcessorAdapter implements Ignite
private class ServiceEntriesListener implements CacheEntryUpdatedListener<Object, Object> {
/** {@inheritDoc} */
@Override public void onUpdated(final Iterable<CacheEntryEvent<?, ?>> deps) {
- if (!busyLock.enterBusy())
+ GridSpinBusyLock busyLock = GridServiceProcessor.this.busyLock;
+
+ if (busyLock == null || !busyLock.enterBusy())
return;
try {
@@ -1483,7 +1493,9 @@ public class GridServiceProcessor extends GridProcessorAdapter implements Ignite
}
@Override public void onTimeout() {
- if (!busyLock.enterBusy())
+ GridSpinBusyLock busyLock = GridServiceProcessor.this.busyLock;
+
+ if (busyLock == null || !busyLock.enterBusy())
return;
try {
@@ -1504,7 +1516,9 @@ public class GridServiceProcessor extends GridProcessorAdapter implements Ignite
private class TopologyListener implements DiscoveryEventListener {
/** {@inheritDoc} */
@Override public void onEvent(DiscoveryEvent evt, final DiscoCache discoCache) {
- if (!busyLock.enterBusy())
+ GridSpinBusyLock busyLock = GridServiceProcessor.this.busyLock;
+
+ if (busyLock == null || !busyLock.enterBusy())
return;
try {
@@ -1626,7 +1640,9 @@ public class GridServiceProcessor extends GridProcessorAdapter implements Ignite
*/
private void onReassignmentFailed(final AffinityTopologyVersion topVer,
final Collection<GridServiceDeployment> retries) {
- if (!busyLock.enterBusy())
+ GridSpinBusyLock busyLock = GridServiceProcessor.this.busyLock;
+
+ if (busyLock == null || !busyLock.enterBusy())
return;
try {
@@ -1744,7 +1760,9 @@ public class GridServiceProcessor extends GridProcessorAdapter implements Ignite
private abstract class DepRunnable implements Runnable {
/** {@inheritDoc} */
@Override public void run() {
- if (!busyLock.enterBusy())
+ GridSpinBusyLock busyLock = GridServiceProcessor.this.busyLock;
+
+ if (busyLock == null || !busyLock.enterBusy())
return;
// Won't block ServiceProcessor stopping process.
[12/42] ignite git commit: ignite-5196 JDBC Driver fix
Posted by ag...@apache.org.
ignite-5196 JDBC Driver fix
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5120a245
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5120a245
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5120a245
Branch: refs/heads/ignite-5267-merge-ea
Commit: 5120a245ee5819ee3602b659e4146362cd38adc0
Parents: 8555e21
Author: Igor Seliverstov <gv...@gmail.com>
Authored: Wed Jun 7 15:00:16 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jun 7 15:00:16 2017 +0300
----------------------------------------------------------------------
.../processors/cache/query/jdbc/GridCacheQueryJdbcTask.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5120a245/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcTask.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcTask.java
index 4ae8a8a..ba87cff 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcTask.java
@@ -106,9 +106,9 @@ public class GridCacheQueryJdbcTask extends ComputeTaskAdapter<byte[], byte[]> {
else {
String cache = (String)args.get("cache");
- Map<? extends ComputeJob, ClusterNode> node = mapToNode(subgrid, args, first, cache);
+ Map<? extends ComputeJob, ClusterNode> node = null;
- if (node == null && cache == null) {
+ if (cache == null) {
boolean start = ignite.configuration().isClientMode();
IgniteCache<?, ?> cache0 =
@@ -117,6 +117,8 @@ public class GridCacheQueryJdbcTask extends ComputeTaskAdapter<byte[], byte[]> {
if (cache0 != null)
node = mapToNode(subgrid, args, first, cache0.getName());
}
+ else
+ node = mapToNode(subgrid, args, first, cache);
if (node != null)
return node;
[30/42] ignite git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/ignite
Posted by ag...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/ignite
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4b0998e5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4b0998e5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4b0998e5
Branch: refs/heads/ignite-5267-merge-ea
Commit: 4b0998e5d22a94f56db5ddc65ad7fc274a1e3199
Parents: e3ff16a a1e6edc
Author: Sergi Vladykin <se...@gmail.com>
Authored: Thu Jun 8 20:39:13 2017 +0300
Committer: Sergi Vladykin <se...@gmail.com>
Committed: Thu Jun 8 20:39:13 2017 +0300
----------------------------------------------------------------------
.../ClientTcpUnreachableMultiNodeSelfTest.java | 6 +-
.../configuration/CacheConfiguration.java | 24 +++
.../ignite/internal/binary/BinaryContext.java | 1 -
.../ignite/internal/binary/BinaryFieldEx.java | 5 +
.../ignite/internal/binary/BinaryFieldImpl.java | 5 +
.../ignite/internal/client/GridClientNode.java | 9 +-
.../client/impl/GridClientNodeImpl.java | 22 +-
.../connection/GridClientNioTcpConnection.java | 3 +-
.../PlatformDotNetConfigurationClosure.java | 8 +-
.../utils/PlatformConfigurationUtils.java | 8 +
.../query/DynamicTableAffinityKeyMapper.java | 92 ++++++++
.../processors/query/GridQueryProcessor.java | 59 +++---
.../internal/processors/query/QueryUtils.java | 19 +-
.../rest/client/message/GridClientNodeBean.java | 25 +++
.../top/GridTopologyCommandHandler.java | 1 +
.../query/h2/ddl/DdlStatementsProcessor.java | 5 +-
.../processors/query/h2/opt/GridH2Table.java | 5 +-
.../query/h2/sql/GridSqlCreateTable.java | 37 +++-
.../query/h2/sql/GridSqlQueryParser.java | 54 +++++
.../cache/index/H2DynamicTableSelfTest.java | 209 +++++++++++++++++--
.../Cache/CacheConfigurationTest.cs | 10 +
.../IgniteConfigurationSerializerTest.cs | 11 +-
.../IgniteConfigurationTest.cs | 4 +
.../Cache/Configuration/CacheConfiguration.cs | 23 ++
.../Datastream/IDataStreamer.cs | 8 +-
.../Apache.Ignite.Core/IgniteConfiguration.cs | 20 ++
.../IgniteConfigurationSection.xsd | 12 ++
modules/web-console/backend/.gitignore | 1 +
modules/web-console/frontend/.gitignore | 1 +
.../yardstick/cache/load/model/ModelUtil.java | 1 +
30 files changed, 621 insertions(+), 67 deletions(-)
----------------------------------------------------------------------
[41/42] ignite git commit: Merge from ignite-5267
Posted by ag...@apache.org.
Merge from ignite-5267
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/fbb51b01
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/fbb51b01
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/fbb51b01
Branch: refs/heads/ignite-5267-merge-ea
Commit: fbb51b01caa666ec9625b9c7f05f80020b05d647
Parents: 4b89ae0 b6c7361
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Fri Jun 9 17:17:47 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Jun 9 17:17:47 2017 +0300
----------------------------------------------------------------------
config/ignite-log4j.xml | 6 +-
config/ignite-log4j2.xml | 6 +-
.../ClientTcpUnreachableMultiNodeSelfTest.java | 6 +-
.../jdbc/suite/IgniteJdbcDriverTestSuite.java | 2 +
.../thin/JdbcThinAutoCloseServerCursorTest.java | 359 +++++++++++++++++++
.../jdbc/thin/JdbcThinConnectionSelfTest.java | 36 ++
modules/clients/src/test/resources/log4j.xml | 2 +-
.../apache/ignite/IgniteSystemProperties.java | 3 +
.../configuration/CacheConfiguration.java | 24 ++
.../configuration/IgniteConfiguration.java | 6 +
.../SqlConnectorConfiguration.java | 2 +-
.../internal/binary/BinaryClassDescriptor.java | 1 -
.../ignite/internal/binary/BinaryContext.java | 1 -
.../ignite/internal/binary/BinaryFieldEx.java | 5 +
.../ignite/internal/binary/BinaryFieldImpl.java | 5 +
.../ignite/internal/client/GridClientNode.java | 9 +-
.../client/impl/GridClientNodeImpl.java | 22 +-
.../connection/GridClientNioTcpConnection.java | 3 +-
.../internal/jdbc/thin/JdbcThinConnection.java | 4 +-
.../internal/jdbc/thin/JdbcThinResultSet.java | 18 +-
.../internal/jdbc/thin/JdbcThinStatement.java | 2 +-
.../internal/jdbc/thin/JdbcThinTcpIo.java | 17 +-
.../internal/jdbc/thin/JdbcThinUtils.java | 7 +-
.../discovery/GridDiscoveryManager.java | 32 +-
.../processors/cache/ClusterCachesInfo.java | 29 +-
.../processors/cache/GridCacheAttributes.java | 17 +-
.../GridCachePartitionExchangeManager.java | 142 ++++----
.../processors/cache/GridCacheProcessor.java | 138 ++++---
.../processors/cache/StoredCacheData.java | 17 +
.../GridDhtPartitionsExchangeFuture.java | 62 ++--
.../query/jdbc/GridCacheQueryJdbcTask.java | 6 +-
.../processors/cluster/ClusterProcessor.java | 5 +-
.../processors/odbc/SqlListenerNioListener.java | 5 +-
.../processors/odbc/jdbc/JdbcQueryCursor.java | 9 +-
.../odbc/jdbc/JdbcRequestHandler.java | 21 +-
.../PlatformDotNetConfigurationClosure.java | 8 +-
.../utils/PlatformConfigurationUtils.java | 94 +++++
.../query/DynamicTableAffinityKeyMapper.java | 92 +++++
.../processors/query/GridQueryProcessor.java | 18 +-
.../internal/processors/query/QueryUtils.java | 51 ++-
.../rest/client/message/GridClientNodeBean.java | 25 ++
.../handlers/cache/GridCacheCommandHandler.java | 4 +-
.../top/GridTopologyCommandHandler.java | 11 +-
.../service/GridServiceProcessor.java | 32 +-
.../node/VisorExecutorServiceConfiguration.java | 20 +-
.../visor/node/VisorGridConfiguration.java | 22 +-
.../visor/node/VisorOdbcConfiguration.java | 114 ------
.../node/VisorSqlConnectorConfiguration.java | 166 +++++++++
.../visor/query/VisorQueryIndexField.java | 32 +-
.../internal/visor/query/VisorRunningQuery.java | 20 +-
.../resources/META-INF/classnames.properties | 2 +-
modules/core/src/test/config/log4j-test.xml | 6 +-
modules/core/src/test/config/log4j2-test.xml | 6 +-
.../src/test/config/log4j2-verbose-test.xml | 4 +-
.../ignite/internal/ClusterGroupSelfTest.java | 100 ++++++
.../processors/cache/IgniteCacheGroupsTest.java | 98 ++---
.../top/CacheTopologyCommandHandlerTest.java | 152 ++++++++
.../loadtest/GridSingleExecutionTest.java | 4 +-
.../cache/GridCacheAbstractLoadTest.java | 4 +-
.../testframework/junits/GridAbstractTest.java | 4 +-
.../junits/logger/GridTestLog4jLogger.java | 4 +-
.../testsuites/IgniteRestHandlerTestSuite.java | 2 +
.../shuffle/streams/HadoopOffheapBuffer.java | 2 +-
.../query/h2/ddl/DdlStatementsProcessor.java | 16 +-
.../processors/query/h2/opt/GridH2Table.java | 5 +-
.../query/h2/sql/GridSqlCreateTable.java | 37 +-
.../processors/query/h2/sql/GridSqlJoin.java | 7 +
.../query/h2/sql/GridSqlQueryParser.java | 54 +++
.../query/h2/sql/GridSqlQuerySplitter.java | 147 +++++++-
.../h2/twostep/msg/GridH2IndexRangeRequest.java | 2 +
.../cache/index/H2DynamicTableSelfTest.java | 270 +++++++++++---
.../query/IgniteSqlSplitterSelfTest.java | 97 +++++
.../apache/ignite/logger/log4j/Log4JLogger.java | 4 +-
.../log4j/GridLog4jCorrectFileNameTest.java | 2 +-
.../ignite/logger/log4j2/Log4J2Logger.java | 2 +-
.../impls/matrix/SparseDistributedMatrix.java | 9 -
.../matrix/SparseDistributedMatrixTest.java | 9 -
.../IgnitePersistentStoreSchemaLoadTest.java | 10 +-
.../Cache/CacheConfigurationTest.cs | 10 +
.../Config/Log/dotnet-log4j.xml | 2 +-
.../IgniteConfigurationSerializerTest.cs | 37 +-
.../IgniteConfigurationTest.cs | 60 ++++
.../Apache.Ignite.Core.csproj | 2 +
.../Cache/Configuration/CacheConfiguration.cs | 23 ++
.../Configuration/Package-Info.cs | 26 ++
.../Configuration/SqlConnectorConfiguration.cs | 159 ++++++++
.../Datastream/IDataStreamer.cs | 8 +-
.../Apache.Ignite.Core/IgniteConfiguration.cs | 184 ++++++++++
.../IgniteConfigurationSection.xsd | 104 ++++++
.../Common/IgniteConfigurationXmlSerializer.cs | 10 +
.../config/VisorConfigurationCommand.scala | 1 +
.../src/main/java/log4j.properties | 2 +-
modules/web-console/backend/.gitignore | 1 +
modules/web-console/backend/app/mongo.js | 12 +
modules/web-console/frontend/.gitignore | 1 +
.../app/modules/agent/AgentManager.service.js | 2 +
.../modules/configuration/Version.service.js | 4 +
.../generator/AbstractTransformer.js | 9 +-
.../generator/ConfigurationGenerator.js | 35 +-
.../generator/defaults/Cluster.service.js | 9 +
.../states/configuration/caches/query.pug | 3 +-
.../states/configuration/clusters/memory.pug | 9 +
.../states/configuration/clusters/odbc.pug | 2 +-
.../configuration/clusters/sql-connector.pug | 62 ++++
.../frontend/controllers/clusters-controller.js | 5 +-
.../frontend/controllers/domains-controller.js | 169 ++++-----
.../views/configuration/clusters.tpl.pug | 6 +
.../views/configuration/domains-import.tpl.pug | 4 +-
.../apache/ignite/console/agent/AgentUtils.java | 24 +-
.../ignite/console/agent/db/DbColumn.java | 17 +-
.../ignite/console/agent/db/DbSchema.java | 60 ++++
.../apache/ignite/console/agent/db/DbTable.java | 21 +-
.../db/dialect/DatabaseMetadataDialect.java | 27 +-
.../agent/db/dialect/JdbcMetadataDialect.java | 42 ++-
.../agent/db/dialect/OracleMetadataDialect.java | 116 ++++--
.../agent/handlers/DatabaseListener.java | 18 +-
.../src/main/resources/log4j.properties | 6 +-
117 files changed, 3351 insertions(+), 738 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fbb51b01/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fbb51b01/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fbb51b01/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 e3b0ebf,e3bda2c..5b61c2f
--- 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
@@@ -49,7 -49,6 +49,8 @@@ import org.apache.ignite.cluster.Cluste
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.internal.IgniteClientDisconnectedCheckedException;
+import org.apache.ignite.internal.IgniteDiagnosticAware;
++import org.apache.ignite.internal.IgniteDiagnosticAware;
import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
@@@ -1428,93 -1428,83 +1433,92 @@@ public class GridCachePartitionExchange
/**
* @param timeout Operation timeout.
+ * @return {@code True} if found long running operations.
*/
- public void dumpLongRunningOperations(long timeout) {
- try {
- GridDhtPartitionsExchangeFuture lastFut = lastInitializedFut;
-
- // If exchange is in progress it will dump all hanging operations if any.
- if (lastFut != null && !lastFut.isDone())
- return;
+ private boolean dumpLongRunningOperations0(long timeout) {
+ long curTime = U.currentTimeMillis();
- long curTime = U.currentTimeMillis();
+ boolean found = false;
- boolean found = false;
+ IgniteTxManager tm = cctx.tm();
- IgniteTxManager tm = cctx.tm();
+ GridCacheMvccManager mvcc = cctx.mvcc();
- if (tm != null) {
- for (IgniteInternalTx tx : tm.activeTransactions()) {
- if (curTime - tx.startTime() > timeout) {
- found = true;
+ if (tm != null) {
+ for (IgniteInternalTx tx : tm.activeTransactions()) {
+ if (curTime - tx.startTime() > timeout) {
+ found = true;
- if (longRunningOpsDumpCnt < GridDhtPartitionsExchangeFuture.DUMP_PENDING_OBJECTS_THRESHOLD) {
- U.warn(log, "Found long running transaction [startTime=" + formatTime(tx.startTime()) +
- ", curTime=" + formatTime(curTime) + ", tx=" + tx + ']');
- }
- else
- break;
- }
+ U.warn(log, "Found long running transaction [startTime=" + formatTime(tx.startTime()) +
+ ", curTime=" + formatTime(curTime) + ", tx=" + tx + ']');
}
}
+ }
- GridCacheMvccManager mvcc = cctx.mvcc();
-
- if (mvcc != null) {
- for (GridCacheFuture<?> fut : mvcc.activeFutures()) {
- if (curTime - fut.startTime() > timeout) {
- found = true;
+ if (mvcc != null) {
+ for (GridCacheFuture<?> fut : mvcc.activeFutures()) {
+ if (curTime - fut.startTime() > timeout) {
+ found = true;
- if (longRunningOpsDumpCnt < GridDhtPartitionsExchangeFuture.DUMP_PENDING_OBJECTS_THRESHOLD) {
- U.warn(log, "Found long running cache future [startTime=" + formatTime(fut.startTime()) +
- ", curTime=" + formatTime(curTime) + ", fut=" + fut + ']');
+ U.warn(log, "Found long running cache future [startTime=" + formatTime(fut.startTime()) +
+ ", curTime=" + formatTime(curTime) + ", fut=" + fut + ']');
+
- if (fut instanceof IgniteDiagnosticAware)
- ((IgniteDiagnosticAware)fut).dumpDiagnosticInfo();
- }
- else
- break;
- }
++ if (fut instanceof IgniteDiagnosticAware)
++ ((IgniteDiagnosticAware)fut).dumpDiagnosticInfo();
}
+ }
- for (GridCacheFuture<?> fut : mvcc.atomicFutures()) {
- if (curTime - fut.startTime() > timeout) {
- found = true;
+ for (GridCacheFuture<?> fut : mvcc.atomicFutures()) {
+ if (curTime - fut.startTime() > timeout) {
+ found = true;
- if (longRunningOpsDumpCnt < GridDhtPartitionsExchangeFuture.DUMP_PENDING_OBJECTS_THRESHOLD) {
- U.warn(log, "Found long running cache future [startTime=" + formatTime(fut.startTime()) +
- ", curTime=" + formatTime(curTime) + ", fut=" + fut + ']');
+ U.warn(log, "Found long running cache future [startTime=" + formatTime(fut.startTime()) +
+ ", curTime=" + formatTime(curTime) + ", fut=" + fut + ']');
+
- if (fut instanceof IgniteDiagnosticAware)
- ((IgniteDiagnosticAware)fut).dumpDiagnosticInfo();
- }
- else
- break;
- }
++ if (fut instanceof IgniteDiagnosticAware)
++ ((IgniteDiagnosticAware)fut).dumpDiagnosticInfo();
}
}
+ }
+
++ cctx.io().dumpPendingMessages();
++
+ return found;
+ }
- cctx.io().dumpPendingMessages();
+ /**
+ * @param timeout Operation timeout.
+ */
+ public void dumpLongRunningOperations(long timeout) {
+ try {
+ GridDhtPartitionsExchangeFuture lastFut = lastInitializedFut;
- if (found) {
- if (longRunningOpsDumpCnt < GridDhtPartitionsExchangeFuture.DUMP_PENDING_OBJECTS_THRESHOLD) {
- longRunningOpsDumpCnt++;
+ // If exchange is in progress it will dump all hanging operations if any.
+ if (lastFut != null && !lastFut.isDone())
+ return;
- if (IgniteSystemProperties.getBoolean(IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT, false)) {
- U.warn(log, "Found long running cache operations, dump threads.");
+ if (U.currentTimeMillis() < nextLongRunningOpsDumpTime)
+ return;
- U.dumpThreads(log);
- }
+ if (dumpLongRunningOperations0(timeout)) {
+ nextLongRunningOpsDumpTime = U.currentTimeMillis() + nextDumpTimeout(longRunningOpsDumpStep++, timeout);
- U.warn(log, "Found long running cache operations, dump IO statistics.");
+ if (IgniteSystemProperties.getBoolean(IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT, false)) {
+ U.warn(log, "Found long running cache operations, dump threads.");
- // Dump IO manager statistics.
- if (IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_IO_DUMP_ON_TIMEOUT, false))
- cctx.gridIO().dumpStats();
+ U.dumpThreads(log);
}
+
+ U.warn(log, "Found long running cache operations, dump IO statistics.");
+
+ // Dump IO manager statistics.
- cctx.gridIO().dumpStats();
++ if (IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_IO_DUMP_ON_TIMEOUT, false))
++ cctx.gridIO().dumpStats();
+ }
+ else {
+ nextLongRunningOpsDumpTime = 0;
+ longRunningOpsDumpStep = 0;
}
- else
- longRunningOpsDumpCnt = 0;
}
catch (Exception e) {
U.error(log, "Failed to dump debug information: " + e, e);
@@@ -1839,9 -1825,7 +1847,9 @@@
if (IgniteSystemProperties.getBoolean(IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT, false))
U.dumpThreads(log);
- dumpedObjects++;
+ nextDumpTime = U.currentTimeMillis() + nextDumpTimeout(dumpCnt++, futTimeout);
+
+ exchFut.dumpDiagnosticInfo();
}
}
catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/fbb51b01/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fbb51b01/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 90eec85,1d04dec..aaa4944
--- 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
@@@ -52,20 -50,19 +51,16 @@@ import org.apache.ignite.internal.clust
import org.apache.ignite.internal.events.DiscoveryCustomEvent;
import org.apache.ignite.internal.managers.discovery.DiscoCache;
import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
- import org.apache.ignite.internal.managers.discovery.DiscoCache;
- import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
import org.apache.ignite.internal.pagemem.snapshot.SnapshotOperation;
-import org.apache.ignite.internal.pagemem.snapshot.SnapshotOperationType;
import org.apache.ignite.internal.pagemem.snapshot.StartSnapshotOperationAckDiscoveryMessage;
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.CacheGroupDescriptor;
import org.apache.ignite.internal.processors.cache.CacheGroupContext;
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.DynamicCacheChangeRequest;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
import org.apache.ignite.internal.processors.cache.ExchangeActions;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
@@@ -94,7 -91,7 +88,6 @@@ import org.apache.ignite.internal.util.
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.lang.IgniteRunnable;
--import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
@@@ -114,14 -114,7 +110,10 @@@ import static org.apache.ignite.interna
*/
@SuppressWarnings({"TypeMayBeWeakened", "unchecked"})
public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityTopologyVersion>
- implements Comparable<GridDhtPartitionsExchangeFuture>, GridDhtTopologyFuture, CachePartitionExchangeWorkerTask {
+ implements Comparable<GridDhtPartitionsExchangeFuture>, GridDhtTopologyFuture, CachePartitionExchangeWorkerTask, IgniteDiagnosticAware {
+ /** */
- public static final int DUMP_PENDING_OBJECTS_THRESHOLD =
- IgniteSystemProperties.getInteger(IgniteSystemProperties.IGNITE_DUMP_PENDING_OBJECTS_THRESHOLD, 10);
-
- /** */
+ public static final String EXCHANGE_LOG = "org.apache.ignite.internal.exchange.time";
+
/** Dummy flag. */
private final boolean dummy;
http://git-wip-us.apache.org/repos/asf/ignite/blob/fbb51b01/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
index 2396b10,542ee43..26b1a2e
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
@@@ -120,106 -78,7 +120,103 @@@ public class ClusterProcessor extends G
public ClusterProcessor(GridKernalContext ctx) {
super(ctx);
- notifyEnabled.set(IgniteSystemProperties.getBoolean(IGNITE_UPDATE_NOTIFIER,
- Boolean.parseBoolean(IgniteProperties.get("ignite.update.notifier.enabled.by.default"))));
-
cluster = new IgniteClusterImpl(ctx);
+
+ diagnosticLog = ctx.log(DIAGNOSTIC_LOG_CATEGORY);
+ }
+
+ /**
+ * @throws IgniteCheckedException If failed.
+ */
+ public void initListeners() throws IgniteCheckedException {
+ ctx.event().addLocalEventListener(new GridLocalEventListener() {
+ @Override public void onEvent(Event evt) {
+ assert evt instanceof DiscoveryEvent;
+ assert evt.type() == EVT_NODE_FAILED || evt.type() == EVT_NODE_LEFT;
+
+ DiscoveryEvent discoEvt = (DiscoveryEvent)evt;
+
+ UUID nodeId = discoEvt.eventNode().id();
+
+ ConcurrentHashMap<Long, InternalDiagnosticFuture> futs = diagnosticFutMap.get();
+
+ if (futs != null) {
+ for (InternalDiagnosticFuture fut : futs.values()) {
+ if (fut.nodeId.equals(nodeId))
+ fut.onDone("Target node failed: " + nodeId);
+ }
+ }
+ }
+ },
+ EVT_NODE_FAILED, EVT_NODE_LEFT);
+
+ ctx.io().addMessageListener(GridTopic.TOPIC_INTERNAL_DIAGNOSTIC, new GridMessageListener() {
+ @Override public void onMessage(UUID nodeId, Object msg) {
+ if (msg instanceof IgniteDiagnosticMessage) {
+ IgniteDiagnosticMessage msg0 = (IgniteDiagnosticMessage)msg;
+
+ if (msg0.request()) {
+ ClusterNode node = ctx.discovery().node(nodeId);
+
+ if (node == null) {
+ if (diagnosticLog.isDebugEnabled()) {
+ diagnosticLog.debug("Skip diagnostic request, sender node left " +
+ "[node=" + nodeId + ", msg=" + msg + ']');
+ }
+
+ return;
+ }
+
+ String resMsg;
+
+ IgniteClosure<GridKernalContext, String> c;
+
+ try {
+ c = msg0.unmarshalClosure(ctx);
+
+ resMsg = c.apply(ctx);
+ }
+ catch (Exception e) {
+ U.error(diagnosticLog, "Failed to run diagnostic closure: " + e, e);
+
+ resMsg = "Failed to run diagnostic closure: " + e;
+ }
+
+ IgniteDiagnosticMessage res = IgniteDiagnosticMessage.createResponse(resMsg, msg0.futureId());
+
+ try {
+ ctx.io().sendToGridTopic(node, GridTopic.TOPIC_INTERNAL_DIAGNOSTIC, res, GridIoPolicy.SYSTEM_POOL);
+ }
+ catch (ClusterTopologyCheckedException ignore) {
+ if (diagnosticLog.isDebugEnabled()) {
+ diagnosticLog.debug("Failed to send diagnostic response, node left " +
+ "[node=" + nodeId + ", msg=" + msg + ']');
+ }
+ }
+ catch (IgniteCheckedException e) {
+ U.error(diagnosticLog, "Failed to send diagnostic response [msg=" + msg0 + "]", e);
+ }
+ }
+ else {
+ InternalDiagnosticFuture fut = diagnosticFuturesMap().get(msg0.futureId());
+
+ if (fut != null)
+ fut.onResponse(msg0);
+ else
+ U.warn(diagnosticLog, "Failed to find diagnostic message future [msg=" + msg0 + ']');
+ }
+ }
+ else
+ U.warn(diagnosticLog, "Received unexpected message: " + msg);
+ }
+ });
+ }
+
+ /**
+ * @return Logger for diagnostic category.
+ */
+ public IgniteLogger diagnosticLog() {
+ return diagnosticLog;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/fbb51b01/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fbb51b01/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
----------------------------------------------------------------------
[18/42] ignite git commit: IGNITE-5188: CREATE TABLE: added affinity
key support. This closes #2097.
Posted by ag...@apache.org.
IGNITE-5188: CREATE TABLE: added affinity key support. This closes #2097.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bd5065b1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bd5065b1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bd5065b1
Branch: refs/heads/ignite-5267-merge-ea
Commit: bd5065b1b1a4babf7cd882b9753700e7a58a6094
Parents: 0a6b44c
Author: Alexander Paschenko <al...@gmail.com>
Authored: Thu Jun 8 12:07:38 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Jun 8 12:07:38 2017 +0300
----------------------------------------------------------------------
.../ignite/internal/binary/BinaryContext.java | 1 -
.../ignite/internal/binary/BinaryFieldEx.java | 5 +
.../ignite/internal/binary/BinaryFieldImpl.java | 5 +
.../query/DynamicTableAffinityKeyMapper.java | 92 ++++++++++
.../processors/query/GridQueryProcessor.java | 52 +++---
.../internal/processors/query/QueryUtils.java | 19 ++-
.../query/h2/ddl/DdlStatementsProcessor.java | 2 +-
.../processors/query/h2/opt/GridH2Table.java | 5 +-
.../query/h2/sql/GridSqlCreateTable.java | 17 ++
.../query/h2/sql/GridSqlQueryParser.java | 44 +++++
.../cache/index/H2DynamicTableSelfTest.java | 170 ++++++++++++++++++-
11 files changed, 375 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd5065b1/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
index 70bc2f9..be02ba1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
@@ -116,7 +116,6 @@ import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.marshaller.MarshallerContext;
import org.apache.ignite.marshaller.MarshallerUtils;
-import org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd5065b1/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldEx.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldEx.java
index 42aa282..c998022 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldEx.java
@@ -26,6 +26,11 @@ import org.apache.ignite.binary.BinaryObject;
*/
public interface BinaryFieldEx extends BinaryField {
/**
+ * @return Type ID this field relates to.
+ */
+ public int typeId();
+
+ /**
* Writes field value to the given byte buffer.
*
* @param obj Object from which the field should be extracted.
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd5065b1/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldImpl.java
index c318397..59bd03d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldImpl.java
@@ -109,6 +109,11 @@ public class BinaryFieldImpl implements BinaryFieldEx {
}
/** {@inheritDoc} */
+ @Override public int typeId() {
+ return typeId;
+ }
+
+ /** {@inheritDoc} */
@Override public boolean writeField(BinaryObject obj, ByteBuffer buf) {
BinaryObjectExImpl obj0 = (BinaryObjectExImpl)obj;
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd5065b1/modules/core/src/main/java/org/apache/ignite/internal/processors/query/DynamicTableAffinityKeyMapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/DynamicTableAffinityKeyMapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/DynamicTableAffinityKeyMapper.java
new file mode 100644
index 0000000..e49341a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/DynamicTableAffinityKeyMapper.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.query;
+
+import org.apache.ignite.binary.BinaryObject;
+import org.apache.ignite.binary.BinaryType;
+import org.apache.ignite.cache.affinity.AffinityKeyMapper;
+import org.apache.ignite.internal.binary.BinaryFieldEx;
+import org.apache.ignite.internal.binary.BinaryObjectEx;
+import org.apache.ignite.internal.util.typedef.F;
+
+/**
+ * Trivial mapper to take extract field value from binary object of specific type as affinity key.
+ */
+@SuppressWarnings("deprecation")
+public class DynamicTableAffinityKeyMapper implements AffinityKeyMapper {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Type name. */
+ private final String typeName;
+
+ /** Field name. */
+ private final String fieldName;
+
+ /** Type id for faster type checks. */
+ private transient volatile BinaryFieldEx field;
+
+ /**
+ * Constructor.
+ *
+ * @param typeName Type name.
+ * @param fieldName Field name.
+ */
+ DynamicTableAffinityKeyMapper(String typeName, String fieldName) {
+ this.typeName = typeName;
+ this.fieldName = fieldName;
+ }
+
+ /**
+ * @return Field name.
+ */
+ public String fieldName() {
+ return fieldName;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Object affinityKey(Object key) {
+ if (!(key instanceof BinaryObject))
+ return key;
+
+ assert key instanceof BinaryObjectEx;
+
+ BinaryObjectEx key0 = (BinaryObjectEx)key;
+
+ if (field == null) {
+ BinaryType type = key0.type();
+
+ if (!F.eq(type.typeName(), typeName))
+ return key;
+
+ field = (BinaryFieldEx)type.field(fieldName);
+ }
+
+ if (!F.eq(key0.typeId(), field.typeId()))
+ return key;
+
+ Object affKey = field.value(key0);
+
+ return affKey != null ? affKey : key;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void reset() {
+ // No-op.
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd5065b1/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 48c7229..4311b12 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
@@ -17,6 +17,25 @@
package org.apache.ignite.internal.processors.query;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.atomic.AtomicBoolean;
+import javax.cache.Cache;
+import javax.cache.CacheException;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteDataStreamer;
import org.apache.ignite.IgniteException;
@@ -34,8 +53,8 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.events.CacheQueryExecutedEvent;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.managers.communication.GridMessageListener;
import org.apache.ignite.internal.NodeStoppingException;
+import org.apache.ignite.internal.managers.communication.GridMessageListener;
import org.apache.ignite.internal.processors.GridProcessorAdapter;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheObject;
@@ -72,9 +91,9 @@ import org.apache.ignite.internal.util.lang.GridCloseableIterator;
import org.apache.ignite.internal.util.lang.GridClosureException;
import org.apache.ignite.internal.util.lang.IgniteOutClosureX;
import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.T3;
+import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.util.worker.GridWorker;
import org.apache.ignite.internal.util.worker.GridWorkerFuture;
@@ -88,26 +107,6 @@ import org.apache.ignite.spi.indexing.IndexingQueryFilter;
import org.apache.ignite.thread.IgniteThread;
import org.jetbrains.annotations.Nullable;
-import javax.cache.Cache;
-import javax.cache.CacheException;
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.atomic.AtomicBoolean;
-
import static org.apache.ignite.events.EventType.EVT_CACHE_QUERY_EXECUTED;
import static org.apache.ignite.internal.GridTopic.TOPIC_SCHEMA;
import static org.apache.ignite.internal.IgniteComponentType.INDEXING;
@@ -1279,13 +1278,14 @@ public class GridQueryProcessor extends GridProcessorAdapter {
* @param schemaName Schema name to create table in.
* @param entity Entity to create table from.
* @param templateName Template name.
+ * @param affinityKey Affinity key column name.
* @param atomicityMode Atomicity mode.
* @param backups Backups.
* @param ifNotExists Quietly ignore this command if table already exists.
* @throws IgniteCheckedException If failed.
*/
@SuppressWarnings("unchecked")
- public void dynamicTableCreate(String schemaName, QueryEntity entity, String templateName,
+ public void dynamicTableCreate(String schemaName, QueryEntity entity, String templateName, String affinityKey,
@Nullable CacheAtomicityMode atomicityMode, int backups, boolean ifNotExists) throws IgniteCheckedException {
assert !F.isEmpty(templateName);
assert backups >= 0;
@@ -1316,6 +1316,12 @@ public class GridQueryProcessor extends GridProcessorAdapter {
ccfg.setSqlEscapeAll(true);
ccfg.setQueryEntities(Collections.singleton(entity));
+ if (affinityKey != null) {
+ assert entity.getFields().containsKey(affinityKey) && entity.getKeyFields().contains(affinityKey);
+
+ ccfg.setAffinityMapper(new DynamicTableAffinityKeyMapper(entity.getKeyType(), affinityKey));
+ }
+
boolean res;
try {
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd5065b1/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 fbd9afa..e0815fd 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
@@ -427,16 +427,19 @@ public class QueryUtils {
if (valCls != null)
altTypeId = new QueryTypeIdKey(cacheName, valCls);
- if (!cctx.customAffinityMapper() && qryEntity.findKeyType() != null) {
- // Need to setup affinity key for distributed joins.
- String affField = ctx.cacheObjects().affinityField(qryEntity.findKeyType());
+ String affField = null;
- if (affField != null) {
- if (!escape)
- affField = normalizeObjectName(affField, false);
+ // Need to setup affinity key for distributed joins.
+ if (!cctx.customAffinityMapper() && qryEntity.findKeyType() != null)
+ affField = ctx.cacheObjects().affinityField(qryEntity.findKeyType());
+ else if (cctx.config().getAffinityMapper() instanceof DynamicTableAffinityKeyMapper)
+ affField = ((DynamicTableAffinityKeyMapper)cctx.config().getAffinityMapper()).fieldName();
- desc.affinityKey(affField);
- }
+ if (affField != null) {
+ if (!escape)
+ affField = normalizeObjectName(affField, false);
+
+ desc.affinityKey(affField);
}
}
else {
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd5065b1/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
index 5efc5c9..d6bcabd 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
@@ -178,7 +178,7 @@ public class DdlStatementsProcessor {
throw err;
ctx.query().dynamicTableCreate(cmd.schemaName(), e, cmd.templateName(),
- cmd.atomicityMode(), cmd.backups(), cmd.ifNotExists());
+ cmd.affinityKey(), cmd.atomicityMode(), cmd.backups(), cmd.ifNotExists());
}
}
else if (stmt0 instanceof GridSqlDropTable) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd5065b1/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 d656cc3..4f3ef01 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
@@ -34,6 +34,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.query.QueryTable;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.processors.query.DynamicTableAffinityKeyMapper;
import org.apache.ignite.internal.processors.query.h2.database.H2RowFactory;
import org.apache.ignite.internal.processors.query.h2.database.H2TreeIndex;
import org.apache.ignite.internal.util.offheap.unsafe.GridUnsafeMemory;
@@ -130,7 +131,9 @@ public class GridH2Table extends TableBase {
this.desc = desc;
this.cctx = cctx;
- if (desc != null && desc.context() != null && !desc.context().customAffinityMapper()) {
+ if (desc != null && desc.context() != null &&
+ (!desc.context().customAffinityMapper() ||
+ desc.context().config().getAffinityMapper() instanceof DynamicTableAffinityKeyMapper)) {
boolean affinityColExists = true;
String affKey = desc.type().affinityKey();
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd5065b1/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlCreateTable.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlCreateTable.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlCreateTable.java
index 50348fe..edced6b 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlCreateTable.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlCreateTable.java
@@ -53,6 +53,9 @@ public class GridSqlCreateTable extends GridSqlStatement {
/** Primary key columns. */
private LinkedHashSet<String> pkCols;
+ /** Name of the column that represents affinity key. */
+ private String affinityKey;
+
/** Extra WITH-params. */
private List<String> params;
@@ -127,6 +130,20 @@ public class GridSqlCreateTable extends GridSqlStatement {
}
/**
+ * @return Name of the column that represents affinity key.
+ */
+ public String affinityKey() {
+ return affinityKey;
+ }
+
+ /**
+ * @param affinityKey Name of the column that represents affinity key.
+ */
+ public void affinityKey(String affinityKey) {
+ this.affinityKey = affinityKey;
+ }
+
+ /**
* @return Schema name upon which this statement has been issued.
*/
public String schemaName() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd5065b1/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
index fdb908e..d8baed3 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
@@ -405,6 +405,9 @@ public class GridSqlQueryParser {
private static final String PARAM_ATOMICITY = "ATOMICITY";
/** */
+ private static final String PARAM_AFFINITY_KEY = "AFFINITYKEY";
+
+ /** */
private final IdentityHashMap<Object, Object> h2ObjToGridObj = new IdentityHashMap<>();
/** */
@@ -1048,6 +1051,47 @@ public class GridSqlQueryParser {
break;
+ case PARAM_AFFINITY_KEY:
+ ensureNotEmpty(name, val);
+
+ String affColName = null;
+
+ // Either strip column name off its quotes, or uppercase it.
+ if (val.startsWith("'")) {
+ if (val.length() == 1 || !val.endsWith("'"))
+ throw new IgniteSQLException("Affinity key column name does not have trailing quote: " + val,
+ IgniteQueryErrorCode.PARSING);
+
+ val = val.substring(1, val.length() - 1);
+
+ ensureNotEmpty(name, val);
+
+ affColName = val;
+ }
+ else {
+ for (String colName : res.columns().keySet()) {
+ if (val.equalsIgnoreCase(colName)) {
+ if (affColName != null)
+ throw new IgniteSQLException("Ambiguous affinity column name, use single quotes " +
+ "for case sensitivity: " + val, IgniteQueryErrorCode.PARSING);
+
+ affColName = colName;
+ }
+ }
+ }
+
+ if (affColName == null || !res.columns().containsKey(affColName))
+ throw new IgniteSQLException("Affinity key column with given name not found: " + val,
+ IgniteQueryErrorCode.PARSING);
+
+ if (!res.primaryKeyColumns().contains(affColName))
+ throw new IgniteSQLException("Affinity key column must be one of key columns: " + affColName,
+ IgniteQueryErrorCode.PARSING);
+
+ res.affinityKey(affColName);
+
+ break;
+
default:
throw new IgniteSQLException("Unsupported parameter: " + name, IgniteQueryErrorCode.PARSING);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd5065b1/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
index 699fdad..e4babba 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
@@ -19,13 +19,15 @@ package org.apache.ignite.internal.processors.cache.index;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
+import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
+import java.util.Random;
import java.util.concurrent.Callable;
-
import javax.cache.CacheException;
-
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteException;
import org.apache.ignite.Ignition;
@@ -41,6 +43,7 @@ import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
import org.apache.ignite.internal.processors.query.GridQueryProperty;
+import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
import org.apache.ignite.internal.processors.query.IgniteSQLException;
import org.apache.ignite.internal.processors.query.QueryTypeDescriptorImpl;
import org.apache.ignite.internal.processors.query.QueryUtils;
@@ -401,7 +404,7 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
e.setKeyType("CityKey");
e.setValueType("City");
- queryProcessor(client()).dynamicTableCreate("PUBLIC", e, CacheMode.PARTITIONED.name(),
+ queryProcessor(client()).dynamicTableCreate("PUBLIC", e, CacheMode.PARTITIONED.name(), null,
CacheAtomicityMode.ATOMIC, 10, false);
return null;
@@ -427,6 +430,167 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
}
/**
+ * @throws Exception if failed.
+ */
+ public void testAffinityKey() throws Exception {
+ executeDdl("CREATE TABLE \"City\" (\"name\" varchar primary key, \"code\" int) WITH \"affinityKey='name'\"");
+
+ assertAffinityCacheConfiguration("City", "name");
+
+ executeDdl("INSERT INTO \"City\" (\"name\", \"code\") values ('A', 1), ('B', 2), ('C', 3)");
+
+ List<String> cityNames = Arrays.asList("A", "B", "C");
+
+ List<Integer> cityCodes = Arrays.asList(1, 2, 3);
+
+ // We need unique name for this table to avoid conflicts with existing binary metadata.
+ executeDdl("CREATE TABLE \"Person2\" (\"id\" int, \"city\" varchar," +
+ " \"name\" varchar, \"surname\" varchar, \"age\" int, PRIMARY KEY (\"id\", \"city\")) WITH " +
+ "\"template=cache,affinityKey='city'\"");
+
+ assertAffinityCacheConfiguration("Person2", "city");
+
+ Random r = new Random();
+
+ Map<Integer, Integer> personId2cityCode = new HashMap<>();
+
+ for (int i = 0; i < 100; i++) {
+ int cityIdx = r.nextInt(3);
+
+ String cityName = cityNames.get(cityIdx);
+
+ int cityCode = cityCodes.get(cityIdx);
+
+ personId2cityCode.put(i, cityCode);
+
+ queryProcessor(client()).querySqlFieldsNoCache(new SqlFieldsQuery("insert into \"Person2\"(\"id\", " +
+ "\"city\") values (?, ?)").setArgs(i, cityName), true).getAll();
+ }
+
+ List<List<?>> res = queryProcessor(client()).querySqlFieldsNoCache(new SqlFieldsQuery("select \"id\", " +
+ "c.\"code\" from \"Person2\" p left join \"City\" c on p.\"city\" = c.\"name\" where c.\"name\" " +
+ "is not null"), true).getAll();
+
+ assertEquals(100, res.size());
+
+ for (int i = 0; i < 100; i++) {
+ assertNotNull(res.get(i).get(0));
+
+ assertNotNull(res.get(i).get(1));
+
+ int id = (Integer)res.get(i).get(0);
+
+ int code = (Integer)res.get(i).get(1);
+
+ assertEquals((int)personId2cityCode.get(id), code);
+ }
+ }
+
+ /**
+ * Test various cases of affinity key column specification.
+ */
+ @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
+ public void testAffinityKeyCaseSensitivity() {
+ executeDdl("CREATE TABLE \"A\" (\"name\" varchar primary key, \"code\" int) WITH \"affinityKey='name'\"");
+
+ assertAffinityCacheConfiguration("A", "name");
+
+ executeDdl("CREATE TABLE \"B\" (name varchar primary key, \"code\" int) WITH \"affinityKey=name\"");
+
+ assertAffinityCacheConfiguration("B", "NAME");
+
+ executeDdl("CREATE TABLE \"C\" (name varchar primary key, \"code\" int) WITH \"affinityKey=NamE\"");
+
+ assertAffinityCacheConfiguration("C", "NAME");
+
+ executeDdl("CREATE TABLE \"D\" (\"name\" varchar primary key, \"code\" int) WITH \"affinityKey=NAME\"");
+
+ assertAffinityCacheConfiguration("D", "name");
+
+ // Error arises because user has specified case sensitive affinity column name
+ GridTestUtils.assertThrows(null, new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ executeDdl("CREATE TABLE \"E\" (name varchar primary key, \"code\" int) WITH \"affinityKey='Name'\"");
+
+ return null;
+ }
+ }, IgniteSQLException.class, "Affinity key column with given name not found: Name");
+
+ // Error arises because user declares case insensitive affinity column name while having two 'name'
+ // columns whose names are equal in ignore case.
+ GridTestUtils.assertThrows(null, new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ executeDdl("CREATE TABLE \"E\" (\"name\" varchar, \"Name\" int, val int, primary key(\"name\", " +
+ "\"Name\")) WITH \"affinityKey=name\"");
+
+ return null;
+ }
+ }, IgniteSQLException.class, "Ambiguous affinity column name, use single quotes for case sensitivity: name");
+
+ executeDdl("CREATE TABLE \"E\" (\"name\" varchar, \"Name\" int, val int, primary key(\"name\", " +
+ "\"Name\")) WITH \"affinityKey='Name'\"");
+
+ assertAffinityCacheConfiguration("E", "Name");
+ }
+
+ /**
+ * Tests that attempting to specify an affinity key that actually is a value column yields an error.
+ */
+ @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
+ public void testAffinityKeyNotKeyColumn() {
+ // Error arises because user has specified case sensitive affinity column name
+ GridTestUtils.assertThrows(null, new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ executeDdl("CREATE TABLE \"E\" (name varchar primary key, \"code\" int) WITH \"affinityKey=code\"");
+
+ return null;
+ }
+ }, IgniteSQLException.class, "Affinity key column must be one of key columns: code");
+ }
+
+ /**
+ * Tests that attempting to specify an affinity key that actually is a value column yields an error.
+ */
+ @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
+ public void testAffinityKeyNotFound() {
+ // Error arises because user has specified case sensitive affinity column name
+ GridTestUtils.assertThrows(null, new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ executeDdl("CREATE TABLE \"E\" (name varchar primary key, \"code\" int) WITH \"affinityKey=missing\"");
+
+ return null;
+ }
+ }, IgniteSQLException.class, "Affinity key column with given name not found: missing");
+ }
+
+ /**
+ * Check that dynamic cache created with {@code CREATE TABLE} is correctly configured affinity wise.
+ * @param cacheName Cache name to check.
+ * @param affKeyFieldName Expected affinity key field name.
+ */
+ private void assertAffinityCacheConfiguration(String cacheName, String affKeyFieldName) {
+ String actualCacheName = cacheName(cacheName);
+
+ Collection<GridQueryTypeDescriptor> types = client().context().query().types(actualCacheName);
+
+ assertEquals(1, types.size());
+
+ GridQueryTypeDescriptor type = types.iterator().next();
+
+ assertTrue(type.name().startsWith(actualCacheName));
+ assertEquals(cacheName, type.tableName());
+ assertEquals(affKeyFieldName, type.affinityKey());
+
+ GridH2Table tbl = ((IgniteH2Indexing)queryProcessor(client()).getIndexing()).dataTable("PUBLIC", cacheName);
+
+ assertNotNull(tbl);
+
+ assertNotNull(tbl.getAffinityKeyColumn());
+
+ assertEquals(affKeyFieldName, tbl.getAffinityKeyColumn().columnName);
+ }
+
+ /**
* Execute {@code CREATE TABLE} w/given params.
* @param params Engine parameters.
*/
[07/42] ignite git commit: IGNITE-5314 VisorRunningQuery should use
schema name instead of cache name.
Posted by ag...@apache.org.
IGNITE-5314 VisorRunningQuery should use schema name instead of cache name.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/183aa80a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/183aa80a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/183aa80a
Branch: refs/heads/ignite-5267-merge-ea
Commit: 183aa80a58e37f312e4d7d85bf52a103730ad049
Parents: c3b8998
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Wed Jun 7 09:48:37 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Wed Jun 7 09:48:37 2017 +0700
----------------------------------------------------------------------
.../internal/visor/query/VisorRunningQuery.java | 20 ++++++++++----------
.../app/modules/agent/AgentManager.service.js | 2 ++
2 files changed, 12 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/183aa80a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQuery.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQuery.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQuery.java
index 1864718..47f4436 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQuery.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQuery.java
@@ -41,8 +41,8 @@ public class VisorRunningQuery extends VisorDataTransferObject {
/** Query type. */
private GridCacheQueryType qryType;
- /** Cache name for query. */
- private String cache;
+ /** Schema name. */
+ private String schemaName;
/** */
private long startTime;
@@ -69,19 +69,19 @@ public class VisorRunningQuery extends VisorDataTransferObject {
* @param id Query ID.
* @param qry Query text.
* @param qryType Query type.
- * @param cache Cache where query was executed.
+ * @param schemaName Query schema name.
* @param startTime Query start time.
* @param duration Query current duration.
* @param cancellable {@code true} if query can be canceled.
* @param loc {@code true} if query is local.
*/
- public VisorRunningQuery(long id, String qry, GridCacheQueryType qryType, String cache,
+ public VisorRunningQuery(long id, String qry, GridCacheQueryType qryType, String schemaName,
long startTime, long duration,
boolean cancellable, boolean loc) {
this.id = id;
this.qry = qry;
this.qryType = qryType;
- this.cache = cache;
+ this.schemaName = schemaName;
this.startTime = startTime;
this.duration = duration;
this.cancellable = cancellable;
@@ -110,10 +110,10 @@ public class VisorRunningQuery extends VisorDataTransferObject {
}
/**
- * @return Cache name.
+ * @return Schema name.
*/
- public String getCache() {
- return cache;
+ public String getSchemaName() {
+ return schemaName;
}
/**
@@ -149,7 +149,7 @@ public class VisorRunningQuery extends VisorDataTransferObject {
out.writeLong(id);
U.writeString(out, qry);
U.writeEnum(out, qryType);
- U.writeString(out, cache);
+ U.writeString(out, schemaName);
out.writeLong(startTime);
out.writeLong(duration);
out.writeBoolean(cancellable);
@@ -161,7 +161,7 @@ public class VisorRunningQuery extends VisorDataTransferObject {
id = in.readLong();
qry = U.readString(in);
qryType = GridCacheQueryType.fromOrdinal(in.readByte());
- cache = U.readString(in);
+ schemaName = U.readString(in);
startTime = in.readLong();
duration = in.readLong();
cancellable = in.readBoolean();
http://git-wip-us.apache.org/repos/asf/ignite/blob/183aa80a/modules/web-console/frontend/app/modules/agent/AgentManager.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/agent/AgentManager.service.js b/modules/web-console/frontend/app/modules/agent/AgentManager.service.js
index 58e071b..ee59d91 100644
--- a/modules/web-console/frontend/app/modules/agent/AgentManager.service.js
+++ b/modules/web-console/frontend/app/modules/agent/AgentManager.service.js
@@ -44,6 +44,7 @@ export default class IgniteAgentManager {
$root.$on('$stateChangeSuccess', () => this.stopWatch());
this.ignite2x = false;
+ this.ignite2_1 = false;
if (!$root.IgniteDemoMode) {
$root.$watch(() => _.get(this, 'cluster.clusterVersion'), (ver) => {
@@ -51,6 +52,7 @@ export default class IgniteAgentManager {
return;
this.ignite2x = ver.startsWith('2.');
+ this.ignite2_1 = ver.startsWith('2.1');
}, true);
}
[17/42] ignite git commit: IGNITE-5075 CacheConfiguration.groupName:
update javadoc
Posted by ag...@apache.org.
IGNITE-5075 CacheConfiguration.groupName: update javadoc
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0a6b44ce
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0a6b44ce
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0a6b44ce
Branch: refs/heads/ignite-5267-merge-ea
Commit: 0a6b44cee31084f35591f3a4d28c69d68ebeb857
Parents: d2efe78
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed Jun 7 19:46:54 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Wed Jun 7 19:46:54 2017 +0300
----------------------------------------------------------------------
.../configuration/CacheConfiguration.java | 24 ++++++++++++++++++++
1 file changed, 24 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0a6b44ce/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 67b7590..6e0836e 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
@@ -459,6 +459,18 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
}
/**
+ * Gets the cache group name.
+ *
+ * Caches with the same group name share single underlying 'physical' cache (partition set),
+ * but are logically isolated.
+ *
+ * Since underlying cache is shared, the following configuration properties should be the same within group:
+ * {@link #setAffinity(AffinityFunction)}, {@link #setNodeFilter(IgnitePredicate)}, {@link #cacheMode},
+ * {@link #setTopologyValidator(TopologyValidator)}, {@link #setPartitionLossPolicy(PartitionLossPolicy)},
+ * {@link #setMemoryPolicyName(String)}.
+ *
+ * Grouping caches reduces overall overhead, since internal data structures are shared.
+ *
* @return Cache group name.
*/
public String getGroupName() {
@@ -466,6 +478,18 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
}
/**
+ * Sets the cache group name.
+ *
+ * Caches with the same group name share single underlying 'physical' cache (partition set),
+ * but are logically isolated.
+ *
+ * Since underlying cache is shared, the following configuration properties should be the same within group:
+ * {@link #setAffinity(AffinityFunction)}, {@link #setNodeFilter(IgnitePredicate)}, {@link #cacheMode},
+ * {@link #setTopologyValidator(TopologyValidator)}, {@link #setPartitionLossPolicy(PartitionLossPolicy)},
+ * {@link #setMemoryPolicyName(String)}.
+ *
+ * Grouping caches reduces overall overhead, since internal data structures are shared.
+ *
* @param grpName Cache group name.
* @return {@code this} for chaining.
*/
[16/42] ignite git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/ignite
Posted by ag...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/ignite
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d2efe78e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d2efe78e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d2efe78e
Branch: refs/heads/ignite-5267-merge-ea
Commit: d2efe78e1bc59b79a1e544b64bbcd44a0203ce27
Parents: 8371e3a 3a2797e
Author: Sergi Vladykin <se...@gmail.com>
Authored: Wed Jun 7 18:21:19 2017 +0300
Committer: Sergi Vladykin <se...@gmail.com>
Committed: Wed Jun 7 18:21:19 2017 +0300
----------------------------------------------------------------------
.../jdbc/suite/IgniteJdbcDriverTestSuite.java | 2 +
.../thin/JdbcThinAutoCloseServerCursorTest.java | 359 +++++++++++++++++++
.../jdbc/thin/JdbcThinConnectionSelfTest.java | 36 ++
.../internal/binary/BinaryClassDescriptor.java | 1 -
.../internal/jdbc/thin/JdbcThinConnection.java | 4 +-
.../internal/jdbc/thin/JdbcThinResultSet.java | 18 +-
.../internal/jdbc/thin/JdbcThinStatement.java | 2 +-
.../internal/jdbc/thin/JdbcThinTcpIo.java | 17 +-
.../internal/jdbc/thin/JdbcThinUtils.java | 7 +-
.../query/jdbc/GridCacheQueryJdbcTask.java | 6 +-
.../processors/odbc/SqlListenerNioListener.java | 3 +-
.../processors/odbc/jdbc/JdbcQueryCursor.java | 9 +-
.../odbc/jdbc/JdbcRequestHandler.java | 21 +-
.../processors/query/GridQueryProcessor.java | 2 +-
.../internal/processors/query/QueryUtils.java | 32 ++
.../query/h2/ddl/DdlStatementsProcessor.java | 23 +-
.../cache/index/H2DynamicTableSelfTest.java | 37 +-
17 files changed, 531 insertions(+), 48 deletions(-)
----------------------------------------------------------------------
[03/42] ignite git commit: IGNITE-5420: CREATE TABLE command now
generates unique key and value type names. This closes #2093.
Posted by ag...@apache.org.
IGNITE-5420: CREATE TABLE command now generates unique key and value type names. This closes #2093.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f3c6b3c5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f3c6b3c5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f3c6b3c5
Branch: refs/heads/ignite-5267-merge-ea
Commit: f3c6b3c5a7b610f0aea3945f5378964dc60d77c4
Parents: 98cdcfd
Author: devozerov <vo...@gridgain.com>
Authored: Tue Jun 6 15:48:26 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Tue Jun 6 15:48:26 2017 +0300
----------------------------------------------------------------------
.../query/h2/ddl/DdlStatementsProcessor.java | 20 +++++++++++++++--
.../cache/index/H2DynamicTableSelfTest.java | 23 +++++---------------
2 files changed, 23 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f3c6b3c5/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
index 060636b..251ee9f 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
@@ -22,6 +22,8 @@ import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.UUID;
+
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.QueryEntity;
import org.apache.ignite.cache.QueryIndex;
@@ -288,9 +290,11 @@ public class DdlStatementsProcessor {
res.addQueryField(e.getKey(), DataType.getTypeClassName(col.getType()), null);
}
- res.setKeyType(createTbl.tableName() + "Key");
+ String valTypeName = valueType(createTbl.schemaName(), createTbl.tableName());
+ String keyTypeName = valTypeName + "_Key";
- res.setValueType(createTbl.tableName());
+ res.setValueType(valTypeName);
+ res.setKeyType(keyTypeName);
res.setKeyFields(createTbl.primaryKeyColumns());
@@ -298,6 +302,18 @@ public class DdlStatementsProcessor {
}
/**
+ * Construct value type name for table.
+ *
+ * @param schemaName Schema name.
+ * @param tblName Table name.
+ * @return Value type name.
+ */
+ private static String valueType(String schemaName, String tblName) {
+ return "sql_" + schemaName + "_" + tblName + "_" + UUID.randomUUID().toString().replace("-", "_");
+ }
+
+
+ /**
* @param cmd Statement.
* @return Whether {@code cmd} is a DDL statement we're able to handle.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/f3c6b3c5/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
index 1d376c1..efb6cc8 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
@@ -27,8 +27,6 @@ import java.util.concurrent.Callable;
import javax.cache.CacheException;
import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.Ignition;
import org.apache.ignite.cache.CacheAtomicityMode;
@@ -51,7 +49,6 @@ import org.apache.ignite.internal.processors.query.h2.ddl.DdlStatementsProcessor
import org.apache.ignite.internal.processors.query.h2.opt.GridH2Table;
import org.apache.ignite.internal.processors.query.schema.SchemaOperationException;
import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.GridTestUtils;
/**
@@ -191,12 +188,12 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
QueryTypeDescriptorImpl desc = typeExisting(node, "Person", "Person");
assertEquals(Object.class, desc.keyClass());
-
- assertEquals("PersonKey", desc.keyTypeName());
-
assertEquals(Object.class, desc.valueClass());
- assertEquals("Person", desc.valueTypeName());
+ assertTrue(desc.valueTypeName(), desc.valueTypeName().contains("Person"));
+
+ assertTrue(desc.keyTypeName(), desc.keyTypeName().startsWith(desc.valueTypeName()));
+ assertTrue(desc.keyTypeName(), desc.keyTypeName().endsWith("Key"));
assertEquals(
F.asList("id", "city", "name", "surname", "age"),
@@ -204,13 +201,9 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
);
assertProperty(desc, "id", Integer.class, true);
-
assertProperty(desc, "city", String.class, true);
-
assertProperty(desc, "name", String.class, false);
-
assertProperty(desc, "surname", String.class, false);
-
assertProperty(desc, "age", Integer.class, false);
GridH2Table tbl = ((IgniteH2Indexing)node.context().query().getIndexing()).dataTable("PUBLIC", "Person");
@@ -465,6 +458,7 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
* @param params Engine parameters.
* @param expErrMsg Expected error message.
*/
+ @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
private void assertCreateTableWithParamsThrows(final String params, String expErrMsg) {
GridTestUtils.assertThrows(null, new Callable<Object>() {
@Override public Object call() throws Exception {
@@ -588,13 +582,6 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
}
/**
- * @return Cache to issue queries upon.
- */
- private IgniteCache<?, ?> cache() {
- return client().cache(INDEXED_CACHE_NAME);
- }
-
- /**
* @return Default cache configuration.
*/
private CacheConfiguration cacheConfiguration() {
[24/42] ignite git commit: IGNITE-5450 .NET: Update
IDataStreamer.AllowOverwrite documentation
Posted by ag...@apache.org.
IGNITE-5450 .NET: Update IDataStreamer.AllowOverwrite documentation
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e238d563
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e238d563
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e238d563
Branch: refs/heads/ignite-5267-merge-ea
Commit: e238d563bf374489b34e6c719d10f580e4eb7b14
Parents: 612f5ad
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Jun 8 15:25:07 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Jun 8 15:25:07 2017 +0300
----------------------------------------------------------------------
.../dotnet/Apache.Ignite.Core/Datastream/IDataStreamer.cs | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e238d563/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/IDataStreamer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/IDataStreamer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/IDataStreamer.cs
index d18040f..222f6c3 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/IDataStreamer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/IDataStreamer.cs
@@ -86,7 +86,11 @@ namespace Apache.Ignite.Core.Datastream
string CacheName { get; }
/// <summary>
- /// Flag value indicating that this data streamer assumes that there could be concurrent updates to the cache.
+ /// Gets or sets a value indicating whether existing values can be overwritten by the data streamer.
+ /// Performance is better when this flag is false.
+ /// <para />
+ /// NOTE: When false, cache updates won't be propagated to cache store
+ /// (even if <see cref="SkipStore"/> is false).
/// <para />
/// Default is <c>false</c>.
/// </summary>
@@ -95,6 +99,8 @@ namespace Apache.Ignite.Core.Datastream
/// <summary>
/// Flag indicating that write-through behavior should be disabled for data loading.
/// <para />
+ /// <see cref="AllowOverwrite"/> must be true for write-through to work.
+ /// <para />
/// Default is <c>false</c>.
/// </summary>
bool SkipStore { get; set; }
[22/42] ignite git commit: IGNITE-5075: Fix to Yardstick in for cache
groups.
Posted by ag...@apache.org.
IGNITE-5075: Fix to Yardstick in for cache groups.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c73aad7c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c73aad7c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c73aad7c
Branch: refs/heads/ignite-5267-merge-ea
Commit: c73aad7c0b7960bf41e64f60a7342fef13fb301e
Parents: 45bb5b3
Author: devozerov <vo...@gridgain.com>
Authored: Thu Jun 8 13:58:27 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Jun 8 13:58:27 2017 +0300
----------------------------------------------------------------------
.../org/apache/ignite/yardstick/cache/load/model/ModelUtil.java | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c73aad7c/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/ModelUtil.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/ModelUtil.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/ModelUtil.java
index 492ace7..eb945a0 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/ModelUtil.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/ModelUtil.java
@@ -38,6 +38,7 @@ public class ModelUtil {
* Classes of keys.
*/
private static Class[] keyClasses = {
+ Integer.class,
Double.class,
Identifier.class,
Mark.class,
[08/42] ignite git commit: IGNITE-5406 VisorExecutorConfiguration and
VisorGridConfiguration should use
IgniteConfiguration.sqlConnectorConfiguration instead of
IgniteConfiguration.odbcConfiguration.
Posted by ag...@apache.org.
IGNITE-5406 VisorExecutorConfiguration and VisorGridConfiguration should use IgniteConfiguration.sqlConnectorConfiguration instead of IgniteConfiguration.odbcConfiguration.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3ab4b9a2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3ab4b9a2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3ab4b9a2
Branch: refs/heads/ignite-5267-merge-ea
Commit: 3ab4b9a289e585bfa580fdf82ac0eab9fb3bfdec
Parents: 183aa80
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Wed Jun 7 14:26:29 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Wed Jun 7 14:26:29 2017 +0700
----------------------------------------------------------------------
.../SqlConnectorConfiguration.java | 2 +-
.../node/VisorExecutorServiceConfiguration.java | 20 +--
.../visor/node/VisorGridConfiguration.java | 22 +--
.../visor/node/VisorOdbcConfiguration.java | 114 -------------
.../node/VisorSqlConnectorConfiguration.java | 166 +++++++++++++++++++
.../resources/META-INF/classnames.properties | 2 +-
.../config/VisorConfigurationCommand.scala | 1 +
modules/web-console/backend/app/mongo.js | 12 ++
.../modules/configuration/Version.service.js | 4 +
.../generator/AbstractTransformer.js | 9 +-
.../generator/ConfigurationGenerator.js | 35 +++-
.../generator/defaults/Cluster.service.js | 9 +
.../states/configuration/caches/query.pug | 3 +-
.../states/configuration/clusters/memory.pug | 9 +
.../states/configuration/clusters/odbc.pug | 2 +-
.../configuration/clusters/sql-connector.pug | 62 +++++++
.../frontend/controllers/clusters-controller.js | 5 +-
.../views/configuration/clusters.tpl.pug | 6 +
18 files changed, 338 insertions(+), 145 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3ab4b9a2/modules/core/src/main/java/org/apache/ignite/configuration/SqlConnectorConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/SqlConnectorConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/SqlConnectorConfiguration.java
index 15563c8..9921974 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/SqlConnectorConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/SqlConnectorConfiguration.java
@@ -48,7 +48,7 @@ public class SqlConnectorConfiguration {
/** Port. */
private int port = DFLT_PORT;
- /** Poart range. */
+ /** Port range. */
private int portRange = DFLT_PORT_RANGE;
/** Socket send buffer size. */
http://git-wip-us.apache.org/repos/asf/ignite/blob/3ab4b9a2/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorExecutorServiceConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorExecutorServiceConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorExecutorServiceConfiguration.java
index 6929190..31a3713 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorExecutorServiceConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorExecutorServiceConfiguration.java
@@ -23,7 +23,7 @@ import java.io.ObjectOutput;
import java.util.List;
import org.apache.ignite.configuration.ConnectorConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.OdbcConfiguration;
+import org.apache.ignite.configuration.SqlConnectorConfiguration;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.visor.VisorDataTransferObject;
@@ -74,8 +74,8 @@ public class VisorExecutorServiceConfiguration extends VisorDataTransferObject {
/** Utility cache pool size. */
private int utilityCachePoolSize;
- /** ODBC pool size. */
- private int odbcPoolSize;
+ /** SQL connector configuration pool size. */
+ private int sqlConnCfgPoolSize;
/** List of executor configurations. */
private List<VisorExecutorConfiguration> executors;
@@ -112,10 +112,10 @@ public class VisorExecutorServiceConfiguration extends VisorDataTransferObject {
svcPoolSize = c.getServiceThreadPoolSize();
utilityCachePoolSize = c.getUtilityCacheThreadPoolSize();
- OdbcConfiguration oc = c.getOdbcConfiguration();
+ SqlConnectorConfiguration scc = c.getSqlConnectorConfiguration();
- if (oc != null)
- odbcPoolSize = oc.getThreadPoolSize();
+ if (scc != null)
+ sqlConnCfgPoolSize = scc.getThreadPoolSize();
executors = VisorExecutorConfiguration.list(c.getExecutorConfiguration());
}
@@ -216,8 +216,8 @@ public class VisorExecutorServiceConfiguration extends VisorDataTransferObject {
/**
* @return Thread pool that is in charge of processing ODBC tasks.
*/
- public int getOdbcThreadPoolSize() {
- return odbcPoolSize;
+ public int getSqlConnectorConfigurationThreadPoolSize() {
+ return sqlConnCfgPoolSize;
}
/**
@@ -242,7 +242,7 @@ public class VisorExecutorServiceConfiguration extends VisorDataTransferObject {
out.writeInt(stripedPoolSize);
out.writeInt(svcPoolSize);
out.writeInt(utilityCachePoolSize);
- out.writeInt(odbcPoolSize);
+ out.writeInt(sqlConnCfgPoolSize);
U.writeCollection(out, executors);
}
@@ -261,7 +261,7 @@ public class VisorExecutorServiceConfiguration extends VisorDataTransferObject {
stripedPoolSize = in.readInt();
svcPoolSize = in.readInt();
utilityCachePoolSize = in.readInt();
- odbcPoolSize = in.readInt();
+ sqlConnCfgPoolSize = in.readInt();
executors = U.readList(in);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3ab4b9a2/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
index ea5ce9e..ef916dc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
@@ -28,7 +28,7 @@ import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.configuration.BinaryConfiguration;
import org.apache.ignite.configuration.HadoopConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.OdbcConfiguration;
+import org.apache.ignite.configuration.SqlConnectorConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -110,8 +110,8 @@ public class VisorGridConfiguration extends VisorDataTransferObject {
/** Hadoop configuration. */
private VisorHadoopConfiguration hadoopCfg;
- /** ODBC configuration. */
- private VisorOdbcConfiguration odbcCfg;
+ /** SQL connector configuration. */
+ private VisorSqlConnectorConfiguration sqlConnCfg;
/** List of service configurations. */
private List<VisorServiceConfiguration> srvcCfgs;
@@ -168,10 +168,10 @@ public class VisorGridConfiguration extends VisorDataTransferObject {
if (hc != null)
hadoopCfg = new VisorHadoopConfiguration(hc);
- OdbcConfiguration oc = c.getOdbcConfiguration();
+ SqlConnectorConfiguration scc = c.getSqlConnectorConfiguration();
- if (oc != null)
- odbcCfg = new VisorOdbcConfiguration(c.getOdbcConfiguration());
+ if (scc != null)
+ sqlConnCfg = new VisorSqlConnectorConfiguration(scc);
srvcCfgs = VisorServiceConfiguration.list(c.getServiceConfiguration());
}
@@ -331,10 +331,10 @@ public class VisorGridConfiguration extends VisorDataTransferObject {
}
/**
- * @return ODBC configuration.
+ * @return SQL connector configuration.
*/
- public VisorOdbcConfiguration getOdbcConfiguration() {
- return odbcCfg;
+ public VisorSqlConnectorConfiguration getSqlConnectorConfiguration() {
+ return sqlConnCfg;
}
/**
@@ -368,7 +368,7 @@ public class VisorGridConfiguration extends VisorDataTransferObject {
out.writeObject(binaryCfg);
U.writeCollection(out, cacheKeyCfgs);
out.writeObject(hadoopCfg);
- out.writeObject(odbcCfg);
+ out.writeObject(sqlConnCfg);
U.writeCollection(out, srvcCfgs);
}
@@ -396,7 +396,7 @@ public class VisorGridConfiguration extends VisorDataTransferObject {
binaryCfg = (VisorBinaryConfiguration)in.readObject();
cacheKeyCfgs = U.readList(in);
hadoopCfg = (VisorHadoopConfiguration)in.readObject();
- odbcCfg = (VisorOdbcConfiguration)in.readObject();
+ sqlConnCfg = (VisorSqlConnectorConfiguration) in.readObject();
srvcCfgs = U.readList(in);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3ab4b9a2/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorOdbcConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorOdbcConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorOdbcConfiguration.java
deleted file mode 100644
index e29376b..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorOdbcConfiguration.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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.visor.node;
-
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import org.apache.ignite.configuration.OdbcConfiguration;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.internal.visor.VisorDataTransferObject;
-
-/**
- * Data transfer object for configuration of ODBC data structures.
- */
-public class VisorOdbcConfiguration extends VisorDataTransferObject {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Endpoint address. */
- private String endpointAddr;
-
- /** Socket send buffer size. */
- private int sockSndBufSize;
-
- /** Socket receive buffer size. */
- private int sockRcvBufSize;
-
- /** Max number of opened cursors per connection. */
- private int maxOpenCursors;
-
- /**
- * Default constructor.
- */
- public VisorOdbcConfiguration() {
- // No-op.
- }
-
- /**
- * Create data transfer object for ODBC configuration.
- *
- * @param src ODBC configuration.
- */
- public VisorOdbcConfiguration(OdbcConfiguration src) {
- endpointAddr = src.getEndpointAddress();
- sockSndBufSize = src.getSocketSendBufferSize();
- sockRcvBufSize = src.getSocketReceiveBufferSize();
- maxOpenCursors = src.getMaxOpenCursors();
- }
-
- /**
- * @return ODBC endpoint address.
- */
- public String getEndpointAddress() {
- return endpointAddr;
- }
-
- /**
- * @return Maximum number of opened cursors.
- */
- public int getMaxOpenCursors() {
- return maxOpenCursors;
- }
-
- /**
- * @return Socket send buffer size in bytes.
- */
- public int getSocketSendBufferSize() {
- return sockSndBufSize;
- }
-
- /**
- * @return Socket receive buffer size in bytes.
- */
- public int getSocketReceiveBufferSize() {
- return sockRcvBufSize;
- }
-
- /** {@inheritDoc} */
- @Override protected void writeExternalData(ObjectOutput out) throws IOException {
- U.writeString(out, endpointAddr);
- out.writeInt(sockSndBufSize);
- out.writeInt(sockRcvBufSize);
- out.writeInt(maxOpenCursors);
- }
-
- /** {@inheritDoc} */
- @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
- endpointAddr = U.readString(in);
- sockSndBufSize = in.readInt();
- sockRcvBufSize = in.readInt();
- maxOpenCursors = in.readInt();
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(VisorOdbcConfiguration.class, this);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3ab4b9a2/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSqlConnectorConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSqlConnectorConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSqlConnectorConfiguration.java
new file mode 100644
index 0000000..ccde415
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSqlConnectorConfiguration.java
@@ -0,0 +1,166 @@
+/*
+ * 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.visor.node;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.configuration.SqlConnectorConfiguration;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Data transfer object for SQL connector configuration.
+ */
+public class VisorSqlConnectorConfiguration extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Host. */
+ private String host;
+
+ /** Port. */
+ private int port;
+
+ /** Port range. */
+ private int portRange;
+
+ /** Max number of opened cursors per connection. */
+ private int maxOpenCursorsPerConn;
+
+ /** Socket send buffer size. */
+ private int sockSndBufSize;
+
+ /** Socket receive buffer size. */
+ private int sockRcvBufSize;
+
+ /** TCP no delay. */
+ private boolean tcpNoDelay;
+
+ /** Thread pool size. */
+ private int threadPoolSize ;
+
+ /**
+ * Default constructor.
+ */
+ public VisorSqlConnectorConfiguration() {
+ // No-op.
+ }
+
+ /**
+ * Create data transfer object for Sql connector configuration.
+ *
+ * @param cfg Sql connector configuration.
+ */
+ public VisorSqlConnectorConfiguration(SqlConnectorConfiguration cfg) {
+ host = cfg.getHost();
+ port = cfg.getPort();
+ portRange = cfg.getPortRange();
+ maxOpenCursorsPerConn = cfg.getMaxOpenCursorsPerConnection();
+ sockSndBufSize = cfg.getSocketSendBufferSize();
+ sockRcvBufSize = cfg.getSocketReceiveBufferSize();
+ tcpNoDelay = cfg.isTcpNoDelay();
+ threadPoolSize = cfg.getThreadPoolSize();
+ }
+
+ /**
+ * @return Host.
+ */
+ @Nullable public String getHost() {
+ return host;
+ }
+
+ /**
+ * @return Port.
+ */
+ public int getPort() {
+ return port;
+ }
+
+ /**
+ * @return Port range.
+ */
+ public int getPortRange() {
+ return portRange;
+ }
+
+ /**
+ * @return Maximum number of opened cursors.
+ */
+ public int getMaxOpenCursorsPerConnection() {
+ return maxOpenCursorsPerConn;
+ }
+
+ /**
+ * @return Socket send buffer size in bytes.
+ */
+ public int getSocketSendBufferSize() {
+ return sockSndBufSize;
+ }
+
+ /**
+ * @return Socket receive buffer size in bytes.
+ */
+ public int getSocketReceiveBufferSize() {
+ return sockRcvBufSize;
+ }
+
+ /**
+ * @return TCP NO_DELAY flag.
+ */
+ public boolean isTcpNoDelay() {
+ return tcpNoDelay;
+ }
+ /**
+ * @return Thread pool that is in charge of processing SQL requests.
+ */
+ public int getThreadPoolSize() {
+ return threadPoolSize;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, host);
+ out.writeInt(port);
+ out.writeInt(portRange);
+ out.writeInt(maxOpenCursorsPerConn);
+ out.writeInt(sockSndBufSize);
+ out.writeInt(sockRcvBufSize );
+ out.writeBoolean(tcpNoDelay);
+ out.writeInt(threadPoolSize);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ host = U.readString(in);
+ port = in.readInt();
+ portRange = in.readInt();
+ maxOpenCursorsPerConn = in.readInt();
+ sockSndBufSize = in.readInt();
+ sockRcvBufSize = in.readInt();
+ tcpNoDelay = in.readBoolean();
+ threadPoolSize = in.readInt();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorSqlConnectorConfiguration.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3ab4b9a2/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index 8349687..2218aad 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -1852,13 +1852,13 @@ org.apache.ignite.internal.visor.node.VisorNodeSuppressedErrors
org.apache.ignite.internal.visor.node.VisorNodeSuppressedErrorsTask
org.apache.ignite.internal.visor.node.VisorNodeSuppressedErrorsTask$VisorNodeSuppressedErrorsJob
org.apache.ignite.internal.visor.node.VisorNodeSuppressedErrorsTaskArg
-org.apache.ignite.internal.visor.node.VisorOdbcConfiguration
org.apache.ignite.internal.visor.node.VisorPeerToPeerConfiguration
org.apache.ignite.internal.visor.node.VisorRestConfiguration
org.apache.ignite.internal.visor.node.VisorSegmentationConfiguration
org.apache.ignite.internal.visor.node.VisorServiceConfiguration
org.apache.ignite.internal.visor.node.VisorSpiDescription
org.apache.ignite.internal.visor.node.VisorSpisConfiguration
+org.apache.ignite.internal.visor.node.VisorSqlConnectorConfiguration
org.apache.ignite.internal.visor.node.VisorSuppressedError
org.apache.ignite.internal.visor.node.VisorTransactionConfiguration
org.apache.ignite.internal.visor.query.VisorQueryCancelTask
http://git-wip-us.apache.org/repos/asf/ignite/blob/3ab4b9a2/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala
index 299c300..13ab778 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala
@@ -273,6 +273,7 @@ class VisorConfigurationCommand extends VisorConsoleCommand {
execSvcT += ("Peer-to-Peer thread pool size", safe(execCfg.getPeerClassLoadingThreadPoolSize))
execSvcT += ("Rebalance Thread Pool size", execCfg.getRebalanceThreadPoolSize)
execSvcT += ("REST thread pool size", safe(execCfg.getRestThreadPoolSize))
+ execSvcT += ("SQL processor thread pool size", safe(execCfg.getSqlConnectorConfigurationThreadPoolSize))
execSvcT.render()
http://git-wip-us.apache.org/repos/asf/ignite/blob/3ab4b9a2/modules/web-console/backend/app/mongo.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/mongo.js b/modules/web-console/backend/app/mongo.js
index d3bc4c0..8e75719 100644
--- a/modules/web-console/backend/app/mongo.js
+++ b/modules/web-console/backend/app/mongo.js
@@ -959,6 +959,18 @@ module.exports.factory = function(passportMongo, settings, pluginMongo, mongoose
emptyPagesPoolSize: Number,
metricsEnabled: Boolean
}]
+ },
+ longQueryWarningTimeout: Number,
+ sqlConnectorConfiguration: {
+ enabled: Boolean,
+ host: String,
+ port: Number,
+ portRange: Number,
+ socketSendBufferSize: Number,
+ socketReceiveBufferSize: Number,
+ tcpNoDelay: {type: Boolean, default: true},
+ maxOpenCursorsPerConnection: Number,
+ threadPoolSize: Number
}
});
http://git-wip-us.apache.org/repos/asf/ignite/blob/3ab4b9a2/modules/web-console/frontend/app/modules/configuration/Version.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/Version.service.js b/modules/web-console/frontend/app/modules/configuration/Version.service.js
index cf2bfc5..5b29291 100644
--- a/modules/web-console/frontend/app/modules/configuration/Version.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/Version.service.js
@@ -75,6 +75,10 @@ export default class IgniteVersion {
constructor() {
this.supportedVersions = [
{
+ label: 'Ignite 2.1',
+ ignite: '2.1.0'
+ },
+ {
label: 'Ignite 2.0',
ignite: '2.0.0'
},
http://git-wip-us.apache.org/repos/asf/ignite/blob/3ab4b9a2/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js b/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
index 20393c5..6451a76 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
@@ -154,8 +154,13 @@ export default class AbstractTransformer {
}
// Generate ODBC group.
- static clusterODBC(odbc) {
- return this.toSection(this.generator.clusterODBC(odbc));
+ static clusterODBC(odbc, available) {
+ return this.toSection(this.generator.clusterODBC(odbc, available));
+ }
+
+ // Generate cluster query group.
+ static clusterQuery(odbc, available) {
+ return this.toSection(this.generator.clusterQuery(odbc, available));
}
// Generate cache node filter group.
http://git-wip-us.apache.org/repos/asf/ignite/blob/3ab4b9a2/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
index 39ebced..a55fdf1 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
@@ -95,7 +95,8 @@ export default class IgniteConfigurationGenerator {
this.clusterMisc(cluster, available, cfg);
this.clusterMetrics(cluster, available, cfg);
- this.clusterODBC(cluster.odbc, cfg);
+ this.clusterODBC(cluster.odbc, available, cfg);
+ this.clusterQuery(cluster, available, cfg);
this.clusterServiceConfiguration(cluster.serviceConfigurations, cluster.caches, cfg);
this.clusterSsl(cluster, cfg);
@@ -1410,8 +1411,9 @@ export default class IgniteConfigurationGenerator {
}
// Generate ODBC group.
- static clusterODBC(odbc, cfg = this.igniteConfigurationBean()) {
- if (_.get(odbc, 'odbcEnabled') !== true)
+ static clusterODBC(odbc, available, cfg = this.igniteConfigurationBean()) {
+ // Deprecated in ignite 2.1
+ if (available('2.1.0') || _.get(odbc, 'odbcEnabled') !== true)
return cfg;
const bean = new Bean('org.apache.ignite.configuration.OdbcConfiguration', 'odbcConfiguration',
@@ -1425,6 +1427,33 @@ export default class IgniteConfigurationGenerator {
return cfg;
}
+ // Generate cluster query group.
+ static clusterQuery(cluster, available, cfg = this.igniteConfigurationBean(cluster)) {
+ if (available(['1.0.0', '2.1.0']))
+ return cfg;
+
+ cfg.intProperty('longQueryWarningTimeout');
+
+ if (_.get(cluster, 'sqlConnectorConfiguration.enabled') !== true)
+ return cfg;
+
+ const bean = new Bean('org.apache.ignite.configuration.SqlConnectorConfiguration', 'sqlConnCfg',
+ cluster.sqlConnectorConfiguration, clusterDflts.sqlConnectorConfiguration);
+
+ bean.stringProperty('host')
+ .intProperty('port')
+ .intProperty('portRange')
+ .intProperty('socketSendBufferSize')
+ .intProperty('socketReceiveBufferSize')
+ .intProperty('maxOpenCursorsPerConnection')
+ .intProperty('threadPoolSize')
+ .boolProperty('tcpNoDelay');
+
+ cfg.beanProperty('sqlConnectorConfiguration', bean);
+
+ return cfg;
+ }
+
// Java code generator for cluster's service configurations.
static clusterServiceConfiguration(srvs, caches, cfg = this.igniteConfigurationBean()) {
const srvBeans = [];
http://git-wip-us.apache.org/repos/asf/ignite/blob/3ab4b9a2/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js
index 2c86667..d3fafe0 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js
@@ -324,6 +324,15 @@ const DFLT_CLUSTER = {
serviceConfigurations: {
maxPerNodeCount: 0,
totalCount: 0
+ },
+ longQueryWarningTimeout: 3000,
+ sqlConnectorConfiguration: {
+ port: 10800,
+ portRange: 100,
+ socketSendBufferSize: 0,
+ socketReceiveBufferSize: 0,
+ tcpNoDelay: true,
+ maxOpenCursorsPerConnection: 128
}
};
http://git-wip-us.apache.org/repos/asf/ignite/blob/3ab4b9a2/modules/web-console/frontend/app/modules/states/configuration/caches/query.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/caches/query.pug b/modules/web-console/frontend/app/modules/states/configuration/caches/query.pug
index 480b0a5..0eb73d7 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/caches/query.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/caches/query.pug
@@ -52,7 +52,8 @@ include /app/helpers/jade/mixins
+number('On-heap cache for off-heap indexes:', `${model}.sqlOnheapRowCacheSize`, '"sqlOnheapRowCacheSize"', 'true', '10240', '1',
'Number of SQL rows which will be cached onheap to avoid deserialization on each SQL index access')
- .settings-row
+ //- Deprecated in ignite 2.1
+ .settings-row(ng-if='$ctrl.available(["1.0.0", "2.1.0"])')
+number('Long query timeout:', `${model}.longQueryWarningTimeout`, '"longQueryWarningTimeout"', 'true', '3000', '0',
'Timeout in milliseconds after which long query warning will be printed')
.settings-row
http://git-wip-us.apache.org/repos/asf/ignite/blob/3ab4b9a2/modules/web-console/frontend/app/modules/states/configuration/clusters/memory.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/memory.pug b/modules/web-console/frontend/app/modules/states/configuration/clusters/memory.pug
index 62a07c1..06f9f7b 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/memory.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/memory.pug
@@ -110,5 +110,14 @@ include /app/helpers/jade/mixins
.settings-row
+checkbox('Metrics enabled', 'model.metricsEnabled', '"MemoryPolicyMetricsEnabled" + $index',
'Whether memory metrics are enabled by default on node startup')
+
+ //- Since ignite 2.1
+ .div(ng-if='$ctrl.available("2.1.0")')
+ .settings-row
+ +number('Sub intervals:', 'model.subIntervals', '"MemoryPolicySubIntervals" + $index',
+ 'true', '5', '1', 'A number of sub-intervals the whole rate time interval will be split into to calculate allocation and eviction rates')
+ .settings-row
+ +number('Rate time interval:', 'model.rateTimeInterval', '"MemoryPolicyRateTimeInterval" + $index',
+ 'true', '60000', '1000', 'Time interval for allocation rate and eviction rate monitoring purposes')
.col-sm-6
+preview-xml-java(model, 'clusterMemory')
http://git-wip-us.apache.org/repos/asf/ignite/blob/3ab4b9a2/modules/web-console/frontend/app/modules/states/configuration/clusters/odbc.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/odbc.pug b/modules/web-console/frontend/app/modules/states/configuration/clusters/odbc.pug
index a69c7ad..a1d8b89 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/odbc.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/odbc.pug
@@ -20,7 +20,7 @@ include /app/helpers/jade/mixins
-var model = 'backupItem.odbc'
-var enabled = model + '.odbcEnabled'
-.panel.panel-default(ng-form=form novalidate)
+.panel.panel-default(ng-if='$ctrl.available(["1.0.0", "2.1.0"])' ng-form=form novalidate)
.panel-heading(bs-collapse-toggle ng-click=`ui.loadPanel('${form}')`)
ignite-form-panel-chevron
label ODBC configuration
http://git-wip-us.apache.org/repos/asf/ignite/blob/3ab4b9a2/modules/web-console/frontend/app/modules/states/configuration/clusters/sql-connector.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/sql-connector.pug b/modules/web-console/frontend/app/modules/states/configuration/clusters/sql-connector.pug
new file mode 100644
index 0000000..4b4e1c0
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/sql-connector.pug
@@ -0,0 +1,62 @@
+//-
+ 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.
+
+include /app/helpers/jade/mixins
+
+-var form = 'query'
+-var model = 'backupItem'
+-var connectionModel = model + '.sqlConnectorConfiguration'
+-var connectionEnabled = connectionModel + '.enabled'
+
+.panel.panel-default(ng-if='$ctrl.available("2.1.0")' ng-form=form novalidate)
+ .panel-heading(bs-collapse-toggle ng-click=`ui.loadPanel('${form}')`)
+ ignite-form-panel-chevron
+ label Query configuration
+ ignite-form-field-tooltip.tipLabel
+ | Query configuration
+ ignite-form-revert
+ .panel-collapse(role='tabpanel' bs-collapse-target id=`${form}`)
+ .panel-body(ng-if=`ui.isPanelLoaded('${form}')`)
+ .col-sm-6
+ .settings-row
+ +number('Long query timeout:', `${model}.longQueryWarningTimeout`, '"LongQueryWarningTimeout"', 'true', '3000', '0',
+ 'Timeout in milliseconds after which long query warning will be printed')
+ .settings-row
+ +checkbox('Enable SQL connection configuration', connectionEnabled, '"SqlConnectorEnabled"', 'Enable SQL connector configuration')
+ .settings-row
+ +text-enabled('Host:', `${connectionModel}.host`, '"SqlConnectorHost"', connectionEnabled, 'false', 'localhost', 'Host')
+ .settings-row
+ +number('Port:', `${connectionModel}.port`, '"SqlConnectorPort"', connectionEnabled, '10800', '1025', 'Port')
+ .settings-row
+ +number('Port range:', `${connectionModel}.portRange`, '"SqlConnectorPortRange"', connectionEnabled, '100', '0', 'Port range')
+ .settings-row
+ +number('Socket send buffer:', `${connectionModel}.socketSendBufferSize`, '"SqlConnectorSocketSendBufferSize"', connectionEnabled, '0', '0',
+ 'Socket send buffer size.<br/>\ ' +
+ 'When set to <b>0</b>, operation system default will be used')
+ .settings-row
+ +number('Socket receive buffer:', `${connectionModel}.socketReceiveBufferSize`, '"SqlConnectorSocketReceiveBufferSize"', connectionEnabled, '0', '0',
+ 'Socket receive buffer size.<br/>\ ' +
+ 'When set to <b>0</b>, operation system default will be used')
+ .settings-row
+ +number('Max connection cursors:', `${connectionModel}.maxOpenCursorsPerConnection`, '"SqlConnectorMaxOpenCursorsPerConnection"', connectionEnabled, '128', '0',
+ 'Max number of opened cursors per connection')
+ .settings-row
+ +number('Pool size:', `${connectionModel}.threadPoolSize`, '"SqlConnectorThreadPoolSize"', connectionEnabled, 'max(8, availableProcessors)', '1',
+ 'Size of thread pool that is in charge of processing SQL requests')
+ .settings-row
+ +checkbox-enabled('TCP_NODELAY option', `${connectionModel}.tcpNoDelay`, '"SqlConnectorTcpNoDelay"', connectionEnabled, 'Value for TCP_NODELAY socket option')
+ .col-sm-6
+ +preview-xml-java(model, 'clusterQuery')
http://git-wip-us.apache.org/repos/asf/ignite/blob/3ab4b9a2/modules/web-console/frontend/controllers/clusters-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/controllers/clusters-controller.js b/modules/web-console/frontend/controllers/clusters-controller.js
index 6861fe7..6333009 100644
--- a/modules/web-console/frontend/controllers/clusters-controller.js
+++ b/modules/web-console/frontend/controllers/clusters-controller.js
@@ -110,7 +110,10 @@ export default ['$rootScope', '$scope', '$http', '$state', '$timeout', 'IgniteLe
nativeLibraryNames: []
},
serviceConfigurations: [],
- executorConfiguration: []
+ executorConfiguration: [],
+ sqlConnectorConfiguration: {
+ tcpNoDelay: true
+ }
};
const pairFields = {
http://git-wip-us.apache.org/repos/asf/ignite/blob/3ab4b9a2/modules/web-console/frontend/views/configuration/clusters.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/configuration/clusters.tpl.pug b/modules/web-console/frontend/views/configuration/clusters.tpl.pug
index 744ec7c..68698a3 100644
--- a/modules/web-console/frontend/views/configuration/clusters.tpl.pug
+++ b/modules/web-console/frontend/views/configuration/clusters.tpl.pug
@@ -63,7 +63,13 @@ include /app/helpers/jade/mixins
include /app/modules/states/configuration/clusters/misc
include /app/modules/states/configuration/clusters/metrics
+
+ //- Deprecated in ignite 2.1
include /app/modules/states/configuration/clusters/odbc
+
+ //- Since ignite 2.1
+ include /app/modules/states/configuration/clusters/sql-connector
+
include /app/modules/states/configuration/clusters/service
include /app/modules/states/configuration/clusters/ssl
[10/42] ignite git commit: IGNITE-5400 .NET:
IgniteConfiguration.SqlConnectorConfiguration
Posted by ag...@apache.org.
IGNITE-5400 .NET: IgniteConfiguration.SqlConnectorConfiguration
This closes #2085
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/86d0049b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/86d0049b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/86d0049b
Branch: refs/heads/ignite-5267-merge-ea
Commit: 86d0049b7a248cf6f9fe2532b63d0e22baaa659e
Parents: 56768a2
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed Jun 7 12:08:34 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Wed Jun 7 12:08:34 2017 +0300
----------------------------------------------------------------------
.../utils/PlatformConfigurationUtils.java | 86 ++++++++++
.../IgniteConfigurationSerializerTest.cs | 26 ++-
.../IgniteConfigurationTest.cs | 56 +++++++
.../Apache.Ignite.Core.csproj | 2 +
.../Configuration/Package-Info.cs | 26 +++
.../Configuration/SqlConnectorConfiguration.cs | 159 ++++++++++++++++++
.../Apache.Ignite.Core/IgniteConfiguration.cs | 164 +++++++++++++++++++
.../IgniteConfigurationSection.xsd | 92 +++++++++++
.../Common/IgniteConfigurationXmlSerializer.cs | 10 ++
9 files changed, 620 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/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 7f23b85..40dafbd 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
@@ -58,6 +58,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.MemoryConfiguration;
import org.apache.ignite.configuration.MemoryPolicyConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.configuration.SqlConnectorConfiguration;
import org.apache.ignite.configuration.TransactionConfiguration;
import org.apache.ignite.internal.binary.BinaryRawReaderEx;
import org.apache.ignite.internal.binary.BinaryRawWriterEx;
@@ -562,6 +563,26 @@ public class PlatformConfigurationUtils {
if (in.readBoolean())
cfg.setClientFailureDetectionTimeout(in.readLong());
+ // Thread pools.
+ if (in.readBoolean())
+ cfg.setPublicThreadPoolSize(in.readInt());
+ if (in.readBoolean())
+ cfg.setStripedPoolSize(in.readInt());
+ if (in.readBoolean())
+ cfg.setServiceThreadPoolSize(in.readInt());
+ if (in.readBoolean())
+ cfg.setSystemThreadPoolSize(in.readInt());
+ if (in.readBoolean())
+ cfg.setAsyncCallbackPoolSize(in.readInt());
+ if (in.readBoolean())
+ cfg.setManagementThreadPoolSize(in.readInt());
+ if (in.readBoolean())
+ cfg.setDataStreamerThreadPoolSize(in.readInt());
+ if (in.readBoolean())
+ cfg.setUtilityCachePoolSize(in.readInt());
+ if (in.readBoolean())
+ cfg.setQueryThreadPoolSize(in.readInt());
+
readCacheConfigurations(in, cfg);
readDiscoveryConfiguration(in, cfg);
@@ -650,6 +671,9 @@ public class PlatformConfigurationUtils {
if (in.readBoolean())
cfg.setMemoryConfiguration(readMemoryConfiguration(in));
+ if (in.readBoolean())
+ cfg.setSqlConnectorConfiguration(readSqlConnectorConfiguration(in));
+
readPluginConfiguration(cfg, in);
}
@@ -978,6 +1002,26 @@ public class PlatformConfigurationUtils {
w.writeBoolean(true);
w.writeLong(cfg.getClientFailureDetectionTimeout());
+ // Thread pools.
+ w.writeBoolean(true);
+ w.writeInt(cfg.getPublicThreadPoolSize());
+ w.writeBoolean(true);
+ w.writeInt(cfg.getStripedPoolSize());
+ w.writeBoolean(true);
+ w.writeInt(cfg.getServiceThreadPoolSize());
+ w.writeBoolean(true);
+ w.writeInt(cfg.getSystemThreadPoolSize());
+ w.writeBoolean(true);
+ w.writeInt(cfg.getAsyncCallbackPoolSize());
+ w.writeBoolean(true);
+ w.writeInt(cfg.getManagementThreadPoolSize());
+ w.writeBoolean(true);
+ w.writeInt(cfg.getDataStreamerThreadPoolSize());
+ w.writeBoolean(true);
+ w.writeInt(cfg.getUtilityCacheThreadPoolSize());
+ w.writeBoolean(true);
+ w.writeInt(cfg.getQueryThreadPoolSize());
+
CacheConfiguration[] cacheCfg = cfg.getCacheConfiguration();
if (cacheCfg != null) {
@@ -1084,6 +1128,8 @@ public class PlatformConfigurationUtils {
writeMemoryConfiguration(w, cfg.getMemoryConfiguration());
+ writeSqlConnectorConfiguration(w, cfg.getSqlConnectorConfiguration());
+
w.writeString(cfg.getIgniteHome());
w.writeLong(ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getInit());
@@ -1371,7 +1417,47 @@ public class PlatformConfigurationUtils {
}
}
+ /**
+ * Reads the SQL connector configuration.
+ *
+ * @param in Reader.
+ * @return Config.
+ */
+ private static SqlConnectorConfiguration readSqlConnectorConfiguration(BinaryRawReader in) {
+ return new SqlConnectorConfiguration()
+ .setHost(in.readString())
+ .setPort(in.readInt())
+ .setPortRange(in.readInt())
+ .setSocketSendBufferSize(in.readInt())
+ .setSocketReceiveBufferSize(in.readInt())
+ .setTcpNoDelay(in.readBoolean())
+ .setMaxOpenCursorsPerConnection(in.readInt())
+ .setThreadPoolSize(in.readInt());
+ }
+
+ /**
+ * Writes the SQL connector configuration.
+ *
+ * @param w Writer.
+ */
+ private static void writeSqlConnectorConfiguration(BinaryRawWriter w, SqlConnectorConfiguration cfg) {
+ assert w != null;
+
+ if (cfg != null) {
+ w.writeBoolean(true);
+ w.writeString(cfg.getHost());
+ w.writeInt(cfg.getPort());
+ w.writeInt(cfg.getPortRange());
+ w.writeInt(cfg.getSocketSendBufferSize());
+ w.writeInt(cfg.getSocketReceiveBufferSize());
+ w.writeBoolean(cfg.isTcpNoDelay());
+ w.writeInt(cfg.getMaxOpenCursorsPerConnection());
+ w.writeInt(cfg.getThreadPoolSize());
+ } else {
+ w.writeBoolean(false);
+ }
+ }
/**
* Private constructor.
http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/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 c726f85..7ba4ed2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
@@ -40,6 +40,7 @@ namespace Apache.Ignite.Core.Tests
using Apache.Ignite.Core.Cache.Store;
using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Communication.Tcp;
+ using Apache.Ignite.Core.Configuration;
using Apache.Ignite.Core.DataStructures.Configuration;
using Apache.Ignite.Core.Deployment;
using Apache.Ignite.Core.Discovery.Tcp;
@@ -140,6 +141,7 @@ namespace Apache.Ignite.Core.Tests
<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>
+ <sqlConnectorConfiguration host='bar' port='10' portRange='11' socketSendBufferSize='12' socketReceiveBufferSize='13' tcpNoDelay='true' maxOpenCursorsPerConnection='14' threadPoolSize='15' />
</igniteConfig>";
var cfg = IgniteConfiguration.FromXml(xml);
@@ -278,6 +280,17 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(TimeSpan.FromSeconds(62), memPlc.RateTimeInterval);
Assert.AreEqual(PeerAssemblyLoadingMode.CurrentAppDomain, cfg.PeerAssemblyLoadingMode);
+
+ var sql = cfg.SqlConnectorConfiguration;
+ Assert.IsNotNull(sql);
+ Assert.AreEqual("bar", sql.Host);
+ Assert.AreEqual(10, sql.Port);
+ Assert.AreEqual(11, sql.PortRange);
+ Assert.AreEqual(12, sql.SocketSendBufferSize);
+ Assert.AreEqual(13, sql.SocketReceiveBufferSize);
+ Assert.IsTrue(sql.TcpNoDelay);
+ Assert.AreEqual(14, sql.MaxOpenCursorsPerConnection);
+ Assert.AreEqual(15, sql.ThreadPoolSize);
}
/// <summary>
@@ -839,7 +852,18 @@ namespace Apache.Ignite.Core.Tests
}
}
},
- PeerAssemblyLoadingMode = PeerAssemblyLoadingMode.CurrentAppDomain
+ PeerAssemblyLoadingMode = PeerAssemblyLoadingMode.CurrentAppDomain,
+ SqlConnectorConfiguration = new SqlConnectorConfiguration
+ {
+ Host = "foo",
+ Port = 2,
+ PortRange = 3,
+ MaxOpenCursorsPerConnection = 4,
+ SocketReceiveBufferSize = 5,
+ SocketSendBufferSize = 6,
+ TcpNoDelay = false,
+ ThreadPoolSize = 7
+ }
};
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/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 80b271d..9d19a23 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
@@ -27,6 +27,7 @@ namespace Apache.Ignite.Core.Tests
using Apache.Ignite.Core.Cache.Eviction;
using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Communication.Tcp;
+ using Apache.Ignite.Core.Configuration;
using Apache.Ignite.Core.DataStructures.Configuration;
using Apache.Ignite.Core.Discovery.Tcp;
using Apache.Ignite.Core.Discovery.Tcp.Multicast;
@@ -81,6 +82,7 @@ namespace Apache.Ignite.Core.Tests
CheckDefaultValueAttributes(new MemoryEventStorageSpi());
CheckDefaultValueAttributes(new MemoryConfiguration());
CheckDefaultValueAttributes(new MemoryPolicyConfiguration());
+ CheckDefaultValueAttributes(new SqlConnectorConfiguration());
}
/// <summary>
@@ -173,6 +175,16 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(cfg.FailureDetectionTimeout, resCfg.FailureDetectionTimeout);
Assert.AreEqual(cfg.ClientFailureDetectionTimeout, resCfg.ClientFailureDetectionTimeout);
+ Assert.AreEqual(cfg.PublicThreadPoolSize, resCfg.PublicThreadPoolSize);
+ Assert.AreEqual(cfg.StripedThreadPoolSize, resCfg.StripedThreadPoolSize);
+ Assert.AreEqual(cfg.ServiceThreadPoolSize, resCfg.ServiceThreadPoolSize);
+ Assert.AreEqual(cfg.SystemThreadPoolSize, resCfg.SystemThreadPoolSize);
+ Assert.AreEqual(cfg.AsyncCallbackThreadPoolSize, resCfg.AsyncCallbackThreadPoolSize);
+ Assert.AreEqual(cfg.ManagementThreadPoolSize, resCfg.ManagementThreadPoolSize);
+ Assert.AreEqual(cfg.DataStreamerThreadPoolSize, resCfg.DataStreamerThreadPoolSize);
+ Assert.AreEqual(cfg.UtilityCacheThreadPoolSize, resCfg.UtilityCacheThreadPoolSize);
+ Assert.AreEqual(cfg.QueryThreadPoolSize, resCfg.QueryThreadPoolSize);
+
var binCfg = cfg.BinaryConfiguration;
Assert.IsFalse(binCfg.CompactFooter);
@@ -218,6 +230,18 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(plc.Name, resPlc.Name);
Assert.AreEqual(plc.SwapFilePath, resPlc.SwapFilePath);
}
+
+ var sql = cfg.SqlConnectorConfiguration;
+ var resSql = resCfg.SqlConnectorConfiguration;
+
+ Assert.AreEqual(sql.Host, resSql.Host);
+ Assert.AreEqual(sql.Port, resSql.Port);
+ Assert.AreEqual(sql.PortRange, resSql.PortRange);
+ Assert.AreEqual(sql.MaxOpenCursorsPerConnection, resSql.MaxOpenCursorsPerConnection);
+ Assert.AreEqual(sql.SocketReceiveBufferSize, resSql.SocketReceiveBufferSize);
+ Assert.AreEqual(sql.SocketSendBufferSize, resSql.SocketSendBufferSize);
+ Assert.AreEqual(sql.TcpNoDelay, resSql.TcpNoDelay);
+ Assert.AreEqual(sql.ThreadPoolSize, resSql.ThreadPoolSize);
}
}
@@ -455,6 +479,17 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(IgniteConfiguration.DefaultFailureDetectionTimeout, cfg.FailureDetectionTimeout);
Assert.AreEqual(IgniteConfiguration.DefaultClientFailureDetectionTimeout,
cfg.ClientFailureDetectionTimeout);
+
+ // Thread pools.
+ Assert.AreEqual(IgniteConfiguration.DefaultManagementThreadPoolSize, cfg.ManagementThreadPoolSize);
+ Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.PublicThreadPoolSize);
+ Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.StripedThreadPoolSize);
+ Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.ServiceThreadPoolSize);
+ Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.SystemThreadPoolSize);
+ Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.AsyncCallbackThreadPoolSize);
+ Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.DataStreamerThreadPoolSize);
+ Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.UtilityCacheThreadPoolSize);
+ Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.QueryThreadPoolSize);
}
/// <summary>
@@ -466,6 +501,7 @@ namespace Apache.Ignite.Core.Tests
var props = obj.GetType().GetProperties();
foreach (var prop in props.Where(p => p.Name != "SelectorsCount" && p.Name != "ReadStripesNumber" &&
+ !p.Name.Contains("ThreadPoolSize") &&
!(p.Name == "MaxSize" &&
p.DeclaringType == typeof(MemoryPolicyConfiguration))))
{
@@ -615,6 +651,26 @@ namespace Apache.Ignite.Core.Tests
MetricsEnabled = true
}
}
+ },
+ PublicThreadPoolSize = 3,
+ StripedThreadPoolSize = 5,
+ ServiceThreadPoolSize = 6,
+ SystemThreadPoolSize = 7,
+ AsyncCallbackThreadPoolSize = 8,
+ ManagementThreadPoolSize = 9,
+ DataStreamerThreadPoolSize = 10,
+ UtilityCacheThreadPoolSize = 11,
+ QueryThreadPoolSize = 12,
+ SqlConnectorConfiguration = new SqlConnectorConfiguration
+ {
+ Host = "127.0.0.2",
+ Port = 1081,
+ PortRange = 3,
+ SocketReceiveBufferSize = 2048,
+ MaxOpenCursorsPerConnection = 5,
+ ThreadPoolSize = 4,
+ TcpNoDelay = false,
+ SocketSendBufferSize = 4096
}
};
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index b37b685..82bb5ca 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -98,6 +98,8 @@
<Compile Include="Cache\Configuration\PartitionLossPolicy.cs" />
<Compile Include="Cache\IMemoryMetrics.cs" />
<Compile Include="Common\ExceptionFactory.cs" />
+ <Compile Include="Configuration\Package-Info.cs" />
+ <Compile Include="Configuration\SqlConnectorConfiguration.cs" />
<Compile Include="Deployment\PeerAssemblyLoadingMode.cs" />
<Compile Include="Events\IEventStorageSpi.cs" />
<Compile Include="Events\MemoryEventStorageSpi.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/Package-Info.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/Package-Info.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/Package-Info.cs
new file mode 100644
index 0000000..f2dfb53
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/Package-Info.cs
@@ -0,0 +1,26 @@
+/*
+* 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.
+*/
+
+#pragma warning disable 1587 // invalid XML comment
+
+/// <summary>
+/// General configuration APIs.
+/// </summary>
+namespace Apache.Ignite.Core.Configuration
+{
+ // No-op.
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/SqlConnectorConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/SqlConnectorConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/SqlConnectorConfiguration.cs
new file mode 100644
index 0000000..0a9b7e5
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/SqlConnectorConfiguration.cs
@@ -0,0 +1,159 @@
+/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Configuration
+{
+ using System.ComponentModel;
+ using System.Diagnostics;
+ using Apache.Ignite.Core.Binary;
+
+ /// <summary>
+ /// SQL connector configuration (for ODBC and JDBC).
+ /// </summary>
+ public class SqlConnectorConfiguration
+ {
+ /// <summary>
+ /// Default port.
+ /// </summary>
+ public const int DefaultPort = 10800;
+
+ /// <summary>
+ /// Default port range.
+ /// </summary>
+ public const int DefaultPortRange = 100;
+
+ /// <summary>
+ /// Default socket buffer size.
+ /// </summary>
+ public const int DefaultSocketBufferSize = 0;
+
+ /// <summary>
+ /// Default value of <see cref="TcpNoDelay" /> property.
+ /// </summary>
+ public const bool DefaultTcpNoDelay = true;
+
+ /// <summary>
+ /// Default maximum number of open cursors per connection.
+ /// </summary>
+ public const int DefaultMaxOpenCursorsPerConnection = 128;
+
+ /// <summary>
+ /// Default SQL connector thread pool size.
+ /// </summary>
+ public static readonly int DefaultThreadPoolSize = IgniteConfiguration.DefaultThreadPoolSize;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="SqlConnectorConfiguration"/> class.
+ /// </summary>
+ public SqlConnectorConfiguration()
+ {
+ Port = DefaultPort;
+ PortRange = DefaultPortRange;
+ SocketSendBufferSize = DefaultSocketBufferSize;
+ SocketReceiveBufferSize = DefaultSocketBufferSize;
+ TcpNoDelay = DefaultTcpNoDelay;
+ MaxOpenCursorsPerConnection = DefaultMaxOpenCursorsPerConnection;
+ ThreadPoolSize = DefaultThreadPoolSize;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="SqlConnectorConfiguration"/> class.
+ /// </summary>
+ internal SqlConnectorConfiguration(IBinaryRawReader reader)
+ {
+ Debug.Assert(reader != null);
+
+ Host = reader.ReadString();
+ Port = reader.ReadInt();
+ PortRange = reader.ReadInt();
+ SocketSendBufferSize = reader.ReadInt();
+ SocketReceiveBufferSize = reader.ReadInt();
+ TcpNoDelay = reader.ReadBoolean();
+ MaxOpenCursorsPerConnection = reader.ReadInt();
+ ThreadPoolSize = reader.ReadInt();
+ }
+
+ /// <summary>
+ /// Writes to the specified writer.
+ /// </summary>
+ internal void Write(IBinaryRawWriter writer)
+ {
+ Debug.Assert(writer != null);
+
+ writer.WriteString(Host);
+ writer.WriteInt(Port);
+ writer.WriteInt(PortRange);
+ writer.WriteInt(SocketSendBufferSize);
+ writer.WriteInt(SocketReceiveBufferSize);
+ writer.WriteBoolean(TcpNoDelay);
+ writer.WriteInt(MaxOpenCursorsPerConnection);
+ writer.WriteInt(ThreadPoolSize);
+ }
+
+ /// <summary>
+ /// Gets or sets the host.
+ /// </summary>
+ public string Host { get; set; }
+
+ /// <summary>
+ /// Gets or sets the port.
+ /// </summary>
+ [DefaultValue(DefaultPort)]
+ public int Port { get; set; }
+
+ /// <summary>
+ /// Gets or sets the port range.
+ /// </summary>
+ [DefaultValue(DefaultPortRange)]
+ public int PortRange { get; set; }
+
+ /// <summary>
+ /// Gets or sets the size of the socket send buffer. When set to 0, operating system default is used.
+ /// </summary>
+ [DefaultValue(DefaultSocketBufferSize)]
+ public int SocketSendBufferSize { get; set; }
+
+ /// <summary>
+ /// Gets or sets the size of the socket receive buffer. When set to 0, operating system default is used.
+ /// </summary>
+ [DefaultValue(DefaultSocketBufferSize)]
+ public int SocketReceiveBufferSize { get; set; }
+
+ /// <summary>
+ /// Gets or sets the value for <c>TCP_NODELAY</c> socket option. Each
+ /// socket will be opened using provided value.
+ /// <para />
+ /// Setting this option to <c>true</c> disables Nagle's algorithm
+ /// for socket decreasing latency and delivery time for small messages.
+ /// <para />
+ /// For systems that work under heavy network load it is advisable to set this value to <c>false</c>.
+ /// </summary>
+ [DefaultValue(DefaultTcpNoDelay)]
+ public bool TcpNoDelay { get; set; }
+
+ /// <summary>
+ /// Gets or sets the maximum open cursors per connection.
+ /// </summary>
+ [DefaultValue(DefaultMaxOpenCursorsPerConnection)]
+ public int MaxOpenCursorsPerConnection { get; set; }
+
+ /// <summary>
+ /// Gets or sets the size of the thread pool.
+ /// </summary>
+ public int ThreadPoolSize { get; set; }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
index 8fab8a4..40bab15 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
@@ -34,6 +34,7 @@ namespace Apache.Ignite.Core
using Apache.Ignite.Core.Communication;
using Apache.Ignite.Core.Communication.Tcp;
using Apache.Ignite.Core.Compute;
+ using Apache.Ignite.Core.Configuration;
using Apache.Ignite.Core.DataStructures.Configuration;
using Apache.Ignite.Core.Deployment;
using Apache.Ignite.Core.Discovery;
@@ -103,6 +104,16 @@ namespace Apache.Ignite.Core
/// </summary>
public static readonly TimeSpan DefaultClientFailureDetectionTimeout = TimeSpan.FromSeconds(30);
+ /// <summary>
+ /// Default thread pool size.
+ /// </summary>
+ public static readonly int DefaultThreadPoolSize = Math.Max(8, Environment.ProcessorCount);
+
+ /// <summary>
+ /// Default management thread pool size.
+ /// </summary>
+ public const int DefaultManagementThreadPoolSize = 4;
+
/** */
private TimeSpan? _metricsExpireTime;
@@ -139,6 +150,33 @@ namespace Apache.Ignite.Core
/** */
private TimeSpan? _clientFailureDetectionTimeout;
+ /** */
+ private int? _publicThreadPoolSize;
+
+ /** */
+ private int? _stripedThreadPoolSize;
+
+ /** */
+ private int? _serviceThreadPoolSize;
+
+ /** */
+ private int? _systemThreadPoolSize;
+
+ /** */
+ private int? _asyncCallbackThreadPoolSize;
+
+ /** */
+ private int? _managementThreadPoolSize;
+
+ /** */
+ private int? _dataStreamerThreadPoolSize;
+
+ /** */
+ private int? _utilityCacheThreadPoolSize;
+
+ /** */
+ private int? _queryThreadPoolSize;
+
/// <summary>
/// Default network retry count.
/// </summary>
@@ -222,6 +260,17 @@ namespace Apache.Ignite.Core
writer.WriteTimeSpanAsLongNullable(_failureDetectionTimeout);
writer.WriteTimeSpanAsLongNullable(_clientFailureDetectionTimeout);
+ // Thread pools
+ writer.WriteIntNullable(_publicThreadPoolSize);
+ writer.WriteIntNullable(_stripedThreadPoolSize);
+ writer.WriteIntNullable(_serviceThreadPoolSize);
+ writer.WriteIntNullable(_systemThreadPoolSize);
+ writer.WriteIntNullable(_asyncCallbackThreadPoolSize);
+ writer.WriteIntNullable(_managementThreadPoolSize);
+ writer.WriteIntNullable(_dataStreamerThreadPoolSize);
+ writer.WriteIntNullable(_utilityCacheThreadPoolSize);
+ writer.WriteIntNullable(_queryThreadPoolSize);
+
// Cache config
var caches = CacheConfiguration;
@@ -371,6 +420,17 @@ namespace Apache.Ignite.Core
writer.WriteBoolean(false);
}
+ // SQL
+ if (SqlConnectorConfiguration != null)
+ {
+ writer.WriteBoolean(true);
+ SqlConnectorConfiguration.Write(writer);
+ }
+ else
+ {
+ writer.WriteBoolean(false);
+ }
+
// Plugins (should be last)
if (PluginConfigurations != null)
{
@@ -438,6 +498,17 @@ namespace Apache.Ignite.Core
_failureDetectionTimeout = r.ReadTimeSpanNullable();
_clientFailureDetectionTimeout = r.ReadTimeSpanNullable();
+ // Thread pools
+ _publicThreadPoolSize = r.ReadIntNullable();
+ _stripedThreadPoolSize = r.ReadIntNullable();
+ _serviceThreadPoolSize = r.ReadIntNullable();
+ _systemThreadPoolSize = r.ReadIntNullable();
+ _asyncCallbackThreadPoolSize = r.ReadIntNullable();
+ _managementThreadPoolSize = r.ReadIntNullable();
+ _dataStreamerThreadPoolSize = r.ReadIntNullable();
+ _utilityCacheThreadPoolSize = r.ReadIntNullable();
+ _queryThreadPoolSize = r.ReadIntNullable();
+
// Cache config
var cacheCfgCount = r.ReadInt();
CacheConfiguration = new List<CacheConfiguration>(cacheCfgCount);
@@ -509,6 +580,12 @@ namespace Apache.Ignite.Core
{
MemoryConfiguration = new MemoryConfiguration(r);
}
+
+ // SQL
+ if (r.ReadBoolean())
+ {
+ SqlConnectorConfiguration = new SqlConnectorConfiguration(r);
+ }
}
/// <summary>
@@ -995,5 +1072,92 @@ namespace Apache.Ignite.Core
/// Peer loading is enabled for <see cref="ICompute"/> functionality.
/// </summary>
public PeerAssemblyLoadingMode PeerAssemblyLoadingMode { get; set; }
+
+ /// <summary>
+ /// Gets or sets the size of the public thread pool, which processes compute jobs and user messages.
+ /// </summary>
+ public int PublicThreadPoolSize
+ {
+ get { return _publicThreadPoolSize ?? DefaultThreadPoolSize; }
+ set { _publicThreadPoolSize = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the striped thread pool, which processes cache requests.
+ /// </summary>
+ public int StripedThreadPoolSize
+ {
+ get { return _stripedThreadPoolSize ?? DefaultThreadPoolSize; }
+ set { _stripedThreadPoolSize = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the service thread pool, which processes Ignite services.
+ /// </summary>
+ public int ServiceThreadPoolSize
+ {
+ get { return _serviceThreadPoolSize ?? DefaultThreadPoolSize; }
+ set { _serviceThreadPoolSize = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the system thread pool, which processes internal system messages.
+ /// </summary>
+ public int SystemThreadPoolSize
+ {
+ get { return _systemThreadPoolSize ?? DefaultThreadPoolSize; }
+ set { _systemThreadPoolSize = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the asynchronous callback thread pool.
+ /// </summary>
+ public int AsyncCallbackThreadPoolSize
+ {
+ get { return _asyncCallbackThreadPoolSize ?? DefaultThreadPoolSize; }
+ set { _asyncCallbackThreadPoolSize = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the management thread pool, which processes internal Ignite jobs.
+ /// </summary>
+ [DefaultValue(DefaultManagementThreadPoolSize)]
+ public int ManagementThreadPoolSize
+ {
+ get { return _managementThreadPoolSize ?? DefaultManagementThreadPoolSize; }
+ set { _managementThreadPoolSize = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the data streamer thread pool.
+ /// </summary>
+ public int DataStreamerThreadPoolSize
+ {
+ get { return _dataStreamerThreadPoolSize ?? DefaultThreadPoolSize; }
+ set { _dataStreamerThreadPoolSize = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the utility cache thread pool.
+ /// </summary>
+ public int UtilityCacheThreadPoolSize
+ {
+ get { return _utilityCacheThreadPoolSize ?? DefaultThreadPoolSize; }
+ set { _utilityCacheThreadPoolSize = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the query thread pool.
+ /// </summary>
+ public int QueryThreadPoolSize
+ {
+ get { return _queryThreadPoolSize ?? DefaultThreadPoolSize; }
+ set { _queryThreadPoolSize = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the SQL connector configuration (for JDBC and ODBC).
+ /// </summary>
+ public SqlConnectorConfiguration SqlConnectorConfiguration { get; set; }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/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 fae4ebb..0cd58ed 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
@@ -1247,6 +1247,53 @@
</xs:annotation>
</xs:attribute>
</xs:complexType>
+ </xs:element>
+ <xs:element name="sqlConnectorConfiguration" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>SQL connector configuration (JDBC and ODBC).</xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:attribute name="port" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Connector port.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="host" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Connector host.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="portRange" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Connector port range.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="socketSendBufferSize" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Size of the socket send buffer.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="socketReceiveBufferSize" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Size of the socket receive buffer.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="tcpNoDelay" type="xs:boolean">
+ <xs:annotation>
+ <xs:documentation>TCP_NODELAY socket option.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="maxOpenCursorsPerConnection" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Maximum open cursors per connection.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="threadPoolSize" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>SQL connector thread pool size.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
</xs:element>
<xs:element name="pluginConfigurations" minOccurs="0">
<xs:annotation>
@@ -1433,6 +1480,51 @@
<xs:documentation>Indicates whether user assemblies should be loaded on remote nodes automatically.</xs:documentation>
</xs:annotation>
</xs:attribute>
+ <xs:attribute name="publicThreadPoolSize" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Size of the public thread pool, which processes compute jobs and user messages.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="stripedThreadPoolSize" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Size of the striped thread pool.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="serviceThreadPoolSize" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Size of the service thread pool.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="systemThreadPoolSize" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Size of the system thread pool.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="asyncCallbackThreadPoolSize" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Size of the async callback thread pool.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="managementThreadPoolSize" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Size of the management thread pool.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="dataStreamerThreadPoolSize" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Size of the data streamer thread pool.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="utilityCacheThreadPoolSize" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Size of the utility cache thread pool.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="queryThreadPoolSize" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Size of the query thread pool.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs
index 6c5d620..775add4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs
@@ -529,12 +529,22 @@ namespace Apache.Ignite.Core.Impl.Common
var attr = property.GetCustomAttributes(true).OfType<DefaultValueAttribute>().FirstOrDefault();
if (attr != null)
+ {
return attr.Value;
+ }
+
+ var declType = property.DeclaringType;
+ if (declType != null && !declType.IsAbstract && declType.GetConstructor(new Type[0]) != null)
+ {
+ return property.GetValue(Activator.CreateInstance(declType), null);
+ }
var propertyType = property.PropertyType;
if (propertyType.IsValueType)
+ {
return Activator.CreateInstance(propertyType);
+ }
return null;
}
[33/42] ignite git commit: IGNITE-5303 Added support for multiple
RDBMS.
Posted by ag...@apache.org.
IGNITE-5303 Added support for multiple RDBMS.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0fb6d2f8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0fb6d2f8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0fb6d2f8
Branch: refs/heads/ignite-5267-merge-ea
Commit: 0fb6d2f8d2ac2d26be48dc5513fb6702ae680918
Parents: 4479f21
Author: vsisko <vs...@gridgain.com>
Authored: Fri Jun 9 15:05:34 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Jun 9 15:05:34 2017 +0700
----------------------------------------------------------------------
.../frontend/controllers/domains-controller.js | 123 ++++++++++---------
.../ignite/console/agent/db/DbSchema.java | 60 +++++++++
.../agent/handlers/DatabaseListener.java | 18 ++-
3 files changed, 140 insertions(+), 61 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0fb6d2f8/modules/web-console/frontend/controllers/domains-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/controllers/domains-controller.js b/modules/web-console/frontend/controllers/domains-controller.js
index b8fae5d..4d59264 100644
--- a/modules/web-console/frontend/controllers/domains-controller.js
+++ b/modules/web-console/frontend/controllers/domains-controller.js
@@ -433,6 +433,62 @@ export default ['$rootScope', '$scope', '$http', '$state', '$filter', '$timeout'
};
}
+ function isValidJavaIdentifier(s) {
+ return JavaTypes.validIdentifier(s) && !JavaTypes.isKeyword(s) && JavaTypes.nonBuiltInClass(s) &&
+ SqlTypes.validIdentifier(s) && !SqlTypes.isKeyword(s);
+ }
+
+ function toJavaIdentifier(name) {
+ if (_.isEmpty(name))
+ return 'DB';
+
+ const len = name.length;
+
+ let ident = '';
+
+ let capitalizeNext = true;
+
+ for (let i = 0; i < len; i++) {
+ const ch = name.charAt(i);
+
+ if (ch === ' ' || ch === '_')
+ capitalizeNext = true;
+ else if (ch === '-') {
+ ident += '_';
+ capitalizeNext = true;
+ }
+ else if (capitalizeNext) {
+ ident += ch.toLocaleUpperCase();
+
+ capitalizeNext = false;
+ }
+ else
+ ident += ch.toLocaleLowerCase();
+ }
+
+ return ident;
+ }
+
+ function toJavaClassName(name) {
+ const clazzName = toJavaIdentifier(name);
+
+ if (isValidJavaIdentifier(clazzName))
+ return clazzName;
+
+ return 'Class' + clazzName;
+ }
+
+ function toJavaFieldName(dbName) {
+ const javaName = toJavaIdentifier(dbName);
+
+ const fieldName = javaName.charAt(0).toLocaleLowerCase() + javaName.slice(1);
+
+ if (isValidJavaIdentifier(fieldName))
+ return fieldName;
+
+ return 'field' + javaName;
+ }
+
/**
* Show import domain models modal.
*/
@@ -544,17 +600,14 @@ export default ['$rootScope', '$scope', '$http', '$state', '$filter', '$timeout'
return agentMgr.schemas(preset);
})
- .then(function(schemas) {
- $scope.importDomain.schemas = _.map(schemas, function(schema) {
- return {use: true, name: schema};
- });
-
+ .then((schemaInfo) => {
$scope.importDomain.action = 'schemas';
+ $scope.importDomain.info = INFO_SELECT_SCHEMAS;
+ $scope.importDomain.catalog = toJavaIdentifier(schemaInfo.catalog);
+ $scope.importDomain.schemas = _.map(schemaInfo.schemas, (schema) => ({use: true, name: schema}));
if ($scope.importDomain.schemas.length === 0)
$scope.importDomainNext();
-
- $scope.importDomain.info = INFO_SELECT_SCHEMAS;
})
.catch(Messages.showError)
.then(() => Loading.finish('importDomainFromDb'));
@@ -595,55 +648,6 @@ export default ['$rootScope', '$scope', '$http', '$state', '$filter', '$timeout'
return 'Associate with ' + cacheName;
};
- function isValidJavaIdentifier(s) {
- return JavaTypes.validIdentifier(s) && !JavaTypes.isKeyword(s) && JavaTypes.nonBuiltInClass(s) &&
- SqlTypes.validIdentifier(s) && !SqlTypes.isKeyword(s);
- }
-
- function toJavaIdentifier(name) {
- const len = name.length;
-
- let ident = '';
-
- let capitalizeNext = true;
-
- for (let i = 0; i < len; i++) {
- const ch = name.charAt(i);
-
- if (ch === ' ' || ch === '_')
- capitalizeNext = true;
- else if (capitalizeNext) {
- ident += ch.toLocaleUpperCase();
-
- capitalizeNext = false;
- }
- else
- ident += ch.toLocaleLowerCase();
- }
-
- return ident;
- }
-
- function toJavaClassName(name) {
- const clazzName = toJavaIdentifier(name);
-
- if (isValidJavaIdentifier(clazzName))
- return clazzName;
-
- return 'Class' + clazzName;
- }
-
- function toJavaFieldName(dbName) {
- const javaName = toJavaIdentifier(dbName);
-
- const fieldName = javaName.charAt(0).toLocaleLowerCase() + javaName.slice(1);
-
- if (isValidJavaIdentifier(fieldName))
- return fieldName;
-
- return 'field' + javaName;
- }
-
function _fillCommonCachesOrTemplates(item) {
return function(action) {
if (item.cachesOrTemplates)
@@ -968,9 +972,14 @@ export default ['$rootScope', '$scope', '$http', '$state', '$filter', '$timeout'
if (!newCache.cacheStoreFactory || newCache.cacheStoreFactory.kind !== 'CacheJdbcPojoStoreFactory') {
const dialect = $scope.importDomain.demo ? 'H2' : $scope.selectedPreset.db;
+ const catalog = $scope.importDomain.catalog;
+
newCache.cacheStoreFactory = {
kind: 'CacheJdbcPojoStoreFactory',
- CacheJdbcPojoStoreFactory: {dataSourceBean: 'ds' + dialect, dialect},
+ CacheJdbcPojoStoreFactory: {
+ dataSourceBean: 'ds' + dialect + '_' + catalog,
+ dialect
+ },
CacheJdbcBlobStoreFactory: { connectVia: 'DataSource' }
};
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0fb6d2f8/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbSchema.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbSchema.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbSchema.java
new file mode 100644
index 0000000..1c89ceb
--- /dev/null
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbSchema.java
@@ -0,0 +1,60 @@
+/*
+ * 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.console.agent.db;
+
+import java.util.Collection;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+/**
+ * Database schema names with catalog name.
+ */
+public class DbSchema {
+ /** Catalog name. */
+ private final String catalog;
+
+ /** Schema names. */
+ private final Collection<String> schemas;
+
+ /**
+ * @param catalog Catalog name.
+ * @param schemas Schema names.
+ */
+ public DbSchema(String catalog, Collection<String> schemas) {
+ this.catalog = catalog;
+ this.schemas = schemas;
+ }
+
+ /**
+ * @return Catalog name.
+ */
+ public String getCatalog() {
+ return catalog;
+ }
+
+ /**
+ * @return Schema names.
+ */
+ public Collection<String> getSchemas() {
+ return schemas;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(DbSchema.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0fb6d2f8/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DatabaseListener.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DatabaseListener.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DatabaseListener.java
index d1394c9..9da118d 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DatabaseListener.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DatabaseListener.java
@@ -33,9 +33,10 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.apache.ignite.console.agent.AgentConfiguration;
-import org.apache.ignite.console.demo.AgentMetadataDemo;
import org.apache.ignite.console.agent.db.DbMetadataReader;
+import org.apache.ignite.console.agent.db.DbSchema;
import org.apache.ignite.console.agent.db.DbTable;
+import org.apache.ignite.console.demo.AgentMetadataDemo;
import org.apache.log4j.Logger;
import static java.nio.charset.StandardCharsets.UTF_8;
@@ -211,19 +212,28 @@ public class DatabaseListener {
* @return Collection of schema names.
* @throws SQLException If failed to collect schemas.
*/
- protected Collection<String> schemas(String jdbcDriverJarPath, String jdbcDriverCls, String jdbcUrl,
+ protected DbSchema schemas(String jdbcDriverJarPath, String jdbcDriverCls, String jdbcUrl,
Properties jdbcInfo) throws SQLException {
if (log.isDebugEnabled())
log.debug("Start collecting database schemas [drvJar=" + jdbcDriverJarPath +
", drvCls=" + jdbcDriverCls + ", jdbcUrl=" + jdbcUrl + "]");
try (Connection conn = connect(jdbcDriverJarPath, jdbcDriverCls, jdbcUrl, jdbcInfo)) {
+ String catalog = conn.getCatalog();
+
+ if (catalog == null) {
+ String[] parts = jdbcUrl.split("[/:=]");
+
+ catalog = parts.length > 0 ? parts[parts.length - 1] : "NONE";
+ }
+
Collection<String> schemas = dbMetaReader.schemas(conn);
if (log.isDebugEnabled())
- log.debug("Finished collection of schemas [jdbcUrl=" + jdbcUrl + ", count=" + schemas.size() + "]");
+ log.debug("Finished collection of schemas [jdbcUrl=" + jdbcUrl + ", catalog=" + catalog +
+ ", count=" + schemas.size() + "]");
- return schemas;
+ return new DbSchema(catalog, schemas);
}
catch (Throwable e) {
log.error("Failed to collect schemas", e);
[23/42] ignite git commit: Merge remote-tracking branch
'origin/master'
Posted by ag...@apache.org.
Merge remote-tracking branch 'origin/master'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/612f5ad5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/612f5ad5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/612f5ad5
Branch: refs/heads/ignite-5267-merge-ea
Commit: 612f5ad5ea6deaf7addd39ebfc6956adcfb9a545
Parents: c73aad7 d5ecf0a
Author: devozerov <vo...@gridgain.com>
Authored: Thu Jun 8 13:58:53 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Jun 8 13:58:53 2017 +0300
----------------------------------------------------------------------
.../utils/PlatformConfigurationUtils.java | 6 ++++++
.../Cache/CacheConfigurationTest.cs | 8 ++++++++
.../IgniteConfigurationSerializerTest.cs | 5 +++--
.../IgniteConfigurationTest.cs | 4 ++++
.../Cache/Configuration/CacheConfiguration.cs | 9 +++++++++
.../Apache.Ignite.Core/IgniteConfiguration.cs | 20 ++++++++++++++++++++
.../IgniteConfigurationSection.xsd | 7 +++++++
7 files changed, 57 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
[11/42] ignite git commit: IGNITE-5430: CREATE TABLE: cache name is
now masked as follows: "SQL_[schemaName]_[cacheName]". This closes #2101.
Posted by ag...@apache.org.
IGNITE-5430: CREATE TABLE: cache name is now masked as follows: "SQL_[schemaName]_[cacheName]". This closes #2101.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8555e21e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8555e21e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8555e21e
Branch: refs/heads/ignite-5267-merge-ea
Commit: 8555e21e9063724e6f0a35862549c0b251d4d27b
Parents: 86d0049
Author: Alexander Paschenko <al...@gmail.com>
Authored: Wed Jun 7 14:16:47 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Jun 7 14:16:47 2017 +0300
----------------------------------------------------------------------
.../processors/query/GridQueryProcessor.java | 2 +-
.../internal/processors/query/QueryUtils.java | 32 +++++++++++++++++
.../query/h2/ddl/DdlStatementsProcessor.java | 23 +++++-------
.../cache/index/H2DynamicTableSelfTest.java | 37 +++++++++++++-------
4 files changed, 65 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/8555e21e/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 edf8dc1..48c7229 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
@@ -1305,7 +1305,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
throw new SchemaOperationException("Template cache already contains query entities which it should not: " +
templateName);
- ccfg.setName(entity.getTableName());
+ ccfg.setName(QueryUtils.createTableCacheName(schemaName, entity.getTableName()));
if (atomicityMode != null)
ccfg.setAtomicityMode(atomicityMode);
http://git-wip-us.apache.org/repos/asf/ignite/blob/8555e21e/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 fd498ad..fbd9afa 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
@@ -1112,6 +1112,38 @@ public class QueryUtils {
}
/**
+ * Construct cache name for table.
+ *
+ * @param schemaName Schema name.
+ * @param tblName Table name.
+ * @return Cache name.
+ */
+ public static String createTableCacheName(String schemaName, String tblName) {
+ return "SQL_" + schemaName + "_" + tblName;
+ }
+
+ /**
+ * Construct value type name for table.
+ *
+ * @param schemaName Schema name.
+ * @param tblName Table name.
+ * @return Value type name.
+ */
+ public static String createTableValueTypeName(String schemaName, String tblName) {
+ return createTableCacheName(schemaName, tblName) + "_" + UUID.randomUUID().toString().replace("-", "_");
+ }
+
+ /**
+ * Construct key type name for table.
+ *
+ * @param valTypeName Value type name.
+ * @return Key type name.
+ */
+ public static String createTableKeyTypeName(String valTypeName) {
+ return valTypeName + "_KEY";
+ }
+
+ /**
* Private constructor.
*/
private QueryUtils() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/8555e21e/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
index 251ee9f..5efc5c9 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
@@ -22,7 +22,6 @@ import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import java.util.UUID;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.QueryEntity;
@@ -191,6 +190,12 @@ public class DdlStatementsProcessor {
GridH2Table tbl = idx.dataTable(cmd.schemaName(), cmd.tableName());
+ if (tbl == null && cmd.ifExists()) {
+ ctx.cache().createMissingQueryCaches();
+
+ tbl = idx.dataTable(cmd.schemaName(), cmd.tableName());
+ }
+
if (tbl == null) {
if (!cmd.ifExists())
throw new SchemaOperationException(SchemaOperationException.CODE_TABLE_NOT_FOUND,
@@ -290,8 +295,8 @@ public class DdlStatementsProcessor {
res.addQueryField(e.getKey(), DataType.getTypeClassName(col.getType()), null);
}
- String valTypeName = valueType(createTbl.schemaName(), createTbl.tableName());
- String keyTypeName = valTypeName + "_Key";
+ String valTypeName = QueryUtils.createTableValueTypeName(createTbl.schemaName(), createTbl.tableName());
+ String keyTypeName = QueryUtils.createTableKeyTypeName(valTypeName);
res.setValueType(valTypeName);
res.setKeyType(keyTypeName);
@@ -302,18 +307,6 @@ public class DdlStatementsProcessor {
}
/**
- * Construct value type name for table.
- *
- * @param schemaName Schema name.
- * @param tblName Table name.
- * @return Value type name.
- */
- private static String valueType(String schemaName, String tblName) {
- return "sql_" + schemaName + "_" + tblName + "_" + UUID.randomUUID().toString().replace("-", "_");
- }
-
-
- /**
* @param cmd Statement.
* @return Whether {@code cmd} is a DDL statement we're able to handle.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/8555e21e/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
index efb6cc8..699fdad 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
@@ -91,11 +91,8 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
- if (client().cache("Person") != null)
- executeDdl("DROP TABLE IF EXISTS PUBLIC.\"Person\"");
-
-
- executeDdl("DROP TABLE IF EXISTS PUBLIC.\"City\"");
+ executeDdl("DROP TABLE IF EXISTS PUBLIC.\"Person\"");
+ executeDdl("DROP TABLE IF EXISTS PUBLIC.\"City\"");
super.afterTest();
}
@@ -164,12 +161,14 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
" \"name\" varchar, \"surname\" varchar, \"age\" int, PRIMARY KEY (\"id\", \"city\")) WITH " +
(F.isEmpty(tplCacheName) ? "" : "\"template=" + tplCacheName + "\",") + "\"backups=10,atomicity=atomic\"");
+ String cacheName = cacheName("Person");
+
for (int i = 0; i < 4; i++) {
IgniteEx node = grid(i);
- assertNotNull(node.cache("Person"));
+ assertNotNull(node.cache(cacheName));
- DynamicCacheDescriptor cacheDesc = node.context().cache().cacheDescriptor("Person");
+ DynamicCacheDescriptor cacheDesc = node.context().cache().cacheDescriptor(cacheName);
assertNotNull(cacheDesc);
@@ -185,7 +184,7 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
if (mode != null)
assertEquals(mode, cacheDesc.cacheConfiguration().getCacheMode());
- QueryTypeDescriptorImpl desc = typeExisting(node, "Person", "Person");
+ QueryTypeDescriptorImpl desc = typeExisting(node, cacheName, "Person");
assertEquals(Object.class, desc.keyClass());
assertEquals(Object.class, desc.valueClass());
@@ -193,7 +192,7 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
assertTrue(desc.valueTypeName(), desc.valueTypeName().contains("Person"));
assertTrue(desc.keyTypeName(), desc.keyTypeName().startsWith(desc.valueTypeName()));
- assertTrue(desc.keyTypeName(), desc.keyTypeName().endsWith("Key"));
+ assertTrue(desc.keyTypeName(), desc.keyTypeName().endsWith("KEY"));
assertEquals(
F.asList("id", "city", "name", "surname", "age"),
@@ -352,12 +351,12 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
GridTestUtils.assertThrows(null, new Callable<Object>() {
@Override public Object call() throws Exception {
- client().destroyCache("Person");
+ client().destroyCache(cacheName("Person"));
return null;
}
}, CacheException.class,
- "Only cache created with cache API may be removed with direct call to destroyCache [cacheName=Person]");
+ "Only cache created with cache API may be removed with direct call to destroyCache");
}
/**
@@ -372,7 +371,9 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
GridTestUtils.assertThrows(null, new Callable<Object>() {
@Override public Object call() throws Exception {
- Ignition.start(clientConfiguration(5).setCacheConfiguration(new CacheConfiguration("Person")));
+ String cacheName = cacheName("Person");
+
+ Ignition.start(clientConfiguration(5).setCacheConfiguration(new CacheConfiguration(cacheName)));
return null;
}
@@ -397,7 +398,7 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
e.setKeyFields(Collections.singleton("name"));
e.setFields(new LinkedHashMap<>(Collections.singletonMap("name", String.class.getName())));
e.setIndexes(Collections.singleton(new QueryIndex("name").setName("idx")));
- e.setValueType("CityKey");
+ e.setKeyType("CityKey");
e.setValueType("City");
queryProcessor(client()).dynamicTableCreate("PUBLIC", e, CacheMode.PARTITIONED.name(),
@@ -621,4 +622,14 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
.setSqlSchema(QueryUtils.DFLT_SCHEMA)
.setNodeFilter(F.not(new DynamicIndexAbstractSelfTest.NodeFilter()));
}
+
+ /**
+ * Get cache name.
+ *
+ * @param tblName Table name.
+ * @return Cache name.
+ */
+ private static String cacheName(String tblName) {
+ return QueryUtils.createTableCacheName("PUBLIC", tblName);
+ }
}
[15/42] ignite git commit: master - fixes splitter push down
Posted by ag...@apache.org.
master - fixes splitter push down
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8371e3ad
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8371e3ad
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8371e3ad
Branch: refs/heads/ignite-5267-merge-ea
Commit: 8371e3adf453803b2eefe228adebaac3b42b3c0a
Parents: 86d0049
Author: Sergi Vladykin <se...@gmail.com>
Authored: Wed Jun 7 18:20:24 2017 +0300
Committer: Sergi Vladykin <se...@gmail.com>
Committed: Wed Jun 7 18:20:24 2017 +0300
----------------------------------------------------------------------
.../query/h2/sql/GridSqlQuerySplitter.java | 69 +++++++++++++++++++-
.../query/IgniteSqlSplitterSelfTest.java | 47 +++++++++++++
2 files changed, 114 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/8371e3ad/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
index 1b9619e..e87a032 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
@@ -43,8 +43,10 @@ import org.apache.ignite.internal.processors.query.h2.H2Utils;
import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2RowDescriptor;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2Table;
+import org.apache.ignite.internal.util.lang.GridTreePrinter;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.h2.command.Prepared;
import org.h2.command.dml.Query;
@@ -187,6 +189,8 @@ public class GridSqlQuerySplitter {
String originalSql = qry.getSQL();
+// debug("ORIGINAL", originalSql);
+
final boolean explain = qry.explain();
qry.explain(false);
@@ -197,6 +201,8 @@ public class GridSqlQuerySplitter {
// Also it will collect all tables and schemas from the query.
splitter.normalizeQuery(qry);
+// debug("NORMALIZED", qry.getSQL());
+
Connection conn = stmt.getConnection();
// Here we will have correct normalized AST with optimized join order.
@@ -270,13 +276,19 @@ public class GridSqlQuerySplitter {
// Setup the needed information for split.
analyzeQueryModel(qrym);
+// debug("ANALYZED", printQueryModel(qrym));
+
// If we have child queries to split, then go hard way.
if (qrym.needSplitChild) {
// All the siblings to selects we are going to split must be also wrapped into subqueries.
pushDownQueryModel(qrym);
+// debug("PUSHED_DOWN", printQueryModel(qrym));
+
// Need to make all the joined subqueries to be ordered by join conditions.
setupMergeJoinSorting(qrym);
+
+// debug("SETUP_MERGE_JOIN", printQueryModel(qrym));
}
else if (!qrym.needSplit) // Just split the top level query.
setNeedSplit(qrym);
@@ -317,6 +329,20 @@ public class GridSqlQuerySplitter {
}
/**
+ * @param label Label.
+ * @param info Info.
+ * @deprecated Must be commented out.
+ */
+ @Deprecated
+ @SuppressWarnings("unused")
+ private static void debug(String label, String info) {
+ X.println();
+ X.println(" ==" + label + "== ");
+ X.println(info);
+ X.println(" ======== ");
+ }
+
+ /**
* @param qrym Query model for the SELECT.
*/
private void pushDownQueryModelSelect(QueryModel qrym) {
@@ -546,6 +572,8 @@ public class GridSqlQuerySplitter {
// and mark that subquery as splittable.
doPushDownQueryModelRange(qrym, begin, end, true);
}
+
+// debug("PUSH_DOWN_PARTIAL", printQueryModel(qrym));
}
/**
@@ -645,6 +673,9 @@ public class GridSqlQuerySplitter {
int end,
GridSqlAlias wrapAlias
) {
+ // Get the original SELECT.
+ GridSqlSelect select = qrym.ast();
+
GridSqlSelect wrapSelect = GridSqlAlias.<GridSqlSubquery>unwrap(wrapAlias).subquery();
final int last = qrym.size() - 1;
@@ -716,6 +747,7 @@ public class GridSqlQuerySplitter {
wrapSelect.from(endJoin);
afterBeginJoin.leftTable(beginJoin.rightTable());
beginJoin.rightTable(wrapAlias);
+ select.from(beginJoin);
}
else if (begin == 0) {
// From the first model to some middle one.
@@ -780,8 +812,6 @@ public class GridSqlQuerySplitter {
beginJoin.rightTable(wrapAlias);
}
- // Get the original SELECT.
- GridSqlSelect select = qrym.ast();
GridSqlAst from = select.from();
// Push down related ON conditions for all the related joins.
@@ -2177,6 +2207,41 @@ public class GridSqlQuerySplitter {
}
/**
+ * @param root Root model.
+ * @return Tree as a string.
+ */
+ @SuppressWarnings("unused")
+ private String printQueryModel(QueryModel root) {
+ GridTreePrinter<QueryModel> mp = new GridTreePrinter<QueryModel>() {
+ /** {@inheritDoc} */
+ @Override protected List<QueryModel> getChildren(QueryModel m) {
+ return m;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected String formatTreeNode(QueryModel m) {
+ return "[ " +(m.uniqueAlias == null ? "+" : m.uniqueAlias.alias()) +
+ " -> " + m.type +
+ " ns:" + m.needSplit + " nsch:" + m.needSplitChild +
+ " ast: " + ast(m) +" ]";
+ }
+
+ private String ast(QueryModel m) {
+ if (m.prnt == null)
+ return "-+-+-";
+
+ String ast = m.ast().getSQL().replace('\n', ' ');
+
+ int maxLen = 2000;
+
+ return ast.length() <= maxLen ? ast : ast.substring(0, maxLen);
+ }
+ };
+
+ return mp.print(root);
+ }
+
+ /**
* Ensures all given queries have non-empty derived partitions and merges them.
*
* @param queries Collection of queries.
http://git-wip-us.apache.org/repos/asf/ignite/blob/8371e3ad/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
index d8f71a3..8b743bf 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
@@ -50,6 +50,7 @@ import org.apache.ignite.internal.processors.query.h2.twostep.GridMergeIndex;
import org.apache.ignite.internal.util.GridRandom;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.X;
+import org.apache.ignite.internal.util.typedef.internal.SB;
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;
@@ -164,6 +165,52 @@ public class IgniteSqlSplitterSelfTest extends GridCommonAbstractTest {
/**
*/
+ public void testPushDown() {
+ IgniteCache<Integer, Person> c = ignite(0).getOrCreateCache(cacheConfig("ps", true,
+ Integer.class, Person.class));
+
+ try {
+ String subqry = "(select max(p.id) as id, p.depId from Person p group by p.depId)";
+
+ for (int i = 0; i < 5; i++) {
+ SB qry = new SB("select * from ");
+
+ for (int j = 0; j < 5; j++) {
+ if (j != 0)
+ qry.a(", ");
+
+ if (j == i)
+ qry.a(subqry);
+ else
+ qry.a("Person");
+
+ qry.a(" p").a(j);
+ }
+
+ qry.a(" where");
+
+ for (int j = 1; j < 5; j++) {
+ if (j != 1)
+ qry.a(" and");
+
+ qry.a(" p").a(j - 1).a(".id").a(" = ").a("p").a(j).a(".depId");
+ }
+
+ c.query(new SqlFieldsQuery(qry.toString())
+ .setEnforceJoinOrder(true)).getAll();
+
+ X.println("\nPlan:\n" +
+ c.query(new SqlFieldsQuery("explain " + qry.toString())
+ .setEnforceJoinOrder(true)).getAll());
+ }
+ }
+ finally {
+ c.destroy();
+ }
+ }
+
+ /**
+ */
public void testReplicatedTablesUsingPartitionedCache() {
doTestReplicatedTablesUsingPartitionedCache(1, false, false);
}
[42/42] ignite git commit: Merge from ignite-5267
Posted by ag...@apache.org.
Merge from ignite-5267
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ffe1a010
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ffe1a010
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ffe1a010
Branch: refs/heads/ignite-5267-merge-ea
Commit: ffe1a010c9452954aabd091b25e3dc47128acdcd
Parents: fbb51b0
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Fri Jun 9 17:20:07 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Jun 9 17:20:07 2017 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheAbstractFullApiSelfTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ffe1a010/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index 551d565..bf27e26 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -925,7 +925,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
final Set<String> c = new HashSet<>();
c.add("key1");
-// c.add(null);
+ c.add(null);
GridTestUtils.assertThrows(log, new Callable<Void>() {
@Override public Void call() throws Exception {
[40/42] ignite git commit: Merge branch master into ignite-5267
Posted by ag...@apache.org.
Merge branch master into ignite-5267
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b6c73617
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b6c73617
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b6c73617
Branch: refs/heads/ignite-5267-merge-ea
Commit: b6c736172006814eb848bc5abc9dd515bcfec8fb
Parents: 8755142 72e2f88
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Fri Jun 9 16:43:48 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Jun 9 16:43:48 2017 +0300
----------------------------------------------------------------------
config/ignite-log4j.xml | 6 +-
config/ignite-log4j2.xml | 6 +-
.../ClientTcpUnreachableMultiNodeSelfTest.java | 6 +-
.../jdbc/suite/IgniteJdbcDriverTestSuite.java | 2 +
.../thin/JdbcThinAutoCloseServerCursorTest.java | 359 +++++++++++++++++++
.../jdbc/thin/JdbcThinConnectionSelfTest.java | 36 ++
modules/clients/src/test/resources/log4j.xml | 2 +-
.../apache/ignite/IgniteSystemProperties.java | 3 +
.../configuration/CacheConfiguration.java | 24 ++
.../configuration/IgniteConfiguration.java | 6 +
.../SqlConnectorConfiguration.java | 2 +-
.../internal/binary/BinaryClassDescriptor.java | 1 -
.../ignite/internal/binary/BinaryContext.java | 1 -
.../ignite/internal/binary/BinaryFieldEx.java | 5 +
.../ignite/internal/binary/BinaryFieldImpl.java | 5 +
.../ignite/internal/client/GridClientNode.java | 9 +-
.../client/impl/GridClientNodeImpl.java | 22 +-
.../connection/GridClientNioTcpConnection.java | 3 +-
.../internal/jdbc/thin/JdbcThinConnection.java | 4 +-
.../internal/jdbc/thin/JdbcThinResultSet.java | 18 +-
.../internal/jdbc/thin/JdbcThinStatement.java | 2 +-
.../internal/jdbc/thin/JdbcThinTcpIo.java | 17 +-
.../internal/jdbc/thin/JdbcThinUtils.java | 7 +-
.../discovery/GridDiscoveryManager.java | 32 +-
.../processors/cache/ClusterCachesInfo.java | 30 +-
.../processors/cache/GridCacheAttributes.java | 17 +-
.../GridCachePartitionExchangeManager.java | 129 +++----
.../GridDhtPartitionsExchangeFuture.java | 56 ++-
.../query/jdbc/GridCacheQueryJdbcTask.java | 6 +-
.../processors/cluster/ClusterProcessor.java | 5 +-
.../processors/odbc/SqlListenerNioListener.java | 5 +-
.../processors/odbc/jdbc/JdbcQueryCursor.java | 9 +-
.../odbc/jdbc/JdbcRequestHandler.java | 21 +-
.../PlatformDotNetConfigurationClosure.java | 8 +-
.../utils/PlatformConfigurationUtils.java | 94 +++++
.../query/DynamicTableAffinityKeyMapper.java | 92 +++++
.../processors/query/GridQueryProcessor.java | 18 +-
.../internal/processors/query/QueryUtils.java | 51 ++-
.../rest/client/message/GridClientNodeBean.java | 25 ++
.../handlers/cache/GridCacheCommandHandler.java | 4 +-
.../top/GridTopologyCommandHandler.java | 11 +-
.../service/GridServiceProcessor.java | 32 +-
.../node/VisorExecutorServiceConfiguration.java | 20 +-
.../visor/node/VisorGridConfiguration.java | 22 +-
.../visor/node/VisorOdbcConfiguration.java | 114 ------
.../node/VisorSqlConnectorConfiguration.java | 166 +++++++++
.../visor/query/VisorQueryIndexField.java | 32 +-
.../internal/visor/query/VisorRunningQuery.java | 20 +-
.../resources/META-INF/classnames.properties | 2 +-
modules/core/src/test/config/log4j-test.xml | 6 +-
modules/core/src/test/config/log4j2-test.xml | 6 +-
.../src/test/config/log4j2-verbose-test.xml | 4 +-
.../ignite/internal/ClusterGroupSelfTest.java | 100 ++++++
.../processors/cache/IgniteCacheGroupsTest.java | 98 ++---
.../top/CacheTopologyCommandHandlerTest.java | 152 ++++++++
.../loadtest/GridSingleExecutionTest.java | 4 +-
.../cache/GridCacheAbstractLoadTest.java | 4 +-
.../testframework/junits/GridAbstractTest.java | 4 +-
.../junits/logger/GridTestLog4jLogger.java | 4 +-
.../testsuites/IgniteRestHandlerTestSuite.java | 2 +
.../shuffle/streams/HadoopOffheapBuffer.java | 2 +-
.../query/h2/ddl/DdlStatementsProcessor.java | 16 +-
.../processors/query/h2/opt/GridH2Table.java | 5 +-
.../query/h2/sql/GridSqlCreateTable.java | 37 +-
.../processors/query/h2/sql/GridSqlJoin.java | 7 +
.../query/h2/sql/GridSqlQueryParser.java | 54 +++
.../query/h2/sql/GridSqlQuerySplitter.java | 147 +++++++-
.../h2/twostep/msg/GridH2IndexRangeRequest.java | 2 +
.../cache/index/H2DynamicTableSelfTest.java | 270 +++++++++++---
.../query/IgniteSqlSplitterSelfTest.java | 97 +++++
.../apache/ignite/logger/log4j/Log4JLogger.java | 4 +-
.../log4j/GridLog4jCorrectFileNameTest.java | 2 +-
.../ignite/logger/log4j2/Log4J2Logger.java | 2 +-
.../impls/matrix/SparseDistributedMatrix.java | 9 -
.../matrix/SparseDistributedMatrixTest.java | 9 -
.../IgnitePersistentStoreSchemaLoadTest.java | 8 +-
.../Cache/CacheConfigurationTest.cs | 10 +
.../Config/Log/dotnet-log4j.xml | 2 +-
.../IgniteConfigurationSerializerTest.cs | 37 +-
.../IgniteConfigurationTest.cs | 60 ++++
.../Apache.Ignite.Core.csproj | 2 +
.../Cache/Configuration/CacheConfiguration.cs | 23 ++
.../Configuration/Package-Info.cs | 26 ++
.../Configuration/SqlConnectorConfiguration.cs | 159 ++++++++
.../Datastream/IDataStreamer.cs | 8 +-
.../Apache.Ignite.Core/IgniteConfiguration.cs | 184 ++++++++++
.../IgniteConfigurationSection.xsd | 104 ++++++
.../Common/IgniteConfigurationXmlSerializer.cs | 10 +
.../config/VisorConfigurationCommand.scala | 1 +
.../src/main/java/log4j.properties | 2 +-
modules/web-console/backend/.gitignore | 1 +
modules/web-console/backend/app/mongo.js | 12 +
modules/web-console/frontend/.gitignore | 1 +
.../app/modules/agent/AgentManager.service.js | 2 +
.../modules/configuration/Version.service.js | 4 +
.../generator/AbstractTransformer.js | 9 +-
.../generator/ConfigurationGenerator.js | 35 +-
.../generator/defaults/Cluster.service.js | 9 +
.../states/configuration/caches/query.pug | 3 +-
.../states/configuration/clusters/memory.pug | 9 +
.../states/configuration/clusters/odbc.pug | 2 +-
.../configuration/clusters/sql-connector.pug | 62 ++++
.../frontend/controllers/clusters-controller.js | 5 +-
.../frontend/controllers/domains-controller.js | 169 ++++-----
.../views/configuration/clusters.tpl.pug | 6 +
.../views/configuration/domains-import.tpl.pug | 4 +-
.../apache/ignite/console/agent/AgentUtils.java | 24 +-
.../ignite/console/agent/db/DbColumn.java | 17 +-
.../ignite/console/agent/db/DbSchema.java | 60 ++++
.../apache/ignite/console/agent/db/DbTable.java | 21 +-
.../db/dialect/DatabaseMetadataDialect.java | 27 +-
.../agent/db/dialect/JdbcMetadataDialect.java | 42 ++-
.../agent/db/dialect/OracleMetadataDialect.java | 116 ++++--
.../agent/handlers/DatabaseListener.java | 18 +-
.../src/main/resources/log4j.properties | 6 +-
115 files changed, 3263 insertions(+), 651 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b6c73617/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b6c73617/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b6c73617/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b6c73617/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
index e584701,d5718f8..3f79122
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
@@@ -145,16 -145,26 +145,26 @@@ class ClusterCachesInfo
if (gridData != null && gridData.conflictErr != null)
throw new IgniteCheckedException(gridData.conflictErr);
- if (checkConsistency && joinDiscoData != null && gridData != null) {
+ if (joinDiscoData != null && gridData != null) {
for (CacheJoinNodeDiscoveryData.CacheInfo locCacheInfo : joinDiscoData.caches().values()) {
- CacheConfiguration locCfg = locCacheInfo.config();
+ CacheConfiguration locCfg = locCacheInfo.cacheData().config();
CacheData cacheData = gridData.gridData.caches().get(locCfg.getName());
- if (cacheData != null)
- checkCache(locCacheInfo, cacheData, cacheData.receivedFrom());
+ if (cacheData != null) {
+ if (!F.eq(cacheData.sql(), locCacheInfo.sql())) {
+ throw new IgniteCheckedException("Cache configuration mismatch (local cache was created " +
+ "via " + (locCacheInfo.sql() ? "CREATE TABLE" : "Ignite API") + ", while remote cache " +
+ "was created via " + (cacheData.sql() ? "CREATE TABLE" : "Ignite API") + "): " +
- locCacheInfo.config().getName());
++ locCacheInfo.cacheData().config().getName());
+ }
+
+ if (checkConsistency)
+ checkCache(locCacheInfo, cacheData, cacheData.receivedFrom());
+ }
- validateStartCacheConfiguration(locCfg);
+ if (checkConsistency)
+ validateStartCacheConfiguration(locCfg);
}
}
@@@ -172,8 -183,8 +183,8 @@@
@SuppressWarnings("unchecked")
private void checkCache(CacheJoinNodeDiscoveryData.CacheInfo locInfo, CacheData rmtData, UUID rmt)
throws IgniteCheckedException {
- GridCacheAttributes rmtAttr = new GridCacheAttributes(rmtData.cacheConfiguration(), rmtData.sql());
- GridCacheAttributes locAttr = new GridCacheAttributes(locInfo.cacheData().config(), locInfo.sql());
+ GridCacheAttributes rmtAttr = new GridCacheAttributes(rmtData.cacheConfiguration());
- GridCacheAttributes locAttr = new GridCacheAttributes(locInfo.config());
++ GridCacheAttributes locAttr = new GridCacheAttributes(locInfo.cacheData().config());
CU.checkAttributeMismatch(log, rmtAttr.cacheName(), rmt, "cacheMode", "Cache mode",
locAttr.cacheMode(), rmtAttr.cacheMode(), true);
http://git-wip-us.apache.org/repos/asf/ignite/blob/b6c73617/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b6c73617/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b6c73617/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b6c73617/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --cc modules/core/src/main/resources/META-INF/classnames.properties
index 61ae27a,2218aad..ad0a3e9
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@@ -1872,9 -1858,9 +1871,10 @@@ org.apache.ignite.internal.visor.node.V
org.apache.ignite.internal.visor.node.VisorServiceConfiguration
org.apache.ignite.internal.visor.node.VisorSpiDescription
org.apache.ignite.internal.visor.node.VisorSpisConfiguration
+ org.apache.ignite.internal.visor.node.VisorSqlConnectorConfiguration
org.apache.ignite.internal.visor.node.VisorSuppressedError
org.apache.ignite.internal.visor.node.VisorTransactionConfiguration
+org.apache.ignite.internal.visor.query.VisorQueryArg
org.apache.ignite.internal.visor.query.VisorQueryCancelTask
org.apache.ignite.internal.visor.query.VisorQueryCancelTask$VisorCancelQueriesJob
org.apache.ignite.internal.visor.query.VisorQueryCancelTaskArg
http://git-wip-us.apache.org/repos/asf/ignite/blob/b6c73617/modules/core/src/test/config/log4j-test.xml
----------------------------------------------------------------------
diff --cc modules/core/src/test/config/log4j-test.xml
index 9034805,1e88dfc..9138c02
mode 100755,100644..100755
--- a/modules/core/src/test/config/log4j-test.xml
+++ b/modules/core/src/test/config/log4j-test.xml
http://git-wip-us.apache.org/repos/asf/ignite/blob/b6c73617/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b6c73617/modules/pds/src/test/java/org/apache/ignite/cache/database/IgnitePersistentStoreSchemaLoadTest.java
----------------------------------------------------------------------
diff --cc modules/pds/src/test/java/org/apache/ignite/cache/database/IgnitePersistentStoreSchemaLoadTest.java
index 7719f1a,0000000..bed17ac
mode 100644,000000..100644
--- a/modules/pds/src/test/java/org/apache/ignite/cache/database/IgnitePersistentStoreSchemaLoadTest.java
+++ b/modules/pds/src/test/java/org/apache/ignite/cache/database/IgnitePersistentStoreSchemaLoadTest.java
@@@ -1,297 -1,0 +1,297 @@@
+/*
+ * 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.cache.database;
+
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheRebalanceMode;
+import org.apache.ignite.cache.QueryEntity;
+import org.apache.ignite.cache.QueryIndex;
+import org.apache.ignite.cache.QueryIndexType;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.IgniteInterruptedCheckedException;
+import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
+import org.apache.ignite.internal.processors.cache.database.DbCheckpointListener;
+import org.apache.ignite.internal.processors.cache.database.GridCacheDatabaseSharedManager;
+import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
+import org.apache.ignite.internal.util.typedef.internal.U;
+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;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK;
+
+/**
+ *
+ */
+public class IgnitePersistentStoreSchemaLoadTest extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** Index name. */
+ private static final String IDX_NAME = "my_idx";
+
+ /** Cache name. */
+ private static final String TMPL_NAME = "test_cache*";
+
+ /** Table name. */
+ private static final String TBL_NAME = Person.class.getSimpleName();
+
+ /** Schema name. */
+ private static final String SCHEMA_NAME = "PUBLIC";
+
+ /** Cache name. */
+ private static final String CACHE_NAME = TBL_NAME;
+
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+
+ cfg.setCacheConfiguration(cacheCfg(TMPL_NAME));
+
+ PersistentStoreConfiguration pCfg = new PersistentStoreConfiguration();
+
+ pCfg.setCheckpointingFrequency(1000);
+
+ cfg.setPersistentStoreConfiguration(pCfg);
+
+ return cfg;
+ }
+
+ /** */
+ private CacheConfiguration cacheCfg(String name) {
+ CacheConfiguration<?, ?> cfg = new CacheConfiguration<>();
+
+ cfg.setName(name);
+
+ cfg.setRebalanceMode(CacheRebalanceMode.NONE);
+
+ cfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
+
+ return cfg;
+ }
+
+ /** */
+ private QueryEntity getEntity() {
+ LinkedHashMap<String, String> fields = new LinkedHashMap<>();
+
+ fields.put("id", Integer.class.getName());
+ fields.put("name", String.class.getName());
+
+ QueryEntity entity = new QueryEntity(Integer.class.getName(), Person.class.getName());
+ entity.setFields(fields);
+ entity.setTableName(TBL_NAME);
+
+ return entity;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ System.setProperty(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK, "true");
+
+ stopAllGrids();
+
+ deleteWorkFiles();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+
+ deleteWorkFiles();
+
+ System.clearProperty(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK);
+ }
+
+ /** */
+ public void testPersistIndex() throws Exception {
+ IgniteEx ig0 = startGrid(0);
+ startGrid(1);
+
+ final AtomicInteger cnt = new AtomicInteger();
+
+ GridCacheDatabaseSharedManager db = (GridCacheDatabaseSharedManager)ig0.context().cache().context().database();
+
+ db.addCheckpointListener(new DbCheckpointListener() {
- @Override public void onCheckpointBegin(Context context) throws IgniteCheckedException {
++ @Override public void onCheckpointBegin(Context context) {
+ cnt.incrementAndGet();
+ }
+ });
+
+ QueryIndex idx = new QueryIndex("name");
+
+ idx.setName(IDX_NAME);
+
- ig0.context().query().dynamicTableCreate(SCHEMA_NAME, getEntity(), TMPL_NAME, null, 1, true);
++ ig0.context().query().dynamicTableCreate(SCHEMA_NAME, getEntity(), TMPL_NAME, null, null, null, 1, true);
+
+ assert indexCnt(ig0, CACHE_NAME) == 0;
+
+ ig0.context().query().dynamicIndexCreate(CACHE_NAME, SCHEMA_NAME, TBL_NAME, idx, false).get();
+
+ assert indexCnt(ig0, CACHE_NAME) == 1;
+
+ waitForCheckpoint(cnt);
+
+ stopGrid(1);
+
+ IgniteEx ig1 = startGrid(1);
+
+ assert indexCnt(ig1, CACHE_NAME) == 1;
+ }
+
+ /** */
+ public void testPersistCompositeIndex() throws Exception {
+ IgniteEx ig0 = startGrid(0);
+ startGrid(1);
+
+ final AtomicInteger cnt = new AtomicInteger();
+
+ GridCacheDatabaseSharedManager db = (GridCacheDatabaseSharedManager)ig0.context().cache().context().database();
+
+ db.addCheckpointListener(new DbCheckpointListener() {
- @Override public void onCheckpointBegin(Context context) throws IgniteCheckedException {
++ @Override public void onCheckpointBegin(Context context) {
+ cnt.incrementAndGet();
+ }
+ });
+
- ig0.context().query().dynamicTableCreate(SCHEMA_NAME, getEntity(), TMPL_NAME, null, 1, true);
++ ig0.context().query().dynamicTableCreate(SCHEMA_NAME, getEntity(), TMPL_NAME, null, null, null, 1, true);
+
+ assert indexCnt(ig0, CACHE_NAME) == 0;
+
+ QueryIndex idx = new QueryIndex(Arrays.asList("id", "name"), QueryIndexType.SORTED);
+
+ idx.setName(IDX_NAME);
+
+ ig0.context().query().dynamicIndexCreate(CACHE_NAME, SCHEMA_NAME, TBL_NAME, idx, false).get();
+
+ assert indexCnt(ig0, CACHE_NAME) == 1;
+
+ waitForCheckpoint(cnt);
+
+ stopGrid(1);
+
+ IgniteEx ig1 = startGrid(1);
+
+ assert indexCnt(ig1, CACHE_NAME) == 1;
+ }
+
+ /** */
+ private void waitForCheckpoint(final AtomicInteger cnt) throws IgniteInterruptedCheckedException {
+ final int i = cnt.get();
+
+ GridTestUtils.waitForCondition(new GridAbsPredicate() {
+ @Override public boolean apply() {
+ return cnt.get() > i;
+ }
+ }, 2000);
+ }
+
+ /** */
+ private int indexCnt(IgniteEx node, String cacheName) {
+
+ DynamicCacheDescriptor desc = node.context().cache().cacheDescriptor(cacheName);
+
+ int cnt = 0;
+
+ for (QueryEntity entity : desc.schema().entities()) {
+ cnt += entity.getIndexes().size();
+ }
+
+ return cnt;
+ }
+
+ /**
+ * @return Indexing.
+ */
+ private IgniteH2Indexing getIndexing(IgniteEx ignite) {
+ return U.field(ignite.context().query(), "idx");
+ }
+
+ /**
+ *
+ */
+ private void deleteWorkFiles() throws IgniteCheckedException {
+ deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
+ }
+
+ /**
+ *
+ */
+ protected static class Person implements Serializable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ @SuppressWarnings("unused")
+ private Person() {
+ // No-op.
+ }
+
+ /** */
+ public Person(int id) {
+ this.id = id;
+ }
+
+ /** */
+ @QuerySqlField
+ protected int id;
+
+ /** */
+ @QuerySqlField
+ protected String name;
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ IgnitePersistentStoreSchemaLoadTest.Person person = (IgnitePersistentStoreSchemaLoadTest.Person)o;
+
+ if (id != person.id)
+ return false;
+
+ return name != null ? name.equals(person.name) : person.name == null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ int result = id;
+
+ result = 31 * result + (name != null ? name.hashCode() : 0);
+
+ return result;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b6c73617/modules/web-console/frontend/app/modules/agent/AgentManager.service.js
----------------------------------------------------------------------
[26/42] ignite git commit: Clients / REST: added node order to
GridClientNode / GridClientNodeBean.
Posted by ag...@apache.org.
Clients / REST: added node order to GridClientNode / GridClientNodeBean.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6cc5f18a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6cc5f18a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6cc5f18a
Branch: refs/heads/ignite-5267-merge-ea
Commit: 6cc5f18a9a8da1c741a9728091fdb5988183af81
Parents: 0a0ddbc
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Thu Jun 8 19:41:19 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Thu Jun 8 19:41:19 2017 +0700
----------------------------------------------------------------------
.../ignite/internal/client/GridClientNode.java | 9 ++++++-
.../client/impl/GridClientNodeImpl.java | 22 ++++++++++++++++-
.../connection/GridClientNioTcpConnection.java | 3 ++-
.../rest/client/message/GridClientNodeBean.java | 25 ++++++++++++++++++++
.../top/GridTopologyCommandHandler.java | 1 +
5 files changed, 57 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6cc5f18a/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientNode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientNode.java b/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientNode.java
index be8053b..1df1c21 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientNode.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientNode.java
@@ -119,4 +119,11 @@ public interface GridClientNode {
* {@code false} if request may be passed through a router.
*/
public boolean connectable();
-}
\ No newline at end of file
+
+ /**
+ * Node order within grid topology.
+ *
+ * @return Node startup order.
+ */
+ public long order();
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6cc5f18a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/GridClientNodeImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/GridClientNodeImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/GridClientNodeImpl.java
index ac0866b..a4b659b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/GridClientNodeImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/GridClientNodeImpl.java
@@ -66,6 +66,9 @@ public class GridClientNodeImpl implements GridClientNode {
/** Cache for REST TCP socket addresses. */
private final AtomicReference<Collection<InetSocketAddress>> tcpSockAddrs = new AtomicReference<>();
+ /** Node order within grid topology */
+ private long order;
+
/**
* Default constructor (private).
*/
@@ -99,7 +102,8 @@ public class GridClientNodeImpl implements GridClientNode {
.tcpAddresses(from.tcpAddresses())
.tcpPort(from.tcpPort())
.caches(from.caches())
- .connectable(from.connectable());
+ .connectable(from.connectable())
+ .order(from.order());
if (!skipAttrs)
b.attributes(from.attributes());
@@ -186,6 +190,11 @@ public class GridClientNodeImpl implements GridClientNode {
return filterIfNecessary(addrs0, filterResolved);
}
+ /** {@inheritDoc} */
+ public long order() {
+ return order;
+ }
+
/**
* Filters sockets with resolved addresses.
*
@@ -377,5 +386,16 @@ public class GridClientNodeImpl implements GridClientNode {
return this;
}
+
+ /**
+ * Set node order within grid topology
+ *
+ * @param order Node order within grid topology
+ */
+ public Builder order(long order) {
+ impl.order = order;
+
+ return this;
+ }
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/6cc5f18a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
index 75fa315..18ce6e4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
@@ -946,7 +946,8 @@ public class GridClientNioTcpConnection extends GridClientConnection {
.nodeId(nodeBean.getNodeId())
.consistentId(nodeBean.getConsistentId())
.tcpAddresses(nodeBean.getTcpAddresses())
- .tcpPort(nodeBean.getTcpPort());
+ .tcpPort(nodeBean.getTcpPort())
+ .order(nodeBean.getOrder());
Map<String, GridClientCacheMode> caches = new HashMap<>();
http://git-wip-us.apache.org/repos/asf/ignite/blob/6cc5f18a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientNodeBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientNodeBean.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientNodeBean.java
index f1848df..b4bdaa1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientNodeBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientNodeBean.java
@@ -60,6 +60,9 @@ public class GridClientNodeBean implements Externalizable {
/** Node caches. */
private Collection<GridClientCacheBean> caches;
+ /** Node order within grid topology. */
+ private long order;
+
/**
* Gets node ID.
*
@@ -200,6 +203,24 @@ public class GridClientNodeBean implements Externalizable {
this.tcpPort = tcpPort;
}
+ /**
+ * Node order within grid topology.
+ *
+ * @return Node startup order.
+ */
+ public long getOrder() {
+ return order;
+ }
+
+ /**
+ * Set node order within grid topology
+ *
+ * @param order Node order within grid topology
+ */
+ public void setOrder(long order) {
+ this.order = order;
+ }
+
/** {@inheritDoc} */
@Override public int hashCode() {
return nodeId != null ? nodeId.hashCode() : 0;
@@ -252,6 +273,8 @@ public class GridClientNodeBean implements Externalizable {
out.writeObject(String.valueOf(consistentId));
out.writeObject(metrics);
+
+ out.writeLong(order);
}
/** {@inheritDoc} */
@@ -287,6 +310,8 @@ public class GridClientNodeBean implements Externalizable {
consistentId = in.readObject();
metrics = (GridClientNodeMetricsBean)in.readObject();
+
+ order = in.readLong();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/6cc5f18a/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 fa677c7..b773e16 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
@@ -211,6 +211,7 @@ public class GridTopologyCommandHandler extends GridRestCommandHandlerAdapter {
nodeBean.setNodeId(node.id());
nodeBean.setConsistentId(node.consistentId());
nodeBean.setTcpPort(attribute(node, ATTR_REST_TCP_PORT, 0));
+ nodeBean.setOrder(node.order());
nodeBean.setTcpAddresses(nonEmptyList(node.<Collection<String>>attribute(ATTR_REST_TCP_ADDRS)));
nodeBean.setTcpHostNames(nonEmptyList(node.<Collection<String>>attribute(ATTR_REST_TCP_HOST_NAMES)));
[35/42] ignite git commit: IGNITE-4431: Include date into the default
format of the ignite log. - Fixes #2109.
Posted by ag...@apache.org.
IGNITE-4431: Include date into the default format of the ignite log. - Fixes #2109.
Signed-off-by: shroman <rs...@yahoo.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7ceb2016
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7ceb2016
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7ceb2016
Branch: refs/heads/ignite-5267-merge-ea
Commit: 7ceb20169748c99116e21400ed12f426d0771e00
Parents: c63988a
Author: shroman <rs...@yahoo.com>
Authored: Fri Jun 9 17:36:01 2017 +0900
Committer: shroman <rs...@yahoo.com>
Committed: Fri Jun 9 17:36:01 2017 +0900
----------------------------------------------------------------------
config/ignite-log4j.xml | 6 +++---
config/ignite-log4j2.xml | 6 +++---
modules/clients/src/test/resources/log4j.xml | 2 +-
modules/core/src/test/config/log4j-test.xml | 6 +++---
modules/core/src/test/config/log4j2-test.xml | 6 +++---
modules/core/src/test/config/log4j2-verbose-test.xml | 4 ++--
.../org/apache/ignite/loadtest/GridSingleExecutionTest.java | 4 ++--
.../ignite/loadtests/cache/GridCacheAbstractLoadTest.java | 4 ++--
.../apache/ignite/testframework/junits/GridAbstractTest.java | 4 ++--
.../testframework/junits/logger/GridTestLog4jLogger.java | 4 ++--
.../main/java/org/apache/ignite/logger/log4j/Log4JLogger.java | 4 ++--
.../ignite/logger/log4j/GridLog4jCorrectFileNameTest.java | 2 +-
.../java/org/apache/ignite/logger/log4j2/Log4J2Logger.java | 2 +-
.../Apache.Ignite.Core.Tests/Config/Log/dotnet-log4j.xml | 2 +-
modules/visor-plugins/src/main/java/log4j.properties | 2 +-
.../web-console/web-agent/src/main/resources/log4j.properties | 6 +++---
16 files changed, 32 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/config/ignite-log4j.xml
----------------------------------------------------------------------
diff --git a/config/ignite-log4j.xml b/config/ignite-log4j.xml
index 9d4521a..7669af3 100644
--- a/config/ignite-log4j.xml
+++ b/config/ignite-log4j.xml
@@ -37,7 +37,7 @@
<param name="Threshold" value="DEBUG"/>
<layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <param name="ConversionPattern" value="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
@@ -59,7 +59,7 @@
<!-- The default pattern: Date Priority [Category] Message\n -->
<layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <param name="ConversionPattern" value="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
</layout>
</appender>
@@ -74,7 +74,7 @@
<param name="MaxFileSize" value="10MB"/>
<param name="MaxBackupIndex" value="10"/>
<layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <param name="ConversionPattern" value="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
</layout>
</appender>
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/config/ignite-log4j2.xml
----------------------------------------------------------------------
diff --git a/config/ignite-log4j2.xml b/config/ignite-log4j2.xml
index c9c349e..2c88e57 100644
--- a/config/ignite-log4j2.xml
+++ b/config/ignite-log4j2.xml
@@ -20,12 +20,12 @@
<Configuration>
<Appenders>
<Console name="CONSOLE" target="SYSTEM_OUT">
- <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <PatternLayout pattern="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
<ThresholdFilter level="ERROR" onMatch="DENY" onMismatch="ACCEPT"/>
</Console>
<Console name="CONSOLE_ERR" target="SYSTEM_ERR">
- <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <PatternLayout pattern="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
</Console>
<Routing name="FILE">
@@ -33,7 +33,7 @@
<Route>
<RollingFile name="Rolling-${sys:nodeId}" fileName="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}.log"
filePattern="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}-%i-%d{yyyy-MM-dd}.log.gz">
- <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <PatternLayout pattern="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="6" modulate="true" />
<SizeBasedTriggeringPolicy size="10 MB" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/modules/clients/src/test/resources/log4j.xml
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/resources/log4j.xml b/modules/clients/src/test/resources/log4j.xml
index 33a723c..5c19f0f 100644
--- a/modules/clients/src/test/resources/log4j.xml
+++ b/modules/clients/src/test/resources/log4j.xml
@@ -75,7 +75,7 @@
<param name="MaxFileSize" value="10MB"/>
<param name="MaxBackupIndex" value="10"/>
<layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <param name="ConversionPattern" value="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
</layout>
</appender>
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/modules/core/src/test/config/log4j-test.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/log4j-test.xml b/modules/core/src/test/config/log4j-test.xml
index 638b260..1e88dfc 100644
--- a/modules/core/src/test/config/log4j-test.xml
+++ b/modules/core/src/test/config/log4j-test.xml
@@ -35,7 +35,7 @@
<!-- The default pattern: Date Priority [Category] Message\n -->
<layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <param name="ConversionPattern" value="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
</layout>
<!-- Do not log beyond INFO level. -->
@@ -57,7 +57,7 @@
<!-- The default pattern: Date Priority [Category] Message\n -->
<layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <param name="ConversionPattern" value="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
</layout>
</appender>
@@ -71,7 +71,7 @@
<param name="MaxFileSize" value="10MB"/>
<param name="MaxBackupIndex" value="10"/>
<layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <param name="ConversionPattern" value="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
</layout>
</appender>
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/modules/core/src/test/config/log4j2-test.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/log4j2-test.xml b/modules/core/src/test/config/log4j2-test.xml
index 30599cc..81b14a8 100644
--- a/modules/core/src/test/config/log4j2-test.xml
+++ b/modules/core/src/test/config/log4j2-test.xml
@@ -20,12 +20,12 @@
<Configuration>
<Appenders>
<Console name="CONSOLE" target="SYSTEM_OUT">
- <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <PatternLayout pattern="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
<ThresholdFilter level="ERROR" onMatch="DENY" onMismatch="ACCEPT"/>
</Console>
<Console name="CONSOLE_ERR" target="SYSTEM_ERR">
- <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <PatternLayout pattern="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
</Console>
<Routing name="FILE">
@@ -33,7 +33,7 @@
<Route>
<RollingFile name="Rolling-${sys:nodeId}" fileName="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}.log"
filePattern="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}-%i-%d{yyyy-MM-dd}.log.gz">
- <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <PatternLayout pattern="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="6" modulate="true" />
<SizeBasedTriggeringPolicy size="10 MB" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/modules/core/src/test/config/log4j2-verbose-test.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/log4j2-verbose-test.xml b/modules/core/src/test/config/log4j2-verbose-test.xml
index b870dc8..50366d3 100644
--- a/modules/core/src/test/config/log4j2-verbose-test.xml
+++ b/modules/core/src/test/config/log4j2-verbose-test.xml
@@ -20,7 +20,7 @@
<Configuration>
<Appenders>
<Console name="CONSOLE_ERR" target="SYSTEM_ERR">
- <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <PatternLayout pattern="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
</Console>
<Routing name="FILE">
@@ -28,7 +28,7 @@
<Route>
<RollingFile name="Rolling-${sys:nodeId}" fileName="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}.log"
filePattern="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}-%i-%d{yyyy-MM-dd}.log.gz">
- <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <PatternLayout pattern="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="6" modulate="true" />
<SizeBasedTriggeringPolicy size="10 MB" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/modules/core/src/test/java/org/apache/ignite/loadtest/GridSingleExecutionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtest/GridSingleExecutionTest.java b/modules/core/src/test/java/org/apache/ignite/loadtest/GridSingleExecutionTest.java
index 559cfc9..59eb1ef 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtest/GridSingleExecutionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtest/GridSingleExecutionTest.java
@@ -140,7 +140,7 @@ public final class GridSingleExecutionTest {
// Configure output that should go to System.out
RollingFileAppender fileApp;
- String fmt = "[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n";
+ String fmt = "[%d{ISO8601}][%-5p][%t][%c{1}] %m%n";
try {
fileApp = new RollingFileAppender(new PatternLayout(fmt), fileName);
@@ -338,4 +338,4 @@ public final class GridSingleExecutionTest {
return null;
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheAbstractLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheAbstractLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheAbstractLoadTest.java
index 8c351d7..8a94899 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheAbstractLoadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheAbstractLoadTest.java
@@ -272,7 +272,7 @@ abstract class GridCacheAbstractLoadTest {
// Configure output that should go to System.out
RollingFileAppender fileApp;
- String fmt = "[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n";
+ String fmt = "[%d{ISO8601}][%-5p][%t][%c{1}] %m%n";
try {
fileApp = new RollingFileAppender(new PatternLayout(fmt), fileName);
@@ -391,4 +391,4 @@ abstract class GridCacheAbstractLoadTest {
return cfg;
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
index a5a2401..aea7a2f 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
@@ -335,7 +335,7 @@ public abstract class GridAbstractTest extends TestCase {
c.setName("CONSOLE_ERR");
c.setTarget("System.err");
c.setThreshold(Priority.WARN);
- c.setLayout(new PatternLayout("[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"));
+ c.setLayout(new PatternLayout("[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"));
c.activateOptions();
@@ -350,7 +350,7 @@ public abstract class GridAbstractTest extends TestCase {
file.setAppend(false);
file.setMaxFileSize("10MB");
file.setMaxBackupIndex(10);
- file.setLayout(new PatternLayout("[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"));
+ file.setLayout(new PatternLayout("[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"));
file.activateOptions();
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridTestLog4jLogger.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridTestLog4jLogger.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridTestLog4jLogger.java
index 6a46c7d..52813b9 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridTestLog4jLogger.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridTestLog4jLogger.java
@@ -123,7 +123,7 @@ public class GridTestLog4jLogger implements IgniteLogger, LoggerNodeIdAware {
* log level.
*
* @param init If {@code true}, then a default console appender with
- * following pattern layout will be created: {@code %d{ABSOLUTE} %-5p [%c{1}] %m%n}.
+ * following pattern layout will be created: {@code %d{ISO8601} %-5p [%c{1}] %m%n}.
* If {@code false}, then no implicit initialization will take place,
* and {@code Log4j} should be configured prior to calling this
* constructor.
@@ -367,7 +367,7 @@ public class GridTestLog4jLogger implements IgniteLogger, LoggerNodeIdAware {
* @return New console appender.
*/
private Appender createConsoleAppender(Level maxLevel) {
- String fmt = "[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n";
+ String fmt = "[%d{ISO8601}][%-5p][%t][%c{1}] %m%n";
// Configure output that should go to System.out
Appender app = new ConsoleAppender(new PatternLayout(fmt), ConsoleAppender.SYSTEM_OUT);
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JLogger.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JLogger.java b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JLogger.java
index d5b0f02..39a1008 100644
--- a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JLogger.java
+++ b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JLogger.java
@@ -123,7 +123,7 @@ public class Log4JLogger implements IgniteLogger, LoggerNodeIdAware, Log4jFileAw
* log level.
*
* @param init If {@code true}, then a default console appender with
- * following pattern layout will be created: {@code %d{ABSOLUTE} %-5p [%c{1}] %m%n}.
+ * following pattern layout will be created: {@code %d{ISO8601} %-5p [%c{1}] %m%n}.
* If {@code false}, then no implicit initialization will take place,
* and {@code Log4j} should be configured prior to calling this
* constructor.
@@ -371,7 +371,7 @@ public class Log4JLogger implements IgniteLogger, LoggerNodeIdAware, Log4jFileAw
* @return New console appender.
*/
private Appender createConsoleAppender(Level maxLevel) {
- String fmt = "[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n";
+ String fmt = "[%d{ISO8601}][%-5p][%t][%c{1}] %m%n";
// Configure output that should go to System.out
Appender app = new ConsoleAppender(new PatternLayout(fmt), ConsoleAppender.SYSTEM_OUT);
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jCorrectFileNameTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jCorrectFileNameTest.java b/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jCorrectFileNameTest.java
index 1c19751..4672963 100644
--- a/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jCorrectFileNameTest.java
+++ b/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jCorrectFileNameTest.java
@@ -120,7 +120,7 @@ public class GridLog4jCorrectFileNameTest extends TestCase {
private static Log4jRollingFileAppender createAppender() throws Exception {
Log4jRollingFileAppender appender = new Log4jRollingFileAppender();
- appender.setLayout(new PatternLayout("[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"));
+ appender.setLayout(new PatternLayout("[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"));
appender.setFile("work/log/ignite.log");
appender.setName(Log4jRollingFileAppender.class.getSimpleName());
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
index dff3179..46215e5 100644
--- a/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
+++ b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
@@ -356,7 +356,7 @@ public class Log4J2Logger implements IgniteLogger, LoggerNodeIdAware {
PatternLayout.Builder builder = PatternLayout.newBuilder();
builder
- .withPattern("%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n")
+ .withPattern("%d{ISO8601}][%-5p][%t][%c{1}] %m%n")
.withCharset(Charset.defaultCharset())
.withAlwaysWriteExceptions(false)
.withNoConsoleNoAnsi(false);
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Log/dotnet-log4j.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Log/dotnet-log4j.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Log/dotnet-log4j.xml
index c8c62d7..9d6aefd 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Log/dotnet-log4j.xml
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Log/dotnet-log4j.xml
@@ -75,7 +75,7 @@
<param name="MaxFileSize" value="10MB"/>
<param name="MaxBackupIndex" value="10"/>
<layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <param name="ConversionPattern" value="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
</layout>
</appender>
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/modules/visor-plugins/src/main/java/log4j.properties
----------------------------------------------------------------------
diff --git a/modules/visor-plugins/src/main/java/log4j.properties b/modules/visor-plugins/src/main/java/log4j.properties
index 9f82cc4..092bf9f 100644
--- a/modules/visor-plugins/src/main/java/log4j.properties
+++ b/modules/visor-plugins/src/main/java/log4j.properties
@@ -22,4 +22,4 @@ log4j.logger.ro.fortsoft.pf4j=ERROR, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.err
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n
+log4j.appender.stdout.layout.ConversionPattern=[%d{ISO8601}][%-5p][%t][%c{1}] %m%n
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/modules/web-console/web-agent/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/resources/log4j.properties b/modules/web-console/web-agent/src/main/resources/log4j.properties
index c4116ac..6e42699 100644
--- a/modules/web-console/web-agent/src/main/resources/log4j.properties
+++ b/modules/web-console/web-agent/src/main/resources/log4j.properties
@@ -25,12 +25,12 @@ log4j.logger.sun.net.www.protocol.http=WARN
log4j.appender.console_err=org.apache.log4j.ConsoleAppender
log4j.appender.console_err.Threshold=WARN
log4j.appender.console_err.layout=org.apache.log4j.PatternLayout
-log4j.appender.console_err.layout.ConversionPattern=[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n
+log4j.appender.console_err.layout.ConversionPattern=[%d{ISO8601}][%-5p][%t][%c{1}] %m%n
# Configure console appender.
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern=[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n
+log4j.appender.console.layout.ConversionPattern=[%d{ISO8601}][%-5p][%t][%c{1}] %m%n
log4j.appender.console.filter.a=org.apache.log4j.varia.LevelMatchFilter
log4j.appender.console.filter.a.LevelToMatch=INFO
log4j.appender.console.filter.a.AcceptOnMatch=true
@@ -49,4 +49,4 @@ log4j.appender.file.File=logs/ignite-web-agent.log
log4j.appender.file.MaxFileSize=10MB
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n
+log4j.appender.file.layout.ConversionPattern=[%d{ISO8601}][%-5p][%t][%c{1}] %m%n
[29/42] ignite git commit: master - fixes for push down with LEFT
OUTER JOIN
Posted by ag...@apache.org.
master - fixes for push down with LEFT OUTER JOIN
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e3ff16ab
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e3ff16ab
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e3ff16ab
Branch: refs/heads/ignite-5267-merge-ea
Commit: e3ff16abed72e2b8a897a2699fe23e0e614f502d
Parents: d2efe78
Author: Sergi Vladykin <se...@gmail.com>
Authored: Thu Jun 8 20:39:05 2017 +0300
Committer: Sergi Vladykin <se...@gmail.com>
Committed: Thu Jun 8 20:39:05 2017 +0300
----------------------------------------------------------------------
.../processors/query/h2/sql/GridSqlJoin.java | 7 ++
.../query/h2/sql/GridSqlQuerySplitter.java | 82 ++++++++++++++++++--
.../query/IgniteSqlSplitterSelfTest.java | 50 ++++++++++++
3 files changed, 131 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e3ff16ab/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlJoin.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlJoin.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlJoin.java
index afe4a53..9546223 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlJoin.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlJoin.java
@@ -93,6 +93,13 @@ public class GridSqlJoin extends GridSqlElement {
return child(ON_CHILD);
}
+ /**
+ * @return {@code true} If this is a LEFT OUTER JOIN.
+ */
+ public boolean isLeftOuter() {
+ return leftOuter;
+ }
+
/** {@inheritDoc} */
@Override public String getSQL() {
StatementBuilder buff = new StatementBuilder();
http://git-wip-us.apache.org/repos/asf/ignite/blob/e3ff16ab/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
index e87a032..25d97fc 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
@@ -106,6 +106,9 @@ public class GridSqlQuerySplitter {
private Set<QueryTable> tbls = new HashSet<>();
/** */
+ private Set<String> pushedDownCols = new HashSet<>();
+
+ /** */
private boolean rdcQrySimple;
/** */
@@ -337,22 +340,75 @@ public class GridSqlQuerySplitter {
@SuppressWarnings("unused")
private static void debug(String label, String info) {
X.println();
- X.println(" ==" + label + "== ");
+ X.println(" == " + label + " == ");
X.println(info);
- X.println(" ======== ");
+ X.println(" ======================= ");
+ }
+
+ /**
+ * @param expr Expression.
+ * @return {@code true} If the expression contains pushed down columns.
+ */
+ private boolean hasPushedDownColumn(GridSqlAst expr) {
+ if (expr instanceof GridSqlColumn)
+ return pushedDownCols.contains(((GridSqlColumn)expr).columnName());
+
+ for (int i = 0; i < expr.size(); i++) {
+ if (hasPushedDownColumn(expr.child(i)))
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @param from FROM clause.
+ * @return {@code true} If contains LEFT OUTER JOIN.
+ */
+ private static boolean hasLeftJoin(GridSqlAst from) {
+ while (from instanceof GridSqlJoin) {
+ GridSqlJoin join = (GridSqlJoin)from;
+
+ assert !(join.rightTable() instanceof GridSqlJoin);
+
+ if (join.isLeftOuter())
+ return true;
+
+ from = join.leftTable();
+ }
+
+ return false;
}
/**
* @param qrym Query model for the SELECT.
*/
private void pushDownQueryModelSelect(QueryModel qrym) {
+ assert qrym.type == Type.SELECT: qrym.type;
+
+ boolean hasLeftJoin = hasLeftJoin(qrym.<GridSqlSelect>ast().from());
+
int begin = -1;
// Here we iterate over joined FROM table filters.
+ // !!! qrym.size() can change, never assign it to a variable.
for (int i = 0; i < qrym.size(); i++) {
QueryModel child = qrym.get(i);
- if (child.isQuery() && (child.needSplitChild || child.needSplit)) {
+ boolean hasPushedDownCol = false;
+
+ // It is either splittable subquery (it must remain in REDUCE query)
+ // or left join condition with pushed down columns (this condition
+ // can not be pushed down into a wrap query).
+ if ((child.isQuery() && (child.needSplitChild || child.needSplit)) ||
+ // We always must be at the right side of the join here to push down
+ // range on the left side. If there are no LEFT JOINs in the SELECT, then
+ // we will never have ON conditions, they are getting moved to WHERE clause.
+ (hasPushedDownCol = (hasLeftJoin && i != 0 && hasPushedDownColumn(findJoin(qrym, i).on())))) {
+ // Handle a single table push down case.
+ if (hasPushedDownCol && begin == -1)
+ begin = i - 1;
+
// Push down the currently collected range.
if (begin != -1) {
pushDownQueryModelRange(qrym, begin, i - 1);
@@ -361,8 +417,10 @@ public class GridSqlQuerySplitter {
assert qrym.get(i) == child; // Adjustment check: we have to return to the same point.
- // Reset range begin.
- begin = -1;
+ // Reset range begin: in case of pushed down column we can assume current child as
+ // as new begin (because it is not a splittable subquery), otherwise reset begin
+ // and try to find next range begin further.
+ begin = hasPushedDownCol ? i : -1;
}
if (child.needSplitChild)
@@ -394,7 +452,7 @@ public class GridSqlQuerySplitter {
for (int i = 0; i < qrym.size(); i++) {
QueryModel child = qrym.get(i);
- assert child.isQuery() : qrym.type;
+ assert child.isQuery() : child.type;
if (child.needSplit)
needSplitChild = true;
@@ -579,9 +637,12 @@ public class GridSqlQuerySplitter {
/**
* @param qrym Query model.
*/
- private void setNeedSplit(QueryModel qrym) {
- if (qrym.type == Type.SELECT)
+ private static void setNeedSplit(QueryModel qrym) {
+ if (qrym.type == Type.SELECT) {
+ assert !qrym.needSplitChild;
+
qrym.needSplit = true;
+ }
else if (qrym.type == Type.UNION) {
qrym.needSplitChild = true;
@@ -816,6 +877,8 @@ public class GridSqlQuerySplitter {
// Push down related ON conditions for all the related joins.
while (from instanceof GridSqlJoin) {
+ assert !(((GridSqlJoin)from).rightTable() instanceof GridSqlJoin);
+
pushDownColumnsInExpression(tblAliases, cols, wrapAlias, from, ON_CHILD);
from = from.child(LEFT_TABLE_CHILD);
@@ -909,6 +972,9 @@ public class GridSqlQuerySplitter {
// We have this map to avoid column duplicates in wrap query.
cols.put(uniqueColAlias, colAlias);
+
+ if (!pushedDownCols.add(uniqueColAlias)) // Must be globally unique.
+ throw new IllegalStateException(uniqueColAlias);
}
col = column(uniqueColAlias);
http://git-wip-us.apache.org/repos/asf/ignite/blob/e3ff16ab/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
index 8b743bf..6c61988 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
@@ -211,6 +211,56 @@ public class IgniteSqlSplitterSelfTest extends GridCommonAbstractTest {
/**
*/
+ public void testPushDownLeftJoin() {
+ IgniteCache<Integer, Person> c = ignite(0).getOrCreateCache(cacheConfig("ps", true,
+ Integer.class, Person.class));
+
+ try {
+ String subqryAgg = "(select max(p.id) as id, p.depId from Person p group by p.depId)";
+ String subqrySimple = "(select p.id, p.depId from Person p)";
+
+ for (int i = 0; i < 5; i++) {
+ for (int k = 0; k < 5; k++) {
+ SB qry = new SB("select * from ");
+
+ for (int j = 0; j < 5; j++) {
+ if (j != 0)
+ qry.a(j == i ? " left join " : " join ");
+
+ if (j == 2)
+ qry.a(subqryAgg);
+ else
+ qry.a(j == k ? subqrySimple : "Person");
+
+ qry.a(" p").a(j);
+
+ if (j != 0) {
+ qry.a(" on ");
+
+ qry.a(" p0.id").a(" = ").a("p").a(j).a(".depId");
+ }
+ }
+
+
+ X.println(" ---> ik: : " + i + " " + k);
+ X.println("\nqry: \n" + qry.toString());
+
+ c.query(new SqlFieldsQuery(qry.toString())
+ .setEnforceJoinOrder(true)).getAll();
+
+ X.println("\nPlan:\n" +
+ c.query(new SqlFieldsQuery("explain " + qry.toString())
+ .setEnforceJoinOrder(true)).getAll());
+ }
+ }
+ }
+ finally {
+ c.destroy();
+ }
+ }
+
+ /**
+ */
public void testReplicatedTablesUsingPartitionedCache() {
doTestReplicatedTablesUsingPartitionedCache(1, false, false);
}
[31/42] ignite git commit: IGNITE-5414 Implemented usage of UNIQUE
index for key fields generation, if PRIMARY KEY not found.
Posted by ag...@apache.org.
IGNITE-5414 Implemented usage of UNIQUE index for key fields generation, if PRIMARY KEY not found.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8de8fe50
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8de8fe50
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8de8fe50
Branch: refs/heads/ignite-5267-merge-ea
Commit: 8de8fe50c663a0a20fc36b82ae6a621b2864d010
Parents: 4b0998e
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Jun 9 14:36:30 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Jun 9 14:36:30 2017 +0700
----------------------------------------------------------------------
.../visor/query/VisorQueryIndexField.java | 32 ++---
.../frontend/controllers/domains-controller.js | 46 ++++----
.../views/configuration/domains-import.tpl.pug | 4 +-
.../apache/ignite/console/agent/AgentUtils.java | 24 ++--
.../ignite/console/agent/db/DbColumn.java | 17 ++-
.../apache/ignite/console/agent/db/DbTable.java | 21 ++--
.../db/dialect/DatabaseMetadataDialect.java | 27 ++++-
.../agent/db/dialect/JdbcMetadataDialect.java | 42 ++++++-
.../agent/db/dialect/OracleMetadataDialect.java | 116 +++++++++++++++----
9 files changed, 230 insertions(+), 99 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/8de8fe50/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryIndexField.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryIndexField.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryIndexField.java
index fb32dd1..f1d120d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryIndexField.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryIndexField.java
@@ -37,10 +37,10 @@ public class VisorQueryIndexField extends VisorDataTransferObject {
private static final long serialVersionUID = 0L;
/** Index field name. */
- private String fldName;
+ private String name;
/** Index field sort order. */
- private boolean fldSort;
+ private boolean sort;
/**
* Create data transfer object for given cache type metadata.
@@ -50,14 +50,14 @@ public class VisorQueryIndexField extends VisorDataTransferObject {
}
/**
- * Create data transfer object for given cache type metadata.
+ * Create data transfer object for index field.
*
- * @param fldName Index field name.
- * @param fldSort Index field sort order.
+ * @param name Index field name.
+ * @param sort Index field sort order.
*/
- public VisorQueryIndexField(String fldName, boolean fldSort) {
- this.fldName = fldName;
- this.fldSort = fldSort;
+ public VisorQueryIndexField(String name, boolean sort) {
+ this.name = name;
+ this.sort = sort;
}
/**
@@ -76,27 +76,27 @@ public class VisorQueryIndexField extends VisorDataTransferObject {
/**
* @return Index field name.
*/
- public String getFieldName() {
- return fldName;
+ public String getName() {
+ return name;
}
/**
* @return Index field sort order.
*/
- public boolean isFieldSort() {
- return fldSort;
+ public boolean getSortOrder() {
+ return sort;
}
/** {@inheritDoc} */
@Override protected void writeExternalData(ObjectOutput out) throws IOException {
- U.writeString(out, fldName);
- out.writeBoolean(fldSort);
+ U.writeString(out, name);
+ out.writeBoolean(sort);
}
/** {@inheritDoc} */
@Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
- fldName = U.readString(in);
- fldSort = in.readBoolean();
+ name = U.readString(in);
+ sort = in.readBoolean();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/8de8fe50/modules/web-console/frontend/controllers/domains-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/controllers/domains-controller.js b/modules/web-console/frontend/controllers/domains-controller.js
index 992c829..b8fae5d 100644
--- a/modules/web-console/frontend/controllers/domains-controller.js
+++ b/modules/web-console/frontend/controllers/domains-controller.js
@@ -697,16 +697,14 @@ export default ['$rootScope', '$scope', '$http', '$state', '$filter', '$timeout'
_fillCommonCachesOrTemplates($scope.importCommon)($scope.importCommon.action);
- _.forEach(tables, function(tbl, idx) {
+ _.forEach(tables, (tbl, idx) => {
tbl.id = idx;
tbl.action = IMPORT_DM_NEW_CACHE;
- tbl.generatedCacheName = toJavaClassName(tbl.tbl) + 'Cache';
+ tbl.generatedCacheName = toJavaClassName(tbl.table) + 'Cache';
tbl.cacheOrTemplate = DFLT_PARTITIONED_CACHE.value;
- tbl.label = tbl.schema + '.' + tbl.tbl;
+ tbl.label = tbl.schema + '.' + tbl.table;
tbl.edit = false;
- tbl.use = LegacyUtils.isDefined(_.find(tbl.cols, function(col) {
- return col.key;
- }));
+ tbl.use = LegacyUtils.isDefined(_.find(tbl.columns, (col) => col.key));
});
$scope.importDomain.action = 'tables';
@@ -718,7 +716,7 @@ export default ['$rootScope', '$scope', '$http', '$state', '$filter', '$timeout'
}
$scope.applyDefaults = function() {
- _.forEach($scope.importDomain.displayedTables, function(table) {
+ _.forEach($scope.importDomain.displayedTables, (table) => {
table.edit = false;
table.action = $scope.importCommon.action;
table.cacheOrTemplate = $scope.importCommon.cacheOrTemplate;
@@ -770,9 +768,7 @@ export default ['$rootScope', '$scope', '$http', '$state', '$filter', '$timeout'
let lastItem;
const newItems = [];
- _.forEach(_mapCaches(data.generatedCaches), function(cache) {
- $scope.caches.push(cache);
- });
+ _.forEach(_mapCaches(data.generatedCaches), (cache) => $scope.caches.push(cache));
_.forEach(data.savedDomains, function(savedItem) {
const idx = _.findIndex($scope.domains, function(domain) {
@@ -847,11 +843,11 @@ export default ['$rootScope', '$scope', '$http', '$state', '$filter', '$timeout'
const valFields = [];
const aliases = [];
- const tableName = table.tbl;
+ const tableName = table.table;
let typeName = toJavaClassName(tableName);
if (_.find($scope.importDomain.tables,
- (tbl, ix) => tbl.use && ix !== curIx && tableName === tbl.tbl)) {
+ (tbl, ix) => tbl.use && ix !== curIx && tableName === tbl.table)) {
typeName = typeName + '_' + toJavaClassName(table.schema);
containDup = true;
@@ -869,7 +865,7 @@ export default ['$rootScope', '$scope', '$http', '$state', '$filter', '$timeout'
let _containKey = false;
- _.forEach(table.cols, function(col) {
+ _.forEach(table.columns, function(col) {
const fld = dbField(col.name, SqlTypes.findJdbcType(col.type), col.nullable, col.unsigned);
qryFields.push({name: fld.javaFieldName, className: fld.javaType});
@@ -892,18 +888,17 @@ export default ['$rootScope', '$scope', '$http', '$state', '$filter', '$timeout'
});
containKey &= _containKey;
-
- if (table.idxs) {
- _.forEach(table.idxs, function(idx) {
- const fields = Object.keys(idx.fields);
+ if (table.indexes) {
+ _.forEach(table.indexes, (idx) => {
+ const idxFields = _.map(idx.fields, (idxFld) => ({
+ name: toJavaFieldName(idxFld.name),
+ direction: idxFld.sortOrder
+ }));
indexes.push({
- name: idx.name, indexType: 'SORTED', fields: _.map(fields, function(fieldName) {
- return {
- name: toJavaFieldName(fieldName),
- direction: idx.fields[fieldName]
- };
- })
+ name: idx.name,
+ indexType: 'SORTED',
+ fields: idxFields
});
});
}
@@ -946,10 +941,11 @@ export default ['$rootScope', '$scope', '$http', '$state', '$filter', '$timeout'
newDomain.keyType = keyField.javaType;
- // Exclude key column from query fields and indexes.
+ // Exclude key column from query fields.
newDomain.fields = _.filter(newDomain.fields, (field) => field.name !== keyField.javaFieldName);
- _.forEach(newDomain.indexes, function(index) {
+ // Exclude key column from indexes.
+ _.forEach(newDomain.indexes, (index) => {
index.fields = _.filter(index.fields, (field) => field.name !== keyField.javaFieldName);
});
http://git-wip-us.apache.org/repos/asf/ignite/blob/8de8fe50/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/configuration/domains-import.tpl.pug b/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
index 20a7b85..29bbf4a 100644
--- a/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
+++ b/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
@@ -74,7 +74,7 @@ mixin td-ellipses-lbl(w, lbl)
.settings-row.settings-row_small-label
+text('JDBC URL:', 'selectedPreset.jdbcUrl', '"jdbcUrl"', true, 'JDBC URL', 'JDBC URL for connecting to database<br>Refer to your database documentation for details')
.settings-row.settings-row_small-label
- +text('User:', 'selectedPreset.user', '"jdbdUser"', false, '', 'User name for connecting to database')
+ +text('User:', 'selectedPreset.user', '"jdbcUser"', false, '', 'User name for connecting to database')
.settings-row.settings-row_small-label
+password('Password:', 'selectedPreset.password', '"jdbcPassword"', false, '', 'Password for connecting to database<br>Note, password would not be saved in preferences for security reasons')(ignite-on-enter='importDomainNext()')
.settings-row
@@ -132,7 +132,7 @@ mixin td-ellipses-lbl(w, lbl)
td(width='30px' style='min-width: 30px; max-width: 30px')
input(type='checkbox' ng-model='table.use' ng-change='selectTable()')
+td-ellipses-lbl('130px', '{{table.schema}}')
- +td-ellipses-lbl('160px', '{{table.tbl}}')
+ +td-ellipses-lbl('160px', '{{table.table}}')
td(colspan='2' width='288px' style='min-width: 160px; max-width: 160px')
div.td-ellipsis
a(ng-if='!table.edit' ng-click='startEditDbTableCache(table)') {{tableActionView(table)}}
http://git-wip-us.apache.org/repos/asf/ignite/blob/8de8fe50/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/AgentUtils.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/AgentUtils.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/AgentUtils.java
index 1999afc..797951c 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/AgentUtils.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/AgentUtils.java
@@ -17,8 +17,6 @@
package org.apache.ignite.console.agent;
-import com.fasterxml.jackson.annotation.JsonAutoDetect;
-import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsonorg.JsonOrgModule;
import io.socket.client.Ack;
@@ -39,7 +37,12 @@ public class AgentUtils {
private static final Logger log = Logger.getLogger(AgentUtils.class.getName());
/** JSON object mapper. */
- private static final ObjectMapper mapper = new ObjectMapper();
+ private static final ObjectMapper MAPPER = new ObjectMapper();
+
+ static {
+ // Register special module with basic serializers.
+ MAPPER.registerModule(new JsonOrgModule());
+ }
/** */
private static final Ack NOOP_CB = new Ack() {
@@ -51,15 +54,6 @@ public class AgentUtils {
}
};
- static {
- JsonOrgModule module = new JsonOrgModule();
-
- mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE);
- mapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
-
- mapper.registerModule(module);
- }
-
/**
* Default constructor.
*/
@@ -172,9 +166,9 @@ public class AgentUtils {
*/
public static Object toJSON(Object obj) {
if (obj instanceof Iterable)
- return mapper.convertValue(obj, JSONArray.class);
+ return MAPPER.convertValue(obj, JSONArray.class);
- return mapper.convertValue(obj, JSONObject.class);
+ return MAPPER.convertValue(obj, JSONObject.class);
}
/**
@@ -186,6 +180,6 @@ public class AgentUtils {
* @throws IllegalArgumentException If conversion fails due to incompatible type.
*/
public static <T> T fromJSON(Object obj, Class<T> toValType) throws IllegalArgumentException {
- return mapper.convertValue(obj, toValType);
+ return MAPPER.convertValue(obj, toValType);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/8de8fe50/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbColumn.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbColumn.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbColumn.java
index 723ee25..61c15ba 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbColumn.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbColumn.java
@@ -17,6 +17,8 @@
package org.apache.ignite.console.agent.db;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
/**
* Database table column.
*/
@@ -54,35 +56,40 @@ public class DbColumn {
/**
* @return Column name.
*/
- public String name() {
+ public String getName() {
return name;
}
/**
* @return Column JDBC type.
*/
- public int type() {
+ public int getType() {
return type;
}
/**
* @return {@code true} if this column belongs to primary key.
*/
- public boolean key() {
+ public boolean isKey() {
return key;
}
/**
* @return {@code true} if {@code NULL } allowed for column in database.
*/
- public boolean nullable() {
+ public boolean isNullable() {
return nullable;
}
/**
* @return {@code true} if column is unsigned.
*/
- public boolean unsigned() {
+ public boolean isUnsigned() {
return unsigned;
}
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(DbColumn.class, this);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/8de8fe50/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbTable.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbTable.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbTable.java
index b74cfe5..653bb07 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbTable.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbTable.java
@@ -17,9 +17,9 @@
package org.apache.ignite.console.agent.db;
-import org.apache.ignite.cache.QueryIndex;
-
import java.util.Collection;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.query.VisorQueryIndex;
/**
* Database table.
@@ -35,7 +35,7 @@ public class DbTable {
private final Collection<DbColumn> cols;
/** Indexes. */
- private final Collection<QueryIndex> idxs;
+ private final Collection<VisorQueryIndex> idxs;
/**
* Default columns.
@@ -45,7 +45,7 @@ public class DbTable {
* @param cols Columns.
* @param idxs Indexes;
*/
- public DbTable(String schema, String tbl, Collection<DbColumn> cols, Collection<QueryIndex> idxs) {
+ public DbTable(String schema, String tbl, Collection<DbColumn> cols, Collection<VisorQueryIndex> idxs) {
this.schema = schema;
this.tbl = tbl;
this.cols = cols;
@@ -55,28 +55,33 @@ public class DbTable {
/**
* @return Schema name.
*/
- public String schema() {
+ public String getSchema() {
return schema;
}
/**
* @return Table name.
*/
- public String table() {
+ public String getTable() {
return tbl;
}
/**
* @return Columns.
*/
- public Collection<DbColumn> columns() {
+ public Collection<DbColumn> getColumns() {
return cols;
}
/**
* @return Indexes.
*/
- public Collection<QueryIndex> indexes() {
+ public Collection<VisorQueryIndex> getIndexes() {
return idxs;
}
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(DbTable.class, this);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/8de8fe50/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/DatabaseMetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/DatabaseMetadataDialect.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/DatabaseMetadataDialect.java
index 674bda5..e049d74 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/DatabaseMetadataDialect.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/DatabaseMetadataDialect.java
@@ -20,16 +20,19 @@ package org.apache.ignite.console.agent.db.dialect;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.apache.ignite.cache.QueryIndex;
import org.apache.ignite.cache.QueryIndexType;
import org.apache.ignite.console.agent.db.DbColumn;
import org.apache.ignite.console.agent.db.DbTable;
+import org.apache.ignite.internal.visor.query.VisorQueryIndex;
/**
* Base class for database metadata dialect.
@@ -81,7 +84,12 @@ public abstract class DatabaseMetadataDialect {
* @return New {@code DbTable} instance.
*/
protected DbTable table(String schema, String tbl, Collection<DbColumn> cols, Collection<QueryIndex>idxs) {
- return new DbTable(schema, tbl, cols, idxs);
+ Collection<VisorQueryIndex> res = new ArrayList<>(idxs.size());
+
+ for (QueryIndex idx : idxs)
+ res.add(new VisorQueryIndex(idx));
+
+ return new DbTable(schema, tbl, cols, res);
}
/**
@@ -99,4 +107,21 @@ public abstract class DatabaseMetadataDialect {
return idx;
}
+
+ /**
+ * Select first shortest index.
+ *
+ * @param uniqueIdxs Unique indexes with columns.
+ * @return Unique index that could be used instead of primary key.
+ */
+ protected Map.Entry<String, Set<String>> uniqueIndexAsPk(Map<String, Set<String>> uniqueIdxs) {
+ Map.Entry<String, Set<String>> uniqueIdxAsPk = null;
+
+ for (Map.Entry<String, Set<String>> uniqueIdx : uniqueIdxs.entrySet()) {
+ if (uniqueIdxAsPk == null || uniqueIdxAsPk.getValue().size() > uniqueIdx.getValue().size())
+ uniqueIdxAsPk = uniqueIdx;
+ }
+
+ return uniqueIdxAsPk;
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/8de8fe50/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/JdbcMetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/JdbcMetadataDialect.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/JdbcMetadataDialect.java
index dcfd9c0..031e3a7 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/JdbcMetadataDialect.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/JdbcMetadataDialect.java
@@ -23,8 +23,8 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashSet;
import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -140,13 +140,45 @@ public class JdbcMetadataDialect extends DatabaseMetadataDialect {
if (sys.contains(schema))
continue;
- Collection<String> pkCols = new HashSet<>();
+ Collection<String> pkCols = new LinkedHashSet<>();
try (ResultSet pkRs = dbMeta.getPrimaryKeys(tblCatalog, tblSchema, tblName)) {
while (pkRs.next())
pkCols.add(pkRs.getString(PK_COL_NAME_IDX));
}
+ Map.Entry<String, Set<String>> uniqueIdxAsPk = null;
+
+ // If PK not found, trying to use first UNIQUE index as key.
+ if (pkCols.isEmpty()) {
+ Map<String, Set<String>> uniqueIdxs = new LinkedHashMap<>();
+
+ try (ResultSet idxRs = dbMeta.getIndexInfo(tblCatalog, tblSchema, tblName, true, true)) {
+ while (idxRs.next()) {
+ String idxName = idxRs.getString(IDX_NAME_IDX);
+ String colName = idxRs.getString(IDX_COL_NAME_IDX);
+
+ if (idxName == null || colName == null)
+ continue;
+
+ Set<String> idxCols = uniqueIdxs.get(idxName);
+
+ if (idxCols == null) {
+ idxCols = new LinkedHashSet<>();
+
+ uniqueIdxs.put(idxName, idxCols);
+ }
+
+ idxCols.add(colName);
+ }
+ }
+
+ uniqueIdxAsPk = uniqueIndexAsPk(uniqueIdxs);
+
+ if (uniqueIdxAsPk != null)
+ pkCols.addAll(uniqueIdxAsPk.getValue());
+ }
+
Collection<DbColumn> cols = new ArrayList<>();
try (ResultSet colsRs = dbMeta.getColumns(tblCatalog, tblSchema, tblName, null)) {
@@ -162,15 +194,17 @@ public class JdbcMetadataDialect extends DatabaseMetadataDialect {
}
}
+ String uniqueIdxAsPkName = uniqueIdxAsPk != null ? uniqueIdxAsPk.getKey() : null;
+
Map<String, QueryIndex> idxs = new LinkedHashMap<>();
try (ResultSet idxRs = dbMeta.getIndexInfo(tblCatalog, tblSchema, tblName, false, true)) {
while (idxRs.next()) {
String idxName = idxRs.getString(IDX_NAME_IDX);
-
String colName = idxRs.getString(IDX_COL_NAME_IDX);
- if (idxName == null || colName == null)
+ // Skip {@code null} names and unique index used as PK.
+ if (idxName == null || colName == null || idxName.equals(uniqueIdxAsPkName))
continue;
QueryIndex idx = idxs.get(idxName);
http://git-wip-us.apache.org/repos/asf/ignite/blob/8de8fe50/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/OracleMetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/OracleMetadataDialect.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/OracleMetadataDialect.java
index 1722948..6d12c81 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/OracleMetadataDialect.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/OracleMetadataDialect.java
@@ -28,6 +28,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -61,21 +62,36 @@ import static java.sql.Types.VARCHAR;
public class OracleMetadataDialect extends DatabaseMetadataDialect {
/** SQL to get columns metadata. */
private static final String SQL_COLUMNS = "SELECT a.owner, a.table_name, a.column_name, a.nullable," +
- " a.data_type, a.data_precision, a.data_scale " +
- "FROM all_tab_columns a %s " +
+ " a.data_type, a.data_precision, a.data_scale" +
+ " FROM all_tab_columns a %s" +
" %s " +
" ORDER BY a.owner, a.table_name, a.column_id";
/** SQL to get list of PRIMARY KEYS columns. */
private static final String SQL_PRIMARY_KEYS = "SELECT b.column_name" +
" FROM all_constraints a" +
- " INNER JOIN all_cons_columns b ON a.owner = b.owner AND a.constraint_name = b.constraint_name" +
+ " INNER JOIN all_cons_columns b" +
+ " ON a.owner = b.owner" +
+ " AND a.constraint_name = b.constraint_name" +
" WHERE a.owner = ? and a.table_name = ? AND a.constraint_type = 'P'";
+ /** SQL to get list of UNIQUE INDEX columns. */
+ private static final String SQL_UNIQUE_INDEXES_KEYS = "SELECT a.index_name, b.column_name" +
+ " FROM all_indexes a" +
+ " INNER JOIN all_ind_columns b" +
+ " ON a.index_name = b.index_name" +
+ " AND a.table_owner = b.table_owner" +
+ " AND a.table_name = b.table_name" +
+ " AND a.owner = b.index_owner" +
+ " WHERE a.owner = ? AND a.table_name = ? AND a.uniqueness = 'UNIQUE'" +
+ " ORDER BY b.column_position";
+
/** SQL to get indexes metadata. */
private static final String SQL_INDEXES = "SELECT i.index_name, u.column_expression, i.column_name, i.descend" +
" FROM all_ind_columns i" +
- " LEFT JOIN user_ind_expressions u on u.index_name = i.index_name and i.table_name = u.table_name" +
+ " LEFT JOIN user_ind_expressions u" +
+ " ON u.index_name = i.index_name" +
+ " AND i.table_name = u.table_name" +
" WHERE i.index_owner = ? and i.table_name = ?" +
" ORDER BY i.index_name, i.column_position";
@@ -100,6 +116,12 @@ public class OracleMetadataDialect extends DatabaseMetadataDialect {
/** Numeric scale index. */
private static final int DATA_SCALE_IDX = 7;
+ /** Unique index name index. */
+ private static final int UNQ_IDX_NAME_IDX = 1;
+
+ /** Unique index column name index. */
+ private static final int UNQ_IDX_COL_NAME_IDX = 2;
+
/** Index name index. */
private static final int IDX_NAME_IDX = 1;
@@ -114,9 +136,9 @@ public class OracleMetadataDialect extends DatabaseMetadataDialect {
/** {@inheritDoc} */
@Override public Set<String> systemSchemas() {
- return new HashSet<>(Arrays.asList("ANONYMOUS", "CTXSYS", "DBSNMP", "EXFSYS", "LBACSYS", "MDSYS", "MGMT_VIEW",
- "OLAPSYS", "OWBSYS", "ORDPLUGINS", "ORDSYS", "OUTLN", "SI_INFORMTN_SCHEMA", "SYS", "SYSMAN", "SYSTEM",
- "TSMSYS", "WK_TEST", "WKSYS", "WKPROXY", "WMSYS", "XDB",
+ return new HashSet<>(Arrays.asList("ANONYMOUS", "APPQOSSYS", "CTXSYS", "DBSNMP", "EXFSYS", "LBACSYS", "MDSYS",
+ "MGMT_VIEW", "OLAPSYS", "OWBSYS", "ORDPLUGINS", "ORDSYS", "OUTLN", "SI_INFORMTN_SCHEMA", "SYS", "SYSMAN",
+ "SYSTEM", "TSMSYS", "WK_TEST", "WKSYS", "WKPROXY", "WMSYS", "XDB",
"APEX_040000", "APEX_PUBLIC_USER", "DIP", "FLOWS_30000", "FLOWS_FILES", "MDDATA", "ORACLE_OCM",
"SPATIAL_CSW_ADMIN_USR", "SPATIAL_WFS_ADMIN_USR", "XS$NULL",
@@ -235,11 +257,11 @@ public class OracleMetadataDialect extends DatabaseMetadataDialect {
* @throws SQLException If failed to retrieve primary key columns.
*/
private Set<String> primaryKeys(PreparedStatement stmt, String owner, String tbl) throws SQLException {
- Set<String> pkCols = new HashSet<>();
-
stmt.setString(1, owner);
stmt.setString(2, tbl);
+ Set<String> pkCols = new LinkedHashSet<>();
+
try (ResultSet pkRs = stmt.executeQuery()) {
while(pkRs.next())
pkCols.add(pkRs.getString(1));
@@ -249,24 +271,64 @@ public class OracleMetadataDialect extends DatabaseMetadataDialect {
}
/**
+ * Retrieve unique indexes with columns.
+ *
+ * @param stmt Prepared SQL statement to execute.
+ * @param owner DB owner.
+ * @param tbl Table name.
+ * @return Unique indexes.
+ * @throws SQLException If failed to retrieve unique indexes columns.
+ */
+ private Map<String, Set<String>> uniqueIndexes(PreparedStatement stmt, String owner, String tbl) throws SQLException {
+ stmt.setString(1, owner);
+ stmt.setString(2, tbl);
+
+ Map<String, Set<String>> uniqueIdxs = new LinkedHashMap<>();
+
+ try (ResultSet idxsRs = stmt.executeQuery()) {
+ while (idxsRs.next()) {
+ String idxName = idxsRs.getString(UNQ_IDX_NAME_IDX);
+ String colName = idxsRs.getString(UNQ_IDX_COL_NAME_IDX);
+
+ Set<String> idxCols = uniqueIdxs.get(idxName);
+
+ if (idxCols == null) {
+ idxCols = new LinkedHashSet<>();
+
+ uniqueIdxs.put(idxName, idxCols);
+ }
+
+ idxCols.add(colName);
+ }
+ }
+
+ return uniqueIdxs;
+ }
+
+ /**
* Retrieve index columns.
*
* @param stmt Prepared SQL statement to execute.
* @param owner DB owner.
* @param tbl Table name.
+ * @param uniqueIdxAsPk Optional unique index that used as PK.
* @return Indexes.
* @throws SQLException If failed to retrieve indexes columns.
*/
- private Collection<QueryIndex> indexes(PreparedStatement stmt, String owner, String tbl) throws SQLException {
- Map<String, QueryIndex> idxs = new LinkedHashMap<>();
-
+ private Collection<QueryIndex> indexes(PreparedStatement stmt, String owner, String tbl, String uniqueIdxAsPk) throws SQLException {
stmt.setString(1, owner);
stmt.setString(2, tbl);
+ Map<String, QueryIndex> idxs = new LinkedHashMap<>();
+
try (ResultSet idxsRs = stmt.executeQuery()) {
while (idxsRs.next()) {
String idxName = idxsRs.getString(IDX_NAME_IDX);
+ // Skip unique index used as PK.
+ if (idxName.equals(uniqueIdxAsPk))
+ continue;
+
QueryIndex idx = idxs.get(idxName);
if (idx == null) {
@@ -287,12 +349,9 @@ public class OracleMetadataDialect extends DatabaseMetadataDialect {
}
/** {@inheritDoc} */
- @Override public Collection<DbTable> tables(Connection conn, List<String> schemas, boolean tblsOnly)
- throws SQLException {
- Collection<DbTable> tbls = new ArrayList<>();
-
+ @Override public Collection<DbTable> tables(Connection conn, List<String> schemas, boolean tblsOnly) throws SQLException {
PreparedStatement pkStmt = conn.prepareStatement(SQL_PRIMARY_KEYS);
-
+ PreparedStatement uniqueIdxsStmt = conn.prepareStatement(SQL_UNIQUE_INDEXES_KEYS);
PreparedStatement idxStmt = conn.prepareStatement(SQL_INDEXES);
if (schemas.isEmpty())
@@ -300,16 +359,13 @@ public class OracleMetadataDialect extends DatabaseMetadataDialect {
Set<String> sysSchemas = systemSchemas();
+ Collection<DbTable> tbls = new ArrayList<>();
+
try (Statement colsStmt = conn.createStatement()) {
for (String schema: schemas) {
if (systemSchemas().contains(schema) || (schema != null && schema.startsWith("FLOWS_")))
continue;
- Collection<DbColumn> cols = new ArrayList<>();
-
- Set<String> pkCols = Collections.emptySet();
- Collection<QueryIndex> idxs = Collections.emptyList();
-
String sql = String.format(SQL_COLUMNS,
tblsOnly ? "INNER JOIN all_tables b on a.table_name = b.table_name and a.owner = b.owner" : "",
schema != null ? String.format(" WHERE a.owner = '%s' ", schema) : "");
@@ -320,6 +376,10 @@ public class OracleMetadataDialect extends DatabaseMetadataDialect {
boolean first = true;
+ Set<String> pkCols = Collections.emptySet();
+ Collection<DbColumn> cols = new ArrayList<>();
+ Collection<QueryIndex> idxs = Collections.emptyList();
+
while (colsRs.next()) {
String owner = colsRs.getString(OWNER_IDX);
String tbl = colsRs.getString(TBL_NAME_IDX);
@@ -339,7 +399,17 @@ public class OracleMetadataDialect extends DatabaseMetadataDialect {
prevTbl = tbl;
cols = new ArrayList<>();
pkCols = primaryKeys(pkStmt, owner, tbl);
- idxs = indexes(idxStmt, owner, tbl);
+
+ Map.Entry<String, Set<String>> uniqueIdxAsPk = null;
+
+ if (pkCols.isEmpty()) {
+ uniqueIdxAsPk = uniqueIndexAsPk(uniqueIndexes(uniqueIdxsStmt, owner, tbl));
+
+ if (uniqueIdxAsPk != null)
+ pkCols.addAll(uniqueIdxAsPk.getValue());
+ }
+
+ idxs = indexes(idxStmt, owner, tbl, uniqueIdxAsPk != null ? uniqueIdxAsPk.getKey() : null);
}
String colName = colsRs.getString(COL_NAME_IDX);
[20/42] ignite git commit: IGNITE-5325: CREATE TABLE: added
"cacheGroup" property. This closes #2099.
Posted by ag...@apache.org.
IGNITE-5325: CREATE TABLE: added "cacheGroup" property. This closes #2099.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/45bb5b3a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/45bb5b3a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/45bb5b3a
Branch: refs/heads/ignite-5267-merge-ea
Commit: 45bb5b3a2faca318ede6dd194bd2fb7fb9898d7c
Parents: 5c77dab
Author: Alexander Paschenko <al...@gmail.com>
Authored: Thu Jun 8 13:00:34 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Jun 8 13:00:34 2017 +0300
----------------------------------------------------------------------
.../processors/query/GridQueryProcessor.java | 9 ++++-
.../query/h2/ddl/DdlStatementsProcessor.java | 3 +-
.../query/h2/sql/GridSqlCreateTable.java | 20 +++++++++-
.../query/h2/sql/GridSqlQueryParser.java | 10 +++++
.../cache/index/H2DynamicTableSelfTest.java | 39 +++++++++++++++-----
5 files changed, 65 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/45bb5b3a/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 4311b12..dd07584 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
@@ -1278,6 +1278,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
* @param schemaName Schema name to create table in.
* @param entity Entity to create table from.
* @param templateName Template name.
+ * @param cacheGroup Cache group name.
* @param affinityKey Affinity key column name.
* @param atomicityMode Atomicity mode.
* @param backups Backups.
@@ -1285,8 +1286,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
* @throws IgniteCheckedException If failed.
*/
@SuppressWarnings("unchecked")
- public void dynamicTableCreate(String schemaName, QueryEntity entity, String templateName, String affinityKey,
- @Nullable CacheAtomicityMode atomicityMode, int backups, boolean ifNotExists) throws IgniteCheckedException {
+ public void dynamicTableCreate(String schemaName, QueryEntity entity, String templateName, String cacheGroup,
+ String affinityKey, @Nullable CacheAtomicityMode atomicityMode, int backups, boolean ifNotExists)
+ throws IgniteCheckedException {
assert !F.isEmpty(templateName);
assert backups >= 0;
@@ -1307,6 +1309,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
ccfg.setName(QueryUtils.createTableCacheName(schemaName, entity.getTableName()));
+ if (!F.isEmpty(cacheGroup))
+ ccfg.setGroupName(cacheGroup);
+
if (atomicityMode != null)
ccfg.setAtomicityMode(atomicityMode);
http://git-wip-us.apache.org/repos/asf/ignite/blob/45bb5b3a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
index d6bcabd..65e402d 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
@@ -22,7 +22,6 @@ import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.QueryEntity;
import org.apache.ignite.cache.QueryIndex;
@@ -177,7 +176,7 @@ public class DdlStatementsProcessor {
if (err != null)
throw err;
- ctx.query().dynamicTableCreate(cmd.schemaName(), e, cmd.templateName(),
+ ctx.query().dynamicTableCreate(cmd.schemaName(), e, cmd.templateName(), cmd.cacheGroup(),
cmd.affinityKey(), cmd.atomicityMode(), cmd.backups(), cmd.ifNotExists());
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/45bb5b3a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlCreateTable.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlCreateTable.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlCreateTable.java
index edced6b..fa76123 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlCreateTable.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlCreateTable.java
@@ -17,11 +17,10 @@
package org.apache.ignite.internal.processors.query.h2.sql;
-import org.apache.ignite.cache.CacheAtomicityMode;
-
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
+import org.apache.ignite.cache.CacheAtomicityMode;
/**
* CREATE TABLE statement.
@@ -38,6 +37,9 @@ public class GridSqlCreateTable extends GridSqlStatement {
/** Cache name upon which new cache configuration for this table must be based. */
private String templateName;
+ /** Group to put new cache into. */
+ private String cacheGrp;
+
/** Atomicity mode for new cache. */
private CacheAtomicityMode atomicityMode;
@@ -74,6 +76,20 @@ public class GridSqlCreateTable extends GridSqlStatement {
}
/**
+ * @return Group to put new cache into.
+ */
+ public String cacheGroup() {
+ return cacheGrp;
+ }
+
+ /**
+ * @param cacheGrp Group to put new cache into.
+ */
+ public void cacheGroup(String cacheGrp) {
+ this.cacheGrp = cacheGrp;
+ }
+
+ /**
* @return Atomicity mode for new cache.
*/
public CacheAtomicityMode atomicityMode() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/45bb5b3a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
index d8baed3..0d6a0b2 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
@@ -405,6 +405,9 @@ public class GridSqlQueryParser {
private static final String PARAM_ATOMICITY = "ATOMICITY";
/** */
+ private static final String PARAM_CACHE_GROUP = "CACHEGROUP";
+
+ /** */
private static final String PARAM_AFFINITY_KEY = "AFFINITYKEY";
/** */
@@ -1051,6 +1054,13 @@ public class GridSqlQueryParser {
break;
+ case PARAM_CACHE_GROUP:
+ ensureNotEmpty(name, val);
+
+ res.cacheGroup(val);
+
+ break;
+
case PARAM_AFFINITY_KEY:
ensureNotEmpty(name, val);
http://git-wip-us.apache.org/repos/asf/ignite/blob/45bb5b3a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
index e4babba..2255fb8 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
@@ -105,7 +105,15 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
* @throws Exception if failed.
*/
public void testCreateTable() throws Exception {
- doTestCreateTable(CACHE_NAME, null);
+ doTestCreateTable(CACHE_NAME, null, null);
+ }
+
+ /**
+ * Test that {@code CREATE TABLE} actually creates new cache, H2 table and type descriptor on all nodes.
+ * @throws Exception if failed.
+ */
+ public void testCreateTableWithCacheGroup() throws Exception {
+ doTestCreateTable(CACHE_NAME, "MyGroup", null);
}
/**
@@ -114,7 +122,7 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
* @throws Exception if failed.
*/
public void testCreateTableReplicated() throws Exception {
- doTestCreateTable("REPLICATED", CacheMode.REPLICATED);
+ doTestCreateTable("REPLICATED", null, CacheMode.REPLICATED);
}
/**
@@ -123,7 +131,7 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
* @throws Exception if failed.
*/
public void testCreateTablePartitioned() throws Exception {
- doTestCreateTable("PARTITIONED", CacheMode.PARTITIONED);
+ doTestCreateTable("PARTITIONED", null, CacheMode.PARTITIONED);
}
/**
@@ -132,7 +140,7 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
* @throws Exception if failed.
*/
public void testCreateTableReplicatedCaseInsensitive() throws Exception {
- doTestCreateTable("replicated", CacheMode.REPLICATED);
+ doTestCreateTable("replicated", null, CacheMode.REPLICATED);
}
/**
@@ -141,7 +149,7 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
* @throws Exception if failed.
*/
public void testCreateTablePartitionedCaseInsensitive() throws Exception {
- doTestCreateTable("partitioned", CacheMode.PARTITIONED);
+ doTestCreateTable("partitioned", null, CacheMode.PARTITIONED);
}
/**
@@ -150,19 +158,21 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
* @throws Exception if failed.
*/
public void testCreateTableNoTemplate() throws Exception {
- doTestCreateTable(null, CacheMode.PARTITIONED);
+ doTestCreateTable(null, null, CacheMode.PARTITIONED);
}
/**
* Test that {@code CREATE TABLE} with given template cache name actually creates new cache,
* H2 table and type descriptor on all nodes, optionally with cache type check.
* @param tplCacheName Template cache name.
+ * @param cacheGrp Cache group name, or {@code null} if no group is set.
* @param mode Expected cache mode, or {@code null} if no check is needed.
*/
- private void doTestCreateTable(String tplCacheName, CacheMode mode) {
+ private void doTestCreateTable(String tplCacheName, String cacheGrp, CacheMode mode) {
executeDdl("CREATE TABLE \"Person\" (\"id\" int, \"city\" varchar," +
" \"name\" varchar, \"surname\" varchar, \"age\" int, PRIMARY KEY (\"id\", \"city\")) WITH " +
- (F.isEmpty(tplCacheName) ? "" : "\"template=" + tplCacheName + "\",") + "\"backups=10,atomicity=atomic\"");
+ (F.isEmpty(tplCacheName) ? "" : "\"template=" + tplCacheName + "\",") + "\"backups=10,atomicity=atomic\"" +
+ (F.isEmpty(cacheGrp) ? "" : ",\"cacheGroup=" + cacheGrp + '"'));
String cacheName = cacheName("Person");
@@ -184,6 +194,8 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
assertTrue(cacheDesc.sql());
+ assertEquals(cacheGrp, cacheDesc.groupDescriptor().groupName());
+
if (mode != null)
assertEquals(mode, cacheDesc.cacheConfiguration().getCacheMode());
@@ -236,7 +248,7 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
}
/**
- * Test that attempting to omit mandatory value of ATOMICITY parameter yields an error.
+ * Test that providing an invalid value of ATOMICITY parameter yields an error.
*/
public void testInvalidAtomicity() {
assertCreateTableWithParamsThrows("atomicity=InvalidValue",
@@ -244,6 +256,13 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
}
/**
+ * Test that attempting to omit mandatory value of CACHEGROUP parameter yields an error.
+ */
+ public void testEmptyCacheGroup() {
+ assertCreateTableWithParamsThrows("cachegroup=", "Parameter value cannot be empty: CACHEGROUP");
+ }
+
+ /**
* Test that attempting to {@code CREATE TABLE} that already exists does not yield an error if the statement
* contains {@code IF NOT EXISTS} clause.
* @throws Exception if failed.
@@ -405,7 +424,7 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
e.setValueType("City");
queryProcessor(client()).dynamicTableCreate("PUBLIC", e, CacheMode.PARTITIONED.name(), null,
- CacheAtomicityMode.ATOMIC, 10, false);
+ null, CacheAtomicityMode.ATOMIC, 10, false);
return null;
}
[09/42] ignite git commit: ignite-5196 Need use concurrent collection
for GridDiscoveryManager.registeredCaches
Posted by ag...@apache.org.
ignite-5196 Need use concurrent collection for GridDiscoveryManager.registeredCaches
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/56768a2b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/56768a2b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/56768a2b
Branch: refs/heads/ignite-5267-merge-ea
Commit: 56768a2b2f50892537c91fa46db6b887660c9932
Parents: 3ab4b9a
Author: Igor Seliverstov <gv...@gmail.com>
Authored: Wed Jun 7 11:10:47 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jun 7 11:10:47 2017 +0300
----------------------------------------------------------------------
.../discovery/GridDiscoveryManager.java | 32 ++--
.../handlers/cache/GridCacheCommandHandler.java | 4 +-
.../top/GridTopologyCommandHandler.java | 10 +-
.../ignite/internal/ClusterGroupSelfTest.java | 100 ++++++++++++
.../top/CacheTopologyCommandHandlerTest.java | 152 +++++++++++++++++++
.../testsuites/IgniteRestHandlerTestSuite.java | 2 +
6 files changed, 279 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/56768a2b/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 8c2bd8c..c91ff74 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
@@ -54,6 +54,7 @@ import org.apache.ignite.cache.CacheMetrics;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cluster.ClusterMetrics;
import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.Event;
import org.apache.ignite.internal.ClusterMetricsSnapshot;
@@ -70,6 +71,7 @@ import org.apache.ignite.internal.managers.communication.GridIoManager;
import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheGroupDescriptor;
+import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
import org.apache.ignite.internal.processors.jobmetrics.GridJobMetrics;
import org.apache.ignite.internal.processors.security.SecurityContext;
@@ -254,7 +256,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
private final Collection<IgniteInClosure<ClusterNode>> locNodeInitLsnrs = new ArrayList<>();
/** Map of dynamic cache filters. */
- private Map<String, CachePredicate> registeredCaches = new HashMap<>();
+ private ConcurrentMap<String, CachePredicate> registeredCaches = new ConcurrentHashMap<>();
/** */
private Map<Integer, CacheGroupAffinity> registeredCacheGrps = new HashMap<>();
@@ -353,7 +355,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
}
/**
- * Adds dynamic cache filter.
+ * Called from discovery thread. Adds dynamic cache filter.
*
* @param grpId Cache group ID.
* @param cacheName Cache name.
@@ -377,7 +379,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
}
/**
- * Removes dynamic cache filter.
+ * Called from discovery thread. Removes dynamic cache filter.
*
* @param cacheName Cache name.
*/
@@ -404,7 +406,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
}
/**
- * Removes near node ID from cache filter.
+ * Called from discovery thread. Removes near node ID from cache filter.
*
* @param cacheName Cache name.
* @param clientNodeId Near node ID.
@@ -419,6 +421,8 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
}
/**
+ * Called from discovery thread.
+ *
* @return Client nodes map.
*/
public Map<String, Map<UUID, Boolean>> clientNodesMap() {
@@ -439,6 +443,8 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
}
/**
+ * Called from discovery thread.
+ *
* @param leftNodeId Left node ID.
*/
private void updateClientNodes(UUID leftNodeId) {
@@ -1837,17 +1843,17 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
* @param node Node to check.
* @return Public cache names accessible on the given node.
*/
- public Map<String, CacheMode> nodeCaches(ClusterNode node) {
- Map<String, CacheMode> caches = U.newHashMap(registeredCaches.size());
+ public Map<String, CacheConfiguration> nodePublicCaches(ClusterNode node) {
+ Map<String, CacheConfiguration> caches = U.newHashMap(registeredCaches.size());
- for (Map.Entry<String, CachePredicate> entry : registeredCaches.entrySet()) {
- String cacheName = entry.getKey();
+ for (DynamicCacheDescriptor cacheDesc : ctx.cache().cacheDescriptors().values()) {
+ if (!cacheDesc.cacheType().userCache())
+ continue;
- CachePredicate pred = entry.getValue();
+ CachePredicate p = registeredCaches.get(cacheDesc.cacheName());
- if (!CU.isSystemCache(cacheName) && !CU.isIgfsCache(ctx.config(), cacheName) &&
- pred != null && pred.cacheNode(node))
- caches.put(cacheName, pred.aff.cacheMode);
+ if (p != null && p.cacheNode(node))
+ caches.put(cacheDesc.cacheName(), cacheDesc.cacheConfiguration());
}
return caches;
@@ -2059,6 +2065,8 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
}
/**
+ * Called from discovery thread.
+ *
* @param loc Local node.
* @param topSnapshot Topology snapshot.
* @return Newly created discovery cache.
http://git-wip-us.apache.org/repos/asf/ignite/blob/56768a2b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
index da260b1..bfc5282 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
@@ -943,10 +943,10 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter {
boolean sameCaches = true;
- int hash = discovery.nodeCaches(F.first(subgrid)).hashCode();
+ Set<String> caches = discovery.nodePublicCaches(F.first(subgrid)).keySet();
for (int i = 1; i < subgrid.size(); i++) {
- if (hash != discovery.nodeCaches(subgrid.get(i)).hashCode()) {
+ if (!caches.equals(discovery.nodePublicCaches(subgrid.get(i)).keySet())) {
sameCaches = false;
break;
http://git-wip-us.apache.org/repos/asf/ignite/blob/56768a2b/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 d9e023d..fa677c7 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
@@ -27,14 +27,12 @@ import java.util.Iterator;
import java.util.Map;
import java.util.UUID;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cluster.ClusterMetrics;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.client.GridClientCacheMode;
-import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
import org.apache.ignite.internal.processors.port.GridPortRecord;
import org.apache.ignite.internal.processors.rest.GridRestCommand;
import org.apache.ignite.internal.processors.rest.GridRestProtocol;
@@ -217,14 +215,12 @@ public class GridTopologyCommandHandler extends GridRestCommandHandlerAdapter {
nodeBean.setTcpAddresses(nonEmptyList(node.<Collection<String>>attribute(ATTR_REST_TCP_ADDRS)));
nodeBean.setTcpHostNames(nonEmptyList(node.<Collection<String>>attribute(ATTR_REST_TCP_HOST_NAMES)));
- GridCacheProcessor cacheProc = ctx.cache();
-
- Map<String, CacheMode> nodeCaches = ctx.discovery().nodeCaches(node);
+ Map<String, CacheConfiguration> nodeCaches = ctx.discovery().nodePublicCaches(node);
Collection<GridClientCacheBean> caches = new ArrayList<>(nodeCaches.size());
- for (String cacheName : nodeCaches.keySet())
- caches.add(createCacheBean(cacheProc.cacheConfiguration(cacheName)));
+ for (CacheConfiguration ccfg : nodeCaches.values())
+ caches.add(createCacheBean(ccfg));
nodeBean.setCaches(caches);
http://git-wip-us.apache.org/repos/asf/ignite/blob/56768a2b/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupSelfTest.java
index 142626b..9df561a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupSelfTest.java
@@ -19,14 +19,21 @@ package org.apache.ignite.internal;
import java.util.Collection;
import java.util.LinkedList;
+import java.util.Random;
+import java.util.Set;
import java.util.UUID;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
import org.apache.ignite.Ignite;
import org.apache.ignite.Ignition;
import org.apache.ignite.cluster.ClusterGroup;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.marshaller.Marshaller;
+import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonTest;
/**
@@ -274,6 +281,99 @@ public class ClusterGroupSelfTest extends ClusterGroupAbstractTest {
/**
* @throws Exception If failed.
*/
+ public void testForCacheNodesOnDynamicCacheCreateDestroy() throws Exception {
+ Random rnd = ThreadLocalRandom.current();
+
+ final AtomicReference<Exception> ex = new AtomicReference<>();
+
+ IgniteInternalFuture fut = runCacheCreateDestroyTask(ex);
+
+ while (!fut.isDone())
+ ignite.cluster().forCacheNodes("cache" + rnd.nextInt(16)).nodes();
+
+ if (ex.get() != null)
+ throw ex.get();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testForClientNodesOnDynamicCacheCreateDestroy() throws Exception {
+ Random rnd = ThreadLocalRandom.current();
+
+ final AtomicReference<Exception> ex = new AtomicReference<>();
+
+ IgniteInternalFuture fut = runCacheCreateDestroyTask(ex);
+
+ while (!fut.isDone())
+ ignite.cluster().forClientNodes("cache" + rnd.nextInt(16)).nodes();
+
+ if (ex.get() != null)
+ throw ex.get();
+ }
+
+ /**
+ * @param exHldr Exception holder.
+ * @return Task future.
+ */
+ private IgniteInternalFuture runCacheCreateDestroyTask(final AtomicReference<Exception> exHldr) {
+ final long deadline = System.currentTimeMillis() + 5000;
+
+ final AtomicInteger cntr = new AtomicInteger();
+
+ return GridTestUtils.runMultiThreadedAsync(new Runnable() {
+ @Override public void run() {
+ int startIdx = cntr.getAndAdd(4);
+ int idx = 0;
+ boolean start = true;
+
+ Set<String> caches = U.newHashSet(4);
+
+ while (System.currentTimeMillis() < deadline) {
+ try {
+ if (start) {
+ caches.add("cache" + (startIdx + idx));
+ ignite.createCache("cache" + (startIdx + idx));
+ }
+ else {
+ ignite.destroyCache("cache" + (startIdx + idx));
+ caches.remove("cache" + (startIdx + idx));
+ }
+
+ if ((idx = (idx + 1) % 4) == 0)
+ start = !start;
+ }
+ catch (Exception e) {
+ addException(exHldr, e);
+
+ break;
+ }
+ }
+
+ for (String cache : caches) {
+ try {
+ ignite.destroyCache(cache);
+ }
+ catch (Exception e) {
+ addException(exHldr, e);
+ }
+ }
+ }
+ }, 4, "cache-start-destroy");
+ }
+
+ /**
+ * @param exHldr Exception holder.
+ * @param ex Exception.
+ */
+ private void addException(AtomicReference<Exception> exHldr, Exception ex) {
+ if (exHldr.get() != null || !exHldr.compareAndSet(null, ex))
+ exHldr.get().addSuppressed(ex);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testEmptyGroup() throws Exception {
ClusterGroup emptyGrp = ignite.cluster().forAttribute("nonExistent", "val");
http://git-wip-us.apache.org/repos/asf/ignite/blob/56768a2b/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/top/CacheTopologyCommandHandlerTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/top/CacheTopologyCommandHandlerTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/top/CacheTopologyCommandHandlerTest.java
new file mode 100644
index 0000000..5d7dfd7
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/top/CacheTopologyCommandHandlerTest.java
@@ -0,0 +1,152 @@
+/*
+ * 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.rest.handlers.top;
+
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.ConnectorConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.processors.rest.GridRestCommand;
+import org.apache.ignite.internal.processors.rest.request.GridRestTopologyRequest;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ *
+ */
+public class CacheTopologyCommandHandlerTest extends GridCommonAbstractTest {
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration() throws Exception {
+ // Discovery config.
+ TcpDiscoverySpi disco = new TcpDiscoverySpi()
+ .setIpFinder(new TcpDiscoveryVmIpFinder(true))
+ .setJoinTimeout(5000);
+
+ // Cache config.
+ CacheConfiguration ccfg = new CacheConfiguration("cache*")
+ .setCacheMode(CacheMode.LOCAL)
+ .setAtomicityMode(CacheAtomicityMode.ATOMIC);
+
+ ConnectorConfiguration clnCfg = new ConnectorConfiguration()
+ .setHost("127.0.0.1");
+
+ return super.getConfiguration()
+ .setLocalHost("127.0.0.1")
+ .setConnectorConfiguration(clnCfg)
+ .setDiscoverySpi(disco)
+ .setCacheConfiguration(ccfg);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ super.afterTest();
+
+ stopAllGrids();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testTopologyCommandOnDynamicCacheCreateDestroy() throws Exception {
+ GridRestTopologyRequest req = new GridRestTopologyRequest();
+ req.command(GridRestCommand.TOPOLOGY);
+
+ topologyCommandOnDynamicCacheCreateDestroy(startGrid(), req);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testNodeCommandOnDynamicCacheCreateDestroy1() throws Exception {
+ Ignite node = startGrid();
+
+ GridRestTopologyRequest req = new GridRestTopologyRequest();
+ req.command(GridRestCommand.NODE);
+ req.nodeId(node.cluster().localNode().id());
+
+ topologyCommandOnDynamicCacheCreateDestroy(node, req);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testNodeCommandOnDynamicCacheCreateDestroy2() throws Exception {
+ Ignite node = startGrid();
+
+ GridRestTopologyRequest req = new GridRestTopologyRequest();
+ req.command(GridRestCommand.NODE);
+ req.nodeIp("127.0.0.1");
+
+ topologyCommandOnDynamicCacheCreateDestroy(node, req);
+ }
+
+ /**
+ * @param node Ignite node.
+ * @param req Rest request.
+ * @throws Exception If failed.
+ */
+ private void topologyCommandOnDynamicCacheCreateDestroy(final Ignite node, GridRestTopologyRequest req) throws Exception {
+ GridTopologyCommandHandler hnd = new GridTopologyCommandHandler(((IgniteKernal)node).context());
+
+ final AtomicReference<Exception> ex = new AtomicReference<>();
+
+ final long deadline = System.currentTimeMillis() + 5000;
+
+ final AtomicInteger cntr = new AtomicInteger();
+
+ IgniteInternalFuture fut = GridTestUtils.runMultiThreadedAsync(new Runnable() {
+ @Override public void run() {
+ int startIdx = cntr.getAndAdd(4);
+ int idx = 0;
+ boolean start = true;
+
+ while (System.currentTimeMillis() < deadline) {
+ try {
+ if (start)
+ node.createCache("cache" + (startIdx + idx));
+ else
+ node.destroyCache("cache" + (startIdx + idx));
+
+ if ((idx = (idx + 1) % 4) == 0)
+ start = !start;
+ }
+ catch (Exception e) {
+ if (ex.get() != null || !ex.compareAndSet(null, e))
+ ex.get().addSuppressed(e);
+
+ break;
+ }
+ }
+ }
+ }, 4, "cache-start-destroy");
+
+ while (!fut.isDone())
+ hnd.handleAsync(req).get();
+
+ if (ex.get() != null)
+ throw ex.get();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/56768a2b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteRestHandlerTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteRestHandlerTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteRestHandlerTestSuite.java
index 6263e8b..f3e5828 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteRestHandlerTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteRestHandlerTestSuite.java
@@ -22,6 +22,7 @@ import org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheAtomic
import org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandlerSelfTest;
import org.apache.ignite.internal.processors.rest.handlers.log.GridLogCommandHandlerTest;
import org.apache.ignite.internal.processors.rest.handlers.query.GridQueryCommandHandlerTest;
+import org.apache.ignite.internal.processors.rest.handlers.top.CacheTopologyCommandHandlerTest;
/**
* REST support tests.
@@ -38,6 +39,7 @@ public class IgniteRestHandlerTestSuite extends TestSuite {
suite.addTestSuite(GridCacheAtomicCommandHandlerSelfTest.class);
suite.addTestSuite(GridLogCommandHandlerTest.class);
suite.addTestSuite(GridQueryCommandHandlerTest.class);
+ suite.addTestSuite(CacheTopologyCommandHandlerTest.class);
return suite;
}
[38/42] ignite git commit: IGNITE-5431: Better error message in case
of SQL cache mode mismtach. This closes #2103.
Posted by ag...@apache.org.
IGNITE-5431: Better error message in case of SQL cache mode mismtach. This closes #2103.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/72e2f883
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/72e2f883
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/72e2f883
Branch: refs/heads/ignite-5267-merge-ea
Commit: 72e2f883e1a9a1e1fa2d5c275be143163e1c16ee
Parents: 39c5b5d
Author: Alexander Paschenko <al...@gmail.com>
Authored: Fri Jun 9 16:19:37 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Fri Jun 9 16:19:37 2017 +0300
----------------------------------------------------------------------
.../processors/cache/ClusterCachesInfo.java | 30 +++++++++++++-------
.../processors/cache/GridCacheAttributes.java | 17 ++---------
.../cache/index/H2DynamicTableSelfTest.java | 3 +-
3 files changed, 23 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/72e2f883/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
index 0fcc740..d5718f8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
@@ -145,22 +145,33 @@ class ClusterCachesInfo {
if (gridData != null && gridData.conflictErr != null)
throw new IgniteCheckedException(gridData.conflictErr);
- if (checkConsistency && joinDiscoData != null && gridData != null) {
+ if (joinDiscoData != null && gridData != null) {
for (CacheJoinNodeDiscoveryData.CacheInfo locCacheInfo : joinDiscoData.caches().values()) {
CacheConfiguration locCfg = locCacheInfo.config();
CacheData cacheData = gridData.gridData.caches().get(locCfg.getName());
- if (cacheData != null)
- checkCache(locCacheInfo, cacheData, cacheData.receivedFrom());
+ if (cacheData != null) {
+ if (!F.eq(cacheData.sql(), locCacheInfo.sql())) {
+ throw new IgniteCheckedException("Cache configuration mismatch (local cache was created " +
+ "via " + (locCacheInfo.sql() ? "CREATE TABLE" : "Ignite API") + ", while remote cache " +
+ "was created via " + (cacheData.sql() ? "CREATE TABLE" : "Ignite API") + "): " +
+ locCacheInfo.config().getName());
+ }
+
+ if (checkConsistency)
+ checkCache(locCacheInfo, cacheData, cacheData.receivedFrom());
+ }
- validateStartCacheConfiguration(locCfg);
+ if (checkConsistency)
+ validateStartCacheConfiguration(locCfg);
}
}
joinDiscoData = null;
gridData = null;
}
+
/**
* Checks that remote caches has configuration compatible with the local.
*
@@ -172,8 +183,8 @@ class ClusterCachesInfo {
@SuppressWarnings("unchecked")
private void checkCache(CacheJoinNodeDiscoveryData.CacheInfo locInfo, CacheData rmtData, UUID rmt)
throws IgniteCheckedException {
- GridCacheAttributes rmtAttr = new GridCacheAttributes(rmtData.cacheConfiguration(), rmtData.sql());
- GridCacheAttributes locAttr = new GridCacheAttributes(locInfo.config(), locInfo.sql());
+ GridCacheAttributes rmtAttr = new GridCacheAttributes(rmtData.cacheConfiguration());
+ GridCacheAttributes locAttr = new GridCacheAttributes(locInfo.config());
CU.checkAttributeMismatch(log, rmtAttr.cacheName(), rmt, "cacheMode", "Cache mode",
locAttr.cacheMode(), rmtAttr.cacheMode(), true);
@@ -181,9 +192,6 @@ class ClusterCachesInfo {
CU.checkAttributeMismatch(log, rmtAttr.groupName(), rmt, "groupName", "Cache group name",
locAttr.groupName(), rmtAttr.groupName(), true);
- CU.checkAttributeMismatch(log, rmtAttr.cacheName(), rmt, "sql", "SQL flag",
- locAttr.sql(), rmtAttr.sql(), true);
-
if (rmtAttr.cacheMode() != LOCAL) {
CU.checkAttributeMismatch(log, rmtAttr.cacheName(), rmt, "interceptor", "Cache Interceptor",
locAttr.interceptorClassName(), rmtAttr.interceptorClassName(), true);
@@ -1219,8 +1227,8 @@ class ClusterCachesInfo {
*/
private void validateCacheGroupConfiguration(CacheConfiguration cfg, CacheConfiguration startCfg)
throws IgniteCheckedException {
- GridCacheAttributes attr1 = new GridCacheAttributes(cfg, false);
- GridCacheAttributes attr2 = new GridCacheAttributes(startCfg, false);
+ GridCacheAttributes attr1 = new GridCacheAttributes(cfg);
+ GridCacheAttributes attr2 = new GridCacheAttributes(startCfg);
CU.validateCacheGroupsAttributesMismatch(log, cfg, startCfg, "cacheMode", "Cache mode",
cfg.getCacheMode(), startCfg.getCacheMode(), true);
http://git-wip-us.apache.org/repos/asf/ignite/blob/72e2f883/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java
index 7d97159..dca4286 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java
@@ -17,7 +17,6 @@
package org.apache.ignite.internal.processors.cache;
-import java.io.Externalizable;
import java.io.Serializable;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
@@ -47,17 +46,12 @@ public class GridCacheAttributes implements Serializable {
/** Cache configuration. */
private CacheConfiguration ccfg;
- /** SQL flag - whether the cache is created by an SQL command such as {@code CREATE TABLE}. */
- private boolean sql;
-
/**
* @param cfg Cache configuration.
- * @param sql SQL flag.
+ *
*/
- public GridCacheAttributes(CacheConfiguration cfg, boolean sql) {
+ public GridCacheAttributes(CacheConfiguration cfg) {
ccfg = cfg;
-
- this.sql = sql;
}
/**
@@ -293,13 +287,6 @@ public class GridCacheAttributes implements Serializable {
}
/**
- * @return SQL flag.
- */
- public boolean sql() {
- return sql;
- }
-
- /**
* @param obj Object to get class of.
* @return Class name or {@code null}.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/72e2f883/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
index 2255fb8..ca1c937 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
@@ -399,7 +399,8 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
return null;
}
- }, IgniteException.class, "SQL flag mismatch (fix sql flag in cache configuration");
+ }, IgniteException.class, "Cache configuration mismatch (local cache was created via Ignite API, while " +
+ "remote cache was created via CREATE TABLE): SQL_PUBLIC_Person");
}
/**
[21/42] ignite git commit: IGNITE-5372 .NET:
IgniteConfiguration.LongQueryWarningTimeout
Posted by ag...@apache.org.
IGNITE-5372 .NET: IgniteConfiguration.LongQueryWarningTimeout
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d5ecf0a7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d5ecf0a7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d5ecf0a7
Branch: refs/heads/ignite-5267-merge-ea
Commit: d5ecf0a7e1683a060cd5c0b1dd2ba0d49c678947
Parents: 45bb5b3
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Jun 8 13:29:21 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Jun 8 13:29:21 2017 +0300
----------------------------------------------------------------------
.../utils/PlatformConfigurationUtils.java | 6 ++++++
.../Cache/CacheConfigurationTest.cs | 8 ++++++++
.../IgniteConfigurationSerializerTest.cs | 5 +++--
.../IgniteConfigurationTest.cs | 4 ++++
.../Cache/Configuration/CacheConfiguration.cs | 9 +++++++++
.../Apache.Ignite.Core/IgniteConfiguration.cs | 20 ++++++++++++++++++++
.../IgniteConfigurationSection.xsd | 7 +++++++
7 files changed, 57 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d5ecf0a7/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 176d77b..575dead 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
@@ -151,6 +151,7 @@ public class PlatformConfigurationUtils {
ccfg.setStoreKeepBinary(in.readBoolean());
ccfg.setLoadPreviousValue(in.readBoolean());
ccfg.setDefaultLockTimeout(in.readLong());
+ //noinspection deprecation
ccfg.setLongQueryWarningTimeout(in.readLong());
ccfg.setMaxConcurrentAsyncOperations(in.readInt());
ccfg.setName(in.readString());
@@ -563,6 +564,8 @@ public class PlatformConfigurationUtils {
cfg.setFailureDetectionTimeout(in.readLong());
if (in.readBoolean())
cfg.setClientFailureDetectionTimeout(in.readLong());
+ if (in.readBoolean())
+ cfg.setLongQueryWarningTimeout(in.readLong());
// Thread pools.
if (in.readBoolean())
@@ -808,6 +811,7 @@ public class PlatformConfigurationUtils {
writer.writeBoolean(ccfg.isStoreKeepBinary());
writer.writeBoolean(ccfg.isLoadPreviousValue());
writer.writeLong(ccfg.getDefaultLockTimeout());
+ //noinspection deprecation
writer.writeLong(ccfg.getLongQueryWarningTimeout());
writer.writeInt(ccfg.getMaxConcurrentAsyncOperations());
writer.writeString(ccfg.getName());
@@ -1003,6 +1007,8 @@ public class PlatformConfigurationUtils {
w.writeLong(cfg.getFailureDetectionTimeout());
w.writeBoolean(true);
w.writeLong(cfg.getClientFailureDetectionTimeout());
+ w.writeBoolean(true);
+ w.writeLong(cfg.getLongQueryWarningTimeout());
// Thread pools.
w.writeBoolean(true);
http://git-wip-us.apache.org/repos/asf/ignite/blob/d5ecf0a7/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
index b674b0e..1f6dbcf 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
@@ -203,7 +203,9 @@ namespace Apache.Ignite.Core.Tests.Cache
Assert.AreEqual(CacheConfiguration.DefaultKeepVinaryInStore, cfg.KeepBinaryInStore);
Assert.AreEqual(CacheConfiguration.DefaultLoadPreviousValue, cfg.LoadPreviousValue);
Assert.AreEqual(CacheConfiguration.DefaultLockTimeout, cfg.LockTimeout);
+#pragma warning disable 618
Assert.AreEqual(CacheConfiguration.DefaultLongQueryWarningTimeout, cfg.LongQueryWarningTimeout);
+#pragma warning restore 618
Assert.AreEqual(CacheConfiguration.DefaultMaxConcurrentAsyncOperations, cfg.MaxConcurrentAsyncOperations);
Assert.AreEqual(CacheConfiguration.DefaultReadFromBackup, cfg.ReadFromBackup);
Assert.AreEqual(CacheConfiguration.DefaultRebalanceBatchSize, cfg.RebalanceBatchSize);
@@ -233,7 +235,9 @@ namespace Apache.Ignite.Core.Tests.Cache
Assert.AreEqual(x.KeepBinaryInStore, y.KeepBinaryInStore);
Assert.AreEqual(x.LoadPreviousValue, y.LoadPreviousValue);
Assert.AreEqual(x.LockTimeout, y.LockTimeout);
+#pragma warning disable 618
Assert.AreEqual(x.LongQueryWarningTimeout, y.LongQueryWarningTimeout);
+#pragma warning restore 618
Assert.AreEqual(x.MaxConcurrentAsyncOperations, y.MaxConcurrentAsyncOperations);
Assert.AreEqual(x.ReadFromBackup, y.ReadFromBackup);
Assert.AreEqual(x.RebalanceBatchSize, y.RebalanceBatchSize);
@@ -487,7 +491,9 @@ namespace Apache.Ignite.Core.Tests.Cache
Name = name ?? CacheName,
MaxConcurrentAsyncOperations = 3,
WriteBehindFlushThreadCount = 4,
+#pragma warning disable 618
LongQueryWarningTimeout = TimeSpan.FromSeconds(5),
+#pragma warning restore 618
LoadPreviousValue = true,
CopyOnRead = true,
WriteBehindFlushFrequency = TimeSpan.FromSeconds(6),
@@ -577,7 +583,9 @@ namespace Apache.Ignite.Core.Tests.Cache
Name = name ?? CacheName2,
MaxConcurrentAsyncOperations = 3,
WriteBehindFlushThreadCount = 4,
+#pragma warning disable 618
LongQueryWarningTimeout = TimeSpan.FromSeconds(5),
+#pragma warning restore 618
LoadPreviousValue = true,
CopyOnRead = true,
WriteBehindFlushFrequency = TimeSpan.FromSeconds(6),
http://git-wip-us.apache.org/repos/asf/ignite/blob/d5ecf0a7/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 3229de9..2a8e907 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
@@ -67,7 +67,7 @@ namespace Apache.Ignite.Core.Tests
[Test]
public void TestPredefinedXml()
{
- var xml = @"<igniteConfig workDirectory='c:' JvmMaxMemoryMb='1024' MetricsLogFrequency='0:0:10' isDaemon='true' isLateAffinityAssignment='false' springConfigUrl='c:\myconfig.xml' autoGenerateIgniteInstanceName='true' peerAssemblyLoadingMode='CurrentAppDomain'>
+ var xml = @"<igniteConfig workDirectory='c:' JvmMaxMemoryMb='1024' MetricsLogFrequency='0:0:10' isDaemon='true' isLateAffinityAssignment='false' springConfigUrl='c:\myconfig.xml' autoGenerateIgniteInstanceName='true' peerAssemblyLoadingMode='CurrentAppDomain' longQueryWarningTimeout='1:2:3'>
<localhost>127.1.1.1</localhost>
<binaryConfiguration compactFooter='false' keepDeserialized='true'>
<nameMapper type='Apache.Ignite.Core.Tests.IgniteConfigurationSerializerTest+NameMapper' bar='testBar' />
@@ -167,6 +167,7 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(new[] {42, EventType.TaskFailed, EventType.JobFinished}, cfg.IncludedEventTypes);
Assert.AreEqual(@"c:\myconfig.xml", cfg.SpringConfigUrl);
Assert.IsTrue(cfg.AutoGenerateIgniteInstanceName);
+ Assert.AreEqual(new TimeSpan(1, 2, 3), cfg.LongQueryWarningTimeout);
Assert.AreEqual("secondCache", cfg.CacheConfiguration.Last().Name);
@@ -663,7 +664,6 @@ namespace Apache.Ignite.Core.Tests
KeepBinaryInStore = true,
LoadPreviousValue = true,
LockTimeout = TimeSpan.FromSeconds(56),
- LongQueryWarningTimeout = TimeSpan.FromSeconds(99),
MaxConcurrentAsyncOperations = 24,
QueryEntities = new[]
{
@@ -816,6 +816,7 @@ namespace Apache.Ignite.Core.Tests
Logger = new IgniteNLogLogger(),
FailureDetectionTimeout = TimeSpan.FromMinutes(2),
ClientFailureDetectionTimeout = TimeSpan.FromMinutes(3),
+ LongQueryWarningTimeout = TimeSpan.FromDays(4),
PluginConfigurations = new[] {new TestIgnitePluginConfiguration() },
EventStorageSpi = new MemoryEventStorageSpi
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/d5ecf0a7/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 9d19a23..9341c95 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
@@ -174,6 +174,7 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(cfg.FailureDetectionTimeout, resCfg.FailureDetectionTimeout);
Assert.AreEqual(cfg.ClientFailureDetectionTimeout, resCfg.ClientFailureDetectionTimeout);
+ Assert.AreEqual(cfg.LongQueryWarningTimeout, resCfg.LongQueryWarningTimeout);
Assert.AreEqual(cfg.PublicThreadPoolSize, resCfg.PublicThreadPoolSize);
Assert.AreEqual(cfg.StripedThreadPoolSize, resCfg.StripedThreadPoolSize);
@@ -479,6 +480,8 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(IgniteConfiguration.DefaultFailureDetectionTimeout, cfg.FailureDetectionTimeout);
Assert.AreEqual(IgniteConfiguration.DefaultClientFailureDetectionTimeout,
cfg.ClientFailureDetectionTimeout);
+ Assert.AreEqual(IgniteConfiguration.DefaultLongQueryWarningTimeout, cfg.LongQueryWarningTimeout);
+ Assert.AreEqual(IgniteConfiguration.DefaultIsLateAffinityAssignment, cfg.IsLateAffinityAssignment);
// Thread pools.
Assert.AreEqual(IgniteConfiguration.DefaultManagementThreadPoolSize, cfg.ManagementThreadPoolSize);
@@ -599,6 +602,7 @@ namespace Apache.Ignite.Core.Tests
},
FailureDetectionTimeout = TimeSpan.FromSeconds(3.5),
ClientFailureDetectionTimeout = TimeSpan.FromMinutes(12.3),
+ LongQueryWarningTimeout = TimeSpan.FromMinutes(1.23),
BinaryConfiguration = new BinaryConfiguration
{
CompactFooter = false,
http://git-wip-us.apache.org/repos/asf/ignite/blob/d5ecf0a7/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
index 04198dd..ec0ac40 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
@@ -156,7 +156,9 @@ namespace Apache.Ignite.Core.Cache.Configuration
KeepBinaryInStore = DefaultKeepVinaryInStore;
LoadPreviousValue = DefaultLoadPreviousValue;
LockTimeout = DefaultLockTimeout;
+#pragma warning disable 618
LongQueryWarningTimeout = DefaultLongQueryWarningTimeout;
+#pragma warning restore 618
MaxConcurrentAsyncOperations = DefaultMaxConcurrentAsyncOperations;
ReadFromBackup = DefaultReadFromBackup;
RebalanceBatchSize = DefaultRebalanceBatchSize;
@@ -214,7 +216,9 @@ namespace Apache.Ignite.Core.Cache.Configuration
KeepBinaryInStore = reader.ReadBoolean();
LoadPreviousValue = reader.ReadBoolean();
LockTimeout = reader.ReadLongAsTimespan();
+#pragma warning disable 618
LongQueryWarningTimeout = reader.ReadLongAsTimespan();
+#pragma warning restore 618
MaxConcurrentAsyncOperations = reader.ReadInt();
Name = reader.ReadString();
ReadFromBackup = reader.ReadBoolean();
@@ -272,7 +276,9 @@ namespace Apache.Ignite.Core.Cache.Configuration
writer.WriteBoolean(KeepBinaryInStore);
writer.WriteBoolean(LoadPreviousValue);
writer.WriteLong((long) LockTimeout.TotalMilliseconds);
+#pragma warning disable 618
writer.WriteLong((long) LongQueryWarningTimeout.TotalMilliseconds);
+#pragma warning restore 618
writer.WriteInt(MaxConcurrentAsyncOperations);
writer.WriteString(Name);
writer.WriteBoolean(ReadFromBackup);
@@ -538,8 +544,11 @@ namespace Apache.Ignite.Core.Cache.Configuration
/// <summary>
/// Gets or sets the timeout after which long query warning will be printed.
+ /// <para />
+ /// This property is obsolete, use <see cref="IgniteConfiguration.LongQueryWarningTimeout"/> instead.
/// </summary>
[DefaultValue(typeof(TimeSpan), "00:00:03")]
+ [Obsolete("Use IgniteConfiguration.LongQueryWarningTimeout instead.")]
public TimeSpan LongQueryWarningTimeout { get; set; }
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/d5ecf0a7/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
index 40bab15..4c141da 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
@@ -114,6 +114,11 @@ namespace Apache.Ignite.Core
/// </summary>
public const int DefaultManagementThreadPoolSize = 4;
+ /// <summary>
+ /// Default timeout after which long query warning will be printed.
+ /// </summary>
+ public static readonly TimeSpan DefaultLongQueryWarningTimeout = TimeSpan.FromMilliseconds(3000);
+
/** */
private TimeSpan? _metricsExpireTime;
@@ -177,6 +182,9 @@ namespace Apache.Ignite.Core
/** */
private int? _queryThreadPoolSize;
+ /** */
+ private TimeSpan? _longQueryWarningTimeout;
+
/// <summary>
/// Default network retry count.
/// </summary>
@@ -259,6 +267,7 @@ namespace Apache.Ignite.Core
writer.WriteBooleanNullable(_isLateAffinityAssignment);
writer.WriteTimeSpanAsLongNullable(_failureDetectionTimeout);
writer.WriteTimeSpanAsLongNullable(_clientFailureDetectionTimeout);
+ writer.WriteTimeSpanAsLongNullable(_longQueryWarningTimeout);
// Thread pools
writer.WriteIntNullable(_publicThreadPoolSize);
@@ -497,6 +506,7 @@ namespace Apache.Ignite.Core
_isLateAffinityAssignment = r.ReadBooleanNullable();
_failureDetectionTimeout = r.ReadTimeSpanNullable();
_clientFailureDetectionTimeout = r.ReadTimeSpanNullable();
+ _longQueryWarningTimeout = r.ReadTimeSpanNullable();
// Thread pools
_publicThreadPoolSize = r.ReadIntNullable();
@@ -1159,5 +1169,15 @@ namespace Apache.Ignite.Core
/// Gets or sets the SQL connector configuration (for JDBC and ODBC).
/// </summary>
public SqlConnectorConfiguration SqlConnectorConfiguration { get; set; }
+
+ /// <summary>
+ /// Gets or sets the timeout after which long query warning will be printed.
+ /// </summary>
+ [DefaultValue(typeof(TimeSpan), "00:00:03")]
+ public TimeSpan LongQueryWarningTimeout
+ {
+ get { return _longQueryWarningTimeout ?? DefaultLongQueryWarningTimeout; }
+ set { _longQueryWarningTimeout = value; }
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d5ecf0a7/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 f0b7f44..864ff9e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
@@ -1480,6 +1480,13 @@
</xs:documentation>
</xs:annotation>
</xs:attribute>
+ <xs:attribute name="longQueryWarningTimeout" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>
+ Timeout after which long query warning will be printed.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
<xs:attribute name="peerAssemblyLoadingMode" type="peerAssemblyLoadingMode">
<xs:annotation>
<xs:documentation>Indicates whether user assemblies should be loaded on remote nodes automatically.</xs:documentation>
[27/42] ignite git commit: Fixed test compilation.
Posted by ag...@apache.org.
Fixed test compilation.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f03ecba3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f03ecba3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f03ecba3
Branch: refs/heads/ignite-5267-merge-ea
Commit: f03ecba3c9351dea56794fcb829b4b1142f726a2
Parents: 6cc5f18
Author: Alexey Kuznetsov <ak...@gridgain.com>
Authored: Thu Jun 8 20:45:26 2017 +0700
Committer: Alexey Kuznetsov <ak...@gridgain.com>
Committed: Thu Jun 8 20:45:26 2017 +0700
----------------------------------------------------------------------
.../integration/ClientTcpUnreachableMultiNodeSelfTest.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f03ecba3/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpUnreachableMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpUnreachableMultiNodeSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpUnreachableMultiNodeSelfTest.java
index e70df53..362b978 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpUnreachableMultiNodeSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpUnreachableMultiNodeSelfTest.java
@@ -120,6 +120,10 @@ public class ClientTcpUnreachableMultiNodeSelfTest extends ClientTcpMultiNodeSel
@Override public boolean connectable() {
return node.connectable();
}
+
+ @Override public long order() {
+ return node.order();
+ }
};
}
@@ -135,4 +139,4 @@ public class ClientTcpUnreachableMultiNodeSelfTest extends ClientTcpMultiNodeSel
((GridClientTopologyListener)b).onNodeRemoved(node);
}
}
-}
\ No newline at end of file
+}
[06/42] ignite git commit: IGNITE-5413. Ignite shouldn't expose nor
send (clear-text) env variables to a 3rd endpoint
Posted by ag...@apache.org.
IGNITE-5413. Ignite shouldn't expose nor send (clear-text) env variables to a 3rd endpoint
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c3b89981
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c3b89981
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c3b89981
Branch: refs/heads/ignite-5267-merge-ea
Commit: c3b899812c4df952767888b4493a614bba87b4fa
Parents: 808ad9f
Author: Konstantin Boudnik <ko...@epam.com>
Authored: Mon Jun 5 19:47:02 2017 -0700
Committer: Konstantin Boudnik <ko...@epam.com>
Committed: Tue Jun 6 11:06:52 2017 -0700
----------------------------------------------------------------------
.../ignite/internal/processors/cluster/ClusterProcessor.java | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c3b89981/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
index 075fb06..542ee43 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
@@ -62,7 +62,7 @@ public class ClusterProcessor extends GridProcessorAdapter {
private IgniteClusterImpl cluster;
/** */
- private final AtomicBoolean notifyEnabled = new AtomicBoolean();
+ private final AtomicBoolean notifyEnabled = new AtomicBoolean(false);
/** */
@GridToStringExclude
@@ -78,9 +78,6 @@ public class ClusterProcessor extends GridProcessorAdapter {
public ClusterProcessor(GridKernalContext ctx) {
super(ctx);
- notifyEnabled.set(IgniteSystemProperties.getBoolean(IGNITE_UPDATE_NOTIFIER,
- Boolean.parseBoolean(IgniteProperties.get("ignite.update.notifier.enabled.by.default"))));
-
cluster = new IgniteClusterImpl(ctx);
}
[14/42] ignite git commit: Removed import
Posted by ag...@apache.org.
Removed import
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3a2797e2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3a2797e2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3a2797e2
Branch: refs/heads/ignite-5267-merge-ea
Commit: 3a2797e2dbae8415de790dcf1331b888da08aad9
Parents: ecba1ac
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Wed Jun 7 15:04:09 2017 +0200
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Wed Jun 7 15:04:09 2017 +0200
----------------------------------------------------------------------
.../org/apache/ignite/internal/binary/BinaryClassDescriptor.java | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3a2797e2/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
index adfdcfc..4950a53 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
@@ -49,7 +49,6 @@ import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.marshaller.MarshallerExclusions;
-import org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller;
import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.internal.processors.query.QueryUtils.isGeometryClass;
[37/42] ignite git commit: IGNITE-5459: Deprecated
IgniteConfiguration.marshaller property.
Posted by ag...@apache.org.
IGNITE-5459: Deprecated IgniteConfiguration.marshaller property.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/39c5b5db
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/39c5b5db
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/39c5b5db
Branch: refs/heads/ignite-5267-merge-ea
Commit: 39c5b5db250a48437baf4bcb8df0dc1c029cbed8
Parents: 03ec107
Author: devozerov <vo...@gridgain.com>
Authored: Fri Jun 9 16:13:09 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Fri Jun 9 16:13:09 2017 +0300
----------------------------------------------------------------------
.../org/apache/ignite/configuration/IgniteConfiguration.java | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/39c5b5db/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 8e531e2..76073c9 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
@@ -1179,7 +1179,10 @@ public class IgniteConfiguration {
* without deserialization will be used.
*
* @return Marshaller to use in grid.
+ * @deprecated Since 2.1. Some Ignite features will not work if non-null marshaller is set
+ * (IgniteCache.withKeepBinary(), .NET, CPP, ODBC)
*/
+ @Deprecated
public Marshaller getMarshaller() {
return marsh;
}
@@ -1190,7 +1193,10 @@ public class IgniteConfiguration {
* @param marsh Marshaller to use within grid.
* @see IgniteConfiguration#getMarshaller()
* @return {@code this} for chaining.
+ * @deprecated Since 2.1. Some Ignite features will not work if non-null marshaller is set
+ * (IgniteCache.withKeepBinary(), .NET, CPP, ODBC)
*/
+ @Deprecated
public IgniteConfiguration setMarshaller(Marshaller marsh) {
this.marsh = marsh;
[32/42] ignite git commit: IgniteCacheGroupsTest: reduced test time.
Posted by ag...@apache.org.
IgniteCacheGroupsTest: reduced test time.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4479f213
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4479f213
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4479f213
Branch: refs/heads/ignite-5267-merge-ea
Commit: 4479f2135116d5f8a587af58a20feb5eb2c93e5e
Parents: 8de8fe5
Author: sboikov <sb...@gridgain.com>
Authored: Fri Jun 9 10:56:08 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Jun 9 10:56:08 2017 +0300
----------------------------------------------------------------------
.../processors/cache/IgniteCacheGroupsTest.java | 98 ++++++++++++--------
1 file changed, 58 insertions(+), 40 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4479f213/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
index 78d4e0a..a8b0c8b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
@@ -115,7 +115,7 @@ import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE;
/**
*
*/
-@SuppressWarnings("unchecked")
+@SuppressWarnings({"unchecked", "ThrowableNotThrown"})
public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
/** */
private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
@@ -708,9 +708,8 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
Affinity<Integer> aff = affinity(cache1);
for(int i = 0; i < keys; i++) {
- if (aff.partition(i) == p) {
+ if (aff.partition(i) == p)
keysSet.add(i);
- }
}
for (Cache.Entry<Integer, Integer> entry : cache1.query(qry)) {
@@ -729,9 +728,8 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
aff = affinity(cache2);
for(int i = 0; i < keys; i++) {
- if (aff.partition(i) == p) {
+ if (aff.partition(i) == p)
keysSet.add(i);
- }
}
for (Cache.Entry<Integer, Integer> entry : cache2.query(qry)) {
@@ -753,9 +751,9 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
Integer[] data1 = generateData(keys);
Integer[] data2 = generateData(keys);
- boolean local = cacheMode == LOCAL;
+ boolean loc = cacheMode == LOCAL;
- if (local)
+ if (loc)
startGrid(0);
else
startGridsMultiThreaded(4);
@@ -765,11 +763,11 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
srv0.createCache(cacheConfiguration(GROUP1, CACHE1, cacheMode, atomicityMode, 2, false));
srv0.createCache(cacheConfiguration(GROUP1, CACHE2, cacheMode, atomicityMode, 2, false));
- if(!local)
+ if(!loc)
awaitPartitionMapExchange();
if (atomicityMode == TRANSACTIONAL) {
- Ignite ignite = ignite(local ? 0 : 1);
+ Ignite ignite = ignite(loc ? 0 : 1);
IgniteCache cache1 = ignite.cache(CACHE1);
IgniteCache cache2 = ignite.cache(CACHE2);
@@ -790,8 +788,8 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
List<Callable<?>> cls = new ArrayList<>(ldrs * 2);
for (int i = 0; i < ldrs ; i++) {
- cls.add(putOperation(local ? 0 : 1, ldrs, i, CACHE1, data1));
- cls.add(putOperation(local ? 0 : 2, ldrs, i, CACHE2, data2));
+ cls.add(putOperation(loc ? 0 : 1, ldrs, i, CACHE1, data1));
+ cls.add(putOperation(loc ? 0 : 2, ldrs, i, CACHE2, data2));
}
GridTestUtils.runMultiThreaded(cls, "loaders");
@@ -800,7 +798,7 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
Set<Integer> keysSet = sequence(keys);
- for (Cache.Entry<Integer, Integer> entry : ignite(local ? 0 : 3).<Integer, Integer>cache(CACHE1)) {
+ for (Cache.Entry<Integer, Integer> entry : ignite(loc ? 0 : 3).<Integer, Integer>cache(CACHE1)) {
assertTrue(keysSet.remove(entry.getKey()));
assertEquals(data1[entry.getKey()], entry.getValue());
}
@@ -811,7 +809,7 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
keysSet = sequence(keys);
- for (Cache.Entry<Integer, Integer> entry : ignite(local ? 0 : 3).<Integer, Integer>cache(CACHE2)) {
+ for (Cache.Entry<Integer, Integer> entry : ignite(loc ? 0 : 3).<Integer, Integer>cache(CACHE2)) {
assertTrue(keysSet.remove(entry.getKey()));
assertEquals(data2[entry.getKey()], entry.getValue());
}
@@ -820,6 +818,8 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
}
/**
+ * @param cacheMode Cache mode.
+ * @param atomicityMode Cache atomicity mode.
* @throws Exception If failed.
*/
private void entriesTtl(CacheMode cacheMode, CacheAtomicityMode atomicityMode) throws Exception {
@@ -830,9 +830,9 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
Integer[] data1 = generateData(keys);
Integer[] data2 = generateData(keys);
- boolean local = cacheMode == LOCAL;
+ boolean loc = cacheMode == LOCAL;
- if (local)
+ if (loc)
startGrid(0);
else
startGridsMultiThreaded(4);
@@ -849,11 +849,11 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
srv0.createCache(cacheConfiguration(GROUP1, CACHE2, cacheMode, atomicityMode, 2, false));
- if (!local)
+ if (!loc)
awaitPartitionMapExchange();
if (atomicityMode == TRANSACTIONAL) {
- Ignite ignite = ignite(local ? 0 : 1);
+ Ignite ignite = ignite(loc ? 0 : 1);
IgniteCache cache1 = ignite.cache(CACHE1);
IgniteCache cache2 = ignite.cache(CACHE2);
@@ -874,25 +874,25 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
List<Callable<?>> cls = new ArrayList<>(ldrs * 2);
for (int i = 0; i < ldrs ; i++) {
- cls.add(putOperation(local ? 0 : 1, ldrs, i, CACHE1, data1));
- cls.add(putOperation(local ? 0 : 2, ldrs, i, CACHE2, data2));
+ cls.add(putOperation(loc ? 0 : 1, ldrs, i, CACHE1, data1));
+ cls.add(putOperation(loc ? 0 : 2, ldrs, i, CACHE2, data2));
}
GridTestUtils.runMultiThreaded(cls, "loaders");
}
- checkData(local ? 0 : 3, CACHE1, data1);
- checkData(local ? 0 : 3, CACHE2, data2);
+ checkData(loc ? 0 : 3, CACHE1, data1);
+ checkData(loc ? 0 : 3, CACHE2, data2);
srv0.destroyCache(CACHE2);
- checkData(local ? 0 : 3, CACHE1, data1);
+ checkData(loc ? 0 : 3, CACHE1, data1);
// Wait for expiration
Thread.sleep((long)(ttl * 1.2));
- assertEquals(0, ignite(local ? 0 : 3).cache(CACHE1).size());
+ assertEquals(0, ignite(loc ? 0 : 3).cache(CACHE1).size());
}
/**
@@ -1082,21 +1082,21 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
Affinity aff = affinity(cache);
- Set<Integer> localKeys = new TreeSet<>();
+ Set<Integer> locKeys = new TreeSet<>();
for (int key = 0; key < data.length; key++) {
if(aff.isPrimaryOrBackup(node, key))
- localKeys.add(key);
+ locKeys.add(key);
}
- Iterable<Cache.Entry<Integer, Integer>> localEntries = cache.localEntries(CachePeekMode.OFFHEAP);
+ Iterable<Cache.Entry<Integer, Integer>> locEntries = cache.localEntries(CachePeekMode.OFFHEAP);
- for (Cache.Entry<Integer, Integer> entry : localEntries) {
- assertTrue(localKeys.remove(entry.getKey()));
+ for (Cache.Entry<Integer, Integer> entry : locEntries) {
+ assertTrue(locKeys.remove(entry.getKey()));
assertEquals(data[entry.getKey()], entry.getValue());
}
- assertTrue(localKeys.isEmpty());
+ assertTrue(locKeys.isEmpty());
}
/**
@@ -1307,12 +1307,13 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
checkCacheDiscoveryDataConsistent();
for (int i = 0; i < NODES; i++) {
- for (int c = 0; c < CACHES; c++) {
- if (c % 100 == 0)
- log.info("Check node: " + i);
+ log.info("Check node: " + i);
- checkCache(i, "testCache1-" + c, 1);
- checkCache(i, "testCache2-" + c, 1);
+ for (int c = 0; c < 10; c++) {
+ int cache = ThreadLocalRandom.current().nextInt(CACHES);
+
+ checkCache(i, "testCache1-" + cache, 1);
+ checkCache(i, "testCache2-" + cache, 1);
}
}
@@ -2633,27 +2634,44 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
tearDown(cache);
}
-
+ /**
+ * @throws Exception If failed.
+ */
public void testLoadCacheAtomicPartitioned() throws Exception {
loadCache(PARTITIONED, ATOMIC);
}
+ /**
+ * @throws Exception If failed.
+ */
public void testLoadCacheAtomicReplicated() throws Exception {
loadCache(REPLICATED, ATOMIC);
}
+ /**
+ * @throws Exception If failed.
+ */
public void testLoadCacheTxPartitioned() throws Exception {
loadCache(PARTITIONED, TRANSACTIONAL);
}
+ /**
+ * @throws Exception If failed.
+ */
public void testLoadCacheTxReplicated() throws Exception {
loadCache(REPLICATED, TRANSACTIONAL);
}
+ /**
+ * @throws Exception If failed.
+ */
public void testLoadCacheAtomicLocal() throws Exception {
loadCache(LOCAL, ATOMIC);
}
+ /**
+ * @throws Exception If failed.
+ */
public void testLoadCacheTxLocal() throws Exception {
loadCache(LOCAL, TRANSACTIONAL);
}
@@ -2666,7 +2684,7 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
private void loadCache(CacheMode cacheMode, CacheAtomicityMode atomicityMode) throws Exception {
int keys = 100;
- boolean local = cacheMode == LOCAL;
+ boolean loc = cacheMode == LOCAL;
Map<Integer, Integer> data1 = generateDataMap(keys);
Map<Integer, Integer> data2 = generateDataMap(keys);
@@ -2684,7 +2702,7 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
CacheConfiguration ccfg2 = cacheConfiguration(GROUP1, CACHE2, cacheMode, atomicityMode, 1, false)
.setCacheStoreFactory(fctr2);
- Ignite node = startGrids(local ? 1 : 4);
+ Ignite node = startGrids(loc ? 1 : 4);
node.createCaches(F.asList(ccfg1, ccfg2));
@@ -4247,7 +4265,8 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
*
*/
static class MapBasedStore<K,V> implements CacheStore<K,V>, Serializable {
- private final Map<K,V> src;
+ /** */
+ private final Map<K, V> src;
/**
* @param src Source map.
@@ -4283,8 +4302,7 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
- @Override
- public void writeAll(Collection<Cache.Entry<? extends K, ? extends V>> entries) throws CacheWriterException {
+ @Override public void writeAll(Collection<Cache.Entry<? extends K, ? extends V>> entries) {
throw new UnsupportedOperationException();
}
[28/42] ignite git commit: Remove unused imports
Posted by ag...@apache.org.
Remove unused imports
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a1e6edcf
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a1e6edcf
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a1e6edcf
Branch: refs/heads/ignite-5267-merge-ea
Commit: a1e6edcf425d59e2e300b92b538021c9feff106f
Parents: f03ecba
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Jun 8 17:35:44 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Jun 8 17:35:44 2017 +0300
----------------------------------------------------------------------
.../platform/dotnet/PlatformDotNetConfigurationClosure.java | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a1e6edcf/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
index b0daf35..5b4f1cc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
@@ -18,10 +18,6 @@
package org.apache.ignite.internal.processors.platform.dotnet;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.binary.BinaryBasicIdMapper;
-import org.apache.ignite.binary.BinaryBasicNameMapper;
-import org.apache.ignite.binary.BinaryIdMapper;
-import org.apache.ignite.binary.BinaryNameMapper;
import org.apache.ignite.configuration.BinaryConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
@@ -118,7 +114,7 @@ public class PlatformDotNetConfigurationClosure extends PlatformAbstractConfigur
* Sets binary config.
*
* @param igniteCfg Ignite config.
- * @param dotNetCfg Dotnet config.
+ * @param dotNetCfg .NET config.
*/
private void setBinaryConfiguration(IgniteConfiguration igniteCfg, PlatformDotNetConfigurationEx dotNetCfg) {
// Check marshaller.
@@ -166,7 +162,7 @@ public class PlatformDotNetConfigurationClosure extends PlatformAbstractConfigur
writer.writeMap(bean.getProperties());
}
- // Write .NET affinity funcs
+ // Write .NET affinity functions
List<PlatformDotNetAffinityFunction> affFuncs = affinityFunctions(igniteCfg);
writer.writeInt(affFuncs.size());