ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [34/51] [abbrv] incubator-ignite git commit: IGNITE-264 - WIP
Date Wed, 25 Feb 2015 00:52:12 GMT
IGNITE-264 - WIP


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

Branch: refs/heads/ignite-264
Commit: 3a88c01933a8821920b845043d1a8f268a641e7a
Parents: a22a8c2
Author: Alexey Goncharuk <agoncharuk@gridgain.com>
Authored: Fri Feb 20 18:53:36 2015 -0800
Committer: Alexey Goncharuk <agoncharuk@gridgain.com>
Committed: Fri Feb 20 18:53:36 2015 -0800

----------------------------------------------------------------------
 .../processors/cache/GridCacheAdapter.java      |  19 +-
 .../processors/cache/GridCacheContext.java      |  11 +-
 .../processors/cache/GridCacheMvcc.java         | 125 +----
 .../processors/cache/GridCacheUtils.java        |  19 +
 .../distributed/GridDistributedBaseMessage.java |  62 ---
 .../distributed/GridDistributedCacheEntry.java  |  95 +---
 .../GridDistributedLockResponse.java            |   7 +-
 .../GridDistributedTxFinishRequest.java         |  34 --
 .../GridDistributedTxRemoteAdapter.java         |  18 +-
 .../distributed/dht/GridDhtLockFuture.java      |   7 +-
 .../dht/GridDhtTransactionalCacheAdapter.java   |  52 +--
 .../distributed/dht/GridDhtTxFinishFuture.java  |   8 -
 .../distributed/dht/GridDhtTxFinishRequest.java |  48 +-
 .../cache/distributed/dht/GridDhtTxLocal.java   |   4 +-
 .../distributed/dht/GridDhtTxLocalAdapter.java  |  35 +-
 .../distributed/dht/GridDhtTxPrepareFuture.java |  70 ++-
 .../dht/colocated/GridDhtColocatedCache.java    |   5 -
 .../distributed/near/GridNearLockFuture.java    |   6 +-
 .../distributed/near/GridNearLockResponse.java  |  41 --
 .../near/GridNearTransactionalCache.java        |   8 -
 .../near/GridNearTxFinishFuture.java            |  40 +-
 .../near/GridNearTxFinishRequest.java           |   9 +-
 .../cache/distributed/near/GridNearTxLocal.java |  29 +-
 .../near/GridNearTxPrepareFuture.java           |   3 +-
 .../near/GridNearTxPrepareResponse.java         |  37 --
 .../cache/transactions/IgniteInternalTx.java    |  13 -
 .../cache/transactions/IgniteTxAdapter.java     |  24 +-
 .../cache/transactions/IgniteTxHandler.java     |  66 +--
 .../transactions/IgniteTxLocalAdapter.java      |  55 +--
 .../cache/transactions/IgniteTxManager.java     |  88 +---
 .../cache/transactions/IgniteTxRemoteEx.java    |   6 +-
 .../cache/GridCacheMvccPartitionedSelfTest.java | 227 ++--------
 .../processors/cache/GridCacheMvccSelfTest.java | 452 +++----------------
 .../processors/cache/GridCacheTestEntryEx.java  |  27 +-
 .../cache/IgniteOnePhaseCommitNearSelfTest.java | 173 +++++++
 35 files changed, 445 insertions(+), 1478 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a88c019/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 6318432..9e08d3e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -301,7 +301,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
     /**
      * @return Context.
      */
-    public GridCacheContext<K, V> context() {
+    @Override public GridCacheContext<K, V> context() {
         return ctx;
     }
 
@@ -667,10 +667,9 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
 
                 assert map.isEmpty() || map.size() == 1 : map.size();
 
-                if (ctx.portableEnabled())
-                    return map.isEmpty() ? false : map.values().iterator().next() != null;
-                else
-                    return map.get(key0) != null;
+                return ctx.portableEnabled() ?
+                    !map.isEmpty() && map.values().iterator().next() != null :
+                    map.get(key0) != null;
             }
         });
     }
@@ -3975,15 +3974,13 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
 
         final Collection<? extends K> keys0;
 
