You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/04/18 15:04:43 UTC

[44/46] ignite git commit: ignite-1561

ignite-1561


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

Branch: refs/heads/ignite-1561-1
Commit: 03e1f3ff0fe4d5d21ce7eb21c897a3c176219900
Parents: 84d4dec
Author: sboikov <sb...@gridgain.com>
Authored: Tue Apr 18 13:14:41 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Apr 18 16:02:59 2017 +0300

----------------------------------------------------------------------
 .../distributed/GridDistributedTxMapping.java   |  18 ++
 ...arOptimisticSerializableTxPrepareFuture.java |  38 ++--
 .../near/GridNearOptimisticTxPrepareFuture.java | 173 ++++++++++++-------
 .../GridNearPessimisticTxPrepareFuture.java     |  16 +-
 .../near/GridNearTxPrepareFutureAdapter.java    |   5 +-
 .../lang/gridfunc/PredicateCollectionView.java  |   6 +-
 .../dht/IgniteCrossCacheTxSelfTest.java         |   2 +-
 7 files changed, 153 insertions(+), 105 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/03e1f3ff/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxMapping.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxMapping.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxMapping.java
index a15c00a..8e97922 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxMapping.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxMapping.java
@@ -43,6 +43,7 @@ public class GridDistributedTxMapping {
 
     /** Entries. */
     @GridToStringInclude
+    // TODO: change to List?
     private Collection<IgniteTxEntry> entries;
 
     /** Explicit lock flag. */
@@ -69,6 +70,23 @@ public class GridDistributedTxMapping {
         entries = new LinkedHashSet<>();
     }
 
+    public GridDistributedTxMapping copy(boolean colocatedEntriesOnly) {
+        assert !colocatedEntriesOnly || hasColocatedCacheEntries();
+
+        GridDistributedTxMapping res = new GridDistributedTxMapping(primary);
+
+        res.clientFirst = clientFirst;
+        res.explicitLock = explicitLock;
+        res.last = last;
+
+        for (IgniteTxEntry entry : entries) {
+            if (!colocatedEntriesOnly || !entry.context().isNear())
+                res.add(entry);
+        }
+
+        return res;
+    }
+
     /**
      * @return {@code True} if this is last mapping for node.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/03e1f3ff/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
index 1212155..2ce7802 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
@@ -377,7 +377,7 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
         if (!nearEntries)
             checkOnePhase(txMapping);
 
-        MiniFuture locNearOnlyFut = null;
+        MiniFuture locNearEntriesFut = null;
 
         // Create futures in advance to have all futures when process {@link GridNearTxPrepareResponse#clientRemapVersion}.
         for (GridDistributedTxMapping m : mappings.values()) {
@@ -388,9 +388,9 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
             add(fut);
 
             if (m.primary().isLocal() && m.hasNearCacheEntries() && m.hasColocatedCacheEntries()) {
-                assert locNearOnlyFut == null;
+                assert locNearEntriesFut == null;
 
-                locNearOnlyFut = fut;
+                locNearEntriesFut = fut;
 
                 add(new MiniFuture(this, m, ++miniId));
             }
@@ -408,7 +408,7 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
 
             MiniFuture fut = (MiniFuture)fut0;
 
-            IgniteCheckedException err = prepare(fut, txMapping, locNearOnlyFut);
+            IgniteCheckedException err = prepare(fut, txMapping, locNearEntriesFut);
 
             if (err != null) {
                 while (it.hasNext()) {
@@ -442,11 +442,13 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
 
     /**
      * @param fut Mini future.
+     * @param txMapping
+     * @param locNearEntriesFut
      * @return Prepare error if any.
      */
     @Nullable private IgniteCheckedException prepare(final MiniFuture fut,
         GridDhtTxMapping txMapping,
-        @Nullable MiniFuture locNearOnlyFut) {
+        @Nullable MiniFuture locNearEntriesFut) {
         GridDistributedTxMapping m = fut.mapping();
 
         final ClusterNode primary = m.primary();
@@ -477,16 +479,16 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
 
         // If this is the primary node for the keys.
         if (primary.isLocal()) {
-            if (locNearOnlyFut != null) {
-                boolean nearOnly = fut == locNearOnlyFut;
+            if (locNearEntriesFut != null) {
+                boolean nearEntries = fut == locNearEntriesFut;
 
                 GridNearTxPrepareRequest req = createRequest(txMapping.transactionNodes(),
                     fut,
                     timeout,
-                    nearOnly ? m.nearEntriesReads() : m.colocatedEntriesReads(),
-                    nearOnly ? m.nearEntriesWrites() : m.colocatedEntriesWrites());
+                    nearEntries ? m.nearEntriesReads() : m.colocatedEntriesReads(),
+                    nearEntries ? m.nearEntriesWrites() : m.colocatedEntriesWrites());
 
-                prepareLocal(req, fut, nearOnly, nearOnly);
+                prepareLocal(req, fut, nearEntries);
             }
             else {
                 GridNearTxPrepareRequest req = createRequest(txMapping.transactionNodes(),
@@ -495,7 +497,7 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
                     m.reads(),
                     m.writes());
 
-                prepareLocal(req, fut, m.hasNearCacheEntries(), true);
+                prepareLocal(req, fut, m.hasNearCacheEntries());
             }
         }
         else {
@@ -572,24 +574,20 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
 
     /**
      * @param req Request.
-     * @param nearTx Near cache mapping flag.
-     * @param updateMapping Update mapping flag.
+     * @param fut Future.
+     * @param nearEntries {@code True} if prepare near cache entries.
      */
     private void prepareLocal(GridNearTxPrepareRequest req,
         final MiniFuture fut,
-        final boolean nearTx,
-        final boolean updateMapping) {
-        if (nearTx)
-            req.cloneEntries();
-
-        IgniteInternalFuture<GridNearTxPrepareResponse> prepFut = nearTx ?
+        final boolean nearEntries) {
+        IgniteInternalFuture<GridNearTxPrepareResponse> prepFut = nearEntries ?
             cctx.tm().txHandler().prepareNearTx(cctx.localNodeId(), req, true) :
             cctx.tm().txHandler().prepareColocatedTx(tx, req);
 
         prepFut.listen(new CI1<IgniteInternalFuture<GridNearTxPrepareResponse>>() {
             @Override public void apply(IgniteInternalFuture<GridNearTxPrepareResponse> prepFut) {
                 try {
-                    fut.onResult(prepFut.get(), updateMapping);
+                    fut.onResult(prepFut.get(), nearEntries);
                 }
                 catch (IgniteCheckedException e) {
                     fut.onResult(e);

http://git-wip-us.apache.org/repos/asf/ignite/blob/03e1f3ff/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
index fc4d8c6..c9db422 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
@@ -180,7 +180,7 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
             if (mini != null) {
                 assert mini.node().id().equals(nodeId);
 
-                mini.onResult(res, true);
+                mini.onResult(res);
             }
             else {
                 if (msgLog.isDebugEnabled()) {
@@ -345,6 +345,7 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
     /**
      * @param write Write.
      * @param topLocked {@code True} if thread already acquired lock preventing topology change.
+     * @param remap Remap flag.
      */
     private void prepareSingle(IgniteTxEntry write, boolean topLocked, boolean remap) {
         write.clearEntryReadVersion();
@@ -382,15 +383,18 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
 
         tx.transactionNodes(txMapping.transactionNodes());
 
-        if (!mapping.hasNearCacheEntries())
+        if (!write.context().isNear())
             checkOnePhase(txMapping);
 
+        assert !(mapping.hasColocatedCacheEntries() && mapping.hasNearCacheEntries()) : mapping;
+
         proceedPrepare(mapping, null);
     }
 
     /**
      * @param writes Write entries.
      * @param topLocked {@code True} if thread already acquired lock preventing topology change.
+     * @param remap Remap flag.
      */
     private void prepare(
         Iterable<IgniteTxEntry> writes,
@@ -403,7 +407,7 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
 
         txMapping = new GridDhtTxMapping();
 
-        Map<UUID, GridDistributedTxMapping> map = new HashMap<>();
+        Map<Object, GridDistributedTxMapping> map = new HashMap<>();
 
         // Assign keys to primary nodes.
         GridDistributedTxMapping cur = null;
@@ -417,7 +421,7 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
 
             GridDistributedTxMapping updated = map(write, topVer, cur, topLocked, remap);
 
-            if (updated.hasNearCacheEntries())
+            if (write.context().isNear())
                 hasNearCache = true;
 
             if (cur != updated) {
@@ -425,7 +429,15 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
 
                 updated.last(true);
 
-                GridDistributedTxMapping prev = map.put(updated.primary().id(), updated);
+                ClusterNode primary = updated.primary();
+
+                assert !primary.isLocal() || !cctx.kernalContext().clientNode();
+
+                // Minor optimization: on client node can not have mapping for local node.
+                Object key =  cctx.kernalContext().clientNode() ? primary.id() :
+                    new MappingKey(primary.id(), primary.isLocal() && updated.hasNearCacheEntries());
+
+                GridDistributedTxMapping prev = map.put(key, updated);
 
                 if (prev != null)
                     prev.last(false);
@@ -477,60 +489,6 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
         proceedPrepare(m, mappings);
     }
 
-    private void prepareLocal(GridNearTxPrepareRequest req,
-        final MiniFuture fut,
-        boolean nearTx,
-        final boolean updateMapping) {
-        IgniteInternalFuture<GridNearTxPrepareResponse> prepFut = nearTx ?
-            cctx.tm().txHandler().prepareNearTx(cctx.localNodeId(), req, true) :
-            cctx.tm().txHandler().prepareColocatedTx(tx, req);
-
-        prepFut.listen(new CI1<IgniteInternalFuture<GridNearTxPrepareResponse>>() {
-            @Override public void apply(IgniteInternalFuture<GridNearTxPrepareResponse> prepFut) {
-                try {
-                    fut.onResult(prepFut.get(), updateMapping);
-                }
-                catch (IgniteCheckedException e) {
-                    fut.onResult(e);
-                }
-            }
-        });
-    }
-
-    private GridNearTxPrepareRequest createRequest(long timeout,
-        MiniFuture fut,
-        Collection<IgniteTxEntry> writes) {
-        GridDistributedTxMapping m = fut.mapping();
-
-        GridNearTxPrepareRequest req = new GridNearTxPrepareRequest(
-            futId,
-            tx.topologyVersion(),
-            tx,
-            timeout,
-            null,
-            writes,
-            m.hasNearCacheEntries(),
-            txMapping.transactionNodes(),
-            m.last(),
-            tx.onePhaseCommit(),
-            tx.needReturnValue() && tx.implicit(),
-            tx.implicitSingle(),
-            m.explicitLock(),
-            tx.subjectId(),
-            tx.taskNameHash(),
-            m.clientFirst(),
-            tx.activeCachesDeploymentEnabled());
-
-        for (IgniteTxEntry txEntry : m.entries()) {
-            if (txEntry.op() == TRANSFORM)
-                req.addDhtVersion(txEntry.txKey(), null);
-        }
-
-        req.miniId(fut.futureId());
-
-        return req;
-    }
-
     /**
      * Continues prepare after previous mapping successfully finished.
      *
@@ -551,6 +509,30 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
             long timeout = tx.remainingTime();
 
             if (timeout != -1) {
+                GridNearTxPrepareRequest req = new GridNearTxPrepareRequest(
+                    futId,
+                    tx.topologyVersion(),
+                    tx,
+                    timeout,
+                    null,
+                    m.writes(),
+                    m.hasNearCacheEntries(),
+                    txMapping.transactionNodes(),
+                    m.last(),
+                    tx.onePhaseCommit(),
+                    tx.needReturnValue() && tx.implicit(),
+                    tx.implicitSingle(),
+                    m.explicitLock(),
+                    tx.subjectId(),
+                    tx.taskNameHash(),
+                    m.clientFirst(),
+                    tx.activeCachesDeploymentEnabled());
+
+                for (IgniteTxEntry txEntry : m.entries()) {
+                    if (txEntry.op() == TRANSFORM)
+                        req.addDhtVersion(txEntry.txKey(), null);
+                }
+
                 // Must lock near entries separately.
                 if (m.hasNearCacheEntries()) {
                     try {
@@ -565,17 +547,32 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
 
                 final MiniFuture fut = new MiniFuture(this, m, ++miniId, mappings);
 
+                req.miniId(fut.futureId());
+
                 add(fut); // Append new future.
 
+                // If this is the primary node for the keys.
                 if (n.isLocal()) {
-                    GridNearTxPrepareRequest req = createRequest(timeout, fut, m.writes());
-
-                    prepareLocal(req, fut, m.hasNearCacheEntries(), true);
+                    // At this point, if any new node joined, then it is
+                    // waiting for this transaction to complete, so
+                    // partition reassignments are not possible here.
+                    IgniteInternalFuture<GridNearTxPrepareResponse> prepFut =
+                        m.hasNearCacheEntries() ? cctx.tm().txHandler().prepareNearTx(n.id(), req, true)
+                        : cctx.tm().txHandler().prepareColocatedTx(tx, req);
+
+                    prepFut.listen(new CI1<IgniteInternalFuture<GridNearTxPrepareResponse>>() {
+                        @Override public void apply(IgniteInternalFuture<GridNearTxPrepareResponse> prepFut) {
+                            try {
+                                fut.onResult(prepFut.get());
+                            }
+                            catch (IgniteCheckedException e) {
+                                fut.onResult(e);
+                            }
+                        }
+                    });
                 }
                 else {
                     try {
-                        GridNearTxPrepareRequest req = createRequest(timeout, fut, m.writes());
-
                         cctx.io().send(n, req, tx.ioPolicy());
 
                         if (msgLog.isDebugEnabled()) {
@@ -613,6 +610,7 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
      * @param topVer Topology version.
      * @param cur Current mapping.
      * @param topLocked {@code True} if thread already acquired lock preventing topology change.
+     * @param remap Remap flag.
      * @return Mapping.
      */
     private GridDistributedTxMapping map(
@@ -667,7 +665,8 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
             }
         }
 
-        if (cur == null || !cur.primary().id().equals(primary.id())) {
+        if (cur == null || !cur.primary().id().equals(primary.id()) ||
+            (primary.isLocal() && cur.hasNearCacheEntries() != cacheCtx.isNear())) {
             boolean clientFirst = cur == null && !topLocked && cctx.kernalContext().clientNode();
 
             cur = new GridDistributedTxMapping(primary);
@@ -886,7 +885,7 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
          * @param res Result callback.
          */
         @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
-        void onResult(final GridNearTxPrepareResponse res, boolean updateMapping) {
+        void onResult(final GridNearTxPrepareResponse res) {
             if (isDone())
                 return;
 
@@ -928,7 +927,7 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
                             remap();
                     }
                     else {
-                        parent.onPrepareResponse(m, res, updateMapping);
+                        parent.onPrepareResponse(m, res, m.hasNearCacheEntries());
 
                         // Proceed prepare before finishing mini future.
                         if (mappings != null)
@@ -957,4 +956,44 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
             return S.toString(MiniFuture.class, this, "done", isDone(), "cancelled", isCancelled(), "err", error());
         }
     }
+
+    /**
+     *
+     */
+    private static class MappingKey {
+        /** */
+        private final UUID nodeId;
+
+        /** */
+        private final boolean nearEntries;
+
+        /**
+         * @param nodeId Node ID.
+         * @param nearEntries Near cache entries flag (should be true only for local node).
+         */
+        MappingKey(UUID nodeId, boolean nearEntries) {
+            this.nodeId = nodeId;
+            this.nearEntries = nearEntries;
+        }
+
+        /** {@inheritDoc} */
+        @SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
+        @Override public boolean equals(Object o) {
+            MappingKey that = (MappingKey) o;
+
+            return nearEntries == that.nearEntries && nodeId.equals(that.nodeId);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            int res = nodeId.hashCode();
+            res = 31 * res + (nearEntries ? 1 : 0);
+            return res;
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(MappingKey.class, this);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/03e1f3ff/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
index ee5790f..af1d651 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
@@ -223,28 +223,26 @@ public class GridNearPessimisticTxPrepareFuture extends GridNearTxPrepareFutureA
      * @param req Request.
      * @param m Mapping.
      * @param miniId Mini future ID.
-     * @param nearTx Near cache mapping flag.
-     * @param updateMapping Update mapping flag.
+     * @param nearEntries {@code True} if prepare near cache entries.
      */
     private void prepareLocal(GridNearTxPrepareRequest req,
         GridDistributedTxMapping m,
         int miniId,
-        final boolean nearTx,
-        final boolean updateMapping) {
+        final boolean nearEntries) {
         final MiniFuture fut = new MiniFuture(m, miniId);
 
         req.miniId(fut.futureId());
 
         add(fut);
 
-        IgniteInternalFuture<GridNearTxPrepareResponse> prepFut = nearTx ?
+        IgniteInternalFuture<GridNearTxPrepareResponse> prepFut = nearEntries ?
             cctx.tm().txHandler().prepareNearTx(cctx.localNodeId(), req, true) :
             cctx.tm().txHandler().prepareColocatedTx(tx, req);
 
         prepFut.listen(new CI1<IgniteInternalFuture<GridNearTxPrepareResponse>>() {
             @Override public void apply(IgniteInternalFuture<GridNearTxPrepareResponse> prepFut) {
                 try {
-                    fut.onResult(prepFut.get(), updateMapping);
+                    fut.onResult(prepFut.get(), nearEntries);
                 }
                 catch (IgniteCheckedException e) {
                     fut.onError(e);
@@ -327,7 +325,7 @@ public class GridNearPessimisticTxPrepareFuture extends GridNearTxPrepareFutureA
                         m.nearEntriesReads(),
                         m.nearEntriesWrites());
 
-                    prepareLocal(nearReq, m, ++miniId, true, true);
+                    prepareLocal(nearReq, m, ++miniId, true);
 
                     GridNearTxPrepareRequest colocatedReq = createRequest(txNodes,
                         m,
@@ -335,12 +333,12 @@ public class GridNearPessimisticTxPrepareFuture extends GridNearTxPrepareFutureA
                         m.colocatedEntriesReads(),
                         m.colocatedEntriesWrites());
 
-                    prepareLocal(colocatedReq, m, ++miniId, false, false);
+                    prepareLocal(colocatedReq, m, ++miniId, false);
                 }
                 else {
                     GridNearTxPrepareRequest req = createRequest(txNodes, m, timeout, m.reads(), m.writes());
 
-                    prepareLocal(req, m, ++miniId, m.hasNearCacheEntries(), true);
+                    prepareLocal(req, m, ++miniId, m.hasNearCacheEntries());
                 }
             }
             else {

http://git-wip-us.apache.org/repos/asf/ignite/blob/03e1f3ff/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java
index a9675d6..004e4da 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java
@@ -251,7 +251,7 @@ public abstract class GridNearTxPrepareFutureAdapter extends
             // This step is very important as near and DHT versions grow separately.
             cctx.versions().onReceived(nodeId, res.dhtVersion());
 
-            if (updateMapping) {
+            if (updateMapping && m.hasNearCacheEntries()) {
                 GridCacheVersion writeVer = res.writeVersion();
 
                 if (writeVer == null)
@@ -265,8 +265,7 @@ public abstract class GridNearTxPrepareFutureAdapter extends
                 if (map != null)
                     map.dhtVersion(res.dhtVersion(), writeVer);
 
-                if (m.hasNearCacheEntries())
-                    tx.readyNearLocks(m, res.pending(), res.committedVersions(), res.rolledbackVersions());
+                tx.readyNearLocks(m, res.pending(), res.committedVersions(), res.rolledbackVersions());
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/03e1f3ff/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/PredicateCollectionView.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/PredicateCollectionView.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/PredicateCollectionView.java
index b4785a7..348a37c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/PredicateCollectionView.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/PredicateCollectionView.java
@@ -45,6 +45,7 @@ public class PredicateCollectionView<T> extends GridSerializableCollection<T> {
      * @param col Input col that serves as a base for the view.
      * @param preds Optional preds. If preds are not provided - all elements will be in the view.
      */
+    @SafeVarargs
     public PredicateCollectionView(Collection<T> col, IgnitePredicate<? super T>... preds) {
         this.col = col;
         this.preds = preds;
@@ -70,9 +71,4 @@ public class PredicateCollectionView<T> extends GridSerializableCollection<T> {
     @Override public boolean isEmpty() {
         return F.isEmpty(preds) ? col.isEmpty() : !iterator().hasNext();
     }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(PredicateCollectionView.class, this);
-    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/03e1f3ff/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCrossCacheTxSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCrossCacheTxSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCrossCacheTxSelfTest.java
index 1cac85a..d9529da 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCrossCacheTxSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCrossCacheTxSelfTest.java
@@ -78,7 +78,7 @@ public class IgniteCrossCacheTxSelfTest extends GridCommonAbstractTest {
      * @return {@code True} if near cache should be enabled.
      */
     protected boolean nearEnabled() {
-        return true;
+        return false;
     }
 
     /** {@inheritDoc} */