ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dma...@apache.org
Subject [17/50] ignite git commit: ignite-808 Fixed GridDhtTxPrepareFuture.onEntriesLocked
Date Fri, 02 Oct 2015 09:29:21 GMT
ignite-808 Fixed GridDhtTxPrepareFuture.onEntriesLocked


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

Branch: refs/heads/ignite-801
Commit: 8fea96ea1bba43bdc702e6096bb5492bdb745b67
Parents: dc379fe
Author: sboikov <sboikov@gridgain.com>
Authored: Mon Sep 28 11:44:12 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Mon Sep 28 11:44:12 2015 +0300

----------------------------------------------------------------------
 .../distributed/dht/GridDhtTxPrepareFuture.java |  6 ++-
 .../IgniteTxPreloadAbstractTest.java            | 43 ++++++++++++--------
 .../replicated/GridReplicatedTxPreloadTest.java |  2 -
 .../testsuites/IgniteCacheTestSuite4.java       |  7 ++++
 4 files changed, 37 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/8fea96ea/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 81cc272..761bbb0 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
@@ -318,7 +318,11 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
     private void onEntriesLocked() {
         ret = new GridCacheReturn(null, tx.localResult(), null, true);
 
-        for (IgniteTxEntry txEntry : tx.optimisticLockEntries()) {
+        for (IgniteTxEntry writeEntry : writes) {
+            IgniteTxEntry txEntry = tx.entry(writeEntry.txKey());
+
+            assert txEntry != null : writeEntry;
+
             GridCacheContext cacheCtx = txEntry.context();
 
             GridCacheEntryEx cached = txEntry.cached();

http://git-wip-us.apache.org/repos/asf/ignite/blob/8fea96ea/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPreloadAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPreloadAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPreloadAbstractTest.java
index 939b4a6..0a7845b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPreloadAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPreloadAbstractTest.java
@@ -24,6 +24,7 @@ import java.util.Set;
 import java.util.concurrent.Callable;
 import java.util.concurrent.atomic.AtomicInteger;
 import javax.cache.processor.EntryProcessor;
+import javax.cache.processor.EntryProcessorResult;
 import javax.cache.processor.MutableEntry;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteTransactions;
@@ -65,6 +66,7 @@ public abstract class IgniteTxPreloadAbstractTest extends GridCacheAbstractSelfT
 
     /** {@inheritDoc} */
     @Override protected void beforeTestsStarted() throws Exception {
+        // No-op.
     }
 
     /** {@inheritDoc} */
@@ -78,7 +80,7 @@ public abstract class IgniteTxPreloadAbstractTest extends GridCacheAbstractSelfT
     public void testRemoteTxPreloading() throws Exception {
         IgniteCache<String, Integer> cache = jcache(0);
 
-        for (int i = 0; i < 10000; i++)
+        for (int i = 0; i < 10_000; i++)
             cache.put(String.valueOf(i), 0);
 
         final AtomicInteger gridIdx = new AtomicInteger(1);
@@ -104,31 +106,36 @@ public abstract class IgniteTxPreloadAbstractTest extends GridCacheAbstractSelfT
         for (int i = 0; i < 10; i++)
             keys.add(String.valueOf(i * 1000));
 
-        cache.invokeAll(keys, new EntryProcessor<String, Integer, Void>() {
-            @Override public Void process(MutableEntry<String, Integer> e, Object...
args) {
-                Integer val = e.getValue();
+        Map<String, EntryProcessorResult<Integer>> resMap = cache.invokeAll(keys,
+            new EntryProcessor<String, Integer, Integer>() {
+                @Override public Integer process(MutableEntry<String, Integer> e, Object...
args) {
+                    Integer val = e.getValue();
 
-                if (val == null) {
-                    keyNotLoaded = true;
+                    if (val == null) {
+                        keyNotLoaded = true;
 
-                    e.setValue(1);
+                        e.setValue(1);
 
-                    return null;
-                }
+                        return null;
+                    }
 
-                e.setValue(val + 1);
+                    e.setValue(val + 1);
 
-                return null;
+                    return val;
+                }
             }
-        });
+        );
 
         assertFalse(keyNotLoaded);
 
-        fut.get();
+        for (String key : keys) {
+            EntryProcessorResult<Integer> res = resMap.get(key);
 
-        for (int i = 0; i < GRID_CNT; i++)
-            // Wait for preloader.
-            jcache(i).rebalance().get();
+            assertNotNull(res);
+            assertEquals(0, (Object)res.get());
+        }
+
+        fut.get();
 
         for (int i = 0; i < GRID_CNT; i++) {
             for (String key : keys)
@@ -217,10 +224,10 @@ public abstract class IgniteTxPreloadAbstractTest extends GridCacheAbstractSelfT
         CacheConfiguration cfg = super.cacheConfiguration(gridName);
 
         cfg.setRebalanceMode(ASYNC);
-
         cfg.setWriteSynchronizationMode(FULL_SYNC);
-
         cfg.setCacheStoreFactory(null);
+        cfg.setReadThrough(false);
+        cfg.setWriteThrough(false);
 
         return cfg;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8fea96ea/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridReplicatedTxPreloadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridReplicatedTxPreloadTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridReplicatedTxPreloadTest.java
index e3ce612..4da7734 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridReplicatedTxPreloadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridReplicatedTxPreloadTest.java
@@ -24,8 +24,6 @@ import static org.apache.ignite.cache.CacheMode.REPLICATED;
 
 /**
  * Tests cache transaction during preloading.
- *
- * TODO: IGNITE-808.
  */
 public class GridReplicatedTxPreloadTest extends IgniteTxPreloadAbstractTest {
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/8fea96ea/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
index 289da3d..0ebcc81 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
@@ -76,9 +76,12 @@ import org.apache.ignite.internal.processors.cache.IgniteStartCacheInTransaction
 import org.apache.ignite.internal.processors.cache.IgniteSystemCacheOnClientTest;
 import org.apache.ignite.internal.processors.cache.distributed.CacheAffinityEarlyTest;
 import org.apache.ignite.internal.processors.cache.distributed.CacheNoValueClassOnServerNodeTest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtTxPreloadSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCacheLockFailoverSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCacheMultiTxLockSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearTxPreloadSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.near.IgniteCacheNearReadCommittedTest;
+import org.apache.ignite.internal.processors.cache.distributed.replicated.GridReplicatedTxPreloadTest;
 import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicLoadAllTest;
 import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicLoaderWriterTest;
 import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicLocalLoadAllTest;
@@ -261,6 +264,10 @@ public class IgniteCacheTestSuite4 extends TestSuite {
 
         suite.addTestSuite(CacheSwapUnswapGetTest.class);
 
+        suite.addTestSuite(GridCacheDhtTxPreloadSelfTest.class);
+        suite.addTestSuite(GridCacheNearTxPreloadSelfTest.class);
+        suite.addTestSuite(GridReplicatedTxPreloadTest.class);
+
         return suite;
     }
 }
\ No newline at end of file


Mime
View raw message