ignite-6467 Result of updateRebalanceVersion was incorrect when diffFromAffinityVer did not match current affinity version.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5fc18e6f Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5fc18e6f Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5fc18e6f Branch: refs/heads/ignite-8446 Commit: 5fc18e6f1f81643747bcc8d5ef8ee4fe47116763 Parents: 891da2a Author: sboikov <[email protected]> Authored: Wed Aug 1 23:51:19 2018 +0300 Committer: sboikov <[email protected]> Committed: Wed Aug 1 23:51:19 2018 +0300 ---------------------------------------------------------------------- .../dht/GridDhtPartitionTopologyImpl.java | 23 +++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/5fc18e6f/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 aa43b2f..c5c574f 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 @@ -433,7 +433,7 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology { } } - updateRebalanceVersion(affAssignment); + updateRebalanceVersion(affVer, affAssignment); return needRefresh; } @@ -762,7 +762,7 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology { if (node2part != null && node2part.valid()) changed |= checkEvictions(updateSeq, aff); - updateRebalanceVersion(aff.assignment()); + updateRebalanceVersion(aff.topologyVersion(), aff.assignment()); consistencyCheck(); @@ -1535,7 +1535,7 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology { if (exchangeVer == null) changed |= checkEvictions(updateSeq, aff); - updateRebalanceVersion(aff.assignment()); + updateRebalanceVersion(aff.topologyVersion(), aff.assignment()); } if (partSizes != null) @@ -1803,7 +1803,7 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology { if (exchId == null) changed |= checkEvictions(updateSeq, aff); - updateRebalanceVersion(aff.assignment()); + updateRebalanceVersion(aff.topologyVersion(), aff.assignment()); } consistencyCheck(); @@ -1827,8 +1827,8 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology { /** {@inheritDoc} */ @Override public void onExchangeDone(@Nullable GridDhtPartitionsExchangeFuture fut, - AffinityAssignment assignment, - boolean updateRebalanceVer) { + AffinityAssignment assignment, + boolean updateRebalanceVer) { lock.writeLock().lock(); try { @@ -1850,10 +1850,13 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology { } else diffFromAffinityVer = readyTopVer; + + if (!updateRebalanceVer) + updateRebalanceVersion(assignment.topologyVersion(), assignment.assignment()); } if (updateRebalanceVer) - updateRebalanceVersion(assignment.assignment()); + updateRebalanceVersion(assignment.topologyVersion(), assignment.assignment()); } finally { lock.writeLock().unlock(); @@ -2748,9 +2751,13 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology { } /** + * @param affVer Affinity version. * @param aff Affinity assignments. */ - private void updateRebalanceVersion(List<List<ClusterNode>> aff) { + private void updateRebalanceVersion(AffinityTopologyVersion affVer, List<List<ClusterNode>> aff) { + if (!grp.isReplicated() && !affVer.equals(diffFromAffinityVer)) + return; + if (!rebalancedTopVer.equals(readyTopVer)) { if (node2part == null || !node2part.valid()) return;
