ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [3/4] incubator-ignite git commit: IGNITE-45 - WIP
Date Thu, 05 Mar 2015 02:54:55 GMT
IGNITE-45 - WIP


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

Branch: refs/heads/ignite-45
Commit: c0e60f890da238c06c6a5c9f9bf0065246a52351
Parents: 03758ea
Author: Alexey Goncharuk <agoncharuk@gridgain.com>
Authored: Wed Mar 4 18:12:57 2015 -0800
Committer: Alexey Goncharuk <agoncharuk@gridgain.com>
Committed: Wed Mar 4 18:12:57 2015 -0800

----------------------------------------------------------------------
 .../near/GridNearTxPrepareFuture.java           |  4 +-
 .../cache/IgniteDynamicCacheStartSelfTest.java  | 66 +++++++++++++++++++-
 2 files changed, 67 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c0e60f89/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
index 05a53ee..9a81691 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
@@ -339,7 +339,7 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut
 
                         GridDiscoveryTopologySnapshot snapshot = topFut.topologySnapshot();
 
-                        tx.topologyVersion(new AffinityTopologyVersion(snapshot.topologyVersion()));
+                        tx.topologyVersion(topFut.topologyVersion());
                         tx.topologySnapshot(snapshot);
 
                         // Make sure to add future before calling prepare.
@@ -464,7 +464,7 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut
 
         assert snapshot != null;
 
-        AffinityTopologyVersion topVer = new AffinityTopologyVersion(snapshot.topologyVersion());
+        AffinityTopologyVersion topVer = tx.topologyVersion();
 
         assert topVer.topologyVersion() > 0;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c0e60f89/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
index ac92e72..29eac7c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
@@ -177,11 +177,26 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest
{
     /**
      * @throws Exception If failed.
      */
-    public void testStartStopCacheSimple() throws Exception {
+    public void testStartStopCacheSimpleTransactional() throws Exception {
+        checkStartStopCacheSimple(CacheAtomicityMode.TRANSACTIONAL);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testStartStopCacheSimpleAtomic() throws Exception {
+        checkStartStopCacheSimple(CacheAtomicityMode.ATOMIC);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    private void checkStartStopCacheSimple(CacheAtomicityMode mode) throws Exception {
         final IgniteKernal kernal = (IgniteKernal)grid(0);
 
         CacheConfiguration ccfg = new CacheConfiguration();
         ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+        ccfg.setAtomicityMode(mode);
 
         ccfg.setName(CACHE_NAME);
 
@@ -230,4 +245,53 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest
{
             }, IllegalStateException.class, null);
         }
     }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void _testStartStopCacheAddNode() throws Exception {
+        final IgniteKernal kernal = (IgniteKernal)grid(0);
+
+        CacheConfiguration ccfg = new CacheConfiguration();
+        ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+
+        ccfg.setName(CACHE_NAME);
+
+        kernal.context().cache().dynamicStartCache(ccfg, F.<ClusterNode>alwaysTrue()).get();
+
+        startGrid(nodeCount());
+
+        try {
+            // Check that cache got deployed on new node.
+            IgniteCache<Object, Object> cache = ignite(nodeCount()).jcache(CACHE_NAME);
+
+            cache.put("1", "1");
+
+            for (int g = 0; g < nodeCount(); g++)
+                assertEquals("1", grid(g).jcache(CACHE_NAME).get("1"));
+
+            // Undeploy cache.
+            kernal.context().cache().dynamicStopCache(CACHE_NAME);
+
+            startGrid(nodeCount() + 1);
+
+            // Check that cache is not deployed on new node after undeploy.
+            for (int g = 0; g < nodeCount(); g++) {
+                final IgniteKernal kernal0 = (IgniteKernal)grid(g);
+
+                for (IgniteInternalFuture f : kernal0.context().cache().context().exchange().exchangeFutures())
+                    f.get();
+
+                GridTestUtils.assertThrows(log, new Callable<Object>() {
+                    @Override public Object call() throws Exception {
+                        return kernal0.jcache(CACHE_NAME);
+                    }
+                }, IllegalArgumentException.class, null);
+            }
+        }
+        finally {
+            stopGrid(nodeCount() + 1);
+            stopGrid(nodeCount());
+        }
+    }
 }


Mime
View raw message