ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [10/10] incubator-ignite git commit: ignite-656: fixing get() for pessimistic mode
Date Wed, 15 Apr 2015 08:06:43 GMT
ignite-656: fixing get() for pessimistic mode


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

Branch: refs/heads/ignite-656
Commit: 8d18956fd5ab04288dd72dde6f59e7fae2187c34
Parents: 56a6348
Author: Denis Magda <dmagda@gridgain.com>
Authored: Tue Apr 14 18:15:51 2015 +0300
Committer: Denis Magda <dmagda@gridgain.com>
Committed: Tue Apr 14 18:15:51 2015 +0300

----------------------------------------------------------------------
 .../colocated/GridDhtColocatedLockFuture.java   |  3 +-
 .../distributed/near/GridNearLockFuture.java    |  3 +-
 .../distributed/near/GridNearLockRequest.java   |  5 +-
 .../cache/GridCacheAbstractFullApiSelfTest.java | 71 ++++++++++++++++++--
 4 files changed, 73 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8d18956f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
index 7b05065..515e5f7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
@@ -746,7 +746,8 @@ public final class GridDhtColocatedLockFuture<K, V> extends GridCompoundIdentity
                                     key,
                                     retval,
                                     dhtVer, // Include DHT version to match remote DHT entry.
-                                    cctx);
+                                    cctx,
+                                    entry.context().skipStore());
                             }
 
                             explicit = inTx() && cand == null;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8d18956f/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 789fd93..68d98e7 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
@@ -882,7 +882,8 @@ public final class GridNearLockFuture<K, V> extends GridCompoundIdentityFuture<B
                                         key,
                                         retval && dhtVer == null,
                                         dhtVer, // Include DHT version to match remote DHT
entry.
-                                        cctx);
+                                        cctx,
+                                        entry.context().skipStore());
                                 }
 
                                 if (cand.reentry())

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8d18956f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
index 3bbc45c..8f9a81f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
@@ -287,12 +287,13 @@ public class GridNearLockRequest extends GridDistributedLockRequest
{
         KeyCacheObject key,
         boolean retVal,
         @Nullable GridCacheVersion dhtVer,
-        GridCacheContext ctx
+        GridCacheContext ctx,
+        boolean skipStore
     ) throws IgniteCheckedException {
         dhtVers[idx] = dhtVer;
 
         // Delegate to super.
-        addKeyBytes(key, retVal, (Collection<GridCacheMvccCandidate>)null, ctx, false);
//TODO: revisit
+        addKeyBytes(key, retVal, (Collection<GridCacheMvccCandidate>)null, ctx, skipStore);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8d18956f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index b2368ff..684b5b5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -4426,8 +4426,19 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         assertTrue(map.size() == 0);
 
         if (atomicityMode() == CacheAtomicityMode.TRANSACTIONAL) {
-            checkSkipStoreWithTransaction(cache, cacheSkipStore, data, keys, TransactionConcurrency.OPTIMISTIC,
+            /*checkSkipStoreWithTransaction(cache, cacheSkipStore, data, keys, TransactionConcurrency.OPTIMISTIC,
                 TransactionIsolation.READ_COMMITTED);
+            checkSkipStoreWithTransaction(cache, cacheSkipStore, data, keys, TransactionConcurrency.OPTIMISTIC,
+                TransactionIsolation.REPEATABLE_READ);
+            checkSkipStoreWithTransaction(cache, cacheSkipStore, data, keys, TransactionConcurrency.OPTIMISTIC,
+                TransactionIsolation.SERIALIZABLE);*/
+
+            //checkSkipStoreWithTransaction(cache, cacheSkipStore, data, keys, TransactionConcurrency.PESSIMISTIC,
+            //    TransactionIsolation.READ_COMMITTED);
+            checkSkipStoreWithTransaction(cache, cacheSkipStore, data, keys, TransactionConcurrency.PESSIMISTIC,
+               TransactionIsolation.REPEATABLE_READ);
+            //checkSkipStoreWithTransaction(cache, cacheSkipStore, data, keys, TransactionConcurrency.PESSIMISTIC,
+            //    TransactionIsolation.SERIALIZABLE);
         }
     }
 
@@ -4472,6 +4483,16 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         }
     }
 
+    /**
+     * @param cache Cache instance.
+     * @param cacheSkipStore Cache skip store projection.
+     * @param data Data set.
+     * @param keys Keys list.
+     * @param txConcurrency Concurrency mode.
+     * @param txIsolation Isolation mode.
+     *
+     * @throws Exception If failed.
+     */
     private void checkSkipStoreWithTransaction(IgniteCache<String, Integer> cache,
         IgniteCache<String, Integer> cacheSkipStore,
         Map<String, Integer> data,
@@ -4480,10 +4501,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         TransactionIsolation txIsolation) throws  Exception {
 
         cache.removeAll(data.keySet());
-
-        assertTrue(cache.size(CachePeekMode.ALL) == 0);
-        assertTrue(cacheSkipStore.size(CachePeekMode.ALL) == 0);
-        assertTrue(map.size() == 0);
+        checkEmpty(cache, cacheSkipStore);
 
         IgniteTransactions txs = grid(0).transactions();
 
@@ -4522,6 +4540,8 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         tx.commit();
 
+        assertTrue(map.size() == 0);
+
         // cache putAll(..)/removeAll(..) check
         tx = txs.txStart(txConcurrency, txIsolation);
 
@@ -4543,6 +4563,8 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         tx.commit();
 
+        assertTrue(map.size() == 0);
+
         // putAll(..) from both cacheSkipStore and cache
         tx = txs.txStart(txConcurrency, txIsolation);
 
@@ -4590,6 +4612,45 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
             assertNull(cache.get(key));
             assertFalse(map.containsKey(key));
         }
+
+        // Check that read-through is disabled when cacheSkipStore is used
+        for (int i = 0; i < keys.size(); i++)
+            putToStore(keys.get(i), i);
+
+        assertTrue(cacheSkipStore.size(CachePeekMode.ALL) == 0);
+        assertTrue(cache.size(CachePeekMode.ALL) == 0);
+        assertTrue(map.size() != 0);
+
+        tx = txs.txStart(txConcurrency, txIsolation);
+
+        //assertTrue(cacheSkipStore.getAll(data.keySet()).size() == 0);
+
+        for (String key : keys) {
+            assertNull(cacheSkipStore.get(key));
+
+            if (txIsolation == READ_COMMITTED) {
+                assertNotNull(cache.get(key));
+                assertNotNull(cacheSkipStore.get(key));
+            }
+        }
+
+        tx.commit();
+
+        cache.removeAll(data.keySet());
+        checkEmpty(cache, cacheSkipStore);
+    }
+
+    /**
+     * @param cache Cache instance.
+     * @param cacheSkipStore Cache skip store projection.
+     *
+     * @throws Exception If failed.
+     */
+    private void checkEmpty(IgniteCache<String, Integer> cache, IgniteCache<String,
Integer> cacheSkipStore)
+        throws Exception {
+        assertTrue(cache.size(CachePeekMode.ALL) == 0);
+        assertTrue(cacheSkipStore.size(CachePeekMode.ALL) == 0);
+        assertTrue(map.size() == 0);
     }
 
     /**


Mime
View raw message