ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntikho...@apache.org
Subject [28/37] ignite git commit: IGNITE-2925: Fixed conflict resolution in ATOMIC cache.
Date Mon, 04 Apr 2016 18:38:34 GMT
IGNITE-2925: Fixed conflict resolution in ATOMIC cache.


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

Branch: refs/heads/ignite-2004
Commit: 1aa2a2baf9f3499f815f7a6865a8bf71273ecf9a
Parents: 42048c2
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Fri Apr 1 14:06:41 2016 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Fri Apr 1 14:06:41 2016 +0300

----------------------------------------------------------------------
 .../dht/atomic/GridDhtAtomicCache.java          | 28 +++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/1aa2a2ba/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 f85862d..1797acd 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
@@ -1062,6 +1062,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
         @Nullable final CacheEntryPredicate[] filter,
         boolean waitTopFut
     ) {
+        CacheOperationContext opCtx = ctx.operationContextPerCall();
+
         GridCacheOperation op;
         Collection vals;
 
@@ -1078,7 +1080,27 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
             vals = null;
         }
 
-        CacheOperationContext opCtx = ctx.operationContextPerCall();
+        GridCacheDrInfo conflictPutVal = null;
+        GridCacheVersion conflictRmvVer = null;
+
+        if (opCtx != null && opCtx.hasDataCenterId()) {
+            Byte dcId = opCtx.dataCenterId();
+
+            assert dcId != null;
+
+            if (op == UPDATE) {
+                conflictPutVal = new GridCacheDrInfo(ctx.toCacheObject(val), ctx.versions().next(dcId));
+
+                vals = null;
+            }
+            else if (op == GridCacheOperation.TRANSFORM) {
+                conflictPutVal = new GridCacheDrInfo(proc, ctx.versions().next(dcId));
+
+                vals = null;
+            }
+            else
+                conflictRmvVer = ctx.versions().next(dcId);
+        }
 
         return new GridNearAtomicUpdateFuture(
             ctx,
@@ -1088,8 +1110,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
             Collections.singletonList(key),
             vals,
             invokeArgs,
-            null,
-            null,
+            conflictPutVal != null ? Collections.singleton(conflictPutVal) : null,
+            conflictRmvVer != null ? Collections.singleton(conflictRmvVer) : null,
             retval,
             false,
             opCtx != null ? opCtx.expiry() : null,


Mime
View raw message