ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [05/15] incubator-ignite git commit: # Fix TopologyVersionAwareJob
Date Mon, 17 Aug 2015 11:05:26 GMT
 # Fix TopologyVersionAwareJob


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

Branch: refs/heads/ignite-gg-10606
Commit: a3301b3511a742c7c2cc013a4e31a1a838482938
Parents: 51dcd51
Author: sboikov <sboikov@gridgain.com>
Authored: Fri Aug 14 11:27:29 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Fri Aug 14 11:37:47 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheAdapter.java      |   9 +-
 .../IgniteCacheSizeFailoverTest.java            | 115 +++++++++++++++++++
 .../IgniteCachePutRetryAbstractSelfTest.java    |  19 ++-
 ...PutRetryAtomicPrimaryWriteOrderSelfTest.java |  32 ++++++
 .../tcp/IgniteCacheSslStartStopSelfTest.java    |   1 +
 .../IgniteCacheFailoverTestSuite.java           |   3 +
 6 files changed, 175 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a3301b35/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 18f4004..47ede5b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -5597,9 +5597,12 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
                     jobCtx.holdcc();
 
                     fut.listen(new CI1<IgniteInternalFuture<?>>() {
-                        @Override
-                        public void apply(IgniteInternalFuture<?> t) {
-                            jobCtx.callcc();
+                        @Override public void apply(IgniteInternalFuture<?> t) {
+                            ((IgniteKernal)ignite).context().closure().runLocalSafe(new Runnable()
{
+                                @Override public void run() {
+                                    jobCtx.callcc();
+                                }
+                            }, false);
                         }
                     });
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a3301b35/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSizeFailoverTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSizeFailoverTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSizeFailoverTest.java
new file mode 100644
index 0000000..a76d894
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSizeFailoverTest.java
@@ -0,0 +1,115 @@
+/*
+ * 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.distributed;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+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.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+import static org.apache.ignite.cache.CacheMode.*;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
+
+/**
+ *
+ */
+public class IgniteCacheSizeFailoverTest extends GridCommonAbstractTest {
+    /** */
+    private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception
{
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+
+        CacheConfiguration ccfg = new CacheConfiguration();
+
+        ccfg.setCacheMode(PARTITIONED);
+        ccfg.setAtomicityMode(ATOMIC);
+        ccfg.setWriteSynchronizationMode(FULL_SYNC);
+        ccfg.setBackups(1);
+
+        cfg.setCacheConfiguration(ccfg);
+
+        return cfg;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSize() throws Exception {
+        startGrids(2);
+
+        final AtomicBoolean stop = new AtomicBoolean();
+
+        final AtomicInteger cntr = new AtomicInteger();
+
+        IgniteInternalFuture<?> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Object>()
{
+            @Override public Object call() throws Exception {
+                int idx = cntr.getAndIncrement();
+
+                IgniteCache<Object, Object> cache = ignite(idx).cache(null);
+
+                long cntr = 0;
+
+                while (!stop.get()) {
+                    cache.size();
+
+                    if (cntr++ % 1000 == 0)
+                        log.info("Iteration: " + cntr);
+                }
+
+                return null;
+            }
+        }, 2, "size-thread");
+
+        try {
+            for (int i = 0; i < 10; i++) {
+                log.info("Start node: " + i);
+
+                Ignite node = startGrid(3);
+
+                IgniteCache<Object, Object> cache = node.cache(null);
+
+                for (int j = 0; j < 100; j++)
+                    assertTrue(cache.size() >= 0);
+
+                log.info("Stop node: " + i);
+
+                stopGrid(3);
+            }
+        }
+        finally {
+            stop.set(true);
+        }
+
+        log.info("Stop test.");
+
+        fut.get();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a3301b35/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
index bfddbe7..dcba325 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.cache.distributed.dht;
 
+import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.*;
@@ -29,6 +30,9 @@ import org.apache.ignite.testframework.*;
 import java.util.concurrent.*;
 import java.util.concurrent.atomic.*;
 
+import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.*;
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+
 /**
  *
  */
@@ -47,6 +51,7 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCacheAbstr
     @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception
{
         CacheConfiguration cfg = super.cacheConfiguration(gridName);
 
+        cfg.setAtomicWriteOrderMode(writeOrderMode());
         cfg.setBackups(1);
 
         return cfg;
@@ -66,6 +71,13 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCacheAbstr
     }
 
     /**
+     * @return Write order mode.
+     */
+    protected CacheAtomicWriteOrderMode writeOrderMode() {
+        return CLOCK;
+    }
+
+    /**
      * @throws Exception If failed.
      */
     public void testPut() throws Exception {
@@ -87,8 +99,13 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCacheAbstr
 
         int keysCnt = keysCount();
 
+        IgniteCache<Object, Object> cache = ignite(0).cache(null);
+
+        if (atomicityMode() == ATOMIC)
+            assertEquals(writeOrderMode(), cache.getConfiguration(CacheConfiguration.class).getAtomicWriteOrderMode());
+
         for (int i = 0; i < keysCnt; i++)
-            ignite(0).cache(null).put(i, i);
+            cache.put(i, i);
 
         finished.set(true);
         fut.get();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a3301b35/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCachePutRetryAtomicPrimaryWriteOrderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCachePutRetryAtomicPrimaryWriteOrderSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCachePutRetryAtomicPrimaryWriteOrderSelfTest.java
new file mode 100644
index 0000000..e9682c5
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCachePutRetryAtomicPrimaryWriteOrderSelfTest.java
@@ -0,0 +1,32 @@
+/*
+ * 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.distributed.dht.atomic;
+
+import org.apache.ignite.cache.*;
+import org.apache.ignite.internal.processors.cache.distributed.dht.*;
+
+import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.*;
+
+/**
+ *
+ */
+public class IgniteCachePutRetryAtomicPrimaryWriteOrderSelfTest extends IgniteCachePutRetryAtomicSelfTest
{
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicWriteOrderMode writeOrderMode() {
+        return PRIMARY;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a3301b35/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteCacheSslStartStopSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteCacheSslStartStopSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteCacheSslStartStopSelfTest.java
index 9bf6caa..5b9af4f 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteCacheSslStartStopSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteCacheSslStartStopSelfTest.java
@@ -26,6 +26,7 @@ import org.apache.ignite.testframework.*;
  *
  */
 public class IgniteCacheSslStartStopSelfTest extends IgniteCachePutRetryAbstractSelfTest
{
+    /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception
{
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a3301b35/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
index 524bfb3..af2b85c 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
@@ -73,10 +73,13 @@ public class IgniteCacheFailoverTestSuite extends TestSuite {
         suite.addTestSuite(IgniteCacheTxNearDisabledFairAffinityPutGetRestartTest.class);
 
         suite.addTestSuite(IgniteCachePutRetryAtomicSelfTest.class);
+        suite.addTestSuite(IgniteCachePutRetryAtomicPrimaryWriteOrderSelfTest.class);
         suite.addTestSuite(IgniteCachePutRetryTransactionalSelfTest.class);
 
         suite.addTestSuite(IgniteCacheSslStartStopSelfTest.class);
 
+        suite.addTestSuite(IgniteCacheSizeFailoverTest.class);
+
         return suite;
     }
 }


Mime
View raw message