ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [24/50] incubator-ignite git commit: # ignite-157-2
Date Fri, 08 May 2015 10:27:58 GMT
# ignite-157-2


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

Branch: refs/heads/ignite-471
Commit: 3394b4c5aa8c557b94c8726ad5f27a01f2d76d32
Parents: 6509936
Author: sboikov <sboikov@gridgain.com>
Authored: Tue May 5 15:16:09 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Tue May 5 15:41:34 2015 +0300

----------------------------------------------------------------------
 .../GridCacheAbstractNodeRestartSelfTest.java   | 94 +++++++++++---------
 .../GridCachePartitionedNodeRestartTest.java    |  4 +-
 ...ePartitionedOptimisticTxNodeRestartTest.java |  4 +-
 .../GridCacheReplicatedNodeRestartSelfTest.java |  2 +
 .../testsuites/IgniteCacheRestartTestSuite.java |  6 +-
 5 files changed, 58 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3394b4c5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
index 17d6e42..85e2c7c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
@@ -77,10 +77,10 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
     private static volatile int idx = -1;
 
     /** Preload mode. */
-    protected CacheRebalanceMode preloadMode = ASYNC;
+    protected CacheRebalanceMode rebalancMode = ASYNC;
 
     /** */
-    protected int preloadBatchSize = DFLT_BATCH_SIZE;
+    protected int rebalancBatchSize = DFLT_BATCH_SIZE;
 
     /** Number of partitions. */
     protected int partitions = DFLT_PARTITIONS;
@@ -124,8 +124,8 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
     @Override protected void beforeTest() throws Exception {
         backups = DFLT_BACKUPS;
         partitions = DFLT_PARTITIONS;
-        preloadMode = ASYNC;
-        preloadBatchSize = DFLT_BATCH_SIZE;
+        rebalancMode = ASYNC;
+        rebalancBatchSize = DFLT_BATCH_SIZE;
         nodeCnt = DFLT_NODE_CNT;
         keyCnt = DFLT_KEY_CNT;
         retries = DFLT_RETRIES;
@@ -160,7 +160,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
      * @throws Exception If failed.
      */
     public void testRestart() throws Exception {
-        preloadMode = SYNC;
+        rebalancMode = SYNC;
         partitions = 3;
         nodeCnt = 2;
         keyCnt = 10;
@@ -240,7 +240,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
         nodeCnt = 2;
         keyCnt = 10;
         partitions = 29;
-        preloadMode = ASYNC;
+        rebalancMode = ASYNC;
 
         long duration = 30000;
 
@@ -255,7 +255,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
         nodeCnt = 2;
         keyCnt = 10;
         partitions = 29;
-        preloadMode = ASYNC;
+        rebalancMode = ASYNC;
 
         long duration = 30000;
 
@@ -270,7 +270,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
         nodeCnt = 2;
         keyCnt = 10;
         partitions = 29;
-        preloadMode = ASYNC;
+        rebalancMode = ASYNC;
 
         long duration = 30000;
 
@@ -285,7 +285,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
         nodeCnt = 2;
         keyCnt = 10;
         partitions = 29;
-        preloadMode = ASYNC;
+        rebalancMode = ASYNC;
 
         long duration = 30000;
 
@@ -300,7 +300,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
         nodeCnt = 4;
         keyCnt = 10;
         partitions = 29;
-        preloadMode = ASYNC;
+        rebalancMode = ASYNC;
 
         long duration = 60000;
 
@@ -315,7 +315,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
         nodeCnt = 4;
         keyCnt = 10;
         partitions = 29;
-        preloadMode = ASYNC;
+        rebalancMode = ASYNC;
 
         long duration = 60000;
 
@@ -330,7 +330,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
         nodeCnt = 4;
         keyCnt = 10;
         partitions = 29;
-        preloadMode = ASYNC;
+        rebalancMode = ASYNC;
 
         long duration = 60000;
 
@@ -345,7 +345,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
         nodeCnt = 4;
         keyCnt = 10;
         partitions = 29;
-        preloadMode = ASYNC;
+        rebalancMode = ASYNC;
 
         long duration = 60000;
 
@@ -360,7 +360,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
         nodeCnt = 6;
         keyCnt = 10;
         partitions = 29;
-        preloadMode = ASYNC;
+        rebalancMode = ASYNC;
 
         long duration = 90000;
 
@@ -375,7 +375,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
         nodeCnt = 6;
         keyCnt = 10;
         partitions = 29;
-        preloadMode = ASYNC;
+        rebalancMode = ASYNC;
 
         long duration = 90000;
 
@@ -390,7 +390,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
         nodeCnt = 8;
         keyCnt = 10;
         partitions = 29;
-        preloadMode = ASYNC;
+        rebalancMode = ASYNC;
 
         long duration = 90000;
 
@@ -405,7 +405,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
         nodeCnt = 8;
         keyCnt = 10;
         partitions = 29;
-        preloadMode = ASYNC;
+        rebalancMode = ASYNC;
 
         long duration = 90000;
 
@@ -420,7 +420,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
         nodeCnt = 10;
         keyCnt = 10;
         partitions = 29;
-        preloadMode = ASYNC;
+        rebalancMode = ASYNC;
 
         long duration = 90000;
 
@@ -435,7 +435,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
         nodeCnt = 10;
         keyCnt = 10;
         partitions = 29;
-        preloadMode = ASYNC;
+        rebalancMode = ASYNC;
 
         long duration = 90000;
 
@@ -450,7 +450,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
         nodeCnt = 10;
         keyCnt = 10;
         partitions = 29;
-        preloadMode = ASYNC;
+        rebalancMode = ASYNC;
 
         long duration = 90000;
 
@@ -465,7 +465,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
         nodeCnt = 4;
         keyCnt = 10;
         partitions = 29;
-        preloadMode = ASYNC;
+        rebalancMode = ASYNC;
 
         long duration = 90000;
 
@@ -525,7 +525,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
                         catch (Exception e) {
                             err.compareAndSet(null, e);
 
-                            error("Failed to put value in cache.", e);
+                            error("Unexpected exception in put-worker.", e);
                         }
                     }
                 }, "put-worker-" + i);
