ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject ignite git commit: Handle GridDhtInvalidPartitionException in GridDhtLocalPartition.clearAll.
Date Fri, 04 Sep 2015 09:15:17 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-1.4 bd8c60740 -> 8a4b7541a


Handle GridDhtInvalidPartitionException in GridDhtLocalPartition.clearAll.


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

Branch: refs/heads/ignite-1.4
Commit: 8a4b7541a050a29f3a3032554ffece1496c76145
Parents: bd8c607
Author: sboikov <sboikov@gridgain.com>
Authored: Fri Sep 4 12:15:09 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Fri Sep 4 12:15:09 2015 +0300

----------------------------------------------------------------------
 .../distributed/dht/GridDhtLocalPartition.java  | 51 ++++++++++++++++++--
 1 file changed, 46 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/8a4b7541/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
index d0e2b5b..6d22dc7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
@@ -628,22 +628,41 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
 
         try {
             while (it.hasNext()) {
-                GridDhtCacheEntry cached = it.next();
+                GridDhtCacheEntry cached = null;
 
                 try {
+                    cached = it.next();
+
                     if (cached.clearInternal(clearVer, swap)) {
                         map.remove(cached.key(), cached);
 
                         if (!cached.isInternal()) {
                             mapPubSize.decrement();
 
-                            if (rec)
-                                cctx.events().addEvent(cached.partition(), cached.key(),
cctx.localNodeId(),
-                                    (IgniteUuid)null, null, EVT_CACHE_REBALANCE_OBJECT_UNLOADED,
null, false,
-                                    cached.rawGet(), cached.hasValue(), null, null, null);
+                            if (rec) {
+                                cctx.events().addEvent(cached.partition(),
+                                    cached.key(),
+                                    cctx.localNodeId(),
+                                    (IgniteUuid)null,
+                                    null,
+                                    EVT_CACHE_REBALANCE_OBJECT_UNLOADED,
+                                    null,
+                                    false,
+                                    cached.rawGet(),
+                                    cached.hasValue(),
+                                    null,
+                                    null,
+                                    null);
+                            }
                         }
                     }
                 }
+                catch (GridDhtInvalidPartitionException e) {
+                    assert map.isEmpty() && state() == EVICTED: "Invalid error [e="
+ e + ", part=" + this + ']';
+                    assert swapEmpty() : "Invalid error when swap is not cleared [e=" + e
+ ", part=" + this + ']';
+
+                    break; // Partition is already concurrently cleared and evicted.
+                }
                 catch (IgniteCheckedException e) {
                     U.error(log, "Failed to clear cache entry for evicted partition: " +
cached, e);
                 }
@@ -655,6 +674,28 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
     }
 
     /**
+     * @return {@code True} if there are no swap entries for this partition.
+     */
+    private boolean swapEmpty() {
+        GridCloseableIterator<?> it0 = null;
+
+        try {
+            it0 = cctx.swap().iterator(id);
+
+            return it0 == null || !it0.hasNext();
+        }
+        catch (IgniteCheckedException e) {
+            U.error(log, "Failed to get partition swap iterator: " + this, e);
+
+            return true;
+        }
+        finally {
+            if (it0 != null)
+                U.closeQuiet(it0);
+        }
+    }
+
+    /**
      * @param it Swap iterator.
      * @return Unswapping iterator over swapped entries.
      */


Mime
View raw message