ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [16/18] ignite git commit: ignite-5068 : Handling of lost partitions.
Date Thu, 08 Jun 2017 13:13:50 GMT
ignite-5068 : Handling of lost partitions.


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

Branch: refs/heads/ignite-5267-merge-ea
Commit: 3cf4c7b0175eb3556957df8865d049b14065bd49
Parents: eb80b40
Author: Ilya Lantukh <ilantukh@gridgain.com>
Authored: Tue May 16 17:57:58 2017 +0300
Committer: Ilya Lantukh <ilantukh@gridgain.com>
Committed: Tue May 16 17:57:58 2017 +0300

----------------------------------------------------------------------
 .../dht/GridClientPartitionTopology.java        |  2 +-
 .../dht/GridDhtPartitionTopologyImpl.java       | 99 ++++++++------------
 2 files changed, 38 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3cf4c7b0/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 d55dda7..7092242 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
@@ -756,7 +756,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology
{
 
     /** {@inheritDoc} */
     @Override public void onExchangeDone(AffinityAssignment assignment) {
-        // TODO
+        // no-op
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/3cf4c7b0/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 e9c535f..58fb14c 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
@@ -1553,17 +1553,13 @@ import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDh
                     }
                     // Update map for remote node.
                     else if (plc != PartitionLossPolicy.IGNORE) {
-                        // TODO
-//                        Set<UUID> nodeIds = part2node.get(part);
-//
-//                        if (nodeIds != null) {
-//                            for (UUID nodeId : nodeIds) {
-//                                GridDhtPartitionMap nodeMap = node2part.get(nodeId);
-//
-//                                if (nodeMap.get(part) != EVICTED)
-//                                    nodeMap.put(part, LOST);
-//                            }
-//                        }
+                        for (Map.Entry<UUID, GridDhtPartitionMap> e : node2part.entrySet())
{
+                            if (e.getKey().equals(cctx.localNodeId()))
+                                continue;
+
+                            if (e.getValue().get(part) != EVICTED)
+                                e.getValue().put(part, LOST);
+                        }
                     }
 
                     if (cctx.events().isRecordable(EventType.EVT_CACHE_REBALANCE_PART_DATA_LOST))
@@ -1584,57 +1580,36 @@ import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDh
 
     /** {@inheritDoc} */
     @Override public void resetLostPartitions() {
-        // TODO
-
-//        lock.writeLock().lock();
-//
-//        try {
-//            int parts = cctx.affinity().partitions();
-//            long updSeq = updateSeq.incrementAndGet();
-//
-//            for (int part = 0; part < parts; part++) {
-//                Set<UUID> nodeIds = part2node.get(part);
-//
-//                if (nodeIds != null) {
-//                    boolean lost = false;
-//
-//                    for (UUID node : nodeIds) {
-//                        GridDhtPartitionMap map = node2part.get(node);
-//
-//                        if (map.get(part) == LOST) {
-//                            lost = true;
-//
-//                            break;
-//                        }
-//                    }
-//
-//                    if (lost) {
-//                        GridDhtLocalPartition locPart = localPartition(part, topVer, false);
-//
-//                        if (locPart != null) {
-//                            boolean marked = locPart.own();
-//
-//                            if (marked)
-//                                updateLocal(locPart.id(), locPart.state(), updSeq);
-//                        }
-//
-//                        for (UUID nodeId : nodeIds) {
-//                            GridDhtPartitionMap nodeMap = node2part.get(nodeId);
-//
-//                            if (nodeMap.get(part) == LOST)
-//                                nodeMap.put(part, OWNING);
-//                        }
-//                    }
-//                }
-//            }
-//
-//            checkEvictions(updSeq, cctx.affinity().assignments(topVer));
-//
-//            cctx.needsRecovery(false);
-//        }
-//        finally {
-//            lock.writeLock().unlock();
-//        }
+        lock.writeLock().lock();
+
+        try {
+            long updSeq = updateSeq.incrementAndGet();
+
+            for (Map.Entry<UUID, GridDhtPartitionMap> e : node2part.entrySet()) {
+                for (Map.Entry<Integer, GridDhtPartitionState> e0 : e.getValue().entrySet())
{
+                    if (e0.getValue() != LOST)
+                        continue;
+
+                    e0.setValue(OWNING);
+
+                    GridDhtLocalPartition locPart = localPartition(e0.getKey(), topVer, false);
+
+                    if (locPart != null && locPart.state() == LOST) {
+                        boolean marked = locPart.own();
+
+                        if (marked)
+                            updateLocal(locPart.id(), locPart.state(), updSeq);
+                    }
+                }
+            }
+
+            checkEvictions(updSeq, cctx.affinity().assignments(topVer));
+
+            cctx.needsRecovery(false);
+        }
+        finally {
+            lock.writeLock().unlock();
+        }
     }
 
     /** {@inheritDoc} */


Mime
View raw message