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 0E39518240 for ; Wed, 8 Jul 2015 13:31:33 +0000 (UTC) Received: (qmail 19785 invoked by uid 500); 8 Jul 2015 13:31:33 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 19753 invoked by uid 500); 8 Jul 2015 13:31:32 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 19743 invoked by uid 99); 8 Jul 2015 13:31:32 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Jul 2015 13:31:32 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 7CD91181A31 for ; Wed, 8 Jul 2015 13:31:32 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.771 X-Spam-Level: * X-Spam-Status: No, score=1.771 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, T_RP_MATCHES_RCVD=-0.01, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id GalcUVLHfbAE for ; Wed, 8 Jul 2015 13:31:22 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with SMTP id D56304E1F9 for ; Wed, 8 Jul 2015 13:31:12 +0000 (UTC) Received: (qmail 18212 invoked by uid 99); 8 Jul 2015 13:31:12 -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; Wed, 08 Jul 2015 13:31:12 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 205D8E0F33; Wed, 8 Jul 2015 13:31:12 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.incubator.apache.org Date: Wed, 08 Jul 2015 13:31:37 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [27/50] incubator-ignite git commit: ignite-1070 Zombie entries in cache with SortedEvictionPolicy ignite-1070 Zombie entries in cache with SortedEvictionPolicy Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/9d0aa6f1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9d0aa6f1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9d0aa6f1 Branch: refs/heads/ignite-gg-10052 Commit: 9d0aa6f1244e13187b64dec81b8d33d94f3db2af Parents: 44506c3 Author: agura Authored: Tue Jul 7 14:49:13 2015 +0300 Committer: agura Committed: Tue Jul 7 14:49:13 2015 +0300 ---------------------------------------------------------------------- .../cache/eviction/fifo/FifoEvictionPolicy.java | 5 ----- .../cache/eviction/lru/LruEvictionPolicy.java | 5 ----- .../eviction/sorted/SortedEvictionPolicy.java | 19 +++++-------------- ...cheConcurrentEvictionConsistencySelfTest.java | 15 +++++++++++++-- 4 files changed, 18 insertions(+), 26 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9d0aa6f1/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicy.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicy.java index 221bc39..1e06ffd 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicy.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicy.java @@ -216,11 +216,6 @@ public class FifoEvictionPolicy implements EvictionPolicy, FifoEvict // If node was unlinked by concurrent shrink() call, we must repeat the whole cycle. else if (!entry.removeMeta(node)) return false; - else { - memSize.add(-entry.size()); - - return true; - } } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9d0aa6f1/modules/core/src/main/java/org/apache/ignite/cache/eviction/lru/LruEvictionPolicy.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/lru/LruEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/lru/LruEvictionPolicy.java index 0be26c8..ba6f88a 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/lru/LruEvictionPolicy.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/lru/LruEvictionPolicy.java @@ -200,11 +200,6 @@ public class LruEvictionPolicy implements EvictionPolicy, LruEvictio // If node was unlinked by concurrent shrink() call, we must repeat the whole cycle. else if (!entry.removeMeta(node)) return false; - else { - memSize.add(-entry.size()); - - return true; - } } } else if (queue.unlinkx(node)) { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9d0aa6f1/modules/core/src/main/java/org/apache/ignite/cache/eviction/sorted/SortedEvictionPolicy.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/sorted/SortedEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/sorted/SortedEvictionPolicy.java index b8b82fa..d99b3b0 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/sorted/SortedEvictionPolicy.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/sorted/SortedEvictionPolicy.java @@ -224,21 +224,17 @@ public class SortedEvictionPolicy implements EvictionPolicy, SortedE private boolean touch(EvictableEntry entry) { Holder holder = entry.meta(); - // Entry has not been add yet to backed queue.. + // Entry has not been added yet to backed queue. if (holder == null) { while (true) { holder = new Holder<>(entry, orderCnt.incrementAndGet()); - set.add(holder); + if (entry.putMetaIfAbsent(holder) != null) + return false; // Set has not been changed. - if (entry.putMetaIfAbsent(holder) != null) { - // Was concurrently added, need to remove it from queue. - removeHolder(holder); + set.add(holder); - // Set has not been changed. - return false; - } - else if (holder.order > 0) { + if (holder.order > 0) { if (!entry.isCached()) { // Was concurrently evicted, need to remove it from queue. removeHolder(holder); @@ -253,11 +249,6 @@ public class SortedEvictionPolicy implements EvictionPolicy, SortedE // If holder was removed by concurrent shrink() call, we must repeat the whole cycle. else if (!entry.removeMeta(holder)) return false; - else { - memSize.add(-entry.size()); - - return true; - } } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9d0aa6f1/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionConsistencySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionConsistencySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionConsistencySelfTest.java index 921422e..91e9ecc 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionConsistencySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionConsistencySelfTest.java @@ -24,6 +24,7 @@ import org.apache.ignite.cache.eviction.lru.*; import org.apache.ignite.cache.eviction.sorted.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; +import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.*; @@ -273,15 +274,25 @@ public class GridCacheConcurrentEvictionConsistencySelfTest extends GridCommonAb info("Test results [threadCnt=" + threadCnt + ", iterCnt=" + ITERATION_CNT + ", cacheSize=" + cache.size() + ", internalQueueSize" + queue.size() + ", duration=" + (System.currentTimeMillis() - start) + ']'); + boolean detached = false; + for (Cache.Entry e : queue) { Integer rmv = cache.getAndRemove(e.getKey()); - if (rmv == null) - fail("Eviction policy contains key that is not present in cache: " + e); + CacheEvictableEntryImpl unwrapped = e.unwrap(CacheEvictableEntryImpl.class); + + if (rmv == null && (unwrapped.meta() != null || unwrapped.isCached())) { + U.warn(log, "Detached entry: " + e); + + detached = true; + } else info("Entry removed: " + rmv); } + if (detached) + fail("Eviction policy contains keys that are not present in cache"); + if (!(cache.localSize() == 0)) { boolean zombies = false;