Repository: ignite Updated Branches: refs/heads/ignite-2934 b6a0078a9 -> b8fec8dfe
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-2934 Commit: 1aa2a2baf9f3499f815f7a6865a8bf71273ecf9a Parents: 42048c2 Author: vozerov-gridgain <[email protected]> Authored: Fri Apr 1 14:06:41 2016 +0300 Committer: vozerov-gridgain <[email protected]> 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,