-        if (ctx.portableEnabled() && !ctx.store().convertPortable()) {
-            keys0 = F.viewReadOnly(keys, new C1<K, K>() {
+        keys0 = ctx.portableEnabled() && !ctx.store().convertPortable() ?
+            F.viewReadOnly(keys, new C1<K, K>() {
                 @Override public K apply(K k) {
                     return (K)ctx.marshalToPortable(k);
                 }
-            });
-        }
-        else
-            keys0 = keys;
+            }) :
+            keys;
 
         if (replaceExisting) {
             if (ctx.store().isLocalStore()) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a88c019/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
index 060a825..4e20424 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
@@ -297,16 +297,7 @@ public class GridCacheContext<K, V> implements Externalizable {
 
         cacheName = cacheCfg.getName();
 
-        if (cacheName != null) {
-            int hash = cacheName.hashCode();
-
-            if (hash == 0)
-                hash = 1;
-
-            cacheId = hash;
-        }
-        else
-            cacheId = 1;
+        cacheId = CU.cacheId(cacheName);
 
         sys = CU.UTILITY_CACHE_NAME.equals(cacheName);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a88c019/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java
index 116bf0d..2e43365 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java
@@ -323,82 +323,6 @@ public final class GridCacheMvcc<K> {
     }
 
     /**
-     * Moves completed candidates right before the base one. Note that
-     * if base is not found, then nothing happens and {@code false} is
-     * returned.
-     *
-     * @param baseVer Base version.
-     * @param committedVers Committed versions relative to base.
-     * @param rolledbackVers Rolled back versions relative to base.
-     * @return Lock owner.
-     */
-    @Nullable public GridCacheMvccCandidate<K> orderCompleted(GridCacheVersion baseVer,
-        Collection<GridCacheVersion> committedVers, Collection<GridCacheVersion> rolledbackVers) {
-        assert baseVer != null;
-
-        if (rmts != null && !F.isEmpty(committedVers)) {
-            Deque<GridCacheMvccCandidate<K>> mvAfter = null;
-
-            int maxIdx = -1;
-
-            for (ListIterator<GridCacheMvccCandidate<K>> it = rmts.listIterator(rmts.size()); it.hasPrevious(); ) {
-                GridCacheMvccCandidate<K> cur = it.previous();
-
-                if (!cur.version().equals(baseVer) && committedVers.contains(cur.version())) {
-                    cur.setOwner();
-
-                    assert localOwner() == null || localOwner().nearLocal(): "Cannot not have local owner and " +
-                        "remote completed transactions at the same time [baseVer=" + baseVer +
-                        ", committedVers=" + committedVers + ", rolledbackVers=" + rolledbackVers +
-                        ", localOwner=" + localOwner() + ", locs=" + locs + ", rmts=" + rmts + ']';
-
-                    if (maxIdx < 0)
-                        maxIdx = it.nextIndex();
-                }
-                else if (maxIdx >= 0 && cur.version().isGreaterEqual(baseVer)) {
-                    if (--maxIdx >= 0) {
-                        if (mvAfter == null)
-                            mvAfter = new LinkedList<>();
-
-                        it.remove();
-
-                        mvAfter.addFirst(cur);
-                    }
-                }
-
-                // If base is completed, then set it to owner too.
-                if (!cur.owner() && cur.version().equals(baseVer) && committedVers.contains(cur.version()))
-                    cur.setOwner();
-            }
-
-            if (maxIdx >= 0 && mvAfter != null) {
-                ListIterator<GridCacheMvccCandidate<K>> it = rmts.listIterator(maxIdx + 1);
-
-                for (GridCacheMvccCandidate<K> cand : mvAfter)
-                    it.add(cand);
-            }
-
-            // Remove rolled back versions.
-            if (!F.isEmpty(rolledbackVers)) {
-                for (Iterator<GridCacheMvccCandidate<K>> it = rmts.iterator(); it.hasNext(); ) {
-                    GridCacheMvccCandidate<K> cand = it.next();
-
-                    if (rolledbackVers.contains(cand.version())) {
-                        cand.setUsed(); // Mark as used to be consistent, even though we are about to remove it.
-
-                        it.remove();
-                    }
-                }
-
-                if (rmts.isEmpty())
-                    rmts = null;
-            }
-        }
-
-        return anyOwner();
-    }
-
-    /**
      * Puts owned versions in front of base.
      *
      * @param baseVer Base version.
@@ -516,7 +440,8 @@ public final class GridCacheMvcc<K> {
             /*reenter*/false,
             tx,
             implicitSingle,
-            /*near-local*/false, dhtLoc
+            /*near-local*/false,
+            dhtLoc
         );
 
         cctx.mvcc().addLocal(cand);
@@ -649,14 +574,9 @@ public final class GridCacheMvcc<K> {
      *
      * @param ver Version to mark as ready.
      * @param mappedVer Mapped dht version.
-     * @param committedVers Committed versions.
-     * @param rolledBackVers Rolled back versions.
-     * @param pending Pending dht versions that are not owned and which version is less then mapped.
      * @return Lock owner after reassignment.
      */
-    @Nullable public GridCacheMvccCandidate<K> readyNearLocal(GridCacheVersion ver, GridCacheVersion mappedVer,
-        Collection<GridCacheVersion> committedVers, Collection<GridCacheVersion> rolledBackVers,
-        Collection<GridCacheVersion> pending) {
+    @Nullable public GridCacheMvccCandidate<K> readyNearLocal(GridCacheVersion ver, GridCacheVersion mappedVer) {
         GridCacheMvccCandidate<K> cand = candidate(locs, ver);
 
         if (cand != null) {
@@ -701,24 +621,6 @@ public final class GridCacheMvcc<K> {
                 }
             }
 
-            // Mark all remote candidates with less version as owner unless it is pending.
-            if (rmts != null) {
-                for (GridCacheMvccCandidate<K> rmt : rmts) {
-                    GridCacheVersion rmtVer = rmt.version();
-
-                    if (rmtVer.isLess(mappedVer)) {
-                        if (!pending.contains(rmtVer) &&
-                            !mappedVer.equals(rmt.ownerVersion()))
-                            rmt.setOwner();
-                    }
-                    else {
-                        // Remote version is greater, so need to check if it was committed or rolled back.
-                        if (committedVers.contains(rmtVer) || rolledBackVers.contains(rmtVer))
-                            rmt.setOwner();
-                    }
-                }
-            }
-
             reassign();
         }
 
@@ -729,16 +631,10 @@ public final class GridCacheMvcc<K> {
      * Sets remote candidate to done.
      *
      * @param ver Version.
-     * @param pending Pending versions.
-     * @param committed Committed versions.
-     * @param rolledback Rolledback versions.
      * @return Lock owner.
      */
     @Nullable public GridCacheMvccCandidate<K> doneRemote(
-        GridCacheVersion ver,
-        Collection<GridCacheVersion> pending,
-        Collection<GridCacheVersion> committed,
-        Collection<GridCacheVersion> rolledback) {
+        GridCacheVersion ver) {
         assert ver != null;
 
         if (log.isDebugEnabled())
@@ -770,15 +666,6 @@ public final class GridCacheMvcc<K> {
 
                     break;
                 }
-                else if (!committed.contains(c.version()) && !rolledback.contains(c.version()) &&
-                    pending.contains(c.version())) {
-                    it.remove();
-
-                    if (mvAfter == null)
-                        mvAfter = new LinkedList<>();
-
-                    mvAfter.add(c);
-                }
             }
         }
 
@@ -842,6 +729,10 @@ public final class GridCacheMvcc<K> {
             }
         }
 
+        // No assignment can happen in near local cache when remote candidate is present.
+        if (cctx.isNear() && firstRmt != null)
+            return;
+
         if (locs != null) {
             for (ListIterator<GridCacheMvccCandidate<K>> it = locs.listIterator(); it.hasNext(); ) {
                 GridCacheMvccCandidate<K> cand = it.next();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a88c019/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index f5c2836..e609edc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -1550,6 +1550,25 @@ public class GridCacheUtils {
     }
 
     /**
+     * Gets cache ID by cache name.
+     *
+     * @param cacheName Cache name.
+     * @return Cache ID.
+     */
+    public static int cacheId(String cacheName) {
+        if (cacheName != null) {
+            int hash = cacheName.hashCode();
+
+            if (hash == 0)
+                hash = 1;
+
+            return hash;
+        }
+        else
+            return 1;
+    }
+
+    /**
      * Validates that cache key or cache value implements {@link Externalizable}
      *
      * @param log Logger used to log warning message.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a88c019/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedBaseMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedBaseMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedBaseMessage.java
index a7d5819..64a22bd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedBaseMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedBaseMessage.java
@@ -64,16 +64,6 @@ public abstract class GridDistributedBaseMessage<K, V> extends GridCacheMessage<
     @GridToStringExclude
     private byte[] candsByKeyBytes;
 
-    /** Committed versions with order higher than one for this message (needed for commit ordering). */
-    @GridToStringInclude
-    @GridDirectCollection(GridCacheVersion.class)
-    private Collection<GridCacheVersion> committedVers;
-
-    /** Rolled back versions with order higher than one for this message (needed for commit ordering). */
-    @GridToStringInclude
-    @GridDirectCollection(GridCacheVersion.class)
-    private Collection<GridCacheVersion> rolledbackVers;
-
     /** Count of keys referenced in candidates array (needed only locally for optimization). */
     @GridToStringInclude
     @GridDirectTransient
@@ -151,30 +141,6 @@ public abstract class GridDistributedBaseMessage<K, V> extends GridCacheMessage<
     }
 
     /**
-     * @param committedVers Committed versions.
-     * @param rolledbackVers Rolled back versions.
-     */
-    public void completedVersions(Collection<GridCacheVersion> committedVers,
-        Collection<GridCacheVersion> rolledbackVers) {
-        this.committedVers = committedVers;
-        this.rolledbackVers = rolledbackVers;
-    }
-
-    /**
-     * @return Committed versions.
-     */
-    public Collection<GridCacheVersion> committedVersions() {
-        return committedVers == null ? Collections.<GridCacheVersion>emptyList() : committedVers;
-    }
-
-    /**
-     * @return Rolled back versions.
-     */
-    public Collection<GridCacheVersion> rolledbackVersions() {
-        return rolledbackVers == null ? Collections.<GridCacheVersion>emptyList() : rolledbackVers;
-    }
-
-    /**
      * @param idx Key index.
      * @param candsByIdx List of candidates for that key.
      */
@@ -266,18 +232,6 @@ public abstract class GridDistributedBaseMessage<K, V> extends GridCacheMessage<
 
                 writer.incrementState();
 
-            case 5:
-                if (!writer.writeCollection("committedVers", committedVers, Type.MSG))
-                    return false;
-
-                writer.incrementState();
-
-            case 6:
-                if (!writer.writeCollection("rolledbackVers", rolledbackVers, Type.MSG))
-                    return false;
-
-                writer.incrementState();
-
             case 7:
                 if (!writer.writeMessage("ver", ver))
                     return false;
@@ -313,22 +267,6 @@ public abstract class GridDistributedBaseMessage<K, V> extends GridCacheMessage<
 
                 readState++;
 
-            case 5:
-                committedVers = reader.readCollection("committedVers", Type.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                readState++;
-
-            case 6:
-                rolledbackVers = reader.readCollection("rolledbackVers", Type.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                readState++;
-
             case 7:
                 ver = reader.readMessage("ver");
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a88c019/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
index 46a04a7..c0e0bfd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
@@ -499,17 +499,12 @@ public class GridDistributedCacheEntry<K, V> extends GridCacheMapEntry<K, V> {
      *
      * @param ver Lock version.
      * @param mapped Mapped dht lock version.
-     * @param committed Committed versions.
-     * @param rolledBack Rolled back versions.
-     * @param pending Pending locks on dht node with version less then mapped.
      * @return Current lock owner.
      *
      * @throws GridCacheEntryRemovedException If entry is removed.
      */
-    @Nullable public GridCacheMvccCandidate<K> readyNearLock(GridCacheVersion ver, GridCacheVersion mapped,
-        Collection<GridCacheVersion> committed,
-        Collection<GridCacheVersion> rolledBack,
-        Collection<GridCacheVersion> pending) throws GridCacheEntryRemovedException {
+    @Nullable public GridCacheMvccCandidate<K> readyNearLock(GridCacheVersion ver, GridCacheVersion mapped)
+        throws GridCacheEntryRemovedException {
         GridCacheMvccCandidate<K> prev = null;
         GridCacheMvccCandidate<K> owner = null;
 
@@ -525,7 +520,7 @@ public class GridDistributedCacheEntry<K, V> extends GridCacheMapEntry<K, V> {
 
                 boolean emptyBefore = mvcc.isEmpty();
 
-                owner = mvcc.readyNearLocal(ver, mapped, committed, rolledBack, pending);
+                owner = mvcc.readyNearLocal(ver, mapped);
 
                 assert owner == null || owner.owner() : "Owner flag is not set for owner: " + owner;
 
@@ -547,56 +542,9 @@ public class GridDistributedCacheEntry<K, V> extends GridCacheMapEntry<K, V> {
     }
 
     /**
-     * Reorders completed versions.
-     *
-     * @param baseVer Base version for reordering.
-     * @param committedVers Completed versions.
-     * @param rolledbackVers Rolled back versions.
-     * @throws GridCacheEntryRemovedException If entry has been removed.
-     */
-    public void orderCompleted(GridCacheVersion baseVer, Collection<GridCacheVersion> committedVers,
-        Collection<GridCacheVersion> rolledbackVers)
-        throws GridCacheEntryRemovedException {
-        if (!F.isEmpty(committedVers) || !F.isEmpty(rolledbackVers)) {
-            GridCacheMvccCandidate<K> prev = null;
-            GridCacheMvccCandidate<K> owner = null;
-
-            V val;
-
-            synchronized (this) {
-                checkObsolete();
-
-                GridCacheMvcc<K> mvcc = mvccExtras();
-
-                if (mvcc != null) {
-                    prev = mvcc.anyOwner();
-
-                    boolean emptyBefore = mvcc.isEmpty();
-
-                    owner = mvcc.orderCompleted(baseVer, committedVers, rolledbackVers);
-
-                    boolean emptyAfter = mvcc.isEmpty();
-
-                    checkCallbacks(emptyBefore, emptyAfter);
-
-                    if (emptyAfter)
-                        mvccExtras(null);
-                }
-
-                val = this.val;
-            }
-
-            // This call must be made outside of synchronization.
-            checkOwnerChanged(prev, owner, val);
-        }
-    }
-
-    /**
      *
      * @param lockVer Done version.
      * @param baseVer Base version.
-     * @param committedVers Completed versions for reordering.
-     * @param rolledbackVers Rolled back versions for reordering.
      * @param sysInvalidate Flag indicating if this entry is done from invalidated transaction (in case of tx
      *      salvage). In this case all locks before salvaged lock will marked as used and corresponding
      *      transactions will be invalidated.
@@ -606,32 +554,6 @@ public class GridDistributedCacheEntry<K, V> extends GridCacheMapEntry<K, V> {
     @Nullable public GridCacheMvccCandidate<K> doneRemote(
         GridCacheVersion lockVer,
         GridCacheVersion baseVer,
-        Collection<GridCacheVersion> committedVers,
-        Collection<GridCacheVersion> rolledbackVers,
-        boolean sysInvalidate) throws GridCacheEntryRemovedException {
-        return doneRemote(lockVer, baseVer, Collections.<GridCacheVersion>emptySet(), committedVers,
-            rolledbackVers, sysInvalidate);
-    }
-
-    /**
-     *
-     * @param lockVer Done version.
-     * @param baseVer Base version.
-     * @param pendingVers Pending versions that are less than lock version.
-     * @param committedVers Completed versions for reordering.
-     * @param rolledbackVers Rolled back versions for reordering.
-     * @param sysInvalidate Flag indicating if this entry is done from invalidated transaction (in case of tx
-     *      salvage). In this case all locks before salvaged lock will marked as used and corresponding
-     *      transactions will be invalidated.
-     * @throws GridCacheEntryRemovedException If entry has been removed.
-     * @return Owner.
-     */
-    @Nullable public GridCacheMvccCandidate<K> doneRemote(
-        GridCacheVersion lockVer,
-        GridCacheVersion baseVer,
-        @Nullable Collection<GridCacheVersion> pendingVers,
-        Collection<GridCacheVersion> committedVers,
-        Collection<GridCacheVersion> rolledbackVers,
         boolean sysInvalidate) throws GridCacheEntryRemovedException {
         GridCacheMvccCandidate<K> prev = null;
         GridCacheMvccCandidate<K> owner = null;
@@ -648,19 +570,10 @@ public class GridDistributedCacheEntry<K, V> extends GridCacheMapEntry<K, V> {
 
                 boolean emptyBefore = mvcc.isEmpty();
 
-                // Order completed versions.
-                if (!F.isEmpty(committedVers) || !F.isEmpty(rolledbackVers)) {
-                    mvcc.orderCompleted(lockVer, committedVers, rolledbackVers);
-
-                    if (!baseVer.equals(lockVer))
-                        mvcc.orderCompleted(baseVer, committedVers, rolledbackVers);
-                }
-
                 if (sysInvalidate && baseVer != null)
                     mvcc.salvageRemote(baseVer);
 
-                owner = mvcc.doneRemote(lockVer, maskNull(pendingVers), maskNull(committedVers),
-                    maskNull(rolledbackVers));
+                owner = mvcc.doneRemote(lockVer);
 
                 boolean emptyAfter = mvcc.isEmpty();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a88c019/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
index ee993eb..d01d212 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
@@ -170,15 +170,10 @@ public class GridDistributedLockResponse<K, V> extends GridDistributedBaseMessag
     /**
      * @param idx Candidates index.
      * @param cands Collection of candidates.
-     * @param committedVers Committed versions relative to lock version.
-     * @param rolledbackVers Rolled back versions relative to lock version.
      */
-    public void setCandidates(int idx, Collection<GridCacheMvccCandidate<K>> cands,
-        Collection<GridCacheVersion> committedVers, Collection<GridCacheVersion> rolledbackVers) {
+    public void setCandidates(int idx, Collection<GridCacheMvccCandidate<K>> cands) {
         assert idx >= 0;
 
-        completedVersions(committedVers, rolledbackVers);
-
         candidatesByIndex(idx, cands);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a88c019/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
index 4d06ef4..81a5cf7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
@@ -25,7 +25,6 @@ import org.jetbrains.annotations.*;
 
 import java.io.*;
 import java.nio.*;
-import java.util.*;
 
 /**
  * Transaction completion message.
@@ -55,9 +54,6 @@ public class GridDistributedTxFinishRequest<K, V> extends GridDistributedBaseMes
     /** Sync commit flag. */
     private boolean syncRollback;
 
-    /** Min version used as base for completed versions. */
-    private GridCacheVersion baseVer;
-
     /** Expected txSize. */
     private int txSize;
 
@@ -79,9 +75,6 @@ public class GridDistributedTxFinishRequest<K, V> extends GridDistributedBaseMes
      * @param commit Commit flag.
      * @param invalidate Invalidate flag.
      * @param sys System flag.
-     * @param baseVer Base version.
-     * @param committedVers Committed versions.
-     * @param rolledbackVers Rolled back versions.
      * @param txSize Expected transaction size.
      */
     public GridDistributedTxFinishRequest(
@@ -94,9 +87,6 @@ public class GridDistributedTxFinishRequest<K, V> extends GridDistributedBaseMes
         boolean sys,
         boolean syncCommit,
         boolean syncRollback,
-        GridCacheVersion baseVer,
-        Collection<GridCacheVersion> committedVers,
-        Collection<GridCacheVersion> rolledbackVers,
         int txSize
     ) {
         super(xidVer, 0);
@@ -110,10 +100,7 @@ public class GridDistributedTxFinishRequest<K, V> extends GridDistributedBaseMes
         this.sys = sys;
         this.syncCommit = syncCommit;
         this.syncRollback = syncRollback;
-        this.baseVer = baseVer;
         this.txSize = txSize;
-
-        completedVersions(committedVers, rolledbackVers);
     }
 
     /**
@@ -174,13 +161,6 @@ public class GridDistributedTxFinishRequest<K, V> extends GridDistributedBaseMes
     }
 
     /**
-     * @return Base version.
-     */
-    public GridCacheVersion baseVersion() {
-        return baseVer;
-    }
-
-    /**
      * @return Expected tx size.
      */
     public int txSize() {
@@ -210,12 +190,6 @@ public class GridDistributedTxFinishRequest<K, V> extends GridDistributedBaseMes
         }
 
         switch (writer.state()) {
-            case 8:
-                if (!writer.writeMessage("baseVer", baseVer))
-                    return false;
-
-                writer.incrementState();
-
             case 9:
                 if (!writer.writeBoolean("commit", commit))
                     return false;
@@ -283,14 +257,6 @@ public class GridDistributedTxFinishRequest<K, V> extends GridDistributedBaseMes
             return false;
 
         switch (readState) {
-            case 8:
-                baseVer = reader.readMessage("baseVer");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                readState++;
-
             case 9:
                 commit = reader.readBoolean("commit");
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a88c019/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
index 1bd58ef..ef4f302 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
@@ -218,19 +218,16 @@ public class GridDistributedTxRemoteAdapter<K, V> extends IgniteTxAdapter<K, V>
 
     /**
      * @param baseVer Base version.
-     * @param committedVers Committed versions.
-     * @param rolledbackVers Rolled back versions.
      */
-    @Override public void doneRemote(GridCacheVersion baseVer, Collection<GridCacheVersion> committedVers,
-        Collection<GridCacheVersion> rolledbackVers, Collection<GridCacheVersion> pendingVers) {
+    @Override public void doneRemote(GridCacheVersion baseVer) {
         if (readMap != null && !readMap.isEmpty()) {
             for (IgniteTxEntry<K, V> txEntry : readMap.values())
-                doneRemote(txEntry, baseVer, committedVers, rolledbackVers, pendingVers);
+                doneRemote(txEntry, baseVer);
         }
 
         if (writeMap != null && !writeMap.isEmpty()) {
             for (IgniteTxEntry<K, V> txEntry : writeMap.values())
-                doneRemote(txEntry, baseVer, committedVers, rolledbackVers, pendingVers);
+                doneRemote(txEntry, baseVer);
         }
     }
 
@@ -239,13 +236,8 @@ public class GridDistributedTxRemoteAdapter<K, V> extends IgniteTxAdapter<K, V>
      *
      * @param txEntry Entry.
      * @param baseVer Base version for completed versions.
-     * @param committedVers Completed versions relative to base version.
-     * @param rolledbackVers Rolled back versions relative to base version.
-     * @param pendingVers Pending versions.
      */
-    private void doneRemote(IgniteTxEntry<K, V> txEntry, GridCacheVersion baseVer,
-        Collection<GridCacheVersion> committedVers, Collection<GridCacheVersion> rolledbackVers,
-        Collection<GridCacheVersion> pendingVers) {
+    private void doneRemote(IgniteTxEntry<K, V> txEntry, GridCacheVersion baseVer) {
         while (true) {
             GridDistributedCacheEntry<K, V> entry = (GridDistributedCacheEntry<K, V>)txEntry.cached();
 
@@ -253,7 +245,7 @@ public class GridDistributedTxRemoteAdapter<K, V> extends IgniteTxAdapter<K, V>
                 // Handle explicit locks.
                 GridCacheVersion doneVer = txEntry.explicitVersion() != null ? txEntry.explicitVersion() : xidVer;
 
-                entry.doneRemote(doneVer, baseVer, pendingVers, committedVers, rolledbackVers, isSystemInvalidate());
+                entry.doneRemote(doneVer, baseVer, isSystemInvalidate());
 
                 break;
             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a88c019/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
index 31f0c58..5a5d5e1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
@@ -741,14 +741,12 @@ public final class GridDhtLockFuture<K, V> extends GridCompoundIdentityFuture<Bo
             if (log.isDebugEnabled())
                 log.debug("Mapping entry for DHT lock future: " + this);
 
-            boolean hasRmtNodes = false;
-
             // Assign keys to primary nodes.
             for (GridDhtCacheEntry<K, V> entry : entries) {
                 try {
                     while (true) {
                         try {
-                            hasRmtNodes = cctx.dhtMap(nearNodeId, topVer, entry, log, dhtMap, null);
+                            cctx.dhtMap(nearNodeId, topVer, entry, log, dhtMap, null);
 
                             GridCacheMvccCandidate<K> cand = entry.mappings(lockVer);
 
@@ -775,9 +773,6 @@ public final class GridDhtLockFuture<K, V> extends GridCompoundIdentityFuture<Bo
                 }
             }
 
-            if (tx != null)
-                tx.needsCompletedVersions(hasRmtNodes);
-
             if (isDone()) {
                 if (log.isDebugEnabled())
                     log.debug("Mapping won't proceed because future is done: " + this);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a88c019/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
index a769e41..4cabb47 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
@@ -791,6 +791,7 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
                                     req.timeout(),
                                     req.isInvalidate(),
                                     false,
+                                    false,
                                     req.txSize(),
                                     null,
                                     req.subjectId(),
@@ -956,13 +957,6 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
                 req.version(), req.futureId(), req.miniId(), tx != null && tx.onePhaseCommit(), entries.size(), err);
 
             if (err == null) {
-                res.pending(localDhtPendingVersions(entries, mappedVer));
-
-                // We have to add completed versions for cases when nearLocal and remote transactions
-                // execute concurrently.
-                res.completedVersions(ctx.tm().committedVersions(req.version()),
-                    ctx.tm().rolledbackVersions(req.version()));
-
                 int i = 0;
 
                 for (ListIterator<GridCacheEntryEx<K, V>> it = entries.listIterator(); it.hasNext();) {
@@ -1106,40 +1100,6 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
     }
 
     /**
-     * Collects versions of pending candidates versions less then base.
-     *
-     * @param entries Tx entries to process.
-     * @param baseVer Base version.
-     * @return Collection of pending candidates versions.
-     */
-    private Collection<GridCacheVersion> localDhtPendingVersions(Iterable<GridCacheEntryEx<K, V>> entries,
-        GridCacheVersion baseVer) {
-        Collection<GridCacheVersion> lessPending = new GridLeanSet<>(5);
-
-        for (GridCacheEntryEx<K, V> entry : entries) {
-            // Since entries were collected before locks are added, some of them may become obsolete.
-            while (true) {
-                try {
-                    for (GridCacheMvccCandidate cand : entry.localCandidates()) {
-                        if (cand.version().isLess(baseVer))
-                            lessPending.add(cand.version());
-                    }
-
-                    break; // While.
-                }
-                catch (GridCacheEntryRemovedException ignored) {
-                    if (log.isDebugEnabled())
-                        log.debug("Got removed entry is localDhtPendingVersions (will retry): " + entry);
-
-                    entry = entryExx(entry.key());
-                }
-            }
-        }
-
-        return lessPending;
-    }
-
-    /**
      * @param nodeId Node ID.
      * @param req Request.
      */
@@ -1166,9 +1126,6 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
                         entry.doneRemote(
                             req.version(),
                             req.version(),
-                            null,
-                            null,
-                            null,
                             /*system invalidate*/false);
 
                         // Note that we don't reorder completed versions here,
@@ -1387,9 +1344,6 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
             }
         }
 
-        Collection<GridCacheVersion> committed = ctx.tm().committedVersions(ver);
-        Collection<GridCacheVersion> rolledback = ctx.tm().rolledbackVersions(ver);
-
         // Backups.
         for (Map.Entry<ClusterNode, List<T2<K, byte[]>>> entry : dhtMap.entrySet()) {
             ClusterNode n = entry.getKey();
@@ -1410,8 +1364,6 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
                     for (T2<K, byte[]> key : keyBytes)
                         req.addNearKey(key.get1(), key.get2(), ctx.shared());
 
-                req.completedVersions(committed, rolledback);
-
                 ctx.io().send(n, req, ctx.ioPolicy());
             }
             catch (ClusterTopologyCheckedException ignore) {
@@ -1438,8 +1390,6 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
                     for (T2<K, byte[]> key : keyBytes)
                         req.addNearKey(key.get1(), key.get2(), ctx.shared());
 
-                    req.completedVersions(committed, rolledback);
-
                     ctx.io().send(n, req, ctx.ioPolicy());
                 }
                 catch (ClusterTopologyCheckedException ignore) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a88c019/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java
index 2f7696b..bb80480 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java
@@ -321,10 +321,6 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFutur
                 tx.isSystemInvalidate(),
                 tx.syncCommit(),
                 tx.syncRollback(),
-                tx.completedBase(),
-                tx.committedVersions(),
-                tx.rolledbackVersions(),
-                tx.pendingVersions(),
                 tx.size(),
                 tx.subjectId(),
                 tx.taskNameHash());
@@ -371,10 +367,6 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFutur
                     tx.isSystemInvalidate(),
                     tx.syncCommit(),
                     tx.syncRollback(),
-                    tx.completedBase(),
-                    tx.committedVersions(),
-                    tx.rolledbackVersions(),
-                    tx.pendingVersions(),
                     tx.size(),
                     tx.subjectId(),
                     tx.taskNameHash());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a88c019/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
index f5e41dd..97a8b46 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
@@ -17,12 +17,10 @@
 
 package org.apache.ignite.internal.processors.cache.distributed.dht;
 
-import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.processors.cache.distributed.*;
 import org.apache.ignite.internal.processors.cache.version.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.transactions.*;
-import org.apache.ignite.internal.util.tostring.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.plugin.extensions.communication.*;
 import org.jetbrains.annotations.*;
@@ -56,11 +54,6 @@ public class GridDhtTxFinishRequest<K, V> extends GridDistributedTxFinishRequest
     /** Check comitted flag. */
     private boolean checkCommitted;
 
-    /** Pending versions with order less than one for this message (needed for commit ordering). */
-    @GridToStringInclude
-    @GridDirectCollection(GridCacheVersion.class)
-    private Collection<GridCacheVersion> pendingVers;
-
     /** One phase commit write version. */
     private GridCacheVersion writeVer;
 
@@ -92,10 +85,6 @@ public class GridDhtTxFinishRequest<K, V> extends GridDistributedTxFinishRequest
      * @param sysInvalidate System invalidation flag.
      * @param syncCommit Synchronous commit flag.
      * @param syncRollback Synchronous rollback flag.
-     * @param baseVer Base version.
-     * @param committedVers Committed versions.
-     * @param rolledbackVers Rolled back versions.
-     * @param pendingVers Pending versions.
      * @param txSize Expected transaction size.
      * @param subjId Subject ID.
      * @param taskNameHash Task name hash.
@@ -115,22 +104,16 @@ public class GridDhtTxFinishRequest<K, V> extends GridDistributedTxFinishRequest
         boolean sysInvalidate,
         boolean syncCommit,
         boolean syncRollback,
-        GridCacheVersion baseVer,
-        Collection<GridCacheVersion> committedVers,
-        Collection<GridCacheVersion> rolledbackVers,
-        Collection<GridCacheVersion> pendingVers,
         int txSize,
         @Nullable UUID subjId,
         int taskNameHash
     ) {
-        super(xidVer, futId, commitVer, threadId, commit, invalidate, sys, syncCommit, syncRollback, baseVer,
-            committedVers, rolledbackVers, txSize);
+        super(xidVer, futId, commitVer, threadId, commit, invalidate, sys, syncCommit, syncRollback, txSize);
 
         assert miniId != null;
         assert nearNodeId != null;
         assert isolation != null;
 
-        this.pendingVers = pendingVers;
         this.topVer = topVer;
         this.nearNodeId = nearNodeId;
         this.isolation = isolation;
@@ -202,20 +185,17 @@ public class GridDhtTxFinishRequest<K, V> extends GridDistributedTxFinishRequest
     }
 
     /**
-     * @return Topology version.
+     * @return Check committed flag.
      */
-    @Override public long topologyVersion() {
-        return topVer;
+    public boolean checkCommitted() {
+        return checkCommitted;
     }
 
     /**
-     * Gets versions of not acquired locks with version less then one of transaction being committed.
-     *
-     * @return Versions of locks for entries participating in transaction that have not been acquired yet
-     *      have version less then one of transaction being committed.
+     * @return Topology version.
      */
-    public Collection<GridCacheVersion> pendingVersions() {
-        return pendingVers == null ? Collections.<GridCacheVersion>emptyList() : pendingVers;
+    @Override public long topologyVersion() {
+        return topVer;
     }
 
     /** {@inheritDoc} */
@@ -262,12 +242,6 @@ public class GridDhtTxFinishRequest<K, V> extends GridDistributedTxFinishRequest
 
                 writer.incrementState();
 
-            case 22:
-                if (!writer.writeCollection("pendingVers", pendingVers, Type.MSG))
-                    return false;
-
-                writer.incrementState();
-
             case 23:
                 if (!writer.writeUuid("subjId", subjId))
                     return false;
@@ -347,14 +321,6 @@ public class GridDhtTxFinishRequest<K, V> extends GridDistributedTxFinishRequest
 
                 readState++;
 
-            case 22:
-                pendingVers = reader.readCollection("pendingVers", Type.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                readState++;
-
             case 23:
                 subjId = reader.readUuid("subjId");
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a88c019/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
index ae93e7e..953956c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
@@ -108,6 +108,7 @@ public class GridDhtTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> implements
         long timeout,
         boolean invalidate,
         boolean storeEnabled,
+        boolean onePhaseCommit,
         int txSize,
         Map<UUID, Collection<UUID>> txNodes,
         UUID subjId,
@@ -115,7 +116,7 @@ public class GridDhtTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> implements
     ) {
         super(
             cctx,
-            cctx.versions().onReceivedAndNext(nearNodeId, nearXidVer),
+            onePhaseCommit ? nearXidVer : cctx.versions().onReceivedAndNext(nearNodeId, nearXidVer),
             implicit,
             implicitSingle,
             sys,
@@ -124,6 +125,7 @@ public class GridDhtTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> implements
             timeout,
             invalidate,
             storeEnabled,
+            onePhaseCommit,
             txSize,
             subjId,
             taskNameHash);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a88c019/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
index 6280660..3ea25ca 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
@@ -63,12 +63,6 @@ public abstract class GridDhtTxLocalAdapter<K, V> extends IgniteTxLocalAdapter<K
     /** */
     private long dhtThreadId;
 
-    /** */
-    private boolean needsCompletedVers;
-
-    /** Versions of pending locks for entries of this tx. */
-    private Collection<GridCacheVersion> pendingVers;
-
     /**
      * Empty constructor required for {@link Externalizable}.
      */
@@ -98,12 +92,13 @@ public abstract class GridDhtTxLocalAdapter<K, V> extends IgniteTxLocalAdapter<K
         long timeout,
         boolean invalidate,
         boolean storeEnabled,
+        boolean onePhaseCommit,
         int txSize,
         @Nullable UUID subjId,
         int taskNameHash
     ) {
         super(cctx, xidVer, implicit, implicitSingle, sys, concurrency, isolation, timeout, invalidate, storeEnabled,
-            txSize, subjId, taskNameHash);
+            onePhaseCommit, txSize, subjId, taskNameHash);
 
         assert cctx != null;
 
@@ -147,32 +142,6 @@ public abstract class GridDhtTxLocalAdapter<K, V> extends IgniteTxLocalAdapter<K
     protected abstract void sendFinishReply(boolean commit, @Nullable Throwable err);
 
     /**
-     * @param needsCompletedVers {@code True} if needs completed versions.
-     */
-    public void needsCompletedVersions(boolean needsCompletedVers) {
-        this.needsCompletedVers |= needsCompletedVers;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean needsCompletedVersions() {
-        return needsCompletedVers;
-    }
-
-    /**
-     * @return Versions for all pending locks that were in queue before tx locks were released.
-     */
-    public Collection<GridCacheVersion> pendingVersions() {
-        return pendingVers == null ? Collections.<GridCacheVersion>emptyList() : pendingVers;
-    }
-
-    /**
-     * @param pendingVers Versions for all pending locks that were in queue before tx locsk were released.
-     */
-    public void pendingVersions(Collection<GridCacheVersion> pendingVers) {
-        this.pendingVers = pendingVers;
-    }
-
-    /**
      * @return DHT thread ID.
      */
     long dhtThreadId() {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a88c019/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
index e8852a4..f6ae0fb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
@@ -483,7 +483,11 @@ public final class GridDhtTxPrepareFuture<K, V> extends GridCompoundIdentityFutu
         if (tx.optimistic())
             tx.clearPrepareFuture(this);
 
-        if (tx.onePhaseCommit()) {
+        // Check if originating node has a near cache participating in transaction.
+        boolean hasNearCache = originatingNodeHasNearCache();
+
+        // Do not commit one-phase commit transaction if originating node has near cache enabled.
+        if (tx.onePhaseCommit() && !hasNearCache) {
             assert last;
 
             // Must create prepare response before transaction is committed to grab correct return value.
@@ -591,12 +595,6 @@ public final class GridDhtTxPrepareFuture<K, V> extends GridCompoundIdentityFutu
         if (prepErr == null) {
             addDhtValues(res);
 
-            GridCacheVersion min = tx.minVersion();
-
-            res.completedVersions(cctx.tm().committedVersions(min), cctx.tm().rolledbackVersions(min));
-
-            res.pending(localDhtPendingVersions(tx.writeEntries(), min));
-
             tx.implicitSingleResult(ret);
         }
 
@@ -606,6 +604,30 @@ public final class GridDhtTxPrepareFuture<K, V> extends GridCompoundIdentityFutu
     }
 
     /**
+     * Checks if transaction involves a near-enabled cache on originating node.
+     *
+     * @return {@code True} if originating node has a near cache enabled and that cache participates in
+     *      the transaction.
+     */
+    private boolean originatingNodeHasNearCache() {
+        ClusterNode node = cctx.discovery().node(tx.originatingNodeId());
+
+        if (node == null)
+            return false;
+
+        GridCacheAttributes[] attrs = node.attribute(IgniteNodeAttributes.ATTR_CACHE);
+
+        for (GridCacheAttributes attr : attrs) {
+            if (attr.nearCacheEnabled()) {
+                if (tx.activeCacheIds().contains(CU.cacheId(attr.cacheName())))
+                    return true;
+            }
+        }
+
+        return false;
+    }
+
+    /**
      * @param res Response being sent.
      */
     private void addDhtValues(GridNearTxPrepareResponse<K, V> res) {
@@ -776,20 +798,16 @@ public final class GridDhtTxPrepareFuture<K, V> extends GridCompoundIdentityFutu
                 Map<UUID, GridDistributedTxMapping<K, V>> futDhtMap = new HashMap<>();
                 Map<UUID, GridDistributedTxMapping<K, V>> futNearMap = new HashMap<>();
 
-                boolean hasRemoteNodes = false;
-
                 // Assign keys to primary nodes.
                 if (!F.isEmpty(writes)) {
                     for (IgniteTxEntry<K, V> write : writes)
-                        hasRemoteNodes |= map(tx.entry(write.txKey()), futDhtMap, futNearMap);
+                        map(tx.entry(write.txKey()), futDhtMap, futNearMap);
                 }
 
                 if (!F.isEmpty(reads)) {
                     for (IgniteTxEntry<K, V> read : reads)
-                        hasRemoteNodes |= map(tx.entry(read.txKey()), futDhtMap, futNearMap);
+                        map(tx.entry(read.txKey()), futDhtMap, futNearMap);
                 }
-
-                tx.needsCompletedVersions(hasRemoteNodes);
             }
 
             if (isDone())
@@ -1075,32 +1093,6 @@ public final class GridDhtTxPrepareFuture<K, V> extends GridCompoundIdentityFutu
         return ret;
     }
 
-    /**
-     * Collects versions of pending candidates versions less than base.
-     *
-     * @param entries Tx entries to process.
-     * @param baseVer Base version.
-     * @return Collection of pending candidates versions.
-     */
-    private Collection<GridCacheVersion> localDhtPendingVersions(Iterable<IgniteTxEntry<K, V>> entries,
-        GridCacheVersion baseVer) {
-        Collection<GridCacheVersion> lessPending = new GridLeanSet<>(5);
-
-        for (IgniteTxEntry<K, V> entry : entries) {
-            try {
-                for (GridCacheMvccCandidate cand : entry.cached().localCandidates()) {
-                    if (cand.version().isLess(baseVer))
-                        lessPending.add(cand.version());
-                }
-            }
-            catch (GridCacheEntryRemovedException ignored) {
-                // No-op, no candidates.
-            }
-        }
-
-        return lessPending;
-    }
-
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(GridDhtTxPrepareFuture.class, this, "super", super.toString());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a88c019/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
index a59b6aa..a17d011 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
@@ -557,17 +557,12 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
             if (map == null || map.isEmpty())
                 return;
 
-            Collection<GridCacheVersion> committed = ctx.tm().committedVersions(ver);
-            Collection<GridCacheVersion> rolledback = ctx.tm().rolledbackVersions(ver);
-
             for (Map.Entry<ClusterNode, GridNearUnlockRequest<K, V>> mapping : map.entrySet()) {
                 ClusterNode n = mapping.getKey();
 
                 GridDistributedUnlockRequest<K, V> req = mapping.getValue();
 
                 if (!F.isEmpty(req.keyBytes()) || !F.isEmpty(req.keys())) {
-                    req.completedVersions(committed, rolledback);
-
                     // We don't wait for reply to this message.
                     ctx.io().send(n, req, ctx.ioPolicy());
                 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a88c019/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
index adb7ab5..bdb52d1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
@@ -1030,8 +1030,7 @@ public final class GridNearLockFuture<K, V> extends GridCompoundIdentityFuture<B
                                         // returned value if any.
                                         entry.resetFromPrimary(newVal, newBytes, lockVer, dhtVer, node.id());
 
-                                        entry.readyNearLock(lockVer, mappedVer, res.committedVersions(),
-                                            res.rolledbackVersions(), res.pending());
+                                        entry.readyNearLock(lockVer, mappedVer);
 
                                         if (inTx() && implicitTx() && tx.onePhaseCommit()) {
                                             boolean pass = res.filterResult(i);
@@ -1394,8 +1393,7 @@ public final class GridNearLockFuture<K, V> extends GridCompoundIdentityFuture<B
                                 tx.entry(cctx.txKey(k)).filters(pass ? CU.<K, V>empty() : CU.<K, V>alwaysFalse());
                             }
 
-                            entry.readyNearLock(lockVer, mappedVer, res.committedVersions(), res.rolledbackVersions(),
-                                res.pending());
+                            entry.readyNearLock(lockVer, mappedVer);
 
                             if (retval) {
                                 if (readRecordable)

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a88c019/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java
index 8919465..6ba3dab 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.internal.processors.cache.distributed.near;
 
 import org.apache.ignite.*;
-import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.cache.distributed.*;
 import org.apache.ignite.internal.processors.cache.version.*;
@@ -30,7 +29,6 @@ import org.jetbrains.annotations.*;
 
 import java.io.*;
 import java.nio.*;
-import java.util.*;
 
 /**
  * Near cache lock response.
@@ -39,11 +37,6 @@ public class GridNearLockResponse<K, V> extends GridDistributedLockResponse<K, V
     /** */
     private static final long serialVersionUID = 0L;
 
-    /** Collection of versions that are pending and less than lock version. */
-    @GridToStringInclude
-    @GridDirectCollection(GridCacheVersion.class)
-    private Collection<GridCacheVersion> pending;
-
     /** */
     private IgniteUuid miniId;
 
@@ -97,24 +90,6 @@ public class GridNearLockResponse<K, V> extends GridDistributedLockResponse<K, V
     }
 
     /**
-     * Gets pending versions that are less than {@link #version()}.
-     *
-     * @return Pending versions.
-     */
-    public Collection<GridCacheVersion> pending() {
-        return pending;
-    }
-
-    /**
-     * Sets pending versions that are less than {@link #version()}.
-     *
-     * @param pending Pending versions.
-     */
-    public void pending(Collection<GridCacheVersion> pending) {
-        this.pending = pending;
-    }
-
-    /**
      * @return Mini future ID.
      */
     public IgniteUuid miniId() {
@@ -218,13 +193,6 @@ public class GridNearLockResponse<K, V> extends GridDistributedLockResponse<K, V
                     return false;
 
                 writer.incrementState();
-
-            case 15:
-                if (!writer.writeCollection("pending", pending, Type.MSG))
-                    return false;
-
-                writer.incrementState();
-
         }
 
         return true;
@@ -269,15 +237,6 @@ public class GridNearLockResponse<K, V> extends GridDistributedLockResponse<K, V
                     return false;
 
                 readState++;
-
-            case 15:
-                pending = reader.readCollection("pending", Type.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                readState++;
-
         }
 
         return true;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a88c019/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java
index 8792fcb..f1d96d8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java
@@ -194,9 +194,6 @@ public class GridNearTransactionalCache<K, V> extends GridNearCacheAdapter<K, V>
                             entry.doneRemote(
                                 req.version(),
                                 req.version(),
-                                null,
-                                req.committedVersions(),
-                                req.rolledbackVersions(),
                                 /*system invalidate*/false);
 
                             // Note that we don't reorder completed versions here,
@@ -665,17 +662,12 @@ public class GridNearTransactionalCache<K, V> extends GridNearCacheAdapter<K, V>
             if (map == null || map.isEmpty())
                 return;
 
-            Collection<GridCacheVersion> committed = ctx.tm().committedVersions(ver);
-            Collection<GridCacheVersion> rolledback = ctx.tm().rolledbackVersions(ver);
-
             for (Map.Entry<ClusterNode, GridNearUnlockRequest<K, V>> mapping : map.entrySet()) {
                 ClusterNode n = mapping.getKey();
 
                 GridDistributedUnlockRequest<K, V> req = mapping.getValue();
 
                 if (!F.isEmpty(req.keyBytes()) || !F.isEmpty(req.keys())) {
-                    req.completedVersions(committed, rolledback);
-
                     // We don't wait for reply to this message.
                     ctx.io().send(n, req, ctx.ioPolicy());
                 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a88c019/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
index 81e97ec..0152b39 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
@@ -282,8 +282,23 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
      */
     void finish() {
         if (tx.onePhaseCommit()) {
-            if (commit && tx.needCheckBackup())
-                checkBackup();
+            if (commit) {
+                if (tx.needCheckBackup())
+                    checkBackup();
+                else if (needFinishOnePhase()) {
+                    finish(mappings.values());
+
+                    boolean complete = true;
+
+                    for (IgniteInternalFuture<?> f : pending())
+                        // Mini-future in non-sync mode gets done when message gets sent.
+                        if (isMini(f) && !f.isDone())
+                            complete = false;
+
+                    if (complete)
+                        onComplete();
+                }
+            }
 
             markInitialized();
 
@@ -354,10 +369,6 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
                     false,
                     true,
                     true,
-                    tx.xidVersion(),
-                    null,
-                    null,
-                    null,
                     0,
                     null,
                     0);
@@ -378,6 +389,20 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
     /**
      *
      */
+    private boolean needFinishOnePhase() {
+        for (Integer cacheId : tx.activeCacheIds()) {
+            GridCacheContext<K, V> cacheCtx = cctx.cacheContext(cacheId);
+
+            if (cacheCtx.isNear())
+                return true;
+        }
+
+        return false;
+    }
+
+    /**
+     *
+     */
     private void finishOnePhase() {
         // No need to send messages as transaction was already committed on remote node.
         // Finish local mapping only as we need send commit message to backups.
@@ -421,9 +446,6 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
             m.explicitLock(),
             tx.storeEnabled(),
             tx.topologyVersion(),
-            null,
-            null,
-            null,
             tx.size(),
             tx.subjectId(),
             tx.taskNameHash()

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a88c019/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java
index cd215bf..5cd0957 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java
@@ -70,9 +70,6 @@ public class GridNearTxFinishRequest<K, V> extends GridDistributedTxFinishReques
      * @param explicitLock Explicit lock flag.
      * @param storeEnabled Store enabled flag.
      * @param topVer Topology version.
-     * @param baseVer Base version.
-     * @param committedVers Committed versions.
-     * @param rolledbackVers Rolled back versions.
      * @param txSize Expected transaction size.
      */
     public GridNearTxFinishRequest(
@@ -87,14 +84,10 @@ public class GridNearTxFinishRequest<K, V> extends GridDistributedTxFinishReques
         boolean explicitLock,
         boolean storeEnabled,
         long topVer,
-        GridCacheVersion baseVer,
-        Collection<GridCacheVersion> committedVers,
-        Collection<GridCacheVersion> rolledbackVers,
         int txSize,
         @Nullable UUID subjId,
         int taskNameHash) {
-        super(xidVer, futId, null, threadId, commit, invalidate, sys, syncCommit, syncRollback, baseVer, committedVers,
-            rolledbackVers, txSize);
+        super(xidVer, futId, null, threadId, commit, invalidate, sys, syncCommit, syncRollback, txSize);
 
         this.explicitLock = explicitLock;
         this.storeEnabled = storeEnabled;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a88c019/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
index 0a651ba..b6bc993 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
@@ -134,6 +134,7 @@ public class GridNearTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> {
             timeout,
             invalidate,
             storeEnabled,
+            false,
             txSize,
             subjId,
             taskNameHash);
@@ -546,15 +547,8 @@ public class GridNearTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> {
 
     /**
      * @param mapping Mapping to order.
-     * @param pendingVers Pending versions.
-     * @param committedVers Committed versions.
-     * @param rolledbackVers Rolled back versions.
      */
-    void readyNearLocks(GridDistributedTxMapping<K, V> mapping,
-        Collection<GridCacheVersion> pendingVers,
-        Collection<GridCacheVersion> committedVers,
-        Collection<GridCacheVersion> rolledbackVers)
-    {
+    void readyNearLocks(GridDistributedTxMapping<K, V> mapping) {
         Collection<IgniteTxEntry<K, V>> entries = F.concat(false, mapping.reads(), mapping.writes());
 
         for (IgniteTxEntry<K, V> txEntry : entries) {
@@ -570,7 +564,7 @@ public class GridNearTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> {
                     GridCacheVersion explicit = txEntry.explicitVersion();
 
                     if (explicit == null)
-                        entry.readyNearLock(xidVer, mapping.dhtVersion(), committedVers, rolledbackVers, pendingVers);
+                        entry.readyNearLock(xidVer, mapping.dhtVersion());
 
                     break;
                 }
@@ -767,13 +761,20 @@ public class GridNearTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> {
 
                 try {
                     // Make sure that here are no exceptions.
-                    f.get();
+                    if (!needCheckBackup()) {
+                        f.get();
+
+                        if (finish(true))
+                            fut0.finish();
+                        else
+                            fut0.onError(new IgniteCheckedException("Failed to commit transaction: " +
+                                CU.txString(GridNearTxLocal.this)));
+                    }
+                    else {
+                        assert onePhaseCommit();
 
-                    if (finish(true))
                         fut0.finish();
-                    else
-                        fut0.onError(new IgniteCheckedException("Failed to commit transaction: " +
-                            CU.txString(GridNearTxLocal.this)));
+                    }
                 }
                 catch (Error | RuntimeException e) {
                     commitErr.compareAndSet(null, e);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a88c019/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
index 73c1d74..d43e409 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
@@ -739,7 +739,6 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut
      * @param entry Transaction entry.
      * @param topVer Topology version.
      * @param cur Current mapping.
-     * @throws IgniteCheckedException If transaction is group-lock and local node is not primary for key.
      * @return Mapping.
      */
     private GridDistributedTxMapping<K, V> map(
@@ -984,7 +983,7 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut
                         m.dhtVersion(res.dhtVersion());
 
                         if (m.near())
-                            tx.readyNearLocks(m, res.pending(), res.committedVersions(), res.rolledbackVersions());
+                            tx.readyNearLocks(m);
                     }
 
                     // Proceed prepare before finishing mini future.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a88c019/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
index 5106f94..5c101af 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
@@ -41,11 +41,6 @@ public class GridNearTxPrepareResponse<K, V> extends GridDistributedTxPrepareRes
     /** */
     private static final long serialVersionUID = 0L;
 
-    /** Collection of versions that are pending and less than lock version. */
-    @GridToStringInclude
-    @GridDirectCollection(GridCacheVersion.class)
-    private Collection<GridCacheVersion> pending;
-
     /** Future ID.  */
     private IgniteUuid futId;
 
@@ -122,24 +117,6 @@ public class GridNearTxPrepareResponse<K, V> extends GridDistributedTxPrepareRes
     }
 
     /**
-     * Gets pending versions that are less than {@link #version()}.
-     *
-     * @return Pending versions.
-     */
-    public Collection<GridCacheVersion> pending() {
-        return pending == null ? Collections.<GridCacheVersion>emptyList() : pending;
-    }
-
-    /**
-     * Sets pending versions that are less than {@link #version()}.
-     *
-     * @param pending Pending versions.
-     */
-    public void pending(Collection<GridCacheVersion> pending) {
-        this.pending = pending;
-    }
-
-    /**
      * @return Mini future ID.
      */
     public IgniteUuid miniId() {
@@ -333,12 +310,6 @@ public class GridNearTxPrepareResponse<K, V> extends GridDistributedTxPrepareRes
 
                 writer.incrementState();
 
-            case 16:
-                if (!writer.writeCollection("pending", pending, Type.MSG))
-                    return false;
-
-                writer.incrementState();
-
             case 17:
                 if (!writer.writeByteArray("retValBytes", retValBytes))
                     return false;
@@ -406,14 +377,6 @@ public class GridNearTxPrepareResponse<K, V> extends GridDistributedTxPrepareRes
 
                 readState++;
 
-            case 16:
-                pending = reader.readCollection("pending", Type.MSG);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                readState++;
-
             case 17:
                 retValBytes = reader.readByteArray("retValBytes");
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a88c019/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java
index 2a38a5e..43735fe 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java
@@ -660,19 +660,6 @@ public interface IgniteInternalTx<K, V> extends AutoCloseable, GridTimeoutObject
     public Collection<GridCacheVersion> alternateVersions();
 
     /**
-     * @return {@code True} if transaction needs completed versions for processing.
-     */
-    public boolean needsCompletedVersions();
-
-    /**
-     * @param base Base for committed versions.
-     * @param committed Committed transactions relative to base.
-     * @param rolledback Rolled back transactions relative to base.
-     */
-    public void completedVersions(GridCacheVersion base, Collection<GridCacheVersion> committed,
-        Collection<GridCacheVersion> rolledback);
-
-    /**
      * @return {@code True} if transaction has at least one internal entry.
      */
     public boolean internal();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a88c019/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
index 3f65b6b..6d5e60c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
@@ -239,6 +239,7 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter
         long timeout,
         boolean invalidate,
         boolean storeEnabled,
+        boolean onePhaseCommit,
         int txSize,
         @Nullable UUID subjId,
         int taskNameHash
@@ -257,6 +258,7 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter
         this.timeout = timeout;
         this.invalidate = invalidate;
         this.storeEnabled = storeEnabled;
+        this.onePhaseCommit = onePhaseCommit;
         this.txSize = txSize;
         this.subjId = subjId;
         this.taskNameHash = taskNameHash;
@@ -281,7 +283,6 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter
      * @param isolation Isolation.
      * @param timeout Timeout.
      * @param txSize Transaction size.
-     * @param grpLockKey Group lock key if this is group-lock transaction.
      */
     protected IgniteTxAdapter(
         GridCacheSharedContext<K, V> cctx,
@@ -799,17 +800,6 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter
         awaitCompletion();
     }
 
-    /** {@inheritDoc} */
-    @Override public boolean needsCompletedVersions() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void completedVersions(GridCacheVersion base, Collection<GridCacheVersion> committed,
-        Collection<GridCacheVersion> txs) {
-        /* No-op. */
-    }
-
     /**
      * Awaits transaction completion.
      *
@@ -1948,16 +1938,6 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter
         }
 
         /** {@inheritDoc} */
-        @Override public boolean needsCompletedVersions() {
-            return false;
-        }
-
-        /** {@inheritDoc} */
-        @Override public void completedVersions(GridCacheVersion base, Collection committed, Collection rolledback) {
-            // No-op.
-        }
-
-        /** {@inheritDoc} */
         @Override public boolean internal() {
             return false;
         }


Mime
View raw message