ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [38/50] [abbrv] incubator-ignite git commit: # sprint-2 added test for IGNITE-477
Date Thu, 12 Mar 2015 17:21:25 GMT
# sprint-2 added test for IGNITE-477


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

Branch: refs/heads/ignite-333
Commit: b48899b8698b8d7ddd2e127f91a7c99d6187b50e
Parents: 70e0cc6
Author: sboikov <sboikov@gridgain.com>
Authored: Thu Mar 12 17:10:04 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Thu Mar 12 17:13:16 2015 +0300

----------------------------------------------------------------------
 .../distributed/dht/GridDhtTxPrepareFuture.java |   2 +-
 .../transactions/IgniteTxLocalAdapter.java      |   4 +-
 .../cache/IgniteCacheTxPreloadNoWriteTest.java  | 111 +++++++++++++++++++
 .../ignite/testsuites/IgniteCacheTestSuite.java |   3 +
 4 files changed, 117 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b48899b8/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 bc75bc0..3acb9e1 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
@@ -928,7 +928,7 @@ public final class GridDhtTxPrepareFuture<K, V> extends GridCompoundIdentityFutu
                         try {
                             cctx.io().send(nearMapping.node(), req, tx.system() ? UTILITY_CACHE_POOL
: SYSTEM_POOL);
                         }
-                        catch (ClusterTopologyException e) {
+                        catch (ClusterTopologyCheckedException e) {
                             fut.onResult(e);
                         }
                         catch (IgniteCheckedException e) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b48899b8/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 d2f99df..347489c 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
@@ -18,8 +18,8 @@
 package org.apache.ignite.internal.processors.cache.transactions;
 
 import org.apache.ignite.*;
-import org.apache.ignite.cluster.*;
 import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.cluster.*;
 import org.apache.ignite.internal.managers.communication.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.cache.distributed.near.*;
@@ -2096,7 +2096,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                                         resolveTaskName(),
                                         null);
                                 }
-                                catch (ClusterTopologyException e) {
+                                catch (ClusterTopologyCheckedException e) {
                                     entry.context().evicts().touch(entry, topologyVersion());
 
                                     throw e;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b48899b8/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPreloadNoWriteTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPreloadNoWriteTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPreloadNoWriteTest.java
new file mode 100644
index 0000000..0a9b89d
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPreloadNoWriteTest.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.affinity.*;
+import org.apache.ignite.cache.affinity.rendezvous.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.junits.common.*;
+import org.apache.ignite.transactions.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+import static org.apache.ignite.cache.CacheDistributionMode.*;
+import static org.apache.ignite.cache.CacheMode.*;
+import static org.apache.ignite.transactions.TransactionConcurrency.*;
+import static org.apache.ignite.transactions.TransactionIsolation.*;
+
+/**
+ *
+ */
+public class IgniteCacheTxPreloadNoWriteTest extends GridCommonAbstractTest {
+    /** */
+    private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception
{
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        cfg.setPeerClassLoadingEnabled(false);
+
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(ipFinder);
+
+        cfg.setDiscoverySpi(disco);
+
+        CacheConfiguration ccfg = new CacheConfiguration();
+
+        ccfg.setCacheMode(REPLICATED);
+        ccfg.setDistributionMode(PARTITIONED_ONLY);
+        ccfg.setAtomicityMode(TRANSACTIONAL);
+        ccfg.setRebalanceMode(CacheRebalanceMode.ASYNC);
+        ccfg.setAffinity(new CacheRendezvousAffinityFunction(false, 100));
+
+        cfg.setCacheConfiguration(ccfg);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testTxNoWrite() throws Exception {
+        Ignite ignite0 = startGrid(0);
+
+        CacheAffinity<Integer> aff = ignite0.affinity(null);
+
+        IgniteCache<Integer, Object> cache0 = ignite0.jcache(null);
+
+        for (int i = 0; i < 1000; i++)
+            cache0.put(i + 10000, new byte[1024]);
+
+        Ignite ignite1 = startGrid(1);
+
+        Integer key = 70;
+
+        // Want test scenario when ignite1 is new primary node, but ignite0 is still partition
owner.
+        assertTrue(aff.isPrimary(ignite1.cluster().localNode(), key));
+
+        try (Transaction tx = ignite0.transactions().txStart(PESSIMISTIC, REPEATABLE_READ))
{
+            cache0.get(key);
+
+            tx.commit();
+        }
+
+        GridCacheAdapter cacheAdapter = ((IgniteKernal)ignite(0)).context().cache().internalCache();
+
+        // Check all transactions are finished.
+        assertEquals(0, cacheAdapter.context().tm().idMapSize());
+
+        // Try to start one more node.
+        startGrid(2);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b48899b8/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
index df6a95a..8e8ecbe 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
@@ -399,6 +399,9 @@ public class IgniteCacheTestSuite extends TestSuite {
         suite.addTestSuite(IgniteCacheAtomicCopyOnReadDisabledTest.class);
         suite.addTestSuite(IgniteCacheTxCopyOnReadDisabledTest.class);
 
+        // TODO: IGNITE-477.
+        // suite.addTestSuite(IgniteCacheTxPreloadNoWriteTest.class);
+
         return suite;
     }
 }


Mime
View raw message