Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 9D22C200CB0 for ; Thu, 8 Jun 2017 15:13:37 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 9BF21160BE5; Thu, 8 Jun 2017 13:13:37 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id EA44E160BE7 for ; Thu, 8 Jun 2017 15:13:36 +0200 (CEST) Received: (qmail 98138 invoked by uid 500); 8 Jun 2017 13:13:36 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 98114 invoked by uid 99); 8 Jun 2017 13:13:36 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Jun 2017 13:13:36 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E830FE00C4; Thu, 8 Jun 2017 13:13:35 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: agoncharuk@apache.org To: commits@ignite.apache.org Date: Thu, 08 Jun 2017 13:13:38 -0000 Message-Id: <1dec3bd1a2d346298fca6e024b8b91bc@git.apache.org> In-Reply-To: <461cd2a8567b4c45ad64bfb14083569b@git.apache.org> References: <461cd2a8567b4c45ad64bfb14083569b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [04/18] ignite git commit: ignite-5068 : Fixed diff calculation, added workaround when requested affVer != diffFromAffinityVer. archived-at: Thu, 08 Jun 2017 13:13:37 -0000 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 Authored: Tue Apr 25 19:30:03 2017 +0300 Committer: Ilya Lantukh 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 nodes = null; + if (!topVer.equals(diffFromAffinityVer)) { + System.out.println("??? node2part"); + + nodes = new ArrayList<>(); + + nodes.addAll(affNodes); + + for (Map.Entry 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 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 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 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 diffIds = diffFromAffinity.get(p); + + if (diffIds == null) + diffFromAffinity.put(p, diffIds = U.newHashSet(3)); + + diffIds.add(cctx.localNodeId()); + } + } } return updateSeq;