Repository: ignite
Updated Branches:
  refs/heads/master b8a421ee3 -> eca5c5a41


IGNITE-8912 Fixed case when PartitionLossPolicy.READ_ONLY_SAFE does not detect 
partition loss - Fixes #4331.

Signed-off-by: Alexey Goncharuk <[email protected]>


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

Branch: refs/heads/master
Commit: eca5c5a410e324e7f2bddf780fab540446fabdc8
Parents: b8a421e
Author: pvinokurov <[email protected]>
Authored: Fri Jul 13 19:57:35 2018 +0300
Committer: Alexey Goncharuk <[email protected]>
Committed: Fri Jul 13 19:57:35 2018 +0300

----------------------------------------------------------------------
 .../dht/GridDhtPartitionTopologyImpl.java       | 32 +++-----------------
 .../IgniteCachePartitionLossPolicySelfTest.java | 13 +++++++-
 2 files changed, 17 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/eca5c5a4/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 89cd4c5..d9d8868 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
@@ -725,35 +725,13 @@ public class GridDhtPartitionTopologyImpl implements 
GridDhtPartitionTopology {
                             if (grp.rebalanceEnabled()) {
                                 Collection<ClusterNode> owners = owners(p);
 
-                                // If there are no other owners, then become 
an owner.
-                                if (F.isEmpty(owners)) {
-                                    boolean owned = locPart.own();
+                                // If an owner node left during exchange, then 
new exchange should be started with detecting lost partitions.
 
-                                    assert owned : "Failed to own partition 
[grp=" + grp.cacheOrGroupName() +
-                                        ", locPart=" + locPart + ']';
-
-                                    updateSeq = updateLocal(p, 
locPart.state(), updateSeq, topVer);
-
-                                    changed = true;
-
-                                    if 
(grp.eventRecordable(EVT_CACHE_REBALANCE_PART_DATA_LOST)) {
-                                        DiscoveryEvent discoEvt = 
exchFut.events().lastEvent();
-
-                                        grp.addRebalanceEvent(p,
-                                            EVT_CACHE_REBALANCE_PART_DATA_LOST,
-                                            discoEvt.eventNode(),
-                                            discoEvt.type(),
-                                            discoEvt.timestamp());
-                                    }
-
-                                    if (log.isDebugEnabled()) {
-                                        log.debug("Owned partition [grp=" + 
grp.cacheOrGroupName() +
-                                            ", part=" + locPart + ']');
-                                    }
+                                if (!F.isEmpty(owners)) {
+                                    if (log.isDebugEnabled())
+                                        log.debug("Will not own partition 
(there are owners to rebalance from) [grp=" + grp.cacheOrGroupName() +
+                                            ", locPart=" + locPart + ", owners 
= " + owners + ']');
                                 }
-                                else if (log.isDebugEnabled())
-                                    log.debug("Will not own partition (there 
are owners to rebalance from) [grp=" + grp.cacheOrGroupName() +
-                                        ", locPart=" + locPart + ", owners = " 
+ owners + ']');
                             }
                             else
                                 updateSeq = updateLocal(p, locPart.state(), 
updateSeq, topVer);

http://git-wip-us.apache.org/repos/asf/ignite/blob/eca5c5a4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePartitionLossPolicySelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePartitionLossPolicySelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePartitionLossPolicySelfTest.java
index f4660fa..7cefc67 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePartitionLossPolicySelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePartitionLossPolicySelfTest.java
@@ -92,7 +92,7 @@ public class IgniteCachePartitionLossPolicySelfTest extends 
GridCommonAbstractTe
             }
 
             @Override protected int delayMillis() {
-                return 500;
+                return 250;
             }
         });
 
@@ -173,6 +173,17 @@ public class IgniteCachePartitionLossPolicySelfTest 
extends GridCommonAbstractTe
     /**
      * @throws Exception if failed.
      */
+    public void testReadWriteSafeWithBackupsAfterKillThreeNodes() throws 
Exception {
+        partLossPlc = PartitionLossPolicy.READ_WRITE_SAFE;
+
+        backups = 1;
+
+        checkLostPartition(true, true, new TopologyChanger(true, 
Arrays.asList(3, 2, 1), Arrays.asList(0, 4)));
+    }
+
+    /**
+     * @throws Exception if failed.
+     */
     public void testReadWriteSafeAfterKillCrd() throws Exception {
         partLossPlc = PartitionLossPolicy.READ_WRITE_SAFE;
 

Reply via email to