ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [04/18] ignite git commit: ignite-5068 : Fixed diff calculation, added workaround when requested affVer != diffFromAffinityVer.
Date Thu, 08 Jun 2017 13:13:38 GMT
ignite-5068 : Fixed diff calculation, added workaround when requested affVer != diffFromAffinityVer.


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

Branch: refs/heads/ignite-5267-merge-ea
Commit: 401b7a0b76e8372841e4170b14de75da7f45fa76
Parents: 81d9dcb
Author: Ilya Lantukh <ilantukh@gridgain.com>
Authored: Tue Apr 25 19:30:03 2017 +0300
Committer: Ilya Lantukh <ilantukh@gridgain.com>
Committed: Tue Apr 25 19:30:03 2017 +0300

----------------------------------------------------------------------
 .../dht/GridDhtPartitionTopologyImpl.java       | 52 ++++++++++++++++++--
 1 file changed, 47 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/401b7a0b/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 19c5f3a..80b83fa 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
@@ -55,6 +55,8 @@ import org.apache.ignite.internal.util.StripedCompositeReadWriteLock;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.T2;
+import org.apache.ignite.internal.util.typedef.T3;
+import org.apache.ignite.internal.util.typedef.T4;
 import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.U;
@@ -957,6 +959,28 @@ import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDh
 
             List<ClusterNode> nodes = null;
 
+            if (!topVer.equals(diffFromAffinityVer)) {
+                System.out.println("??? node2part");
+
+                nodes = new ArrayList<>();
+
+                nodes.addAll(affNodes);
+
+                for (Map.Entry<UUID, GridDhtPartitionMap> entry : node2part.entrySet())
{
+                    GridDhtPartitionState state = entry.getValue().get(p);
+
+                    ClusterNode n = cctx.discovery().node(entry.getKey());
+
+                    if (n != null && state != null && (state == MOVING ||
state == OWNING || state == RENTING) && !nodes.contains(n)
+                        && (topVer.topologyVersion() < 0 || n.order() <= topVer.topologyVersion()))
{
+                        nodes.add(n);
+                    }
+
+                }
+
+                return nodes;
+            }
+
             Collection<UUID> diffIds = diffFromAffinity.get(p);
 
             if (!F.isEmpty(diffIds)) {
@@ -1012,7 +1036,10 @@ import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDh
             // Node IDs can be null if both, primary and backup, nodes disappear.
             List<ClusterNode> nodes = new ArrayList<>();
 
-            for (UUID id : allIds) {
+            for (UUID id : node2part.keySet()) {
+                if (topVer.topologyVersion() > 0 && !allIds.contains(id))
+                    continue;
+
                 if (hasState(p, id, state, states)) {
                     ClusterNode n = cctx.discovery().node(id);
 
@@ -1196,16 +1223,18 @@ import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDh
 
                         Set<UUID> diffIds = diffFromAffinity.get(p);
 
-                        if (e0.getValue() != MOVING && e0.getValue() != OWNING &&
e0.getValue() != RENTING &&
-                            !affAssignment.getIds(p).contains(partMap.nodeId())) {
+                        if ((e0.getValue() == MOVING || e0.getValue() == OWNING || e0.getValue()
== RENTING) &&
+                            !affAssignment.getIds(p).contains(e.getKey())) {
+
                             if (diffIds == null)
                                 diffFromAffinity.put(p, diffIds = U.newHashSet(3));
 
-                            if (diffIds.add(partMap.nodeId()))
+                            if (diffIds.add(e.getKey())) {
                                 diffFromAffinitySize++;
+                            }
                         }
                         else {
-                            if (diffIds != null && diffIds.remove(partMap.nodeId()))
{
+                            if (diffIds != null && diffIds.remove(e.getKey())) {
                                 diffFromAffinitySize--;
 
                                 if (diffIds.isEmpty())
@@ -1834,6 +1863,19 @@ import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDh
             map.updateSequence(updateSeq, topVer);
 
             map.put(p, state);
+
+            if (state == MOVING || state == OWNING || state == RENTING) {
+                AffinityAssignment assignment = cctx.affinity().assignment(diffFromAffinityVer);
+
+                if (!assignment.getIds(p).contains(cctx.localNodeId())) {
+                    Set<UUID> diffIds = diffFromAffinity.get(p);
+
+                    if (diffIds == null)
+                        diffFromAffinity.put(p, diffIds = U.newHashSet(3));
+
+                    diffIds.add(cctx.localNodeId());
+                }
+            }
         }
 
         return updateSeq;


Mime
View raw message