You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2017/04/10 15:55:26 UTC
[19/53] [abbrv] ignite git commit: ignite-4535 : Adjusted tests for
eviction.
ignite-4535 : Adjusted tests for eviction.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/51b0d007
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/51b0d007
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/51b0d007
Branch: refs/heads/ignite-3477-master
Commit: 51b0d0079bab80fc78115d0db40c8569f41894de
Parents: 65d816f
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Fri Mar 31 18:15:57 2017 +0300
Committer: Ilya Lantukh <il...@gridgain.com>
Committed: Fri Mar 31 18:15:57 2017 +0300
----------------------------------------------------------------------
.../cache/distributed/near/GridNearTxLocal.java | 1 -
.../GridCachePreloadingEvictionsSelfTest.java | 4 +-
.../GridCacheBatchEvictUnswapSelfTest.java | 199 ----------------
...heConcurrentEvictionConsistencySelfTest.java | 5 +-
.../GridCacheDistributedEvictionsSelfTest.java | 235 -------------------
.../GridCacheEvictionTouchSelfTest.java | 11 +-
...cheSynchronousEvictionsFailoverSelfTest.java | 166 -------------
.../IgniteCacheEvictionSelfTestSuite.java | 6 -
.../testsuites/IgniteCacheTestSuite3.java | 1 -
9 files changed, 10 insertions(+), 618 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/51b0d007/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
index 750a99d..c257154 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
@@ -1567,7 +1567,6 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter implements AutoClosea
{
if (log.isDebugEnabled())
log.debug("Acquired transaction lock for remove on keys: " + enlisted);
- U.debug(log, "Acquired transaction lock for remove on keys: " + enlisted);
postLockWrite(cacheCtx,
enlisted,
http://git-wip-us.apache.org/repos/asf/ignite/blob/51b0d007/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java
index c46f6bf..78a92cb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java
@@ -199,8 +199,8 @@ public class GridCachePreloadingEvictionsSelfTest extends GridCommonAbstractTest
assertTrue(GridTestUtils.waitForCondition(new PA() {
@Override public boolean apply() {
- int size1 = ignite1.cache(null).localSize(CachePeekMode.ALL);
- return size1 != oldSize && size1 == ignite2.cache(null).localSize(CachePeekMode.ALL);
+ int size1 = ignite1.cache(null).localSize(CachePeekMode.ONHEAP);
+ return size1 != oldSize && size1 == ignite2.cache(null).localSize(CachePeekMode.ONHEAP);
}
}, getTestTimeout()));
http://git-wip-us.apache.org/repos/asf/ignite/blob/51b0d007/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheBatchEvictUnswapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheBatchEvictUnswapSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheBatchEvictUnswapSelfTest.java
deleted file mode 100644
index 67700b6..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheBatchEvictUnswapSelfTest.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.eviction;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy;
-import org.apache.ignite.cache.store.CacheStore;
-import org.apache.ignite.cache.store.CacheStoreAdapter;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest;
-import org.apache.ignite.lang.IgniteBiInClosure;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Swap benchmark.
- */
-@SuppressWarnings("BusyWait")
-public class GridCacheBatchEvictUnswapSelfTest extends GridCacheAbstractSelfTest {
- /** Eviction policy size. */
- public static final int EVICT_PLC_SIZE = 100000;
-
- /** Keys count. */
- public static final int KEYS_CNT = 100000;
-
- /** Batch size. */
- private static final int BATCH_SIZE = 200;
-
- /** Number of threads for concurrent benchmark + concurrency level. */
- private static final int N_THREADS = 8;
-
- /** {@inheritDoc} */
- @Override protected int gridCount() {
- return 1;
- }
-
- /** {@inheritDoc} */
- @Override protected long getTestTimeout() {
- // Let this test run 2 minutes as it runs for 20 seconds locally.
- return 2 * 60 * 1000;
- }
-
- /** {@inheritDoc} */
- @SuppressWarnings("unchecked")
- @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
- CacheConfiguration cacheCfg = super.cacheConfiguration(igniteInstanceName);
-
- cacheCfg.setCacheMode(CacheMode.PARTITIONED);
-
- CacheStore store = new CacheStoreAdapter<Long, String>() {
- @Nullable @Override public String load(Long key) {
- return null;
- }
-
- @Override public void loadCache(final IgniteBiInClosure<Long, String> c,
- @Nullable Object... args) {
- for (int i = 0; i < KEYS_CNT; i++)
- c.apply((long)i, String.valueOf(i));
- }
-
- @Override public void write(javax.cache.Cache.Entry<? extends Long, ? extends String> val) {
- // No-op.
- }
-
- @Override public void delete(Object key) {
- // No-op.
- }
- };
-
- cacheCfg.setCacheStoreFactory(singletonFactory(store));
- cacheCfg.setReadThrough(true);
- cacheCfg.setWriteThrough(true);
- cacheCfg.setLoadPreviousValue(true);
-
- FifoEvictionPolicy plc = new FifoEvictionPolicy();
- plc.setMaxSize(EVICT_PLC_SIZE);
-
- cacheCfg.setEvictionPolicy(plc);
- cacheCfg.setEvictSynchronized(false);
- cacheCfg.setNearConfiguration(null);
-
- return cacheCfg;
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testConcurrentEvictions() throws Exception {
- runConcurrentTest(grid(0), KEYS_CNT, BATCH_SIZE);
- }
-
- /**
- * @param g Grid instance.
- * @param keysCnt Number of keys to swap and promote.
- * @param batchSize Size of batch to swap/promote.
- * @throws Exception If failed.
- */
- private void runConcurrentTest(Ignite g, final int keysCnt, final int batchSize) throws Exception {
- assert keysCnt % batchSize == 0;
-
- final AtomicInteger evictedKeysCnt = new AtomicInteger();
-
- final IgniteCache<Object, Object> cache = g.cache(null);
-
- cache.loadCache(null, 0);
-
- info("Finished load cache.");
-
- IgniteInternalFuture<?> evictFut = multithreadedAsync(new Runnable() {
- @Override public void run() {
- Collection<Long> keys = new ArrayList<>(batchSize);
-
- int evictedBatches = 0;
-
- for (long i = 0; i < keysCnt; i++) {
- keys.add(i);
-
- if (keys.size() == batchSize) {
- for (Long key : keys)
- cache.localEvict(Collections.<Object>singleton(key));
-
- evictedKeysCnt.addAndGet(batchSize);
-
- keys.clear();
-
- evictedBatches++;
-
- if (evictedBatches % 100 == 0 && evictedBatches > 0)
- info("Evicted " + (evictedBatches * batchSize) + " entries.");
- }
- }
- }
- }, N_THREADS, "evict");
-
- final AtomicInteger unswappedKeys = new AtomicInteger();
-
- IgniteInternalFuture<?> unswapFut = multithreadedAsync(new Runnable() {
- @Override public void run() {
- try {
- Collection<Long> keys = new ArrayList<>(batchSize);
-
- int unswappedBatches = 0;
-
- for (long i = 0; i < keysCnt; i++) {
- keys.add(i);
-
- if (keys.size() == batchSize) {
- for (Long key : keys)
- cache.localPromote(Collections.singleton(key));
-
- unswappedKeys.addAndGet(batchSize);
-
- keys.clear();
-
- unswappedBatches++;
-
- if (unswappedBatches % 100 == 0 && unswappedBatches > 0)
- info("Unswapped " + (unswappedBatches * batchSize) + " entries.");
- }
- }
- }
- catch (IgniteException e) {
- e.printStackTrace();
- }
- }
- }, N_THREADS, "promote");
-
- evictFut.get();
-
- unswapFut.get();
-
- info("Clearing cache.");
-
- for (long i = 0; i < KEYS_CNT; i++)
- cache.remove(i);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/51b0d007/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 f7ef897..0e91e30 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 java.util.concurrent.Callable;
import javax.cache.Cache;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.cache.eviction.EvictableEntry;
import org.apache.ignite.cache.eviction.EvictionPolicy;
import org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy;
@@ -295,10 +296,10 @@ public class GridCacheConcurrentEvictionConsistencySelfTest extends GridCommonAb
if (detached)
fail("Eviction policy contains keys that are not present in cache");
- if (!(cache.localSize() == 0)) {
+ if (!(cache.localSize(CachePeekMode.ONHEAP) == 0)) {
boolean zombies = false;
- for (Cache.Entry<Integer, Integer> e : cache) {
+ for (Cache.Entry<Integer, Integer> e : cache.localEntries(CachePeekMode.ONHEAP)) {
U.warn(log, "Zombie entry: " + e);
zombies = true;
http://git-wip-us.apache.org/repos/asf/ignite/blob/51b0d007/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheDistributedEvictionsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheDistributedEvictionsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheDistributedEvictionsSelfTest.java
deleted file mode 100644
index 7621897..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheDistributedEvictionsSelfTest.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.eviction;
-
-import java.util.TreeSet;
-import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.configuration.TransactionConfiguration;
-import org.apache.ignite.internal.processors.cache.distributed.GridCacheModuloAffinityFunction;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
-import static org.apache.ignite.cache.CacheMode.LOCAL;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
-import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED;
-
-/**
- *
- */
-public class GridCacheDistributedEvictionsSelfTest extends GridCommonAbstractTest {
- /** IP finder. */
- private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
-
- /** */
- private int gridCnt = 2;
-
- /** */
- private CacheMode mode;
-
- /** */
- private boolean nearEnabled;
-
- /** */
- private boolean evictSync;
-
- /** */
- private final AtomicInteger idxGen = new AtomicInteger();
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
- IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
-
- TransactionConfiguration tCfg = new TransactionConfiguration();
-
- tCfg.setDefaultTxConcurrency(PESSIMISTIC);
- tCfg.setDefaultTxIsolation(READ_COMMITTED);
-
- c.setTransactionConfiguration(tCfg);
-
- CacheConfiguration cc = defaultCacheConfiguration();
-
- cc.setCacheMode(mode);
- cc.setAtomicityMode(TRANSACTIONAL);
-
- if (nearEnabled) {
- NearCacheConfiguration nearCfg = new NearCacheConfiguration();
-
- cc.setNearConfiguration(nearCfg);
- }
-
- cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
-
- // Set only DHT policy, leave default near policy.
- FifoEvictionPolicy plc = new FifoEvictionPolicy();
- plc.setMaxSize(10);
-
- cc.setEvictionPolicy(plc);
- cc.setEvictSynchronized(evictSync);
- cc.setEvictSynchronizedKeyBufferSize(1);
-
- cc.setAffinity(new GridCacheModuloAffinityFunction(gridCnt, 1));
-
- c.setCacheConfiguration(cc);
-
- TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
- disco.setIpFinder(ipFinder);
-
- c.setDiscoverySpi(disco);
-
- c.setUserAttributes(F.asMap(GridCacheModuloAffinityFunction.IDX_ATTR, idxGen.getAndIncrement()));
-
- return c;
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- stopAllGrids();
-
- super.afterTest();
- }
-
- /** @throws Throwable If failed. */
- public void testNearSyncBackupSync() throws Throwable {
- gridCnt = 3;
- mode = PARTITIONED;
- evictSync = true;
- nearEnabled = true;
-
- checkEvictions();
- }
-
- /**
- * @throws Throwable If failed.
- */
- public void testLocalSync() throws Throwable {
- gridCnt = 1;
- mode = LOCAL;
- evictSync = true;
- nearEnabled = true;
-
- Ignite g = startGrid(0);
-
- final IgniteCache<Integer, Integer> cache = g.cache(null);
-
- for (int i = 1; i < 20; i++) {
- cache.put(i * gridCnt, i * gridCnt);
-
- info("Put to cache: " + i * gridCnt);
- }
- }
-
- /** @throws Throwable If failed. */
- private void checkEvictions() throws Throwable {
- try {
- startGrids(gridCnt);
-
- Ignite ignite = grid(0);
-
- final IgniteCache<Integer, Integer> cache = ignite.cache(null);
-
- // Put 1 entry to primary node.
- cache.put(0, 0);
-
- Integer nearVal = this.<Integer, Integer>jcache(2).get(0);
-
- assert nearVal == 0 : "Unexpected near value: " + nearVal;
-
- // Put several vals to primary node.
- for (int i = 1; i < 20; i++) {
- cache.put(i * gridCnt, i * gridCnt);
-
- info("Put to cache: " + i * gridCnt);
- }
-
- for (int i = 0; i < 3; i++) {
- try {
- assert jcache(2).get(0) == null : "Entry has not been evicted from near node for key: " + 0;
- assert jcache(1).get(0) == null : "Entry has not been evicted from backup node for key: " + 0;
- assert cache.get(0) == null : "Entry has not been evicted from primary node for key: " + 0;
- }
- catch (Throwable e) {
- if (i == 2)
- // No attempts left.
- throw e;
-
- U.warn(log, "Check failed (will retry in 2000 ms): " + e);
-
- // Unwind evicts?
- cache.get(0);
-
- U.sleep(2000);
- }
- }
-
- for (int i = 0; i < 3; i++) {
- info("Primary key set: " + new TreeSet<>(this.<Integer, Integer>dht(0).keySet()));
- info("Primary near key set: " + new TreeSet<>(this.<Integer, Integer>near(0).keySet()));
-
- info("Backup key set: " + new TreeSet<>(this.<Integer, Integer>dht(1).keySet()));
- info("Backup near key set: " + new TreeSet<>(this.<Integer, Integer>near(1).keySet()));
-
- info("Near key set: " + new TreeSet<>(this.<Integer, Integer>dht(2).keySet()));
- info("Near node near key set: " + new TreeSet<>(this.<Integer, Integer>near(2).keySet()));
-
- try {
- assert cache.localSize() == 10 : "Invalid cache size [size=" + cache.localSize() + ']';
- assert cache.localSize() == 10 : "Invalid key size [size=" + cache.localSize() + ']';
-
- assert jcache(2).localSize() == 0;
-
- break;
- }
- catch (Throwable e) {
- if (i == 2)
- // No attempts left.
- throw e;
-
- U.warn(log, "Check failed (will retry in 2000 ms): " + e);
-
- // Unwind evicts?
- cache.get(0);
-
- U.sleep(2000);
- }
- }
- }
- catch (Throwable t) {
- error("Test failed.", t);
-
- throw t;
- }
- finally {
- stopAllGrids();
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/51b0d007/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionTouchSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionTouchSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionTouchSelfTest.java
index d8746c8..34bb2a8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionTouchSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionTouchSelfTest.java
@@ -28,6 +28,7 @@ import java.util.TreeSet;
import javax.cache.Cache;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.cache.eviction.EvictionPolicy;
import org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy;
import org.apache.ignite.cache.store.CacheStore;
@@ -191,7 +192,7 @@ public class GridCacheEvictionTouchSelfTest extends GridCommonAbstractTest {
cache.localEvict(Collections.singleton(i));
assertEquals(0, ((FifoEvictionPolicy)plc).queue().size());
- assertEquals(0, cache.size());
+ assertEquals(0, cache.size(CachePeekMode.ONHEAP));
}
finally {
stopAllGrids();
@@ -226,7 +227,7 @@ public class GridCacheEvictionTouchSelfTest extends GridCommonAbstractTest {
cache.localEvict(Collections.singleton(key));
assertEquals(0, ((FifoEvictionPolicy)plc).queue().size());
- assertEquals(0, cache.size());
+ assertEquals(0, cache.size(CachePeekMode.ONHEAP));
}
finally {
stopAllGrids();
@@ -250,8 +251,7 @@ public class GridCacheEvictionTouchSelfTest extends GridCommonAbstractTest {
for (int i = 0; i < 10000; i++)
load(cache, i, true);
- assertEquals(100, cache.size());
- assertEquals(100, cache.size());
+ assertEquals(100, cache.size(CachePeekMode.ONHEAP));
assertEquals(100, ((FifoEvictionPolicy)plc).queue().size());
Set<Integer> keys = new TreeSet<>();
@@ -261,8 +261,7 @@ public class GridCacheEvictionTouchSelfTest extends GridCommonAbstractTest {
loadAll(cache, keys, true);
- assertEquals(100, cache.size());
- assertEquals(100, cache.size());
+ assertEquals(100, cache.size(CachePeekMode.ONHEAP));
assertEquals(100, ((FifoEvictionPolicy)plc).queue().size());
}
finally {
http://git-wip-us.apache.org/repos/asf/ignite/blob/51b0d007/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheSynchronousEvictionsFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheSynchronousEvictionsFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheSynchronousEvictionsFailoverSelfTest.java
deleted file mode 100644
index 377afa0..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheSynchronousEvictionsFailoverSelfTest.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.eviction;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Random;
-import java.util.concurrent.Callable;
-import java.util.concurrent.atomic.AtomicBoolean;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.cache.affinity.Affinity;
-import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.testframework.GridTestUtils;
-
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-
-/**
- *
- */
-public class GridCacheSynchronousEvictionsFailoverSelfTest extends GridCacheAbstractSelfTest {
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-804");
- }
-
- /** {@inheritDoc} */
- @Override protected int gridCount() {
- return 3;
- }
-
- /** {@inheritDoc} */
- @Override protected CacheMode cacheMode() {
- return PARTITIONED;
- }
-
- /** {@inheritDoc} */
- @Override protected NearCacheConfiguration nearConfiguration() {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
- CacheConfiguration ccfg = super.cacheConfiguration(igniteInstanceName);
-
- ccfg.setEvictSynchronized(true);
- ccfg.setEvictSynchronizedKeyBufferSize(10);
-
- ccfg.setBackups(2);
-
- ccfg.setAffinity(new RendezvousAffinityFunction(false, 500));
-
- return ccfg;
- }
-
- /** {@inheritDoc} */
- @Override protected long getTestTimeout() {
- return 60_000;
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testSynchronousEvictions() throws Exception {
- IgniteCache<String, Integer> cache = jcache(0);
-
- final AtomicBoolean stop = new AtomicBoolean();
-
- IgniteInternalFuture<?> fut = null;
-
- try {
- Map<String, Integer> data = new HashMap<>();
-
- addKeysForNode(affinity(cache), grid(0).localNode(), data);
- addKeysForNode(affinity(cache), grid(1).localNode(), data);
- addKeysForNode(affinity(cache), grid(2).localNode(), data);
-
- fut = GridTestUtils.runAsync(new Callable<Void>() {
- @Override public Void call() throws Exception {
- Random rnd = new Random();
-
- while (!stop.get()) {
- int idx = rnd.nextBoolean() ? 1 : 2;
-
- log.info("Stopping grid: " + idx);
-
- stopGrid(idx);
-
- U.sleep(100);
-
- log.info("Starting grid: " + idx);
-
- startGrid(idx);
- }
-
- return null;
- }
- });
-
- for (int i = 0 ; i < 100; i++) {
- log.info("Iteration: " + i);
-
- try {
- cache.putAll(data);
- }
- catch (IgniteException ignore) {
- continue;
- }
-
- cache.localEvict(data.keySet());
- }
- }
- finally {
- stop.set(true);
-
- if (fut != null)
- fut.get();
- }
- }
-
- /**
- * @param aff Cache affinity.
- * @param node Primary node for keys.
- * @param data Map where keys/values should be put to.
- */
- private void addKeysForNode(Affinity<String> aff, ClusterNode node, Map<String, Integer> data) {
- int cntr = 0;
-
- for (int i = 0; i < 100_000; i++) {
- String key = String.valueOf(i);
-
- if (aff.isPrimary(node, key)) {
- data.put(key, i);
-
- cntr++;
-
- if (cntr == 500)
- break;
- }
- }
-
- assertEquals(500, cntr);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/51b0d007/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheEvictionSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheEvictionSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheEvictionSelfTestSuite.java
index 503fa7e..94e1447 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheEvictionSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheEvictionSelfTestSuite.java
@@ -21,17 +21,14 @@ import junit.framework.TestSuite;
import org.apache.ignite.internal.processors.cache.GridCachePreloadingEvictionsSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicNearEvictionSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearEvictionSelfTest;
-import org.apache.ignite.internal.processors.cache.eviction.GridCacheBatchEvictUnswapSelfTest;
import org.apache.ignite.internal.processors.cache.eviction.GridCacheConcurrentEvictionConsistencySelfTest;
import org.apache.ignite.internal.processors.cache.eviction.GridCacheConcurrentEvictionsSelfTest;
-import org.apache.ignite.internal.processors.cache.eviction.GridCacheDistributedEvictionsSelfTest;
import org.apache.ignite.internal.processors.cache.eviction.GridCacheEmptyEntriesLocalSelfTest;
import org.apache.ignite.internal.processors.cache.eviction.GridCacheEmptyEntriesPartitionedSelfTest;
import org.apache.ignite.internal.processors.cache.eviction.GridCacheEvictableEntryEqualsSelfTest;
import org.apache.ignite.internal.processors.cache.eviction.GridCacheEvictionFilterSelfTest;
import org.apache.ignite.internal.processors.cache.eviction.GridCacheEvictionLockUnlockSelfTest;
import org.apache.ignite.internal.processors.cache.eviction.GridCacheEvictionTouchSelfTest;
-import org.apache.ignite.internal.processors.cache.eviction.GridCacheSynchronousEvictionsFailoverSelfTest;
import org.apache.ignite.internal.processors.cache.eviction.fifo.FifoEvictionPolicySelfTest;
import org.apache.ignite.internal.processors.cache.eviction.lru.LruEvictionPolicySelfTest;
import org.apache.ignite.internal.processors.cache.eviction.lru.LruNearEvictionPolicySelfTest;
@@ -60,13 +57,10 @@ public class IgniteCacheEvictionSelfTestSuite extends TestSuite {
suite.addTest(new TestSuite(GridCacheConcurrentEvictionsSelfTest.class));
suite.addTest(new TestSuite(GridCacheConcurrentEvictionConsistencySelfTest.class));
suite.addTest(new TestSuite(GridCacheEvictionTouchSelfTest.class));
- suite.addTest(new TestSuite(GridCacheDistributedEvictionsSelfTest.class));
suite.addTest(new TestSuite(GridCacheEvictionLockUnlockSelfTest.class));
- suite.addTest(new TestSuite(GridCacheBatchEvictUnswapSelfTest.class));
suite.addTest(new TestSuite(GridCachePreloadingEvictionsSelfTest.class));
suite.addTest(new TestSuite(GridCacheEmptyEntriesPartitionedSelfTest.class));
suite.addTest(new TestSuite(GridCacheEmptyEntriesLocalSelfTest.class));
- suite.addTest(new TestSuite(GridCacheSynchronousEvictionsFailoverSelfTest.class));
suite.addTest(new TestSuite(GridCacheEvictableEntryEqualsSelfTest.class));
return suite;
http://git-wip-us.apache.org/repos/asf/ignite/blob/51b0d007/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
index d2b7da6..1c2f98b 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
@@ -189,7 +189,6 @@ public class IgniteCacheTestSuite3 extends TestSuite {
suite.addTest(IgniteTopologyValidatorTestSuit.suite());
// Eviction.
- // TODO GG-11140.
suite.addTest(IgniteCacheEvictionSelfTestSuite.suite());
// Iterators.