CacheKeepBinaryIterationSwapEnabledTest fix.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7aa609aa Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7aa609aa Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7aa609aa Branch: refs/heads/ignite-3414 Commit: 7aa609aa54f0015649776105bf32b2a213fa031d Parents: 005ce0f Author: Anton Vinogradov <[email protected]> Authored: Mon Jul 11 15:30:53 2016 +0300 Committer: Anton Vinogradov <[email protected]> Committed: Mon Jul 11 15:30:53 2016 +0300 ---------------------------------------------------------------------- .../cache/CacheEvictableEntryImpl.java | 11 ++++-- .../CacheKeepBinaryIterationTest.java | 36 ++++++++++---------- 2 files changed, 27 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/7aa609aa/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEvictableEntryImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEvictableEntryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEvictableEntryImpl.java index 9f4d9d7..aef71ed 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEvictableEntryImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEvictableEntryImpl.java @@ -64,9 +64,16 @@ public class CacheEvictableEntryImpl<K, V> implements EvictableEntry<K, V> { try { assert ctx != null; - assert ctx.evicts() != null; - return ctx.evicts().evict(cached, null, false, null); + GridCacheEvictionManager mgr = ctx.evicts(); + + if (mgr == null) { + assert ctx.kernalContext().isStopping(); + + return false; + } + + return mgr.evict(cached, null, false, null); } catch (IgniteCheckedException e) { U.error(ctx.grid().log(), "Failed to evict entry from cache: " + cached, e); http://git-wip-us.apache.org/repos/asf/ignite/blob/7aa609aa/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationTest.java index a775d21..605181f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationTest.java @@ -29,11 +29,9 @@ import org.apache.ignite.cache.query.QueryCursor; import org.apache.ignite.cache.query.ScanQuery; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.IgniteInterruptedCheckedException; import org.apache.ignite.internal.binary.BinaryMarshaller; import org.apache.ignite.internal.util.tostring.GridToStringInclude; import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi; import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; @@ -221,11 +219,11 @@ public class CacheKeepBinaryIterationTest extends GridCommonAbstractTest { /** * @param ccfg Cache configuration. */ - private void doTestScanQuery(CacheConfiguration<Object, Object> ccfg, boolean keepBinary, - boolean primitives) throws IgniteInterruptedCheckedException { + private void doTestScanQuery(final CacheConfiguration<Object, Object> ccfg, boolean keepBinary, + boolean primitives) throws Exception { IgniteCache<Object, Object> cache = grid(0).createCache(ccfg); - assertTrue(cache.size() == 0); + assertEquals(0, cache.size()); try { for (int i = 0; i < KEYS; i++) @@ -272,24 +270,25 @@ public class CacheKeepBinaryIterationTest extends GridCommonAbstractTest { } } finally { - cache.removeAll(); + if (ccfg.getEvictionPolicy() != null) { // TODO: IGNITE-3462. Fixes evictionPolicy issues at cache destroy. + stopAllGrids(); - if (ccfg.getEvictionPolicy() != null) - U.sleep(1000); // Fixes evictionPolicy issues at cache destroy. - - grid(0).destroyCache(ccfg.getName()); + startGridsMultiThreaded(getServerNodeCount()); + } + else + grid(0).destroyCache(ccfg.getName()); } } /** * @param ccfg Cache configuration. */ - private void doTestLocalEntries(CacheConfiguration<Object, Object> ccfg, + private void doTestLocalEntries(final CacheConfiguration<Object, Object> ccfg, boolean keepBinary, - boolean primitives) throws IgniteInterruptedCheckedException { + boolean primitives) throws Exception { IgniteCache<Object, Object> cache = grid(0).createCache(ccfg); - assertTrue(cache.size() == 0); + assertEquals(0, cache.size()); try { for (int i = 0; i < KEYS; i++) @@ -341,12 +340,13 @@ public class CacheKeepBinaryIterationTest extends GridCommonAbstractTest { } } finally { - cache.removeAll(); + if (ccfg.getEvictionPolicy() != null) { // TODO: IGNITE-3462. Fixes evictionPolicy issues at cache destroy. + stopAllGrids(); - if (ccfg.getEvictionPolicy() != null) - U.sleep(1000); // Fixes evictionPolicy issues at cache destroy. - - grid(0).destroyCache(ccfg.getName()); + startGridsMultiThreaded(getServerNodeCount()); + } + else + grid(0).destroyCache(ccfg.getName()); } }
