You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2017/01/26 18:28:49 UTC
[5/7] ignite git commit: ignite-db-x fix assign own partition state
ignite-db-x fix assign own partition state
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4b1d21fa
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4b1d21fa
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4b1d21fa
Branch: refs/heads/ignite-3477
Commit: 4b1d21faee58865fe1a6e9f3db62cddbfeed17da
Parents: 196c0ac
Author: Dmitriy Govorukhin <dg...@gridgain.com>
Authored: Thu Jan 26 21:23:34 2017 +0300
Committer: Dmitriy Govorukhin <dg...@gridgain.com>
Committed: Thu Jan 26 21:23:34 2017 +0300
----------------------------------------------------------------------
.../dht/GridDhtPartitionTopologyImpl.java | 40 +++++++-------------
1 file changed, 14 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4b1d21fa/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 f83f93a..5be1d86 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
@@ -1065,9 +1065,11 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
/** {@inheritDoc} */
@SuppressWarnings({"MismatchedQueryAndUpdateOfCollection"})
- @Nullable @Override public GridDhtPartitionMap2 update(@Nullable GridDhtPartitionExchangeId exchId,
+ @Nullable @Override public GridDhtPartitionMap2 update(
+ @Nullable GridDhtPartitionExchangeId exchId,
GridDhtPartitionFullMap partMap,
- @Nullable Map<Integer, T2<Long, Long>> cntrMap) {
+ @Nullable Map<Integer, T2<Long, Long>> cntrMap
+ ) {
if (log.isDebugEnabled())
log.debug("Updating full partition map [exchId=" + exchId + ", parts=" + fullMapString() + ']');
@@ -1080,6 +1082,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
return null;
if (cntrMap != null) {
+ // update local map partition counters
for (Map.Entry<Integer, T2<Long, Long>> e : cntrMap.entrySet()) {
T2<Long, Long> cntr = this.cntrMap.get(e.getKey());
@@ -1087,6 +1090,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
this.cntrMap.put(e.getKey(), e.getValue());
}
+ // update local counters in partitions
for (int i = 0; i < locParts.length(); i++) {
GridDhtLocalPartition part = locParts.get(i);
@@ -1100,6 +1104,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
}
}
+ //if need skip
if (exchId != null && lastExchangeId != null && lastExchangeId.compareTo(exchId) >= 0) {
if (log.isDebugEnabled())
log.debug("Stale exchange id for full partition map update (will ignore) [lastExchId=" +
@@ -1141,6 +1146,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
}
}
+ //remove entry if node left
for (Iterator<UUID> it = partMap.keySet().iterator(); it.hasNext(); ) {
UUID nodeId = it.next();
@@ -1179,32 +1185,12 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
GridDhtPartitionMap2 nodeMap = partMap.get(cctx.localNodeId());
- if (nodeMap != null) {
+ if (nodeMap != null && cctx.shared().database().persistenceEnabled()) {
for (Map.Entry<Integer, GridDhtPartitionState> e : nodeMap.entrySet()) {
int p = e.getKey();
GridDhtPartitionState state = e.getValue();
- if (state == OWNING) {
- GridDhtLocalPartition locPart = locParts.get(p);
-
- assert locPart != null;
-
- if (cntrMap != null) {
- T2<Long, Long> cntr = cntrMap.get(p);
-
- if (cntr != null && cntr.get2() > locPart.updateCounter())
- locPart.updateCounter(cntr.get2());
- }
-
- if (locPart.state() != OWNING) {
- boolean success = locPart.own();
-
- assert success : locPart;
-
- changed |= success;
- }
- }
- else if (state == MOVING) {
+ if (state == MOVING) {
GridDhtLocalPartition locPart = locParts.get(p);
assert locPart != null;
@@ -1250,9 +1236,11 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
/** {@inheritDoc} */
@SuppressWarnings({"MismatchedQueryAndUpdateOfCollection"})
- @Nullable @Override public GridDhtPartitionMap2 update(@Nullable GridDhtPartitionExchangeId exchId,
+ @Nullable @Override public GridDhtPartitionMap2 update(
+ @Nullable GridDhtPartitionExchangeId exchId,
GridDhtPartitionMap2 parts,
- @Nullable Map<Integer, T2<Long, Long>> cntrMap) {
+ @Nullable Map<Integer, T2<Long, Long>> cntrMap
+ ) {
if (log.isDebugEnabled())
log.debug("Updating single partition map [exchId=" + exchId + ", parts=" + mapString(parts) + ']');