ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [04/15] ignite git commit: ignite-db-x fix testSimpleRebalancing
Date Fri, 10 Feb 2017 12:37:19 GMT
ignite-db-x fix testSimpleRebalancing


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

Branch: refs/heads/ignite-3477-compact2
Commit: 98b35ff347d0245024ca52ea128c34bb7f9279bb
Parents: 8a6736e
Author: Dmitriy Govorukhin <dgovorukhin@gridgain.com>
Authored: Fri Feb 3 16:24:23 2017 +0300
Committer: Dmitriy Govorukhin <dgovorukhin@gridgain.com>
Committed: Fri Feb 3 16:24:23 2017 +0300

----------------------------------------------------------------------
 .../dht/GridDhtPartitionTopologyImpl.java       |  2 +-
 .../junits/common/GridCommonAbstractTest.java   | 52 ++++++++++++++------
 2 files changed, 38 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/98b35ff3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
index 5be1d86..322bbe3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
@@ -835,7 +835,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology
{
         for (int i = 0; i < locParts.length(); i++) {
             GridDhtLocalPartition part = locParts.get(i);
 
-            if (part != null)
+            if (part != null && part.state().active())
                 list.add(part);
         }
         return list;

http://git-wip-us.apache.org/repos/asf/ignite/blob/98b35ff3/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
index 48189f7..80ee6b9 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
@@ -707,17 +707,18 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
 
     /**
      * @param c Cache proxy.
-     *
-     * Print partitionState for cache.
      */
     protected void printPartitionState(IgniteCache<?, ?> c) {
-        IgniteCacheProxy<?, ?> cache = (IgniteCacheProxy<?, ?>)c;
-
-        CacheConfiguration cfg = cache.context().config();
-
-        if (cfg == null)
-            return;
+        printPartitionState(c.getConfiguration(CacheConfiguration.class).getName(),0);
+    }
 
+    /**
+     * @param cacheName Cache name.
+     * @param firstParts Count partition for print (will be print first count partition).
+     *
+     * Print partitionState for cache.
+     */
+    protected void printPartitionState(String cacheName, int firstParts) {
         StringBuilder sb = new StringBuilder();
 
         sb.append("----preload sync futures----\n");
@@ -725,7 +726,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
         for (Ignite ig : G.allGrids()) {
             IgniteKernal k = ((IgniteKernal)ig);
 
-            IgniteInternalFuture<?> syncFut = k.internalCache(cfg.getName())
+            IgniteInternalFuture<?> syncFut = k.internalCache(cacheName)
                 .preloader()
                 .syncFuture();
 
@@ -741,7 +742,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
         for (Ignite ig : G.allGrids()) {
             IgniteKernal k = ((IgniteKernal)ig);
 
-            IgniteInternalFuture<?> f = k.internalCache(cfg.getName())
+            IgniteInternalFuture<?> f = k.internalCache(cacheName)
                 .preloader()
                 .rebalanceFuture();
 
@@ -782,9 +783,26 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
                 .append(" grid=").append(g0.name())
                 .append("\n");
 
-            GridDhtPartitionTopology top = dht(cache).topology();
+            IgniteCacheProxy<?, ?> cache = g0.context().cache().jcache(cacheName);
+
+            GridDhtCacheAdapter<?, ?> dht = dht(cache);
+
+            GridDhtPartitionTopology top = dht.topology();
+
+            int parts = firstParts == 0 ? cache.context()
+                .config()
+                .getAffinity()
+                .partitions() : firstParts;
+
+            for (int p = 0; p < parts; p++) {
+                AffinityTopologyVersion readyVer = dht.context().shared().exchange().readyAffinityVersion();
+
+                Collection<UUID> affNodes = F.nodeIds(dht.context()
+                    .affinity()
+                    .assignment(readyVer)
+                    .idealAssignment()
+                    .get(p));
 
-            for (int p = 0; p < cfg.getAffinity().partitions(); p++) {
                 GridDhtLocalPartition part = top.localPartition(p, AffinityTopologyVersion.NONE,
false);
 
                 sb.append("local part=");
@@ -794,16 +812,20 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
                 else
                     sb.append(p).append(" is null");
 
-                sb.append("\n");
+                sb.append(" isAffNode=")
+                    .append(affNodes.contains(g0.localNode().id()))
+                    .append("\n");
 
                 for (UUID nodeId : F.nodeIds(g0.context().discovery().allNodes())) {
                     if (!nodeId.equals(g0.localNode().id()))
-                        sb.append(" nodeId = ")
+                        sb.append(" nodeId=")
                             .append(nodeId)
                             .append(" part=")
                             .append(p)
                             .append(" state=")
                             .append(top.partitionState(nodeId, p))
+                            .append(" isAffNode=")
+                            .append(affNodes.contains(nodeId))
                             .append("\n");
                 }
             }
@@ -811,7 +833,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
             sb.append("\n");
         }
 
-        log.info("dump partitions state for <" + cfg.getName() + ">:\n" + sb.toString());
+        log.info("dump partitions state for <" + cacheName + ">:\n" + sb.toString());
     }
 
     /**


Mime
View raw message