ignite git commit: Check whether deferred update response affects performance.

2015-11-25 Thread agoncharuk
Repository: ignite
Updated Branches:
  refs/heads/ignite-no-deferred-res [created] 9f0d4988a


Check whether deferred update response affects performance.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9f0d4988
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9f0d4988
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9f0d4988

Branch: refs/heads/ignite-no-deferred-res
Commit: 9f0d4988a776afc1d556985d6162d0ab76ba99f3
Parents: ef2007d
Author: Alexey Goncharuk 
Authored: Wed Nov 25 16:15:04 2015 +0300
Committer: Alexey Goncharuk 
Committed: Wed Nov 25 16:15:04 2015 +0300

--
 .../cache/distributed/dht/atomic/GridDhtAtomicCache.java | 4 ++--
 .../cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java  | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ignite/blob/9f0d4988/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 cd76a56..c6fdf14 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
@@ -1311,7 +1311,7 @@ public class GridDhtAtomicCache extends 
GridDhtCacheAdapter {
 
 res.returnValue(retVal);
 
-if (dhtFut != null)
+if (dhtFut != null && 
ctx.config().getWriteSynchronizationMode() == FULL_SYNC)
 ctx.mvcc().addAtomicFuture(dhtFut.version(), 
dhtFut);
 }
 else
@@ -2701,7 +2701,7 @@ public class GridDhtAtomicCache extends 
GridDhtCacheAdapter {
 ctx.io().send(nodeId, res, ctx.ioPolicy());
 else {
 // No failed keys and sync mode is not FULL_SYNC, thus sending 
deferred response.
-sendDeferredUpdateResponse(nodeId, req.futureVersion());
+//sendDeferredUpdateResponse(nodeId, req.futureVersion());
 }
 }
 catch (ClusterTopologyCheckedException ignored) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/9f0d4988/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 e31af19..2269110 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
@@ -349,7 +349,8 @@ public class GridDhtAtomicUpdateFuture extends 
GridFutureAdapter
 /** {@inheritDoc} */
 @Override public boolean onDone(@Nullable Void res, @Nullable Throwable 
err) {
 if (super.onDone(res, err)) {
-cctx.mvcc().removeAtomicFuture(version());
+if (cctx.config().getWriteSynchronizationMode() == FULL_SYNC)
+cctx.mvcc().removeAtomicFuture(version());
 
 if (err != null) {
 if (!mappings.isEmpty()) {



ignite git commit: Check whether deferred update response affects performance.

2015-11-25 Thread agoncharuk
Repository: ignite
Updated Branches:
  refs/heads/ignite-no-deferred-res 9f0d4988a -> 24cbb4964


Check whether deferred update response affects performance.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/24cbb496
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/24cbb496
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/24cbb496

Branch: refs/heads/ignite-no-deferred-res
Commit: 24cbb49642309b7d062070f243014e040ba7708b
Parents: 9f0d498
Author: Alexey Goncharuk 
Authored: Wed Nov 25 16:45:27 2015 +0300
Committer: Alexey Goncharuk 
Committed: Wed Nov 25 16:45:27 2015 +0300

--
 .../dht/atomic/GridDhtAtomicUpdateFuture.java   | 177 ---
 1 file changed, 111 insertions(+), 66 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ignite/blob/24cbb496/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 2269110..b837dd2 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
@@ -84,6 +84,9 @@ public class GridDhtAtomicUpdateFuture extends 
GridFutureAdapter
 @GridToStringInclude
 private final Map mappings;
 
+/** */
+private GridDhtAtomicUpdateRequest singleReq;
+
 /** Entries with readers. */
 private Map nearReadersEntries;
 
@@ -129,7 +132,7 @@ public class GridDhtAtomicUpdateFuture extends 
GridFutureAdapter
 log = U.logger(cctx.kernalContext(), logRef, 
GridDhtAtomicUpdateFuture.class);
 
 keys = new ArrayList<>(updateReq.keys().size());
-mappings = U.newHashMap(updateReq.keys().size());
+mappings = updateReq.keys().size() == 1 ? U.newHashMap(updateReq.keys().size()) : null;
 
 boolean topLocked = updateReq.topologyLocked() || (updateReq.fastMap() 
&& !updateReq.clientRequest());
 
@@ -161,22 +164,39 @@ public class GridDhtAtomicUpdateFuture extends 
GridFutureAdapter
 private boolean registerResponse(UUID nodeId) {
 int resCnt0;
 
-GridDhtAtomicUpdateRequest req = mappings.get(nodeId);
+Map map = mappings;
 
-if (req != null) {
-synchronized (this) {
-if (req.onResponse()) {
-resCnt0 = resCnt;
+if (map != null) {
+GridDhtAtomicUpdateRequest req = map.get(nodeId);
+
+if (req != null) {
+synchronized (this) {
+if (req.onResponse()) {
+resCnt0 = resCnt;
 
-resCnt0 += 1;
+resCnt0 += 1;
 
-resCnt = resCnt0;
+resCnt = resCnt0;
+}
+else
+return false;
 }
-else
-return false;
+
+if (resCnt0 == map.size())
+onDone();
+
+return true;
 }
+}
+else {
+boolean done = false;
 
-if (resCnt0 == mappings.size())
+synchronized (this) {
+if (singleReq.onResponse())
+done = true;
+}
+
+if (done)
 onDone();
 
 return true;
@@ -241,7 +261,7 @@ public class GridDhtAtomicUpdateFuture extends 
GridFutureAdapter
 UUID nodeId = node.id();
 
 if (!nodeId.equals(cctx.localNodeId())) {
-GridDhtAtomicUpdateRequest updateReq = mappings.get(nodeId);
+GridDhtAtomicUpdateRequest updateReq = mappings == null ? 
singleReq : mappings.get(nodeId);
 
 if (updateReq == null) {
 updateReq = new GridDhtAtomicUpdateRequest(
@@ -258,7 +278,10 @@ public class GridDhtAtomicUpdateFuture extends 
GridFutureAdapter
 cctx.deploymentEnabled(),
 this.updateReq.keepBinary());
 
-mappings.put(nodeId, updateReq);
+if (mappings != null)
+mappings.put(nodeId, updateReq);
+