ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [13/18] ignite git commit: ignite-5068 : Cosmetic changes.
Date Thu, 08 Jun 2017 13:13:47 GMT
ignite-5068 : Cosmetic changes.


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

Branch: refs/heads/ignite-5267-merge-ea
Commit: 0955308b8832200aa8ac86c84e967c1d50ebefb1
Parents: 58f1998
Author: Ilya Lantukh <ilantukh@gridgain.com>
Authored: Fri Apr 28 18:19:50 2017 +0300
Committer: Ilya Lantukh <ilantukh@gridgain.com>
Committed: Fri Apr 28 18:19:50 2017 +0300

----------------------------------------------------------------------
 .../dht/GridClientPartitionTopology.java        |   2 +-
 .../dht/GridDhtPartitionTopology.java           |   6 +-
 .../dht/GridDhtPartitionTopologyImpl.java       | 105 ++++++++++---------
 .../GridDhtPartitionsExchangeFuture.java        |  12 +--
 4 files changed, 65 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/0955308b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
index 4dc6b5f..d55dda7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
@@ -755,7 +755,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology
{
     }
 
     /** {@inheritDoc} */
-    @Override public void onAffinityInitialized(AffinityAssignment assignment) {
+    @Override public void onExchangeDone(AffinityAssignment assignment) {
         // TODO
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/0955308b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
index c1933c6..d2f1822 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
@@ -313,5 +313,9 @@ public interface GridDhtPartitionTopology {
      */
     public void setOwners(int p, Set<UUID> owners, boolean updateSeq);
 
-    public void onAffinityInitialized(AffinityAssignment assignment);
+    /**
+     * Callback on exchange done.
+     * @param assignment New affinity assignment.
+     */
+    public void onExchangeDone(AffinityAssignment assignment);
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/0955308b/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 b5a8bef..69cd734 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
@@ -1011,56 +1011,6 @@ import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDh
         }
     }
 
-    private void rebuildDiff(AffinityAssignment affAssignment) {
-        assert lock.isWriteLockedByCurrentThread();
-
-        if (node2part == null)
-            return;
-
-        if (FAST_DIFF_REBUILD) {
-            Collection<UUID> affNodes = F.nodeIds(cctx.discovery().cacheAffinityNodes(cctx.cacheId(),
affAssignment.topologyVersion()));
-
-            for (Map.Entry<Integer, Set<UUID>> e : diffFromAffinity.entrySet())
{
-                int p = e.getKey();
-
-                Iterator<UUID> iter = e.getValue().iterator();
-
-                while (iter.hasNext()) {
-                    UUID nodeId = iter.next();
-
-                    if (!affNodes.contains(nodeId) || affAssignment.getIds(p).contains(nodeId))
-                        iter.remove();
-                }
-            }
-        }
-        else {
-            for (Map.Entry<UUID, GridDhtPartitionMap> e : node2part.entrySet()) {
-                UUID nodeId = e.getKey();
-
-                for (Map.Entry<Integer, GridDhtPartitionState> e0 : e.getValue().entrySet())
{
-                    int p0 = e0.getKey();
-
-                    GridDhtPartitionState state = e0.getValue();
-
-                    Set<UUID> ids = diffFromAffinity.get(p0);
-
-                    if ((state == MOVING || state == OWNING || state == RENTING) &&
!affAssignment.getIds(p0).contains(nodeId)) {
-                        if (ids == null)
-                            diffFromAffinity.put(p0, ids = U.newHashSet(3));
-
-                        ids.add(nodeId);
-                    }
-                    else {
-                        if (ids != null)
-                            ids.remove(nodeId);
-                    }
-                }
-            }
-        }
-
-        diffFromAffinityVer = affAssignment.topologyVersion();
-    }
-
     /**
      * @param p Partition.
      * @param topVer Topology version ({@code -1} for all nodes).
@@ -1513,7 +1463,7 @@ import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDh
     }
 
     /** {@inheritDoc} */
-    @Override public void onAffinityInitialized(AffinityAssignment assignment) {
+    @Override public void onExchangeDone(AffinityAssignment assignment) {
         lock.writeLock().lock();
 
         try {
@@ -1525,6 +1475,59 @@ import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDh
         }
     }
 
+    /**
+     * @param affAssignment New affinity assignment.
+     */
+    private void rebuildDiff(AffinityAssignment affAssignment) {
+        assert lock.isWriteLockedByCurrentThread();
+
+        if (node2part == null)
+            return;
+
+        if (FAST_DIFF_REBUILD) {
+            Collection<UUID> affNodes = F.nodeIds(cctx.discovery().cacheAffinityNodes(cctx.cacheId(),
affAssignment.topologyVersion()));
+
+            for (Map.Entry<Integer, Set<UUID>> e : diffFromAffinity.entrySet())
{
+                int p = e.getKey();
+
+                Iterator<UUID> iter = e.getValue().iterator();
+
+                while (iter.hasNext()) {
+                    UUID nodeId = iter.next();
+
+                    if (!affNodes.contains(nodeId) || affAssignment.getIds(p).contains(nodeId))
+                        iter.remove();
+                }
+            }
+        }
+        else {
+            for (Map.Entry<UUID, GridDhtPartitionMap> e : node2part.entrySet()) {
+                UUID nodeId = e.getKey();
+
+                for (Map.Entry<Integer, GridDhtPartitionState> e0 : e.getValue().entrySet())
{
+                    int p0 = e0.getKey();
+
+                    GridDhtPartitionState state = e0.getValue();
+
+                    Set<UUID> ids = diffFromAffinity.get(p0);
+
+                    if ((state == MOVING || state == OWNING || state == RENTING) &&
!affAssignment.getIds(p0).contains(nodeId)) {
+                        if (ids == null)
+                            diffFromAffinity.put(p0, ids = U.newHashSet(3));
+
+                        ids.add(nodeId);
+                    }
+                    else {
+                        if (ids != null)
+                            ids.remove(nodeId);
+                    }
+                }
+            }
+        }
+
+        diffFromAffinityVer = affAssignment.topologyVersion();
+    }
+
     /** {@inheritDoc} */
     @Override public boolean detectLostPartitions(DiscoveryEvent discoEvt) {
         lock.writeLock().lock();

http://git-wip-us.apache.org/repos/asf/ignite/blob/0955308b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index ec67db4..5b027a9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -1216,14 +1216,12 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
             cctx.kernalContext().state().onExchangeDone();
 
         if (err == null && realExchange) {
-//            if (discoEvt.type() == EVT_NODE_LEFT || discoEvt.type() == EVT_NODE_FAILED
|| (discoEvt instanceof DiscoveryCustomEvent && ((DiscoveryCustomEvent)discoEvt).customMessage()
instanceof CacheAffinityChangeMessage)) {
-                for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
-                    if (cacheCtx.isLocal())
-                        continue;
+            for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
+                if (cacheCtx.isLocal())
+                    continue;
 
-                    cacheCtx.topology().onAffinityInitialized(cacheCtx.affinity().assignment(topologyVersion()));
-                }
-//            }
+                cacheCtx.topology().onExchangeDone(cacheCtx.affinity().assignment(topologyVersion()));
+            }
         }
 
         if (super.onDone(res, err) && realExchange) {


Mime
View raw message