@@ -565,7 +565,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
                         catch (Exception e) {
                             err.compareAndSet(null, e);
 
-                            error("Failed to restart grid node.", e);
+                            error("Unexpected exception in restart-worker.", e);
                         }
                     }
                 }, "restart-worker-" + i);
@@ -643,12 +643,16 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
                                 int c = 0;
 
                                 try {
-                                    try (Transaction tx = ignite.transactions().txStart(txConcurrency(),
REPEATABLE_READ)) {
+                                    IgniteTransactions txs = ignite.transactions();
+
+                                    try (Transaction tx = txs.txStart(txConcurrency(), REPEATABLE_READ))
{
                                         c = txCntr.incrementAndGet();
 
-                                        if (c % logFreq == 0)
-                                            info(">>> Tx iteration started [cnt="
+ c + ", keys=" + keys + ", " +
-                                                "locNodeId=" + locNodeId + ']');
+                                        if (c % logFreq == 0) {
+                                            info(">>> Tx iteration started [cnt="
+ c +
+                                                ", keys=" + keys +
+                                                ", locNodeId=" + locNodeId + ']');
+                                        }
 
                                         for (int key : keys) {
                                             int op = cacheOp();
@@ -664,17 +668,15 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
                                         tx.commit();
                                     }
                                 }
-                                catch (ClusterTopologyException | CacheException e) {
-                                    if (e instanceof CacheException
-                                        && !(e.getCause() instanceof ClusterTopologyException))
-                                        throw e;
-
+                                catch (ClusterTopologyException | CacheException ignored)
{
                                     // It is ok if primary node leaves grid.
                                 }
 
-                                if (c % logFreq == 0)
-                                    info(">>> Tx iteration finished [cnt=" + c +
", keys=" + keys + ", " +
-                                        "locNodeId=" + locNodeId + ']');
+                                if (c % logFreq == 0) {
+                                    info(">>> Tx iteration finished [cnt=" + c +
+                                        ", keys=" + keys +
+                                        ", locNodeId=" + locNodeId + ']');
+                                }
                             }
 
                             info(">>> " + Thread.currentThread().getName() + " finished.");
@@ -682,7 +684,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
                         catch (Exception e) {
                             err.compareAndSet(null, e);
 
-                            error("Failed to put value in cache.", e);
+                            error("Unexpected exception in put-worker.", e);
                         }
                     }
                 }, "put-worker-" + i);
@@ -719,7 +721,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
                         catch (Exception e) {
                             err.compareAndSet(null, e);
 
-                            error("Failed to restart grid node.", e);
+                            error("Unexpected exception in restart-worker.", e);
                         }
                     }
                 }, "restart-worker-" + i);
@@ -812,19 +814,21 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
 
                                     tx.commit();
                                 }
