Repository: ignite
Updated Branches:
  refs/heads/ignite-2.7 e71df460a -> cfe3654be


IGNITE-9722: MVCC: disallow reads from backups for GET operations. This closes 
#4903.


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

Branch: refs/heads/ignite-2.7
Commit: cfe3654bea40e8ec896403cba17fd7f18e8ab381
Parents: e71df46
Author: devozerov <ppoze...@gmail.com>
Authored: Wed Oct 3 21:38:06 2018 +0300
Committer: devozerov <ppoze...@gmail.com>
Committed: Wed Oct 3 21:39:18 2018 +0300

----------------------------------------------------------------------
 .../cache/distributed/dht/GridPartitionedGetFuture.java         | 3 ++-
 .../cache/distributed/dht/GridPartitionedSingleGetFuture.java   | 3 ++-
 .../cache/distributed/dht/colocated/GridDhtColocatedCache.java  | 5 +++--
 .../processors/cache/mvcc/CacheMvccTransactionsTest.java        | 2 --
 4 files changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/cfe3654b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
index 39e0774..1512963 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
@@ -461,7 +461,8 @@ public class GridPartitionedGetFuture<K, V> extends 
CacheDistributedGetFutureAda
             return false;
         }
 
-        boolean fastLocGet = (!forcePrimary || affNodes.get(0).isLocal()) &&
+        // Local get cannot be used with MVCC as local node can contain some 
visible version which is not latest.
+        boolean fastLocGet = !cctx.mvccEnabled() && (!forcePrimary || 
affNodes.get(0).isLocal()) &&
             cctx.reserveForFastLocalGet(part, topVer);
 
         if (fastLocGet) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfe3654b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
index 5d3bef2..8ed6695 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
@@ -344,7 +344,8 @@ public class GridPartitionedSingleGetFuture extends 
GridCacheFutureAdapter<Objec
             return null;
         }
 
-        boolean fastLocGet = (!forcePrimary || affNodes.get(0).isLocal()) &&
+        // Local get cannot be used with MVCC as local node can contain some 
visible version which is not latest.
+        boolean fastLocGet = !cctx.mvccEnabled() && (!forcePrimary || 
affNodes.get(0).isLocal()) &&
             cctx.reserveForFastLocalGet(part, topVer);
 
         if (fastLocGet) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfe3654b/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 a83a93f..bbfb502 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
@@ -468,8 +468,9 @@ public class GridDhtColocatedCache<K, V> extends 
GridDhtTransactionalCacheAdapte
         if (expiryPlc == null)
             expiryPlc = expiryPolicy(null);
 
-        // Optimization: try to resolve value locally and escape 'get future' 
creation.
-        if (!forcePrimary && ctx.affinityNode() && (!ctx.mvccEnabled() || 
mvccSnapshot != null)) {
+        // Optimization: try to resolve value locally and escape 'get future' 
creation. Not applcable for MVCC,
+        // because local node may contain a visible version which is no the 
most recent one.
+        if (!ctx.mvccEnabled() && !forcePrimary && ctx.affinityNode()) {
             try {
                 Map<K, V> locVals = null;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfe3654b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTransactionsTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTransactionsTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTransactionsTest.java
index 66555a0..a29a67a 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTransactionsTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTransactionsTest.java
@@ -2433,8 +2433,6 @@ public class CacheMvccTransactionsTest extends 
CacheMvccAbstractTest {
      * @throws Exception If failed.
      */
     public void testMvccCoordinatorChangeSimple() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-9722";);
-
         Ignite srv0 = startGrid(0);
 
         final List<String> cacheNames = new ArrayList<>();

Reply via email to