You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2016/04/28 16:20:07 UTC
[1/7] ignite git commit: Simplifying DHT request/response APIs.
Repository: ignite
Updated Branches:
refs/heads/ignite-2523-1-resp-dht [created] bb97c217c
Simplifying DHT request/response APIs.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9833dab5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9833dab5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9833dab5
Branch: refs/heads/ignite-2523-1-resp-dht
Commit: 9833dab563e6b33cc3856e5e089eaf6a22bde4d8
Parents: f163aba
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Apr 28 14:45:37 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Apr 28 14:45:37 2016 +0300
----------------------------------------------------------------------
.../dht/atomic/GridDhtAtomicCache.java | 2 +-
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 33 ++++++++++++--------
.../dht/atomic/GridDhtAtomicUpdateRequest.java | 11 ++++---
.../dht/atomic/GridDhtAtomicUpdateResponse.java | 33 +++++++++++++++-----
.../distributed/near/GridNearAtomicCache.java | 5 +--
5 files changed, 55 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/9833dab5/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 2c0417c..a093fa5 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
@@ -3066,7 +3066,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
((GridNearAtomicCache<K, V>)near()).processDhtAtomicUpdateRequest(nodeId, req, res);
try {
- if (res.failedKeys() != null || res.nearEvicted() != null || req.writeSynchronizationMode() == FULL_SYNC)
+ if (res.failedCount() > 0 || res.nearEvictedCount() > 0 || req.writeSynchronizationMode() == FULL_SYNC)
ctx.io().send(nodeId, res, ctx.ioPolicy());
else {
// No failed keys and sync mode is not FULL_SYNC, thus sending deferred response.
http://git-wip-us.apache.org/repos/asf/ignite/blob/9833dab5/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 82238e0..0043bf1 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
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicReference;
@@ -43,7 +44,6 @@ 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;
@@ -412,24 +412,31 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
* @param nodeId Backup node ID.
* @param updateRes Update response.
*/
+ @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
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 (updateRes.error() != null) {
+ List<KeyCacheObject> failed = new ArrayList<>(updateRes.failedCount());
- if (!F.isEmpty(updateRes.nearEvicted())) {
- for (KeyCacheObject key : updateRes.nearEvicted()) {
- GridDhtCacheEntry entry = nearReadersEntries.get(key);
+ for (int i = 0; i < updateRes.failedCount(); i++)
+ failed.add(updateRes.failed(i));
- try {
- entry.removeReader(nodeId, updateRes.messageId());
- }
- catch (GridCacheEntryRemovedException e) {
- if (log.isDebugEnabled())
- log.debug("Entry with evicted reader was removed [entry=" + entry + ", err=" + e + ']');
- }
+ this.updateRes.addFailedKeys(failed, updateRes.error());
+ }
+
+ for (int i = 0; i < updateRes.nearEvictedCount(); i++) {
+ KeyCacheObject key = updateRes.nearEvicted(i);
+
+ GridDhtCacheEntry entry = nearReadersEntries.get(key);
+
+ try {
+ entry.removeReader(nodeId, updateRes.messageId());
+ }
+ catch (GridCacheEntryRemovedException e) {
+ if (log.isDebugEnabled())
+ log.debug("Entry with evicted reader was removed [entry=" + entry + ", err=" + e + ']');
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9833dab5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
index 6b050b1..ed275ca 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
@@ -20,7 +20,6 @@ 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.Collection;
import java.util.List;
import java.util.UUID;
import javax.cache.processor.EntryProcessor;
@@ -38,6 +37,7 @@ import org.apache.ignite.internal.processors.cache.KeyCacheObject;
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.F;
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.MessageCollectionItemType;
@@ -442,10 +442,13 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
}
/**
- * @return Keys.
+ * Check whether the followin key exist.
+ *
+ * @param key Key.
+ * @return {@code True} if exist.
*/
- public Collection<KeyCacheObject> keys() {
- return keys;
+ public boolean hasKey(KeyCacheObject key) {
+ return F.contains(keys, key);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/9833dab5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
index 383e515..7099a4d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
@@ -20,7 +20,6 @@ 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.Collection;
import java.util.List;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.GridDirectCollection;
@@ -113,10 +112,20 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage implements Gri
}
/**
- * @return Failed keys.
+ * @return Amount of failed keys.
*/
- public Collection<KeyCacheObject> failedKeys() {
- return failedKeys;
+ public int failedCount() {
+ return failedKeys != null ? failedKeys.size() : 0;
+ }
+
+ /**
+ * Return failed key.
+ *
+ * @param idx Index.
+ * @return Failed key.
+ */
+ public KeyCacheObject failed(int idx) {
+ return failedKeys.get(idx);
}
/**
@@ -138,10 +147,20 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage implements Gri
}
/**
- * @return Evicted readers.
+ * @return Amount of near evicted keys.
+ */
+ public int nearEvictedCount() {
+ return nearEvicted != null ? nearEvicted.size() : 0;
+ }
+
+ /**
+ * Return near evicted key.
+ *
+ * @param idx Index.
+ * @return Near evicted key.
*/
- public Collection<KeyCacheObject> nearEvicted() {
- return nearEvicted;
+ public KeyCacheObject nearEvicted(int idx) {
+ return nearEvicted.get(idx);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/9833dab5/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 97be2eb..febf0b5 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
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.cache.distributed.near;
import java.io.Externalizable;
import java.util.Collection;
import java.util.Collections;
-import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
@@ -314,8 +313,6 @@ public class GridNearAtomicCache<K, V> extends GridNearCacheAdapter<K, V> {
assert ver != null;
- Collection<KeyCacheObject> backupKeys = req.keys();
-
boolean intercept = req.forceTransformBackups() && ctx.config().getInterceptor() != null;
String taskName = ctx.kernalContext().task().resolveTaskName(req.taskNameHash());
@@ -334,7 +331,7 @@ public class GridNearAtomicCache<K, V> extends GridNearCacheAdapter<K, V> {
break;
}
- if (F.contains(backupKeys, key)) { // Reader became backup.
+ if (req.hasKey(key)) { // Reader became backup.
if (entry.markObsolete(ver))
removeEntry(entry);
[5/7] ignite git commit: Minors.
Posted by vo...@apache.org.
Minors.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/31604dd1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/31604dd1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/31604dd1
Branch: refs/heads/ignite-2523-1-resp-dht
Commit: 31604dd11768ac1d8a7c4959909e44157712a079
Parents: f32f1d8
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Apr 28 16:47:48 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Apr 28 16:47:48 2016 +0300
----------------------------------------------------------------------
.../GridDhtAtomicAbstractUpdateFuture.java | 38 ++++++++++++++------
.../atomic/GridDhtAtomicSingleUpdateFuture.java | 24 +++++++++++++
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 29 ---------------
3 files changed, 52 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/31604dd1/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
index e930d1a..3fc36cb 100644
--- 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
@@ -32,6 +32,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheE
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.internal.U;
@@ -42,6 +43,7 @@ import javax.cache.processor.EntryProcessor;
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;
@@ -89,8 +91,13 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
/** Response count. */
protected volatile int resCnt;
- /** Continuous query closures. */
// TODO: Optimize.
+ /** Mappings. */
+ @GridToStringInclude
+ private Map<UUID, GridDhtAtomicUpdateRequest> mappings;
+
+ // TODO: Optimize.
+ /** Continuous query closures. */
private Collection<CI1<Boolean>> cntQryClsrs;
/**
@@ -120,6 +127,8 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
this.writeVer = writeVer;
waitForExchange = !(updateReq.topologyLocked() || (updateReq.fastMap() && !updateReq.clientRequest()));
+
+ mappings = U.newHashMap(updateReq.keysCount());
}
/**
@@ -333,7 +342,7 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
*/
public void map() {
if (mappingsCount() > 0)
- map0();
+ mapAll();
else
onDone();
@@ -344,6 +353,14 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
}
/**
+ * Internal mapping routine.
+ */
+ private void mapAll() {
+ for (GridDhtAtomicUpdateRequest req : mappings.values())
+ sendRequest(req);
+ }
+
+ /**
* @param clsr Continuous query closure.
*/
public void addContinuousQueryClosure(CI1<Boolean> clsr){
@@ -394,17 +411,14 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
protected abstract void markAllKeysFailed(@Nullable Throwable err);
/**
- * Internal mapping routine.
- */
- protected abstract void map0();
-
- /**
* Add mapping.
*
* @param nodeId Node ID.
* @param req Request.
*/
- protected abstract void mapping(UUID nodeId, GridDhtAtomicUpdateRequest req);
+ private void mapping(UUID nodeId, GridDhtAtomicUpdateRequest req) {
+ mappings.put(nodeId, req);
+ }
/**
* Get mapping for the given node ID.
@@ -412,12 +426,16 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
* @param nodeId Node ID.
* @return Mapping (if any).
*/
- @Nullable protected abstract GridDhtAtomicUpdateRequest mapping(UUID nodeId);
+ @Nullable protected GridDhtAtomicUpdateRequest mapping(UUID nodeId) {
+ return mappings.get(nodeId);
+ }
/**
* @return Mappings number.
*/
- protected abstract int mappingsCount();
+ protected int mappingsCount() {
+ return mappings != null ? mappings.size() : 0;
+ }
/**
* Add near reader entry.
http://git-wip-us.apache.org/repos/asf/ignite/blob/31604dd1/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..17b1d7f
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java
@@ -0,0 +1,24 @@
+/*
+ * 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;
+
+/**
+ * DHT atomic cache backup update future.
+ */
+public class GridDhtAtomicSingleUpdateFuture {
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/31604dd1/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 bf118ab..5f0e267 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
@@ -21,15 +21,12 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
-import java.util.UUID;
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.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.CI2;
import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
import org.jetbrains.annotations.Nullable;
/**
@@ -39,10 +36,6 @@ public class GridDhtAtomicUpdateFuture extends GridDhtAtomicAbstractUpdateFuture
/** */
private static final long serialVersionUID = 0L;
- /** Mappings. */
- @GridToStringInclude
- private final Map<UUID, GridDhtAtomicUpdateRequest> mappings;
-
/** Entries with readers. */
private Map<KeyCacheObject, GridDhtCacheEntry> nearReadersEntries;
@@ -66,7 +59,6 @@ public class GridDhtAtomicUpdateFuture extends GridDhtAtomicAbstractUpdateFuture
super(cctx, updateReq, updateRes, completionCb, writeVer);
keys = new ArrayList<>(updateReq.keysCount());
- mappings = U.newHashMap(updateReq.keysCount());
}
/**
@@ -85,27 +77,6 @@ public class GridDhtAtomicUpdateFuture extends GridDhtAtomicAbstractUpdateFuture
}
/** {@inheritDoc} */
- @Override protected void map0() {
- for (GridDhtAtomicUpdateRequest req : mappings.values())
- sendRequest(req);
- }
-
- /** {@inheritDoc} */
- @Override protected void mapping(UUID nodeId, GridDhtAtomicUpdateRequest req) {
- mappings.put(nodeId, req);
- }
-
- /** {@inheritDoc} */
- @Override @Nullable protected GridDhtAtomicUpdateRequest mapping(UUID nodeId) {
- return mappings.get(nodeId);
- }
-
- /** {@inheritDoc} */
- @Override protected int mappingsCount() {
- return mappings != null ? mappings.size() : 0;
- }
-
- /** {@inheritDoc} */
@Override protected void nearReaderEntry(KeyCacheObject key, GridDhtCacheEntry entry) {
if (nearReadersEntries == null)
nearReadersEntries = new HashMap<>();
[7/7] ignite git commit: WIP.
Posted by vo...@apache.org.
WIP.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bb97c217
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bb97c217
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bb97c217
Branch: refs/heads/ignite-2523-1-resp-dht
Commit: bb97c217c5657348d2dae4a70ceeac3c5338fe43
Parents: ed96cfc
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Apr 28 17:19:54 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Apr 28 17:19:54 2016 +0300
----------------------------------------------------------------------
.../atomic/GridDhtAtomicSingleUpdateFuture.java | 24 --------------------
1 file changed, 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bb97c217/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
deleted file mode 100644
index 17b1d7f..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java
+++ /dev/null
@@ -1,24 +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;
-
-/**
- * DHT atomic cache backup update future.
- */
-public class GridDhtAtomicSingleUpdateFuture {
-}
[6/7] ignite git commit: Optimized DHT future - less collection
creation.
Posted by vo...@apache.org.
Optimized DHT future - less collection creation.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ed96cfcb
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ed96cfcb
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ed96cfcb
Branch: refs/heads/ignite-2523-1-resp-dht
Commit: ed96cfcb051eafef3c0f939ee854fdb065c68309
Parents: 31604dd
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Apr 28 17:12:57 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Apr 28 17:12:57 2016 +0300
----------------------------------------------------------------------
.../GridDhtAtomicAbstractUpdateFuture.java | 79 +++++++++++++++-----
1 file changed, 60 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ed96cfcb/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
index 3fc36cb..8d23e41 100644
--- 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
@@ -35,13 +35,13 @@ 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 javax.cache.processor.EntryProcessor;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@@ -91,14 +91,21 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
/** Response count. */
protected volatile int resCnt;
- // TODO: Optimize.
+ /** Node for single mapping. */
+ private UUID mapSingleNode;
+
+ /** Request for single mapping. */
+ private GridDhtAtomicUpdateRequest mapSingleReq;
+
/** Mappings. */
@GridToStringInclude
private Map<UUID, GridDhtAtomicUpdateRequest> mappings;
- // TODO: Optimize.
+ /** Continuous query closure. */
+ private CI1<Boolean> cntQryClo;
+
/** Continuous query closures. */
- private Collection<CI1<Boolean>> cntQryClsrs;
+ private List<CI1<Boolean>> cntQryClos;
/**
* Constructor.
@@ -127,8 +134,6 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
this.writeVer = writeVer;
waitForExchange = !(updateReq.topologyLocked() || (updateReq.fastMap() && !updateReq.clientRequest()));
-
- mappings = U.newHashMap(updateReq.keysCount());
}
/**
@@ -356,23 +361,36 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
* Internal mapping routine.
*/
private void mapAll() {
- for (GridDhtAtomicUpdateRequest req : mappings.values())
- sendRequest(req);
+ if (mapSingleReq != null)
+ sendRequest(mapSingleReq);
+ else {
+ for (GridDhtAtomicUpdateRequest req : mappings.values())
+ sendRequest(req);
+ }
}
/**
- * @param clsr Continuous query closure.
+ * @param clo Continuous query closure.
*/
- public void addContinuousQueryClosure(CI1<Boolean> clsr){
+ public void addContinuousQueryClosure(CI1<Boolean> clo){
assert !isDone() : this;
- if (cntQryClsrs == null)
- cntQryClsrs = new ArrayList<>(10);
+ if (cntQryClo != null) {
+ cntQryClos = new ArrayList<>(2);
- cntQryClsrs.add(clsr);
+ cntQryClos.add(cntQryClo);
+
+ cntQryClo = null;
+ }
+
+ if (cntQryClos != null)
+ cntQryClos.add(clo);
+ else
+ cntQryClo = clo;
}
/** {@inheritDoc} */
+ @SuppressWarnings("ForLoopReplaceableByForEach")
@Override public boolean onDone(@Nullable Void res, @Nullable Throwable err) {
if (super.onDone(res, err)) {
cctx.mvcc().removeAtomicFuture(version());
@@ -382,9 +400,11 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
if (!suc)
markAllKeysFailed(err);
- if (cntQryClsrs != null) {
- for (CI1<Boolean> clsr : cntQryClsrs)
- clsr.apply(suc);
+ if (cntQryClo != null)
+ cntQryClo.apply(suc);
+ else if (cntQryClos != null) {
+ for (int i = 0; i < cntQryClos.size(); i++)
+ cntQryClos.get(i).apply(suc);
}
if (updateReq.writeSynchronizationMode() == FULL_SYNC)
@@ -417,7 +437,21 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
* @param req Request.
*/
private void mapping(UUID nodeId, GridDhtAtomicUpdateRequest req) {
- mappings.put(nodeId, req);
+ if (mapSingleNode != null) {
+ mappings = U.newHashMap(updateReq.keysCount());
+
+ mappings.put(mapSingleNode, mapSingleReq);
+
+ mapSingleNode = null;
+ mapSingleReq = null;
+ }
+
+ if (mappings != null)
+ mappings.put(nodeId, req);
+ else {
+ mapSingleNode = nodeId;
+ mapSingleReq = req;
+ }
}
/**
@@ -427,14 +461,21 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
* @return Mapping (if any).
*/
@Nullable protected GridDhtAtomicUpdateRequest mapping(UUID nodeId) {
- return mappings.get(nodeId);
+ if (mapSingleNode != null) {
+ if (F.eq(mapSingleNode, nodeId))
+ return mapSingleReq;
+ }
+ else if (mappings != null)
+ return mappings.get(nodeId);
+
+ return null;
}
/**
* @return Mappings number.
*/
protected int mappingsCount() {
- return mappings != null ? mappings.size() : 0;
+ return mapSingleNode != null ? 1 : mappings != null ? mappings.size() : 0;
}
/**
[3/7] ignite git commit: Merge branch 'ignite-2523-1-resp' into
ignite-2523-1-resp-dht
Posted by vo...@apache.org.
Merge branch 'ignite-2523-1-resp' into ignite-2523-1-resp-dht
# Conflicts:
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4ef68687
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4ef68687
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4ef68687
Branch: refs/heads/ignite-2523-1-resp-dht
Commit: 4ef68687688816018ffed08cc8049a5eb713eb87
Parents: a676069 834c9da
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Apr 28 16:40:01 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Apr 28 16:40:01 2016 +0300
----------------------------------------------------------------------
.../apache/ignite/IgniteSystemProperties.java | 16 ++-
.../dht/GridClientPartitionTopology.java | 6 +-
.../dht/GridDhtPartitionTopology.java | 2 +-
.../dht/GridDhtPartitionTopologyImpl.java | 6 +-
.../dht/GridDhtTransactionalCacheAdapter.java | 4 +-
.../dht/atomic/GridNearAtomicUpdateFuture.java | 10 +-
.../processors/cluster/GridUpdateNotifier.java | 3 +-
.../ignite/spi/discovery/tcp/ServerImpl.java | 5 +-
.../spi/discovery/tcp/TcpDiscoveryImpl.java | 10 ++
...GridServiceProxyClientReconnectSelfTest.java | 2 +-
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 34 +++++
.../properties/NotStringSystemPropertyTest.java | 124 +++++++++++++++++++
.../ignite/testsuites/IgniteBasicTestSuite.java | 2 +
.../Apache.Ignite.Linq.nuspec | 5 +-
14 files changed, 209 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
[2/7] ignite git commit: Refactored DHT future.
Posted by vo...@apache.org.
Refactored DHT future.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a6760696
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a6760696
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a6760696
Branch: refs/heads/ignite-2523-1-resp-dht
Commit: a6760696c106b7d62e6bedca6e80b96b579ef4d1
Parents: 9833dab
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Apr 28 15:56:04 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Apr 28 15:56:04 2016 +0300
----------------------------------------------------------------------
.../GridDhtAtomicAbstractUpdateFuture.java | 492 +++++++++++++++++++
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 393 ++-------------
2 files changed, 521 insertions(+), 364 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a6760696/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..4e166b1
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java
@@ -0,0 +1,492 @@
+/*
+ * 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 org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteLogger;
+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.typedef.CI1;
+import org.apache.ignite.internal.util.typedef.CI2;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteUuid;
+import org.jetbrains.annotations.Nullable;
+
+import javax.cache.processor.EntryProcessor;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicReference;
+
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ * Abstract DHT atomic update future.
+ */
+public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapter<Void>
+ implements GridCacheAtomicFuture<Void> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Logger reference. */
+ protected static final AtomicReference<IgniteLogger> logRef = new AtomicReference<>();
+
+ /** Logger. */
+ protected static IgniteLogger log;
+
+ /** Future version. */
+ protected final GridCacheVersion futVer;
+
+ /** Cache context. */
+ protected final GridCacheContext cctx;
+
+ /** Update request. */
+ protected final GridNearAtomicAbstractUpdateRequest updateReq;
+
+ /** Update response. */
+ protected final GridNearAtomicAbstractUpdateResponse updateRes;
+
+ /** Completion callback. */
+ @GridToStringExclude
+ protected final CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicAbstractUpdateResponse> completionCb;
+
+ /** Write version. */
+ protected final GridCacheVersion writeVer;
+
+ /** */
+ protected final boolean waitForExchange;
+
+ /** Force transform backup flag. */
+ protected boolean forceTransformBackups;
+
+ /** Response count. */
+ protected volatile int resCnt;
+
+ /** Continuous query closures. */
+ // TODO: Optimize.
+ private Collection<CI1<Boolean>> cntQryClsrs;
+
+ /**
+ * Constructor.
+ *
+ * @param cctx Cache context.
+ * @param updateReq Near request.
+ * @param updateRes Near response.
+ * @param completionCb Completion callback.
+ * @param writeVer Write version.
+ */
+ protected GridDhtAtomicAbstractUpdateFuture(
+ GridCacheContext cctx,
+ GridNearAtomicAbstractUpdateRequest updateReq,
+ GridNearAtomicAbstractUpdateResponse updateRes,
+ CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicAbstractUpdateResponse> completionCb,
+ GridCacheVersion writeVer) {
+ if (log == null)
+ log = U.logger(cctx.kernalContext(), logRef, GridDhtAtomicUpdateFuture.class);
+
+ futVer = cctx.versions().next(updateReq.topologyVersion());
+
+ this.cctx = cctx;
+ this.updateReq = updateReq;
+ this.updateRes = updateRes;
+ this.completionCb = completionCb;
+ this.writeVer = writeVer;
+
+ waitForExchange = !(updateReq.topologyLocked() || (updateReq.fastMap() && !updateReq.clientRequest()));
+ }
+
+ /**
+ * @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.
+ */
+ 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) {
+ Collection<ClusterNode> dhtNodes = cctx.dht().topology().nodes(entry.partition(), updateReq.topologyVersion());
+
+ if (log.isDebugEnabled())
+ log.debug("Mapping entry to DHT nodes [nodes=" + U.nodeIds(dhtNodes) + ", entry=" + entry + ']');
+
+ addKey(entry.key());
+
+ // TODO: Avoid iteration, we usually will have only one node here.
+ for (ClusterNode node : dhtNodes) {
+ UUID nodeId = node.id();
+
+ if (!nodeId.equals(cctx.localNodeId())) {
+ GridDhtAtomicUpdateRequest req = mapping(nodeId);
+
+ if (req == null) {
+ req = new GridDhtAtomicUpdateRequest(
+ cctx.cacheId(),
+ nodeId,
+ futVer,
+ writeVer,
+ updateReq.writeSynchronizationMode(),
+ updateReq.topologyVersion(),
+ forceTransformBackups,
+ this.updateReq.subjectId(),
+ this.updateReq.taskNameHash(),
+ forceTransformBackups ? this.updateReq.invokeArguments() : null,
+ cctx.deploymentEnabled(),
+ this.updateReq.keepBinary());
+
+ mapping(nodeId, req);
+ }
+
+ req.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) {
+ addKey(entry.key());
+
+ for (UUID nodeId : readers) {
+ GridDhtAtomicUpdateRequest req = mapping(nodeId);
+
+ if (req == null) {
+ ClusterNode node = cctx.discovery().node(nodeId);
+
+ // Node left the grid.
+ if (node == null)
+ continue;
+
+ req = new GridDhtAtomicUpdateRequest(
+ cctx.cacheId(),
+ nodeId,
+ futVer,
+ writeVer,
+ updateReq.writeSynchronizationMode(),
+ updateReq.topologyVersion(),
+ forceTransformBackups,
+ updateReq.subjectId(),
+ updateReq.taskNameHash(),
+ forceTransformBackups ? updateReq.invokeArguments() : null,
+ cctx.deploymentEnabled(),
+ updateReq.keepBinary());
+
+ mapping(nodeId, req);
+ }
+
+ nearReaderEntry(entry.key(), entry);
+
+ req.addNearWriteValue(entry.key(),
+ val,
+ entryProcessor,
+ ttl,
+ expireTime);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteUuid futureId() {
+ return futVer.asGridUuid();
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridCacheVersion version() {
+ return futVer;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean trackable() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void markNotTrackable() {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteInternalFuture<Void> completeFuture(AffinityTopologyVersion topVer) {
+ if (waitForExchange && updateReq.topologyVersion().compareTo(topVer) < 0)
+ return this;
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean onNodeLeft(UUID nodeId) {
+ if (log.isDebugEnabled())
+ log.debug("Processing node leave event [fut=" + this + ", nodeId=" + nodeId + ']');
+
+ return registerResponse(nodeId);
+ }
+
+ /**
+ * Callback for backup update response.
+ *
+ * @param nodeId Backup node ID.
+ * @param updateRes Update response.
+ */
+ @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
+ 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) {
+ List<KeyCacheObject> failed = new ArrayList<>(updateRes.failedCount());
+
+ for (int i = 0; i < updateRes.failedCount(); i++)
+ failed.add(updateRes.failed(i));
+
+ this.updateRes.addFailedKeys(failed, updateRes.error());
+ }
+
+ for (int i = 0; i < updateRes.nearEvictedCount(); i++) {
+ KeyCacheObject key = updateRes.nearEvicted(i);
+
+ GridDhtCacheEntry entry = nearReaderEntry(key);
+
+ try {
+ entry.removeReader(nodeId, updateRes.messageId());
+ }
+ catch (GridCacheEntryRemovedException e) {
+ if (log.isDebugEnabled())
+ log.debug("Entry with evicted reader was removed [entry=" + entry + ", err=" + e + ']');
+ }
+ }
+
+ 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);
+ }
+
+ /**
+ * Sends requests to remote nodes.
+ */
+ public void map() {
+ if (mappingsCount() > 0)
+ map0();
+ 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);
+ }
+
+ /**
+ * @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)
+ markAllKeysFailed(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;
+ }
+
+ /**
+ * Add key.
+ *
+ * @param key Key.
+ */
+ protected abstract void addKey(KeyCacheObject key);
+
+ /**
+ * Mark all request keys as failed.
+ *
+ * @param err Error.
+ */
+ protected abstract void markAllKeysFailed(@Nullable Throwable err);
+
+ /**
+ * Internal mapping routine.
+ */
+ protected abstract void map0();
+
+ /**
+ * Add mapping.
+ *
+ * @param nodeId Node ID.
+ * @param req Request.
+ */
+ protected abstract void mapping(UUID nodeId, GridDhtAtomicUpdateRequest req);
+
+ /**
+ * Get mapping for the given node ID.
+ *
+ * @param nodeId Node ID.
+ * @return Mapping (if any).
+ */
+ @Nullable protected abstract GridDhtAtomicUpdateRequest mapping(UUID nodeId);
+
+ /**
+ * @return Mappings number.
+ */
+ protected abstract int mappingsCount();
+
+ /**
+ * Add near reader entry.
+ *
+ * @param key Key.
+ * @param entry Near reader entry.
+ */
+ protected abstract void nearReaderEntry(KeyCacheObject key, GridDhtCacheEntry entry);
+
+ /**
+ * Get near reader entry.
+ *
+ * @param key Key.
+ * @return Near reader entry.
+ */
+ protected abstract GridDhtCacheEntry nearReaderEntry(KeyCacheObject key);
+
+ /**
+ * Send DHT request.
+ *
+ * @param req Request.
+ */
+ protected void sendRequest(GridDhtAtomicUpdateRequest req) {
+ try {
+ if (log.isDebugEnabled())
+ log.debug("Sending DHT atomic update request [nodeId=" + req.nodeId() + ", req=" + req + ']');
+
+ cctx.io().send(req.nodeId(), req, cctx.ioPolicy());
+ }
+ catch (ClusterTopologyCheckedException ignored) {
+ U.warn(log, "Failed to send update request to backup node because it left grid: " +
+ req.nodeId());
+
+ registerResponse(req.nodeId());
+ }
+ catch (IgniteCheckedException e) {
+ U.error(log, "Failed to send update request to backup node (did node leave the grid?): "
+ + req.nodeId(), e);
+
+ registerResponse(req.nodeId());
+ }
+ }
+
+ /**
+ * @param nodeId Node ID.
+ * @return {@code True} if request found.
+ */
+ private boolean registerResponse(UUID nodeId) {
+ int resCnt0;
+
+ GridDhtAtomicUpdateRequest req = mapping(nodeId);
+
+ if (req != null) {
+ synchronized (this) {
+ if (req.onResponse()) {
+ resCnt0 = resCnt;
+
+ resCnt0 += 1;
+
+ resCnt = resCnt0;
+ }
+ else
+ return false;
+ }
+
+ if (resCnt0 == mappingsCount())
+ onDone();
+
+ return true;
+ }
+
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a6760696/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 0043bf1..bf118ab 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
@@ -20,67 +20,25 @@ package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
import java.util.ArrayList;
import java.util.Collection;
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.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> {
+public class GridDhtAtomicUpdateFuture extends GridDhtAtomicAbstractUpdateFuture {
/** */
private static final long serialVersionUID = 0L;
- /** Logger reference. */
- private static final AtomicReference<IgniteLogger> logRef = new AtomicReference<>();
-
- /** Logger. */
- protected static IgniteLogger log;
-
- /** 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, GridNearAtomicAbstractUpdateResponse> completionCb;
-
/** Mappings. */
@GridToStringInclude
private final Map<UUID, GridDhtAtomicUpdateRequest> mappings;
@@ -88,24 +46,9 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
/** Entries with readers. */
private Map<KeyCacheObject, GridDhtCacheEntry> nearReadersEntries;
- /** Update request. */
- private final GridNearAtomicAbstractUpdateRequest updateReq;
-
- /** Update response. */
- private final GridNearAtomicAbstractUpdateResponse updateRes;
-
/** Future keys. */
private final Collection<KeyCacheObject> keys;
- /** 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.
@@ -120,339 +63,61 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
GridNearAtomicAbstractUpdateRequest updateReq,
GridNearAtomicAbstractUpdateResponse 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)
- log = U.logger(cctx.kernalContext(), logRef, GridDhtAtomicUpdateFuture.class);
+ super(cctx, updateReq, updateRes, completionCb, writeVer);
keys = new ArrayList<>(updateReq.keysCount());
mappings = U.newHashMap(updateReq.keysCount());
-
- waitForExchange = !(updateReq.topologyLocked() || (updateReq.fastMap() && !updateReq.clientRequest()));
- }
-
- /** {@inheritDoc} */
- @Override public IgniteUuid futureId() {
- return futVer.asGridUuid();
- }
-
- /** {@inheritDoc} */
- @Override public GridCacheVersion version() {
- return futVer;
- }
-
- /** {@inheritDoc} */
- @Override public boolean onNodeLeft(UUID nodeId) {
- if (log.isDebugEnabled())
- log.debug("Processing node leave event [fut=" + this + ", nodeId=" + nodeId + ']');
-
- return registerResponse(nodeId);
}
/**
- * @param nodeId Node ID.
- * @return {@code True} if request found.
+ * Add key.
+ *
+ * @param key Key.
*/
- 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;
+ protected void addKey(KeyCacheObject key) {
+ keys.add(key);
}
/** {@inheritDoc} */
- @Override public boolean trackable() {
- return true;
+ @Override protected void markAllKeysFailed(@Nullable Throwable err) {
+ for (KeyCacheObject key : keys)
+ updateRes.addFailedKey(key, err);
}
/** {@inheritDoc} */
- @Override public void markNotTrackable() {
- // No-op.
+ @Override protected void map0() {
+ for (GridDhtAtomicUpdateRequest req : mappings.values())
+ sendRequest(req);
}
/** {@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.
- */
- 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();
-
- Collection<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 (ClusterNode node : dhtNodes) {
- 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());
-
- 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());
-
- 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);
+ @Override protected void mapping(UUID nodeId, GridDhtAtomicUpdateRequest req) {
+ mappings.put(nodeId, req);
}
/** {@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;
+ @Override @Nullable protected GridDhtAtomicUpdateRequest mapping(UUID nodeId) {
+ return mappings.get(nodeId);
}
- /**
- * Sends requests to remote nodes.
- */
- public void map() {
- if (!mappings.isEmpty()) {
- for (GridDhtAtomicUpdateRequest req : mappings.values()) {
- try {
- if (log.isDebugEnabled())
- log.debug("Sending DHT atomic update request [nodeId=" + req.nodeId() + ", req=" + req + ']');
-
- cctx.io().send(req.nodeId(), req, cctx.ioPolicy());
- }
- catch (ClusterTopologyCheckedException ignored) {
- U.warn(log, "Failed to send update request to backup node because it left grid: " +
- req.nodeId());
-
- registerResponse(req.nodeId());
- }
- catch (IgniteCheckedException e) {
- U.error(log, "Failed to send update request to backup node (did node leave the grid?): "
- + req.nodeId(), e);
-
- 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);
+ /** {@inheritDoc} */
+ @Override protected int mappingsCount() {
+ return mappings != null ? mappings.size() : 0;
}
- /**
- * Callback for backup update response.
- *
- * @param nodeId Backup node ID.
- * @param updateRes Update response.
- */
- @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
- 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) {
- List<KeyCacheObject> failed = new ArrayList<>(updateRes.failedCount());
-
- for (int i = 0; i < updateRes.failedCount(); i++)
- failed.add(updateRes.failed(i));
-
- this.updateRes.addFailedKeys(failed, updateRes.error());
- }
-
- for (int i = 0; i < updateRes.nearEvictedCount(); i++) {
- KeyCacheObject key = updateRes.nearEvicted(i);
-
- GridDhtCacheEntry entry = nearReadersEntries.get(key);
-
- try {
- entry.removeReader(nodeId, updateRes.messageId());
- }
- catch (GridCacheEntryRemovedException e) {
- if (log.isDebugEnabled())
- log.debug("Entry with evicted reader was removed [entry=" + entry + ", err=" + e + ']');
- }
- }
+ /** {@inheritDoc} */
+ @Override protected void nearReaderEntry(KeyCacheObject key, GridDhtCacheEntry entry) {
+ if (nearReadersEntries == null)
+ nearReadersEntries = new HashMap<>();
- registerResponse(nodeId);
+ nearReadersEntries.put(entry.key(), entry);
}
- /**
- * 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 + ']');
+ /** {@inheritDoc} */
+ @Override protected GridDhtCacheEntry nearReaderEntry(KeyCacheObject key) {
+ assert nearReadersEntries != null;
- registerResponse(nodeId);
+ return nearReadersEntries.get(key);
}
/** {@inheritDoc} */
[4/7] ignite git commit: Minors.
Posted by vo...@apache.org.
Minors.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f32f1d8d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f32f1d8d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f32f1d8d
Branch: refs/heads/ignite-2523-1-resp-dht
Commit: f32f1d8debcb68efff5c87c49c6af9c907b4346d
Parents: 4ef6868
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Apr 28 16:40:55 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Apr 28 16:40:55 2016 +0300
----------------------------------------------------------------------
.../dht/atomic/GridDhtAtomicAbstractUpdateFuture.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f32f1d8d/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
index 4e166b1..e930d1a 100644
--- 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
@@ -133,6 +133,7 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
* @param prevVal Previous value.
* @param updateCntr Partition update counter.
*/
+ @SuppressWarnings("ForLoopReplaceableByForEach")
public void addWriteEntry(GridDhtCacheEntry entry,
@Nullable CacheObject val,
EntryProcessor<Object, Object, Object> entryProcessor,
@@ -142,15 +143,16 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
boolean addPrevVal,
@Nullable CacheObject prevVal,
long updateCntr) {
- Collection<ClusterNode> dhtNodes = cctx.dht().topology().nodes(entry.partition(), updateReq.topologyVersion());
+ List<ClusterNode> dhtNodes = cctx.dht().topology().nodes(entry.partition(), updateReq.topologyVersion());
if (log.isDebugEnabled())
log.debug("Mapping entry to DHT nodes [nodes=" + U.nodeIds(dhtNodes) + ", entry=" + entry + ']');
addKey(entry.key());
- // TODO: Avoid iteration, we usually will have only one node here.
- for (ClusterNode node : dhtNodes) {
+ for (int i = 0; i < dhtNodes.size(); i++) {
+ ClusterNode node = dhtNodes.get(i);
+
UUID nodeId = node.id();
if (!nodeId.equals(cctx.localNodeId())) {