Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8FCB31098E for ; Tue, 8 Sep 2015 07:26:18 +0000 (UTC) Received: (qmail 50227 invoked by uid 500); 8 Sep 2015 07:26:15 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 50112 invoked by uid 500); 8 Sep 2015 07:26:15 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 49513 invoked by uid 99); 8 Sep 2015 07:26:15 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Sep 2015 07:26:15 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D4C5FDFE12; Tue, 8 Sep 2015 07:26:14 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.apache.org Date: Tue, 08 Sep 2015 07:26:21 -0000 Message-Id: <93f95d6653fd4abebb5f3b22cccebc00@git.apache.org> In-Reply-To: <957c5284c07f4612a5c9acfe98224acd@git.apache.org> References: <957c5284c07f4612a5c9acfe98224acd@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [08/39] ignite git commit: Handle GridDhtInvalidPartitionException in GridDhtLocalPartition.clearAll. 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-1093-2 Commit: 8a4b7541a050a29f3a3032554ffece1496c76145 Parents: bd8c607 Author: sboikov Authored: Fri Sep 4 12:15:09 2015 +0300 Committer: sboikov 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, 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, } /** + * @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. */