ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject ignite git commit: 2224-2
Date Wed, 27 Jan 2016 10:56:28 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-2224-2 3dcf27345 -> 7645d634e


2224-2


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

Branch: refs/heads/ignite-2224-2
Commit: 7645d634ecb5f03762a0d8c1bcb41bd01d5e4def
Parents: 3dcf273
Author: Anton Vinogradov <av@apache.org>
Authored: Wed Jan 27 13:56:28 2016 +0300
Committer: Anton Vinogradov <av@apache.org>
Committed: Wed Jan 27 13:56:28 2016 +0300

----------------------------------------------------------------------
 .../transactions/IgniteTxLocalAdapter.java      |  21 ++--
 .../cache/CacheReadThroughRestartSelfTest.java  | 120 +++++++++++++++++++
 2 files changed, 134 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/7645d634/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index 6422305..551cbe7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -1555,7 +1555,8 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements
Ig
                                     skipVals,
                                     keepCacheObjects,
                                     deserializeBinary,
-                                    false);
+                                    false,
+                                    readVer);
                             }
                             else
                                 missed.put(key, ver);
@@ -1656,12 +1657,14 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
implements Ig
         final boolean deserializeBinary,
         final boolean skipVals,
         final boolean keepCacheObjects,
-        final boolean skipStore
+        final boolean skipStore,
+        final boolean needVer
+
     ) {
         if (log.isDebugEnabled())
             log.debug("Loading missed values for missed map: " + missedMap);
 
-        final boolean needReadVer = serializable() && optimistic();
+        final boolean needReadVer = (serializable() && optimistic()) || needVer;
 
         return new GridEmbeddedFuture<>(
             new C2<Void, Exception, Map<K, V>>() {
@@ -1723,7 +1726,8 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements
Ig
                                     skipVals,
                                     keepCacheObjects,
                                     deserializeBinary,
-                                    false);
+                                    false,
+                                    loadVer);
                             }
                         }
                         else {
@@ -1744,7 +1748,8 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements
Ig
                                     skipVals,
                                     keepCacheObjects,
                                     deserializeBinary,
-                                    false);
+                                    false,
+                                    loadVer);
                             }
                         }
                     }
@@ -1922,7 +1927,8 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements
Ig
                                 deserializeBinary,
                                 skipVals,
                                 keepCacheObjects,
-                                skipStore);
+                                skipStore,
+                                needVer);
                         }
 
                         return new GridFinishedFuture<>(Collections.<K, V>emptyMap());
@@ -1988,7 +1994,8 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements
Ig
                         deserializeBinary,
                         skipVals,
                         keepCacheObjects,
-                        skipStore);
+                        skipStore,
+                        needVer);
                 }
 
                 return new GridFinishedFuture<>(retMap);

http://git-wip-us.apache.org/repos/asf/ignite/blob/7645d634/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java
index c606a2a..8b2055b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java
@@ -17,6 +17,8 @@
 
 package org.apache.ignite.internal.processors.cache;
 
+import java.util.HashSet;
+import java.util.Set;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.cache.CacheAtomicityMode;
@@ -116,6 +118,73 @@ public class CacheReadThroughRestartSelfTest extends GridCacheAbstractSelfTest
{
     /**
      * @throws Exception If failed.
      */
+    public void testReadEntryThroughInTx() throws Exception {
+        IgniteCache<String, Integer> cache = grid(1).cache(null);
+
+        for (int k = 0; k < 1000; k++)
+            cache.put("key" + k, k);
+
+        stopAllGrids();
+
+        startGrids(2);
+
+        Ignite ignite = grid(1);
+
+        cache = ignite.cache(null);
+
+        for (TransactionConcurrency txConcurrency : TransactionConcurrency.values()) {
+            for (TransactionIsolation txIsolation : TransactionIsolation.values()) {
+                try (Transaction tx = ignite.transactions().txStart(txConcurrency, txIsolation,
100000, 1000)) {
+                    for (int k = 0; k < 1000; k++) {
+                        String key = "key" + k;
+
+                        assertNotNull("Null value for key: " + key, cache.getEntry(key));
+                    }
+
+                    tx.commit();
+                }
+            }
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testReadEntriesThroughInTx() throws Exception {
+        IgniteCache<String, Integer> cache = grid(1).cache(null);
+
+        for (int k = 0; k < 1000; k++)
+            cache.put("key" + k, k);
+
+        stopAllGrids();
+
+        startGrids(2);
+
+        Ignite ignite = grid(1);
+
+        cache = ignite.cache(null);
+
+        for (TransactionConcurrency txConcurrency : TransactionConcurrency.values()) {
+            for (TransactionIsolation txIsolation : TransactionIsolation.values()) {
+                try (Transaction tx = ignite.transactions().txStart(txConcurrency, txIsolation,
100000, 1000)) {
+                    for (int k = 0; k < 100; k++) {
+                        Set<String> keys = new HashSet<>();
+
+                        for (int j = k; j < k + 10; j++)
+                            keys.add("key" + j);
+
+                        assertNotNull("Null value for keys: " + k + " - " + k + 9, cache.getEntries(keys));
+                    }
+
+                    tx.commit();
+                }
+            }
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
     public void testReadThrough() throws Exception {
         IgniteCache<String, Integer> cache = grid(1).cache(null);
 
@@ -136,4 +205,55 @@ public class CacheReadThroughRestartSelfTest extends GridCacheAbstractSelfTest
{
             assertNotNull("Null value for key: " + key, cache.get(key));
         }
     }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testReadEntryThrough() throws Exception {
+        IgniteCache<String, Integer> cache = grid(1).cache(null);
+
+        for (int k = 0; k < 1000; k++)
+            cache.put("key" + k, k);
+
+        stopAllGrids();
+
+        startGrids(2);
+
+        Ignite ignite = grid(1);
+
+        cache = ignite.cache(null);
+
+        for (int k = 0; k < 1000; k++) {
+            String key = "key" + k;
+
+            assertNotNull("Null value for key: " + key, cache.getEntry(key));
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testReadEntriesThrough() throws Exception {
+        IgniteCache<String, Integer> cache = grid(1).cache(null);
+
+        for (int k = 0; k < 1000; k++)
+            cache.put("key" + k, k);
+
+        stopAllGrids();
+
+        startGrids(2);
+
+        Ignite ignite = grid(1);
+
+        cache = ignite.cache(null);
+
+        for (int k = 0; k < 100; k++) {
+            Set<String> keys = new HashSet<>();
+
+            for (int j = k; j < k + 10; j++)
+                keys.add("key" + j);
+
+            assertNotNull("Null value for keys: " + k + " - " + k + 9, cache.getEntries(keys));
+        }
+    }
 }
\ No newline at end of file


Mime
View raw message