You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by av...@apache.org on 2016/11/21 13:42:49 UTC
[01/15] ignite git commit: IGNITE-4201: Fixed version fix maven step.
Repository: ignite
Updated Branches:
refs/heads/ignite-4242 [created] 5536adfd8
IGNITE-4201: Fixed version fix maven step.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1093819a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1093819a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1093819a
Branch: refs/heads/ignite-4242
Commit: 1093819ac0f3e7a0faacde59919117b8977e6d5b
Parents: b1c7c9b
Author: Igor Sapego <is...@gridgain.com>
Authored: Wed Nov 9 18:19:01 2016 +0300
Committer: Igor Sapego <is...@gridgain.com>
Committed: Wed Nov 9 18:19:01 2016 +0300
----------------------------------------------------------------------
pom.xml | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1093819a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 4f4198c..942410f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -888,6 +888,7 @@
<substitution expression="\1${new.client.version}\2" />
<fileset dir="${basedir}/">
<include name="**/configure.ac" />
+ <include name="**/configure.acrel" />
</fileset>
</replaceregexp>
[04/15] ignite git commit: Fixed classnames.properties generation for
ignite-hadoop module.
Posted by av...@apache.org.
Fixed classnames.properties generation for ignite-hadoop module.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/73a8fa8b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/73a8fa8b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/73a8fa8b
Branch: refs/heads/ignite-4242
Commit: 73a8fa8b635cce3b9d8dcad364a32d29f12d4398
Parents: 5a4ebd5
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Nov 11 10:20:32 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Nov 11 10:20:32 2016 +0700
----------------------------------------------------------------------
modules/hadoop/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/73a8fa8b/modules/hadoop/pom.xml
----------------------------------------------------------------------
diff --git a/modules/hadoop/pom.xml b/modules/hadoop/pom.xml
index 15d6eee..d0b0481 100644
--- a/modules/hadoop/pom.xml
+++ b/modules/hadoop/pom.xml
@@ -168,7 +168,7 @@
#
]]>
</argument>
- <argument>org.apache.ignite</argument>
+ <argument>org.apache.ignite.hadoop:org.apache.ignite.internal.processors.hadoop</argument>
</arguments>
</configuration>
</execution>
[13/15] ignite git commit: IGNITE-2523 "single put" NEAR update
request
Posted by av...@apache.org.
IGNITE-2523 "single put" NEAR update request
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a24a394b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a24a394b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a24a394b
Branch: refs/heads/ignite-4242
Commit: a24a394bb66ba0237a9e9ef940707d422b2980f0
Parents: 0234f67
Author: Konstantin Dudkov <kd...@ya.ru>
Authored: Mon Nov 21 13:53:58 2016 +0300
Committer: Konstantin Dudkov <kd...@ya.ru>
Committed: Mon Nov 21 13:53:58 2016 +0300
----------------------------------------------------------------------
.../communication/GridIoMessageFactory.java | 24 +-
.../processors/cache/GridCacheIoManager.java | 64 +-
.../processors/cache/GridCachePreloader.java | 11 +
.../cache/GridCachePreloaderAdapter.java | 7 +
.../dht/atomic/GridDhtAtomicCache.java | 96 +-
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 12 +-
...idNearAtomicAbstractSingleUpdateRequest.java | 562 +++++++++
.../GridNearAtomicAbstractUpdateFuture.java | 15 +-
.../GridNearAtomicAbstractUpdateRequest.java | 226 ++++
.../atomic/GridNearAtomicFullUpdateRequest.java | 1031 +++++++++++++++++
...GridNearAtomicSingleUpdateFilterRequest.java | 226 ++++
.../GridNearAtomicSingleUpdateFuture.java | 137 ++-
...GridNearAtomicSingleUpdateInvokeRequest.java | 303 +++++
.../GridNearAtomicSingleUpdateRequest.java | 359 ++++++
.../dht/atomic/GridNearAtomicUpdateFuture.java | 42 +-
.../dht/atomic/GridNearAtomicUpdateRequest.java | 1092 ------------------
.../dht/preloader/GridDhtPreloader.java | 20 +
.../distributed/near/GridNearAtomicCache.java | 10 +-
.../resources/META-INF/classnames.properties | 77 +-
.../CacheAtomicSingleMessageCountSelfTest.java | 259 +++++
.../GridCacheAtomicMessageCountSelfTest.java | 18 +-
.../IgniteCacheAtomicStopBusySelfTest.java | 10 +-
.../IgniteCacheP2pUnmarshallingErrorTest.java | 2 +-
...niteCacheClientNodeChangingTopologyTest.java | 22 +-
...eAtomicInvalidPartitionHandlingSelfTest.java | 2 +-
25 files changed, 3332 insertions(+), 1295 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
index fd55224..b20de68 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
@@ -69,7 +69,10 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtUnlock
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicDeferredUpdateResponse;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicFullUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFilterRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateInvokeRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysResponse;
@@ -392,7 +395,7 @@ public class GridIoMessageFactory implements MessageFactory {
break;
case 40:
- msg = new GridNearAtomicUpdateRequest();
+ msg = new GridNearAtomicFullUpdateRequest();
break;
@@ -756,7 +759,22 @@ public class GridIoMessageFactory implements MessageFactory {
break;
- // [-3..119] [124] - this
+ case 125:
+ msg = new GridNearAtomicSingleUpdateRequest();
+
+ break;
+
+ case 126:
+ msg = new GridNearAtomicSingleUpdateInvokeRequest();
+
+ break;
+
+ case 127:
+ msg = new GridNearAtomicSingleUpdateFilterRequest();
+
+ break;
+
+ // [-3..119] [124..127] - this
// [120..123] - DR
// [-4..-22, -30..-35] - SQL
default:
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index e450287..c5c1c60 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -47,7 +47,11 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrep
import org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicAbstractUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicFullUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFilterRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateInvokeRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysResponse;
@@ -462,8 +466,8 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
* @return Atomic future ID if applicable for message.
*/
@Nullable private GridCacheVersion atomicFututeId(GridCacheMessage cacheMsg) {
- if (cacheMsg instanceof GridNearAtomicUpdateRequest)
- return ((GridNearAtomicUpdateRequest)cacheMsg).futureVersion();
+ if (cacheMsg instanceof GridNearAtomicAbstractUpdateRequest)
+ return ((GridNearAtomicAbstractUpdateRequest)cacheMsg).futureVersion();
else if (cacheMsg instanceof GridNearAtomicUpdateResponse)
return ((GridNearAtomicUpdateResponse) cacheMsg).futureVersion();
else if (cacheMsg instanceof GridDhtAtomicUpdateRequest)
@@ -480,8 +484,8 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
* @return Atomic future ID if applicable for message.
*/
@Nullable private GridCacheVersion atomicWriteVersion(GridCacheMessage cacheMsg) {
- if (cacheMsg instanceof GridNearAtomicUpdateRequest)
- return ((GridNearAtomicUpdateRequest)cacheMsg).updateVersion();
+ if (cacheMsg instanceof GridNearAtomicAbstractUpdateRequest)
+ return ((GridNearAtomicAbstractUpdateRequest)cacheMsg).updateVersion();
else if (cacheMsg instanceof GridDhtAtomicUpdateRequest)
return ((GridDhtAtomicUpdateRequest)cacheMsg).writeVersion();
@@ -562,7 +566,7 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
break;
case 40: {
- GridNearAtomicUpdateRequest req = (GridNearAtomicUpdateRequest)msg;
+ GridNearAtomicFullUpdateRequest req = (GridNearAtomicFullUpdateRequest)msg;
GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(
ctx.cacheId(),
@@ -739,6 +743,54 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
break;
+ case 125: {
+ GridNearAtomicSingleUpdateRequest req = (GridNearAtomicSingleUpdateRequest)msg;
+
+ GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(
+ ctx.cacheId(),
+ nodeId,
+ req.futureVersion(),
+ ctx.deploymentEnabled());
+
+ res.error(req.classError());
+
+ sendResponseOnFailedMessage(nodeId, res, cctx, ctx.ioPolicy());
+ }
+
+ break;
+
+ case 126: {
+ GridNearAtomicSingleUpdateInvokeRequest req = (GridNearAtomicSingleUpdateInvokeRequest)msg;
+
+ GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(
+ ctx.cacheId(),
+ nodeId,
+ req.futureVersion(),
+ ctx.deploymentEnabled());
+
+ res.error(req.classError());
+
+ sendResponseOnFailedMessage(nodeId, res, cctx, ctx.ioPolicy());
+ }
+
+ break;
+
+ case 127: {
+ GridNearAtomicSingleUpdateFilterRequest req = (GridNearAtomicSingleUpdateFilterRequest)msg;
+
+ GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(
+ ctx.cacheId(),
+ nodeId,
+ req.futureVersion(),
+ ctx.deploymentEnabled());
+
+ res.error(req.classError());
+
+ sendResponseOnFailedMessage(nodeId, res, cctx, ctx.ioPolicy());
+ }
+
+ break;
+
default:
throw new IgniteCheckedException("Failed to send response to node. Unsupported direct type [message="
+ msg + "]", msg.classError());
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java
index a49bb04..1d1cfab 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java
@@ -24,6 +24,7 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicAbstractUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemandMessage;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionSupplyMessageV2;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
@@ -140,6 +141,16 @@ public interface GridCachePreloader {
public IgniteInternalFuture<Object> request(Collection<KeyCacheObject> keys, AffinityTopologyVersion topVer);
/**
+ * Requests that preloader sends the request for the key.
+ *
+ * @param req Message with keys to request.
+ * @param topVer Topology version, {@code -1} if not required.
+ * @return Future to complete when all keys are preloaded.
+ */
+ public IgniteInternalFuture<Object> request(GridNearAtomicAbstractUpdateRequest req,
+ AffinityTopologyVersion topVer);
+
+ /**
* Force preload process.
*/
public void forcePreload();
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
index 58b75df..b15ebc5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
@@ -26,6 +26,7 @@ import org.apache.ignite.cache.affinity.AffinityFunction;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicAbstractUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemandMessage;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionSupplyMessageV2;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
@@ -149,6 +150,12 @@ public class GridCachePreloaderAdapter implements GridCachePreloader {
}
/** {@inheritDoc} */
+ @Override public IgniteInternalFuture<Object> request(GridNearAtomicAbstractUpdateRequest req,
+ AffinityTopologyVersion topVer) {
+ return new GridFinishedFuture<>();
+ }
+
+ /** {@inheritDoc} */
@Override public void onInitialExchangeComplete(@Nullable Throwable err) {
// No-op.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 30a3d57..f7d1973 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -136,7 +136,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
/** Update reply closure. */
@GridToStringExclude
- private CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> updateReplyClos;
+ private CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> updateReplyClos;
/** Pending */
private GridDeferredAckMessageSender deferredUpdateMessageSender;
@@ -200,9 +200,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
@Override protected void init() {
super.init();
- updateReplyClos = new CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse>() {
+ updateReplyClos = new CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse>() {
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
- @Override public void apply(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) {
+ @Override public void apply(GridNearAtomicAbstractUpdateRequest req, GridNearAtomicUpdateResponse res) {
if (ctx.config().getAtomicWriteOrderMode() == CLOCK) {
assert req.writeSynchronizationMode() != FULL_ASYNC : req;
@@ -323,11 +323,11 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
ctx.io().addHandler(
ctx.cacheId(),
- GridNearAtomicUpdateRequest.class,
- new CI2<UUID, GridNearAtomicUpdateRequest>() {
+ GridNearAtomicAbstractUpdateRequest.class,
+ new CI2<UUID, GridNearAtomicAbstractUpdateRequest>() {
@Override public void apply(
UUID nodeId,
- GridNearAtomicUpdateRequest req
+ GridNearAtomicAbstractUpdateRequest req
) {
processNearAtomicUpdateRequest(
nodeId,
@@ -335,8 +335,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
}
@Override public String toString() {
- return "GridNearAtomicUpdateRequest handler " +
- "[msgIdx=" + GridNearAtomicUpdateRequest.CACHE_MSG_IDX + ']';
+ return "GridNearAtomicAbstractUpdateRequest handler " +
+ "[msgIdx=" + GridNearAtomicAbstractUpdateRequest.CACHE_MSG_IDX + ']';
}
});
@@ -1252,7 +1252,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
CacheEntryPredicate[] filters = CU.filterArray(filter);
- if (conflictPutVal == null && conflictRmvVer == null && !isFastMap(filters, op)) {
+ if (conflictPutVal == null &&
+ conflictRmvVer == null &&
+ !isFastMap(filters, op)) {
return new GridNearAtomicSingleUpdateFuture(
ctx,
this,
@@ -1603,10 +1605,10 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
*/
public void updateAllAsyncInternal(
final UUID nodeId,
- final GridNearAtomicUpdateRequest req,
- final CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb
+ final GridNearAtomicAbstractUpdateRequest req,
+ final CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb
) {
- IgniteInternalFuture<Object> forceFut = preldr.request(req.keys(), req.topologyVersion());
+ IgniteInternalFuture<Object> forceFut = preldr.request(req, req.topologyVersion());
if (forceFut == null || forceFut.isDone()) {
try {
@@ -1652,8 +1654,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
* @param e Error.
*/
private void onForceKeysError(final UUID nodeId,
- final GridNearAtomicUpdateRequest req,
- final CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
+ final GridNearAtomicAbstractUpdateRequest req,
+ final CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
IgniteCheckedException e
) {
GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(ctx.cacheId(),
@@ -1673,17 +1675,15 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
* @param req Update request.
* @param completionCb Completion callback.
*/
- public void updateAllAsyncInternal0(
+ private void updateAllAsyncInternal0(
UUID nodeId,
- GridNearAtomicUpdateRequest req,
- CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb
+ GridNearAtomicAbstractUpdateRequest req,
+ CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb
) {
GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(ctx.cacheId(), nodeId, req.futureVersion(),
ctx.deploymentEnabled());
- List<KeyCacheObject> keys = req.keys();
-
- assert !req.returnValue() || (req.operation() == TRANSFORM || keys.size() == 1);
+ assert !req.returnValue() || (req.operation() == TRANSFORM || req.size() == 1);
GridDhtAtomicUpdateFuture dhtFut = null;
@@ -1696,7 +1696,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
try {
// If batch store update is enabled, we need to lock all entries.
// First, need to acquire locks on cache entries, then check filter.
- List<GridDhtCacheEntry> locked = lockEntries(keys, req.topologyVersion());
+ List<GridDhtCacheEntry> locked = lockEntries(req, req.topologyVersion());
Collection<IgniteBiTuple<GridDhtCacheEntry, GridCacheVersion>> deleted = null;
@@ -1707,7 +1707,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
try {
if (top.stopping()) {
- res.addFailedKeys(keys, new IgniteCheckedException("Failed to perform cache operation " +
+ res.addFailedKeys(req.keys(), new IgniteCheckedException("Failed to perform cache operation " +
"(cache is stopped): " + name()));
completionCb.apply(req, res);
@@ -1757,7 +1757,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
GridCacheReturn retVal = null;
- if (keys.size() > 1 && // Several keys ...
+ if (req.size() > 1 && // Several keys ...
writeThrough() && !req.skipStore() && // and store is enabled ...
!ctx.store().isLocal() && // and this is not local store ...
// (conflict resolver should be used for local store)
@@ -1853,7 +1853,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
// an attempt to use cleaned resources.
U.error(log, "Unexpected exception during cache update", e);
- res.addFailedKeys(keys, e);
+ res.addFailedKeys(req.keys(), e);
completionCb.apply(req, res);
@@ -1866,7 +1866,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
if (remap) {
assert dhtFut == null;
- res.remapKeys(keys);
+ res.remapKeys(req.keys());
completionCb.apply(req, res);
}
@@ -1904,12 +1904,12 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
private UpdateBatchResult updateWithBatch(
final ClusterNode node,
final boolean hasNear,
- final GridNearAtomicUpdateRequest req,
+ final GridNearAtomicAbstractUpdateRequest req,
final GridNearAtomicUpdateResponse res,
final List<GridDhtCacheEntry> locked,
final GridCacheVersion ver,
@Nullable GridDhtAtomicUpdateFuture dhtFut,
- final CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
+ final CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
final boolean replicate,
final String taskName,
@Nullable final IgniteCacheExpiryPolicy expiry,
@@ -1929,7 +1929,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
}
}
- int size = req.keys().size();
+ int size = req.size();
Map<KeyCacheObject, CacheObject> putMap = null;
@@ -2327,12 +2327,12 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
private UpdateSingleResult updateSingle(
ClusterNode node,
boolean hasNear,
- GridNearAtomicUpdateRequest req,
+ GridNearAtomicAbstractUpdateRequest req,
GridNearAtomicUpdateResponse res,
List<GridDhtCacheEntry> locked,
GridCacheVersion ver,
@Nullable GridDhtAtomicUpdateFuture dhtFut,
- CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
+ CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
boolean replicate,
String taskName,
@Nullable IgniteCacheExpiryPolicy expiry,
@@ -2341,8 +2341,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
GridCacheReturn retVal = null;
Collection<IgniteBiTuple<GridDhtCacheEntry, GridCacheVersion>> deleted = null;
- List<KeyCacheObject> keys = req.keys();
-
AffinityTopologyVersion topVer = req.topologyVersion();
boolean checkReaders = hasNear || ctx.discovery().hasNearCache(name(), topVer);
@@ -2352,8 +2350,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
boolean intercept = ctx.config().getInterceptor() != null;
// Avoid iterator creation.
- for (int i = 0; i < keys.size(); i++) {
- KeyCacheObject k = keys.get(i);
+ for (int i = 0; i < req.size(); i++) {
+ KeyCacheObject k = req.key(i);
GridCacheOperation op = req.operation();
@@ -2489,7 +2487,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
if (updRes.removeVersion() != null) {
if (deleted == null)
- deleted = new ArrayList<>(keys.size());
+ deleted = new ArrayList<>(req.size());
deleted.add(F.t(entry, updRes.removeVersion()));
}
@@ -2565,8 +2563,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
@Nullable final Collection<KeyCacheObject> rmvKeys,
@Nullable final Map<KeyCacheObject, EntryProcessor<Object, Object, Object>> entryProcessorMap,
@Nullable GridDhtAtomicUpdateFuture dhtFut,
- final CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
- final GridNearAtomicUpdateRequest req,
+ final CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
+ final GridNearAtomicAbstractUpdateRequest req,
final GridNearAtomicUpdateResponse res,
final boolean replicate,
final UpdateBatchResult batchRes,
@@ -2803,17 +2801,17 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
/**
* Acquires java-level locks on cache entries. Returns collection of locked entries.
*
- * @param keys Keys to lock.
+ * @param req Request with keys to lock.
* @param topVer Topology version to lock on.
* @return Collection of locked entries.
* @throws GridDhtInvalidPartitionException If entry does not belong to local node. If exception is thrown,
* locks are released.
*/
@SuppressWarnings("ForLoopReplaceableByForEach")
- private List<GridDhtCacheEntry> lockEntries(List<KeyCacheObject> keys, AffinityTopologyVersion topVer)
+ private List<GridDhtCacheEntry> lockEntries(GridNearAtomicAbstractUpdateRequest req, AffinityTopologyVersion topVer)
throws GridDhtInvalidPartitionException {
- if (keys.size() == 1) {
- KeyCacheObject key = keys.get(0);
+ if (req.size() == 1) {
+ KeyCacheObject key = req.key(0);
while (true) {
try {
@@ -2836,12 +2834,12 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
}
}
else {
- List<GridDhtCacheEntry> locked = new ArrayList<>(keys.size());
+ List<GridDhtCacheEntry> locked = new ArrayList<>(req.size());
while (true) {
- for (KeyCacheObject key : keys) {
+ for (int i = 0; i < req.size(); i++) {
try {
- GridDhtCacheEntry entry = entryExx(key, topVer);
+ GridDhtCacheEntry entry = entryExx(req.key(i), topVer);
locked.add(entry);
}
@@ -2946,7 +2944,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
* will return false.
* @return {@code True} if filter evaluation succeeded.
*/
- private boolean checkFilter(GridCacheEntryEx entry, GridNearAtomicUpdateRequest req,
+ private boolean checkFilter(GridCacheEntryEx entry, GridNearAtomicAbstractUpdateRequest req,
GridNearAtomicUpdateResponse res) {
try {
return ctx.isAllLocked(entry, req.filter());
@@ -2961,7 +2959,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
/**
* @param req Request to remap.
*/
- private void remapToNewPrimary(GridNearAtomicUpdateRequest req) {
+ private void remapToNewPrimary(GridNearAtomicAbstractUpdateRequest req) {
assert req.writeSynchronizationMode() == FULL_ASYNC : req;
if (log.isDebugEnabled())
@@ -3040,9 +3038,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
*/
@Nullable private GridDhtAtomicUpdateFuture createDhtFuture(
GridCacheVersion writeVer,
- GridNearAtomicUpdateRequest updateReq,
+ GridNearAtomicAbstractUpdateRequest updateReq,
GridNearAtomicUpdateResponse updateRes,
- CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
+ CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
boolean force
) {
if (!force) {
@@ -3073,7 +3071,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
* @param nodeId Sender node ID.
* @param req Near atomic update request.
*/
- private void processNearAtomicUpdateRequest(UUID nodeId, GridNearAtomicUpdateRequest req) {
+ private void processNearAtomicUpdateRequest(UUID nodeId, GridNearAtomicAbstractUpdateRequest req) {
if (msgLog.isDebugEnabled()) {
msgLog.debug("Received near atomic update request [futId=" + req.futureVersion() +
", writeVer=" + req.updateVersion() +
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
index 4e59d11..c2ad8b8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
@@ -83,7 +83,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
/** Completion callback. */
@GridToStringExclude
- private final CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb;
+ private final CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb;
/** Mappings. */
@GridToStringInclude
@@ -93,7 +93,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
private Map<KeyCacheObject, GridDhtCacheEntry> nearReadersEntries;
/** Update request. */
- private final GridNearAtomicUpdateRequest updateReq;
+ private final GridNearAtomicAbstractUpdateRequest updateReq;
/** Update response. */
private final GridNearAtomicUpdateResponse updateRes;
@@ -119,9 +119,9 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
*/
public GridDhtAtomicUpdateFuture(
GridCacheContext cctx,
- CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
+ CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
GridCacheVersion writeVer,
- GridNearAtomicUpdateRequest updateReq,
+ GridNearAtomicAbstractUpdateRequest updateReq,
GridNearAtomicUpdateResponse updateRes
) {
this.cctx = cctx;
@@ -137,8 +137,8 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
log = U.logger(cctx.kernalContext(), logRef, GridDhtAtomicUpdateFuture.class);
}
- keys = new ArrayList<>(updateReq.keys().size());
- mappings = U.newHashMap(updateReq.keys().size());
+ keys = new ArrayList<>(updateReq.size());
+ mappings = U.newHashMap(updateReq.size());
waitForExchange = !(updateReq.topologyLocked() || (updateReq.fastMap() && !updateReq.clientRequest()));
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractSingleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractSingleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractSingleUpdateRequest.java
new file mode 100644
index 0000000..61deeee
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractSingleUpdateRequest.java
@@ -0,0 +1,562 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.io.Externalizable;
+import java.nio.ByteBuffer;
+import java.util.UUID;
+import javax.cache.expiry.ExpiryPolicy;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
+import org.apache.ignite.internal.processors.cache.GridCacheOperation;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ *
+ */
+public abstract class GridNearAtomicAbstractSingleUpdateRequest extends GridNearAtomicAbstractUpdateRequest {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private static final CacheEntryPredicate[] NO_FILTER = new CacheEntryPredicate[0];
+
+ /** Fast map flag mask. */
+ private static final int FAST_MAP_FLAG_MASK = 0x1;
+
+ /** Flag indicating whether request contains primary keys. */
+ private static final int HAS_PRIMARY_FLAG_MASK = 0x2;
+
+ /** Topology locked flag. Set if atomic update is performed inside TX or explicit lock. */
+ private static final int TOP_LOCKED_FLAG_MASK = 0x4;
+
+ /** Skip write-through to a persistent storage. */
+ private static final int SKIP_STORE_FLAG_MASK = 0x8;
+
+ /** */
+ private static final int CLIENT_REQ_FLAG_MASK = 0x10;
+
+ /** Keep binary flag. */
+ private static final int KEEP_BINARY_FLAG_MASK = 0x20;
+
+ /** Return value flag. */
+ private static final int RET_VAL_FLAG_MASK = 0x40;
+
+ /** Target node ID. */
+ @GridDirectTransient
+ protected UUID nodeId;
+
+ /** Future version. */
+ protected GridCacheVersion futVer;
+
+ /** Update version. Set to non-null if fastMap is {@code true}. */
+ private GridCacheVersion updateVer;
+
+ /** Topology version. */
+ protected AffinityTopologyVersion topVer;
+
+ /** Write synchronization mode. */
+ protected CacheWriteSynchronizationMode syncMode;
+
+ /** Update operation. */
+ protected GridCacheOperation op;
+
+ /** Subject ID. */
+ protected UUID subjId;
+
+ /** Task name hash. */
+ protected int taskNameHash;
+
+ /** */
+ @GridDirectTransient
+ private GridNearAtomicUpdateResponse res;
+
+ /** Compressed boolean flags. */
+ protected byte flags;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ protected GridNearAtomicAbstractSingleUpdateRequest() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param cacheId Cache ID.
+ * @param nodeId Node ID.
+ * @param futVer Future version.
+ * @param fastMap Fast map scheme flag.
+ * @param updateVer Update version set if fast map is performed.
+ * @param topVer Topology version.
+ * @param topLocked Topology locked flag.
+ * @param syncMode Synchronization mode.
+ * @param op Cache update operation.
+ * @param retval Return value required flag.
+ * @param subjId Subject ID.
+ * @param taskNameHash Task name hash code.
+ * @param skipStore Skip write-through to a persistent storage.
+ * @param keepBinary Keep binary flag.
+ * @param clientReq Client node request flag.
+ * @param addDepInfo Deployment info flag.
+ */
+ protected GridNearAtomicAbstractSingleUpdateRequest(
+ int cacheId,
+ UUID nodeId,
+ GridCacheVersion futVer,
+ boolean fastMap,
+ @Nullable GridCacheVersion updateVer,
+ @NotNull AffinityTopologyVersion topVer,
+ boolean topLocked,
+ CacheWriteSynchronizationMode syncMode,
+ GridCacheOperation op,
+ boolean retval,
+ @Nullable UUID subjId,
+ int taskNameHash,
+ boolean skipStore,
+ boolean keepBinary,
+ boolean clientReq,
+ boolean addDepInfo
+ ) {
+ assert futVer != null;
+
+ this.cacheId = cacheId;
+ this.nodeId = nodeId;
+ this.futVer = futVer;
+ this.updateVer = updateVer;
+ this.topVer = topVer;
+ this.syncMode = syncMode;
+ this.op = op;
+ this.subjId = subjId;
+ this.taskNameHash = taskNameHash;
+ this.addDepInfo = addDepInfo;
+
+ fastMap(fastMap);
+ topologyLocked(topLocked);
+ returnValue(retval);
+ skipStore(skipStore);
+ keepBinary(keepBinary);
+ clientRequest(clientReq);
+ }
+
+ /** {@inheritDoc} */
+ @Override public int lookupIndex() {
+ return CACHE_MSG_IDX;
+ }
+
+ /**
+ * @return Mapped node ID.
+ */
+ @Override public UUID nodeId() {
+ return nodeId;
+ }
+
+ /**
+ * @param nodeId Node ID.
+ */
+ @Override public void nodeId(UUID nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ /**
+ * @return Subject ID.
+ */
+ @Override public UUID subjectId() {
+ return subjId;
+ }
+
+ /**
+ * @return Task name hash.
+ */
+ @Override public int taskNameHash() {
+ return taskNameHash;
+ }
+
+ /**
+ * @return Future version.
+ */
+ @Override public GridCacheVersion futureVersion() {
+ return futVer;
+ }
+
+ /**
+ * @return Update version for fast-map request.
+ */
+ @Override public GridCacheVersion updateVersion() {
+ return updateVer;
+ }
+
+ /**
+ * @return Topology version.
+ */
+ @Override public AffinityTopologyVersion topologyVersion() {
+ return topVer;
+ }
+
+ /**
+ * @return Cache write synchronization mode.
+ */
+ @Override public CacheWriteSynchronizationMode writeSynchronizationMode() {
+ return syncMode;
+ }
+
+ /**
+ * @return Expiry policy.
+ */
+ @Override public ExpiryPolicy expiry() {
+ return null;
+ }
+
+ /**
+ * @return Update operation.
+ */
+ @Override public GridCacheOperation operation() {
+ return op;
+ }
+
+ /**
+ * @return Optional arguments for entry processor.
+ */
+ @Override @Nullable public Object[] invokeArguments() {
+ return null;
+ }
+
+ /**
+ * @param res Response.
+ * @return {@code True} if current response was {@code null}.
+ */
+ @Override public boolean onResponse(GridNearAtomicUpdateResponse res) {
+ if (this.res == null) {
+ this.res = res;
+
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @return Response.
+ */
+ @Override @Nullable public GridNearAtomicUpdateResponse response() {
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean addDeploymentInfo() {
+ return addDepInfo;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+ return ctx.atomicMessageLogger();
+ }
+
+ /**
+ * @return Flag indicating whether this is fast-map udpate.
+ */
+ @Override public boolean fastMap() {
+ return isFlag(FAST_MAP_FLAG_MASK);
+ }
+
+ /**
+ * Sets fastMap flag value.
+ */
+ public void fastMap(boolean val) {
+ setFlag(val, FAST_MAP_FLAG_MASK);
+ }
+
+ /**
+ * @return Topology locked flag.
+ */
+ @Override public boolean topologyLocked() {
+ return isFlag(TOP_LOCKED_FLAG_MASK);
+ }
+
+ /**
+ * Sets topologyLocked flag value.
+ */
+ public void topologyLocked(boolean val) {
+ setFlag(val, TOP_LOCKED_FLAG_MASK);
+ }
+
+ /**
+ * @return {@code True} if request sent from client node.
+ */
+ @Override public boolean clientRequest() {
+ return isFlag(CLIENT_REQ_FLAG_MASK);
+ }
+
+ /**
+ * Sets clientRequest flag value.
+ */
+ public void clientRequest(boolean val) {
+ setFlag(val, CLIENT_REQ_FLAG_MASK);
+ }
+
+ /**
+ * @return Return value flag.
+ */
+ @Override public boolean returnValue() {
+ return isFlag(RET_VAL_FLAG_MASK);
+ }
+
+ /**
+ * Sets returnValue flag value.
+ */
+ public void returnValue(boolean val) {
+ setFlag(val, RET_VAL_FLAG_MASK);
+ }
+
+ /**
+ * @return Skip write-through to a persistent storage.
+ */
+ @Override public boolean skipStore() {
+ return isFlag(SKIP_STORE_FLAG_MASK);
+ }
+
+ /**
+ * Sets skipStore flag value.
+ */
+ public void skipStore(boolean val) {
+ setFlag(val, SKIP_STORE_FLAG_MASK);
+ }
+
+ /**
+ * @return Keep binary flag.
+ */
+ @Override public boolean keepBinary() {
+ return isFlag(KEEP_BINARY_FLAG_MASK);
+ }
+
+ /**
+ * Sets keepBinary flag value.
+ */
+ public void keepBinary(boolean val) {
+ setFlag(val, KEEP_BINARY_FLAG_MASK);
+ }
+
+ /**
+ * @return Flag indicating whether this request contains primary keys.
+ */
+ @Override public boolean hasPrimary() {
+ return isFlag(HAS_PRIMARY_FLAG_MASK);
+ }
+
+ /**
+ * Sets hasPrimary flag value.
+ */
+ public void hasPrimary(boolean val) {
+ setFlag(val, HAS_PRIMARY_FLAG_MASK);
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public CacheEntryPredicate[] filter() {
+ return NO_FILTER;
+ }
+
+ /**
+ * Sets flag mask.
+ *
+ * @param flag Set or clear.
+ * @param mask Mask.
+ */
+ private void setFlag(boolean flag, int mask) {
+ flags = flag ? (byte)(flags | mask) : (byte)(flags & ~mask);
+ }
+
+ /**
+ * Reads flag mask.
+ *
+ * @param mask Mask to read.
+ * @return Flag value.
+ */
+ private boolean isFlag(int mask) {
+ return (flags & mask) != 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+ writer.setBuffer(buf);
+
+ if (!super.writeTo(buf, writer))
+ return false;
+
+ if (!writer.isHeaderWritten()) {
+ if (!writer.writeHeader(directType(), fieldsCount()))
+ return false;
+
+ writer.onHeaderWritten();
+ }
+
+ switch (writer.state()) {
+ case 3:
+ if (!writer.writeByte("flags", flags))
+ return false;
+
+ writer.incrementState();
+
+ case 4:
+ if (!writer.writeMessage("futVer", futVer))
+ return false;
+
+ writer.incrementState();
+
+ case 5:
+ if (!writer.writeByte("op", op != null ? (byte)op.ordinal() : -1))
+ return false;
+
+ writer.incrementState();
+
+ case 6:
+ if (!writer.writeUuid("subjId", subjId))
+ return false;
+
+ writer.incrementState();
+
+ case 7:
+ if (!writer.writeByte("syncMode", syncMode != null ? (byte)syncMode.ordinal() : -1))
+ return false;
+
+ writer.incrementState();
+
+ case 8:
+ if (!writer.writeInt("taskNameHash", taskNameHash))
+ return false;
+
+ writer.incrementState();
+
+ case 9:
+ if (!writer.writeMessage("topVer", topVer))
+ return false;
+
+ writer.incrementState();
+
+ case 10:
+ if (!writer.writeMessage("updateVer", updateVer))
+ return false;
+
+ writer.incrementState();
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+ reader.setBuffer(buf);
+
+ if (!reader.beforeMessageRead())
+ return false;
+
+ if (!super.readFrom(buf, reader))
+ return false;
+
+ switch (reader.state()) {
+ case 3:
+ flags = reader.readByte("flags");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 4:
+ futVer = reader.readMessage("futVer");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 5:
+ byte opOrd;
+
+ opOrd = reader.readByte("op");
+
+ if (!reader.isLastRead())
+ return false;
+
+ op = GridCacheOperation.fromOrdinal(opOrd);
+
+ reader.incrementState();
+
+ case 6:
+ subjId = reader.readUuid("subjId");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 7:
+ byte syncModeOrd;
+
+ syncModeOrd = reader.readByte("syncMode");
+
+ if (!reader.isLastRead())
+ return false;
+
+ syncMode = CacheWriteSynchronizationMode.fromOrdinal(syncModeOrd);
+
+ reader.incrementState();
+
+ case 8:
+ taskNameHash = reader.readInt("taskNameHash");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 9:
+ topVer = reader.readMessage("topVer");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 10:
+ updateVer = reader.readMessage("updateVer");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ }
+
+ return reader.afterMessageRead(GridNearAtomicAbstractSingleUpdateRequest.class);
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte fieldsCount() {
+ return 11;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
index 85751bb..2fbabaa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
@@ -17,6 +17,9 @@
package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicReference;
+import javax.cache.expiry.ExpiryPolicy;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
@@ -36,10 +39,6 @@ import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteUuid;
import org.jetbrains.annotations.Nullable;
-import javax.cache.expiry.ExpiryPolicy;
-import java.util.UUID;
-import java.util.concurrent.atomic.AtomicReference;
-
import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_ASYNC;
@@ -255,11 +254,11 @@ public abstract class GridNearAtomicAbstractUpdateFuture extends GridFutureAdapt
* @param nodeId Node ID.
* @param req Request.
*/
- protected void mapSingle(UUID nodeId, GridNearAtomicUpdateRequest req) {
+ protected void mapSingle(UUID nodeId, GridNearAtomicAbstractUpdateRequest req) {
if (cctx.localNodeId().equals(nodeId)) {
cache.updateAllAsyncInternal(nodeId, req,
- new CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse>() {
- @Override public void apply(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) {
+ new CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse>() {
+ @Override public void apply(GridNearAtomicAbstractUpdateRequest req, GridNearAtomicUpdateResponse res) {
onResult(res.nodeId(), res, false);
}
});
@@ -303,7 +302,7 @@ public abstract class GridNearAtomicAbstractUpdateFuture extends GridFutureAdapt
* @param req Request.
* @param e Error.
*/
- protected void onSendError(GridNearAtomicUpdateRequest req, IgniteCheckedException e) {
+ protected void onSendError(GridNearAtomicAbstractUpdateRequest req, IgniteCheckedException e) {
synchronized (mux) {
GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(cctx.cacheId(),
req.nodeId(),
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java
new file mode 100644
index 0000000..bee2ecd
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java
@@ -0,0 +1,226 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.util.List;
+import java.util.UUID;
+import javax.cache.expiry.ExpiryPolicy;
+import javax.cache.processor.EntryProcessor;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheOperation;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ *
+ */
+public abstract class GridNearAtomicAbstractUpdateRequest extends GridCacheMessage implements GridCacheDeployable {
+ /** Message index. */
+ public static final int CACHE_MSG_IDX = nextIndexId();
+
+ /**
+ * @return Mapped node ID.
+ */
+ public abstract UUID nodeId();
+
+ /**
+ * @param nodeId Node ID.
+ */
+ public abstract void nodeId(UUID nodeId);
+
+ /**
+ * @return Subject ID.
+ */
+ public abstract UUID subjectId();
+
+ /**
+ * @return Task name hash.
+ */
+ public abstract int taskNameHash();
+
+ /**
+ * @return Future version.
+ */
+ public abstract GridCacheVersion futureVersion();
+
+ /**
+ * @return Flag indicating whether this is fast-map udpate.
+ */
+ public abstract boolean fastMap();
+
+ /**
+ * @return Update version for fast-map request.
+ */
+ public abstract GridCacheVersion updateVersion();
+
+ /**
+ * @return Topology locked flag.
+ */
+ public abstract boolean topologyLocked();
+
+ /**
+ * @return {@code True} if request sent from client node.
+ */
+ public abstract boolean clientRequest();
+
+ /**
+ * @return Cache write synchronization mode.
+ */
+ public abstract CacheWriteSynchronizationMode writeSynchronizationMode();
+
+ /**
+ * @return Expiry policy.
+ */
+ public abstract ExpiryPolicy expiry();
+
+ /**
+ * @return Return value flag.
+ */
+ public abstract boolean returnValue();
+
+ /**
+ * @return Filter.
+ */
+ @Nullable public abstract CacheEntryPredicate[] filter();
+
+ /**
+ * @return Skip write-through to a persistent storage.
+ */
+ public abstract boolean skipStore();
+
+ /**
+ * @return Keep binary flag.
+ */
+ public abstract boolean keepBinary();
+
+ /**
+ * @return Update operation.
+ */
+ public abstract GridCacheOperation operation();
+
+ /**
+ * @return Optional arguments for entry processor.
+ */
+ @Nullable public abstract Object[] invokeArguments();
+
+ /**
+ * @return Flag indicating whether this request contains primary keys.
+ */
+ public abstract boolean hasPrimary();
+
+ /**
+ * @param res Response.
+ * @return {@code True} if current response was {@code null}.
+ */
+ public abstract boolean onResponse(GridNearAtomicUpdateResponse res);
+
+ /**
+ * @return Response.
+ */
+ @Nullable public abstract GridNearAtomicUpdateResponse response();
+
+ /**
+ * @param key Key to add.
+ * @param val Optional update value.
+ * @param conflictTtl Conflict TTL (optional).
+ * @param conflictExpireTime Conflict expire time (optional).
+ * @param conflictVer Conflict version (optional).
+ * @param primary If given key is primary on this mapping.
+ */
+ public abstract void addUpdateEntry(KeyCacheObject key,
+ @Nullable Object val,
+ long conflictTtl,
+ long conflictExpireTime,
+ @Nullable GridCacheVersion conflictVer,
+ boolean primary);
+
+ /**
+ * @return Keys for this update request.
+ */
+ public abstract List<KeyCacheObject> keys();
+
+ /**
+ * @return Values for this update request.
+ */
+ public abstract List<?> values();
+
+ /**
+ * @param idx Key index.
+ * @return Value.
+ */
+ public abstract CacheObject value(int idx);
+
+ /**
+ * @param idx Key index.
+ * @return Entry processor.
+ */
+ public abstract EntryProcessor<Object, Object, Object> entryProcessor(int idx);
+
+ /**
+ * @param idx Index to get.
+ * @return Write value - either value, or transform closure.
+ */
+ public abstract CacheObject writeValue(int idx);
+
+
+ /**
+ * @return Conflict versions.
+ */
+ @Nullable public abstract List<GridCacheVersion> conflictVersions();
+
+ /**
+ * @param idx Index.
+ * @return Conflict version.
+ */
+ @Nullable public abstract GridCacheVersion conflictVersion(int idx);
+
+ /**
+ * @param idx Index.
+ * @return Conflict TTL.
+ */
+ public abstract long conflictTtl(int idx);
+
+ /**
+ * @param idx Index.
+ * @return Conflict expire time.
+ */
+ public abstract long conflictExpireTime(int idx);
+
+ /**
+ * Cleanup values.
+ *
+ * @param clearKeys If {@code true} clears keys.
+ */
+ public abstract void cleanup(boolean clearKeys);
+
+ /**
+ * @return Keys size.
+ */
+ public abstract int size();
+
+ /**
+ * @param idx Key index.
+ * @return Key.
+ */
+ public abstract KeyCacheObject key(int idx);
+}
[14/15] ignite git commit: IGNITE-3074 Optimize DHT atomic update
future
Posted by av...@apache.org.
IGNITE-3074 Optimize DHT atomic update future
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/88f38ac6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/88f38ac6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/88f38ac6
Branch: refs/heads/ignite-4242
Commit: 88f38ac6305578946f2881b12d2d557bd561f67d
Parents: a24a394
Author: Konstantin Dudkov <kd...@ya.ru>
Authored: Mon Nov 21 15:11:09 2016 +0300
Committer: Konstantin Dudkov <kd...@ya.ru>
Committed: Mon Nov 21 15:11:09 2016 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheEntryEx.java | 4 +-
.../processors/cache/GridCacheMapEntry.java | 4 +-
.../GridDhtAtomicAbstractUpdateFuture.java | 461 +++++++++++++++++++
.../dht/atomic/GridDhtAtomicCache.java | 33 +-
.../atomic/GridDhtAtomicSingleUpdateFuture.java | 121 +++++
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 393 +---------------
.../atomic/GridNearAtomicFullUpdateRequest.java | 24 +-
.../GridNearAtomicSingleUpdateFuture.java | 4 +-
.../continuous/CacheContinuousQueryHandler.java | 4 +-
.../CacheContinuousQueryListener.java | 4 +-
.../continuous/CacheContinuousQueryManager.java | 6 +-
.../processors/cache/GridCacheTestEntryEx.java | 4 +-
12 files changed, 638 insertions(+), 424 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/88f38ac6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
index ef6a244..176fe77 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
@@ -27,7 +27,7 @@ import org.apache.ignite.cache.eviction.EvictableEntry;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.distributed.GridDistributedLockCancelledException;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateFuture;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicAbstractUpdateFuture;
import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
@@ -504,7 +504,7 @@ public interface GridCacheEntryEx {
String taskName,
@Nullable CacheObject prevVal,
@Nullable Long updateCntr,
- @Nullable GridDhtAtomicUpdateFuture fut
+ @Nullable GridDhtAtomicAbstractUpdateFuture fut
) throws IgniteCheckedException, GridCacheEntryRemovedException;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/88f38ac6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index 5996672..2bcf360 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -43,7 +43,7 @@ import org.apache.ignite.internal.managers.deployment.GridDeploymentInfoBean;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateFuture;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicAbstractUpdateFuture;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheEntry;
import org.apache.ignite.internal.processors.cache.extras.GridCacheEntryExtras;
import org.apache.ignite.internal.processors.cache.extras.GridCacheMvccEntryExtras;
@@ -1951,7 +1951,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
final String taskName,
@Nullable final CacheObject prevVal,
@Nullable final Long updateCntr,
- @Nullable GridDhtAtomicUpdateFuture fut
+ @Nullable GridDhtAtomicAbstractUpdateFuture fut
) throws IgniteCheckedException, GridCacheEntryRemovedException, GridClosureException {
assert cctx.atomic();
http://git-wip-us.apache.org/repos/asf/ignite/blob/88f38ac6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java
new file mode 100644
index 0000000..3bbc348
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java
@@ -0,0 +1,461 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicReference;
+import javax.cache.processor.EntryProcessor;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheAtomicFuture;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.future.GridFutureAdapter;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.CI1;
+import org.apache.ignite.internal.util.typedef.CI2;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteUuid;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ * DHT atomic cache backup update future.
+ */
+public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapter<Void>
+ implements GridCacheAtomicFuture<Void> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Logger. */
+ protected static IgniteLogger log;
+
+ /** Logger reference. */
+ private static final AtomicReference<IgniteLogger> logRef = new AtomicReference<>();
+
+ /** Logger. */
+ protected static IgniteLogger msgLog;
+
+ /** Write version. */
+ protected final GridCacheVersion writeVer;
+
+ /** Cache context. */
+ protected final GridCacheContext cctx;
+
+ /** Future version. */
+ protected final GridCacheVersion futVer;
+
+ /** Completion callback. */
+ @GridToStringExclude
+ private final CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb;
+
+ /** Update request. */
+ private final GridNearAtomicAbstractUpdateRequest updateReq;
+
+ /** Update response. */
+ final GridNearAtomicUpdateResponse updateRes;
+
+ /** Force transform backup flag. */
+ private boolean forceTransformBackups;
+
+ /** Mappings. */
+ @GridToStringInclude
+ protected Map<UUID, GridDhtAtomicUpdateRequest> mappings;
+
+ /** Continuous query closures. */
+ private Collection<CI1<Boolean>> cntQryClsrs;
+
+ /** */
+ private final boolean waitForExchange;
+
+ /** Response count. */
+ private volatile int resCnt;
+
+ /**
+ * @param cctx Cache context.
+ * @param completionCb Callback to invoke when future is completed.
+ * @param writeVer Write version.
+ * @param updateReq Update request.
+ * @param updateRes Update response.
+ */
+ protected GridDhtAtomicAbstractUpdateFuture(
+ GridCacheContext cctx,
+ CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
+ GridCacheVersion writeVer,
+ GridNearAtomicAbstractUpdateRequest updateReq,
+ GridNearAtomicUpdateResponse updateRes) {
+ this.cctx = cctx;
+
+ futVer = cctx.versions().next(updateReq.topologyVersion());
+ this.updateReq = updateReq;
+ this.completionCb = completionCb;
+ this.updateRes = updateRes;
+ this.writeVer = writeVer;
+
+ waitForExchange = !(updateReq.topologyLocked() || (updateReq.fastMap() && !updateReq.clientRequest()));
+
+ if (log == null) {
+ msgLog = cctx.shared().atomicMessageLogger();
+ log = U.logger(cctx.kernalContext(), logRef, GridDhtAtomicUpdateFuture.class);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public final IgniteInternalFuture<Void> completeFuture(AffinityTopologyVersion topVer) {
+ if (waitForExchange && updateReq.topologyVersion().compareTo(topVer) < 0)
+ return this;
+
+ return null;
+ }
+
+ /**
+ * @param clsr Continuous query closure.
+ */
+ public final void addContinuousQueryClosure(CI1<Boolean> clsr) {
+ assert !isDone() : this;
+
+ if (cntQryClsrs == null)
+ cntQryClsrs = new ArrayList<>(10);
+
+ cntQryClsrs.add(clsr);
+ }
+
+ /**
+ * @param entry Entry to map.
+ * @param val Value to write.
+ * @param entryProcessor Entry processor.
+ * @param ttl TTL (optional).
+ * @param conflictExpireTime Conflict expire time (optional).
+ * @param conflictVer Conflict version (optional).
+ * @param addPrevVal If {@code true} sends previous value to backups.
+ * @param prevVal Previous value.
+ * @param updateCntr Partition update counter.
+ */
+ @SuppressWarnings("ForLoopReplaceableByForEach")
+ final void addWriteEntry(GridDhtCacheEntry entry,
+ @Nullable CacheObject val,
+ EntryProcessor<Object, Object, Object> entryProcessor,
+ long ttl,
+ long conflictExpireTime,
+ @Nullable GridCacheVersion conflictVer,
+ boolean addPrevVal,
+ @Nullable CacheObject prevVal,
+ long updateCntr) {
+ AffinityTopologyVersion topVer = updateReq.topologyVersion();
+
+ List<ClusterNode> dhtNodes = cctx.dht().topology().nodes(entry.partition(), topVer);
+
+ if (log.isDebugEnabled())
+ log.debug("Mapping entry to DHT nodes [nodes=" + U.nodeIds(dhtNodes) + ", entry=" + entry + ']');
+
+ CacheWriteSynchronizationMode syncMode = updateReq.writeSynchronizationMode();
+
+ addDhtKey(entry.key(), dhtNodes);
+
+ for (int i = 0; i < dhtNodes.size(); i++) {
+ ClusterNode node = dhtNodes.get(i);
+
+ UUID nodeId = node.id();
+
+ if (!nodeId.equals(cctx.localNodeId())) {
+ GridDhtAtomicUpdateRequest updateReq = mappings.get(nodeId);
+
+ if (updateReq == null) {
+ updateReq = new GridDhtAtomicUpdateRequest(
+ cctx.cacheId(),
+ nodeId,
+ futVer,
+ writeVer,
+ syncMode,
+ topVer,
+ forceTransformBackups,
+ this.updateReq.subjectId(),
+ this.updateReq.taskNameHash(),
+ forceTransformBackups ? this.updateReq.invokeArguments() : null,
+ cctx.deploymentEnabled(),
+ this.updateReq.keepBinary(),
+ this.updateReq.skipStore());
+
+ mappings.put(nodeId, updateReq);
+ }
+
+ updateReq.addWriteValue(entry.key(),
+ val,
+ entryProcessor,
+ ttl,
+ conflictExpireTime,
+ conflictVer,
+ addPrevVal,
+ entry.partition(),
+ prevVal,
+ updateCntr);
+ }
+ }
+ }
+
+ /**
+ * @param key Key.
+ * @param dhtNodes DHT nodes.
+ */
+ protected abstract void addDhtKey(KeyCacheObject key, List<ClusterNode> dhtNodes);
+
+ /**
+ * @param key Key.
+ * @param readers Near cache readers.
+ */
+ protected abstract void addNearKey(KeyCacheObject key, Collection<UUID> readers);
+
+ /**
+ * @param readers Entry readers.
+ * @param entry Entry.
+ * @param val Value.
+ * @param entryProcessor Entry processor..
+ * @param ttl TTL for near cache update (optional).
+ * @param expireTime Expire time for near cache update (optional).
+ */
+ final void addNearWriteEntries(Collection<UUID> readers,
+ GridDhtCacheEntry entry,
+ @Nullable CacheObject val,
+ EntryProcessor<Object, Object, Object> entryProcessor,
+ long ttl,
+ long expireTime) {
+ CacheWriteSynchronizationMode syncMode = updateReq.writeSynchronizationMode();
+
+ addNearKey(entry.key(), readers);
+
+ AffinityTopologyVersion topVer = updateReq.topologyVersion();
+
+ for (UUID nodeId : readers) {
+ GridDhtAtomicUpdateRequest updateReq = mappings.get(nodeId);
+
+ if (updateReq == null) {
+ ClusterNode node = cctx.discovery().node(nodeId);
+
+ // Node left the grid.
+ if (node == null)
+ continue;
+
+ updateReq = new GridDhtAtomicUpdateRequest(
+ cctx.cacheId(),
+ nodeId,
+ futVer,
+ writeVer,
+ syncMode,
+ topVer,
+ forceTransformBackups,
+ this.updateReq.subjectId(),
+ this.updateReq.taskNameHash(),
+ forceTransformBackups ? this.updateReq.invokeArguments() : null,
+ cctx.deploymentEnabled(),
+ this.updateReq.keepBinary(),
+ this.updateReq.skipStore());
+
+ mappings.put(nodeId, updateReq);
+ }
+
+ addNearReaderEntry(entry);
+
+ updateReq.addNearWriteValue(entry.key(),
+ val,
+ entryProcessor,
+ ttl,
+ expireTime);
+ }
+ }
+
+ /**
+ * adds new nearReader.
+ *
+ * @param entry GridDhtCacheEntry.
+ */
+ protected abstract void addNearReaderEntry(GridDhtCacheEntry entry);
+
+ /**
+ * @return Write version.
+ */
+ final GridCacheVersion writeVersion() {
+ return writeVer;
+ }
+
+ /** {@inheritDoc} */
+ @Override public final IgniteUuid futureId() {
+ return futVer.asGridUuid();
+ }
+
+ /** {@inheritDoc} */
+ @Override public final GridCacheVersion version() {
+ return futVer;
+ }
+
+ /** {@inheritDoc} */
+ @Override public final boolean onNodeLeft(UUID nodeId) {
+ boolean res = registerResponse(nodeId);
+
+ if (res && msgLog.isDebugEnabled()) {
+ msgLog.debug("DTH update fut, node left [futId=" + futVer + ", writeVer=" + writeVer +
+ ", node=" + nodeId + ']');
+ }
+
+ return res;
+ }
+
+ /**
+ * @param nodeId Node ID.
+ * @return {@code True} if request found.
+ */
+ final boolean registerResponse(UUID nodeId) {
+ int resCnt0;
+
+ GridDhtAtomicUpdateRequest req = mappings != null ? mappings.get(nodeId) : null;
+
+ if (req != null) {
+ synchronized (this) {
+ if (req.onResponse()) {
+ resCnt0 = resCnt;
+
+ resCnt0 += 1;
+
+ resCnt = resCnt0;
+ }
+ else
+ return false;
+ }
+
+ if (resCnt0 == mappings.size())
+ onDone();
+
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Sends requests to remote nodes.
+ */
+ final void map() {
+ if (!F.isEmpty(mappings)) {
+ for (GridDhtAtomicUpdateRequest req : mappings.values()) {
+ try {
+ cctx.io().send(req.nodeId(), req, cctx.ioPolicy());
+
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DTH update fut, sent request [futId=" + futVer +
+ ", writeVer=" + writeVer + ", node=" + req.nodeId() + ']');
+ }
+ }
+ catch (ClusterTopologyCheckedException ignored) {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DTH update fut, failed to send request, node left [futId=" + futVer +
+ ", writeVer=" + writeVer + ", node=" + req.nodeId() + ']');
+ }
+
+ registerResponse(req.nodeId());
+ }
+ catch (IgniteCheckedException e) {
+ U.error(msgLog, "Failed to send request [futId=" + futVer +
+ ", writeVer=" + writeVer + ", node=" + req.nodeId() + ']');
+
+ registerResponse(req.nodeId());
+ }
+ }
+ }
+ else
+ onDone();
+
+ // Send response right away if no ACKs from backup is required.
+ // Backups will send ACKs anyway, future will be completed after all backups have replied.
+ if (updateReq.writeSynchronizationMode() != FULL_SYNC)
+ completionCb.apply(updateReq, updateRes);
+ }
+
+ /**
+ * Deferred update response.
+ *
+ * @param nodeId Backup node ID.
+ */
+ public final void onResult(UUID nodeId) {
+ if (log.isDebugEnabled())
+ log.debug("Received deferred DHT atomic update future result [nodeId=" + nodeId + ']');
+
+ registerResponse(nodeId);
+ }
+
+ /**
+ * Callback for backup update response.
+ *
+ * @param nodeId Backup node ID.
+ * @param updateRes Update response.
+ */
+ public abstract void onResult(UUID nodeId, GridDhtAtomicUpdateResponse updateRes);
+
+ /**
+ * @param updateRes Response.
+ * @param err Error.
+ */
+ protected abstract void addFailedKeys(GridNearAtomicUpdateResponse updateRes, Throwable err);
+
+ /** {@inheritDoc} */
+ @Override public final boolean onDone(@Nullable Void res, @Nullable Throwable err) {
+ if (super.onDone(res, err)) {
+ cctx.mvcc().removeAtomicFuture(version());
+
+ boolean suc = err == null;
+
+ if (!suc)
+ addFailedKeys(updateRes, err);
+
+ if (cntQryClsrs != null) {
+ for (CI1<Boolean> clsr : cntQryClsrs)
+ clsr.apply(suc);
+ }
+
+ if (updateReq.writeSynchronizationMode() == FULL_SYNC)
+ completionCb.apply(updateReq, updateRes);
+
+ return true;
+ }
+
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean trackable() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void markNotTrackable() {
+ // No-op.
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/88f38ac6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index f7d1973..d7eb062 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -1685,7 +1685,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
assert !req.returnValue() || (req.operation() == TRANSFORM || req.size() == 1);
- GridDhtAtomicUpdateFuture dhtFut = null;
+ GridDhtAtomicAbstractUpdateFuture dhtFut = null;
boolean remap = false;
@@ -1908,7 +1908,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
final GridNearAtomicUpdateResponse res,
final List<GridDhtCacheEntry> locked,
final GridCacheVersion ver,
- @Nullable GridDhtAtomicUpdateFuture dhtFut,
+ @Nullable GridDhtAtomicAbstractUpdateFuture dhtFut,
final CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
final boolean replicate,
final String taskName,
@@ -2331,7 +2331,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
GridNearAtomicUpdateResponse res,
List<GridDhtCacheEntry> locked,
GridCacheVersion ver,
- @Nullable GridDhtAtomicUpdateFuture dhtFut,
+ @Nullable GridDhtAtomicAbstractUpdateFuture dhtFut,
CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
boolean replicate,
String taskName,
@@ -2552,7 +2552,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
* @return Deleted entries.
*/
@SuppressWarnings("ForLoopReplaceableByForEach")
- @Nullable private GridDhtAtomicUpdateFuture updatePartialBatch(
+ @Nullable private GridDhtAtomicAbstractUpdateFuture updatePartialBatch(
final boolean hasNear,
final int firstEntryIdx,
final List<GridDhtCacheEntry> entries,
@@ -2562,7 +2562,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
@Nullable final Map<KeyCacheObject, CacheObject> putMap,
@Nullable final Collection<KeyCacheObject> rmvKeys,
@Nullable final Map<KeyCacheObject, EntryProcessor<Object, Object, Object>> entryProcessorMap,
- @Nullable GridDhtAtomicUpdateFuture dhtFut,
+ @Nullable GridDhtAtomicAbstractUpdateFuture dhtFut,
final CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
final GridNearAtomicAbstractUpdateRequest req,
final GridNearAtomicUpdateResponse res,
@@ -3036,7 +3036,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
* @param force If {@code true} then creates future without optimizations checks.
* @return Backup update future or {@code null} if there are no backups.
*/
- @Nullable private GridDhtAtomicUpdateFuture createDhtFuture(
+ @Nullable private GridDhtAtomicAbstractUpdateFuture createDhtFuture(
GridCacheVersion writeVer,
GridNearAtomicAbstractUpdateRequest updateReq,
GridNearAtomicUpdateResponse updateRes,
@@ -3064,7 +3064,10 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
}
}
- return new GridDhtAtomicUpdateFuture(ctx, completionCb, writeVer, updateReq, updateRes);
+ if (updateReq.size() == 1)
+ return new GridDhtAtomicSingleUpdateFuture(ctx, completionCb, writeVer, updateReq, updateRes);
+ else
+ return new GridDhtAtomicUpdateFuture(ctx, completionCb, writeVer, updateReq, updateRes);
}
/**
@@ -3256,7 +3259,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
*/
@SuppressWarnings("unchecked")
private void processDhtAtomicUpdateResponse(UUID nodeId, GridDhtAtomicUpdateResponse res) {
- GridDhtAtomicUpdateFuture updateFut = (GridDhtAtomicUpdateFuture)ctx.mvcc().atomicFuture(res.futureVersion());
+ GridDhtAtomicAbstractUpdateFuture updateFut = (GridDhtAtomicAbstractUpdateFuture)ctx.mvcc().atomicFuture(res.futureVersion());
if (updateFut != null) {
if (msgLog.isDebugEnabled()) {
@@ -3279,7 +3282,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
@SuppressWarnings("unchecked")
private void processDhtAtomicDeferredUpdateResponse(UUID nodeId, GridDhtAtomicDeferredUpdateResponse res) {
for (GridCacheVersion ver : res.futureVersions()) {
- GridDhtAtomicUpdateFuture updateFut = (GridDhtAtomicUpdateFuture)ctx.mvcc().atomicFuture(ver);
+ GridDhtAtomicAbstractUpdateFuture updateFut = (GridDhtAtomicAbstractUpdateFuture)ctx.mvcc().atomicFuture(ver);
if (updateFut != null) {
if (msgLog.isDebugEnabled()) {
@@ -3335,7 +3338,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
private final Collection<IgniteBiTuple<GridDhtCacheEntry, GridCacheVersion>> deleted;
/** */
- private final GridDhtAtomicUpdateFuture dhtFut;
+ private final GridDhtAtomicAbstractUpdateFuture dhtFut;
/**
* @param retVal Return value.
@@ -3344,7 +3347,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
*/
private UpdateSingleResult(GridCacheReturn retVal,
Collection<IgniteBiTuple<GridDhtCacheEntry, GridCacheVersion>> deleted,
- GridDhtAtomicUpdateFuture dhtFut) {
+ GridDhtAtomicAbstractUpdateFuture dhtFut) {
this.retVal = retVal;
this.deleted = deleted;
this.dhtFut = dhtFut;
@@ -3367,7 +3370,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
/**
* @return DHT future.
*/
- public GridDhtAtomicUpdateFuture dhtFuture() {
+ public GridDhtAtomicAbstractUpdateFuture dhtFuture() {
return dhtFut;
}
}
@@ -3380,7 +3383,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
private Collection<IgniteBiTuple<GridDhtCacheEntry, GridCacheVersion>> deleted;
/** */
- private GridDhtAtomicUpdateFuture dhtFut;
+ private GridDhtAtomicAbstractUpdateFuture dhtFut;
/** */
private boolean readersOnly;
@@ -3414,7 +3417,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
/**
* @return DHT future.
*/
- public GridDhtAtomicUpdateFuture dhtFuture() {
+ public GridDhtAtomicAbstractUpdateFuture dhtFuture() {
return dhtFut;
}
@@ -3435,7 +3438,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
/**
* @param dhtFut DHT future.
*/
- private void dhtFuture(@Nullable GridDhtAtomicUpdateFuture dhtFut) {
+ private void dhtFuture(@Nullable GridDhtAtomicAbstractUpdateFuture dhtFut) {
this.dhtFut = dhtFut;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/88f38ac6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java
new file mode 100644
index 0000000..f83a7b7
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.UUID;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.typedef.CI2;
+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;
+
+/**
+ *
+ */
+class GridDhtAtomicSingleUpdateFuture extends GridDhtAtomicAbstractUpdateFuture {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Future keys. */
+ private KeyCacheObject key;
+
+ /** Entries with readers. */
+ private GridDhtCacheEntry nearReaderEntry;
+
+ /**
+ * @param cctx Cache context.
+ * @param completionCb Callback to invoke when future is completed.
+ * @param writeVer Write version.
+ * @param updateReq Update request.
+ * @param updateRes Update response.
+ */
+ GridDhtAtomicSingleUpdateFuture(
+ GridCacheContext cctx,
+ CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
+ GridCacheVersion writeVer,
+ GridNearAtomicAbstractUpdateRequest updateReq,
+ GridNearAtomicUpdateResponse updateRes
+ ) {
+ super(cctx, completionCb, writeVer, updateReq, updateRes);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void addDhtKey(KeyCacheObject key, List<ClusterNode> dhtNodes) {
+ assert this.key == null || this.key.equals(key) : this.key;
+
+ if (mappings == null)
+ mappings = U.newHashMap(dhtNodes.size());
+
+ this.key = key;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void addNearKey(KeyCacheObject key, Collection<UUID> readers) {
+ assert this.key == null || this.key.equals(key) : this.key;
+
+ if (mappings == null)
+ mappings = U.newHashMap(readers.size());
+
+ this.key = key;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void addNearReaderEntry(GridDhtCacheEntry entry) {
+ nearReaderEntry = entry;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onResult(UUID nodeId, GridDhtAtomicUpdateResponse updateRes) {
+ if (log.isDebugEnabled())
+ log.debug("Received DHT atomic update future result [nodeId=" + nodeId + ", updateRes=" + updateRes + ']');
+
+ if (updateRes.error() != null)
+ this.updateRes.addFailedKeys(updateRes.failedKeys(), updateRes.error());
+
+ if (!F.isEmpty(updateRes.nearEvicted())) {
+ try {
+ assert nearReaderEntry != null;
+
+ nearReaderEntry.removeReader(nodeId, updateRes.messageId());
+ }
+ catch (GridCacheEntryRemovedException e) {
+ if (log.isDebugEnabled())
+ log.debug("Entry with evicted reader was removed [entry=" + nearReaderEntry + ", err=" + e + ']');
+ }
+ }
+
+ registerResponse(nodeId);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void addFailedKeys(GridNearAtomicUpdateResponse updateRes, Throwable err) {
+ updateRes.addFailedKey(key, err);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDhtAtomicSingleUpdateFuture.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/88f38ac6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
index c2ad8b8..864aadd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
@@ -23,92 +23,30 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-import java.util.concurrent.atomic.AtomicReference;
-import javax.cache.processor.EntryProcessor;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.CacheObject;
-import org.apache.ignite.internal.processors.cache.GridCacheAtomicFuture;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.util.future.GridFutureAdapter;
-import org.apache.ignite.internal.util.tostring.GridToStringExclude;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-import org.apache.ignite.internal.util.typedef.CI1;
import org.apache.ignite.internal.util.typedef.CI2;
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.lang.IgniteUuid;
-import org.jetbrains.annotations.Nullable;
-
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
/**
* DHT atomic cache backup update future.
*/
-public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
- implements GridCacheAtomicFuture<Void> {
+class GridDhtAtomicUpdateFuture extends GridDhtAtomicAbstractUpdateFuture {
/** */
private static final long serialVersionUID = 0L;
- /** Logger reference. */
- private static final AtomicReference<IgniteLogger> logRef = new AtomicReference<>();
-
- /** Logger. */
- private static IgniteLogger log;
-
- /** Logger. */
- private static IgniteLogger msgLog;
-
- /** Cache context. */
- private final GridCacheContext cctx;
-
- /** Future version. */
- private final GridCacheVersion futVer;
-
- /** Write version. */
- private final GridCacheVersion writeVer;
-
- /** Force transform backup flag. */
- private boolean forceTransformBackups;
-
- /** Completion callback. */
- @GridToStringExclude
- private final CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb;
-
- /** Mappings. */
- @GridToStringInclude
- private final Map<UUID, GridDhtAtomicUpdateRequest> mappings;
-
- /** Entries with readers. */
- private Map<KeyCacheObject, GridDhtCacheEntry> nearReadersEntries;
-
- /** Update request. */
- private final GridNearAtomicAbstractUpdateRequest updateReq;
-
- /** Update response. */
- private final GridNearAtomicUpdateResponse updateRes;
-
/** Future keys. */
private final Collection<KeyCacheObject> keys;
- /** Continuous query closures. */
- private Collection<CI1<Boolean>> cntQryClsrs;
-
- /** */
- private final boolean waitForExchange;
+ /** Entries with readers. */
+ private Map<KeyCacheObject, GridDhtCacheEntry> nearReadersEntries;
- /** Response count. */
- private volatile int resCnt;
/**
* @param cctx Cache context.
@@ -117,328 +55,39 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
* @param updateReq Update request.
* @param updateRes Update response.
*/
- public GridDhtAtomicUpdateFuture(
+ GridDhtAtomicUpdateFuture(
GridCacheContext cctx,
CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
GridCacheVersion writeVer,
GridNearAtomicAbstractUpdateRequest updateReq,
GridNearAtomicUpdateResponse updateRes
) {
- this.cctx = cctx;
- this.writeVer = writeVer;
-
- futVer = cctx.versions().next(updateReq.topologyVersion());
- this.updateReq = updateReq;
- this.completionCb = completionCb;
- this.updateRes = updateRes;
-
- if (log == null) {
- msgLog = cctx.shared().atomicMessageLogger();
- log = U.logger(cctx.kernalContext(), logRef, GridDhtAtomicUpdateFuture.class);
- }
+ super(cctx, completionCb, writeVer, updateReq, updateRes);
keys = new ArrayList<>(updateReq.size());
mappings = U.newHashMap(updateReq.size());
-
- waitForExchange = !(updateReq.topologyLocked() || (updateReq.fastMap() && !updateReq.clientRequest()));
- }
-
- /**
- * @return Write version.
- */
- GridCacheVersion writeVersion() {
- return writeVer;
- }
-
- /** {@inheritDoc} */
- @Override public IgniteUuid futureId() {
- return futVer.asGridUuid();
}
/** {@inheritDoc} */
- @Override public GridCacheVersion version() {
- return futVer;
+ @Override protected void addDhtKey(KeyCacheObject key, List<ClusterNode> dhtNodes) {
+ keys.add(key);
}
/** {@inheritDoc} */
- @Override public boolean onNodeLeft(UUID nodeId) {
- boolean res = registerResponse(nodeId);
-
- if (res && msgLog.isDebugEnabled()) {
- msgLog.debug("DTH update fut, node left [futId=" + futVer + ", writeVer=" + writeVer +
- ", node=" + nodeId + ']');
- }
-
- return res;
- }
-
- /**
- * @param nodeId Node ID.
- * @return {@code True} if request found.
- */
- private boolean registerResponse(UUID nodeId) {
- int resCnt0;
-
- GridDhtAtomicUpdateRequest req = mappings.get(nodeId);
-
- if (req != null) {
- synchronized (this) {
- if (req.onResponse()) {
- resCnt0 = resCnt;
-
- resCnt0 += 1;
-
- resCnt = resCnt0;
- }
- else
- return false;
- }
-
- if (resCnt0 == mappings.size())
- onDone();
-
- return true;
- }
-
- return false;
+ @Override protected void addNearKey(KeyCacheObject key, Collection<UUID> readers) {
+ keys.add(key);
}
/** {@inheritDoc} */
- @Override public boolean trackable() {
- return true;
- }
+ @Override protected void addNearReaderEntry(GridDhtCacheEntry entry) {
+ if (nearReadersEntries == null)
+ nearReadersEntries = new HashMap<>();
- /** {@inheritDoc} */
- @Override public void markNotTrackable() {
- // No-op.
+ nearReadersEntries.put(entry.key(), entry);
}
/** {@inheritDoc} */
- @Override public IgniteInternalFuture<Void> completeFuture(AffinityTopologyVersion topVer) {
- if (waitForExchange && updateReq.topologyVersion().compareTo(topVer) < 0)
- return this;
-
- return null;
- }
-
- /**
- * @param entry Entry to map.
- * @param val Value to write.
- * @param entryProcessor Entry processor.
- * @param ttl TTL (optional).
- * @param conflictExpireTime Conflict expire time (optional).
- * @param conflictVer Conflict version (optional).
- * @param addPrevVal If {@code true} sends previous value to backups.
- * @param prevVal Previous value.
- * @param updateCntr Partition update counter.
- */
- @SuppressWarnings("ForLoopReplaceableByForEach")
- public void addWriteEntry(GridDhtCacheEntry entry,
- @Nullable CacheObject val,
- EntryProcessor<Object, Object, Object> entryProcessor,
- long ttl,
- long conflictExpireTime,
- @Nullable GridCacheVersion conflictVer,
- boolean addPrevVal,
- @Nullable CacheObject prevVal,
- long updateCntr) {
- AffinityTopologyVersion topVer = updateReq.topologyVersion();
-
- List<ClusterNode> dhtNodes = cctx.dht().topology().nodes(entry.partition(), topVer);
-
- if (log.isDebugEnabled())
- log.debug("Mapping entry to DHT nodes [nodes=" + U.nodeIds(dhtNodes) + ", entry=" + entry + ']');
-
- CacheWriteSynchronizationMode syncMode = updateReq.writeSynchronizationMode();
-
- keys.add(entry.key());
-
- for (int i = 0; i < dhtNodes.size(); i++) {
- ClusterNode node = dhtNodes.get(i);
-
- UUID nodeId = node.id();
-
- if (!nodeId.equals(cctx.localNodeId())) {
- GridDhtAtomicUpdateRequest updateReq = mappings.get(nodeId);
-
- if (updateReq == null) {
- updateReq = new GridDhtAtomicUpdateRequest(
- cctx.cacheId(),
- nodeId,
- futVer,
- writeVer,
- syncMode,
- topVer,
- forceTransformBackups,
- this.updateReq.subjectId(),
- this.updateReq.taskNameHash(),
- forceTransformBackups ? this.updateReq.invokeArguments() : null,
- cctx.deploymentEnabled(),
- this.updateReq.keepBinary(),
- this.updateReq.skipStore());
-
- mappings.put(nodeId, updateReq);
- }
-
- updateReq.addWriteValue(entry.key(),
- val,
- entryProcessor,
- ttl,
- conflictExpireTime,
- conflictVer,
- addPrevVal,
- entry.partition(),
- prevVal,
- updateCntr);
- }
- }
- }
-
- /**
- * @param readers Entry readers.
- * @param entry Entry.
- * @param val Value.
- * @param entryProcessor Entry processor..
- * @param ttl TTL for near cache update (optional).
- * @param expireTime Expire time for near cache update (optional).
- */
- public void addNearWriteEntries(Iterable<UUID> readers,
- GridDhtCacheEntry entry,
- @Nullable CacheObject val,
- EntryProcessor<Object, Object, Object> entryProcessor,
- long ttl,
- long expireTime) {
- CacheWriteSynchronizationMode syncMode = updateReq.writeSynchronizationMode();
-
- keys.add(entry.key());
-
- AffinityTopologyVersion topVer = updateReq.topologyVersion();
-
- for (UUID nodeId : readers) {
- GridDhtAtomicUpdateRequest updateReq = mappings.get(nodeId);
-
- if (updateReq == null) {
- ClusterNode node = cctx.discovery().node(nodeId);
-
- // Node left the grid.
- if (node == null)
- continue;
-
- updateReq = new GridDhtAtomicUpdateRequest(
- cctx.cacheId(),
- nodeId,
- futVer,
- writeVer,
- syncMode,
- topVer,
- forceTransformBackups,
- this.updateReq.subjectId(),
- this.updateReq.taskNameHash(),
- forceTransformBackups ? this.updateReq.invokeArguments() : null,
- cctx.deploymentEnabled(),
- this.updateReq.keepBinary(),
- this.updateReq.skipStore());
-
- mappings.put(nodeId, updateReq);
- }
-
- if (nearReadersEntries == null)
- nearReadersEntries = new HashMap<>();
-
- nearReadersEntries.put(entry.key(), entry);
-
- updateReq.addNearWriteValue(entry.key(),
- val,
- entryProcessor,
- ttl,
- expireTime);
- }
- }
-
- /**
- * @param clsr Continuous query closure.
- */
- public void addContinuousQueryClosure(CI1<Boolean> clsr){
- assert !isDone() : this;
-
- if (cntQryClsrs == null)
- cntQryClsrs = new ArrayList<>(10);
-
- cntQryClsrs.add(clsr);
- }
-
- /** {@inheritDoc} */
- @Override public boolean onDone(@Nullable Void res, @Nullable Throwable err) {
- if (super.onDone(res, err)) {
- cctx.mvcc().removeAtomicFuture(version());
-
- boolean suc = err == null;
-
- if (!suc) {
- for (KeyCacheObject key : keys)
- updateRes.addFailedKey(key, err);
- }
-
- if (cntQryClsrs != null) {
- for (CI1<Boolean> clsr : cntQryClsrs)
- clsr.apply(suc);
- }
-
- if (updateReq.writeSynchronizationMode() == FULL_SYNC)
- completionCb.apply(updateReq, updateRes);
-
- return true;
- }
-
- return false;
- }
-
- /**
- * Sends requests to remote nodes.
- */
- public void map() {
- if (!mappings.isEmpty()) {
- for (GridDhtAtomicUpdateRequest req : mappings.values()) {
- try {
- cctx.io().send(req.nodeId(), req, cctx.ioPolicy());
-
- if (msgLog.isDebugEnabled()) {
- msgLog.debug("DTH update fut, sent request [futId=" + futVer +
- ", writeVer=" + writeVer + ", node=" + req.nodeId() + ']');
- }
- }
- catch (ClusterTopologyCheckedException ignored) {
- if (msgLog.isDebugEnabled()) {
- msgLog.debug("DTH update fut, failed to send request, node left [futId=" + futVer +
- ", writeVer=" + writeVer + ", node=" + req.nodeId() + ']');
- }
-
- registerResponse(req.nodeId());
- }
- catch (IgniteCheckedException e) {
- U.error(msgLog, "Failed to send request [futId=" + futVer +
- ", writeVer=" + writeVer + ", node=" + req.nodeId() + ']');
-
- registerResponse(req.nodeId());
- }
- }
- }
- else
- onDone();
-
- // Send response right away if no ACKs from backup is required.
- // Backups will send ACKs anyway, future will be completed after all backups have replied.
- if (updateReq.writeSynchronizationMode() != FULL_SYNC)
- completionCb.apply(updateReq, updateRes);
- }
-
- /**
- * Callback for backup update response.
- *
- * @param nodeId Backup node ID.
- * @param updateRes Update response.
- */
- public void onResult(UUID nodeId, GridDhtAtomicUpdateResponse updateRes) {
+ @Override public void onResult(UUID nodeId, GridDhtAtomicUpdateResponse updateRes) {
if (log.isDebugEnabled())
log.debug("Received DHT atomic update future result [nodeId=" + nodeId + ", updateRes=" + updateRes + ']');
@@ -462,16 +111,10 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
registerResponse(nodeId);
}
- /**
- * Deferred update response.
- *
- * @param nodeId Backup node ID.
- */
- public void onResult(UUID nodeId) {
- if (log.isDebugEnabled())
- log.debug("Received deferred DHT atomic update future result [nodeId=" + nodeId + ']');
-
- registerResponse(nodeId);
+ /** {@inheritDoc} */
+ @Override protected void addFailedKeys(GridNearAtomicUpdateResponse updateRes, Throwable err) {
+ for (KeyCacheObject key : keys)
+ updateRes.addFailedKey(key, err);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/88f38ac6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
index e2314f8..b733d7b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
@@ -487,44 +487,32 @@ public class GridNearAtomicFullUpdateRequest extends GridNearAtomicAbstractUpdat
return invokeArgs;
}
- /**
- * @return Flag indicating whether this is fast-map udpate.
- */
+ /** {@inheritDoc} */
@Override public boolean fastMap() {
return fastMap;
}
- /**
- * @return Topology locked flag.
- */
+ /** {@inheritDoc} */
@Override public boolean topologyLocked() {
return topLocked;
}
- /**
- * @return {@code True} if request sent from client node.
- */
+ /** {@inheritDoc} */
@Override public boolean clientRequest() {
return clientReq;
}
- /**
- * @return Return value flag.
- */
+ /** {@inheritDoc} */
@Override public boolean returnValue() {
return retval;
}
- /**
- * @return Skip write-through to a persistent storage.
- */
+ /** {@inheritDoc} */
@Override public boolean skipStore() {
return skipStore;
}
- /**
- * @return Keep binary flag.
- */
+ /** {@inheritDoc} */
@Override public boolean keepBinary() {
return keepBinary;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/88f38ac6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
index eaf2f2c..bd231cf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
@@ -667,9 +667,7 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
* @return {@code True} can use 'single' update requests.
*/
private boolean canUseSingleRequest(ClusterNode node) {
- assert node != null;
-
- return expiryPlc == null && node.version().compareToIgnoreTimestamp(SINGLE_UPDATE_REQUEST) >= 0;
+ return expiryPlc == null && node != null && node.version().compareToIgnoreTimestamp(SINGLE_UPDATE_REQUEST) >= 0;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/88f38ac6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
index 304d031..10784fc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
@@ -59,7 +59,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
import org.apache.ignite.internal.processors.cache.GridCacheAffinityManager;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheDeploymentManager;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateFuture;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicAbstractUpdateFuture;
import org.apache.ignite.internal.processors.cache.query.CacheQueryType;
import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryManager.JCacheQueryLocalListener;
import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryManager.JCacheQueryRemoteFilter;
@@ -382,7 +382,7 @@ public class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler
@Override public void onEntryUpdated(final CacheContinuousQueryEvent<K, V> evt,
boolean primary,
final boolean recordIgniteEvt,
- GridDhtAtomicUpdateFuture fut) {
+ GridDhtAtomicAbstractUpdateFuture fut) {
if (ignoreExpired && evt.getEventType() == EventType.EXPIRED)
return ;
http://git-wip-us.apache.org/repos/asf/ignite/blob/88f38ac6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryListener.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryListener.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryListener.java
index 8eca81c..84b22f9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryListener.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryListener.java
@@ -20,7 +20,7 @@ package org.apache.ignite.internal.processors.cache.query.continuous;
import java.util.Map;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateFuture;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicAbstractUpdateFuture;
import org.jetbrains.annotations.Nullable;
/**
@@ -41,7 +41,7 @@ public interface CacheContinuousQueryListener<K, V> {
* @param fut Dht atomic future.
*/
public void onEntryUpdated(CacheContinuousQueryEvent<K, V> evt, boolean primary,
- boolean recordIgniteEvt, @Nullable GridDhtAtomicUpdateFuture fut);
+ boolean recordIgniteEvt, @Nullable GridDhtAtomicAbstractUpdateFuture fut);
/**
* Listener unregistered callback.
http://git-wip-us.apache.org/repos/asf/ignite/blob/88f38ac6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
index 2863f3d..e2fbf52 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
@@ -56,7 +56,7 @@ import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
import org.apache.ignite.internal.processors.cache.GridCacheManagerAdapter;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateFuture;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicAbstractUpdateFuture;
import org.apache.ignite.internal.processors.continuous.GridContinuousHandler;
import org.apache.ignite.internal.processors.continuous.GridContinuousProcessor;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
@@ -245,7 +245,7 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
boolean primary,
boolean preload,
long updateCntr,
- @Nullable GridDhtAtomicUpdateFuture fut,
+ @Nullable GridDhtAtomicAbstractUpdateFuture fut,
AffinityTopologyVersion topVer
) throws IgniteCheckedException {
Map<UUID, CacheContinuousQueryListener> lsnrCol = updateListeners(internal, preload);
@@ -290,7 +290,7 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
boolean primary,
boolean preload,
long updateCntr,
- @Nullable GridDhtAtomicUpdateFuture fut,
+ @Nullable GridDhtAtomicAbstractUpdateFuture fut,
AffinityTopologyVersion topVer)
throws IgniteCheckedException
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/88f38ac6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
index bf543cb..396629a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
@@ -26,7 +26,7 @@ import javax.cache.processor.EntryProcessorResult;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.eviction.EvictableEntry;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateFuture;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicAbstractUpdateFuture;
import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
@@ -542,7 +542,7 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
String taskName,
@Nullable CacheObject prevVal,
@Nullable Long updateCntr,
- @Nullable GridDhtAtomicUpdateFuture fut) throws IgniteCheckedException,
+ @Nullable GridDhtAtomicAbstractUpdateFuture fut) throws IgniteCheckedException,
GridCacheEntryRemovedException {
assert false;
[03/15] ignite git commit: Fixed classnames.properties generation for
ignite-hadoop module.
Posted by av...@apache.org.
Fixed classnames.properties generation for ignite-hadoop module.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5a4ebd5d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5a4ebd5d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5a4ebd5d
Branch: refs/heads/ignite-4242
Commit: 5a4ebd5de8751dcf32a26c96bf4f39e43bcbb341
Parents: baa7526
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Nov 11 09:49:41 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Nov 11 09:49:41 2016 +0700
----------------------------------------------------------------------
modules/hadoop/pom.xml | 49 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5a4ebd5d/modules/hadoop/pom.xml
----------------------------------------------------------------------
diff --git a/modules/hadoop/pom.xml b/modules/hadoop/pom.xml
index c02a574..15d6eee 100644
--- a/modules/hadoop/pom.xml
+++ b/modules/hadoop/pom.xml
@@ -127,6 +127,55 @@
<build>
<plugins>
<plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.3.2</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-tools</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ <configuration>
+ <includePluginDependencies>true</includePluginDependencies>
+ <mainClass>org.apache.ignite.tools.classgen.ClassesGenerator</mainClass>
+ <arguments>
+ <argument>${project.basedir}/target/classes</argument>
+ <argument>
+ <![CDATA[
+#
+# 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.
+#
+ ]]>
+ </argument>
+ <argument>org.apache.ignite</argument>
+ </arguments>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
[09/15] ignite git commit: IGNITE-3443 Implemented metrics for
queries monitoring.
Posted by av...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/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 ade21ce..0d291cc 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -75,11 +75,13 @@ org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicy$HolderComparator
org.apache.ignite.cache.query.CacheQueryEntryEvent
org.apache.ignite.cache.query.ContinuousQuery
org.apache.ignite.cache.query.Query
+org.apache.ignite.cache.query.QueryCancelledException
org.apache.ignite.cache.query.ScanQuery
org.apache.ignite.cache.query.SpiQuery
org.apache.ignite.cache.query.SqlFieldsQuery
org.apache.ignite.cache.query.SqlQuery
org.apache.ignite.cache.query.TextQuery
+org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore$2
org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore$EntryMapping$1
org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore$EntryMapping$2
org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore$TypeKind
@@ -366,6 +368,7 @@ org.apache.ignite.internal.processors.cache.CacheWeakQueryIteratorsHolder$WeakQu
org.apache.ignite.internal.processors.cache.CacheWeakQueryIteratorsHolder$WeakReferenceCloseableIterator
org.apache.ignite.internal.processors.cache.DynamicCacheChangeBatch
org.apache.ignite.internal.processors.cache.DynamicCacheChangeRequest
+org.apache.ignite.internal.processors.cache.EntryProcessorResourceInjectorProxy
org.apache.ignite.internal.processors.cache.GridCacheAdapter
org.apache.ignite.internal.processors.cache.GridCacheAdapter$10
org.apache.ignite.internal.processors.cache.GridCacheAdapter$11
@@ -373,9 +376,9 @@ org.apache.ignite.internal.processors.cache.GridCacheAdapter$12
org.apache.ignite.internal.processors.cache.GridCacheAdapter$13
org.apache.ignite.internal.processors.cache.GridCacheAdapter$14
org.apache.ignite.internal.processors.cache.GridCacheAdapter$15
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$16$1
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$16
org.apache.ignite.internal.processors.cache.GridCacheAdapter$17
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$18
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$18$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$2
org.apache.ignite.internal.processors.cache.GridCacheAdapter$26$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$28
@@ -533,6 +536,7 @@ org.apache.ignite.internal.processors.cache.GridCacheUtils$8
org.apache.ignite.internal.processors.cache.GridCacheUtils$9
org.apache.ignite.internal.processors.cache.GridCacheValueCollection
org.apache.ignite.internal.processors.cache.GridCacheValueCollection$1
+org.apache.ignite.internal.processors.cache.GridDeferredAckMessageSender$DeferredAckMessageBuffer
org.apache.ignite.internal.processors.cache.IgniteCacheProxy
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$1
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$10
@@ -545,12 +549,13 @@ org.apache.ignite.internal.processors.cache.IgniteCacheProxy$8
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$9
org.apache.ignite.internal.processors.cache.KeyCacheObject
org.apache.ignite.internal.processors.cache.KeyCacheObjectImpl
+org.apache.ignite.internal.processors.cache.QueryCursorImpl$State
org.apache.ignite.internal.processors.cache.affinity.GridCacheAffinityProxy
org.apache.ignite.internal.processors.cache.binary.BinaryMetadataKey
org.apache.ignite.internal.processors.cache.binary.CacheDefaultBinaryAffinityKeyMapper
org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$1
-org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$4
org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$5
+org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$6
org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$MetaDataEntryFilter
org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$MetaDataPredicate
org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$MetadataProcessor
@@ -630,6 +635,7 @@ org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocal$2
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocalAdapter
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocalAdapter$1
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocalAdapter$2
+org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxOnePhaseCommitAckRequest
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture$2
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture$3
@@ -670,25 +676,23 @@ org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomic
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$27
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$28
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$29
-org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$3
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$30
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$31
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$4
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$5
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$6
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$7
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$8
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$9
-org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$DeferredResponseBuffer
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicDeferredUpdateResponse
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicAbstractUpdateFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFuture$2
-org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFuture$3
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$2
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$3
-org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$4
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse
org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCache
@@ -760,6 +764,7 @@ org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$2
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$3
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$4
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$LockTimeoutObject$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$MiniFuture$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockRequest
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockResponse
@@ -772,6 +777,7 @@ org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticS
org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$2
org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$3
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$4
org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$MiniFuture$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFutureAdapter$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearPessimisticTxPrepareFuture$1
@@ -821,22 +827,23 @@ org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManag
org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$7
org.apache.ignite.internal.processors.cache.query.GridCacheQueryAdapter$1
org.apache.ignite.internal.processors.cache.query.GridCacheQueryAdapter$ScanQueryFallbackClosableIterator
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryDetailMetricsAdapter
org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter$1
org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter$2
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$1$1
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$1$2
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$10
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$11
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$12
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$13
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$14
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$15$1
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$2
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$3
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$15
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$16
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$17$1
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$3$1
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$3$2
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$4
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$5
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$6
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$7
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$8
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$9
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$CacheSqlIndexMetadata
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$CacheSqlMetadata
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$CachedResult$QueueIterator
@@ -896,6 +903,8 @@ org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$12
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$13
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$14
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$15
+org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$16
+org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$17
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$2
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$3
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$4
@@ -929,9 +938,9 @@ org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$Po
org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$PostLockClosure1$4
org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$PostLockClosure2
org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$PostMissClosure
-org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$2
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$3
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$4
+org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$5
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$CommitListener
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$CommittedVersion
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$NodeFailureTimeoutObject$1
@@ -1005,7 +1014,6 @@ org.apache.ignite.internal.processors.datastreamer.DataStreamerEntry
org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$1
org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$4
org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$5
-org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$6
org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$Buffer$1
org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$Buffer$2
org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$DataStreamerPda
@@ -1084,6 +1092,7 @@ org.apache.ignite.internal.processors.datastructures.GridCacheSetProxy
org.apache.ignite.internal.processors.datastructures.GridSetQueryPredicate
org.apache.ignite.internal.processors.dr.GridDrType
org.apache.ignite.internal.processors.dr.IgniteDrDataStreamerCacheUpdater
+org.apache.ignite.internal.processors.hadoop.HadoopDefaultJobInfo
org.apache.ignite.internal.processors.hadoop.HadoopFileBlock
org.apache.ignite.internal.processors.hadoop.HadoopInputSplit
org.apache.ignite.internal.processors.hadoop.HadoopJobId
@@ -1119,7 +1128,6 @@ org.apache.ignite.internal.processors.igfs.IgfsFragmentizerManager$IdentityHashS
org.apache.ignite.internal.processors.igfs.IgfsFragmentizerRequest
org.apache.ignite.internal.processors.igfs.IgfsFragmentizerResponse
org.apache.ignite.internal.processors.igfs.IgfsHandshakeResponse
-org.apache.ignite.internal.processors.igfs.IgfsImpl$12$1
org.apache.ignite.internal.processors.igfs.IgfsImpl$IgfsGlobalSpaceTask
org.apache.ignite.internal.processors.igfs.IgfsImpl$IgfsGlobalSpaceTask$1
org.apache.ignite.internal.processors.igfs.IgfsInputStreamDescriptor
@@ -1155,6 +1163,7 @@ org.apache.ignite.internal.processors.igfs.client.IgfsClientSummaryCallable
org.apache.ignite.internal.processors.igfs.client.IgfsClientUpdateCallable
org.apache.ignite.internal.processors.igfs.client.meta.IgfsClientMetaIdsForPathCallable
org.apache.ignite.internal.processors.igfs.client.meta.IgfsClientMetaInfoForPathCallable
+org.apache.ignite.internal.processors.igfs.client.meta.IgfsClientMetaUnlockCallable
org.apache.ignite.internal.processors.igfs.data.IgfsDataPutProcessor
org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryCreateProcessor
org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryListingAddProcessor
@@ -1172,6 +1181,8 @@ org.apache.ignite.internal.processors.igfs.meta.IgfsMetaUpdateTimesProcessor
org.apache.ignite.internal.processors.job.GridJobProcessor$5
org.apache.ignite.internal.processors.job.GridJobWorker$3
org.apache.ignite.internal.processors.jobmetrics.GridJobMetricsProcessor$SnapshotReducer
+org.apache.ignite.internal.processors.odbc.OdbcProtocolVersion
+org.apache.ignite.internal.processors.odbc.escape.OdbcEscapeType
org.apache.ignite.internal.processors.platform.PlatformAbstractConfigurationClosure
org.apache.ignite.internal.processors.platform.PlatformAbstractPredicate
org.apache.ignite.internal.processors.platform.PlatformEventFilterListener
@@ -1180,7 +1191,7 @@ org.apache.ignite.internal.processors.platform.PlatformExtendedException
org.apache.ignite.internal.processors.platform.PlatformJavaObjectFactoryProxy
org.apache.ignite.internal.processors.platform.PlatformNativeException
org.apache.ignite.internal.processors.platform.PlatformNoCallbackException
-org.apache.ignite.internal.processors.platform.cache.PlatformCache$1
+org.apache.ignite.internal.processors.platform.cache.PlatformCache$5
org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryFilter
org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryFilterImpl
org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryProcessor
@@ -1211,6 +1222,8 @@ org.apache.ignite.internal.processors.platform.cpp.PlatformCppConfigurationClosu
org.apache.ignite.internal.processors.platform.datastreamer.PlatformStreamReceiver
org.apache.ignite.internal.processors.platform.datastreamer.PlatformStreamReceiverImpl
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$1
+org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$10
+org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$11
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$2
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$3
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$4
@@ -1218,6 +1231,7 @@ org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$5
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$6
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$7
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$8
+org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$9
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetConfigurationClosure
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetService
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetServiceImpl
@@ -1232,19 +1246,24 @@ org.apache.ignite.internal.processors.platform.transactions.PlatformTransactions
org.apache.ignite.internal.processors.platform.utils.PlatformFutureUtils$1
org.apache.ignite.internal.processors.platform.utils.PlatformFutureUtils$FutureListenable$1
org.apache.ignite.internal.processors.platform.utils.PlatformFutureUtils$InternalFutureListenable$1
+org.apache.ignite.internal.processors.platform.websession.PlatformDotNetSessionLockProcessor
+org.apache.ignite.internal.processors.platform.websession.PlatformDotNetSessionSetAndUnlockProcessor
org.apache.ignite.internal.processors.query.GridQueryFieldMetadata
org.apache.ignite.internal.processors.query.GridQueryIndexType
-org.apache.ignite.internal.processors.query.GridQueryProcessor$2
org.apache.ignite.internal.processors.query.GridQueryProcessor$3
org.apache.ignite.internal.processors.query.GridQueryProcessor$4
org.apache.ignite.internal.processors.query.GridQueryProcessor$5
org.apache.ignite.internal.processors.query.GridQueryProcessor$6
+org.apache.ignite.internal.processors.query.GridQueryProcessor$7
+org.apache.ignite.internal.processors.query.GridQueryProcessor$8
org.apache.ignite.internal.processors.query.GridQueryProcessor$IndexType
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryCancelRequest
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryFailResponse
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryNextPageRequest
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryNextPageResponse
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryRequest
+org.apache.ignite.internal.processors.resource.GridResourceIoc$AnnotationSet
+org.apache.ignite.internal.processors.resource.GridResourceIoc$ResourceAnnotation
org.apache.ignite.internal.processors.rest.GridRestCommand
org.apache.ignite.internal.processors.rest.GridRestProcessor$2$1
org.apache.ignite.internal.processors.rest.GridRestProcessor$3
@@ -1332,7 +1351,7 @@ org.apache.ignite.internal.processors.service.ServiceDescriptorImpl
org.apache.ignite.internal.processors.task.GridTaskProcessor$1
org.apache.ignite.internal.processors.task.GridTaskThreadContextKey
org.apache.ignite.internal.processors.task.GridTaskWorker$3
-org.apache.ignite.internal.processors.task.GridTaskWorker$4
+org.apache.ignite.internal.processors.task.GridTaskWorker$5
org.apache.ignite.internal.processors.task.GridTaskWorker$State
org.apache.ignite.internal.transactions.IgniteTxHeuristicCheckedException
org.apache.ignite.internal.transactions.IgniteTxOptimisticCheckedException
@@ -1356,6 +1375,7 @@ org.apache.ignite.internal.util.GridBoundedConcurrentOrderedMap
org.apache.ignite.internal.util.GridBoundedConcurrentOrderedSet
org.apache.ignite.internal.util.GridBoundedLinkedHashMap
org.apache.ignite.internal.util.GridBoundedLinkedHashSet
+org.apache.ignite.internal.util.GridBoundedPriorityQueue
org.apache.ignite.internal.util.GridByteArrayList
org.apache.ignite.internal.util.GridCloseableIteratorAdapter
org.apache.ignite.internal.util.GridCloseableIteratorAdapterEx
@@ -1407,14 +1427,14 @@ org.apache.ignite.internal.util.IgniteUtils$11
org.apache.ignite.internal.util.IgniteUtils$12
org.apache.ignite.internal.util.IgniteUtils$13
org.apache.ignite.internal.util.IgniteUtils$14
-org.apache.ignite.internal.util.IgniteUtils$16
-org.apache.ignite.internal.util.IgniteUtils$2
-org.apache.ignite.internal.util.IgniteUtils$22
+org.apache.ignite.internal.util.IgniteUtils$15
+org.apache.ignite.internal.util.IgniteUtils$17
org.apache.ignite.internal.util.IgniteUtils$23
org.apache.ignite.internal.util.IgniteUtils$24
org.apache.ignite.internal.util.IgniteUtils$25
org.apache.ignite.internal.util.IgniteUtils$26
org.apache.ignite.internal.util.IgniteUtils$27
+org.apache.ignite.internal.util.IgniteUtils$28
org.apache.ignite.internal.util.IgniteUtils$3
org.apache.ignite.internal.util.IgniteUtils$4
org.apache.ignite.internal.util.IgniteUtils$5
@@ -1647,12 +1667,19 @@ org.apache.ignite.internal.visor.cache.VisorCachePartitionsTask
org.apache.ignite.internal.visor.cache.VisorCachePartitionsTask$VisorCachePartitionsJob
org.apache.ignite.internal.visor.cache.VisorCacheQueryConfiguration
org.apache.ignite.internal.visor.cache.VisorCacheQueryConfigurationV2
+org.apache.ignite.internal.visor.cache.VisorCacheQueryDetailMetrics
+org.apache.ignite.internal.visor.cache.VisorCacheQueryDetailMetricsCollectorTask
+org.apache.ignite.internal.visor.cache.VisorCacheQueryDetailMetricsCollectorTask$VisorCacheQueryDetailMetricsCollectorJob
org.apache.ignite.internal.visor.cache.VisorCacheQueryMetrics
org.apache.ignite.internal.visor.cache.VisorCacheRebalanceConfiguration
org.apache.ignite.internal.visor.cache.VisorCacheRebalanceTask
org.apache.ignite.internal.visor.cache.VisorCacheRebalanceTask$VisorCachesRebalanceJob
org.apache.ignite.internal.visor.cache.VisorCacheResetMetricsTask
org.apache.ignite.internal.visor.cache.VisorCacheResetMetricsTask$VisorCacheResetMetricsJob
+org.apache.ignite.internal.visor.cache.VisorCacheResetQueryDetailMetricsTask
+org.apache.ignite.internal.visor.cache.VisorCacheResetQueryDetailMetricsTask$VisorCacheResetQueryDetailMetricsJob
+org.apache.ignite.internal.visor.cache.VisorCacheResetQueryMetricsTask
+org.apache.ignite.internal.visor.cache.VisorCacheResetQueryMetricsTask$VisorCacheResetQueryMetricsJob
org.apache.ignite.internal.visor.cache.VisorCacheStartTask
org.apache.ignite.internal.visor.cache.VisorCacheStartTask$VisorCacheStartArg
org.apache.ignite.internal.visor.cache.VisorCacheStartTask$VisorCacheStartJob
@@ -1682,6 +1709,7 @@ org.apache.ignite.internal.visor.debug.VisorThreadLockInfo
org.apache.ignite.internal.visor.debug.VisorThreadMonitorInfo
org.apache.ignite.internal.visor.event.VisorGridDeploymentEvent
org.apache.ignite.internal.visor.event.VisorGridDiscoveryEvent
+org.apache.ignite.internal.visor.event.VisorGridDiscoveryEventV2
org.apache.ignite.internal.visor.event.VisorGridEvent
org.apache.ignite.internal.visor.event.VisorGridEventsLost
org.apache.ignite.internal.visor.event.VisorGridJobEvent
@@ -1769,6 +1797,7 @@ org.apache.ignite.internal.visor.util.VisorClusterGroupEmptyException
org.apache.ignite.internal.visor.util.VisorEventMapper
org.apache.ignite.internal.visor.util.VisorExceptionWrapper
org.apache.ignite.internal.visor.util.VisorTaskUtils$4
+org.apache.ignite.internal.visor.util.VisorTaskUtils$5
org.apache.ignite.internal.websession.WebSessionAttributeProcessor
org.apache.ignite.internal.websession.WebSessionEntity
org.apache.ignite.lang.IgniteBiClosure
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/test/java/org/apache/ignite/lang/utils/GridBoundedPriorityQueueSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/lang/utils/GridBoundedPriorityQueueSelfTest.java b/modules/core/src/test/java/org/apache/ignite/lang/utils/GridBoundedPriorityQueueSelfTest.java
new file mode 100644
index 0000000..bcaecc4
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/lang/utils/GridBoundedPriorityQueueSelfTest.java
@@ -0,0 +1,114 @@
+/*
+ * 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.lang.utils;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Random;
+
+import org.apache.ignite.internal.util.GridBoundedPriorityQueue;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.testframework.junits.common.GridCommonTest;
+
+/**
+ * Test for {@link GridBoundedPriorityQueue}.
+ */
+@GridCommonTest(group = "Lang")
+public class GridBoundedPriorityQueueSelfTest extends GridCommonAbstractTest {
+ /** Queue items comparator. */
+ private static final Comparator<Integer> CMP = new Comparator<Integer>() {
+ @Override public int compare(Integer o1, Integer o2) {
+ return Integer.compare(o1, o2);
+ }
+ };
+
+ /** Queue items reverse order comparator. */
+ private static final Comparator<Integer> CMP_REVERSE = Collections.reverseOrder(CMP);
+
+ /**
+ * Test eviction in bounded priority queue.
+ */
+ public void testEviction() {
+ GridBoundedPriorityQueue<Integer> queue = new GridBoundedPriorityQueue<>(3, CMP);
+
+ assertTrue(queue.offer(2));
+ assertTrue(queue.offer(1));
+ assertTrue(queue.offer(3));
+ assertTrue(queue.offer(4));
+
+ assertEquals(3, queue.size());
+
+ assertFalse(queue.offer(0)); // Item with lower priority should not be put into queue.
+
+ assertEquals(3, queue.size());
+
+ assertEquals(Integer.valueOf(2), queue.poll());
+ assertEquals(Integer.valueOf(3), queue.poll());
+ assertEquals(Integer.valueOf(4), queue.poll());
+
+ assertNull(queue.poll());
+ assertTrue(queue.isEmpty());
+
+ // Test queue with reverse comparator.
+ GridBoundedPriorityQueue<Integer> queueReverse = new GridBoundedPriorityQueue<>(3, CMP_REVERSE);
+
+ assertTrue(queueReverse.offer(2));
+ assertTrue(queueReverse.offer(1));
+ assertTrue(queueReverse.offer(3));
+
+ assertFalse(queueReverse.offer(4)); // Item with lower priority should not be put into queue.
+
+ assertEquals(Integer.valueOf(3), queueReverse.poll());
+ assertEquals(Integer.valueOf(2), queueReverse.poll());
+ assertEquals(Integer.valueOf(1), queueReverse.poll());
+
+ assertNull(queueReverse.poll());
+ assertTrue(queueReverse.isEmpty());
+
+ // Test put random 100 items into GridBoundedPriorityQueue(10) and check result.
+ queue = new GridBoundedPriorityQueue<>(10, CMP);
+ queueReverse = new GridBoundedPriorityQueue<>(10, CMP_REVERSE);
+
+ Random rnd = new Random();
+
+ List<Integer> items = new ArrayList<>(100);
+
+ for (int i = 0; i < 100; i++) {
+ Integer item = rnd.nextInt(100);
+
+ items.add(item);
+ queue.offer(item);
+ queueReverse.offer(item);
+ }
+
+ Collections.sort(items);
+
+ for (int i = 0; i < 10; i++) {
+ assertEquals(items.get(90 + i), queue.poll());
+ assertEquals(items.get(9 - i), queueReverse.poll());
+ }
+
+ assertNull(queue.poll());
+ assertTrue(queue.isEmpty());
+
+ assertNull(queueReverse.poll());
+ assertTrue(queueReverse.isEmpty());
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
index 71dc964..46053b3 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
@@ -40,6 +40,7 @@ import org.apache.ignite.cache.CacheMetrics;
import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.cache.query.Query;
import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cache.query.QueryDetailMetrics;
import org.apache.ignite.cache.query.QueryMetrics;
import org.apache.ignite.cluster.ClusterGroup;
import org.apache.ignite.internal.processors.cache.CacheEntryImpl;
@@ -188,6 +189,21 @@ public class IgniteCacheProcessProxy<K, V> implements IgniteCache<K, V> {
}
/** {@inheritDoc} */
+ @Override public void resetQueryMetrics() {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<? extends QueryDetailMetrics> queryDetailMetrics() {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void resetQueryDetailMetrics() {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+
+ /** {@inheritDoc} */
@Override public void localEvict(Collection<? extends K> keys) {
compute.call(new LocalEvictTask<>(cacheName, isAsync, keys));
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteLangSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteLangSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteLangSelfTestSuite.java
index 78c0ab4..cfec1ec 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteLangSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteLangSelfTestSuite.java
@@ -32,6 +32,7 @@ import org.apache.ignite.lang.GridXSelfTest;
import org.apache.ignite.lang.IgniteUuidSelfTest;
import org.apache.ignite.lang.utils.GridBoundedConcurrentLinkedHashMapSelfTest;
import org.apache.ignite.lang.utils.GridBoundedConcurrentOrderedMapSelfTest;
+import org.apache.ignite.lang.utils.GridBoundedPriorityQueueSelfTest;
import org.apache.ignite.lang.utils.GridCircularBufferSelfTest;
import org.apache.ignite.lang.utils.GridConcurrentLinkedHashMapSelfTest;
import org.apache.ignite.lang.utils.GridConcurrentWeakHashSetSelfTest;
@@ -55,6 +56,7 @@ public class IgniteLangSelfTestSuite extends TestSuite {
TestSuite suite = new TestSuite("Ignite Lang Test Suite");
suite.addTest(new TestSuite(GridTupleSelfTest.class));
+ suite.addTest(new TestSuite(GridBoundedPriorityQueueSelfTest.class));
suite.addTest(new TestSuite(GridByteArrayListSelfTest.class));
suite.addTest(new TestSuite(GridLeanMapSelfTest.class));
suite.addTest(new TestSuite(GridLeanIdentitySetSelfTest.class));
@@ -85,4 +87,4 @@ public class IgniteLangSelfTestSuite extends TestSuite {
return suite;
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheAbstractQueryDetailMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheAbstractQueryDetailMetricsSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheAbstractQueryDetailMetricsSelfTest.java
new file mode 100644
index 0000000..1b870e4
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheAbstractQueryDetailMetricsSelfTest.java
@@ -0,0 +1,572 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.query.Query;
+import org.apache.ignite.cache.query.QueryDetailMetrics;
+import org.apache.ignite.cache.query.ScanQuery;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.cache.query.SqlQuery;
+import org.apache.ignite.cache.query.TextQuery;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteInterruptedCheckedException;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
+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.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ * Tests for cache query details metrics.
+ */
+public abstract class CacheAbstractQueryDetailMetricsSelfTest extends GridCommonAbstractTest {
+ /** */
+ private static final int QRY_DETAIL_METRICS_SIZE = 3;
+
+ /** Grid count. */
+ protected int gridCnt;
+
+ /** Cache mode. */
+ protected CacheMode cacheMode;
+
+ /** */
+ private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ startGridsMultiThreaded(gridCnt);
+
+ IgniteCache<Integer, String> cacheA = grid(0).cache("A");
+ IgniteCache<Integer, String> cacheB = grid(0).cache("B");
+
+ for (int i = 0; i < 100; i++) {
+ cacheA.put(i, String.valueOf(i));
+ cacheB.put(i, String.valueOf(i));
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+ }
+
+ /**
+ * @param cacheName Cache name.
+ * @return Cache configuration.
+ */
+ private CacheConfiguration<Integer, String> configureCache(String cacheName) {
+ CacheConfiguration<Integer, String> ccfg = defaultCacheConfiguration();
+
+ ccfg.setName(cacheName);
+ ccfg.setCacheMode(cacheMode);
+ ccfg.setWriteSynchronizationMode(FULL_SYNC);
+ ccfg.setIndexedTypes(Integer.class, String.class);
+ ccfg.setStatisticsEnabled(true);
+ ccfg.setQueryDetailMetricsSize(QRY_DETAIL_METRICS_SIZE);
+
+ return ccfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+ disco.setIpFinder(ipFinder);
+
+ cfg.setDiscoverySpi(disco);
+
+ cfg.setCacheConfiguration(configureCache("A"), configureCache("B"));
+
+ return cfg;
+ }
+
+ /**
+ * Test metrics for SQL fields queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testSqlFieldsQueryMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ SqlFieldsQuery qry = new SqlFieldsQuery("select * from String");
+
+ checkQueryMetrics(cache, qry);
+ }
+
+ /**
+ * Test metrics for SQL fields queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testSqlFieldsQueryNotFullyFetchedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ SqlFieldsQuery qry = new SqlFieldsQuery("select * from String");
+ qry.setPageSize(10);
+
+ checkQueryNotFullyFetchedMetrics(cache, qry, false);
+ }
+
+ /**
+ * Test metrics for failed SQL queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testSqlFieldsQueryFailedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ SqlFieldsQuery qry = new SqlFieldsQuery("select * from UNKNOWN");
+
+ checkQueryFailedMetrics(cache, qry);
+ }
+
+ /**
+ * Test metrics eviction.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testQueryMetricsEviction() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ // Execute several DIFFERENT queries with guaranteed DIFFERENT time of execution.
+ cache.query(new SqlFieldsQuery("select * from String")).getAll();
+ Thread.sleep(100);
+
+ cache.query(new SqlFieldsQuery("select count(*) from String")).getAll();
+ Thread.sleep(100);
+
+ cache.query(new SqlFieldsQuery("select * from String limit 1")).getAll();
+ Thread.sleep(100);
+
+ cache.query(new SqlFieldsQuery("select * from String limit 2")).getAll();
+ Thread.sleep(100);
+
+ cache.query(new ScanQuery()).getAll();
+ Thread.sleep(100);
+
+ cache.query(new SqlQuery("String", "from String")).getAll();
+
+ waitingFor(cache, "size", QRY_DETAIL_METRICS_SIZE);
+
+ for (int i = 0; i < QRY_DETAIL_METRICS_SIZE; i++)
+ checkMetrics(cache, QRY_DETAIL_METRICS_SIZE, i, 1, 1, 0, false);
+
+ // Check that collected metrics contains correct items: metrics for last 3 queries.
+ Collection<? extends QueryDetailMetrics> metrics = cache.queryDetailMetrics();
+
+ String lastMetrics = "";
+
+ for (QueryDetailMetrics m : metrics)
+ lastMetrics += m.queryType() + " " + m.query() + ";";
+
+ assertTrue(lastMetrics.contains("SQL_FIELDS select * from String limit 2;"));
+ assertTrue(lastMetrics.contains("SCAN A;"));
+ assertTrue(lastMetrics.contains("SQL from String;"));
+
+ cache = grid(0).context().cache().jcache("B");
+
+ cache.query(new SqlFieldsQuery("select * from String")).getAll();
+ cache.query(new SqlFieldsQuery("select count(*) from String")).getAll();
+ cache.query(new SqlFieldsQuery("select * from String limit 1")).getAll();
+ cache.query(new SqlFieldsQuery("select * from String limit 2")).getAll();
+ cache.query(new ScanQuery()).getAll();
+ cache.query(new SqlQuery("String", "from String")).getAll();
+
+ waitingFor(cache, "size", QRY_DETAIL_METRICS_SIZE);
+
+ for (int i = 0; i < QRY_DETAIL_METRICS_SIZE; i++)
+ checkMetrics(cache, QRY_DETAIL_METRICS_SIZE, i, 1, 1, 0, false);
+
+ if (gridCnt > 1) {
+ cache = grid(1).context().cache().jcache("A");
+
+ cache.query(new SqlFieldsQuery("select * from String")).getAll();
+ cache.query(new SqlFieldsQuery("select count(*) from String")).getAll();
+ cache.query(new SqlFieldsQuery("select * from String limit 1")).getAll();
+ cache.query(new SqlFieldsQuery("select * from String limit 2")).getAll();
+ cache.query(new ScanQuery()).getAll();
+ cache.query(new SqlQuery("String", "from String")).getAll();
+
+ waitingFor(cache, "size", QRY_DETAIL_METRICS_SIZE);
+
+ for (int i = 0; i < QRY_DETAIL_METRICS_SIZE; i++)
+ checkMetrics(cache, QRY_DETAIL_METRICS_SIZE, i, 1, 1, 0, false);
+
+ cache = grid(1).context().cache().jcache("B");
+
+ cache.query(new SqlFieldsQuery("select * from String")).getAll();
+ cache.query(new SqlFieldsQuery("select count(*) from String")).getAll();
+ cache.query(new SqlFieldsQuery("select * from String limit 1")).getAll();
+ cache.query(new SqlFieldsQuery("select * from String limit 2")).getAll();
+ cache.query(new ScanQuery()).getAll();
+ cache.query(new SqlQuery("String", "from String")).getAll();
+
+ waitingFor(cache, "size", QRY_DETAIL_METRICS_SIZE);
+
+ for (int i = 0; i < QRY_DETAIL_METRICS_SIZE; i++)
+ checkMetrics(cache, QRY_DETAIL_METRICS_SIZE, i, 1, 1, 0, false);
+ }
+ }
+
+ /** */
+ private static class Worker extends Thread {
+ /** */
+ private final IgniteCache cache;
+
+ /** */
+ private final Query qry;
+
+ /** */
+ Worker(IgniteCache cache, Query qry) {
+ this.cache = cache;
+ this.qry = qry;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void run() {
+ cache.query(qry).getAll();
+ }
+ }
+
+ /**
+ * Test metrics if queries executed from several threads.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testQueryMetricsMultithreaded() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ Collection<Worker> workers = new ArrayList<>();
+
+ int repeat = 10;
+
+ for (int k = 0; k < repeat; k++) {
+ // Execute as match queries as history size to avoid eviction.
+ for (int i = 1; i <= QRY_DETAIL_METRICS_SIZE; i++)
+ workers.add(new Worker(cache, new SqlFieldsQuery("select * from String limit " + i)));
+ }
+
+ for (Worker worker : workers)
+ worker.start();
+
+ for (Worker worker : workers)
+ worker.join();
+
+ for (int i = 0; i < QRY_DETAIL_METRICS_SIZE; i++)
+ checkMetrics(cache, QRY_DETAIL_METRICS_SIZE, i, repeat, repeat, 0, false);
+ }
+
+ /**
+ * Test metrics for Scan queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testScanQueryMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ ScanQuery<Integer, String> qry = new ScanQuery<>();
+
+ checkQueryMetrics(cache, qry);
+ }
+
+ /**
+ * Test metrics for Scan queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testScanQueryNotFullyFetchedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ ScanQuery<Integer, String> qry = new ScanQuery<>();
+ qry.setPageSize(10);
+
+ checkQueryNotFullyFetchedMetrics(cache, qry, true);
+ }
+
+ /**
+ * Test metrics for failed Scan queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testScanQueryFailedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ ScanQuery<Integer, String> qry = new ScanQuery<>(Integer.MAX_VALUE);
+
+ checkQueryFailedMetrics(cache, qry);
+ }
+
+ /**
+ * Test metrics for Scan queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testSqlQueryMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ SqlQuery<Integer, String> qry = new SqlQuery<>("String", "from String");
+
+ checkQueryMetrics(cache, qry);
+ }
+
+ /**
+ * Test metrics for Scan queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testSqlQueryNotFullyFetchedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ SqlQuery<Integer, String> qry = new SqlQuery<>("String", "from String");
+ qry.setPageSize(10);
+
+ checkQueryNotFullyFetchedMetrics(cache, qry, true);
+ }
+
+ /**
+ * Test metrics for failed Scan queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testSqlQueryFailedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ SqlQuery<Integer, String> qry = new SqlQuery<>("Long", "from Long");
+
+ checkQueryFailedMetrics(cache, qry);
+ }
+
+ /**
+ * Test metrics for Sql queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testTextQueryMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ TextQuery qry = new TextQuery<>("String", "1");
+
+ checkQueryMetrics(cache, qry);
+ }
+
+ /**
+ * Test metrics for Sql queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testTextQueryNotFullyFetchedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ TextQuery qry = new TextQuery<>("String", "1");
+ qry.setPageSize(10);
+
+ checkQueryNotFullyFetchedMetrics(cache, qry, true);
+ }
+
+ /**
+ * Test metrics for failed Scan queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testTextQueryFailedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ TextQuery qry = new TextQuery<>("Unknown", "zzz");
+
+ checkQueryFailedMetrics(cache, qry);
+ }
+
+ /**
+ * Test metrics for SQL cross cache queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testSqlFieldsCrossCacheQueryMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ SqlFieldsQuery qry = new SqlFieldsQuery("select * from \"B\".String");
+
+ checkQueryMetrics(cache, qry);
+ }
+
+ /**
+ * Test metrics for SQL cross cache queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testSqlFieldsCrossCacheQueryNotFullyFetchedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ SqlFieldsQuery qry = new SqlFieldsQuery("select * from \"B\".String");
+ qry.setPageSize(10);
+
+ checkQueryNotFullyFetchedMetrics(cache, qry, false);
+ }
+
+ /**
+ * Test metrics for failed SQL cross cache queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testSqlFieldsCrossCacheQueryFailedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ SqlFieldsQuery qry = new SqlFieldsQuery("select * from \"G\".String");
+
+ checkQueryFailedMetrics(cache, qry);
+ }
+
+ /**
+ * Check metrics.
+ *
+ * @param cache Cache to check metrics.
+ * @param sz Expected size of metrics.
+ * @param idx Index of metrics to check.
+ * @param execs Expected number of executions.
+ * @param completions Expected number of completions.
+ * @param failures Expected number of failures.
+ * @param first {@code true} if metrics checked for first query only.
+ */
+ private void checkMetrics(IgniteCache<Integer, String> cache, int sz, int idx, int execs,
+ int completions, int failures, boolean first) {
+ Collection<? extends QueryDetailMetrics> metrics = cache.queryDetailMetrics();
+
+ assertNotNull(metrics);
+ assertEquals(sz, metrics.size());
+
+ QueryDetailMetrics m = new ArrayList<>(metrics).get(idx);
+
+ info("Metrics: " + m);
+
+ assertEquals("Executions", execs, m.executions());
+ assertEquals("Completions", completions, m.completions());
+ assertEquals("Failures", failures, m.failures());
+ assertTrue(m.averageTime() >= 0);
+ assertTrue(m.maximumTime() >= 0);
+ assertTrue(m.minimumTime() >= 0);
+
+ if (first)
+ assertTrue("On first execution minTime == maxTime", m.minimumTime() == m.maximumTime());
+ }
+
+ /**
+ * @param cache Cache.
+ * @param qry Query.
+ */
+ private void checkQueryMetrics(IgniteCache<Integer, String> cache, Query qry) {
+ // Execute query.
+ cache.query(qry).getAll();
+
+ checkMetrics(cache, 1, 0, 1, 1, 0, true);
+
+ // Execute again with the same parameters.
+ cache.query(qry).getAll();
+
+ checkMetrics(cache, 1, 0, 2, 2, 0, false);
+ }
+
+ /**
+ * @param cache Cache.
+ * @param qry Query.
+ * @param waitingForCompletion Waiting for query completion.
+ */
+ private void checkQueryNotFullyFetchedMetrics(IgniteCache<Integer, String> cache, Query qry,
+ boolean waitingForCompletion) throws IgniteInterruptedCheckedException {
+ // Execute query.
+ cache.query(qry).iterator().next();
+
+ if (waitingForCompletion)
+ waitingFor(cache, "completions", 1);
+
+ checkMetrics(cache, 1, 0, 1, 1, 0, true);
+
+ // Execute again with the same parameters.
+ cache.query(qry).iterator().next();
+
+ if (waitingForCompletion)
+ waitingFor(cache, "completions", 2);
+
+ checkMetrics(cache, 1, 0, 2, 2, 0, false);
+ }
+
+ /**
+ * @param cache Cache.
+ * @param qry Query.
+ */
+ private void checkQueryFailedMetrics(IgniteCache<Integer, String> cache, Query qry) {
+ try {
+ // Execute invalid query.
+ cache.query(qry).getAll();
+ }
+ catch (Exception ignored) {
+ // No-op.
+ }
+
+ checkMetrics(cache, 1, 0, 1, 0, 1, true);
+
+ try {
+ // Execute invalid query again with the same parameters.
+ cache.query(qry).getAll();
+ }
+ catch (Exception ignored) {
+ // No-op.
+ }
+
+ checkMetrics(cache, 1, 0, 2, 0, 2, true);
+ }
+
+ /**
+ * @param cache Cache.
+ * @param cond Condition to check.
+ * @param exp Expected value.
+ */
+ private static void waitingFor(final IgniteCache<Integer, String> cache,
+ final String cond, final int exp) throws IgniteInterruptedCheckedException {
+ GridTestUtils.waitForCondition(new GridAbsPredicate() {
+ @Override public boolean apply() {
+ Collection<? extends QueryDetailMetrics> metrics = cache.queryDetailMetrics();
+
+ switch (cond) {
+ case "size":
+ return metrics.size() == exp;
+
+ case "completions":
+ int completions = 0;
+
+ for (QueryDetailMetrics m : metrics)
+ completions += m.completions();
+
+ return completions == exp;
+
+ default:
+ return true;
+ }
+ }
+ }, 5000);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheAbstractQueryMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheAbstractQueryMetricsSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheAbstractQueryMetricsSelfTest.java
index 10f7612..e5845d3 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheAbstractQueryMetricsSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheAbstractQueryMetricsSelfTest.java
@@ -17,11 +17,15 @@
package org.apache.ignite.internal.processors.cache;
+import java.util.ArrayList;
+import java.util.Collection;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.query.Query;
import org.apache.ignite.cache.query.ScanQuery;
import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.cache.query.SqlQuery;
+import org.apache.ignite.cache.query.TextQuery;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
@@ -52,15 +56,13 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
@Override protected void beforeTest() throws Exception {
startGridsMultiThreaded(gridCnt);
- IgniteCache<String, Integer> cacheA = grid(0).cache("A");
+ IgniteCache<Integer, String> cacheA = grid(0).cache("A");
+ IgniteCache<Integer, String> cacheB = grid(0).cache("B");
- for (int i = 0; i < 100; i++)
- cacheA.put(String.valueOf(i), i);
-
- IgniteCache<String, Integer> cacheB = grid(0).cache("B");
-
- for (int i = 0; i < 100; i++)
- cacheB.put(String.valueOf(i), i);
+ for (int i = 0; i < 100; i++) {
+ cacheA.put(i, String.valueOf(i));
+ cacheB.put(i, String.valueOf(i));
+ }
}
/** {@inheritDoc} */
@@ -78,20 +80,20 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
cfg.setDiscoverySpi(disco);
- CacheConfiguration<String, Integer> cacheCfg1 = defaultCacheConfiguration();
+ CacheConfiguration<Integer, String> cacheCfg1 = defaultCacheConfiguration();
cacheCfg1.setName("A");
cacheCfg1.setCacheMode(cacheMode);
cacheCfg1.setWriteSynchronizationMode(FULL_SYNC);
- cacheCfg1.setIndexedTypes(String.class, Integer.class);
+ cacheCfg1.setIndexedTypes(Integer.class, String.class);
cacheCfg1.setStatisticsEnabled(true);
- CacheConfiguration<String, Integer> cacheCfg2 = defaultCacheConfiguration();
+ CacheConfiguration<Integer, String> cacheCfg2 = defaultCacheConfiguration();
cacheCfg2.setName("B");
cacheCfg2.setCacheMode(cacheMode);
cacheCfg2.setWriteSynchronizationMode(FULL_SYNC);
- cacheCfg2.setIndexedTypes(String.class, Integer.class);
+ cacheCfg2.setIndexedTypes(Integer.class, String.class);
cacheCfg2.setStatisticsEnabled(true);
cfg.setCacheConfiguration(cacheCfg1, cacheCfg2);
@@ -105,11 +107,11 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
* @throws Exception In case of error.
*/
public void testSqlFieldsQueryMetrics() throws Exception {
- IgniteCache<String, Integer> cache = grid(0).context().cache().jcache("A");
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
- SqlFieldsQuery qry = new SqlFieldsQuery("select * from Integer");
+ SqlFieldsQuery qry = new SqlFieldsQuery("select * from String");
- testQueryMetrics(cache, qry);
+ checkQueryMetrics(cache, qry);
}
/**
@@ -118,12 +120,12 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
* @throws Exception In case of error.
*/
public void testSqlFieldsQueryNotFullyFetchedMetrics() throws Exception {
- IgniteCache<String, Integer> cache = grid(0).context().cache().jcache("A");
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
- SqlFieldsQuery qry = new SqlFieldsQuery("select * from Integer");
+ SqlFieldsQuery qry = new SqlFieldsQuery("select * from String");
qry.setPageSize(10);
- testQueryNotFullyFetchedMetrics(cache, qry, false);
+ checkQueryNotFullyFetchedMetrics(cache, qry, false);
}
/**
@@ -132,11 +134,11 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
* @throws Exception In case of error.
*/
public void testSqlFieldsQueryFailedMetrics() throws Exception {
- IgniteCache<String, Integer> cache = grid(0).context().cache().jcache("A");
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
SqlFieldsQuery qry = new SqlFieldsQuery("select * from UNKNOWN");
- testQueryFailedMetrics(cache, qry);
+ checkQueryFailedMetrics(cache, qry);
}
/**
@@ -145,11 +147,11 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
* @throws Exception In case of error.
*/
public void testScanQueryMetrics() throws Exception {
- IgniteCache<String, Integer> cache = grid(0).context().cache().jcache("A");
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
- ScanQuery<String, Integer> qry = new ScanQuery<>();
+ ScanQuery<Integer, String> qry = new ScanQuery<>();
- testQueryMetrics(cache, qry);
+ checkQueryMetrics(cache, qry);
}
/**
@@ -158,12 +160,12 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
* @throws Exception In case of error.
*/
public void testScanQueryNotFullyFetchedMetrics() throws Exception {
- IgniteCache<String, Integer> cache = grid(0).context().cache().jcache("A");
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
- ScanQuery<String, Integer> qry = new ScanQuery<>();
+ ScanQuery<Integer, String> qry = new ScanQuery<>();
qry.setPageSize(10);
- testQueryNotFullyFetchedMetrics(cache, qry, true);
+ checkQueryNotFullyFetchedMetrics(cache, qry, true);
}
/**
@@ -172,11 +174,91 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
* @throws Exception In case of error.
*/
public void testScanQueryFailedMetrics() throws Exception {
- IgniteCache<String, Integer> cache = grid(0).context().cache().jcache("A");
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ ScanQuery<Integer, String> qry = new ScanQuery<>(Integer.MAX_VALUE);
+
+ checkQueryFailedMetrics(cache, qry);
+ }
+
+ /**
+ * Test metrics for Sql queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testSqlQueryMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ SqlQuery qry = new SqlQuery<>("String", "from String");
+
+ checkQueryMetrics(cache, qry);
+ }
+
+ /**
+ * Test metrics for Sql queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testSqlQueryNotFullyFetchedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ SqlQuery qry = new SqlQuery<>("String", "from String");
+ qry.setPageSize(10);
+
+ checkQueryNotFullyFetchedMetrics(cache, qry, true);
+ }
+
+ /**
+ * Test metrics for failed Scan queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testSqlQueryFailedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
- ScanQuery<String, Integer> qry = new ScanQuery<>(Integer.MAX_VALUE);
+ SqlQuery qry = new SqlQuery<>("Long", "from Long");
- testQueryFailedMetrics(cache, qry);
+ checkQueryFailedMetrics(cache, qry);
+ }
+
+ /**
+ * Test metrics for Sql queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testTextQueryMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ TextQuery qry = new TextQuery<>("String", "1");
+
+ checkQueryMetrics(cache, qry);
+ }
+
+ /**
+ * Test metrics for Sql queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testTextQueryNotFullyFetchedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ TextQuery qry = new TextQuery<>("String", "1");
+ qry.setPageSize(10);
+
+ checkQueryNotFullyFetchedMetrics(cache, qry, true);
+ }
+
+ /**
+ * Test metrics for failed Scan queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testTextQueryFailedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ TextQuery qry = new TextQuery<>("Unknown", "zzz");
+
+ checkQueryFailedMetrics(cache, qry);
}
/**
@@ -184,12 +266,12 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
*
* @throws Exception In case of error.
*/
- public void testSqlCrossCacheQueryMetrics() throws Exception {
- IgniteCache<String, Integer> cache = grid(0).context().cache().jcache("A");
+ public void testSqlFieldsCrossCacheQueryMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
- SqlFieldsQuery qry = new SqlFieldsQuery("select * from \"B\".Integer");
+ SqlFieldsQuery qry = new SqlFieldsQuery("select * from \"B\".String");
- testQueryMetrics(cache, qry);
+ checkQueryMetrics(cache, qry);
}
/**
@@ -197,13 +279,13 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
*
* @throws Exception In case of error.
*/
- public void testSqlCrossCacheQueryNotFullyFetchedMetrics() throws Exception {
- IgniteCache<String, Integer> cache = grid(0).context().cache().jcache("A");
+ public void testSqlFieldsCrossCacheQueryNotFullyFetchedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
- SqlFieldsQuery qry = new SqlFieldsQuery("select * from \"B\".Integer");
+ SqlFieldsQuery qry = new SqlFieldsQuery("select * from \"B\".String");
qry.setPageSize(10);
- testQueryNotFullyFetchedMetrics(cache, qry, false);
+ checkQueryNotFullyFetchedMetrics(cache, qry, false);
}
/**
@@ -211,46 +293,102 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
*
* @throws Exception In case of error.
*/
- public void testSqlCrossCacheQueryFailedMetrics() throws Exception {
- IgniteCache<String, Integer> cache = grid(0).context().cache().jcache("A");
+ public void testSqlFieldsCrossCacheQueryFailedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ SqlFieldsQuery qry = new SqlFieldsQuery("select * from \"G\".String");
+
+ checkQueryFailedMetrics(cache, qry);
+ }
+
+ /** */
+ private static class Worker extends Thread {
+ /** */
+ private final IgniteCache cache;
+
+ /** */
+ private final Query qry;
- SqlFieldsQuery qry = new SqlFieldsQuery("select * from \"G\".Integer");
+ /** */
+ Worker(IgniteCache cache, Query qry) {
+ this.cache = cache;
+ this.qry = qry;
+ }
- testQueryFailedMetrics(cache, qry);
+ /** {@inheritDoc} */
+ @Override public void run() {
+ cache.query(qry).getAll();
+ }
}
/**
- * @param cache Cache.
- * @param qry Query.
+ * Test metrics if queries executed from several threads.
+ *
+ * @throws Exception In case of error.
*/
- private void testQueryMetrics(IgniteCache<String, Integer> cache, Query qry) {
- cache.query(qry).getAll();
+ public void testQueryMetricsMultithreaded() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+ Collection<CacheAbstractQueryMetricsSelfTest.Worker> workers = new ArrayList<>();
+
+ int repeat = 100;
+
+ for (int i = 0; i < repeat; i++) {
+ workers.add(new CacheAbstractQueryMetricsSelfTest.Worker(cache, new SqlFieldsQuery("select * from String limit " + i)));
+ workers.add(new CacheAbstractQueryMetricsSelfTest.Worker(cache, new SqlQuery("String", "from String")));
+ workers.add(new CacheAbstractQueryMetricsSelfTest.Worker(cache, new ScanQuery()));
+ workers.add(new CacheAbstractQueryMetricsSelfTest.Worker(cache, new TextQuery("String", "1")));
+ }
+
+ for (CacheAbstractQueryMetricsSelfTest.Worker worker : workers)
+ worker.start();
+
+ for (CacheAbstractQueryMetricsSelfTest.Worker worker : workers)
+ worker.join();
+
+ checkMetrics(cache, repeat * 4, repeat * 4, 0, false);
+ }
+
+ /**
+ * Check metrics.
+ *
+ * @param cache Cache to check metrics.
+ * @param execs Expected number of executions.
+ * @param completions Expected number of completions.
+ * @param failures Expected number of failures.
+ * @param first {@code true} if metrics checked for first query only.
+ */
+ private void checkMetrics(IgniteCache<Integer, String> cache, int execs, int completions, int failures, boolean first) {
GridCacheQueryMetricsAdapter m = (GridCacheQueryMetricsAdapter)cache.queryMetrics();
+ assertNotNull(m);
+
info("Metrics: " + m);
- assertEquals(1, m.executions());
- assertEquals(1, m.completedExecutions());
- assertEquals(0, m.fails());
+ assertEquals("Executions", execs, m.executions());
+ assertEquals("Completions", completions, m.completedExecutions());
+ assertEquals("Failures", failures, m.fails());
assertTrue(m.averageTime() >= 0);
assertTrue(m.maximumTime() >= 0);
assertTrue(m.minimumTime() >= 0);
- assertTrue("On first execution minTime == maxTime", m.minimumTime() == m.maximumTime());
- // Execute again with the same parameters.
+ if (first)
+ assertTrue("On first execution minTime == maxTime", m.minimumTime() == m.maximumTime());
+ }
+
+ /**
+ * @param cache Cache.
+ * @param qry Query.
+ */
+ private void checkQueryMetrics(IgniteCache<Integer, String> cache, Query qry) {
cache.query(qry).getAll();
- m = (GridCacheQueryMetricsAdapter)cache.queryMetrics();
+ checkMetrics(cache, 1, 1, 0, true);
- info("Metrics: " + m);
+ // Execute again with the same parameters.
+ cache.query(qry).getAll();
- assertEquals(2, m.executions());
- assertEquals(2, m.completedExecutions());
- assertEquals(0, m.fails());
- assertTrue(m.averageTime() >= 0);
- assertTrue(m.maximumTime() >= 0);
- assertTrue(m.minimumTime() >= 0);
+ checkMetrics(cache, 2, 2, 0, false);
}
/**
@@ -258,24 +396,14 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
* @param qry Query.
* @param waitingForCompletion Waiting for query completion.
*/
- private void testQueryNotFullyFetchedMetrics(IgniteCache<String, Integer> cache, Query qry,
+ private void checkQueryNotFullyFetchedMetrics(IgniteCache<Integer, String> cache, Query qry,
boolean waitingForCompletion) throws IgniteInterruptedCheckedException {
cache.query(qry).iterator().next();
if (waitingForCompletion)
waitingForCompletion(cache, 1);
- GridCacheQueryMetricsAdapter m = (GridCacheQueryMetricsAdapter)cache.queryMetrics();
-
- info("Metrics: " + m);
-
- assertEquals(1, m.executions());
- assertEquals(1, m.completedExecutions());
- assertEquals(0, m.fails());
- assertTrue(m.averageTime() >= 0);
- assertTrue(m.maximumTime() >= 0);
- assertTrue(m.minimumTime() >= 0);
- assertTrue("On first execution minTime == maxTime", m.minimumTime() == m.maximumTime());
+ checkMetrics(cache, 1, 1, 0, true);
// Execute again with the same parameters.
cache.query(qry).iterator().next();
@@ -283,23 +411,14 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
if (waitingForCompletion)
waitingForCompletion(cache, 2);
- m = (GridCacheQueryMetricsAdapter)cache.queryMetrics();
-
- info("Metrics: " + m);
-
- assertEquals(2, m.executions());
- assertEquals(2, m.completedExecutions());
- assertEquals(0, m.fails());
- assertTrue(m.averageTime() >= 0);
- assertTrue(m.maximumTime() >= 0);
- assertTrue(m.minimumTime() >= 0);
+ checkMetrics(cache, 2, 2, 0, false);
}
/**
* @param cache Cache.
* @param qry Query.
*/
- private void testQueryFailedMetrics(IgniteCache<String, Integer> cache, Query qry) {
+ private void checkQueryFailedMetrics(IgniteCache<Integer, String> cache, Query qry) {
try {
cache.query(qry).getAll();
}
@@ -307,16 +426,7 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
// No-op.
}
- GridCacheQueryMetricsAdapter m = (GridCacheQueryMetricsAdapter)cache.queryMetrics();
-
- info("Metrics: " + m);
-
- assertEquals(1, m.executions());
- assertEquals(0, m.completedExecutions());
- assertEquals(1, m.fails());
- assertTrue(m.averageTime() == 0);
- assertTrue(m.maximumTime() == 0);
- assertTrue(m.minimumTime() == 0);
+ checkMetrics(cache, 1, 0, 1, true);
// Execute again with the same parameters.
try {
@@ -326,23 +436,14 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
// No-op.
}
- m = (GridCacheQueryMetricsAdapter)cache.queryMetrics();
-
- info("Metrics: " + m);
-
- assertEquals(2, m.executions());
- assertEquals(0, m.completedExecutions());
- assertEquals(2, m.fails());
- assertTrue(m.averageTime() == 0);
- assertTrue(m.maximumTime() == 0);
- assertTrue(m.minimumTime() == 0);
+ checkMetrics(cache, 2, 0, 2, true);
}
/**
* @param cache Cache.
* @param exp Expected.
*/
- private static void waitingForCompletion(final IgniteCache<String, Integer> cache,
+ private static void waitingForCompletion(final IgniteCache<Integer, String> cache,
final int exp) throws IgniteInterruptedCheckedException {
GridTestUtils.waitForCondition(new GridAbsPredicate() {
@Override public boolean apply() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheLocalQueryDetailMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheLocalQueryDetailMetricsSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheLocalQueryDetailMetricsSelfTest.java
new file mode 100644
index 0000000..7797120
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheLocalQueryDetailMetricsSelfTest.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import static org.apache.ignite.cache.CacheMode.LOCAL;
+
+/**
+ * Tests for local cache query metrics.
+ */
+public class CacheLocalQueryDetailMetricsSelfTest extends CacheAbstractQueryDetailMetricsSelfTest {
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ gridCnt = 1;
+ cacheMode = LOCAL;
+
+ super.beforeTest();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CachePartitionedQueryDetailMetricsDistributedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CachePartitionedQueryDetailMetricsDistributedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CachePartitionedQueryDetailMetricsDistributedSelfTest.java
new file mode 100644
index 0000000..c924487
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CachePartitionedQueryDetailMetricsDistributedSelfTest.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+
+/**
+ * Tests for partitioned distributed cache query metrics.
+ */
+public class CachePartitionedQueryDetailMetricsDistributedSelfTest extends CacheAbstractQueryDetailMetricsSelfTest {
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ gridCnt = 2;
+ cacheMode = PARTITIONED;
+
+ super.beforeTest();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CachePartitionedQueryDetailMetricsLocalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CachePartitionedQueryDetailMetricsLocalSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CachePartitionedQueryDetailMetricsLocalSelfTest.java
new file mode 100644
index 0000000..4ffba3e
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CachePartitionedQueryDetailMetricsLocalSelfTest.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+
+/**
+ * Tests for partitioned local cache query metrics.
+ */
+public class CachePartitionedQueryDetailMetricsLocalSelfTest extends CacheAbstractQueryDetailMetricsSelfTest {
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ gridCnt = 1;
+ cacheMode = PARTITIONED;
+
+ super.beforeTest();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheReplicatedQueryDetailMetricsDistributedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheReplicatedQueryDetailMetricsDistributedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheReplicatedQueryDetailMetricsDistributedSelfTest.java
new file mode 100644
index 0000000..32edb66
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheReplicatedQueryDetailMetricsDistributedSelfTest.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import static org.apache.ignite.cache.CacheMode.REPLICATED;
+
+/**
+ * Tests for replicated distributed cache query metrics.
+ */
+public class CacheReplicatedQueryDetailMetricsDistributedSelfTest extends CacheAbstractQueryDetailMetricsSelfTest {
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ gridCnt = 2;
+ cacheMode = REPLICATED;
+
+ super.beforeTest();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheReplicatedQueryDetailMetricsLocalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheReplicatedQueryDetailMetricsLocalSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheReplicatedQueryDetailMetricsLocalSelfTest.java
new file mode 100644
index 0000000..65c372d
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheReplicatedQueryDetailMetricsLocalSelfTest.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import static org.apache.ignite.cache.CacheMode.REPLICATED;
+
+/**
+ * Tests for replicated local cache query metrics.
+ */
+public class CacheReplicatedQueryDetailMetricsLocalSelfTest extends CacheAbstractQueryDetailMetricsSelfTest {
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ gridCnt = 1;
+ cacheMode = REPLICATED;
+
+ super.beforeTest();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java
index be7523f..21f6864 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java
@@ -18,12 +18,17 @@
package org.apache.ignite.testsuites;
import junit.framework.TestSuite;
+import org.apache.ignite.internal.processors.cache.CacheLocalQueryDetailMetricsSelfTest;
import org.apache.ignite.internal.processors.cache.CacheLocalQueryMetricsSelfTest;
import org.apache.ignite.internal.processors.cache.CacheOffheapBatchIndexingSingleTypeTest;
+import org.apache.ignite.internal.processors.cache.CachePartitionedQueryDetailMetricsDistributedSelfTest;
+import org.apache.ignite.internal.processors.cache.CachePartitionedQueryDetailMetricsLocalSelfTest;
import org.apache.ignite.internal.processors.cache.CachePartitionedQueryMetricsDistributedSelfTest;
import org.apache.ignite.internal.processors.cache.CachePartitionedQueryMetricsLocalSelfTest;
import org.apache.ignite.internal.processors.cache.CacheQueryNewClientSelfTest;
import org.apache.ignite.internal.processors.cache.CacheQueryOffheapEvictDataLostTest;
+import org.apache.ignite.internal.processors.cache.CacheReplicatedQueryDetailMetricsDistributedSelfTest;
+import org.apache.ignite.internal.processors.cache.CacheReplicatedQueryDetailMetricsLocalSelfTest;
import org.apache.ignite.internal.processors.cache.CacheReplicatedQueryMetricsDistributedSelfTest;
import org.apache.ignite.internal.processors.cache.CacheReplicatedQueryMetricsLocalSelfTest;
import org.apache.ignite.internal.processors.cache.CacheScanPartitionQueryFallbackSelfTest;
@@ -93,6 +98,13 @@ public class IgniteCacheQuerySelfTestSuite2 extends TestSuite {
suite.addTestSuite(CacheReplicatedQueryMetricsDistributedSelfTest.class);
suite.addTestSuite(CacheReplicatedQueryMetricsLocalSelfTest.class);
+ // Cache query metrics.
+ suite.addTestSuite(CacheLocalQueryDetailMetricsSelfTest.class);
+ suite.addTestSuite(CachePartitionedQueryDetailMetricsDistributedSelfTest.class);
+ suite.addTestSuite(CachePartitionedQueryDetailMetricsLocalSelfTest.class);
+ suite.addTestSuite(CacheReplicatedQueryDetailMetricsDistributedSelfTest.class);
+ suite.addTestSuite(CacheReplicatedQueryDetailMetricsLocalSelfTest.class);
+
// Unmarshalling query test.
suite.addTestSuite(IgniteCacheP2pUnmarshallingQueryErrorTest.class);
suite.addTestSuite(IgniteCacheNoClassQuerySelfTest.class);
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
index 1fa185f..04a68ae 100755
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
@@ -22,7 +22,8 @@ import java.util.{Collection => JavaCollection, Collections, UUID}
import org.apache.ignite._
import org.apache.ignite.cluster.ClusterNode
-import org.apache.ignite.internal.util.typedef._
+import org.apache.ignite.internal.util.lang.{GridFunc => F}
+import org.apache.ignite.internal.util.typedef.X
import org.apache.ignite.internal.visor.cache._
import org.apache.ignite.internal.visor.util.VisorTaskUtils._
import org.apache.ignite.lang.IgniteBiTuple
@@ -287,7 +288,7 @@ class VisorCacheCommand {
if (hasArgFlag("scan", argLst))
VisorCacheScanCommand().scan(argLst, node)
else {
- if (aggrData.nonEmpty && !aggrData.exists(cache => safeEquals(cache.name(), name) && cache.system())) {
+ if (aggrData.nonEmpty && !aggrData.exists(cache => F.eq(cache.name(), name) && cache.system())) {
if (hasArgFlag("clear", argLst))
VisorCacheClearCommand().clear(argLst, node)
else if (hasArgFlag("swap", argLst))
@@ -470,7 +471,7 @@ class VisorCacheCommand {
println(" Total number of executions: " + ad.execsQuery)
println(" Total number of failures: " + ad.failsQuery)
- gCfg.foreach(ccfgs => ccfgs.find(ccfg => safeEquals(ccfg.name(), ad.name()))
+ gCfg.foreach(ccfgs => ccfgs.find(ccfg => F.eq(ccfg.name(), ad.name()))
.foreach(ccfg => {
nl()
[05/15] ignite git commit: Reverted wrong commit.
Posted by av...@apache.org.
Reverted wrong commit.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f8aa9573
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f8aa9573
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f8aa9573
Branch: refs/heads/ignite-4242
Commit: f8aa957327312d76f90231b9bfe6d386d1d4ec37
Parents: 73a8fa8
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Nov 11 15:56:42 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Nov 11 15:56:42 2016 +0700
----------------------------------------------------------------------
modules/hadoop/pom.xml | 49 ---------------------------------------------
1 file changed, 49 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f8aa9573/modules/hadoop/pom.xml
----------------------------------------------------------------------
diff --git a/modules/hadoop/pom.xml b/modules/hadoop/pom.xml
index d0b0481..c02a574 100644
--- a/modules/hadoop/pom.xml
+++ b/modules/hadoop/pom.xml
@@ -127,55 +127,6 @@
<build>
<plugins>
<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <version>1.3.2</version>
- <dependencies>
- <dependency>
- <groupId>org.apache.ignite</groupId>
- <artifactId>ignite-tools</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- <executions>
- <execution>
- <phase>process-classes</phase>
- <goals>
- <goal>java</goal>
- </goals>
- <configuration>
- <includePluginDependencies>true</includePluginDependencies>
- <mainClass>org.apache.ignite.tools.classgen.ClassesGenerator</mainClass>
- <arguments>
- <argument>${project.basedir}/target/classes</argument>
- <argument>
- <![CDATA[
-#
-# 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.
-#
- ]]>
- </argument>
- <argument>org.apache.ignite.hadoop:org.apache.ignite.internal.processors.hadoop</argument>
- </arguments>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
[11/15] ignite git commit: IGNITE-2523 "single put" NEAR update
request
Posted by av...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
deleted file mode 100644
index 5057fbb..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
+++ /dev/null
@@ -1,1092 +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.processors.cache.distributed.dht.atomic;
-
-import java.io.Externalizable;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.UUID;
-import javax.cache.expiry.ExpiryPolicy;
-import javax.cache.processor.EntryProcessor;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.internal.GridDirectCollection;
-import org.apache.ignite.internal.GridDirectTransient;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
-import org.apache.ignite.internal.processors.cache.CacheObject;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
-import org.apache.ignite.internal.processors.cache.GridCacheMessage;
-import org.apache.ignite.internal.processors.cache.GridCacheOperation;
-import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
-import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.distributed.IgniteExternalizableExpiryPolicy;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.util.GridLongList;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-import org.apache.ignite.internal.util.typedef.internal.CU;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
-import org.apache.ignite.plugin.extensions.communication.MessageReader;
-import org.apache.ignite.plugin.extensions.communication.MessageWriter;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import static org.apache.ignite.internal.processors.cache.GridCacheOperation.DELETE;
-import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRANSFORM;
-import static org.apache.ignite.internal.processors.cache.GridCacheOperation.UPDATE;
-
-/**
- * Lite DHT cache update request sent from near node to primary node.
- */
-public class GridNearAtomicUpdateRequest extends GridCacheMessage implements GridCacheDeployable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Message index. */
- public static final int CACHE_MSG_IDX = nextIndexId();
-
- /** Target node ID. */
- @GridDirectTransient
- private UUID nodeId;
-
- /** Future version. */
- private GridCacheVersion futVer;
-
- /** Fast map flag. */
- private boolean fastMap;
-
- /** Update version. Set to non-null if fastMap is {@code true}. */
- private GridCacheVersion updateVer;
-
- /** Topology version. */
- private AffinityTopologyVersion topVer;
-
- /** Topology locked flag. Set if atomic update is performed inside TX or explicit lock. */
- private boolean topLocked;
-
- /** Write synchronization mode. */
- private CacheWriteSynchronizationMode syncMode;
-
- /** Update operation. */
- private GridCacheOperation op;
-
- /** Keys to update. */
- @GridToStringInclude
- @GridDirectCollection(KeyCacheObject.class)
- private List<KeyCacheObject> keys;
-
- /** Values to update. */
- @GridDirectCollection(CacheObject.class)
- private List<CacheObject> vals;
-
- /** Partitions of keys. */
- @GridDirectCollection(int.class)
- private List<Integer> partIds;
-
- /** Entry processors. */
- @GridDirectTransient
- private List<EntryProcessor<Object, Object, Object>> entryProcessors;
-
- /** Entry processors bytes. */
- @GridDirectCollection(byte[].class)
- private List<byte[]> entryProcessorsBytes;
-
- /** Optional arguments for entry processor. */
- @GridDirectTransient
- private Object[] invokeArgs;
-
- /** Entry processor arguments bytes. */
- private byte[][] invokeArgsBytes;
-
- /** Conflict versions. */
- @GridDirectCollection(GridCacheVersion.class)
- private List<GridCacheVersion> conflictVers;
-
- /** Conflict TTLs. */
- private GridLongList conflictTtls;
-
- /** Conflict expire times. */
- private GridLongList conflictExpireTimes;
-
- /** Return value flag. */
- private boolean retval;
-
- /** Expiry policy. */
- @GridDirectTransient
- private ExpiryPolicy expiryPlc;
-
- /** Expiry policy bytes. */
- private byte[] expiryPlcBytes;
-
- /** Filter. */
- private CacheEntryPredicate[] filter;
-
- /** Flag indicating whether request contains primary keys. */
- private boolean hasPrimary;
-
- /** Subject ID. */
- private UUID subjId;
-
- /** Task name hash. */
- private int taskNameHash;
-
- /** Skip write-through to a persistent storage. */
- private boolean skipStore;
-
- /** */
- private boolean clientReq;
-
- /** Keep binary flag. */
- private boolean keepBinary;
-
- /** */
- @GridDirectTransient
- private GridNearAtomicUpdateResponse res;
-
- /** Maximum possible size of inner collections. */
- @GridDirectTransient
- private int initSize;
-
- /**
- * Empty constructor required by {@link Externalizable}.
- */
- public GridNearAtomicUpdateRequest() {
- // No-op.
- }
-
- /**
- * Constructor.
- *
- * @param cacheId Cache ID.
- * @param nodeId Node ID.
- * @param futVer Future version.
- * @param fastMap Fast map scheme flag.
- * @param updateVer Update version set if fast map is performed.
- * @param topVer Topology version.
- * @param topLocked Topology locked flag.
- * @param syncMode Synchronization mode.
- * @param op Cache update operation.
- * @param retval Return value required flag.
- * @param expiryPlc Expiry policy.
- * @param invokeArgs Optional arguments for entry processor.
- * @param filter Optional filter for atomic check.
- * @param subjId Subject ID.
- * @param taskNameHash Task name hash code.
- * @param skipStore Skip write-through to a persistent storage.
- * @param keepBinary Keep binary flag.
- * @param clientReq Client node request flag.
- * @param addDepInfo Deployment info flag.
- * @param maxEntryCnt Maximum entries count.
- */
- public GridNearAtomicUpdateRequest(
- int cacheId,
- UUID nodeId,
- GridCacheVersion futVer,
- boolean fastMap,
- @Nullable GridCacheVersion updateVer,
- @NotNull AffinityTopologyVersion topVer,
- boolean topLocked,
- CacheWriteSynchronizationMode syncMode,
- GridCacheOperation op,
- boolean retval,
- @Nullable ExpiryPolicy expiryPlc,
- @Nullable Object[] invokeArgs,
- @Nullable CacheEntryPredicate[] filter,
- @Nullable UUID subjId,
- int taskNameHash,
- boolean skipStore,
- boolean keepBinary,
- boolean clientReq,
- boolean addDepInfo,
- int maxEntryCnt
- ) {
- assert futVer != null;
-
- this.cacheId = cacheId;
- this.nodeId = nodeId;
- this.futVer = futVer;
- this.fastMap = fastMap;
- this.updateVer = updateVer;
-
- this.topVer = topVer;
- this.topLocked = topLocked;
- this.syncMode = syncMode;
- this.op = op;
- this.retval = retval;
- this.expiryPlc = expiryPlc;
- this.invokeArgs = invokeArgs;
- this.filter = filter;
- this.subjId = subjId;
- this.taskNameHash = taskNameHash;
- this.skipStore = skipStore;
- this.keepBinary = keepBinary;
- this.clientReq = clientReq;
- this.addDepInfo = addDepInfo;
-
- // By default ArrayList expands to array of 10 elements on first add. We cannot guess how many entries
- // will be added to request because of unknown affinity distribution. However, we DO KNOW how many keys
- // participate in request. As such, we know upper bound of all collections in request. If this bound is lower
- // than 10, we use it.
- initSize = Math.min(maxEntryCnt, 10);
-
- keys = new ArrayList<>(initSize);
-
- partIds = new ArrayList<>(initSize);
- }
-
- /** {@inheritDoc} */
- @Override public int lookupIndex() {
- return CACHE_MSG_IDX;
- }
-
- /**
- * @return Mapped node ID.
- */
- public UUID nodeId() {
- return nodeId;
- }
-
- /**
- * @param nodeId Node ID.
- */
- public void nodeId(UUID nodeId) {
- this.nodeId = nodeId;
- }
-
- /**
- * @return Subject ID.
- */
- public UUID subjectId() {
- return subjId;
- }
-
- /**
- * @return Task name hash.
- */
- public int taskNameHash() {
- return taskNameHash;
- }
-
- /**
- * @return Future version.
- */
- public GridCacheVersion futureVersion() {
- return futVer;
- }
-
- /**
- * @return Flag indicating whether this is fast-map udpate.
- */
- public boolean fastMap() {
- return fastMap;
- }
-
- /**
- * @return Update version for fast-map request.
- */
- public GridCacheVersion updateVersion() {
- return updateVer;
- }
-
- /**
- * @return Topology version.
- */
- @Override public AffinityTopologyVersion topologyVersion() {
- return topVer;
- }
-
- /**
- * @return Topology locked flag.
- */
- public boolean topologyLocked() {
- return topLocked;
- }
-
- /**
- * @return {@code True} if request sent from client node.
- */
- public boolean clientRequest() {
- return clientReq;
- }
-
- /**
- * @return Cache write synchronization mode.
- */
- public CacheWriteSynchronizationMode writeSynchronizationMode() {
- return syncMode;
- }
-
- /**
- * @return Expiry policy.
- */
- public ExpiryPolicy expiry() {
- return expiryPlc;
- }
-
- /**
- * @return Return value flag.
- */
- public boolean returnValue() {
- return retval;
- }
-
- /**
- * @return Filter.
- */
- @Nullable public CacheEntryPredicate[] filter() {
- return filter;
- }
-
- /**
- * @return Skip write-through to a persistent storage.
- */
- public boolean skipStore() {
- return skipStore;
- }
-
- /**
- * @return Keep binary flag.
- */
- public boolean keepBinary() {
- return keepBinary;
- }
-
- /**
- * @param key Key to add.
- * @param val Optional update value.
- * @param conflictTtl Conflict TTL (optional).
- * @param conflictExpireTime Conflict expire time (optional).
- * @param conflictVer Conflict version (optional).
- * @param primary If given key is primary on this mapping.
- */
- public void addUpdateEntry(KeyCacheObject key,
- @Nullable Object val,
- long conflictTtl,
- long conflictExpireTime,
- @Nullable GridCacheVersion conflictVer,
- boolean primary) {
- EntryProcessor<Object, Object, Object> entryProcessor = null;
-
- if (op == TRANSFORM) {
- assert val instanceof EntryProcessor : val;
-
- entryProcessor = (EntryProcessor<Object, Object, Object>)val;
- }
-
- assert val != null || op == DELETE;
-
- keys.add(key);
- partIds.add(key.partition());
-
- if (entryProcessor != null) {
- if (entryProcessors == null)
- entryProcessors = new ArrayList<>(initSize);
-
- entryProcessors.add(entryProcessor);
- }
- else if (val != null) {
- assert val instanceof CacheObject : val;
-
- if (vals == null)
- vals = new ArrayList<>(initSize);
-
- vals.add((CacheObject)val);
- }
-
- hasPrimary |= primary;
-
- // In case there is no conflict, do not create the list.
- if (conflictVer != null) {
- if (conflictVers == null) {
- conflictVers = new ArrayList<>(initSize);
-
- for (int i = 0; i < keys.size() - 1; i++)
- conflictVers.add(null);
- }
-
- conflictVers.add(conflictVer);
- }
- else if (conflictVers != null)
- conflictVers.add(null);
-
- if (conflictTtl >= 0) {
- if (conflictTtls == null) {
- conflictTtls = new GridLongList(keys.size());
-
- for (int i = 0; i < keys.size() - 1; i++)
- conflictTtls.add(CU.TTL_NOT_CHANGED);
- }
-
- conflictTtls.add(conflictTtl);
- }
-
- if (conflictExpireTime >= 0) {
- if (conflictExpireTimes == null) {
- conflictExpireTimes = new GridLongList(keys.size());
-
- for (int i = 0; i < keys.size() - 1; i++)
- conflictExpireTimes.add(CU.EXPIRE_TIME_CALCULATE);
- }
-
- conflictExpireTimes.add(conflictExpireTime);
- }
- }
-
- /**
- * @return Keys for this update request.
- */
- public List<KeyCacheObject> keys() {
- return keys;
- }
-
- /**
- * @return Values for this update request.
- */
- public List<?> values() {
- return op == TRANSFORM ? entryProcessors : vals;
- }
-
- /**
- * @return Update operation.
- */
- public GridCacheOperation operation() {
- return op;
- }
-
- /**
- * @return Optional arguments for entry processor.
- */
- @Nullable public Object[] invokeArguments() {
- return invokeArgs;
- }
-
- /**
- * @param idx Key index.
- * @return Value.
- */
- @SuppressWarnings("unchecked")
- public CacheObject value(int idx) {
- assert op == UPDATE : op;
-
- return vals.get(idx);
- }
-
- /**
- * @param idx Key index.
- * @return Entry processor.
- */
- @SuppressWarnings("unchecked")
- public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
- assert op == TRANSFORM : op;
-
- return entryProcessors.get(idx);
- }
-
- /**
- * @param idx Index to get.
- * @return Write value - either value, or transform closure.
- */
- public CacheObject writeValue(int idx) {
- if (vals != null)
- return vals.get(idx);
-
- return null;
- }
-
- /**
- * @return Conflict versions.
- */
- @Nullable public List<GridCacheVersion> conflictVersions() {
- return conflictVers;
- }
-
- /**
- * @param idx Index.
- * @return Conflict version.
- */
- @Nullable public GridCacheVersion conflictVersion(int idx) {
- if (conflictVers != null) {
- assert idx >= 0 && idx < conflictVers.size();
-
- return conflictVers.get(idx);
- }
-
- return null;
- }
-
- /**
- * @param idx Index.
- * @return Conflict TTL.
- */
- public long conflictTtl(int idx) {
- if (conflictTtls != null) {
- assert idx >= 0 && idx < conflictTtls.size();
-
- return conflictTtls.get(idx);
- }
-
- return CU.TTL_NOT_CHANGED;
- }
-
- /**
- * @param idx Index.
- * @return Conflict expire time.
- */
- public long conflictExpireTime(int idx) {
- if (conflictExpireTimes != null) {
- assert idx >= 0 && idx < conflictExpireTimes.size();
-
- return conflictExpireTimes.get(idx);
- }
-
- return CU.EXPIRE_TIME_CALCULATE;
- }
-
- /**
- * @return Flag indicating whether this request contains primary keys.
- */
- public boolean hasPrimary() {
- return hasPrimary;
- }
-
- /**
- * @param res Response.
- * @return {@code True} if current response was {@code null}.
- */
- public boolean onResponse(GridNearAtomicUpdateResponse res) {
- if (this.res == null) {
- this.res = res;
-
- return true;
- }
-
- return false;
- }
-
- /**
- * @return Response.
- */
- @Nullable public GridNearAtomicUpdateResponse response() {
- return res;
- }
-
- /** {@inheritDoc}
- * @param ctx*/
- @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
- super.prepareMarshal(ctx);
-
- GridCacheContext cctx = ctx.cacheContext(cacheId);
-
- prepareMarshalCacheObjects(keys, cctx);
-
- if (filter != null) {
- boolean hasFilter = false;
-
- for (CacheEntryPredicate p : filter) {
- if (p != null) {
- hasFilter = true;
-
- p.prepareMarshal(cctx);
- }
- }
-
- if (!hasFilter)
- filter = null;
- }
-
- if (expiryPlc != null && expiryPlcBytes == null)
- expiryPlcBytes = CU.marshal(cctx, new IgniteExternalizableExpiryPolicy(expiryPlc));
-
- if (op == TRANSFORM) {
- // force addition of deployment info for entry processors if P2P is enabled globally.
- if (!addDepInfo && ctx.deploymentEnabled())
- addDepInfo = true;
-
- if (entryProcessorsBytes == null)
- entryProcessorsBytes = marshalCollection(entryProcessors, cctx);
-
- if (invokeArgsBytes == null)
- invokeArgsBytes = marshalInvokeArguments(invokeArgs, cctx);
- }
- else
- prepareMarshalCacheObjects(vals, cctx);
- }
-
- /** {@inheritDoc} */
- @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
- super.finishUnmarshal(ctx, ldr);
-
- GridCacheContext cctx = ctx.cacheContext(cacheId);
-
- finishUnmarshalCacheObjects(keys, cctx, ldr);
-
- if (op == TRANSFORM) {
- if (entryProcessors == null)
- entryProcessors = unmarshalCollection(entryProcessorsBytes, ctx, ldr);
-
- if (invokeArgs == null)
- invokeArgs = unmarshalInvokeArguments(invokeArgsBytes, ctx, ldr);
- }
- else
- finishUnmarshalCacheObjects(vals, cctx, ldr);
-
- if (filter != null) {
- for (CacheEntryPredicate p : filter) {
- if (p != null)
- p.finishUnmarshal(cctx, ldr);
- }
- }
-
- if (expiryPlcBytes != null && expiryPlc == null)
- expiryPlc = U.unmarshal(ctx, expiryPlcBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
-
- if (partIds != null && !partIds.isEmpty()) {
- assert partIds.size() == keys.size();
-
- for (int i = 0; i < keys.size(); i++)
- keys.get(i).partition(partIds.get(i));
- }
- }
-
- /** {@inheritDoc} */
- @Override public boolean addDeploymentInfo() {
- return addDepInfo;
- }
-
- /** {@inheritDoc} */
- @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
- return ctx.atomicMessageLogger();
- }
-
- /** {@inheritDoc} */
- @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
- writer.setBuffer(buf);
-
- if (!super.writeTo(buf, writer))
- return false;
-
- if (!writer.isHeaderWritten()) {
- if (!writer.writeHeader(directType(), fieldsCount()))
- return false;
-
- writer.onHeaderWritten();
- }
-
- switch (writer.state()) {
- case 3:
- if (!writer.writeBoolean("clientReq", clientReq))
- return false;
-
- writer.incrementState();
-
- case 4:
- if (!writer.writeMessage("conflictExpireTimes", conflictExpireTimes))
- return false;
-
- writer.incrementState();
-
- case 5:
- if (!writer.writeMessage("conflictTtls", conflictTtls))
- return false;
-
- writer.incrementState();
-
- case 6:
- if (!writer.writeCollection("conflictVers", conflictVers, MessageCollectionItemType.MSG))
- return false;
-
- writer.incrementState();
-
- case 7:
- if (!writer.writeCollection("entryProcessorsBytes", entryProcessorsBytes, MessageCollectionItemType.BYTE_ARR))
- return false;
-
- writer.incrementState();
-
- case 8:
- if (!writer.writeByteArray("expiryPlcBytes", expiryPlcBytes))
- return false;
-
- writer.incrementState();
-
- case 9:
- if (!writer.writeBoolean("fastMap", fastMap))
- return false;
-
- writer.incrementState();
-
- case 10:
- if (!writer.writeObjectArray("filter", filter, MessageCollectionItemType.MSG))
- return false;
-
- writer.incrementState();
-
- case 11:
- if (!writer.writeMessage("futVer", futVer))
- return false;
-
- writer.incrementState();
-
- case 12:
- if (!writer.writeBoolean("hasPrimary", hasPrimary))
- return false;
-
- writer.incrementState();
-
- case 13:
- if (!writer.writeObjectArray("invokeArgsBytes", invokeArgsBytes, MessageCollectionItemType.BYTE_ARR))
- return false;
-
- writer.incrementState();
-
- case 14:
- if (!writer.writeBoolean("keepBinary", keepBinary))
- return false;
-
- writer.incrementState();
-
- case 15:
- if (!writer.writeCollection("keys", keys, MessageCollectionItemType.MSG))
- return false;
-
- writer.incrementState();
-
- case 16:
- if (!writer.writeByte("op", op != null ? (byte)op.ordinal() : -1))
- return false;
-
- writer.incrementState();
-
- case 17:
- if (!writer.writeBoolean("retval", retval))
- return false;
-
- writer.incrementState();
-
- case 18:
- if (!writer.writeBoolean("skipStore", skipStore))
- return false;
-
- writer.incrementState();
-
- case 19:
- if (!writer.writeUuid("subjId", subjId))
- return false;
-
- writer.incrementState();
-
- case 20:
- if (!writer.writeByte("syncMode", syncMode != null ? (byte)syncMode.ordinal() : -1))
- return false;
-
- writer.incrementState();
-
- case 21:
- if (!writer.writeInt("taskNameHash", taskNameHash))
- return false;
-
- writer.incrementState();
-
- case 22:
- if (!writer.writeBoolean("topLocked", topLocked))
- return false;
-
- writer.incrementState();
-
- case 23:
- if (!writer.writeMessage("topVer", topVer))
- return false;
-
- writer.incrementState();
-
- case 24:
- if (!writer.writeMessage("updateVer", updateVer))
- return false;
-
- writer.incrementState();
-
- case 25:
- if (!writer.writeCollection("vals", vals, MessageCollectionItemType.MSG))
- return false;
-
- writer.incrementState();
-
- case 26:
- if (!writer.writeCollection("partIds", partIds, MessageCollectionItemType.INT))
- return false;
-
- writer.incrementState();
- }
-
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
- reader.setBuffer(buf);
-
- if (!reader.beforeMessageRead())
- return false;
-
- if (!super.readFrom(buf, reader))
- return false;
-
- switch (reader.state()) {
- case 3:
- clientReq = reader.readBoolean("clientReq");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 4:
- conflictExpireTimes = reader.readMessage("conflictExpireTimes");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 5:
- conflictTtls = reader.readMessage("conflictTtls");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 6:
- conflictVers = reader.readCollection("conflictVers", MessageCollectionItemType.MSG);
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 7:
- entryProcessorsBytes = reader.readCollection("entryProcessorsBytes", MessageCollectionItemType.BYTE_ARR);
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 8:
- expiryPlcBytes = reader.readByteArray("expiryPlcBytes");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 9:
- fastMap = reader.readBoolean("fastMap");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 10:
- filter = reader.readObjectArray("filter", MessageCollectionItemType.MSG, CacheEntryPredicate.class);
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 11:
- futVer = reader.readMessage("futVer");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 12:
- hasPrimary = reader.readBoolean("hasPrimary");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 13:
- invokeArgsBytes = reader.readObjectArray("invokeArgsBytes", MessageCollectionItemType.BYTE_ARR, byte[].class);
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 14:
- keepBinary = reader.readBoolean("keepBinary");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 15:
- keys = reader.readCollection("keys", MessageCollectionItemType.MSG);
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 16:
- byte opOrd;
-
- opOrd = reader.readByte("op");
-
- if (!reader.isLastRead())
- return false;
-
- op = GridCacheOperation.fromOrdinal(opOrd);
-
- reader.incrementState();
-
- case 17:
- retval = reader.readBoolean("retval");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 18:
- skipStore = reader.readBoolean("skipStore");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 19:
- subjId = reader.readUuid("subjId");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 20:
- byte syncModeOrd;
-
- syncModeOrd = reader.readByte("syncMode");
-
- if (!reader.isLastRead())
- return false;
-
- syncMode = CacheWriteSynchronizationMode.fromOrdinal(syncModeOrd);
-
- reader.incrementState();
-
- case 21:
- taskNameHash = reader.readInt("taskNameHash");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 22:
- topLocked = reader.readBoolean("topLocked");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 23:
- topVer = reader.readMessage("topVer");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 24:
- updateVer = reader.readMessage("updateVer");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 25:
- vals = reader.readCollection("vals", MessageCollectionItemType.MSG);
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 26:
- partIds = reader.readCollection("partIds", MessageCollectionItemType.INT);
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- }
-
- return reader.afterMessageRead(GridNearAtomicUpdateRequest.class);
- }
-
- /**
- * Cleanup values.
- *
- * @param clearKeys If {@code true} clears keys.
- */
- public void cleanup(boolean clearKeys) {
- vals = null;
- entryProcessors = null;
- entryProcessorsBytes = null;
- invokeArgs = null;
- invokeArgsBytes = null;
-
- if (clearKeys)
- keys = null;
- }
-
- /** {@inheritDoc} */
- @Override public byte directType() {
- return 40;
- }
-
- /** {@inheritDoc} */
- @Override public byte fieldsCount() {
- return 27;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(GridNearAtomicUpdateRequest.class, this, "filter", Arrays.toString(filter),
- "parent", super.toString());
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
index 09aec81..a9245f0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
@@ -50,6 +50,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtFuture
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvalidPartitionException;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicAbstractUpdateRequest;
import org.apache.ignite.internal.util.future.GridCompoundFuture;
import org.apache.ignite.internal.util.future.GridFinishedFuture;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
@@ -661,6 +662,15 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
return true;
}
+ /** {@inheritDoc} */
+ @Override public IgniteInternalFuture<Object> request(GridNearAtomicAbstractUpdateRequest req,
+ AffinityTopologyVersion topVer) {
+ if (!needForceKeys())
+ return null;
+
+ return request0(req.keys(), topVer);
+ }
+
/**
* @param keys Keys to request.
* @return Future for request.
@@ -670,6 +680,16 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
if (!needForceKeys())
return null;
+ return request0(keys, topVer);
+ }
+
+ /**
+ * @param keys Keys to request.
+ * @param topVer Topology version.
+ * @return Future for request.
+ */
+ @SuppressWarnings({"unchecked", "RedundantCast"})
+ private GridDhtFuture<Object> request0(Collection<KeyCacheObject> keys, AffinityTopologyVersion topVer) {
final GridDhtForceKeysFuture<?, ?> fut = new GridDhtForceKeysFuture<>(cctx, topVer, keys, this);
IgniteInternalFuture<?> topReadyFut = cctx.affinity().affinityReadyFuturex(topVer);
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
index 3e0e392..b5b2c72 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
@@ -44,7 +44,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvali
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicAbstractUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
import org.apache.ignite.internal.processors.cache.dr.GridCacheDrInfo;
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalEx;
@@ -126,10 +126,10 @@ public class GridNearAtomicCache<K, V> extends GridNearCacheAdapter<K, V> {
* @param res Update response.
*/
public void processNearAtomicUpdateResponse(
- GridNearAtomicUpdateRequest req,
+ GridNearAtomicAbstractUpdateRequest req,
GridNearAtomicUpdateResponse res
) {
- if (F.size(res.failedKeys()) == req.keys().size())
+ if (F.size(res.failedKeys()) == req.size())
return;
/*
@@ -152,11 +152,11 @@ public class GridNearAtomicCache<K, V> extends GridNearCacheAdapter<K, V> {
String taskName = ctx.kernalContext().task().resolveTaskName(req.taskNameHash());
- for (int i = 0; i < req.keys().size(); i++) {
+ for (int i = 0; i < req.size(); i++) {
if (F.contains(skipped, i))
continue;
- KeyCacheObject key = req.keys().get(i);
+ KeyCacheObject key = req.key(i);
if (F.contains(failed, key))
continue;
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/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 0d291cc..71d236f 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -75,13 +75,11 @@ org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicy$HolderComparator
org.apache.ignite.cache.query.CacheQueryEntryEvent
org.apache.ignite.cache.query.ContinuousQuery
org.apache.ignite.cache.query.Query
-org.apache.ignite.cache.query.QueryCancelledException
org.apache.ignite.cache.query.ScanQuery
org.apache.ignite.cache.query.SpiQuery
org.apache.ignite.cache.query.SqlFieldsQuery
org.apache.ignite.cache.query.SqlQuery
org.apache.ignite.cache.query.TextQuery
-org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore$2
org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore$EntryMapping$1
org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore$EntryMapping$2
org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore$TypeKind
@@ -368,7 +366,6 @@ org.apache.ignite.internal.processors.cache.CacheWeakQueryIteratorsHolder$WeakQu
org.apache.ignite.internal.processors.cache.CacheWeakQueryIteratorsHolder$WeakReferenceCloseableIterator
org.apache.ignite.internal.processors.cache.DynamicCacheChangeBatch
org.apache.ignite.internal.processors.cache.DynamicCacheChangeRequest
-org.apache.ignite.internal.processors.cache.EntryProcessorResourceInjectorProxy
org.apache.ignite.internal.processors.cache.GridCacheAdapter
org.apache.ignite.internal.processors.cache.GridCacheAdapter$10
org.apache.ignite.internal.processors.cache.GridCacheAdapter$11
@@ -376,9 +373,9 @@ org.apache.ignite.internal.processors.cache.GridCacheAdapter$12
org.apache.ignite.internal.processors.cache.GridCacheAdapter$13
org.apache.ignite.internal.processors.cache.GridCacheAdapter$14
org.apache.ignite.internal.processors.cache.GridCacheAdapter$15
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$16
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$16$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$17
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$18$1
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$18
org.apache.ignite.internal.processors.cache.GridCacheAdapter$2
org.apache.ignite.internal.processors.cache.GridCacheAdapter$26$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$28
@@ -536,7 +533,6 @@ org.apache.ignite.internal.processors.cache.GridCacheUtils$8
org.apache.ignite.internal.processors.cache.GridCacheUtils$9
org.apache.ignite.internal.processors.cache.GridCacheValueCollection
org.apache.ignite.internal.processors.cache.GridCacheValueCollection$1
-org.apache.ignite.internal.processors.cache.GridDeferredAckMessageSender$DeferredAckMessageBuffer
org.apache.ignite.internal.processors.cache.IgniteCacheProxy
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$1
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$10
@@ -549,13 +545,12 @@ org.apache.ignite.internal.processors.cache.IgniteCacheProxy$8
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$9
org.apache.ignite.internal.processors.cache.KeyCacheObject
org.apache.ignite.internal.processors.cache.KeyCacheObjectImpl
-org.apache.ignite.internal.processors.cache.QueryCursorImpl$State
org.apache.ignite.internal.processors.cache.affinity.GridCacheAffinityProxy
org.apache.ignite.internal.processors.cache.binary.BinaryMetadataKey
org.apache.ignite.internal.processors.cache.binary.CacheDefaultBinaryAffinityKeyMapper
org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$1
+org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$4
org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$5
-org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$6
org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$MetaDataEntryFilter
org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$MetaDataPredicate
org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$MetadataProcessor
@@ -635,7 +630,6 @@ org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocal$2
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocalAdapter
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocalAdapter$1
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocalAdapter$2
-org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxOnePhaseCommitAckRequest
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture$2
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture$3
@@ -676,24 +670,26 @@ org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomic
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$27
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$28
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$29
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$3
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$30
-org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$31
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$4
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$5
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$6
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$7
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$8
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$9
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$DeferredResponseBuffer
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicDeferredUpdateResponse
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse
-org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicAbstractUpdateFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFuture$2
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFuture$3
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$2
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$3
-org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$4
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicFullUpdateRequest
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse
org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCache
org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCache$2
@@ -764,7 +760,6 @@ org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$2
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$3
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$4
-org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$LockTimeoutObject$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$MiniFuture$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockRequest
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockResponse
@@ -777,7 +772,6 @@ org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticS
org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$2
org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$3
-org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$4
org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$MiniFuture$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFutureAdapter$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearPessimisticTxPrepareFuture$1
@@ -827,23 +821,22 @@ org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManag
org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$7
org.apache.ignite.internal.processors.cache.query.GridCacheQueryAdapter$1
org.apache.ignite.internal.processors.cache.query.GridCacheQueryAdapter$ScanQueryFallbackClosableIterator
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryDetailMetricsAdapter
org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter$1
org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter$2
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$10
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$1$1
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$1$2
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$11
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$12
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$13
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$14
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$15
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$16
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$17$1
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$3$1
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$3$2
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$15$1
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$2
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$3
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$4
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$5
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$6
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$7
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$8
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$9
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$CacheSqlIndexMetadata
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$CacheSqlMetadata
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$CachedResult$QueueIterator
@@ -903,8 +896,6 @@ org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$12
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$13
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$14
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$15
-org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$16
-org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$17
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$2
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$3
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$4
@@ -938,9 +929,9 @@ org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$Po
org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$PostLockClosure1$4
org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$PostLockClosure2
org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$PostMissClosure
+org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$2
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$3
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$4
-org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$5
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$CommitListener
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$CommittedVersion
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$NodeFailureTimeoutObject$1
@@ -1014,6 +1005,7 @@ org.apache.ignite.internal.processors.datastreamer.DataStreamerEntry
org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$1
org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$4
org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$5
+org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$6
org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$Buffer$1
org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$Buffer$2
org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$DataStreamerPda
@@ -1092,7 +1084,6 @@ org.apache.ignite.internal.processors.datastructures.GridCacheSetProxy
org.apache.ignite.internal.processors.datastructures.GridSetQueryPredicate
org.apache.ignite.internal.processors.dr.GridDrType
org.apache.ignite.internal.processors.dr.IgniteDrDataStreamerCacheUpdater
-org.apache.ignite.internal.processors.hadoop.HadoopDefaultJobInfo
org.apache.ignite.internal.processors.hadoop.HadoopFileBlock
org.apache.ignite.internal.processors.hadoop.HadoopInputSplit
org.apache.ignite.internal.processors.hadoop.HadoopJobId
@@ -1128,6 +1119,7 @@ org.apache.ignite.internal.processors.igfs.IgfsFragmentizerManager$IdentityHashS
org.apache.ignite.internal.processors.igfs.IgfsFragmentizerRequest
org.apache.ignite.internal.processors.igfs.IgfsFragmentizerResponse
org.apache.ignite.internal.processors.igfs.IgfsHandshakeResponse
+org.apache.ignite.internal.processors.igfs.IgfsImpl$12$1
org.apache.ignite.internal.processors.igfs.IgfsImpl$IgfsGlobalSpaceTask
org.apache.ignite.internal.processors.igfs.IgfsImpl$IgfsGlobalSpaceTask$1
org.apache.ignite.internal.processors.igfs.IgfsInputStreamDescriptor
@@ -1163,7 +1155,6 @@ org.apache.ignite.internal.processors.igfs.client.IgfsClientSummaryCallable
org.apache.ignite.internal.processors.igfs.client.IgfsClientUpdateCallable
org.apache.ignite.internal.processors.igfs.client.meta.IgfsClientMetaIdsForPathCallable
org.apache.ignite.internal.processors.igfs.client.meta.IgfsClientMetaInfoForPathCallable
-org.apache.ignite.internal.processors.igfs.client.meta.IgfsClientMetaUnlockCallable
org.apache.ignite.internal.processors.igfs.data.IgfsDataPutProcessor
org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryCreateProcessor
org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryListingAddProcessor
@@ -1181,8 +1172,6 @@ org.apache.ignite.internal.processors.igfs.meta.IgfsMetaUpdateTimesProcessor
org.apache.ignite.internal.processors.job.GridJobProcessor$5
org.apache.ignite.internal.processors.job.GridJobWorker$3
org.apache.ignite.internal.processors.jobmetrics.GridJobMetricsProcessor$SnapshotReducer
-org.apache.ignite.internal.processors.odbc.OdbcProtocolVersion
-org.apache.ignite.internal.processors.odbc.escape.OdbcEscapeType
org.apache.ignite.internal.processors.platform.PlatformAbstractConfigurationClosure
org.apache.ignite.internal.processors.platform.PlatformAbstractPredicate
org.apache.ignite.internal.processors.platform.PlatformEventFilterListener
@@ -1191,7 +1180,7 @@ org.apache.ignite.internal.processors.platform.PlatformExtendedException
org.apache.ignite.internal.processors.platform.PlatformJavaObjectFactoryProxy
org.apache.ignite.internal.processors.platform.PlatformNativeException
org.apache.ignite.internal.processors.platform.PlatformNoCallbackException
-org.apache.ignite.internal.processors.platform.cache.PlatformCache$5
+org.apache.ignite.internal.processors.platform.cache.PlatformCache$1
org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryFilter
org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryFilterImpl
org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryProcessor
@@ -1222,8 +1211,6 @@ org.apache.ignite.internal.processors.platform.cpp.PlatformCppConfigurationClosu
org.apache.ignite.internal.processors.platform.datastreamer.PlatformStreamReceiver
org.apache.ignite.internal.processors.platform.datastreamer.PlatformStreamReceiverImpl
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$1
-org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$10
-org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$11
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$2
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$3
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$4
@@ -1231,7 +1218,6 @@ org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$5
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$6
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$7
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$8
-org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$9
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetConfigurationClosure
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetService
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetServiceImpl
@@ -1246,24 +1232,19 @@ org.apache.ignite.internal.processors.platform.transactions.PlatformTransactions
org.apache.ignite.internal.processors.platform.utils.PlatformFutureUtils$1
org.apache.ignite.internal.processors.platform.utils.PlatformFutureUtils$FutureListenable$1
org.apache.ignite.internal.processors.platform.utils.PlatformFutureUtils$InternalFutureListenable$1
-org.apache.ignite.internal.processors.platform.websession.PlatformDotNetSessionLockProcessor
-org.apache.ignite.internal.processors.platform.websession.PlatformDotNetSessionSetAndUnlockProcessor
org.apache.ignite.internal.processors.query.GridQueryFieldMetadata
org.apache.ignite.internal.processors.query.GridQueryIndexType
+org.apache.ignite.internal.processors.query.GridQueryProcessor$2
org.apache.ignite.internal.processors.query.GridQueryProcessor$3
org.apache.ignite.internal.processors.query.GridQueryProcessor$4
org.apache.ignite.internal.processors.query.GridQueryProcessor$5
org.apache.ignite.internal.processors.query.GridQueryProcessor$6
-org.apache.ignite.internal.processors.query.GridQueryProcessor$7
-org.apache.ignite.internal.processors.query.GridQueryProcessor$8
org.apache.ignite.internal.processors.query.GridQueryProcessor$IndexType
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryCancelRequest
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryFailResponse
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryNextPageRequest
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryNextPageResponse
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryRequest
-org.apache.ignite.internal.processors.resource.GridResourceIoc$AnnotationSet
-org.apache.ignite.internal.processors.resource.GridResourceIoc$ResourceAnnotation
org.apache.ignite.internal.processors.rest.GridRestCommand
org.apache.ignite.internal.processors.rest.GridRestProcessor$2$1
org.apache.ignite.internal.processors.rest.GridRestProcessor$3
@@ -1351,7 +1332,7 @@ org.apache.ignite.internal.processors.service.ServiceDescriptorImpl
org.apache.ignite.internal.processors.task.GridTaskProcessor$1
org.apache.ignite.internal.processors.task.GridTaskThreadContextKey
org.apache.ignite.internal.processors.task.GridTaskWorker$3
-org.apache.ignite.internal.processors.task.GridTaskWorker$5
+org.apache.ignite.internal.processors.task.GridTaskWorker$4
org.apache.ignite.internal.processors.task.GridTaskWorker$State
org.apache.ignite.internal.transactions.IgniteTxHeuristicCheckedException
org.apache.ignite.internal.transactions.IgniteTxOptimisticCheckedException
@@ -1375,7 +1356,6 @@ org.apache.ignite.internal.util.GridBoundedConcurrentOrderedMap
org.apache.ignite.internal.util.GridBoundedConcurrentOrderedSet
org.apache.ignite.internal.util.GridBoundedLinkedHashMap
org.apache.ignite.internal.util.GridBoundedLinkedHashSet
-org.apache.ignite.internal.util.GridBoundedPriorityQueue
org.apache.ignite.internal.util.GridByteArrayList
org.apache.ignite.internal.util.GridCloseableIteratorAdapter
org.apache.ignite.internal.util.GridCloseableIteratorAdapterEx
@@ -1427,14 +1407,14 @@ org.apache.ignite.internal.util.IgniteUtils$11
org.apache.ignite.internal.util.IgniteUtils$12
org.apache.ignite.internal.util.IgniteUtils$13
org.apache.ignite.internal.util.IgniteUtils$14
-org.apache.ignite.internal.util.IgniteUtils$15
-org.apache.ignite.internal.util.IgniteUtils$17
+org.apache.ignite.internal.util.IgniteUtils$16
+org.apache.ignite.internal.util.IgniteUtils$2
+org.apache.ignite.internal.util.IgniteUtils$22
org.apache.ignite.internal.util.IgniteUtils$23
org.apache.ignite.internal.util.IgniteUtils$24
org.apache.ignite.internal.util.IgniteUtils$25
org.apache.ignite.internal.util.IgniteUtils$26
org.apache.ignite.internal.util.IgniteUtils$27
-org.apache.ignite.internal.util.IgniteUtils$28
org.apache.ignite.internal.util.IgniteUtils$3
org.apache.ignite.internal.util.IgniteUtils$4
org.apache.ignite.internal.util.IgniteUtils$5
@@ -1667,19 +1647,12 @@ org.apache.ignite.internal.visor.cache.VisorCachePartitionsTask
org.apache.ignite.internal.visor.cache.VisorCachePartitionsTask$VisorCachePartitionsJob
org.apache.ignite.internal.visor.cache.VisorCacheQueryConfiguration
org.apache.ignite.internal.visor.cache.VisorCacheQueryConfigurationV2
-org.apache.ignite.internal.visor.cache.VisorCacheQueryDetailMetrics
-org.apache.ignite.internal.visor.cache.VisorCacheQueryDetailMetricsCollectorTask
-org.apache.ignite.internal.visor.cache.VisorCacheQueryDetailMetricsCollectorTask$VisorCacheQueryDetailMetricsCollectorJob
org.apache.ignite.internal.visor.cache.VisorCacheQueryMetrics
org.apache.ignite.internal.visor.cache.VisorCacheRebalanceConfiguration
org.apache.ignite.internal.visor.cache.VisorCacheRebalanceTask
org.apache.ignite.internal.visor.cache.VisorCacheRebalanceTask$VisorCachesRebalanceJob
org.apache.ignite.internal.visor.cache.VisorCacheResetMetricsTask
org.apache.ignite.internal.visor.cache.VisorCacheResetMetricsTask$VisorCacheResetMetricsJob
-org.apache.ignite.internal.visor.cache.VisorCacheResetQueryDetailMetricsTask
-org.apache.ignite.internal.visor.cache.VisorCacheResetQueryDetailMetricsTask$VisorCacheResetQueryDetailMetricsJob
-org.apache.ignite.internal.visor.cache.VisorCacheResetQueryMetricsTask
-org.apache.ignite.internal.visor.cache.VisorCacheResetQueryMetricsTask$VisorCacheResetQueryMetricsJob
org.apache.ignite.internal.visor.cache.VisorCacheStartTask
org.apache.ignite.internal.visor.cache.VisorCacheStartTask$VisorCacheStartArg
org.apache.ignite.internal.visor.cache.VisorCacheStartTask$VisorCacheStartJob
@@ -1709,7 +1682,6 @@ org.apache.ignite.internal.visor.debug.VisorThreadLockInfo
org.apache.ignite.internal.visor.debug.VisorThreadMonitorInfo
org.apache.ignite.internal.visor.event.VisorGridDeploymentEvent
org.apache.ignite.internal.visor.event.VisorGridDiscoveryEvent
-org.apache.ignite.internal.visor.event.VisorGridDiscoveryEventV2
org.apache.ignite.internal.visor.event.VisorGridEvent
org.apache.ignite.internal.visor.event.VisorGridEventsLost
org.apache.ignite.internal.visor.event.VisorGridJobEvent
@@ -1797,7 +1769,6 @@ org.apache.ignite.internal.visor.util.VisorClusterGroupEmptyException
org.apache.ignite.internal.visor.util.VisorEventMapper
org.apache.ignite.internal.visor.util.VisorExceptionWrapper
org.apache.ignite.internal.visor.util.VisorTaskUtils$4
-org.apache.ignite.internal.visor.util.VisorTaskUtils$5
org.apache.ignite.internal.websession.WebSessionAttributeProcessor
org.apache.ignite.internal.websession.WebSessionEntity
org.apache.ignite.lang.IgniteBiClosure
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheAtomicSingleMessageCountSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheAtomicSingleMessageCountSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheAtomicSingleMessageCountSelfTest.java
new file mode 100644
index 0000000..8822115
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheAtomicSingleMessageCountSelfTest.java
@@ -0,0 +1,259 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+import javax.cache.processor.EntryProcessorException;
+import javax.cache.processor.MutableEntry;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cache.CacheEntryProcessor;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.managers.communication.GridIoMessage;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicFullUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFilterRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateInvokeRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
+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.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ * Tests single / transform messages being sent between nodes in ATOMIC mode.
+ */
+public class CacheAtomicSingleMessageCountSelfTest extends GridCommonAbstractTest {
+ /** VM ip finder for TCP discovery. */
+ private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** Starting grid index. */
+ private int idx;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+
+ discoSpi.setForceServerMode(true);
+ discoSpi.setIpFinder(ipFinder);
+
+ cfg.setDiscoverySpi(discoSpi);
+
+ CacheConfiguration cCfg = new CacheConfiguration();
+
+ cCfg.setCacheMode(PARTITIONED);
+ cCfg.setBackups(1);
+ cCfg.setWriteSynchronizationMode(FULL_SYNC);
+ cCfg.setAtomicWriteOrderMode(PRIMARY);
+
+ cfg.setCacheConfiguration(cCfg);
+
+ if (idx++ == 0)
+ cfg.setClientMode(true);
+
+ cfg.setCommunicationSpi(new TestCommunicationSpi());
+
+ return cfg;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSingleMessage() throws Exception {
+ startGrids(2);
+
+ try {
+ awaitPartitionMapExchange();
+
+ TestCommunicationSpi commSpi = (TestCommunicationSpi)grid(0).configuration().getCommunicationSpi();
+ commSpi.resetCount();
+
+ commSpi.registerMessage(GridNearAtomicFullUpdateRequest.class);
+ commSpi.registerMessage(GridNearAtomicSingleUpdateRequest.class);
+ commSpi.registerMessage(GridNearAtomicSingleUpdateInvokeRequest.class);
+ commSpi.registerMessage(GridNearAtomicSingleUpdateFilterRequest.class);
+
+ int putCnt = 15;
+
+ for (int i = 0; i < putCnt; i++)
+ jcache(0).put(i, i);
+
+ assertEquals(0, commSpi.messageCount(GridNearAtomicFullUpdateRequest.class));
+ assertEquals(putCnt, commSpi.messageCount(GridNearAtomicSingleUpdateRequest.class));
+ assertEquals(0, commSpi.messageCount(GridNearAtomicSingleUpdateInvokeRequest.class));
+ assertEquals(0, commSpi.messageCount(GridNearAtomicSingleUpdateFilterRequest.class));
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSingleTransformMessage() throws Exception {
+ startGrids(2);
+
+ int cacheId = ((IgniteKernal)grid(0)).internalCache(null).context().cacheId();
+
+ try {
+ awaitPartitionMapExchange();
+
+ TestCommunicationSpi commSpi = (TestCommunicationSpi)grid(0).configuration().getCommunicationSpi();
+
+ commSpi.resetCount();
+ commSpi.filterCacheId(cacheId);
+
+ commSpi.registerMessage(GridNearAtomicFullUpdateRequest.class);
+ commSpi.registerMessage(GridNearAtomicSingleUpdateRequest.class);
+ commSpi.registerMessage(GridNearAtomicSingleUpdateInvokeRequest.class);
+ commSpi.registerMessage(GridNearAtomicSingleUpdateFilterRequest.class);
+
+ int putCnt = 15;
+
+ for (int i = 0; i < putCnt; i++) {
+ jcache(0).invoke(i, new CacheEntryProcessor<Object, Object, Object>() {
+ @Override public Object process(MutableEntry<Object, Object> entry,
+ Object... objects) throws EntryProcessorException {
+ return 2;
+ }
+ });
+ }
+
+ assertEquals(0, commSpi.messageCount(GridNearAtomicFullUpdateRequest.class));
+ assertEquals(0, commSpi.messageCount(GridNearAtomicSingleUpdateRequest.class));
+ assertEquals(putCnt, commSpi.messageCount(GridNearAtomicSingleUpdateInvokeRequest.class));
+ assertEquals(0, commSpi.messageCount(GridNearAtomicSingleUpdateFilterRequest.class));
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSingleFilterMessage() throws Exception {
+ startGrids(2);
+
+ try {
+ awaitPartitionMapExchange();
+
+ TestCommunicationSpi commSpi = (TestCommunicationSpi)grid(0).configuration().getCommunicationSpi();
+
+ commSpi.resetCount();
+
+ commSpi.registerMessage(GridNearAtomicFullUpdateRequest.class);
+ commSpi.registerMessage(GridNearAtomicSingleUpdateRequest.class);
+ commSpi.registerMessage(GridNearAtomicSingleUpdateInvokeRequest.class);
+ commSpi.registerMessage(GridNearAtomicSingleUpdateFilterRequest.class);
+
+ int putCnt = 15;
+
+ for (int i = 0; i < putCnt; i++)
+ jcache(0).putIfAbsent(i, i);
+
+ assertEquals(0, commSpi.messageCount(GridNearAtomicFullUpdateRequest.class));
+ assertEquals(0, commSpi.messageCount(GridNearAtomicSingleUpdateRequest.class));
+ assertEquals(0, commSpi.messageCount(GridNearAtomicSingleUpdateInvokeRequest.class));
+ assertEquals(putCnt, commSpi.messageCount(GridNearAtomicSingleUpdateFilterRequest.class));
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * Test communication SPI.
+ */
+ private static class TestCommunicationSpi extends TcpCommunicationSpi {
+ /** Counters map. */
+ private Map<Class<?>, AtomicInteger> cntMap = new HashMap<>();
+
+ /** Cache id to filter */
+ private volatile Integer filterCacheId;
+
+ /** {@inheritDoc} */
+ @Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackC)
+ throws IgniteSpiException {
+
+ if (((GridIoMessage)msg).message() instanceof GridCacheMessage) {
+ int msgCacheId = ((GridCacheMessage)((GridIoMessage)msg).message()).cacheId();
+
+ if (filterCacheId == null || filterCacheId == msgCacheId) {
+ AtomicInteger cntr = cntMap.get(((GridIoMessage)msg).message().getClass());
+
+ if (cntr != null)
+ cntr.incrementAndGet();
+ }
+ }
+
+ super.sendMessage(node, msg, ackC);
+ }
+
+ /**
+ * Registers message for counting.
+ *
+ * @param cls Class to count.
+ */
+ void registerMessage(Class<?> cls) {
+ AtomicInteger cntr = cntMap.get(cls);
+
+ if (cntr == null)
+ cntMap.put(cls, new AtomicInteger());
+ }
+
+ /**
+ * @param cls Message type to get count.
+ * @return Number of messages of given class.
+ */
+ int messageCount(Class<?> cls) {
+ AtomicInteger cntr = cntMap.get(cls);
+
+ return cntr == null ? 0 : cntr.get();
+ }
+
+ /**
+ * Resets counter to zero.
+ */
+ void resetCount() {
+ cntMap.clear();
+ filterCacheId = null;
+ }
+
+ /**
+ * @param cacheId Cache ID.
+ */
+ void filterCacheId(int cacheId) {
+ filterCacheId = cacheId;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
index 0e17102..a6d612a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
@@ -28,7 +28,8 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.managers.communication.GridIoMessage;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicFullUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.spi.IgniteSpiException;
@@ -137,11 +138,13 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
TestCommunicationSpi commSpi = (TestCommunicationSpi)grid(0).configuration().getCommunicationSpi();
- commSpi.registerMessage(GridNearAtomicUpdateRequest.class);
+ commSpi.registerMessage(GridNearAtomicSingleUpdateRequest.class);
+ commSpi.registerMessage(GridNearAtomicFullUpdateRequest.class);
commSpi.registerMessage(GridDhtAtomicUpdateRequest.class);
int putCnt = 15;
+ int expNearSingleCnt = 0;
int expNearCnt = 0;
int expDhtCnt = 0;
@@ -160,20 +163,22 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
if (affinity.isPrimary(locNode, i))
expDhtCnt++;
else
- expNearCnt ++;
+ expNearSingleCnt++;
}
jcache(0).put(i, i);
}
- assertEquals(expNearCnt, commSpi.messageCount(GridNearAtomicUpdateRequest.class));
+ assertEquals(expNearCnt, commSpi.messageCount(GridNearAtomicFullUpdateRequest.class));
+ assertEquals(expNearSingleCnt, commSpi.messageCount(GridNearAtomicSingleUpdateRequest.class));
assertEquals(expDhtCnt, commSpi.messageCount(GridDhtAtomicUpdateRequest.class));
if (writeOrderMode == CLOCK) {
for (int i = 1; i < 4; i++) {
commSpi = (TestCommunicationSpi)grid(i).configuration().getCommunicationSpi();
- assertEquals(0, commSpi.messageCount(GridNearAtomicUpdateRequest.class));
+ assertEquals(0, commSpi.messageCount(GridNearAtomicSingleUpdateRequest.class));
+ assertEquals(0, commSpi.messageCount(GridNearAtomicFullUpdateRequest.class));
assertEquals(0, commSpi.messageCount(GridDhtAtomicUpdateRequest.class));
}
}
@@ -181,7 +186,8 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
for (int i = 1; i < 4; i++) {
commSpi = (TestCommunicationSpi)grid(i).configuration().getCommunicationSpi();
- assertEquals(0, commSpi.messageCount(GridNearAtomicUpdateRequest.class));
+ assertEquals(0, commSpi.messageCount(GridNearAtomicSingleUpdateRequest.class));
+ assertEquals(0, commSpi.messageCount(GridNearAtomicFullUpdateRequest.class));
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java
index cdb7907..281397a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java
@@ -18,7 +18,7 @@
package org.apache.ignite.internal.processors.cache;
import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
/**
* Stopped node when client operations are executing.
@@ -31,28 +31,28 @@ public class IgniteCacheAtomicStopBusySelfTest extends IgniteCacheAbstractStopBu
/** {@inheritDoc} */
@Override public void testPut() throws Exception {
- bannedMsg.set(GridNearAtomicUpdateRequest.class);
+ bannedMsg.set(GridNearAtomicSingleUpdateRequest.class);
super.testPut();
}
/** {@inheritDoc} */
@Override public void testPutBatch() throws Exception {
- bannedMsg.set(GridNearAtomicUpdateRequest.class);
+ bannedMsg.set(GridNearAtomicSingleUpdateRequest.class);
super.testPut();
}
/** {@inheritDoc} */
@Override public void testPutAsync() throws Exception {
- bannedMsg.set(GridNearAtomicUpdateRequest.class);
+ bannedMsg.set(GridNearAtomicSingleUpdateRequest.class);
super.testPut();
}
/** {@inheritDoc} */
@Override public void testRemove() throws Exception {
- bannedMsg.set(GridNearAtomicUpdateRequest.class);
+ bannedMsg.set(GridNearAtomicSingleUpdateRequest.class);
super.testPut();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingErrorTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingErrorTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingErrorTest.java
index f9608e1..fb2d0de 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingErrorTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingErrorTest.java
@@ -148,7 +148,7 @@ public class IgniteCacheP2pUnmarshallingErrorTest extends IgniteCacheAbstractTes
* @throws Exception If failed.
*/
public void testResponseMessageOnUnmarshallingFailed() throws Exception {
- // GridNearAtomicUpdateRequest unmarshalling failed test.
+ // GridNearAtomicFullUpdateRequest unmarshalling failed test.
readCnt.set(1);
failAtomicPut(++key);
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
index 49c3289..b4ef11a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
@@ -61,7 +61,7 @@ import org.apache.ignite.internal.processors.affinity.GridAffinityFunctionContex
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
import org.apache.ignite.internal.processors.cache.GridCacheAffinityManager;
import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicFullUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheEntry;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockRequest;
@@ -230,8 +230,8 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
TestCommunicationSpi spi = (TestCommunicationSpi)ignite2.configuration().getCommunicationSpi();
// Block messages requests for both nodes.
- spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite0.localNode().id());
- spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite1.localNode().id());
+ spi.blockMessages(GridNearAtomicFullUpdateRequest.class, ignite0.localNode().id());
+ spi.blockMessages(GridNearAtomicFullUpdateRequest.class, ignite1.localNode().id());
final IgniteCache<Integer, Integer> cache = ignite2.cache(null);
@@ -272,7 +272,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
map.put(i, i + 1);
// Block messages requests for single node.
- spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite0.localNode().id());
+ spi.blockMessages(GridNearAtomicFullUpdateRequest.class, ignite0.localNode().id());
putFut = GridTestUtils.runAsync(new Callable<Object>() {
@Override public Object call() throws Exception {
@@ -361,11 +361,11 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
TestCommunicationSpi spi = (TestCommunicationSpi)ignite3.configuration().getCommunicationSpi();
// Block messages requests for both nodes.
- spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite0.localNode().id());
- spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite1.localNode().id());
- spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite2.localNode().id());
+ spi.blockMessages(GridNearAtomicFullUpdateRequest.class, ignite0.localNode().id());
+ spi.blockMessages(GridNearAtomicFullUpdateRequest.class, ignite1.localNode().id());
+ spi.blockMessages(GridNearAtomicFullUpdateRequest.class, ignite2.localNode().id());
- spi.record(GridNearAtomicUpdateRequest.class);
+ spi.record(GridNearAtomicFullUpdateRequest.class);
final IgniteCache<Integer, Integer> cache = ignite3.cache(null);
@@ -402,7 +402,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
assertEquals(3, msgs.size());
for (Object msg : msgs)
- assertTrue(((GridNearAtomicUpdateRequest)msg).clientRequest());
+ assertTrue(((GridNearAtomicFullUpdateRequest)msg).clientRequest());
map.put(primaryKey(ignite0.cache(null)), 3);
map.put(primaryKey(ignite1.cache(null)), 4);
@@ -459,8 +459,8 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
TestCommunicationSpi spi = (TestCommunicationSpi)ignite2.configuration().getCommunicationSpi();
// Block messages requests for both nodes.
- spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite0.localNode().id());
- spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite1.localNode().id());
+ spi.blockMessages(GridNearAtomicFullUpdateRequest.class, ignite0.localNode().id());
+ spi.blockMessages(GridNearAtomicFullUpdateRequest.class, ignite1.localNode().id());
final IgniteCache<Integer, Integer> cache = ignite2.cache(null);
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
index 74d2d09..0899423 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
@@ -478,7 +478,7 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
Object origMsg = msg.message();
return delay &&
- ((origMsg instanceof GridNearAtomicUpdateRequest) || (origMsg instanceof GridDhtAtomicUpdateRequest));
+ ((origMsg instanceof GridNearAtomicAbstractUpdateRequest) || (origMsg instanceof GridDhtAtomicUpdateRequest));
}
}
}
\ No newline at end of file
[15/15] ignite git commit: IGNITE-4242 ExchangeManager should wait
for cache rebalancing in async way
Posted by av...@apache.org.
IGNITE-4242 ExchangeManager should wait for cache rebalancing in async way
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5536adfd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5536adfd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5536adfd
Branch: refs/heads/ignite-4242
Commit: 5536adfd8d816407bf1c3e0ffa7c7bb40dd2b858
Parents: 88f38ac
Author: Anton Vinogradov <av...@apache.org>
Authored: Mon Nov 21 16:42:15 2016 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Mon Nov 21 16:42:15 2016 +0300
----------------------------------------------------------------------
.../GridCachePartitionExchangeManager.java | 107 +++++--------------
.../processors/cache/GridCachePreloader.java | 10 +-
.../cache/GridCachePreloaderAdapter.java | 5 +-
.../dht/preloader/GridDhtPartitionDemander.java | 92 +++++++---------
.../dht/preloader/GridDhtPreloader.java | 7 +-
.../GridCacheRebalancingSyncSelfTest.java | 2 +
6 files changed, 81 insertions(+), 142 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5536adfd/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 4eb61e3..eb9f1f7 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
@@ -21,18 +21,19 @@ import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.NavigableMap;
-import java.util.Queue;
+import java.util.Set;
import java.util.TreeMap;
import java.util.UUID;
import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.LinkedBlockingDeque;
@@ -81,7 +82,6 @@ import org.apache.ignite.internal.util.typedef.CI1;
import org.apache.ignite.internal.util.typedef.CI2;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.CU;
-import org.apache.ignite.internal.util.typedef.internal.GPC;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.util.worker.GridWorker;
@@ -91,7 +91,6 @@ import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.thread.IgniteThread;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
-import org.jsr166.ConcurrentLinkedDeque8;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_PRELOAD_RESEND_TIMEOUT;
@@ -150,9 +149,6 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
/** */
private GridFutureAdapter<?> reconnectExchangeFut;
- /** */
- private final Queue<Callable<Boolean>> rebalanceQ = new ConcurrentLinkedDeque8<>();
-
/**
* Partition map futures.
* This set also contains already completed exchange futures to address race conditions when coordinator
@@ -1391,7 +1387,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
int cnt = 0;
- IgniteInternalFuture asyncStartFut = null;
+ Set<IgniteInternalFuture<Boolean>> rebFuts = null;
while (!isCancelled()) {
GridDhtPartitionsExchangeFuture exchFut = null;
@@ -1546,8 +1542,6 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
if (assignsMap != null) {
int size = assignsMap.size();
- rebalanceQ.clear();
-
NavigableMap<Integer, List<Integer>> orderMap = new TreeMap<>();
for (Map.Entry<Integer, GridDhtPreloaderAssignments> e : assignsMap.entrySet()) {
@@ -1557,95 +1551,52 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
int order = cacheCtx.config().getRebalanceOrder();
- if (orderMap.get(order) == null)
- orderMap.put(order, new ArrayList<Integer>(size));
+ orderMap.putIfAbsent(order, new ArrayList<>(size));
orderMap.get(order).add(cacheId);
}
- Callable<Boolean> marshR = null;
- List<Callable<Boolean>> orderedRs = new ArrayList<>(size);
+ Set<IgniteInternalFuture<Boolean>> prevRebFuts = rebFuts;
- //Ordered rebalance scheduling.
- for (Integer order : orderMap.keySet()) {
- for (Integer cacheId : orderMap.get(order)) {
- GridCacheContext<K, V> cacheCtx = cctx.cacheContext(cacheId);
+ rebFuts = new HashSet<>();
- List<String> waitList = new ArrayList<>(size - 1);
+ Runnable r = null;
- for (List<Integer> cIds : orderMap.headMap(order).values()) {
- for (Integer cId : cIds)
- waitList.add(cctx.cacheContext(cId).name());
- }
+ List<String> rebList = new LinkedList<>();
+
+ for (Integer order : orderMap.descendingKeySet()) {
+ for (Integer cacheId : orderMap.get(order)) {
+ GridCacheContext<K, V> cacheCtx = cctx.cacheContext(cacheId);
- Callable<Boolean> r = cacheCtx.preloader().addAssignments(assignsMap.get(cacheId),
+ Runnable cur = cacheCtx.preloader().addAssignments(assignsMap.get(cacheId),
forcePreload,
- waitList,
- cnt);
+ cnt,
+ r);
- if (r != null) {
- U.log(log, "Cache rebalancing scheduled: [cache=" + cacheCtx.name() +
- ", waitList=" + waitList.toString() + "]");
+ if (cur != null)
+ rebList.add(cacheCtx.name());
- if (cacheId == CU.cacheId(GridCacheUtils.MARSH_CACHE_NAME))
- marshR = r;
- else
- orderedRs.add(r);
- }
+ rebFuts.add(cacheCtx.preloader().rebalanceFuture());
+
+ r = cur;
}
}
- if (asyncStartFut != null)
- asyncStartFut.get(); // Wait for thread stop.
+ if (prevRebFuts != null) // Wait for previous rebalancing (it's finished or cancelled).
+ for (IgniteInternalFuture<Boolean> fut : prevRebFuts)
+ fut.get();
- rebalanceQ.addAll(orderedRs);
+ if (r != null) {
+ Collections.reverse(rebList);
+
+ U.log(log, "Cache rebalancing scheduled: [order=" + rebList + "]");
- if (marshR != null || !rebalanceQ.isEmpty()) {
if (futQ.isEmpty()) {
U.log(log, "Rebalancing required " +
"[top=" + exchFut.topologyVersion() + ", evt=" + exchFut.discoveryEvent().name() +
", node=" + exchFut.discoveryEvent().eventNode().id() + ']');
- if (marshR != null) {
- try {
- marshR.call(); //Marshaller cache rebalancing launches in sync way.
- }
- catch (Exception ex) {
- if (log.isDebugEnabled())
- log.debug("Failed to send initial demand request to node");
-
- continue;
- }
- }
-
- final GridFutureAdapter fut = new GridFutureAdapter();
-
- asyncStartFut = fut;
-
- cctx.kernalContext().closure().callLocalSafe(new GPC<Boolean>() {
- @Override public Boolean call() {
- try {
- while (true) {
- Callable<Boolean> r = rebalanceQ.poll();
-
- if (r == null)
- return false;
-
- if (!r.call())
- return false;
- }
- }
- catch (Exception ex) {
- if (log.isDebugEnabled())
- log.debug("Failed to send initial demand request to node");
-
- return false;
- }
- finally {
- fut.onDone();
- }
- }
- }, /*system pool*/true);
+ r.run(); // Starts rebalancing process.
}
else {
U.log(log, "Skipping rebalancing (obsolete exchange ID) " +
http://git-wip-us.apache.org/repos/asf/ignite/blob/5536adfd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java
index 1d1cfab..874af1e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java
@@ -84,14 +84,14 @@ public interface GridCachePreloader {
*
* @param assignments Assignments to add.
* @param forcePreload Force preload flag.
- * @param caches Rebalancing of these caches will be finished before this started.
* @param cnt Counter.
- * @return Rebalancing closure.
+ * @param next Runnable responsible for cache rebalancing start.
+ * @return Rebalancing runnable.
*/
- public Callable<Boolean> addAssignments(GridDhtPreloaderAssignments assignments,
+ public Runnable addAssignments(GridDhtPreloaderAssignments assignments,
boolean forcePreload,
- Collection<String> caches,
- int cnt);
+ int cnt,
+ Runnable next);
/**
* @param p Preload predicate.
http://git-wip-us.apache.org/repos/asf/ignite/blob/5536adfd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
index b15ebc5..656a960 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.cache;
import java.util.Collection;
import java.util.UUID;
-import java.util.concurrent.Callable;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cache.affinity.AffinityFunction;
@@ -166,8 +165,8 @@ public class GridCachePreloaderAdapter implements GridCachePreloader {
}
/** {@inheritDoc} */
- @Override public Callable<Boolean> addAssignments(GridDhtPreloaderAssignments assignments, boolean forcePreload,
- Collection<String> caches, int cnt) {
+ @Override public Runnable addAssignments(GridDhtPreloaderAssignments assignments, boolean forcePreload,
+ int cnt, Runnable next) {
return null;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5536adfd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
index 57d5229..999f99c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
@@ -28,7 +28,6 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.Callable;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
@@ -249,45 +248,16 @@ public class GridDhtPartitionDemander {
}
/**
- * @param name Cache name.
- * @param fut Future.
- * @throws IgniteCheckedException If failed.
- */
- private boolean waitForCacheRebalancing(String name, RebalanceFuture fut) throws IgniteCheckedException {
- if (log.isDebugEnabled())
- log.debug("Waiting for another cache to start rebalancing [cacheName=" + cctx.name() +
- ", waitCache=" + name + ']');
-
- RebalanceFuture wFut = (RebalanceFuture)cctx.kernalContext().cache().internalCache(name)
- .preloader().rebalanceFuture();
-
- if (!topologyChanged(fut) && wFut.updateSeq == fut.updateSeq) {
- if (!wFut.get()) {
- U.log(log, "Skipping waiting of " + name + " cache [top=" + fut.topologyVersion() +
- "] (cache rebalanced with missed partitions)");
-
- return false;
- }
-
- return true;
- }
- else {
- U.log(log, "Skipping waiting of " + name + " cache [top=" + fut.topologyVersion() +
- "] (topology already changed)");
-
- return false;
- }
- }
-
- /**
* @param assigns Assignments.
* @param force {@code True} if dummy reassign.
- * @param caches Rebalancing of these caches will be finished before this started.
* @param cnt Counter.
- * @return Rebalancing closure.
+ * @param next Runnable responsible for cache rebalancing start.
+ * @return Rebalancing runnable.
*/
- Callable<Boolean> addAssignments(final GridDhtPreloaderAssignments assigns, boolean force,
- final Collection<String> caches, int cnt) {
+ Runnable addAssignments(final GridDhtPreloaderAssignments assigns,
+ boolean force,
+ int cnt,
+ final Runnable next) {
if (log.isDebugEnabled())
log.debug("Adding partition assignments: " + assigns);
@@ -310,20 +280,31 @@ public class GridDhtPartitionDemander {
rebalanceFut = fut;
- if (assigns.isEmpty()) {
- fut.doneIfEmpty(assigns.cancelled());
+ if (next != null)
+ rebalanceFut.listen(new CI1<IgniteInternalFuture<Boolean>>() {
+ @Override public void apply(IgniteInternalFuture<Boolean> fut) {
+ next.run();
+ }
+ });
- return null;
- }
+ return new Runnable() {
+ @Override public void run() {
+ try {
+ requestPartitions(fut, assigns);
+ }
+ catch (IgniteCheckedException e) {
+ log.error("Failed to send initial demand request to node.", e);
- return new Callable<Boolean>() {
- @Override public Boolean call() throws Exception {
- for (String c : caches) {
- if (!waitForCacheRebalancing(c, fut))
- return false;
+ fut.cancel();
}
+ catch (Throwable th) {
+ log.error("Runtime error caught during initial demand request sending.", th);
+
+ fut.cancel();
- return requestPartitions(fut, assigns);
+ if (th instanceof Error)
+ throw th;
+ }
}
};
}
@@ -361,14 +342,23 @@ public class GridDhtPartitionDemander {
* @throws IgniteCheckedException If failed.
* @return Partitions were requested.
*/
- private boolean requestPartitions(
+ private void requestPartitions(
RebalanceFuture fut,
GridDhtPreloaderAssignments assigns
) throws IgniteCheckedException {
- for (Map.Entry<ClusterNode, GridDhtPartitionDemandMessage> e : assigns.entrySet()) {
- if (topologyChanged(fut))
- return false;
+ if (assigns.isEmpty()) {
+ fut.doneIfEmpty(assigns.cancelled());
+
+ return;
+ }
+
+ if (topologyChanged(fut)) {
+ fut.cancel();
+ return;
+ }
+
+ for (Map.Entry<ClusterNode, GridDhtPartitionDemandMessage> e : assigns.entrySet()) {
final ClusterNode node = e.getKey();
GridDhtPartitionDemandMessage d = e.getValue();
@@ -446,8 +436,6 @@ public class GridDhtPartitionDemander {
worker.run(node, d);
}
}
-
- return true;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/5536adfd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
index a9245f0..663ad8d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
@@ -22,7 +22,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
-import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReadWriteLock;
@@ -412,9 +411,9 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
}
/** {@inheritDoc} */
- @Override public Callable<Boolean> addAssignments(GridDhtPreloaderAssignments assignments,
- boolean forcePreload, Collection<String> caches, int cnt) {
- return demander.addAssignments(assignments, forcePreload, caches, cnt);
+ @Override public Runnable addAssignments(GridDhtPreloaderAssignments assignments,
+ boolean forcePreload, int cnt, Runnable next) {
+ return demander.addAssignments(assignments, forcePreload, cnt, next);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/5536adfd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java
index 5716d59..0edb0f5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java
@@ -501,6 +501,8 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest {
record = true;
+ log.info("Checking GridDhtPartitions*Message absent (it will take 30 SECONDS) ... ");
+
U.sleep(30_000);
record = false;
[08/15] ignite git commit: Merged ignite-1.7.3 into ignite-1.7.4.
Posted by av...@apache.org.
Merged ignite-1.7.3 into ignite-1.7.4.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3eacc0b5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3eacc0b5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3eacc0b5
Branch: refs/heads/ignite-4242
Commit: 3eacc0b59c27be6b4b3aaa09f84b867ba42b449f
Parents: e39888a f8aa957
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Mon Nov 21 17:28:56 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Mon Nov 21 17:28:56 2016 +0700
----------------------------------------------------------------------
.../hadoop/fs/v1/IgniteHadoopFileSystem.java | 2 +-
.../hadoop/fs/v2/IgniteHadoopFileSystem.java | 2 +-
.../hadoop/delegate/HadoopDelegateUtils.java | 4 ++--
...doopIgfsSecondaryFileSystemDelegateImpl.java | 3 +--
...KerberosHadoopFileSystemFactorySelfTest.java | 3 ++-
.../igfs/HadoopFIleSystemFactorySelfTest.java | 2 +-
...adoopIgfsSecondaryFileSystemTestAdapter.java | 3 +--
...oopSecondaryFileSystemConfigurationTest.java | 4 ++--
.../h2/twostep/GridReduceQueryExecutor.java | 25 ++++++++++++++------
pom.xml | 1 +
10 files changed, 30 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
[06/15] ignite git commit: IGNITE-4216 .NET: Fix
PlatformAffinityFunction to inject resource into baseFunc
Posted by av...@apache.org.
IGNITE-4216 .NET: Fix PlatformAffinityFunction to inject resource into baseFunc
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/85a4b966
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/85a4b966
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/85a4b966
Branch: refs/heads/ignite-4242
Commit: 85a4b966fdfb7018d1c91b73df1659082128f786
Parents: d69e26d
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Nov 14 13:38:33 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Nov 14 13:39:56 2016 +0300
----------------------------------------------------------------------
.../affinity/PlatformAffinityFunction.java | 7 ++++-
.../dotnet/PlatformDotNetAffinityFunction.java | 9 ++----
.../Cache/Affinity/AffinityFunctionTest.cs | 33 ++++++++++++++++++--
.../Apache.Ignite.Core.Tests/TestUtils.cs | 3 +-
4 files changed, 41 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/85a4b966/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityFunction.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityFunction.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityFunction.java
index 1e844e7..8076a19 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityFunction.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityFunction.java
@@ -18,10 +18,12 @@
package org.apache.ignite.internal.processors.platform.cache.affinity;
import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.cache.affinity.AffinityFunction;
import org.apache.ignite.cache.affinity.AffinityFunctionContext;
import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.binary.BinaryRawWriterEx;
import org.apache.ignite.internal.processors.platform.PlatformContext;
import org.apache.ignite.internal.processors.platform.memory.PlatformMemory;
@@ -298,7 +300,10 @@ public class PlatformAffinityFunction implements AffinityFunction, Externalizabl
*/
@SuppressWarnings("unused")
@IgniteInstanceResource
- public void setIgnite(Ignite ignite) {
+ public void setIgnite(Ignite ignite) throws IgniteCheckedException {
this.ignite = ignite;
+
+ if (baseFunc != null && ignite != null)
+ ((IgniteEx)ignite).context().resource().injectGeneric(baseFunc);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/85a4b966/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetAffinityFunction.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetAffinityFunction.java b/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetAffinityFunction.java
index 483fd22..f9f457d 100644
--- a/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetAffinityFunction.java
+++ b/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetAffinityFunction.java
@@ -18,17 +18,12 @@
package org.apache.ignite.platform.dotnet;
import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.binary.BinaryRawWriter;
import org.apache.ignite.cache.affinity.AffinityFunction;
import org.apache.ignite.cache.affinity.AffinityFunctionContext;
import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.internal.binary.BinaryRawWriterEx;
-import org.apache.ignite.internal.processors.platform.PlatformContext;
import org.apache.ignite.internal.processors.platform.cache.affinity.PlatformAffinityFunction;
-import org.apache.ignite.internal.processors.platform.memory.PlatformMemory;
-import org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream;
-import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
import org.apache.ignite.lifecycle.LifecycleAware;
import org.apache.ignite.resources.IgniteInstanceResource;
@@ -178,7 +173,7 @@ public class PlatformDotNetAffinityFunction implements AffinityFunction, Externa
*/
@SuppressWarnings("unused")
@IgniteInstanceResource
- private void setIgnite(Ignite ignite) {
+ private void setIgnite(Ignite ignite) throws IgniteCheckedException {
assert func != null;
func.setIgnite(ignite);
http://git-wip-us.apache.org/repos/asf/ignite/blob/85a4b966/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionTest.cs
index f38cb3e..d4b6680 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionTest.cs
@@ -100,8 +100,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity
public void FixtureTearDown()
{
// Check that affinity handles are present
- TestUtils.AssertHandleRegistryHasItems(_ignite, _ignite.GetCacheNames().Count - 1, 0);
- TestUtils.AssertHandleRegistryHasItems(_ignite2, _ignite.GetCacheNames().Count - 1, 0);
+ TestUtils.AssertHandleRegistryHasItems(_ignite, _ignite.GetCacheNames().Count - 3, 0);
+ TestUtils.AssertHandleRegistryHasItems(_ignite2, _ignite.GetCacheNames().Count - 3, 0);
// Destroy all caches
_ignite.GetCacheNames().ToList().ForEach(_ignite.DestroyCache);
@@ -165,6 +165,34 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity
}
/// <summary>
+ /// Tests the dynamic cache with predefined functions.
+ /// </summary>
+ [Test]
+ public void TestDynamicCachePredefined()
+ {
+ var caches = new[]
+ {
+ new CacheConfiguration("rendezvousPredefined")
+ {
+ AffinityFunction = new RendezvousAffinityFunction {Partitions = 1234}
+ },
+ new CacheConfiguration("fairPredefined")
+ {
+ AffinityFunction = new FairAffinityFunction {Partitions = 1234}
+ },
+ }.Select(_ignite.CreateCache<int, int>);
+
+ foreach (var cache in caches)
+ {
+ Assert.AreEqual(1234, cache.GetConfiguration().AffinityFunction.Partitions);
+
+ cache[1] = 2;
+
+ Assert.AreEqual(2, cache[1]);
+ }
+ }
+
+ /// <summary>
/// Verifies the cache affinity.
/// </summary>
private static void VerifyCacheAffinity(ICache<int, int> cache)
@@ -231,6 +259,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity
});
var ex = Assert.Throws<CacheException>(() => cache.Put(1, 2));
+ Assert.IsNotNull(ex.InnerException);
Assert.AreEqual("User error", ex.InnerException.Message);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/85a4b966/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
index 88a2b52..5073b1a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
@@ -284,7 +284,8 @@ namespace Apache.Ignite.Core.Tests
var items = handleRegistry.GetItems().Where(x => !(x.Value is LifecycleBeanHolder)).ToList();
if (items.Any())
- Assert.Fail("HandleRegistry is not empty in grid '{0}':\n '{1}'", grid.Name,
+ Assert.Fail("HandleRegistry is not empty in grid '{0}' (expected {1}, actual {2}):\n '{3}'",
+ grid.Name, expectedCount, handleRegistry.Count,
items.Select(x => x.ToString()).Aggregate((x, y) => x + "\n" + y));
}
[12/15] ignite git commit: IGNITE-2523 "single put" NEAR update
request
Posted by av...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
new file mode 100644
index 0000000..e2314f8
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
@@ -0,0 +1,1031 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.io.Externalizable;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+import javax.cache.expiry.ExpiryPolicy;
+import javax.cache.processor.EntryProcessor;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.GridDirectCollection;
+import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheOperation;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.distributed.IgniteExternalizableExpiryPolicy;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.GridLongList;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.internal.processors.cache.GridCacheOperation.DELETE;
+import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRANSFORM;
+import static org.apache.ignite.internal.processors.cache.GridCacheOperation.UPDATE;
+
+/**
+ * Lite DHT cache update request sent from near node to primary node.
+ */
+public class GridNearAtomicFullUpdateRequest extends GridNearAtomicAbstractUpdateRequest {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Target node ID. */
+ @GridDirectTransient
+ private UUID nodeId;
+
+ /** Future version. */
+ private GridCacheVersion futVer;
+
+ /** Fast map flag. */
+ private boolean fastMap;
+
+ /** Update version. Set to non-null if fastMap is {@code true}. */
+ private GridCacheVersion updateVer;
+
+ /** Topology version. */
+ private AffinityTopologyVersion topVer;
+
+ /** Topology locked flag. Set if atomic update is performed inside TX or explicit lock. */
+ private boolean topLocked;
+
+ /** Write synchronization mode. */
+ private CacheWriteSynchronizationMode syncMode;
+
+ /** Update operation. */
+ private GridCacheOperation op;
+
+ /** Keys to update. */
+ @GridToStringInclude
+ @GridDirectCollection(KeyCacheObject.class)
+ private List<KeyCacheObject> keys;
+
+ /** Values to update. */
+ @GridDirectCollection(CacheObject.class)
+ private List<CacheObject> vals;
+
+ /** Partitions of keys. */
+ @GridDirectCollection(int.class)
+ private List<Integer> partIds;
+
+ /** Entry processors. */
+ @GridDirectTransient
+ private List<EntryProcessor<Object, Object, Object>> entryProcessors;
+
+ /** Entry processors bytes. */
+ @GridDirectCollection(byte[].class)
+ private List<byte[]> entryProcessorsBytes;
+
+ /** Optional arguments for entry processor. */
+ @GridDirectTransient
+ private Object[] invokeArgs;
+
+ /** Entry processor arguments bytes. */
+ private byte[][] invokeArgsBytes;
+
+ /** Conflict versions. */
+ @GridDirectCollection(GridCacheVersion.class)
+ private List<GridCacheVersion> conflictVers;
+
+ /** Conflict TTLs. */
+ private GridLongList conflictTtls;
+
+ /** Conflict expire times. */
+ private GridLongList conflictExpireTimes;
+
+ /** Return value flag. */
+ private boolean retval;
+
+ /** Expiry policy. */
+ @GridDirectTransient
+ private ExpiryPolicy expiryPlc;
+
+ /** Expiry policy bytes. */
+ private byte[] expiryPlcBytes;
+
+ /** Filter. */
+ private CacheEntryPredicate[] filter;
+
+ /** Flag indicating whether request contains primary keys. */
+ private boolean hasPrimary;
+
+ /** Subject ID. */
+ private UUID subjId;
+
+ /** Task name hash. */
+ private int taskNameHash;
+
+ /** Skip write-through to a persistent storage. */
+ private boolean skipStore;
+
+ /** */
+ private boolean clientReq;
+
+ /** Keep binary flag. */
+ private boolean keepBinary;
+
+ /** */
+ @GridDirectTransient
+ private GridNearAtomicUpdateResponse res;
+
+ /** Maximum possible size of inner collections. */
+ @GridDirectTransient
+ private int initSize;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridNearAtomicFullUpdateRequest() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param cacheId Cache ID.
+ * @param nodeId Node ID.
+ * @param futVer Future version.
+ * @param fastMap Fast map scheme flag.
+ * @param updateVer Update version set if fast map is performed.
+ * @param topVer Topology version.
+ * @param topLocked Topology locked flag.
+ * @param syncMode Synchronization mode.
+ * @param op Cache update operation.
+ * @param retval Return value required flag.
+ * @param expiryPlc Expiry policy.
+ * @param invokeArgs Optional arguments for entry processor.
+ * @param filter Optional filter for atomic check.
+ * @param subjId Subject ID.
+ * @param taskNameHash Task name hash code.
+ * @param skipStore Skip write-through to a persistent storage.
+ * @param keepBinary Keep binary flag.
+ * @param clientReq Client node request flag.
+ * @param addDepInfo Deployment info flag.
+ * @param maxEntryCnt Maximum entries count.
+ */
+ GridNearAtomicFullUpdateRequest(
+ int cacheId,
+ UUID nodeId,
+ GridCacheVersion futVer,
+ boolean fastMap,
+ @Nullable GridCacheVersion updateVer,
+ @NotNull AffinityTopologyVersion topVer,
+ boolean topLocked,
+ CacheWriteSynchronizationMode syncMode,
+ GridCacheOperation op,
+ boolean retval,
+ @Nullable ExpiryPolicy expiryPlc,
+ @Nullable Object[] invokeArgs,
+ @Nullable CacheEntryPredicate[] filter,
+ @Nullable UUID subjId,
+ int taskNameHash,
+ boolean skipStore,
+ boolean keepBinary,
+ boolean clientReq,
+ boolean addDepInfo,
+ int maxEntryCnt
+ ) {
+ assert futVer != null;
+
+ this.cacheId = cacheId;
+ this.nodeId = nodeId;
+ this.futVer = futVer;
+ this.fastMap = fastMap;
+ this.updateVer = updateVer;
+
+ this.topVer = topVer;
+ this.topLocked = topLocked;
+ this.syncMode = syncMode;
+ this.op = op;
+ this.retval = retval;
+ this.expiryPlc = expiryPlc;
+ this.invokeArgs = invokeArgs;
+ this.filter = filter;
+ this.subjId = subjId;
+ this.taskNameHash = taskNameHash;
+ this.skipStore = skipStore;
+ this.keepBinary = keepBinary;
+ this.clientReq = clientReq;
+ this.addDepInfo = addDepInfo;
+
+ // By default ArrayList expands to array of 10 elements on first add. We cannot guess how many entries
+ // will be added to request because of unknown affinity distribution. However, we DO KNOW how many keys
+ // participate in request. As such, we know upper bound of all collections in request. If this bound is lower
+ // than 10, we use it.
+ initSize = Math.min(maxEntryCnt, 10);
+
+ keys = new ArrayList<>(initSize);
+
+ partIds = new ArrayList<>(initSize);
+ }
+
+ /** {@inheritDoc} */
+ @Override public int lookupIndex() {
+ return CACHE_MSG_IDX;
+ }
+
+ /** {@inheritDoc} */
+ @Override public UUID nodeId() {
+ return nodeId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void nodeId(UUID nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public UUID subjectId() {
+ return subjId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int taskNameHash() {
+ return taskNameHash;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridCacheVersion futureVersion() {
+ return futVer;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridCacheVersion updateVersion() {
+ return updateVer;
+ }
+
+ /** {@inheritDoc} */
+ @Override public AffinityTopologyVersion topologyVersion() {
+ return topVer;
+ }
+
+ /** {@inheritDoc} */
+ @Override public CacheWriteSynchronizationMode writeSynchronizationMode() {
+ return syncMode;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridCacheOperation operation() {
+ return op;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean onResponse(GridNearAtomicUpdateResponse res) {
+ if (this.res == null) {
+ this.res = res;
+
+ return true;
+ }
+
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override @Nullable public GridNearAtomicUpdateResponse response() {
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean addDeploymentInfo() {
+ return addDepInfo;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+ return ctx.atomicMessageLogger();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void addUpdateEntry(KeyCacheObject key,
+ @Nullable Object val,
+ long conflictTtl,
+ long conflictExpireTime,
+ @Nullable GridCacheVersion conflictVer,
+ boolean primary) {
+ EntryProcessor<Object, Object, Object> entryProcessor = null;
+
+ if (op == TRANSFORM) {
+ assert val instanceof EntryProcessor : val;
+
+ entryProcessor = (EntryProcessor<Object, Object, Object>)val;
+ }
+
+ assert val != null || op == DELETE;
+
+ keys.add(key);
+ partIds.add(key.partition());
+
+ if (entryProcessor != null) {
+ if (entryProcessors == null)
+ entryProcessors = new ArrayList<>(initSize);
+
+ entryProcessors.add(entryProcessor);
+ }
+ else if (val != null) {
+ assert val instanceof CacheObject : val;
+
+ if (vals == null)
+ vals = new ArrayList<>(initSize);
+
+ vals.add((CacheObject)val);
+ }
+
+ hasPrimary |= primary;
+
+ // In case there is no conflict, do not create the list.
+ if (conflictVer != null) {
+ if (conflictVers == null) {
+ conflictVers = new ArrayList<>(initSize);
+
+ for (int i = 0; i < keys.size() - 1; i++)
+ conflictVers.add(null);
+ }
+
+ conflictVers.add(conflictVer);
+ }
+ else if (conflictVers != null)
+ conflictVers.add(null);
+
+ if (conflictTtl >= 0) {
+ if (conflictTtls == null) {
+ conflictTtls = new GridLongList(keys.size());
+
+ for (int i = 0; i < keys.size() - 1; i++)
+ conflictTtls.add(CU.TTL_NOT_CHANGED);
+ }
+
+ conflictTtls.add(conflictTtl);
+ }
+
+ if (conflictExpireTime >= 0) {
+ if (conflictExpireTimes == null) {
+ conflictExpireTimes = new GridLongList(keys.size());
+
+ for (int i = 0; i < keys.size() - 1; i++)
+ conflictExpireTimes.add(CU.EXPIRE_TIME_CALCULATE);
+ }
+
+ conflictExpireTimes.add(conflictExpireTime);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public List<KeyCacheObject> keys() {
+ return keys;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int size() {
+ return keys != null ? keys.size() : 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override public KeyCacheObject key(int idx) {
+ return keys.get(idx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public List<?> values() {
+ return op == TRANSFORM ? entryProcessors : vals;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override public CacheObject value(int idx) {
+ assert op == UPDATE : op;
+
+ return vals.get(idx);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
+ assert op == TRANSFORM : op;
+
+ return entryProcessors.get(idx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public CacheObject writeValue(int idx) {
+ if (vals != null)
+ return vals.get(idx);
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override @Nullable public List<GridCacheVersion> conflictVersions() {
+ return conflictVers;
+ }
+
+ /** {@inheritDoc} */
+ @Override @Nullable public GridCacheVersion conflictVersion(int idx) {
+ if (conflictVers != null) {
+ assert idx >= 0 && idx < conflictVers.size();
+
+ return conflictVers.get(idx);
+ }
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long conflictTtl(int idx) {
+ if (conflictTtls != null) {
+ assert idx >= 0 && idx < conflictTtls.size();
+
+ return conflictTtls.get(idx);
+ }
+
+ return CU.TTL_NOT_CHANGED;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long conflictExpireTime(int idx) {
+ if (conflictExpireTimes != null) {
+ assert idx >= 0 && idx < conflictExpireTimes.size();
+
+ return conflictExpireTimes.get(idx);
+ }
+
+ return CU.EXPIRE_TIME_CALCULATE;
+ }
+
+ /** {@inheritDoc} */
+ @Override @Nullable public Object[] invokeArguments() {
+ return invokeArgs;
+ }
+
+ /**
+ * @return Flag indicating whether this is fast-map udpate.
+ */
+ @Override public boolean fastMap() {
+ return fastMap;
+ }
+
+ /**
+ * @return Topology locked flag.
+ */
+ @Override public boolean topologyLocked() {
+ return topLocked;
+ }
+
+ /**
+ * @return {@code True} if request sent from client node.
+ */
+ @Override public boolean clientRequest() {
+ return clientReq;
+ }
+
+ /**
+ * @return Return value flag.
+ */
+ @Override public boolean returnValue() {
+ return retval;
+ }
+
+ /**
+ * @return Skip write-through to a persistent storage.
+ */
+ @Override public boolean skipStore() {
+ return skipStore;
+ }
+
+ /**
+ * @return Keep binary flag.
+ */
+ @Override public boolean keepBinary() {
+ return keepBinary;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean hasPrimary() {
+ return hasPrimary;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public CacheEntryPredicate[] filter() {
+ return filter;
+ }
+
+ /** {@inheritDoc} */
+ @Override public ExpiryPolicy expiry() {
+ return expiryPlc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+ prepareMarshalCacheObjects(keys, cctx);
+
+ if (filter != null) {
+ boolean hasFilter = false;
+
+ for (CacheEntryPredicate p : filter) {
+ if (p != null) {
+ hasFilter = true;
+
+ p.prepareMarshal(cctx);
+ }
+ }
+
+ if (!hasFilter)
+ filter = null;
+ }
+
+ if (expiryPlc != null && expiryPlcBytes == null)
+ expiryPlcBytes = CU.marshal(cctx, new IgniteExternalizableExpiryPolicy(expiryPlc));
+
+ if (op == TRANSFORM) {
+ // force addition of deployment info for entry processors if P2P is enabled globally.
+ if (!addDepInfo && ctx.deploymentEnabled())
+ addDepInfo = true;
+
+ if (entryProcessorsBytes == null)
+ entryProcessorsBytes = marshalCollection(entryProcessors, cctx);
+
+ if (invokeArgsBytes == null)
+ invokeArgsBytes = marshalInvokeArguments(invokeArgs, cctx);
+ }
+ else
+ prepareMarshalCacheObjects(vals, cctx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+ finishUnmarshalCacheObjects(keys, cctx, ldr);
+
+ if (op == TRANSFORM) {
+ if (entryProcessors == null)
+ entryProcessors = unmarshalCollection(entryProcessorsBytes, ctx, ldr);
+
+ if (invokeArgs == null)
+ invokeArgs = unmarshalInvokeArguments(invokeArgsBytes, ctx, ldr);
+ }
+ else
+ finishUnmarshalCacheObjects(vals, cctx, ldr);
+
+ if (filter != null) {
+ for (CacheEntryPredicate p : filter) {
+ if (p != null)
+ p.finishUnmarshal(cctx, ldr);
+ }
+ }
+
+ if (expiryPlcBytes != null && expiryPlc == null)
+ expiryPlc = U.unmarshal(ctx, expiryPlcBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
+
+ if (partIds != null && !partIds.isEmpty()) {
+ assert partIds.size() == keys.size();
+
+ for (int i = 0; i < keys.size(); i++)
+ keys.get(i).partition(partIds.get(i));
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+ writer.setBuffer(buf);
+
+ if (!super.writeTo(buf, writer))
+ return false;
+
+ if (!writer.isHeaderWritten()) {
+ if (!writer.writeHeader(directType(), fieldsCount()))
+ return false;
+
+ writer.onHeaderWritten();
+ }
+
+ switch (writer.state()) {
+ case 3:
+ if (!writer.writeBoolean("clientReq", clientReq))
+ return false;
+
+ writer.incrementState();
+
+ case 4:
+ if (!writer.writeMessage("conflictExpireTimes", conflictExpireTimes))
+ return false;
+
+ writer.incrementState();
+
+ case 5:
+ if (!writer.writeMessage("conflictTtls", conflictTtls))
+ return false;
+
+ writer.incrementState();
+
+ case 6:
+ if (!writer.writeCollection("conflictVers", conflictVers, MessageCollectionItemType.MSG))
+ return false;
+
+ writer.incrementState();
+
+ case 7:
+ if (!writer.writeCollection("entryProcessorsBytes", entryProcessorsBytes, MessageCollectionItemType.BYTE_ARR))
+ return false;
+
+ writer.incrementState();
+
+ case 8:
+ if (!writer.writeByteArray("expiryPlcBytes", expiryPlcBytes))
+ return false;
+
+ writer.incrementState();
+
+ case 9:
+ if (!writer.writeBoolean("fastMap", fastMap))
+ return false;
+
+ writer.incrementState();
+
+ case 10:
+ if (!writer.writeObjectArray("filter", filter, MessageCollectionItemType.MSG))
+ return false;
+
+ writer.incrementState();
+
+ case 11:
+ if (!writer.writeMessage("futVer", futVer))
+ return false;
+
+ writer.incrementState();
+
+ case 12:
+ if (!writer.writeBoolean("hasPrimary", hasPrimary))
+ return false;
+
+ writer.incrementState();
+
+ case 13:
+ if (!writer.writeObjectArray("invokeArgsBytes", invokeArgsBytes, MessageCollectionItemType.BYTE_ARR))
+ return false;
+
+ writer.incrementState();
+
+ case 14:
+ if (!writer.writeBoolean("keepBinary", keepBinary))
+ return false;
+
+ writer.incrementState();
+
+ case 15:
+ if (!writer.writeCollection("keys", keys, MessageCollectionItemType.MSG))
+ return false;
+
+ writer.incrementState();
+
+ case 16:
+ if (!writer.writeByte("op", op != null ? (byte)op.ordinal() : -1))
+ return false;
+
+ writer.incrementState();
+
+ case 17:
+ if (!writer.writeCollection("partIds", partIds, MessageCollectionItemType.INT))
+ return false;
+
+ writer.incrementState();
+
+ case 18:
+ if (!writer.writeBoolean("retval", retval))
+ return false;
+
+ writer.incrementState();
+
+ case 19:
+ if (!writer.writeBoolean("skipStore", skipStore))
+ return false;
+
+ writer.incrementState();
+
+ case 20:
+ if (!writer.writeUuid("subjId", subjId))
+ return false;
+
+ writer.incrementState();
+
+ case 21:
+ if (!writer.writeByte("syncMode", syncMode != null ? (byte)syncMode.ordinal() : -1))
+ return false;
+
+ writer.incrementState();
+
+ case 22:
+ if (!writer.writeInt("taskNameHash", taskNameHash))
+ return false;
+
+ writer.incrementState();
+
+ case 23:
+ if (!writer.writeBoolean("topLocked", topLocked))
+ return false;
+
+ writer.incrementState();
+
+ case 24:
+ if (!writer.writeMessage("topVer", topVer))
+ return false;
+
+ writer.incrementState();
+
+ case 25:
+ if (!writer.writeMessage("updateVer", updateVer))
+ return false;
+
+ writer.incrementState();
+
+ case 26:
+ if (!writer.writeCollection("vals", vals, MessageCollectionItemType.MSG))
+ return false;
+
+ writer.incrementState();
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+ reader.setBuffer(buf);
+
+ if (!reader.beforeMessageRead())
+ return false;
+
+ if (!super.readFrom(buf, reader))
+ return false;
+
+ switch (reader.state()) {
+ case 3:
+ clientReq = reader.readBoolean("clientReq");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 4:
+ conflictExpireTimes = reader.readMessage("conflictExpireTimes");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 5:
+ conflictTtls = reader.readMessage("conflictTtls");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 6:
+ conflictVers = reader.readCollection("conflictVers", MessageCollectionItemType.MSG);
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 7:
+ entryProcessorsBytes = reader.readCollection("entryProcessorsBytes", MessageCollectionItemType.BYTE_ARR);
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 8:
+ expiryPlcBytes = reader.readByteArray("expiryPlcBytes");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 9:
+ fastMap = reader.readBoolean("fastMap");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 10:
+ filter = reader.readObjectArray("filter", MessageCollectionItemType.MSG, CacheEntryPredicate.class);
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 11:
+ futVer = reader.readMessage("futVer");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 12:
+ hasPrimary = reader.readBoolean("hasPrimary");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 13:
+ invokeArgsBytes = reader.readObjectArray("invokeArgsBytes", MessageCollectionItemType.BYTE_ARR, byte[].class);
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 14:
+ keepBinary = reader.readBoolean("keepBinary");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 15:
+ keys = reader.readCollection("keys", MessageCollectionItemType.MSG);
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 16:
+ byte opOrd;
+
+ opOrd = reader.readByte("op");
+
+ if (!reader.isLastRead())
+ return false;
+
+ op = GridCacheOperation.fromOrdinal(opOrd);
+
+ reader.incrementState();
+
+ case 17:
+ partIds = reader.readCollection("partIds", MessageCollectionItemType.INT);
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 18:
+ retval = reader.readBoolean("retval");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 19:
+ skipStore = reader.readBoolean("skipStore");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 20:
+ subjId = reader.readUuid("subjId");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 21:
+ byte syncModeOrd;
+
+ syncModeOrd = reader.readByte("syncMode");
+
+ if (!reader.isLastRead())
+ return false;
+
+ syncMode = CacheWriteSynchronizationMode.fromOrdinal(syncModeOrd);
+
+ reader.incrementState();
+
+ case 22:
+ taskNameHash = reader.readInt("taskNameHash");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 23:
+ topLocked = reader.readBoolean("topLocked");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 24:
+ topVer = reader.readMessage("topVer");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 25:
+ updateVer = reader.readMessage("updateVer");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 26:
+ vals = reader.readCollection("vals", MessageCollectionItemType.MSG);
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ }
+
+ return reader.afterMessageRead(GridNearAtomicFullUpdateRequest.class);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void cleanup(boolean clearKeys) {
+ vals = null;
+ entryProcessors = null;
+ entryProcessorsBytes = null;
+ invokeArgs = null;
+ invokeArgsBytes = null;
+
+ if (clearKeys)
+ keys = null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 40;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte fieldsCount() {
+ return 27;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridNearAtomicFullUpdateRequest.class, this, "filter", Arrays.toString(filter),
+ "parent", super.toString());
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java
new file mode 100644
index 0000000..e0c24b2
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java
@@ -0,0 +1,226 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.io.Externalizable;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import java.util.UUID;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheOperation;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ *
+ */
+public class GridNearAtomicSingleUpdateFilterRequest extends GridNearAtomicSingleUpdateRequest {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Filter. */
+ private CacheEntryPredicate[] filter;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridNearAtomicSingleUpdateFilterRequest() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param cacheId Cache ID.
+ * @param nodeId Node ID.
+ * @param futVer Future version.
+ * @param fastMap Fast map scheme flag.
+ * @param updateVer Update version set if fast map is performed.
+ * @param topVer Topology version.
+ * @param topLocked Topology locked flag.
+ * @param syncMode Synchronization mode.
+ * @param op Cache update operation.
+ * @param retval Return value required flag.
+ * @param filter Optional filter for atomic check.
+ * @param subjId Subject ID.
+ * @param taskNameHash Task name hash code.
+ * @param skipStore Skip write-through to a persistent storage.
+ * @param keepBinary Keep binary flag.
+ * @param clientReq Client node request flag.
+ * @param addDepInfo Deployment info flag.
+ */
+ GridNearAtomicSingleUpdateFilterRequest(
+ int cacheId,
+ UUID nodeId,
+ GridCacheVersion futVer,
+ boolean fastMap,
+ @Nullable GridCacheVersion updateVer,
+ @NotNull AffinityTopologyVersion topVer,
+ boolean topLocked,
+ CacheWriteSynchronizationMode syncMode,
+ GridCacheOperation op,
+ boolean retval,
+ @Nullable CacheEntryPredicate[] filter,
+ @Nullable UUID subjId,
+ int taskNameHash,
+ boolean skipStore,
+ boolean keepBinary,
+ boolean clientReq,
+ boolean addDepInfo
+ ) {
+ super(
+ cacheId,
+ nodeId,
+ futVer,
+ fastMap,
+ updateVer,
+ topVer,
+ topLocked,
+ syncMode,
+ op,
+ retval,
+ subjId,
+ taskNameHash,
+ skipStore,
+ keepBinary,
+ clientReq,
+ addDepInfo
+ );
+
+ assert filter != null && filter.length > 0;
+
+ this.filter = filter;
+ }
+
+ /** {@inheritDoc} */
+ @Override @Nullable public CacheEntryPredicate[] filter() {
+ return filter;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+ if (filter != null) {
+ boolean hasFilter = false;
+
+ for (CacheEntryPredicate p : filter) {
+ if (p != null) {
+ hasFilter = true;
+
+ p.prepareMarshal(cctx);
+ }
+ }
+
+ if (!hasFilter)
+ filter = null;
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (filter != null) {
+ GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+ for (CacheEntryPredicate p : filter) {
+ if (p != null)
+ p.finishUnmarshal(cctx, ldr);
+ }
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+ writer.setBuffer(buf);
+
+ if (!super.writeTo(buf, writer))
+ return false;
+
+ if (!writer.isHeaderWritten()) {
+ if (!writer.writeHeader(directType(), fieldsCount()))
+ return false;
+
+ writer.onHeaderWritten();
+ }
+
+ switch (writer.state()) {
+ case 14:
+ if (!writer.writeObjectArray("filter", filter, MessageCollectionItemType.MSG))
+ return false;
+
+ writer.incrementState();
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+ reader.setBuffer(buf);
+
+ if (!reader.beforeMessageRead())
+ return false;
+
+ if (!super.readFrom(buf, reader))
+ return false;
+
+ switch (reader.state()) {
+ case 14:
+ filter = reader.readObjectArray("filter", MessageCollectionItemType.MSG, CacheEntryPredicate.class);
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ }
+
+ return reader.afterMessageRead(GridNearAtomicSingleUpdateFilterRequest.class);
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 127;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte fieldsCount() {
+ return 15;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridNearAtomicSingleUpdateFilterRequest.class, this, "filter", Arrays.toString(filter),
+ "parent", super.toString());
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
index 256c7ac..eaf2f2c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
@@ -49,6 +49,7 @@ import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.lang.IgniteProductVersion;
import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
@@ -58,6 +59,9 @@ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRA
* DHT atomic cache near update future.
*/
public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpdateFuture {
+ /** */
+ private static final IgniteProductVersion SINGLE_UPDATE_REQUEST = IgniteProductVersion.fromString("1.7.4");
+
/** Keys */
private Object key;
@@ -66,7 +70,7 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
private Object val;
/** Not null is operation is mapped to single node. */
- private GridNearAtomicUpdateRequest req;
+ private GridNearAtomicAbstractUpdateRequest req;
/**
* @param cctx Cache context.
@@ -126,7 +130,7 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
@Override public boolean onNodeLeft(UUID nodeId) {
GridNearAtomicUpdateResponse res = null;
- GridNearAtomicUpdateRequest req;
+ GridNearAtomicAbstractUpdateRequest req;
synchronized (mux) {
req = this.req != null && this.req.nodeId().equals(nodeId) ? this.req : null;
@@ -192,8 +196,8 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
/** {@inheritDoc} */
@SuppressWarnings({"unchecked", "ThrowableResultOfMethodCallIgnored"})
- @Override public void onResult(UUID nodeId, GridNearAtomicUpdateResponse res, boolean nodeErr) {
- GridNearAtomicUpdateRequest req;
+ @Override public void onResult(UUID nodeId, GridNearAtomicUpdateResponse res, boolean nodeErr) {
+ GridNearAtomicAbstractUpdateRequest req;
AffinityTopologyVersion remapTopVer = null;
@@ -369,7 +373,7 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
* @param req Update request.
* @param res Update response.
*/
- private void updateNear(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) {
+ private void updateNear(GridNearAtomicAbstractUpdateRequest req, GridNearAtomicUpdateResponse res) {
assert nearEnabled;
if (res.remapKeys() != null || !req.hasPrimary())
@@ -446,7 +450,7 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
}
Exception err = null;
- GridNearAtomicUpdateRequest singleReq0 = null;
+ GridNearAtomicAbstractUpdateRequest singleReq0 = null;
GridCacheVersion futVer = cctx.versions().next(topVer);
@@ -535,7 +539,7 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
* @return Request.
* @throws Exception If failed.
*/
- private GridNearAtomicUpdateRequest mapSingleUpdate(AffinityTopologyVersion topVer,
+ private GridNearAtomicAbstractUpdateRequest mapSingleUpdate(AffinityTopologyVersion topVer,
GridCacheVersion futVer,
@Nullable GridCacheVersion updVer) throws Exception {
if (key == null)
@@ -559,27 +563,94 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
throw new ClusterTopologyServerNotFoundException("Failed to map keys for cache (all partition nodes " +
"left the grid).");
- GridNearAtomicUpdateRequest req = new GridNearAtomicUpdateRequest(
- cctx.cacheId(),
- primary.id(),
- futVer,
- false,
- updVer,
- topVer,
- topLocked,
- syncMode,
- op,
- retval,
- expiryPlc,
- invokeArgs,
- filter,
- subjId,
- taskNameHash,
- skipStore,
- keepBinary,
- cctx.kernalContext().clientNode(),
- cctx.deploymentEnabled(),
- 1);
+ GridNearAtomicAbstractUpdateRequest req;
+
+ if (canUseSingleRequest(primary)) {
+ if (op == TRANSFORM) {
+ req = new GridNearAtomicSingleUpdateInvokeRequest(
+ cctx.cacheId(),
+ primary.id(),
+ futVer,
+ false,
+ updVer,
+ topVer,
+ topLocked,
+ syncMode,
+ op,
+ retval,
+ invokeArgs,
+ subjId,
+ taskNameHash,
+ skipStore,
+ keepBinary,
+ cctx.kernalContext().clientNode(),
+ cctx.deploymentEnabled());
+ }
+ else {
+ if (filter == null || filter.length == 0) {
+ req = new GridNearAtomicSingleUpdateRequest(
+ cctx.cacheId(),
+ primary.id(),
+ futVer,
+ false,
+ updVer,
+ topVer,
+ topLocked,
+ syncMode,
+ op,
+ retval,
+ subjId,
+ taskNameHash,
+ skipStore,
+ keepBinary,
+ cctx.kernalContext().clientNode(),
+ cctx.deploymentEnabled());
+ }
+ else {
+ req = new GridNearAtomicSingleUpdateFilterRequest(
+ cctx.cacheId(),
+ primary.id(),
+ futVer,
+ false,
+ updVer,
+ topVer,
+ topLocked,
+ syncMode,
+ op,
+ retval,
+ filter,
+ subjId,
+ taskNameHash,
+ skipStore,
+ keepBinary,
+ cctx.kernalContext().clientNode(),
+ cctx.deploymentEnabled());
+ }
+ }
+ }
+ else {
+ req = new GridNearAtomicFullUpdateRequest(
+ cctx.cacheId(),
+ primary.id(),
+ futVer,
+ false,
+ updVer,
+ topVer,
+ topLocked,
+ syncMode,
+ op,
+ retval,
+ expiryPlc,
+ invokeArgs,
+ filter,
+ subjId,
+ taskNameHash,
+ skipStore,
+ keepBinary,
+ cctx.kernalContext().clientNode(),
+ cctx.deploymentEnabled(),
+ 1);
+ }
req.addUpdateEntry(cacheKey,
val,
@@ -591,6 +662,16 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
return req;
}
+ /**
+ * @param node Target node
+ * @return {@code True} can use 'single' update requests.
+ */
+ private boolean canUseSingleRequest(ClusterNode node) {
+ assert node != null;
+
+ return expiryPlc == null && node.version().compareToIgnoreTimestamp(SINGLE_UPDATE_REQUEST) >= 0;
+ }
+
/** {@inheritDoc} */
public String toString() {
synchronized (mux) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java
new file mode 100644
index 0000000..42b51d6
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java
@@ -0,0 +1,303 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.io.Externalizable;
+import java.nio.ByteBuffer;
+import java.util.Collections;
+import java.util.List;
+import java.util.UUID;
+import javax.cache.processor.EntryProcessor;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheOperation;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRANSFORM;
+
+/**
+ *
+ */
+public class GridNearAtomicSingleUpdateInvokeRequest extends GridNearAtomicSingleUpdateRequest {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Optional arguments for entry processor. */
+ @GridDirectTransient
+ private Object[] invokeArgs;
+
+ /** Entry processor arguments bytes. */
+ private byte[][] invokeArgsBytes;
+
+ /** Entry processors. */
+ @GridDirectTransient
+ private EntryProcessor<Object, Object, Object> entryProcessor;
+
+ /** Entry processors bytes. */
+ private byte[] entryProcessorBytes;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridNearAtomicSingleUpdateInvokeRequest() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param cacheId Cache ID.
+ * @param nodeId Node ID.
+ * @param futVer Future version.
+ * @param fastMap Fast map scheme flag.
+ * @param updateVer Update version set if fast map is performed.
+ * @param topVer Topology version.
+ * @param topLocked Topology locked flag.
+ * @param syncMode Synchronization mode.
+ * @param op Cache update operation.
+ * @param retval Return value required flag.
+ * @param invokeArgs Optional arguments for entry processor.
+ * @param subjId Subject ID.
+ * @param taskNameHash Task name hash code.
+ * @param skipStore Skip write-through to a persistent storage.
+ * @param keepBinary Keep binary flag.
+ * @param clientReq Client node request flag.
+ * @param addDepInfo Deployment info flag.
+ */
+ GridNearAtomicSingleUpdateInvokeRequest(
+ int cacheId,
+ UUID nodeId,
+ GridCacheVersion futVer,
+ boolean fastMap,
+ @Nullable GridCacheVersion updateVer,
+ @NotNull AffinityTopologyVersion topVer,
+ boolean topLocked,
+ CacheWriteSynchronizationMode syncMode,
+ GridCacheOperation op,
+ boolean retval,
+ @Nullable Object[] invokeArgs,
+ @Nullable UUID subjId,
+ int taskNameHash,
+ boolean skipStore,
+ boolean keepBinary,
+ boolean clientReq,
+ boolean addDepInfo
+ ) {
+ super(
+ cacheId,
+ nodeId,
+ futVer,
+ fastMap,
+ updateVer,
+ topVer,
+ topLocked,
+ syncMode,
+ op,
+ retval,
+ subjId,
+ taskNameHash,
+ skipStore,
+ keepBinary,
+ clientReq,
+ addDepInfo
+ );
+ this.invokeArgs = invokeArgs;
+
+ assert op == TRANSFORM : op;
+ }
+
+ /**
+ * @param key Key to add.
+ * @param val Optional update value.
+ * @param conflictTtl Conflict TTL (optional).
+ * @param conflictExpireTime Conflict expire time (optional).
+ * @param conflictVer Conflict version (optional).
+ * @param primary If given key is primary on this mapping.
+ */
+ @Override public void addUpdateEntry(KeyCacheObject key,
+ @Nullable Object val,
+ long conflictTtl,
+ long conflictExpireTime,
+ @Nullable GridCacheVersion conflictVer,
+ boolean primary) {
+ assert conflictTtl < 0 : conflictTtl;
+ assert conflictExpireTime < 0 : conflictExpireTime;
+ assert conflictVer == null : conflictVer;
+ assert val instanceof EntryProcessor : val;
+
+ entryProcessor = (EntryProcessor<Object, Object, Object>)val;
+
+ this.key = key;
+ partId = key.partition();
+
+ hasPrimary(hasPrimary() | primary);
+ }
+
+ /** {@inheritDoc} */
+ @Override public List<?> values() {
+ return Collections.singletonList(entryProcessor);
+ }
+
+ /** {@inheritDoc} */
+ @Override public CacheObject value(int idx) {
+ assert idx == 0 : idx;
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
+ assert idx == 0 : idx;
+
+ return entryProcessor;
+ }
+
+ /** {@inheritDoc} */
+ @Override public CacheObject writeValue(int idx) {
+ assert idx == 0 : idx;
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Object[] invokeArguments() {
+ return invokeArgs;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+ // force addition of deployment info for entry processors if P2P is enabled globally.
+ if (!addDepInfo && ctx.deploymentEnabled())
+ addDepInfo = true;
+
+ if (entryProcessor != null && entryProcessorBytes == null)
+ entryProcessorBytes = CU.marshal(cctx, entryProcessor);
+
+ if (invokeArgsBytes == null)
+ invokeArgsBytes = marshalInvokeArguments(invokeArgs, cctx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (entryProcessorBytes != null && entryProcessor == null)
+ entryProcessor = U.unmarshal(ctx, entryProcessorBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
+
+ if (invokeArgs == null)
+ invokeArgs = unmarshalInvokeArguments(invokeArgsBytes, ctx, ldr);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void cleanup(boolean clearKey) {
+ super.cleanup(clearKey);
+
+ entryProcessor = null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+ writer.setBuffer(buf);
+
+ if (!super.writeTo(buf, writer))
+ return false;
+
+ if (!writer.isHeaderWritten()) {
+ if (!writer.writeHeader(directType(), fieldsCount()))
+ return false;
+
+ writer.onHeaderWritten();
+ }
+
+ switch (writer.state()) {
+ case 14:
+ if (!writer.writeByteArray("entryProcessorBytes", entryProcessorBytes))
+ return false;
+
+ writer.incrementState();
+
+ case 15:
+ if (!writer.writeObjectArray("invokeArgsBytes", invokeArgsBytes, MessageCollectionItemType.BYTE_ARR))
+ return false;
+
+ writer.incrementState();
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+ reader.setBuffer(buf);
+
+ if (!reader.beforeMessageRead())
+ return false;
+
+ if (!super.readFrom(buf, reader))
+ return false;
+
+ switch (reader.state()) {
+ case 14:
+ entryProcessorBytes = reader.readByteArray("entryProcessorBytes");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 15:
+ invokeArgsBytes = reader.readObjectArray("invokeArgsBytes", MessageCollectionItemType.BYTE_ARR, byte[].class);
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ }
+
+ return reader.afterMessageRead(GridNearAtomicSingleUpdateInvokeRequest.class);
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte fieldsCount() {
+ return 16;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 126;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
new file mode 100644
index 0000000..211b472
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.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.internal.processors.cache.distributed.dht.atomic;
+
+import java.io.Externalizable;
+import java.nio.ByteBuffer;
+import java.util.Collections;
+import java.util.List;
+import java.util.UUID;
+import javax.cache.processor.EntryProcessor;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheOperation;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.internal.processors.cache.GridCacheOperation.DELETE;
+import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRANSFORM;
+
+/**
+ *
+ */
+public class GridNearAtomicSingleUpdateRequest extends GridNearAtomicAbstractSingleUpdateRequest {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Key to update. */
+ @GridToStringInclude
+ protected KeyCacheObject key;
+
+ /** Value to update. */
+ protected CacheObject val;
+
+ /** Partition of key. */
+ protected int partId;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridNearAtomicSingleUpdateRequest() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param cacheId Cache ID.
+ * @param nodeId Node ID.
+ * @param futVer Future version.
+ * @param fastMap Fast map scheme flag.
+ * @param updateVer Update version set if fast map is performed.
+ * @param topVer Topology version.
+ * @param topLocked Topology locked flag.
+ * @param syncMode Synchronization mode.
+ * @param op Cache update operation.
+ * @param retval Return value required flag.
+ * @param subjId Subject ID.
+ * @param taskNameHash Task name hash code.
+ * @param skipStore Skip write-through to a persistent storage.
+ * @param keepBinary Keep binary flag.
+ * @param clientReq Client node request flag.
+ * @param addDepInfo Deployment info flag.
+ */
+ GridNearAtomicSingleUpdateRequest(
+ int cacheId,
+ UUID nodeId,
+ GridCacheVersion futVer,
+ boolean fastMap,
+ @Nullable GridCacheVersion updateVer,
+ @NotNull AffinityTopologyVersion topVer,
+ boolean topLocked,
+ CacheWriteSynchronizationMode syncMode,
+ GridCacheOperation op,
+ boolean retval,
+ @Nullable UUID subjId,
+ int taskNameHash,
+ boolean skipStore,
+ boolean keepBinary,
+ boolean clientReq,
+ boolean addDepInfo
+ ) {
+ super(
+ cacheId,
+ nodeId,
+ futVer,
+ fastMap,
+ updateVer,
+ topVer,
+ topLocked,
+ syncMode,
+ op,
+ retval,
+ subjId,
+ taskNameHash,
+ skipStore,
+ keepBinary,
+ clientReq,
+ addDepInfo
+ );
+ }
+
+ /**
+ * @param key Key to add.
+ * @param val Optional update value.
+ * @param conflictTtl Conflict TTL (optional).
+ * @param conflictExpireTime Conflict expire time (optional).
+ * @param conflictVer Conflict version (optional).
+ * @param primary If given key is primary on this mapping.
+ */
+ @Override public void addUpdateEntry(KeyCacheObject key,
+ @Nullable Object val,
+ long conflictTtl,
+ long conflictExpireTime,
+ @Nullable GridCacheVersion conflictVer,
+ boolean primary) {
+ assert op != TRANSFORM;
+ assert val != null || op == DELETE;
+ assert conflictTtl < 0 : conflictTtl;
+ assert conflictExpireTime < 0 : conflictExpireTime;
+ assert conflictVer == null : conflictVer;
+
+ this.key = key;
+ partId = key.partition();
+
+ if (val != null) {
+ assert val instanceof CacheObject : val;
+
+ this.val = (CacheObject)val;
+ }
+
+ hasPrimary(hasPrimary() | primary);
+ }
+
+ /** {@inheritDoc} */
+ @Override public int size() {
+ return key == null ? 0 : 1;
+ }
+
+ /** {@inheritDoc} */
+ @Override public List<KeyCacheObject> keys() {
+ return Collections.singletonList(key);
+ }
+
+ /** {@inheritDoc} */
+ @Override public KeyCacheObject key(int idx) {
+ assert idx == 0 : idx;
+
+ return key;
+ }
+
+ /** {@inheritDoc} */
+ @Override public List<?> values() {
+ return Collections.singletonList(val);
+ }
+
+ /** {@inheritDoc} */
+ @Override public CacheObject value(int idx) {
+ assert idx == 0 : idx;
+
+ return val;
+ }
+
+ /** {@inheritDoc} */
+ @Override public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
+ assert idx == 0 : idx;
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public CacheObject writeValue(int idx) {
+ assert idx == 0 : idx;
+
+ return val;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public List<GridCacheVersion> conflictVersions() {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public GridCacheVersion conflictVersion(int idx) {
+ assert idx == 0 : idx;
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long conflictTtl(int idx) {
+ assert idx == 0 : idx;
+
+ return CU.TTL_NOT_CHANGED;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long conflictExpireTime(int idx) {
+ assert idx == 0 : idx;
+
+ return CU.EXPIRE_TIME_CALCULATE;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @param ctx
+ */
+ @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+ prepareMarshalCacheObject(key, cctx);
+
+ if (val != null)
+ prepareMarshalCacheObject(val, cctx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+ key.finishUnmarshal(cctx.cacheObjectContext(), ldr);
+
+ if (val != null)
+ val.finishUnmarshal(cctx.cacheObjectContext(), ldr);
+
+ key.partition(partId);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+ writer.setBuffer(buf);
+
+ if (!super.writeTo(buf, writer))
+ return false;
+
+ if (!writer.isHeaderWritten()) {
+ if (!writer.writeHeader(directType(), fieldsCount()))
+ return false;
+
+ writer.onHeaderWritten();
+ }
+
+ switch (writer.state()) {
+ case 11:
+ if (!writer.writeMessage("key", key))
+ return false;
+
+ writer.incrementState();
+
+ case 12:
+ if (!writer.writeInt("partId", partId))
+ return false;
+
+ writer.incrementState();
+
+ case 13:
+ if (!writer.writeMessage("val", val))
+ return false;
+
+ writer.incrementState();
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+ reader.setBuffer(buf);
+
+ if (!reader.beforeMessageRead())
+ return false;
+
+ if (!super.readFrom(buf, reader))
+ return false;
+
+ switch (reader.state()) {
+ case 11:
+ key = reader.readMessage("key");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 12:
+ partId = reader.readInt("partId");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 13:
+ val = reader.readMessage("val");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ }
+
+ return reader.afterMessageRead(GridNearAtomicSingleUpdateRequest.class);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void cleanup(boolean clearKey) {
+ val = null;
+
+ if (clearKey)
+ key = null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 125;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte fieldsCount() {
+ return 14;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridNearAtomicSingleUpdateRequest.class, this, "parent", super.toString());
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
index 30a0c3d..cd64117 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
@@ -87,13 +87,13 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
/** Mappings if operations is mapped to more than one node. */
@GridToStringInclude
- private Map<UUID, GridNearAtomicUpdateRequest> mappings;
+ private Map<UUID, GridNearAtomicFullUpdateRequest> mappings;
/** Keys to remap. */
private Collection<KeyCacheObject> remapKeys;
/** Not null is operation is mapped to single node. */
- private GridNearAtomicUpdateRequest singleReq;
+ private GridNearAtomicFullUpdateRequest singleReq;
/**
* @param cctx Cache context.
@@ -164,7 +164,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
@Override public boolean onNodeLeft(UUID nodeId) {
GridNearAtomicUpdateResponse res = null;
- GridNearAtomicUpdateRequest req;
+ GridNearAtomicFullUpdateRequest req;
synchronized (mux) {
if (singleReq != null)
@@ -258,7 +258,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
/** {@inheritDoc} */
@SuppressWarnings({"unchecked", "ThrowableResultOfMethodCallIgnored"})
@Override public void onResult(UUID nodeId, GridNearAtomicUpdateResponse res, boolean nodeErr) {
- GridNearAtomicUpdateRequest req;
+ GridNearAtomicFullUpdateRequest req;
AffinityTopologyVersion remapTopVer = null;
@@ -406,7 +406,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
if (rcvAll && nearEnabled) {
if (mappings != null) {
- for (GridNearAtomicUpdateRequest req0 : mappings.values()) {
+ for (GridNearAtomicFullUpdateRequest req0 : mappings.values()) {
GridNearAtomicUpdateResponse res0 = req0.response();
assert res0 != null : req0;
@@ -482,7 +482,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
* @param req Update request.
* @param res Update response.
*/
- private void updateNear(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) {
+ private void updateNear(GridNearAtomicFullUpdateRequest req, GridNearAtomicUpdateResponse res) {
assert nearEnabled;
if (res.remapKeys() != null || !req.hasPrimary())
@@ -552,13 +552,13 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
*
* @param mappings Mappings to send.
*/
- private void doUpdate(Map<UUID, GridNearAtomicUpdateRequest> mappings) {
+ private void doUpdate(Map<UUID, GridNearAtomicFullUpdateRequest> mappings) {
UUID locNodeId = cctx.localNodeId();
- GridNearAtomicUpdateRequest locUpdate = null;
+ GridNearAtomicFullUpdateRequest locUpdate = null;
// Send messages to remote nodes first, then run local update.
- for (GridNearAtomicUpdateRequest req : mappings.values()) {
+ for (GridNearAtomicFullUpdateRequest req : mappings.values()) {
if (locNodeId.equals(req.nodeId())) {
assert locUpdate == null : "Cannot have more than one local mapping [locUpdate=" + locUpdate +
", req=" + req + ']';
@@ -590,8 +590,8 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
if (locUpdate != null) {
cache.updateAllAsyncInternal(cctx.localNodeId(), locUpdate,
- new CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse>() {
- @Override public void apply(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) {
+ new CI2<GridNearAtomicFullUpdateRequest, GridNearAtomicUpdateResponse>() {
+ @Override public void apply(GridNearAtomicFullUpdateRequest req, GridNearAtomicUpdateResponse res) {
onResult(res.nodeId(), res, false);
}
});
@@ -621,8 +621,8 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
}
Exception err = null;
- GridNearAtomicUpdateRequest singleReq0 = null;
- Map<UUID, GridNearAtomicUpdateRequest> mappings0 = null;
+ GridNearAtomicFullUpdateRequest singleReq0 = null;
+ Map<UUID, GridNearAtomicFullUpdateRequest> mappings0 = null;
int size = keys.size();
@@ -651,7 +651,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
singleReq0 = mapSingleUpdate(topVer, futVer, updVer);
}
else {
- Map<UUID, GridNearAtomicUpdateRequest> pendingMappings = mapUpdate(topNodes,
+ Map<UUID, GridNearAtomicFullUpdateRequest> pendingMappings = mapUpdate(topNodes,
topVer,
futVer,
updVer,
@@ -663,7 +663,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
if (syncMode == PRIMARY_SYNC) {
mappings0 = U.newHashMap(pendingMappings.size());
- for (GridNearAtomicUpdateRequest req : pendingMappings.values()) {
+ for (GridNearAtomicFullUpdateRequest req : pendingMappings.values()) {
if (req.hasPrimary())
mappings0.put(req.nodeId(), req);
}
@@ -756,7 +756,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
* @throws Exception If failed.
*/
@SuppressWarnings("ForLoopReplaceableByForEach")
- private Map<UUID, GridNearAtomicUpdateRequest> mapUpdate(Collection<ClusterNode> topNodes,
+ private Map<UUID, GridNearAtomicFullUpdateRequest> mapUpdate(Collection<ClusterNode> topNodes,
AffinityTopologyVersion topVer,
GridCacheVersion futVer,
@Nullable GridCacheVersion updVer,
@@ -776,7 +776,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
if (conflictRmvVals != null)
conflictRmvValsIt = conflictRmvVals.iterator();
- Map<UUID, GridNearAtomicUpdateRequest> pendingMappings = U.newHashMap(topNodes.size());
+ Map<UUID, GridNearAtomicFullUpdateRequest> pendingMappings = U.newHashMap(topNodes.size());
// Create mappings first, then send messages.
for (Object key : keys) {
@@ -848,10 +848,10 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
UUID nodeId = affNode.id();
- GridNearAtomicUpdateRequest mapped = pendingMappings.get(nodeId);
+ GridNearAtomicFullUpdateRequest mapped = pendingMappings.get(nodeId);
if (mapped == null) {
- mapped = new GridNearAtomicUpdateRequest(
+ mapped = new GridNearAtomicFullUpdateRequest(
cctx.cacheId(),
nodeId,
futVer,
@@ -892,7 +892,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
* @return Request.
* @throws Exception If failed.
*/
- private GridNearAtomicUpdateRequest mapSingleUpdate(AffinityTopologyVersion topVer,
+ private GridNearAtomicFullUpdateRequest mapSingleUpdate(AffinityTopologyVersion topVer,
GridCacheVersion futVer,
@Nullable GridCacheVersion updVer) throws Exception {
Object key = F.first(keys);
@@ -953,7 +953,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
throw new ClusterTopologyServerNotFoundException("Failed to map keys for cache (all partition nodes " +
"left the grid).");
- GridNearAtomicUpdateRequest req = new GridNearAtomicUpdateRequest(
+ GridNearAtomicFullUpdateRequest req = new GridNearAtomicFullUpdateRequest(
cctx.cacheId(),
primary.id(),
futVer,
[07/15] ignite git commit: IGNITE-4163 Fixed load range queries.
Posted by av...@apache.org.
IGNITE-4163 Fixed load range queries.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e39888a0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e39888a0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e39888a0
Branch: refs/heads/ignite-4242
Commit: e39888a08da313bec4d30f96488eccb36b4abacc
Parents: 85a4b96
Author: Vasiliy Sisko <vs...@gridgain.com>
Authored: Thu Nov 17 11:41:05 2016 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Thu Nov 17 11:41:05 2016 +0700
----------------------------------------------------------------------
.../ignite/cache/store/jdbc/CacheAbstractJdbcStore.java | 2 +-
.../ignite/cache/store/jdbc/dialect/BasicJdbcDialect.java | 4 ++--
.../apache/ignite/cache/store/jdbc/dialect/DB2Dialect.java | 8 ++++++++
.../ignite/cache/store/jdbc/dialect/OracleDialect.java | 8 ++++++++
.../ignite/cache/store/jdbc/dialect/SQLServerDialect.java | 8 ++++++++
5 files changed, 27 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e39888a0/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
index 4eb5b56..4bfd92b 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
@@ -1982,7 +1982,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
Map<String, Integer> colIdxs = U.newHashMap(meta.getColumnCount());
for (int i = 1; i <= meta.getColumnCount(); i++)
- colIdxs.put(meta.getColumnLabel(i), i);
+ colIdxs.put(meta.getColumnLabel(i).toUpperCase(), i);
while (rs.next()) {
K1 key = buildObject(em.cacheName, em.keyType(), em.keyKind(), em.keyColumns(), em.keyCols, colIdxs, rs);
http://git-wip-us.apache.org/repos/asf/ignite/blob/e39888a0/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/BasicJdbcDialect.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/BasicJdbcDialect.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/BasicJdbcDialect.java
index 5fa564b..3ab112a 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/BasicJdbcDialect.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/BasicJdbcDialect.java
@@ -157,8 +157,8 @@ public class BasicJdbcDialect implements JdbcDialect {
@Override public String loadCacheSelectRangeQuery(String fullTblName, Collection<String> keyCols) {
String cols = mkString(keyCols, ",");
- return String.format("SELECT %s FROM (SELECT %s, ROWNUM() AS rn FROM %s ORDER BY %s) WHERE mod(rn, ?) = 0",
- cols, cols, fullTblName, cols);
+ return String.format("SELECT %1$s FROM (SELECT %1$s, ROW_NUMBER() OVER() AS rn FROM (SELECT %1$s FROM %2$s ORDER BY %1$s) AS tbl) AS tbl WHERE mod(rn, ?) = 0",
+ cols, fullTblName);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/e39888a0/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/DB2Dialect.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/DB2Dialect.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/DB2Dialect.java
index 4bae14a..551782e 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/DB2Dialect.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/DB2Dialect.java
@@ -29,6 +29,14 @@ public class DB2Dialect extends BasicJdbcDialect {
private static final long serialVersionUID = 0L;
/** {@inheritDoc} */
+ @Override public String loadCacheSelectRangeQuery(String fullTblName, Collection<String> keyCols) {
+ String cols = mkString(keyCols, ",");
+
+ return String.format("SELECT %1$s FROM (SELECT %1$s, ROW_NUMBER() OVER(ORDER BY %1$s) AS rn FROM %2$s) WHERE mod(rn, ?) = 0 ORDER BY %1$s",
+ cols, fullTblName);
+ }
+
+ /** {@inheritDoc} */
@Override public boolean hasMerge() {
return true;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e39888a0/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/OracleDialect.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/OracleDialect.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/OracleDialect.java
index a9efe0d..e268b24 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/OracleDialect.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/OracleDialect.java
@@ -34,6 +34,14 @@ public class OracleDialect extends BasicJdbcDialect {
}
/** {@inheritDoc} */
+ @Override public String loadCacheSelectRangeQuery(String fullTblName, Collection<String> keyCols) {
+ String cols = mkString(keyCols, ",");
+
+ return String.format("SELECT %1$s FROM (SELECT %1$s, ROWNUM AS rn FROM (SELECT %1$s FROM %2$s ORDER BY %1$s)) WHERE mod(rn, ?) = 0",
+ cols, fullTblName);
+ }
+
+ /** {@inheritDoc} */
@Override public String mergeQuery(String fullTblName, Collection<String> keyCols, Collection<String> uniqCols) {
Collection<String> cols = F.concat(false, keyCols, uniqCols);
http://git-wip-us.apache.org/repos/asf/ignite/blob/e39888a0/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/SQLServerDialect.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/SQLServerDialect.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/SQLServerDialect.java
index 883918f..ace1d3f 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/SQLServerDialect.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/SQLServerDialect.java
@@ -34,6 +34,14 @@ public class SQLServerDialect extends BasicJdbcDialect {
}
/** {@inheritDoc} */
+ @Override public String loadCacheSelectRangeQuery(String fullTblName, Collection<String> keyCols) {
+ String cols = mkString(keyCols, ",");
+
+ return String.format("SELECT %1$s FROM (SELECT %1$s, ROW_NUMBER() OVER(ORDER BY %1$s) AS rn FROM %2$s) tbl WHERE rn %% ? = 0 ORDER BY %1$s",
+ cols, fullTblName);
+ }
+
+ /** {@inheritDoc} */
@Override public boolean hasMerge() {
return true;
}
[02/15] ignite git commit: IGNITE-4208: Hadoop: Fixed a bug
preventing normal secondary file system start. This closes #1228.
Posted by av...@apache.org.
IGNITE-4208: Hadoop: Fixed a bug preventing normal secondary file system start. This closes #1228.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/baa75266
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/baa75266
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/baa75266
Branch: refs/heads/ignite-4242
Commit: baa752660c6eddf27d15a812252b01b5872385de
Parents: 1093819
Author: iveselovskiy <iv...@gridgain.com>
Authored: Thu Nov 10 18:47:09 2016 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Nov 10 18:47:09 2016 +0300
----------------------------------------------------------------------
.../org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java | 2 +-
.../org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java | 2 +-
.../internal/processors/hadoop/delegate/HadoopDelegateUtils.java | 4 ++--
.../impl/delegate/HadoopIgfsSecondaryFileSystemDelegateImpl.java | 3 +--
.../hadoop/impl/fs/KerberosHadoopFileSystemFactorySelfTest.java | 3 ++-
.../hadoop/impl/igfs/HadoopFIleSystemFactorySelfTest.java | 2 +-
.../impl/igfs/HadoopIgfsSecondaryFileSystemTestAdapter.java | 3 +--
.../impl/igfs/HadoopSecondaryFileSystemConfigurationTest.java | 4 ++--
8 files changed, 11 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/baa75266/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java
index 7133c08..866fc1a 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java
@@ -336,7 +336,7 @@ public class IgniteHadoopFileSystem extends FileSystem {
HadoopFileSystemFactory factory0 =
(HadoopFileSystemFactory)paths.getPayload(getClass().getClassLoader());
- factory = HadoopDelegateUtils.fileSystemFactoryDelegate(factory0);
+ factory = HadoopDelegateUtils.fileSystemFactoryDelegate(getClass().getClassLoader(), factory0);
}
catch (IgniteCheckedException e) {
throw new IOException("Failed to get secondary file system factory.", e);
http://git-wip-us.apache.org/repos/asf/ignite/blob/baa75266/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java
index 18b8bf9..82ad683 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java
@@ -345,7 +345,7 @@ public class IgniteHadoopFileSystem extends AbstractFileSystem implements Closea
HadoopFileSystemFactory factory0 =
(HadoopFileSystemFactory) paths.getPayload(getClass().getClassLoader());
- factory = HadoopDelegateUtils.fileSystemFactoryDelegate(factory0);
+ factory = HadoopDelegateUtils.fileSystemFactoryDelegate(getClass().getClassLoader(), factory0);
}
catch (IgniteCheckedException e) {
throw new IOException("Failed to get secondary file system factory.", e);
http://git-wip-us.apache.org/repos/asf/ignite/blob/baa75266/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/delegate/HadoopDelegateUtils.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/delegate/HadoopDelegateUtils.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/delegate/HadoopDelegateUtils.java
index 76d9bff..2059c8d 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/delegate/HadoopDelegateUtils.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/delegate/HadoopDelegateUtils.java
@@ -81,13 +81,13 @@ public class HadoopDelegateUtils {
* @return Delegate.
*/
@SuppressWarnings("unchecked")
- public static HadoopFileSystemFactoryDelegate fileSystemFactoryDelegate(Object proxy) {
+ public static HadoopFileSystemFactoryDelegate fileSystemFactoryDelegate(ClassLoader ldr, Object proxy) {
String clsName = FACTORY_CLS_MAP.get(proxy.getClass().getName());
if (clsName == null)
clsName = DFLT_FACTORY_CLS;
- return newInstance(clsName, null, proxy);
+ return newInstance(clsName, ldr, proxy);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/baa75266/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/delegate/HadoopIgfsSecondaryFileSystemDelegateImpl.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/delegate/HadoopIgfsSecondaryFileSystemDelegateImpl.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/delegate/HadoopIgfsSecondaryFileSystemDelegateImpl.java
index 203965c..e336fad 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/delegate/HadoopIgfsSecondaryFileSystemDelegateImpl.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/delegate/HadoopIgfsSecondaryFileSystemDelegateImpl.java
@@ -56,7 +56,6 @@ import java.io.OutputStream;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -86,7 +85,7 @@ public class HadoopIgfsSecondaryFileSystemDelegateImpl implements HadoopIgfsSeco
if (factory0 == null)
factory0 = new CachingHadoopFileSystemFactory();
- factory = HadoopDelegateUtils.fileSystemFactoryDelegate(factory0);
+ factory = HadoopDelegateUtils.fileSystemFactoryDelegate(getClass().getClassLoader(), factory0);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/baa75266/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/fs/KerberosHadoopFileSystemFactorySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/fs/KerberosHadoopFileSystemFactorySelfTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/fs/KerberosHadoopFileSystemFactorySelfTest.java
index 8c95a0e..f35d644 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/fs/KerberosHadoopFileSystemFactorySelfTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/fs/KerberosHadoopFileSystemFactorySelfTest.java
@@ -70,7 +70,8 @@ public class KerberosHadoopFileSystemFactorySelfTest extends GridCommonAbstractT
GridTestUtils.assertThrows(null, new Callable<Object>() {
@Override public Object call() throws Exception {
- HadoopFileSystemFactoryDelegate delegate = HadoopDelegateUtils.fileSystemFactoryDelegate(fac);
+ HadoopFileSystemFactoryDelegate delegate = HadoopDelegateUtils.fileSystemFactoryDelegate(
+ getClass().getClassLoader(), fac);
delegate.start();
http://git-wip-us.apache.org/repos/asf/ignite/blob/baa75266/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopFIleSystemFactorySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopFIleSystemFactorySelfTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopFIleSystemFactorySelfTest.java
index 7cf7f2d..5d955d4 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopFIleSystemFactorySelfTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopFIleSystemFactorySelfTest.java
@@ -330,7 +330,7 @@ public class HadoopFIleSystemFactorySelfTest extends IgfsCommonAbstractTest {
/** {@inheritDoc} */
@Override public void start() throws IgniteException {
- delegate = HadoopDelegateUtils.fileSystemFactoryDelegate(factory);
+ delegate = HadoopDelegateUtils.fileSystemFactoryDelegate(getClass().getClassLoader(), factory);
delegate.start();
http://git-wip-us.apache.org/repos/asf/ignite/blob/baa75266/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopIgfsSecondaryFileSystemTestAdapter.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopIgfsSecondaryFileSystemTestAdapter.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopIgfsSecondaryFileSystemTestAdapter.java
index adb1330..453d0c7 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopIgfsSecondaryFileSystemTestAdapter.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopIgfsSecondaryFileSystemTestAdapter.java
@@ -30,7 +30,6 @@ import org.apache.ignite.configuration.FileSystemConfiguration;
import org.apache.ignite.hadoop.fs.HadoopFileSystemFactory;
import org.apache.ignite.internal.processors.hadoop.delegate.HadoopDelegateUtils;
import org.apache.ignite.internal.processors.hadoop.delegate.HadoopFileSystemFactoryDelegate;
-import org.apache.ignite.internal.processors.hadoop.impl.igfs.HadoopIgfsUtils;
import org.apache.ignite.internal.processors.igfs.IgfsEx;
import org.apache.ignite.internal.processors.igfs.IgfsUtils;
import org.apache.ignite.internal.processors.igfs.IgfsSecondaryFileSystemTestAdapter;
@@ -50,7 +49,7 @@ public class HadoopIgfsSecondaryFileSystemTestAdapter implements IgfsSecondaryFi
public HadoopIgfsSecondaryFileSystemTestAdapter(HadoopFileSystemFactory factory) {
assert factory != null;
- this.factory = HadoopDelegateUtils.fileSystemFactoryDelegate(factory);
+ this.factory = HadoopDelegateUtils.fileSystemFactoryDelegate(getClass().getClassLoader(), factory);
this.factory.start();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/baa75266/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopSecondaryFileSystemConfigurationTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopSecondaryFileSystemConfigurationTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopSecondaryFileSystemConfigurationTest.java
index ae03f14..78f457b 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopSecondaryFileSystemConfigurationTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopSecondaryFileSystemConfigurationTest.java
@@ -37,7 +37,6 @@ import org.apache.ignite.igfs.IgfsIpcEndpointType;
import org.apache.ignite.igfs.IgfsMode;
import org.apache.ignite.internal.processors.hadoop.delegate.HadoopDelegateUtils;
import org.apache.ignite.internal.processors.hadoop.delegate.HadoopFileSystemFactoryDelegate;
-import org.apache.ignite.internal.processors.hadoop.impl.igfs.HadoopIgfsUtils;
import org.apache.ignite.internal.processors.igfs.IgfsCommonAbstractTest;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -185,7 +184,8 @@ public class HadoopSecondaryFileSystemConfigurationTest extends IgfsCommonAbstra
fac.setConfigPaths(primaryConfFullPath);
fac.setUri(primaryFsUriStr);
- HadoopFileSystemFactoryDelegate facDelegate = HadoopDelegateUtils.fileSystemFactoryDelegate(fac);
+ HadoopFileSystemFactoryDelegate facDelegate = HadoopDelegateUtils.fileSystemFactoryDelegate(
+ getClass().getClassLoader(), fac);
facDelegate.start();
[10/15] ignite git commit: IGNITE-3443 Implemented metrics for
queries monitoring.
Posted by av...@apache.org.
IGNITE-3443 Implemented metrics for queries monitoring.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0234f673
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0234f673
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0234f673
Branch: refs/heads/ignite-4242
Commit: 0234f67390c88dceefd6e62de98adb922b4ba9ac
Parents: 3eacc0b
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Mon Nov 21 17:40:50 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Mon Nov 21 17:40:50 2016 +0700
----------------------------------------------------------------------
.../java/org/apache/ignite/IgniteCache.java | 21 +-
.../ignite/cache/query/QueryDetailMetrics.java | 98 ++++
.../apache/ignite/cache/query/QueryMetrics.java | 2 +-
.../configuration/CacheConfiguration.java | 30 +
.../processors/cache/GridCacheUtilityKey.java | 6 +-
.../processors/cache/IgniteCacheProxy.java | 59 +-
.../processors/cache/query/CacheQuery.java | 1 -
.../processors/cache/query/CacheQueryType.java | 2 +-
.../cache/query/GridCacheQueryAdapter.java | 10 -
.../GridCacheQueryDetailMetricsAdapter.java | 248 ++++++++
.../query/GridCacheQueryDetailMetricsKey.java | 82 +++
.../query/GridCacheQueryFutureAdapter.java | 2 -
.../cache/query/GridCacheQueryManager.java | 149 ++++-
.../query/GridCacheQueryMetricsAdapter.java | 27 +-
.../processors/query/GridQueryProcessor.java | 102 ++--
.../internal/util/GridBoundedPriorityQueue.java | 68 +++
.../cache/VisorCacheQueryDetailMetrics.java | 167 ++++++
...sorCacheQueryDetailMetricsCollectorTask.java | 146 +++++
.../VisorCacheResetQueryDetailMetricsTask.java | 71 +++
.../cache/VisorCacheResetQueryMetricsTask.java | 8 +-
.../internal/visor/util/VisorTaskUtils.java | 26 +-
.../resources/META-INF/classnames.properties | 75 ++-
.../utils/GridBoundedPriorityQueueSelfTest.java | 114 ++++
.../multijvm/IgniteCacheProcessProxy.java | 16 +
.../testsuites/IgniteLangSelfTestSuite.java | 4 +-
...CacheAbstractQueryDetailMetricsSelfTest.java | 572 +++++++++++++++++++
.../CacheAbstractQueryMetricsSelfTest.java | 305 ++++++----
.../CacheLocalQueryDetailMetricsSelfTest.java | 33 ++
...edQueryDetailMetricsDistributedSelfTest.java | 33 ++
...titionedQueryDetailMetricsLocalSelfTest.java | 33 ++
...edQueryDetailMetricsDistributedSelfTest.java | 33 ++
...plicatedQueryDetailMetricsLocalSelfTest.java | 33 ++
.../IgniteCacheQuerySelfTestSuite2.java | 12 +
.../commands/cache/VisorCacheCommand.scala | 7 +-
34 files changed, 2338 insertions(+), 257 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
index 2290fc5..7eb6e91 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
@@ -43,6 +43,7 @@ import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.cache.query.Query;
import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cache.query.QueryDetailMetrics;
import org.apache.ignite.cache.query.QueryMetrics;
import org.apache.ignite.cache.query.ScanQuery;
import org.apache.ignite.cache.query.SpiQuery;
@@ -326,6 +327,24 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
public QueryMetrics queryMetrics();
/**
+ * Reset query metrics.
+ */
+ public void resetQueryMetrics();
+
+ /**
+ * Gets query detail metrics.
+ * Query detail metrics could be enabled via {@link CacheConfiguration#setQueryDetailMetricsSize(int)} method.
+ *
+ * @return Metrics.
+ */
+ public Collection<? extends QueryDetailMetrics> queryDetailMetrics();
+
+ /**
+ * Reset query detail metrics.
+ */
+ public void resetQueryDetailMetrics();
+
+ /**
* Attempts to evict all entries associated with keys. Note,
* that entry will be evicted only if it's not used (not
* participating in any locks or transactions).
@@ -335,7 +354,7 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
public void localEvict(Collection<? extends K> keys);
/**
- * Peeks at in-memory cached value using default optinal peek mode.
+ * Peeks at in-memory cached value using default optional peek mode.
* <p>
* This method will not load value from any persistent store or from a remote node.
* <h2 class="header">Transactions</h2>
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/cache/query/QueryDetailMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/QueryDetailMetrics.java b/modules/core/src/main/java/org/apache/ignite/cache/query/QueryDetailMetrics.java
new file mode 100644
index 0000000..0b01880
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/cache/query/QueryDetailMetrics.java
@@ -0,0 +1,98 @@
+/*
+ * 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.query;
+
+import org.apache.ignite.configuration.CacheConfiguration;
+
+/**
+ * Query metrics aggregated by query type and its textual representation.
+ *
+ * Query detail metrics could be enabled via {@link CacheConfiguration#setQueryDetailMetricsSize(int)} method.
+ */
+public interface QueryDetailMetrics {
+ /**
+ * @return Query type.
+ */
+ public String queryType();
+
+ /**
+ * @return Textual representation of query.
+ */
+ public String query();
+
+ /**
+ * @return Cache where query was executed.
+ */
+ public String cache();
+
+ /**
+ * Gets total number execution of query.
+ *
+ * @return Number of executions.
+ */
+ public int executions();
+
+ /**
+ * Gets number of completed execution of query.
+ *
+ * @return Number of completed executions.
+ */
+ public int completions();
+
+ /**
+ * Gets number of times a query execution failed.
+ *
+ * @return Number of times a query execution failed.
+ */
+ public int failures();
+
+ /**
+ * Gets minimum execution time of query.
+ *
+ * @return Minimum execution time of query.
+ */
+ public long minimumTime();
+
+ /**
+ * Gets maximum execution time of query.
+ *
+ * @return Maximum execution time of query.
+ */
+ public long maximumTime();
+
+ /**
+ * Gets average execution time of query.
+ *
+ * @return Average execution time of query.
+ */
+ public double averageTime();
+
+ /**
+ * Gets total time of all query executions.
+ *
+ * @return Total time of all query executions.
+ */
+ public long totalTime();
+
+ /**
+ * Gets latest query start time.
+ *
+ * @return Latest time query was stared.
+ */
+ public long lastStartTime();
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/cache/query/QueryMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/QueryMetrics.java b/modules/core/src/main/java/org/apache/ignite/cache/query/QueryMetrics.java
index e376561..d0f0a50 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/query/QueryMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/query/QueryMetrics.java
@@ -59,4 +59,4 @@ public interface QueryMetrics {
* @return Total number of times a query execution failed.
*/
public int fails();
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/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 f65bf52..f9c114b 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
@@ -209,6 +209,9 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
/** Default timeout after which long query warning will be printed. */
public static final long DFLT_LONG_QRY_WARN_TIMEOUT = 3000;
+ /** Default number of queries detail metrics to collect. */
+ public static final int DFLT_QRY_DETAIL_METRICS_SIZE = 0;
+
/** Default size for onheap SQL row cache size. */
public static final int DFLT_SQL_ONHEAP_ROW_CACHE_SIZE = 10 * 1024;
@@ -361,6 +364,9 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
/** */
private long longQryWarnTimeout = DFLT_LONG_QRY_WARN_TIMEOUT;
+ /** */
+ private int qryDetailMetricsSz = DFLT_QRY_DETAIL_METRICS_SIZE;
+
/**
* Flag indicating whether data can be read from backup.
* If {@code false} always get data from primary node (never from backup).
@@ -468,6 +474,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
nodeFilter = cc.getNodeFilter();
pluginCfgs = cc.getPluginConfigurations();
qryEntities = cc.getQueryEntities() == Collections.<QueryEntity>emptyList() ? null : cc.getQueryEntities();
+ qryDetailMetricsSz = cc.getQueryDetailMetricsSize();
readFromBackup = cc.isReadFromBackup();
rebalanceBatchSize = cc.getRebalanceBatchSize();
rebalanceBatchesPrefetchCount = cc.getRebalanceBatchesPrefetchCount();
@@ -1824,6 +1831,29 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
}
/**
+ * Gets size of queries detail metrics that will be stored in memory for monitoring purposes.
+ * If {@code 0} then history will not be collected.
+ * Note, larger number may lead to higher memory consumption.
+ *
+ * @return Maximum number of query metrics that will be stored in memory.
+ */
+ public int getQueryDetailMetricsSize() {
+ return qryDetailMetricsSz;
+ }
+
+ /**
+ * Sets size of queries detail metrics that will be stored in memory for monitoring purposes.
+ *
+ * @param qryDetailMetricsSz Maximum number of latest queries metrics that will be stored in memory.
+ * @return {@code this} for chaining.
+ */
+ public CacheConfiguration<K, V> setQueryDetailMetricsSize(int qryDetailMetricsSz) {
+ this.qryDetailMetricsSz = qryDetailMetricsSz;
+
+ return this;
+ }
+
+ /**
* Gets custom name of the sql schema. If custom sql schema is not set then {@code null} will be returned and
* quoted case sensitive name will be used as sql schema.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtilityKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtilityKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtilityKey.java
index 48b6b45..8110170 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtilityKey.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtilityKey.java
@@ -27,8 +27,8 @@ public abstract class GridCacheUtilityKey<K extends GridCacheUtilityKey> impleme
private static final long serialVersionUID = 0L;
/** {@inheritDoc} */
- @SuppressWarnings("unchecked") @Override
- public final boolean equals(Object obj) {
+ @SuppressWarnings("unchecked")
+ @Override public final boolean equals(Object obj) {
return obj == this || obj != null && obj.getClass() == getClass() && equalsx((K)obj);
}
@@ -42,4 +42,4 @@ public abstract class GridCacheUtilityKey<K extends GridCacheUtilityKey> impleme
/** {@inheritDoc} */
public abstract int hashCode();
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index 297ec68..f87fa1d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -51,6 +51,7 @@ import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.cache.query.ContinuousQuery;
import org.apache.ignite.cache.query.Query;
import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cache.query.QueryDetailMetrics;
import org.apache.ignite.cache.query.QueryMetrics;
import org.apache.ignite.cache.query.ScanQuery;
import org.apache.ignite.cache.query.SpiQuery;
@@ -63,10 +64,10 @@ import org.apache.ignite.internal.AsyncSupportAdapter;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.binary.BinaryUtils;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.query.CacheQuery;
import org.apache.ignite.internal.processors.cache.query.CacheQueryFuture;
+import org.apache.ignite.internal.processors.cache.query.GridCacheQueryType;
import org.apache.ignite.internal.processors.query.GridQueryProcessor;
import org.apache.ignite.internal.util.GridCloseableIteratorAdapter;
import org.apache.ignite.internal.util.GridEmptyIterator;
@@ -243,6 +244,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
}
+ /** {@inheritDoc} */
@Override public CacheMetrics localMetrics() {
GridCacheGateway<K, V> gate = this.gate;
@@ -270,6 +272,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
}
+ /** {@inheritDoc} */
@Override public CacheMetricsMXBean localMxBean() {
GridCacheGateway<K, V> gate = this.gate;
@@ -491,8 +494,8 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
if (grp != null)
qry.projection(grp);
- final GridCloseableIterator<R> iter = ctx.kernalContext().query().executeQuery(ctx,
- new IgniteOutClosureX<GridCloseableIterator<R>>() {
+ final GridCloseableIterator<R> iter = ctx.kernalContext().query().executeQuery(GridCacheQueryType.SCAN,
+ ctx.name(), ctx, new IgniteOutClosureX<GridCloseableIterator<R>>() {
@Override public GridCloseableIterator<R> applyx() throws IgniteCheckedException {
final GridCloseableIterator iter0 = qry.executeScanQuery();
@@ -520,7 +523,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
};
}
- }, false);
+ }, true);
return new QueryCursorImpl<>(iter);
}
@@ -547,7 +550,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
if (grp != null)
qry.projection(grp);
- fut = ctx.kernalContext().query().executeQuery(ctx,
+ fut = ctx.kernalContext().query().executeQuery(GridCacheQueryType.TEXT, p.getText(), ctx,
new IgniteOutClosureX<CacheQueryFuture<Map.Entry<K, V>>>() {
@Override public CacheQueryFuture<Map.Entry<K, V>> applyx() throws IgniteCheckedException {
return qry.execute();
@@ -560,8 +563,8 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
if (grp != null)
qry.projection(grp);
- fut = ctx.kernalContext().query().executeQuery(ctx,
- new IgniteOutClosureX<CacheQueryFuture<Cache.Entry<K, V>>>() {
+ fut = ctx.kernalContext().query().executeQuery(GridCacheQueryType.SPI, filter.getClass().getSimpleName(),
+ ctx, new IgniteOutClosureX<CacheQueryFuture<Cache.Entry<K, V>>>() {
@Override public CacheQueryFuture<Cache.Entry<K, V>> applyx() throws IgniteCheckedException {
return qry.execute(((SpiQuery)filter).getArgs());
}
@@ -887,6 +890,48 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public void resetQueryMetrics() {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ delegate.context().queries().resetMetrics();
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<? extends QueryDetailMetrics> queryDetailMetrics() {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return delegate.context().queries().detailMetrics();
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void resetQueryDetailMetrics() {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ delegate.context().queries().resetDetailMetrics();
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public void localEvict(Collection<? extends K> keys) {
GridCacheGateway<K, V> gate = this.gate;
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQuery.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQuery.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQuery.java
index 3fa041b..a7dbe2a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQuery.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQuery.java
@@ -17,7 +17,6 @@
package org.apache.ignite.internal.processors.cache.query;
-import java.util.Map;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.affinity.AffinityKey;
import org.apache.ignite.cache.query.Query;
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueryType.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueryType.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueryType.java
index bb8bc33..fa0f3df 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueryType.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueryType.java
@@ -44,4 +44,4 @@ public enum CacheQueryType {
/** SPI query. */
SPI
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
index f65b733..2355591 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
@@ -434,16 +434,6 @@ public class GridCacheQueryAdapter<T> implements CacheQuery<T> {
throw new IgniteCheckedException("Indexing is disabled for cache: " + cctx.cache().name());
}
- /**
- * @param res Query result.
- * @param err Error or {@code null} if query executed successfully.
- * @param startTime Start time.
- * @param duration Duration.
- */
- public void onCompleted(Object res, Throwable err, long startTime, long duration) {
- GridQueryProcessor.onCompleted(cctx, res, err, startTime, duration, log);
- }
-
/** {@inheritDoc} */
@Override public CacheQueryFuture<T> execute(@Nullable Object... args) {
return execute0(null, args);
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryDetailMetricsAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryDetailMetricsAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryDetailMetricsAdapter.java
new file mode 100644
index 0000000..a477360
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryDetailMetricsAdapter.java
@@ -0,0 +1,248 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.query;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.cache.query.QueryDetailMetrics;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+/**
+ * Adapter for {@link QueryDetailMetrics}.
+ */
+public class GridCacheQueryDetailMetricsAdapter implements QueryDetailMetrics, Externalizable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Query type to track metrics. */
+ private GridCacheQueryType qryType;
+
+ /** Textual query representation. */
+ private String qry;
+
+ /** Cache name. */
+ private String cache;
+
+ /** Number of executions. */
+ private int execs;
+
+ /** Number of completions executions. */
+ private int completions;
+
+ /** Number of failures. */
+ private int failures;
+
+ /** Minimum time of execution. */
+ private long minTime = -1;
+
+ /** Maximum time of execution. */
+ private long maxTime;
+
+ /** Sum of execution time of completions time. */
+ private long totalTime;
+
+ /** Sum of execution time of completions time. */
+ private long lastStartTime;
+
+ /** Cached metrics group key.*/
+ private GridCacheQueryDetailMetricsKey key;
+
+ /**
+ * Required by {@link Externalizable}.
+ */
+ public GridCacheQueryDetailMetricsAdapter() {
+ // No-op.
+ }
+
+ /**
+ * Constructor with metrics.
+ *
+ * @param qryType Query type.
+ * @param qry Textual query representation.
+ * @param cache Cache name where query was executed.
+ * @param startTime Duration of queue execution.
+ * @param duration Duration of queue execution.
+ * @param failed {@code True} query executed unsuccessfully {@code false} otherwise.
+ */
+ public GridCacheQueryDetailMetricsAdapter(GridCacheQueryType qryType, String qry, String cache, long startTime,
+ long duration, boolean failed) {
+ this.qryType = qryType;
+ this.qry = qryType == GridCacheQueryType.SCAN && qry == null ? cache : qry;
+ this.cache = cache;
+
+ if (failed) {
+ execs = 1;
+ failures = 1;
+ }
+ else {
+ execs = 1;
+ completions = 1;
+ totalTime = duration;
+ minTime = duration;
+ maxTime = duration;
+ }
+
+ lastStartTime = startTime;
+ }
+
+ /**
+ * Copy constructor.
+ *
+ * @param qryType Query type.
+ * @param qry Textual query representation.
+ * @param cache Cache name where query was executed.
+ */
+ public GridCacheQueryDetailMetricsAdapter(GridCacheQueryType qryType, String qry, String cache,
+ int execs, int completions, int failures, long minTime, long maxTime, long totalTime, long lastStartTime,
+ GridCacheQueryDetailMetricsKey key) {
+ this.qryType = qryType;
+ this.qry = qry;
+ this.cache = cache;
+ this.execs = execs;
+ this.completions = completions;
+ this.failures = failures;
+ this.minTime = minTime;
+ this.maxTime = maxTime;
+ this.totalTime = totalTime;
+ this.lastStartTime = lastStartTime;
+ this.key = key;
+ }
+
+ /**
+ * @return Metrics group key.
+ */
+ public GridCacheQueryDetailMetricsKey key() {
+ if (key == null)
+ key = new GridCacheQueryDetailMetricsKey(qryType, qry);
+
+ return key;
+ }
+
+ /**
+ * Aggregate metrics.
+ *
+ * @param m Other metrics to take into account.
+ * @return Aggregated metrics.
+ */
+ public GridCacheQueryDetailMetricsAdapter aggregate(QueryDetailMetrics m) {
+ return new GridCacheQueryDetailMetricsAdapter(
+ qryType,
+ qry,
+ m.cache(),
+ execs + m.executions(),
+ completions + m.completions(),
+ failures + m.failures(),
+ minTime < 0 || minTime > m.minimumTime() ? m.minimumTime() : minTime,
+ maxTime < m.maximumTime() ? m.maximumTime() : maxTime,
+ totalTime + m.totalTime(),
+ lastStartTime < m.lastStartTime() ? m.lastStartTime() : lastStartTime,
+ key
+ );
+ }
+
+ /** {@inheritDoc} */
+ @Override public String queryType() {
+ return qryType.name();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String query() {
+ return qry;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String cache() {
+ return cache;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int executions() {
+ return execs;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int completions() {
+ return completions;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int failures() {
+ return failures;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long minimumTime() {
+ return minTime < 0 ? 0 : minTime;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long maximumTime() {
+ return maxTime;
+ }
+
+ /** {@inheritDoc} */
+ @Override public double averageTime() {
+ double val = completions;
+
+ return val > 0 ? totalTime / val : 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long totalTime() {
+ return totalTime;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long lastStartTime() {
+ return lastStartTime;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ U.writeEnum(out, qryType);
+ U.writeString(out, qry);
+ U.writeString(out, cache);
+ out.writeInt(execs);
+ out.writeInt(completions);
+ out.writeLong(minTime);
+ out.writeLong(maxTime);
+ out.writeLong(totalTime);
+ out.writeLong(lastStartTime);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ qryType = GridCacheQueryType.fromOrdinal(in.readByte());
+ qry = U.readString(in);
+ cache = U.readString(in);
+ execs = in.readInt();
+ completions = in.readInt();
+ minTime = in.readLong();
+ maxTime = in.readLong();
+ totalTime = in.readLong();
+ lastStartTime = in.readLong();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridCacheQueryDetailMetricsAdapter.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryDetailMetricsKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryDetailMetricsKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryDetailMetricsKey.java
new file mode 100644
index 0000000..eb70cd1
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryDetailMetricsKey.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.query;
+
+import org.apache.ignite.internal.util.typedef.F;
+
+/**
+ * Immutable query metrics key used to group metrics.
+ */
+public class GridCacheQueryDetailMetricsKey {
+ /** Query type to track metrics. */
+ private final GridCacheQueryType qryType;
+
+ /** Textual query representation. */
+ private final String qry;
+
+ /** Pre-calculated hash code. */
+ private final int hash;
+
+ /**
+ * Constructor.
+ *
+ * @param qryType Query type.
+ * @param qry Textual query representation.
+ */
+ public GridCacheQueryDetailMetricsKey(GridCacheQueryType qryType, String qry) {
+ assert qryType != null;
+ assert qryType != GridCacheQueryType.SQL_FIELDS || qry != null;
+
+ this.qryType = qryType;
+ this.qry = qry;
+
+ hash = 31 * qryType.hashCode() + (qry != null ? qry.hashCode() : 0);
+ }
+
+ /**
+ * @return Query type.
+ */
+ public GridCacheQueryType getQueryType() {
+ return qryType;
+ }
+
+ /**
+ * @return Textual representation of query.
+ */
+ public String getQuery() {
+ return qry;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return hash;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ GridCacheQueryDetailMetricsKey other = (GridCacheQueryDetailMetricsKey)o;
+
+ return qryType == other.qryType && F.eq(qry, other.qry);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryFutureAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryFutureAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryFutureAdapter.java
index db519f5..4b8915c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryFutureAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryFutureAdapter.java
@@ -155,8 +155,6 @@ public abstract class GridCacheQueryFutureAdapter<K, V, R> extends GridFutureAda
@Override public boolean onDone(Collection<R> res, Throwable err) {
cctx.time().removeTimeoutObject(this);
- qry.query().onCompleted(res, err, startTime(), duration());
-
return super.onDone(res, err);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
index 00a9181..ab8bd63 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
@@ -26,6 +26,7 @@ import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -46,6 +47,7 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.cache.query.QueryMetrics;
import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.events.CacheQueryExecutedEvent;
import org.apache.ignite.events.CacheQueryReadEvent;
import org.apache.ignite.events.DiscoveryEvent;
@@ -80,6 +82,7 @@ import org.apache.ignite.internal.processors.query.GridQueryIndexType;
import org.apache.ignite.internal.processors.query.GridQueryProcessor;
import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
import org.apache.ignite.internal.processors.task.GridInternal;
+import org.apache.ignite.internal.util.GridBoundedPriorityQueue;
import org.apache.ignite.internal.util.GridCloseableIteratorAdapter;
import org.apache.ignite.internal.util.GridEmptyCloseableIterator;
import org.apache.ignite.internal.util.GridEmptyIterator;
@@ -134,8 +137,37 @@ import static org.apache.ignite.internal.processors.cache.query.GridCacheQueryTy
*/
@SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapter<K, V> {
+ /** Maximum number of query detail metrics to evict at once. */
+ private static final int QRY_DETAIL_METRICS_EVICTION_LIMIT = 10_000;
+
+ /** Comparator for priority queue with query detail metrics with priority to new metrics. */
+ private static final Comparator<GridCacheQueryDetailMetricsAdapter> QRY_DETAIL_METRICS_PRIORITY_NEW_CMP =
+ new Comparator<GridCacheQueryDetailMetricsAdapter>() {
+ @Override public int compare(GridCacheQueryDetailMetricsAdapter m1, GridCacheQueryDetailMetricsAdapter m2) {
+ return Long.compare(m1.lastStartTime(), m2.lastStartTime());
+ }
+ };
+
+ /** Comparator for priority queue with query detail metrics with priority to old metrics. */
+ private static final Comparator<GridCacheQueryDetailMetricsAdapter> QRY_DETAIL_METRICS_PRIORITY_OLD_CMP =
+ new Comparator<GridCacheQueryDetailMetricsAdapter>() {
+ @Override public int compare(GridCacheQueryDetailMetricsAdapter m1, GridCacheQueryDetailMetricsAdapter m2) {
+ return Long.compare(m2.lastStartTime(), m1.lastStartTime());
+ }
+ };
+
+ /** Function to merge query detail metrics. */
+ private static final ConcurrentHashMap8.BiFun QRY_DETAIL_METRICS_MERGE_FX =
+ new ConcurrentHashMap8.BiFun<GridCacheQueryDetailMetricsAdapter,
+ GridCacheQueryDetailMetricsAdapter, GridCacheQueryDetailMetricsAdapter>() {
+ @Override public GridCacheQueryDetailMetricsAdapter apply(GridCacheQueryDetailMetricsAdapter oldVal,
+ GridCacheQueryDetailMetricsAdapter newVal) {
+ return oldVal.aggregate(newVal);
+ }
+ };
+
/** */
- protected GridQueryProcessor qryProc;
+ private GridQueryProcessor qryProc;
/** */
private String space;
@@ -147,8 +179,13 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
private volatile GridCacheQueryMetricsAdapter metrics = new GridCacheQueryMetricsAdapter();
/** */
- private final ConcurrentMap<UUID, RequestFutureMap> qryIters =
- new ConcurrentHashMap8<>();
+ private int detailMetricsSz;
+
+ /** */
+ private ConcurrentHashMap8<GridCacheQueryDetailMetricsKey, GridCacheQueryDetailMetricsAdapter> detailMetrics;
+
+ /** */
+ private final ConcurrentMap<UUID, RequestFutureMap> qryIters = new ConcurrentHashMap8<>();
/** */
private final ConcurrentMap<UUID, Map<Long, GridFutureAdapter<FieldsResult>>> fieldsQryRes =
@@ -171,10 +208,18 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
/** {@inheritDoc} */
@Override public void start0() throws IgniteCheckedException {
+ CacheConfiguration ccfg = cctx.config();
+
qryProc = cctx.kernalContext().query();
space = cctx.name();
- maxIterCnt = cctx.config().getMaxQueryIteratorsCount();
+ maxIterCnt = ccfg.getMaxQueryIteratorsCount();
+
+ detailMetricsSz = ccfg.getQueryDetailMetricsSize();
+
+ if (detailMetricsSz > 0)
+ detailMetrics = new ConcurrentHashMap8<>(detailMetricsSz);
+
lsnr = new GridLocalEventListener() {
@Override public void onEvent(Event evt) {
UUID nodeId = ((DiscoveryEvent)evt).eventNode().id();
@@ -213,7 +258,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
cctx.events().addListener(lsnr, EVT_NODE_LEFT, EVT_NODE_FAILED);
- enabled = GridQueryProcessor.isEnabled(cctx.config());
+ enabled = GridQueryProcessor.isEnabled(ccfg);
qryTopVer = cctx.startTopologyVersion();
@@ -1691,6 +1736,8 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
long startTime = U.currentTimeMillis();
+ final String namex = cctx.namex();
+
try {
assert qry.type() == SCAN;
@@ -1699,7 +1746,6 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
final String taskName = cctx.kernalContext().task().resolveTaskName(qry.taskHash());
final IgniteBiPredicate filter = qry.scanFilter();
- final String namex = cctx.namex();
final ClusterNode locNode = cctx.localNode();
final UUID subjId = qry.subjectId();
@@ -1721,12 +1767,9 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
final GridCloseableIterator<IgniteBiTuple<K, V>> iter = scanIterator(qry, true);
- if (updStatisticsIfNeeded) {
+ if (updStatisticsIfNeeded)
needUpdStatistics = false;
- cctx.queries().onCompleted(U.currentTimeMillis() - startTime, false);
- }
-
final boolean readEvt = cctx.gridEvents().isRecordable(EVT_CACHE_QUERY_OBJECT_READ);
return new GridCloseableIteratorAdapter<Object>() {
@@ -1789,7 +1832,8 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
}
catch (Exception e) {
if (needUpdStatistics)
- cctx.queries().onCompleted(U.currentTimeMillis() - startTime, true);
+ cctx.queries().collectMetrics(GridCacheQueryType.SCAN, namex, startTime,
+ U.currentTimeMillis() - startTime, true);
throw e;
}
@@ -2071,6 +2115,52 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
}
/**
+ * Gets cache queries detailed metrics.
+ * Detail metrics could be enabled by setting non-zero value via {@link CacheConfiguration#setQueryDetailMetricsSize(int)}
+ *
+ * @return Cache queries metrics aggregated by query type and query text.
+ */
+ public Collection<GridCacheQueryDetailMetricsAdapter> detailMetrics() {
+ if (detailMetricsSz > 0) {
+ // Return no more than latest detailMetricsSz items.
+ if (detailMetrics.size() > detailMetricsSz) {
+ GridBoundedPriorityQueue<GridCacheQueryDetailMetricsAdapter> latestMetrics =
+ new GridBoundedPriorityQueue<>(detailMetricsSz, QRY_DETAIL_METRICS_PRIORITY_NEW_CMP);
+
+ latestMetrics.addAll(detailMetrics.values());
+
+ return latestMetrics;
+ }
+
+ return new ArrayList<>(detailMetrics.values());
+ }
+
+ return Collections.emptyList();
+ }
+
+ /**
+ * Evict detail metrics.
+ */
+ public void evictDetailMetrics() {
+ if (detailMetricsSz > 0) {
+ int sz = detailMetrics.size();
+
+ if (sz > detailMetricsSz) {
+ // Limit number of metrics to evict in order make eviction time predictable.
+ int evictCnt = Math.min(QRY_DETAIL_METRICS_EVICTION_LIMIT, sz - detailMetricsSz);
+
+ Queue<GridCacheQueryDetailMetricsAdapter> metricsToEvict =
+ new GridBoundedPriorityQueue<>(evictCnt, QRY_DETAIL_METRICS_PRIORITY_OLD_CMP);
+
+ metricsToEvict.addAll(detailMetrics.values());
+
+ for (GridCacheQueryDetailMetricsAdapter m : metricsToEvict)
+ detailMetrics.remove(m.key());
+ }
+ }
+ }
+
+ /**
* Resets metrics.
*/
public void resetMetrics() {
@@ -2078,18 +2168,43 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
}
/**
- * @param fail {@code true} if execution failed.
+ * Resets detail metrics.
*/
- public void onExecuted(boolean fail) {
- metrics.onQueryExecute(fail);
+ public void resetDetailMetrics() {
+ if (detailMetrics != null)
+ detailMetrics.clear();
}
/**
+ * @param qryType Query type.
+ * @param qry Query description.
+ * @param startTime Query start size.
* @param duration Execution duration.
- * @param fail {@code true} if execution failed.
+ * @param failed {@code True} if query execution failed.
*/
- public void onCompleted(long duration, boolean fail) {
- metrics.onQueryCompleted(duration, fail);
+ public void collectMetrics(GridCacheQueryType qryType, String qry, long startTime, long duration, boolean failed) {
+ metrics.update(duration, failed);
+
+ if (detailMetricsSz > 0) {
+ // Do not collect metrics for EXPLAIN queries.
+ if (qryType == SQL_FIELDS && !F.isEmpty(qry)) {
+ int off = 0;
+ int len = qry.length();
+
+ while (off < len && Character.isWhitespace(qry.charAt(off)))
+ off++;
+
+ if (qry.regionMatches(true, off, "EXPLAIN", 0, 7))
+ return;
+ }
+
+ GridCacheQueryDetailMetricsAdapter m = new GridCacheQueryDetailMetricsAdapter(qryType, qry,
+ cctx.name(), startTime, duration, failed);
+
+ GridCacheQueryDetailMetricsKey key = m.key();
+
+ detailMetrics.merge(key, m, QRY_DETAIL_METRICS_MERGE_FX);
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryMetricsAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryMetricsAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryMetricsAdapter.java
index e70ea9f..0bb578f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryMetricsAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryMetricsAdapter.java
@@ -100,32 +100,23 @@ public class GridCacheQueryMetricsAdapter implements QueryMetrics, Externalizabl
}
/**
- * Callback for query execution.
- *
- * @param fail {@code True} query executed unsuccessfully {@code false} otherwise.
- */
- public void onQueryExecute(boolean fail) {
- execs.increment();
-
- if (fail)
- fails.increment();
- }
-
- /**
- * Callback for completion of query execution.
+ * Update metrics.
*
* @param duration Duration of queue execution.
* @param fail {@code True} query executed unsuccessfully {@code false} otherwise.
*/
- public void onQueryCompleted(long duration, boolean fail) {
- minTime.setIfLess(duration);
- maxTime.setIfGreater(duration);
-
- if (fail)
+ public void update(long duration, boolean fail) {
+ if (fail) {
+ execs.increment();
fails.increment();
+ }
else {
+ execs.increment();
completed.increment();
+ minTime.setIfLess(duration);
+ maxTime.setIfGreater(duration);
+
sumTime.add(duration);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/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 27c0b71..8befa0e 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
@@ -70,10 +70,13 @@ import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.CacheObjectContext;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheDefaultAffinityKeyMapper;
+import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
import org.apache.ignite.internal.processors.cache.QueryCursorImpl;
import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl;
import org.apache.ignite.internal.processors.cache.query.CacheQueryFuture;
import org.apache.ignite.internal.processors.cache.query.CacheQueryType;
+import org.apache.ignite.internal.processors.cache.query.GridCacheQueryType;
+import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
import org.apache.ignite.internal.util.GridSpinBusyLock;
import org.apache.ignite.internal.util.future.GridCompoundFuture;
import org.apache.ignite.internal.util.future.GridFinishedFuture;
@@ -111,6 +114,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
/** */
private static final Class<?> GEOMETRY_CLASS = U.classForName("com.vividsolutions.jts.geom.Geometry", null);
+ /** Queries detail metrics eviction frequency. */
+ private static final int QRY_DETAIL_METRICS_EVICTION_FREQ = 3_000;
+
/** */
private static Set<Class<?>> SQL_TYPES = new HashSet<>(F.<Class<?>>asList(
Integer.class,
@@ -149,6 +155,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
private final GridQueryIndexing idx;
/** */
+ private GridTimeoutProcessor.CancelableTask qryDetailMetricsEvictTask;
+
+ /** */
private static final ThreadLocal<AffinityTopologyVersion> requestTopVer = new ThreadLocal<>();
/**
@@ -177,6 +186,14 @@ public class GridQueryProcessor extends GridProcessorAdapter {
idx.start(ctx, busyLock);
}
+
+ // Schedule queries detail metrics eviction.
+ qryDetailMetricsEvictTask = ctx.timeout().schedule(new Runnable() {
+ @Override public void run() {
+ for (IgniteCacheProxy cache : ctx.cache().jcaches())
+ cache.context().queries().evictDetailMetrics();
+ }
+ }, QRY_DETAIL_METRICS_EVICTION_FREQ, QRY_DETAIL_METRICS_EVICTION_FREQ);
}
/**
@@ -478,6 +495,8 @@ public class GridQueryProcessor extends GridProcessorAdapter {
if (idx != null)
idx.stop();
+
+ U.closeQuiet(qryDetailMetricsEvictTask);
}
/** {@inheritDoc} */
@@ -754,7 +773,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
try {
final GridCacheContext<?, ?> cctx = ctx.cache().internalCache(space).context();
- return executeQuery(cctx, new IgniteOutClosureX<GridCloseableIterator<IgniteBiTuple<K, V>>>() {
+ return executeQuery(GridCacheQueryType.SQL_FIELDS, clause, cctx, new IgniteOutClosureX<GridCloseableIterator<IgniteBiTuple<K, V>>>() {
@Override public GridCloseableIterator<IgniteBiTuple<K, V>> applyx() throws IgniteCheckedException {
TypeDescriptor type = typesByName.get(new TypeName(space, resType));
@@ -782,7 +801,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
throw new IllegalStateException("Failed to execute query (grid is stopping).");
try {
- return executeQuery(cctx, new IgniteOutClosureX<QueryCursor<List<?>>>() {
+ return executeQuery(GridCacheQueryType.SQL_FIELDS, qry.getSql(), cctx, new IgniteOutClosureX<QueryCursor<List<?>>>() {
@Override public QueryCursor<List<?>> applyx() {
return idx.queryTwoStep(cctx, qry);
}
@@ -808,11 +827,11 @@ public class GridQueryProcessor extends GridProcessorAdapter {
throw new IllegalStateException("Failed to execute query (grid is stopping).");
try {
- return executeQuery(cctx, new IgniteOutClosureX<QueryCursor<Cache.Entry<K, V>>>() {
+ return executeQuery(GridCacheQueryType.SQL, qry.getSql(), cctx, new IgniteOutClosureX<QueryCursor<Cache.Entry<K, V>>>() {
@Override public QueryCursor<Cache.Entry<K, V>> applyx() throws IgniteCheckedException {
return idx.queryTwoStep(cctx, qry);
}
- }, false);
+ }, true);
}
catch (IgniteCheckedException e) {
throw new IgniteException(e);
@@ -837,8 +856,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
throw new IllegalStateException("Failed to execute query (grid is stopping).");
try {
- return executeQuery(
- cctx,
+ return executeQuery(GridCacheQueryType.SQL, qry.getSql(), cctx,
new IgniteOutClosureX<Iterator<Cache.Entry<K, V>>>() {
@Override public Iterator<Cache.Entry<K, V>> applyx() throws IgniteCheckedException {
String space = cctx.name();
@@ -887,7 +905,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}
};
}
- }, false);
+ }, true);
}
catch (IgniteCheckedException e) {
throw new IgniteException(e);
@@ -956,7 +974,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
try {
final boolean keepBinary = cctx.keepBinary();
- return executeQuery(cctx, new IgniteOutClosureX<QueryCursor<List<?>>>() {
+ return executeQuery(GridCacheQueryType.SQL_FIELDS, qry.getSql(), cctx, new IgniteOutClosureX<QueryCursor<List<?>>>() {
@Override public QueryCursor<List<?>> applyx() throws IgniteCheckedException {
final String space = cctx.name();
final String sql = qry.getSql();
@@ -1115,20 +1133,21 @@ public class GridQueryProcessor extends GridProcessorAdapter {
try {
final GridCacheContext<?, ?> cctx = ctx.cache().internalCache(space).context();
- return executeQuery(cctx, new IgniteOutClosureX<GridCloseableIterator<IgniteBiTuple<K, V>>>() {
- @Override public GridCloseableIterator<IgniteBiTuple<K, V>> applyx() throws IgniteCheckedException {
- TypeDescriptor type = typesByName.get(new TypeName(space, resType));
+ return executeQuery(GridCacheQueryType.TEXT, clause, cctx,
+ new IgniteOutClosureX<GridCloseableIterator<IgniteBiTuple<K, V>>>() {
+ @Override public GridCloseableIterator<IgniteBiTuple<K, V>> applyx() throws IgniteCheckedException {
+ TypeDescriptor type = typesByName.get(new TypeName(space, resType));
- if (type == null || !type.registered())
- throw new CacheException("Failed to find SQL table for type: " + resType);
+ if (type == null || !type.registered())
+ throw new CacheException("Failed to find SQL table for type: " + resType);
- return idx.queryLocalText(
- space,
- clause,
- type,
- filters);
- }
- }, false);
+ return idx.queryLocalText(
+ space,
+ clause,
+ type,
+ filters);
+ }
+ }, true);
}
finally {
busyLock.leaveBusy();
@@ -1744,11 +1763,13 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}
/**
+ * @param qryType Query type.
+ * @param qry Query description.
* @param cctx Cache context.
* @param clo Closure.
* @param complete Complete.
*/
- public <R> R executeQuery(GridCacheContext<?, ?> cctx, IgniteOutClosureX<R> clo, boolean complete)
+ public <R> R executeQuery(GridCacheQueryType qryType, String qry, GridCacheContext<?, ?> cctx, IgniteOutClosureX<R> clo, boolean complete)
throws IgniteCheckedException {
final long startTime = U.currentTimeMillis();
@@ -1783,30 +1804,18 @@ public class GridQueryProcessor extends GridProcessorAdapter {
throw new IgniteCheckedException(e);
}
finally {
- cctx.queries().onExecuted(err != null);
-
- if (complete && err == null)
- onCompleted(cctx, res, null, startTime, U.currentTimeMillis() - startTime, log);
- }
- }
+ boolean failed = err != null;
- /**
- * @param cctx Cctx.
- * @param res Result.
- * @param err Err.
- * @param startTime Start time.
- * @param duration Duration.
- * @param log Logger.
- */
- public static void onCompleted(GridCacheContext<?, ?> cctx, Object res, Throwable err,
- long startTime, long duration, IgniteLogger log) {
- boolean fail = err != null;
+ long duration = U.currentTimeMillis() - startTime;
- cctx.queries().onCompleted(duration, fail);
+ if (complete || failed) {
+ cctx.queries().collectMetrics(qryType, qry, startTime, duration, failed);
- if (log.isTraceEnabled())
- log.trace("Query execution completed [startTime=" + startTime +
- ", duration=" + duration + ", fail=" + fail + ", res=" + res + ']');
+ if (log.isTraceEnabled())
+ log.trace("Query execution [startTime=" + startTime + ", duration=" + duration +
+ ", fail=" + failed + ", res=" + res + ']');
+ }
+ }
}
/**
@@ -2485,6 +2494,11 @@ public class GridQueryProcessor extends GridProcessorAdapter {
* The way to index.
*/
private enum IndexType {
- ASC, DESC, TEXT
+ /** Ascending index. */
+ ASC,
+ /** Descending index. */
+ DESC,
+ /** Text index. */
+ TEXT
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/util/GridBoundedPriorityQueue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridBoundedPriorityQueue.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridBoundedPriorityQueue.java
new file mode 100644
index 0000000..cbc521d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridBoundedPriorityQueue.java
@@ -0,0 +1,68 @@
+/*
+ * 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.util;
+
+import java.util.Comparator;
+import java.util.PriorityQueue;
+import org.apache.ignite.internal.util.typedef.internal.A;
+
+/**
+ * Bounded variant of {@link PriorityQueue}.
+ *
+ * @param <E> Type of the queue element.
+ */
+public class GridBoundedPriorityQueue<E> extends PriorityQueue<E> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Queue max capacity. */
+ private final int maxCap;
+
+ /** Comparator. */
+ private final Comparator<? super E> cmp;
+
+ /**
+ * Creates a bounded priority queue with the specified maximum size.
+ * At most {@code maxCap} elements would be kept in the queue.
+ *
+ * @param maxCap Maximum size of the queue.
+ * @param cmp Comparator that orders the elements.
+ */
+ public GridBoundedPriorityQueue(int maxCap, Comparator<? super E> cmp) {
+ super(maxCap, cmp);
+
+ A.notNull(cmp, "comparator not null");
+
+ this.maxCap = maxCap;
+ this.cmp = cmp;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean offer(E e) {
+ if (size() >= maxCap) {
+ E head = peek();
+
+ if (cmp.compare(e, head) <= 0)
+ return false;
+
+ poll();
+ }
+
+ return super.offer(e);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetrics.java
new file mode 100644
index 0000000..dc46906
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetrics.java
@@ -0,0 +1,167 @@
+/*
+ * 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.cache;
+
+import java.io.Serializable;
+import org.apache.ignite.cache.query.QueryDetailMetrics;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+/**
+ * Data transfer object for cache query detail metrics.
+ */
+public class VisorCacheQueryDetailMetrics implements Serializable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Query type. */
+ private String qryType;
+
+ /** Textual query representation. */
+ private String qry;
+
+ /** Cache name. */
+ private String cache;
+
+ /** Number of executions. */
+ private int execs;
+
+ /** Number of completions executions. */
+ private int completions;
+
+ /** Number of failures. */
+ private int failures;
+
+ /** Minimum time of execution. */
+ private long minTime;
+
+ /** Maximum time of execution. */
+ private long maxTime;
+
+ /** Average time of execution. */
+ private double avgTime;
+
+ /** Sum of execution time of completions time. */
+ private long totalTime;
+
+ /** Sum of execution time of completions time. */
+ private long lastStartTime;
+
+ /**
+ * @param m Cache query metrics.
+ * @return Data transfer object for given cache metrics.
+ */
+ public VisorCacheQueryDetailMetrics from(QueryDetailMetrics m) {
+ qryType = m.queryType();
+ qry = m.query();
+ cache = m.cache();
+
+ execs = m.executions();
+ completions = m.completions();
+ failures = m.failures();
+
+ minTime = m.minimumTime();
+ maxTime = m.maximumTime();
+ avgTime = m.averageTime();
+ totalTime = m.totalTime();
+ lastStartTime = m.lastStartTime();
+
+ return this;
+ }
+
+ /**
+ * @return Query type
+ */
+ public String getQueryType() {
+ return qryType;
+ }
+
+ /**
+ * @return Query type
+ */
+ public String getQuery() {
+ return qry;
+ }
+
+ /**
+ * @return Cache name where query was executed.
+ */
+ public String getCache() {
+ return cache;
+ }
+
+ /**
+ * @return Number of executions.
+ */
+ public int getExecutions() {
+ return execs;
+ }
+
+ /**
+ * @return Number of completed executions.
+ */
+ public int getCompletions() {
+ return completions;
+ }
+
+ /**
+ * @return Total number of times a query execution failed.
+ */
+ public int getFailures() {
+ return failures;
+ }
+
+ /**
+ * @return Minimum execution time of query.
+ */
+ public long getMinimumTime() {
+ return minTime;
+ }
+
+ /**
+ * @return Maximum execution time of query.
+ */
+ public long getMaximumTime() {
+ return maxTime;
+ }
+
+ /**
+ * @return Average execution time of query.
+ */
+ public double getAverageTime() {
+ return avgTime;
+ }
+
+ /**
+ * @return Total time of all query executions.
+ */
+ public long getTotalTime() {
+ return totalTime;
+ }
+
+ /**
+ * @return Latest time query was stared.
+ */
+ public long getLastStartTime() {
+ return lastStartTime;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorCacheQueryDetailMetrics.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetricsCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetricsCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetricsCollectorTask.java
new file mode 100644
index 0000000..aee5063
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetricsCollectorTask.java
@@ -0,0 +1,146 @@
+/*
+ * 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.cache;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cache.query.QueryDetailMetrics;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
+import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
+import org.apache.ignite.internal.processors.cache.query.GridCacheQueryDetailMetricsAdapter;
+import org.apache.ignite.internal.processors.cache.query.GridCacheQueryDetailMetricsKey;
+import org.apache.ignite.internal.processors.task.GridInternal;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.VisorMultiNodeTask;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.internal.processors.cache.GridCacheUtils.isIgfsCache;
+import static org.apache.ignite.internal.processors.cache.GridCacheUtils.isSystemCache;
+
+/**
+ * Task to collect cache query metrics.
+ */
+@GridInternal
+public class VisorCacheQueryDetailMetricsCollectorTask extends VisorMultiNodeTask<Long, Collection<VisorCacheQueryDetailMetrics>,
+ Collection<? extends QueryDetailMetrics>> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** {@inheritDoc} */
+ @Override protected VisorCacheQueryDetailMetricsCollectorJob job(Long arg) {
+ return new VisorCacheQueryDetailMetricsCollectorJob(arg, debug);
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override protected Collection<VisorCacheQueryDetailMetrics> reduce0(List<ComputeJobResult> results)
+ throws IgniteException {
+ Map<GridCacheQueryDetailMetricsKey, GridCacheQueryDetailMetricsAdapter> taskRes = new HashMap<>();
+
+ for (ComputeJobResult res : results) {
+ if (res.getException() != null)
+ throw res.getException();
+
+ Collection<GridCacheQueryDetailMetricsAdapter> metrics = res.getData();
+
+ VisorCacheQueryDetailMetricsCollectorJob.aggregateMetrics(-1, taskRes, metrics);
+ }
+
+ Collection<GridCacheQueryDetailMetricsAdapter> aggMetrics = taskRes.values();
+
+ Collection<VisorCacheQueryDetailMetrics> res = new ArrayList<>(aggMetrics.size());
+
+ for (GridCacheQueryDetailMetricsAdapter m : aggMetrics)
+ res.add(new VisorCacheQueryDetailMetrics().from(m));
+
+ return res;
+ }
+
+ /**
+ * Job that will actually collect query metrics.
+ */
+ private static class VisorCacheQueryDetailMetricsCollectorJob extends VisorJob<Long, Collection<? extends QueryDetailMetrics>> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Create job with specified argument.
+ *
+ * @param arg Last time when metrics were collected.
+ * @param debug Debug flag.
+ */
+ protected VisorCacheQueryDetailMetricsCollectorJob(@Nullable Long arg, boolean debug) {
+ super(arg, debug);
+ }
+
+ /**
+ * @param since Time when metrics were collected last time.
+ * @param res Response.
+ * @param metrics Metrics.
+ */
+ private static void aggregateMetrics(long since, Map<GridCacheQueryDetailMetricsKey,
+ GridCacheQueryDetailMetricsAdapter> res, Collection<GridCacheQueryDetailMetricsAdapter> metrics) {
+ for (GridCacheQueryDetailMetricsAdapter m : metrics) {
+ if (m.lastStartTime() > since) {
+ GridCacheQueryDetailMetricsKey key = m.key();
+
+ GridCacheQueryDetailMetricsAdapter aggMetrics = res.get(key);
+
+ res.put(key, aggMetrics == null ? m : aggMetrics.aggregate(m));
+ }
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override protected Collection<? extends QueryDetailMetrics> run(@Nullable Long arg) throws IgniteException {
+ assert arg != null;
+
+ IgniteConfiguration cfg = ignite.configuration();
+
+ GridCacheProcessor cacheProc = ignite.context().cache();
+
+ Collection<String> cacheNames = cacheProc.cacheNames();
+
+ Map<GridCacheQueryDetailMetricsKey, GridCacheQueryDetailMetricsAdapter> aggMetrics = new HashMap<>();
+
+ for (String cacheName : cacheNames) {
+ if (!isSystemCache(cacheName) && !isIgfsCache(cfg, cacheName)) {
+ IgniteInternalCache<Object, Object> cache = cacheProc.cache(cacheName);
+
+ if (cache == null || !cache.context().started())
+ continue;
+
+ aggregateMetrics(arg, aggMetrics, cache.context().queries().detailMetrics());
+ }
+ }
+
+ return new ArrayList<>(aggMetrics.values());
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorCacheQueryDetailMetricsCollectorJob.class, this);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryDetailMetricsTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryDetailMetricsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryDetailMetricsTask.java
new file mode 100644
index 0000000..84aae9d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryDetailMetricsTask.java
@@ -0,0 +1,71 @@
+/*
+ * 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.cache;
+
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.internal.processors.task.GridInternal;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.VisorOneNodeTask;
+
+/**
+ * Reset query detail metrics.
+ */
+@GridInternal
+public class VisorCacheResetQueryDetailMetricsTask extends VisorOneNodeTask<Void, Void> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** {@inheritDoc} */
+ @Override protected VisorCacheResetQueryDetailMetricsJob job(Void arg) {
+ return new VisorCacheResetQueryDetailMetricsJob(arg, debug);
+ }
+
+ /**
+ * Job that reset query detail metrics.
+ */
+ private static class VisorCacheResetQueryDetailMetricsJob extends VisorJob<Void, Void> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * @param arg Task argument.
+ * @param debug Debug flag.
+ */
+ private VisorCacheResetQueryDetailMetricsJob(Void arg, boolean debug) {
+ super(arg, debug);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected Void run(Void arg) {
+ for (String cacheName : ignite.cacheNames()) {
+ IgniteCache cache = ignite.cache(cacheName);
+
+ if (cache != null)
+ cache.resetQueryDetailMetrics();
+ }
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorCacheResetQueryDetailMetricsJob.class, this);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryMetricsTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryMetricsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryMetricsTask.java
index 96d9857..5ba6156 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryMetricsTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryMetricsTask.java
@@ -17,7 +17,7 @@
package org.apache.ignite.internal.visor.cache;
-import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
+import org.apache.ignite.IgniteCache;
import org.apache.ignite.internal.processors.task.GridInternal;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.visor.VisorJob;
@@ -53,10 +53,10 @@ public class VisorCacheResetQueryMetricsTask extends VisorOneNodeTask<String, Vo
/** {@inheritDoc} */
@Override protected Void run(String cacheName) {
- IgniteInternalCache cache = ignite.cachex(cacheName);
+ IgniteCache cache = ignite.cache(cacheName);
if (cache != null)
- cache.context().queries().resetMetrics();
+ cache.resetQueryMetrics();
return null;
}
@@ -66,4 +66,4 @@ public class VisorCacheResetQueryMetricsTask extends VisorOneNodeTask<String, Vo
return S.toString(VisorCacheResetQueryMetricsJob.class, this);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
index 25aaab5..1e9346c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
@@ -158,8 +158,8 @@ public class VisorTaskUtils {
* @param name Grid-style nullable name.
* @return Name with {@code null} replaced to <default>.
*/
- public static String escapeName(@Nullable String name) {
- return name == null ? DFLT_EMPTY_NAME : name;
+ public static String escapeName(@Nullable Object name) {
+ return name == null ? DFLT_EMPTY_NAME : name.toString();
}
/**
@@ -173,15 +173,6 @@ public class VisorTaskUtils {
}
/**
- * @param a First name.
- * @param b Second name.
- * @return {@code true} if both names equals.
- */
- public static boolean safeEquals(@Nullable String a, @Nullable String b) {
- return (a != null && b != null) ? a.equals(b) : (a == null && b == null);
- }
-
- /**
* Concat arrays in one.
*
* @param arrays Arrays.
@@ -637,12 +628,10 @@ public class VisorTaskUtils {
else {
int toRead = Math.min(blockSz, (int)(fSz - pos));
- byte[] buf = new byte[toRead];
-
raf = new RandomAccessFile(file, "r");
-
raf.seek(pos);
+ byte[] buf = new byte[toRead];
int cntRead = raf.read(buf, 0, toRead);
if (cntRead != toRead)
@@ -887,8 +876,6 @@ public class VisorTaskUtils {
try {
for (int i = 0; i < nodesToStart; i++) {
if (U.isMacOs()) {
- StringBuilder envs = new StringBuilder();
-
Map<String, String> macEnv = new HashMap<>(System.getenv());
if (envVars != null) {
@@ -905,6 +892,8 @@ public class VisorTaskUtils {
macEnv.put(ent.getKey(), ent.getValue());
}
+ StringBuilder envs = new StringBuilder();
+
for (Map.Entry<String, String> entry : macEnv.entrySet()) {
String val = entry.getValue();
@@ -1024,13 +1013,12 @@ public class VisorTaskUtils {
ByteArrayOutputStream bos = new ByteArrayOutputStream(initBufSize);
try (ZipOutputStream zos = new ZipOutputStream(bos)) {
- ZipEntry entry = new ZipEntry("");
-
try {
+ ZipEntry entry = new ZipEntry("");
+
entry.setSize(input.length);
zos.putNextEntry(entry);
-
zos.write(input);
}
finally {