-                                catch (ClusterTopologyException ignored) {
+                                catch (ClusterTopologyException | CacheException ignored)
{
                                     // It is ok if primary node leaves grid.
                                 }
 
-                                if (c % logFreq == 0)
-                                    info(">>> Tx iteration finished [cnt=" + c +
", keys=" + keys + ", " +
+                                if (c % logFreq == 0) {
+                                    info(">>> Tx iteration finished [cnt=" + c +
+                                        ", keys=" + keys + ", " +
                                         "locNodeId=" + locNodeId + ']');
+                                }
                             }
                         }
                         catch (Exception e) {
                             err.compareAndSet(null, e);
 
-                            error("Failed to put value in cache.", e);
+                            error("Unexpected exception in put-worker.", e);
                         }
                     }
                 }, "put-worker-" + i);
@@ -859,7 +863,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
                         catch (Exception e) {
                             err.compareAndSet(null, e);
 
-                            error("Failed to restart grid node.", e);
+                            error("Unexpected exception in restart-worker.", e);
                         }
                     }
                 }, "restart-worker-" + i);
@@ -893,10 +897,12 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
      * @param attempt Attempt.
      */
     private void printFailureDetails(IgniteCache<Integer, String> c, int key, int attempt)
{
+        Ignite ignite = c.unwrap(Ignite.class);
+
         error("*** Failure details ***");
         error("Key: " + key);
-        error("Partition: " + c.getConfiguration(CacheConfiguration.class).getAffinity().partition(key));
+        error("Partition: " + ignite.affinity(c.getName()).partition(key));
         error("Attempt: " + attempt);
-        error("Node: " + c.unwrap(Ignite.class).cluster().localNode().id());
+        error("Node: " + ignite.cluster().localNode().id());
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3394b4c5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java
index 8a2b19a..2096836 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java
@@ -43,8 +43,8 @@ public class GridCachePartitionedNodeRestartTest extends GridCacheAbstractNodeRe
         cc.setWriteSynchronizationMode(FULL_ASYNC);
         cc.setNearConfiguration(null);
         cc.setStartSize(20);
-        cc.setRebalanceMode(preloadMode);
-        cc.setRebalanceBatchSize(preloadBatchSize);
+        cc.setRebalanceMode(rebalancMode);
+        cc.setRebalanceBatchSize(rebalancBatchSize);
         cc.setAffinity(new RendezvousAffinityFunction(false, partitions));
         cc.setBackups(backups);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3394b4c5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedOptimisticTxNodeRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedOptimisticTxNodeRestartTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedOptimisticTxNodeRestartTest.java
index 62dfaa9..82da2ac 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedOptimisticTxNodeRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedOptimisticTxNodeRestartTest.java
@@ -42,8 +42,8 @@ public class GridCachePartitionedOptimisticTxNodeRestartTest extends GridCacheAb
         cc.setCacheMode(PARTITIONED);
         cc.setWriteSynchronizationMode(FULL_ASYNC);
         cc.setStartSize(20);
-        cc.setRebalanceMode(preloadMode);
-        cc.setRebalanceBatchSize(preloadBatchSize);
+        cc.setRebalanceMode(rebalancMode);
+        cc.setRebalanceBatchSize(rebalancBatchSize);
         cc.setAffinity(new RendezvousAffinityFunction(false, partitions));
         cc.setBackups(backups);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3394b4c5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedNodeRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedNodeRestartSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedNodeRestartSelfTest.java
index aa32559..0023160 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedNodeRestartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedNodeRestartSelfTest.java
@@ -34,6 +34,8 @@ public class GridCacheReplicatedNodeRestartSelfTest extends GridCacheAbstractNod
 
         CacheConfiguration cc = defaultCacheConfiguration();
 
+        cc.setNearConfiguration(null);
+
         cc.setAtomicityMode(atomicityMode());
 
         cc.setName(CACHE_NAME);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3394b4c5/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
index 0ced1c8..b219f7f 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
@@ -21,7 +21,6 @@ import junit.framework.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.cache.distributed.*;
 import org.apache.ignite.internal.processors.cache.distributed.near.*;
-import org.apache.ignite.internal.processors.cache.distributed.replicated.*;
 
 /**
  * In-Memory Data Grid stability test suite on changing topology.
@@ -36,10 +35,9 @@ public class IgniteCacheRestartTestSuite extends TestSuite {
 
         suite.addTestSuite(GridCachePartitionedTxSalvageSelfTest.class);
 
-        // TODO: GG-7419: Enable when fixed.
-        // suite.addTestSuite(GridCachePartitionedNodeRestartTest.class);
+        suite.addTestSuite(GridCachePartitionedNodeRestartTest.class);
+        // TODO: IGNITE-157.
         // suite.addTestSuite(GridCachePartitionedOptimisticTxNodeRestartTest.class);
-        // TODO: uncomment when fix GG-1969
         // suite.addTestSuite(GridCacheReplicatedNodeRestartSelfTest.class);
 
         suite.addTestSuite(IgniteCacheAtomicNodeRestartTest.class);


Mime
View raw message