IGNITE-4952 - Delete swap-related functionality - Fixes #1794. Signed-off-by: Alexey Goncharuk <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0da8c70a Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0da8c70a Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0da8c70a Branch: refs/heads/ignite-5024 Commit: 0da8c70ad77a57328d2ece26bfa4d9c09eef70f3 Parents: 1f382af Author: Pavel Tupitsyn <[email protected]> Authored: Fri Apr 21 11:57:13 2017 +0300 Committer: Alexey Goncharuk <[email protected]> Committed: Fri Apr 21 11:57:13 2017 +0300 ---------------------------------------------------------------------- .../java/org/apache/ignite/IgniteCache.java | 11 - .../org/apache/ignite/events/CacheEvent.java | 3 - .../java/org/apache/ignite/events/Event.java | 1 - .../org/apache/ignite/events/EventType.java | 109 ----- .../apache/ignite/events/SwapSpaceEvent.java | 105 ---- .../managers/indexing/GridIndexingManager.java | 44 -- .../processors/cache/CacheMetricsImpl.java | 21 - .../processors/cache/GridCacheContext.java | 23 - .../GridCacheEntryInfoCollectSwapListener.java | 70 --- .../processors/cache/GridCacheSwapListener.java | 33 -- .../processors/cache/IgniteCacheProxy.java | 6 - .../cache/query/GridCacheQueryManager.java | 59 --- .../platform/PlatformContextImpl.java | 11 - .../platform/cache/PlatformCache.java | 9 - .../processors/query/GridQueryIndexing.java | 19 - .../processors/query/GridQueryProcessor.java | 55 --- .../apache/ignite/spi/indexing/IndexingSpi.java | 19 - .../spi/indexing/noop/NoopIndexingSpi.java | 10 - .../resources/META-INF/classnames.properties | 1 - .../cache/GridCacheAbstractFullApiSelfTest.java | 45 -- .../IgniteCacheConfigVariationsFullApiTest.java | 45 -- .../IgniteCacheStoreValueAbstractTest.java | 4 - .../IgniteTxExceptionAbstractSelfTest.java | 10 - ...tractDistributedByteArrayValuesSelfTest.java | 43 -- ...tomicClientOnlyMultiNodeFullApiSelfTest.java | 51 +- ...achePartitionedMultiNodeFullApiSelfTest.java | 59 --- ...idCacheReplicatedUnswapAdvancedSelfTest.java | 151 ------ .../cache/query/IndexingSpiQuerySelfTest.java | 22 - .../cache/query/IndexingSpiQueryTxSelfTest.java | 10 - .../loadtests/cache/GridCacheSwapLoadTest.java | 320 ------------- .../multijvm/IgniteCacheProcessProxy.java | 5 - .../testsuites/IgniteCacheTestSuite3.java | 2 - .../processors/query/h2/IgniteH2Indexing.java | 67 --- .../query/h2/opt/GridH2AbstractKeyValueRow.java | 89 +--- .../query/h2/opt/GridH2KeyValueRowOffheap.java | 70 --- .../query/h2/opt/GridH2RowDescriptor.java | 11 - .../processors/query/h2/opt/GridH2Table.java | 87 +--- ...ryDuplicateIndexObjectsAbstractSelfTest.java | 159 ------- .../cache/GridCacheOffHeapSelfTest.java | 476 ------------------- .../IgniteCacheQueryMultiThreadedSelfTest.java | 25 - ...ateIndexObjectPartitionedAtomicSelfTest.java | 38 -- ...xObjectPartitionedTransactionalSelfTest.java | 41 -- .../query/IgniteQueryDedicatedPoolTest.java | 10 - .../IgniteBinaryCacheQueryTestSuite.java | 5 - .../stream/kafka/connect/IgniteSourceTask.java | 4 - .../Cache/CacheAbstractTest.cs | 58 --- .../Cache/CacheTestAsyncWrapper.cs | 6 - .../dotnet/Apache.Ignite.Core/Cache/ICache.cs | 6 - .../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs | 8 - .../Apache.Ignite.Core/Impl/Cache/CacheOp.cs | 1 - 50 files changed, 3 insertions(+), 2534 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java index 97bb6b0..9c8c090 100644 --- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java +++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java @@ -429,17 +429,6 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS public V localPeek(K key, CachePeekMode... peekModes); /** - * This method unswaps cache entries by given keys, if any, from swap storage - * into memory. - * <h2 class="header">Transactions</h2> - * This method is not transactional. - * - * @param keys Keys to promote entries for. - * @throws CacheException If promote failed. - */ - public void localPromote(Set<? extends K> keys) throws CacheException; - - /** * Gets the number of all entries cached across all nodes. By default, if {@code peekModes} value isn't defined, * only size of primary copies across all nodes will be returned. This behavior is identical to calling * this method with {@link CachePeekMode#PRIMARY} peek mode. http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/main/java/org/apache/ignite/events/CacheEvent.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/events/CacheEvent.java b/modules/core/src/main/java/org/apache/ignite/events/CacheEvent.java index 30f4b37..5aa9d06 100644 --- a/modules/core/src/main/java/org/apache/ignite/events/CacheEvent.java +++ b/modules/core/src/main/java/org/apache/ignite/events/CacheEvent.java @@ -69,14 +69,11 @@ import org.jetbrains.annotations.Nullable; * @see EventType#EVT_CACHE_ENTRY_DESTROYED * @see EventType#EVT_CACHE_ENTRY_EVICTED * @see EventType#EVT_CACHE_OBJECT_EXPIRED - * @see EventType#EVT_CACHE_OBJECT_FROM_OFFHEAP * @see EventType#EVT_CACHE_OBJECT_LOCKED * @see EventType#EVT_CACHE_OBJECT_PUT * @see EventType#EVT_CACHE_OBJECT_READ * @see EventType#EVT_CACHE_OBJECT_REMOVED - * @see EventType#EVT_CACHE_OBJECT_SWAPPED * @see EventType#EVT_CACHE_OBJECT_UNLOCKED - * @see EventType#EVT_CACHE_OBJECT_UNSWAPPED * @see EventType#EVTS_CACHE */ public class CacheEvent extends EventAdapter { http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/main/java/org/apache/ignite/events/Event.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/events/Event.java b/modules/core/src/main/java/org/apache/ignite/events/Event.java index 9ba24ab..e4a02cc 100644 --- a/modules/core/src/main/java/org/apache/ignite/events/Event.java +++ b/modules/core/src/main/java/org/apache/ignite/events/Event.java @@ -75,7 +75,6 @@ import org.jetbrains.annotations.Nullable; * @see JobEvent * @see CacheEvent * @see CacheRebalancingEvent - * @see SwapSpaceEvent * @see CheckpointEvent * @see DeploymentEvent * @see DiscoveryEvent http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/main/java/org/apache/ignite/events/EventType.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/events/EventType.java b/modules/core/src/main/java/org/apache/ignite/events/EventType.java index 103dbd4..e506371 100644 --- a/modules/core/src/main/java/org/apache/ignite/events/EventType.java +++ b/modules/core/src/main/java/org/apache/ignite/events/EventType.java @@ -43,7 +43,6 @@ import org.apache.ignite.lang.IgnitePredicate; * <li>{@link #EVTS_ERROR}</li> * <li>{@link #EVTS_IGFS}</li> * <li>{@link #EVTS_JOB_EXECUTION}</li> - * <li>{@link #EVTS_SWAPSPACE}</li> * <li>{@link #EVTS_TASK_EXECUTION}</li> * </ul> * <p> @@ -495,26 +494,6 @@ public interface EventType { public static final int EVT_CACHE_OBJECT_UNLOCKED = 67; /** - * Built-in event type: cache object swapped from swap storage. - * <p> - * NOTE: all types in range <b>from 1 to 1000 are reserved</b> for - * internal Ignite events and should not be used by user-defined events. - * - * @see CacheEvent - */ - public static final int EVT_CACHE_OBJECT_SWAPPED = 68; - - /** - * Built-in event type: cache object unswapped from swap storage. - * <p> - * NOTE: all types in range <b>from 1 to 1000 are reserved</b> for - * internal Ignite events and should not be used by user-defined events. - * - * @see CacheEvent - */ - public static final int EVT_CACHE_OBJECT_UNSWAPPED = 69; - - /** * Built-in event type: cache object was expired when reading it. * <p> * NOTE: all types in range <b>from 1 to 1000 are reserved</b> for @@ -523,77 +502,6 @@ public interface EventType { * @see CacheEvent */ public static final int EVT_CACHE_OBJECT_EXPIRED = 70; - - /** - * Built-in event type: swap space data read. - * <p> - * NOTE: all types in range <b>from 1 to 1000 are reserved</b> for - * internal Ignite events and should not be used by user-defined events. - * - * @see SwapSpaceEvent - */ - public static final int EVT_SWAP_SPACE_DATA_READ = 71; - - /** - * Built-in event type: swap space data stored. - * <p> - * NOTE: all types in range <b>from 1 to 1000 are reserved</b> for - * internal Ignite events and should not be used by user-defined events. - * - * @see SwapSpaceEvent - */ - public static final int EVT_SWAP_SPACE_DATA_STORED = 72; - - /** - * Built-in event type: swap space data removed. - * <p> - * NOTE: all types in range <b>from 1 to 1000 are reserved</b> for - * internal Ignite events and should not be used by user-defined events. - * - * @see SwapSpaceEvent - */ - public static final int EVT_SWAP_SPACE_DATA_REMOVED = 73; - - /** - * Built-in event type: swap space cleared. - * <p> - * NOTE: all types in range <b>from 1 to 1000 are reserved</b> for - * internal Ignite events and should not be used by user-defined events. - * - * @see SwapSpaceEvent - */ - public static final int EVT_SWAP_SPACE_CLEARED = 74; - - /** - * Built-in event type: swap space data evicted. - * <p> - * NOTE: all types in range <b>from 1 to 1000 are reserved</b> for - * internal Ignite events and should not be used by user-defined events. - * - * @see SwapSpaceEvent - */ - public static final int EVT_SWAP_SPACE_DATA_EVICTED = 75; - - /** - * Built-in event type: cache object stored in off-heap storage. - * <p> - * NOTE: all types in range <b>from 1 to 1000 are reserved</b> for - * internal Ignite events and should not be used by user-defined events. - * - * @see CacheEvent - */ - public static final int EVT_CACHE_OBJECT_TO_OFFHEAP = 76; - - /** - * Built-in event type: cache object moved from off-heap storage back into memory. - * <p> - * NOTE: all types in range <b>from 1 to 1000 are reserved</b> for - * internal Ignite events and should not be used by user-defined events. - * - * @see CacheEvent - */ - public static final int EVT_CACHE_OBJECT_FROM_OFFHEAP = 77; - /** * Built-in event type: cache rebalance started. * <p> @@ -994,8 +902,6 @@ public interface EventType { EVT_CACHE_OBJECT_REMOVED, EVT_CACHE_OBJECT_LOCKED, EVT_CACHE_OBJECT_UNLOCKED, - EVT_CACHE_OBJECT_SWAPPED, - EVT_CACHE_OBJECT_UNSWAPPED, EVT_CACHE_OBJECT_EXPIRED }; @@ -1036,21 +942,6 @@ public interface EventType { }; /** - * All swap space events. This array can be directly passed into - * {@link IgniteEvents#localListen(IgnitePredicate, int...)} method to - * subscribe to all cloud events. - * - * @see SwapSpaceEvent - */ - public static final int[] EVTS_SWAPSPACE = { - EVT_SWAP_SPACE_CLEARED, - EVT_SWAP_SPACE_DATA_REMOVED, - EVT_SWAP_SPACE_DATA_READ, - EVT_SWAP_SPACE_DATA_STORED, - EVT_SWAP_SPACE_DATA_EVICTED - }; - - /** * All Igfs events. This array can be directly passed into * {@link IgniteEvents#localListen(IgnitePredicate, int...)} method to * subscribe to all cloud events. http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/main/java/org/apache/ignite/events/SwapSpaceEvent.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/events/SwapSpaceEvent.java b/modules/core/src/main/java/org/apache/ignite/events/SwapSpaceEvent.java deleted file mode 100644 index 8e7d9e5..0000000 --- a/modules/core/src/main/java/org/apache/ignite/events/SwapSpaceEvent.java +++ /dev/null @@ -1,105 +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.events; - -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.jetbrains.annotations.Nullable; - -/** - * Grid swap space event. - * <p> - * Grid events are used for notification about what happens within the grid. Note that by - * design Ignite keeps all events generated on the local node locally and it provides - * APIs for performing a distributed queries across multiple nodes: - * <ul> - * <li> - * {@link org.apache.ignite.IgniteEvents#remoteQuery(org.apache.ignite.lang.IgnitePredicate, long, int...)} - - * asynchronously querying events occurred on the nodes specified, including remote nodes. - * </li> - * <li> - * {@link org.apache.ignite.IgniteEvents#localQuery(org.apache.ignite.lang.IgnitePredicate, int...)} - - * querying only local events stored on this local node. - * </li> - * <li> - * {@link org.apache.ignite.IgniteEvents#localListen(org.apache.ignite.lang.IgnitePredicate, int...)} - - * listening to local grid events (events from remote nodes not included). - * </li> - * </ul> - * User can also wait for events using method {@link org.apache.ignite.IgniteEvents#waitForLocal(org.apache.ignite.lang.IgnitePredicate, int...)}. - * <h1 class="header">Events and Performance</h1> - * Note that by default all events in Ignite are enabled and therefore generated and stored - * by whatever event storage SPI is configured. Ignite can and often does generate thousands events per seconds - * under the load and therefore it creates a significant additional load on the system. If these events are - * not needed by the application this load is unnecessary and leads to significant performance degradation. - * <p> - * It is <b>highly recommended</b> to enable only those events that your application logic requires - * by using {@link org.apache.ignite.configuration.IgniteConfiguration#getIncludeEventTypes()} method in Ignite configuration. Note that certain - * events are required for Ignite's internal operations and such events will still be generated but not stored by - * event storage SPI if they are disabled in Ignite configuration. - * @see EventType#EVT_SWAP_SPACE_DATA_READ - * @see EventType#EVT_SWAP_SPACE_DATA_STORED - * @see EventType#EVT_SWAP_SPACE_DATA_REMOVED - * @see EventType#EVT_SWAP_SPACE_CLEARED - * @see EventType#EVT_SWAP_SPACE_DATA_EVICTED - */ -public class SwapSpaceEvent extends EventAdapter { - /** */ - private static final long serialVersionUID = 0L; - - /** Swap space name. */ - private String space; - - /** - * Creates swap space event. - * - * @param node Node. - * @param msg Optional message. - * @param type Event type. - * @param space Swap space name ({@code null} for default space). - */ - public SwapSpaceEvent(ClusterNode node, String msg, int type, @Nullable String space) { - super(node, msg, type); - - this.space = space; - } - - /** - * Gets swap space name. - * - * @return Swap space name or {@code null} for default space. - */ - @Nullable public String space() { - return space; - } - - /** {@inheritDoc} */ - @Override public String shortDisplay() { - return name() + ": space=" + space; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(SwapSpaceEvent.class, this, - "nodeId8", U.id8(node().id()), - "msg", message(), - "type", name(), - "tstamp", timestamp()); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/main/java/org/apache/ignite/internal/managers/indexing/GridIndexingManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/indexing/GridIndexingManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/indexing/GridIndexingManager.java index a18b6b0..a60cdbd 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/indexing/GridIndexingManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/indexing/GridIndexingManager.java @@ -177,48 +177,4 @@ public class GridIndexingManager extends GridManagerAdapter<IndexingSpi> { busyLock.leaveBusy(); } } - - /** - * Will be called when entry for key will be swapped. - * - * @param spaceName Space name. - * @param key key. - * @throws IgniteSpiException If failed. - */ - public void onSwap(String spaceName, Object key) throws IgniteSpiException { - assert enabled(); - - if (!busyLock.enterBusy()) - throw new IllegalStateException("Failed to process swap event (grid is stopping)."); - - try { - getSpi().onSwap(spaceName, key); - } - finally { - busyLock.leaveBusy(); - } - } - - /** - * Will be called when entry for key will be unswapped. - * - * @param spaceName Space name. - * @param key Key. - * @param val Value. - * @throws IgniteSpiException If failed. - */ - public void onUnswap(String spaceName, Object key, Object val) - throws IgniteSpiException { - assert enabled(); - - if (!busyLock.enterBusy()) - throw new IllegalStateException("Failed to process swap event (grid is stopping)."); - - try { - getSpi().onUnswap(spaceName, key, val); - } - finally { - busyLock.leaveBusy(); - } - } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsImpl.java index aceef97..1d03e64 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsImpl.java @@ -89,21 +89,6 @@ public class CacheMetricsImpl implements CacheMetrics { /** Number of off-heap misses. */ private AtomicLong offHeapMisses = new AtomicLong(); - /** Number of reads from swap. */ - private AtomicLong swapGets = new AtomicLong(); - - /** Number of writes to swap. */ - private AtomicLong swapPuts = new AtomicLong(); - - /** Number of removed entries from swap. */ - private AtomicLong swapRemoves = new AtomicLong(); - - /** Number of swap hits. */ - private AtomicLong swapHits = new AtomicLong(); - - /** Number of swap misses. */ - private AtomicLong swapMisses = new AtomicLong(); - /** Cache metrics. */ @GridToStringExclude private transient CacheMetricsImpl delegate; @@ -435,12 +420,6 @@ public class CacheMetricsImpl implements CacheMetrics { offHeapMisses.set(0); offHeapEvicts.set(0); - swapGets.set(0); - swapPuts.set(0); - swapRemoves.set(0); - swapHits.set(0); - swapMisses.set(0); - if (delegate != null) delegate.clear(); } http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java index 9e6fc3776..92c144c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java @@ -1812,29 +1812,6 @@ public class GridCacheContext<K, V> implements Externalizable { } /** - * @param type Type. - * @param bytes Bytes. - * @param clsLdrId Class loader ID. - * @return Cache object. - * @throws IgniteCheckedException If failed. - */ - @Nullable public CacheObject unswapCacheObject(byte type, byte[] bytes, @Nullable IgniteUuid clsLdrId) - throws IgniteCheckedException { - if (ctx.config().isPeerClassLoadingEnabled() && type != CacheObject.TYPE_BYTE_ARR) { - ClassLoader ldr = clsLdrId != null ? deploy().getClassLoader(clsLdrId) : deploy().localLoader(); - - if (ldr == null) - return null; - - return ctx.cacheObjects().toCacheObject(cacheObjCtx, - ctx.cacheObjects().unmarshal(cacheObjCtx, bytes, ldr), - false); - } - - return ctx.cacheObjects().toCacheObject(cacheObjCtx, type, bytes); - } - - /** * @param map Map. * @param key Key. * @param val Value. http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryInfoCollectSwapListener.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryInfoCollectSwapListener.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryInfoCollectSwapListener.java deleted file mode 100644 index e8cc01d..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryInfoCollectSwapListener.java +++ /dev/null @@ -1,70 +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; - -import java.util.Collection; -import java.util.Map; -import org.apache.ignite.IgniteLogger; -import org.jsr166.ConcurrentHashMap8; - -/** - * - */ -public class GridCacheEntryInfoCollectSwapListener implements GridCacheSwapListener { - /** */ - private final Map<KeyCacheObject, GridCacheEntryInfo> swappedEntries = new ConcurrentHashMap8<>(); - - /** */ - private final IgniteLogger log; - - /** - * @param log Logger. - */ - public GridCacheEntryInfoCollectSwapListener(IgniteLogger log) { - this.log = log; - } - - /** {@inheritDoc} */ - @Override public void onEntryUnswapped(int part, - KeyCacheObject key, - GridCacheSwapEntry swapEntry) - { - if (log.isDebugEnabled()) - log.debug("Received unswapped event for key: " + key); - - assert key != null; - assert swapEntry != null; - - GridCacheEntryInfo info = new GridCacheEntryInfo(); - - info.key(key); - info.ttl(swapEntry.ttl()); - info.expireTime(swapEntry.expireTime()); - info.version(swapEntry.version()); - info.value(swapEntry.value()); - - swappedEntries.put(key, info); - } - - /** - * @return Entries, received by listener. - */ - public Collection<GridCacheEntryInfo> entries() { - return swappedEntries.values(); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapListener.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapListener.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapListener.java deleted file mode 100644 index 2e6b3ff..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapListener.java +++ /dev/null @@ -1,33 +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; - -import org.apache.ignite.IgniteCheckedException; - -/** - * Provides ability to listen to swap events in cache which is necessary for preloading. - */ -public interface GridCacheSwapListener { - /** - * @param part Partition. - * @param key Cache key. - * @param e Entry. - * @throws IgniteCheckedException If failed. - */ - public void onEntryUnswapped(int part, KeyCacheObject key, GridCacheSwapEntry e) throws IgniteCheckedException; -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java index 98f2f93..186212d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java @@ -1014,12 +1014,6 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V } /** {@inheritDoc} */ - @Override public void localPromote(Set<? extends K> keys) throws CacheException { - // TODO GG-11148. - throw new UnsupportedOperationException("localPromote will be removed"); - } - - /** {@inheritDoc} */ @Override public int size(CachePeekMode... peekModes) throws CacheException { GridCacheGateway<K, V> gate = this.gate; http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java index 94ff0d2..900e96f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java @@ -355,33 +355,6 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte } /** - * Entry for given key unswapped. - * - * @param key Key. - * @throws IgniteCheckedException If failed. - */ - public void onSwap(KeyCacheObject key, int partId) throws IgniteCheckedException { - if(!enabled) - return; - if (!enterBusy()) - return; // Ignore index update when node is stopping. - - try { - if (isIndexingSpiEnabled()) { - Object key0 = unwrapIfNeeded(key, cctx.cacheObjectContext()); - - cctx.kernalContext().indexing().onSwap(space, key0); - } - - if(qryProcEnabled) - qryProc.onSwap(space, key, partId); - } - finally { - leaveBusy(); - } - } - - /** * Checks if IndexinSPI is enabled. * @return IndexingSPI enabled flag. */ @@ -390,38 +363,6 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte } /** - * Entry for given key unswapped. - * - * @param key Key. - * @param val Value - * @throws IgniteCheckedException If failed. - */ - public void onUnswap(KeyCacheObject key, int partId, CacheObject val) throws IgniteCheckedException { - if(!enabled) - return; - if (!enterBusy()) - return; // Ignore index update when node is stopping. - - try { - if (isIndexingSpiEnabled()) { - CacheObjectContext coctx = cctx.cacheObjectContext(); - - Object key0 = unwrapIfNeeded(key, coctx); - - Object val0 = unwrapIfNeeded(val, coctx); - - cctx.kernalContext().indexing().onUnswap(space, key0, val0); - } - - if(qryProcEnabled) - qryProc.onUnswap(space, key, partId, val); - } - finally { - leaveBusy(); - } - } - - /** * */ private void invalidateResultCache() { http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java index bdcb88c..090f382 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java @@ -31,7 +31,6 @@ import org.apache.ignite.events.Event; import org.apache.ignite.events.EventAdapter; import org.apache.ignite.events.EventType; import org.apache.ignite.events.JobEvent; -import org.apache.ignite.events.SwapSpaceEvent; import org.apache.ignite.events.TaskEvent; import org.apache.ignite.internal.GridKernalContext; import org.apache.ignite.internal.binary.BinaryContext; @@ -73,7 +72,6 @@ import org.apache.ignite.internal.processors.platform.messaging.PlatformMessageF import org.apache.ignite.internal.processors.platform.utils.PlatformReaderBiClosure; import org.apache.ignite.internal.processors.platform.utils.PlatformReaderClosure; import org.apache.ignite.internal.processors.platform.utils.PlatformUtils; -import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.lang.IgniteBiTuple; import org.jetbrains.annotations.Nullable; @@ -128,7 +126,6 @@ public class PlatformContextImpl implements PlatformContext { addEventTypes(evtTyps0, EventType.EVTS_CHECKPOINT); addEventTypes(evtTyps0, EventType.EVTS_DISCOVERY_ALL); addEventTypes(evtTyps0, EventType.EVTS_JOB_EXECUTION); - addEventTypes(evtTyps0, EventType.EVTS_SWAPSPACE); addEventTypes(evtTyps0, EventType.EVTS_TASK_EXECUTION); evtTyps = Collections.unmodifiableSet(evtTyps0); @@ -610,14 +607,6 @@ public class PlatformContextImpl implements PlatformContext { writeNode(writer, event0.taskNode()); writer.writeUuid(event0.taskSubjectId()); } - else if (evt0 instanceof SwapSpaceEvent) { - writer.writeInt(9); - writeCommonEventData(writer, evt0); - - SwapSpaceEvent event0 = (SwapSpaceEvent)evt0; - - writer.writeString(event0.space()); - } else if (evt0 instanceof TaskEvent) { writer.writeInt(10); writeCommonEventData(writer, evt0); http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java index a60d364..2847813 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java @@ -132,9 +132,6 @@ public class PlatformCache extends PlatformAbstractTarget { public static final int OP_LOC_LOAD_CACHE = 17; /** */ - public static final int OP_LOC_PROMOTE = 18; - - /** */ public static final int OP_LOCAL_CLEAR = 20; /** */ @@ -433,12 +430,6 @@ public class PlatformCache extends PlatformAbstractTarget { case OP_CONTAINS_KEYS: return cache.containsKeys(PlatformUtils.readSet(reader)) ? TRUE : FALSE; - case OP_LOC_PROMOTE: { - cache.localPromote(PlatformUtils.readSet(reader)); - - return TRUE; - } - case OP_REPLACE_3: return cache.replace(reader.readObjectDetached(), reader.readObjectDetached(), reader.readObjectDetached()) ? TRUE : FALSE; http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java index 7746ba5..23f4343 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java @@ -238,25 +238,6 @@ public interface GridQueryIndexing { GridCacheVersion ver) throws IgniteCheckedException; /** - * Will be called when entry with given key is swapped. - * - * @param spaceName Space name. - * @param key Key. - * @throws IgniteCheckedException If failed. - */ - public void onSwap(@Nullable String spaceName, KeyCacheObject key, int partId) throws IgniteCheckedException; - - /** - * Will be called when entry with given key is unswapped. - * - * @param spaceName Space name. - * @param key Key. - * @param val Value. - * @throws IgniteCheckedException If failed. - */ - public void onUnswap(@Nullable String spaceName, KeyCacheObject key, int partId, CacheObject val) throws IgniteCheckedException; - - /** * Rebuilds all indexes of given type from hash index. * * @param spaceName Space name. http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java index e0dc387..0ac55e6 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java @@ -2031,61 +2031,6 @@ public class GridQueryProcessor extends GridProcessorAdapter { } /** - * Will be called when entry for key will be swapped. - * - * @param spaceName Space name. - * @param key key. - * @throws IgniteCheckedException If failed. - */ - public void onSwap(String spaceName, KeyCacheObject key, int partId) throws IgniteCheckedException { - if (log.isDebugEnabled()) - log.debug("Swap [space=" + spaceName + ", key=" + key + "]"); - - if (idx == null) - return; - - if (!busyLock.enterBusy()) - throw new IllegalStateException("Failed to process swap event (grid is stopping)."); - - try { - idx.onSwap( - spaceName, - key, - partId); - } - finally { - busyLock.leaveBusy(); - } - } - - /** - * Will be called when entry for key will be unswapped. - * - * @param spaceName Space name. - * @param key Key. - * @param val Value. - * @throws IgniteCheckedException If failed. - */ - public void onUnswap(String spaceName, KeyCacheObject key, int partId, CacheObject val) - throws IgniteCheckedException { - if (log.isDebugEnabled()) - log.debug("Unswap [space=" + spaceName + ", key=" + key + ", val=" + val + "]"); - - if (idx == null) - return; - - if (!busyLock.enterBusy()) - throw new IllegalStateException("Failed to process swap event (grid is stopping)."); - - try { - idx.onUnswap(spaceName, key, partId, val); - } - finally { - busyLock.leaveBusy(); - } - } - - /** * Gets types for space. * * @param space Space name. http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingSpi.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingSpi.java index bbe27c0..4d53bea 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingSpi.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingSpi.java @@ -95,23 +95,4 @@ public interface IndexingSpi extends IgniteSpi { * @throws IgniteSpiException If failed. */ public void remove(@Nullable String spaceName, Object key) throws IgniteSpiException; - - /** - * Will be called when entry with given key is swapped. - * - * @param spaceName Space name. - * @param key Key. - * @throws IgniteSpiException If failed. - */ - public void onSwap(@Nullable String spaceName, Object key) throws IgniteSpiException; - - /** - * Will be called when entry with given key is unswapped. - * - * @param spaceName Space name. - * @param key Key. - * @param val Value. - * @throws IgniteSpiException If failed. - */ - public void onUnswap(@Nullable String spaceName, Object key, Object val) throws IgniteSpiException; } http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/main/java/org/apache/ignite/spi/indexing/noop/NoopIndexingSpi.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/indexing/noop/NoopIndexingSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/indexing/noop/NoopIndexingSpi.java index a8683a1..0ed7e33 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/indexing/noop/NoopIndexingSpi.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/indexing/noop/NoopIndexingSpi.java @@ -50,16 +50,6 @@ public class NoopIndexingSpi extends IgniteSpiAdapter implements IndexingSpi { } /** {@inheritDoc} */ - @Override public void onSwap(@Nullable String spaceName, Object key) throws IgniteSpiException { - assert false; - } - - /** {@inheritDoc} */ - @Override public void onUnswap(@Nullable String spaceName, Object key, Object val) throws IgniteSpiException { - assert false; - } - - /** {@inheritDoc} */ @Override public void spiStart(@Nullable String igniteInstanceName) throws IgniteSpiException { // No-op. } http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/main/resources/META-INF/classnames.properties ---------------------------------------------------------------------- diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties index 6b548c7..e45f84a 100644 --- a/modules/core/src/main/resources/META-INF/classnames.properties +++ b/modules/core/src/main/resources/META-INF/classnames.properties @@ -151,7 +151,6 @@ org.apache.ignite.events.Event org.apache.ignite.events.EventAdapter org.apache.ignite.events.IgfsEvent org.apache.ignite.events.JobEvent -org.apache.ignite.events.SwapSpaceEvent org.apache.ignite.events.TaskEvent org.apache.ignite.hadoop.HadoopInputSplit org.apache.ignite.hadoop.HadoopMapReducePlan http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java index f7054b7..93ed7a1 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java @@ -110,13 +110,10 @@ import static org.apache.ignite.cache.CacheMode.LOCAL; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CachePeekMode.ALL; -import static org.apache.ignite.cache.CachePeekMode.OFFHEAP; import static org.apache.ignite.cache.CachePeekMode.ONHEAP; import static org.apache.ignite.cache.CachePeekMode.PRIMARY; import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_LOCKED; -import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_SWAPPED; import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_UNLOCKED; -import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_UNSWAPPED; import static org.apache.ignite.testframework.GridTestUtils.assertThrows; import static org.apache.ignite.testframework.GridTestUtils.waitForCondition; import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC; @@ -6525,48 +6522,6 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract /** * */ - private static class SwapEvtsLocalListener implements IgnitePredicate<Event> { - /** */ - @LoggerResource - private IgniteLogger log; - - /** Swap events. */ - private final AtomicInteger swapEvts; - - /** Unswap events. */ - private final AtomicInteger unswapEvts; - - /** - * @param swapEvts Swap events. - * @param unswapEvts Unswap events. - */ - public SwapEvtsLocalListener(AtomicInteger swapEvts, AtomicInteger unswapEvts) { - this.swapEvts = swapEvts; - this.unswapEvts = unswapEvts; - } - - /** {@inheritDoc} */ - @Override public boolean apply(Event evt) { - log.info("Received event: " + evt); - - switch (evt.type()) { - case EVT_CACHE_OBJECT_SWAPPED: - swapEvts.incrementAndGet(); - - break; - case EVT_CACHE_OBJECT_UNSWAPPED: - unswapEvts.incrementAndGet(); - - break; - } - - return true; - } - } - - /** - * - */ private static class CheckEntriesDeletedTask extends TestIgniteIdxRunnable { /** */ private final int cnt; http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java index 674996d..dcba92f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java @@ -102,9 +102,7 @@ import static org.apache.ignite.cache.CachePeekMode.OFFHEAP; import static org.apache.ignite.cache.CachePeekMode.ONHEAP; import static org.apache.ignite.cache.CachePeekMode.PRIMARY; import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_LOCKED; -import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_SWAPPED; import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_UNLOCKED; -import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_UNSWAPPED; import static org.apache.ignite.testframework.GridTestUtils.assertThrows; import static org.apache.ignite.testframework.GridTestUtils.waitForCondition; import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC; @@ -4103,8 +4101,6 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar assertNull(cache.localPeek("key")); - cache.localPromote(Collections.singleton(key)); - assertNull(cache.localPeek(key, ONHEAP)); assertTrue(cache.localSize() == 0); @@ -6425,47 +6421,6 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar /** * */ - private static class SwapEvtsLocalListener implements IgnitePredicate<Event> { - @LoggerResource - private IgniteLogger log; - - /** Swap events. */ - private final AtomicInteger swapEvts; - - /** Unswap events. */ - private final AtomicInteger unswapEvts; - - /** - * @param swapEvts Swap events. - * @param unswapEvts Unswap events. - */ - public SwapEvtsLocalListener(AtomicInteger swapEvts, AtomicInteger unswapEvts) { - this.swapEvts = swapEvts; - this.unswapEvts = unswapEvts; - } - - /** {@inheritDoc} */ - @Override public boolean apply(Event evt) { - log.info("Received event: " + evt); - - switch (evt.type()) { - case EVT_CACHE_OBJECT_SWAPPED: - swapEvts.incrementAndGet(); - - break; - case EVT_CACHE_OBJECT_UNSWAPPED: - unswapEvts.incrementAndGet(); - - break; - } - - return true; - } - } - - /** - * - */ private static class CheckEntriesDeletedTask extends TestIgniteIdxRunnable { private final int cnt; http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java index a1a2f89..224d1fe 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java @@ -189,8 +189,6 @@ public abstract class IgniteCacheStoreValueAbstractTest extends IgniteCacheAbstr assertNull(cache.localPeek(key, CachePeekMode.ONHEAP)); - cache.localPromote(Collections.singleton(key)); - assertNotNull(cache.localPeek(key, CachePeekMode.ONHEAP)); checkNoValue(aff, key); @@ -356,8 +354,6 @@ public abstract class IgniteCacheStoreValueAbstractTest extends IgniteCacheAbstr assertNull(cache.localPeek(key, CachePeekMode.ONHEAP)); - cache.localPromote(Collections.singleton(key)); - assertNotNull(cache.localPeek(key, CachePeekMode.ONHEAP)); checkHasValue(aff, key); http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java index 221b670..c60d718 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java @@ -690,16 +690,6 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac } /** {@inheritDoc} */ - @Override public void onSwap(@Nullable String spaceName, Object key) throws IgniteSpiException { - // No-op. - } - - /** {@inheritDoc} */ - @Override public void onUnswap(@Nullable String spaceName, Object key, Object val) throws IgniteSpiException { - // No-op. - } - - /** {@inheritDoc} */ @Override public void spiStart(@Nullable String igniteInstanceName) throws IgniteSpiException { // No-op. } http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractDistributedByteArrayValuesSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractDistributedByteArrayValuesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractDistributedByteArrayValuesSelfTest.java index 75aadc5..01202fd 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractDistributedByteArrayValuesSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractDistributedByteArrayValuesSelfTest.java @@ -148,49 +148,6 @@ public abstract class GridCacheAbstractDistributedByteArrayValuesSelfTest extend } /** - * Test swapping. - * - * @throws Exception If failed. - */ - public void testSwap() throws Exception { -// TODO: GG-11148 check if test makes sense. -// for (IgniteCache<Integer, Object> cache : caches) -// assert cache.getConfiguration(CacheConfiguration.class).isSwapEnabled(); - if (true) - return; - - byte[] val1 = wrap(1); - - IgniteCache<Integer, Object> primaryCache = null; - - int i = 0; - - for (IgniteCache<Integer, Object> cache : caches) { - Ignite ignite = ignites[i++]; - - if (affinity(cache).isPrimary(ignite.cluster().localNode(), SWAP_TEST_KEY)) { - primaryCache = cache; - - break; - } - } - - assert primaryCache != null; - - primaryCache.put(SWAP_TEST_KEY, val1); - - assert Arrays.equals(val1, (byte[])primaryCache.get(SWAP_TEST_KEY)); - - primaryCache.localEvict(Collections.singleton(SWAP_TEST_KEY)); - - assert primaryCache.localPeek(SWAP_TEST_KEY, CachePeekMode.ONHEAP) == null; - - primaryCache.localPromote(Collections.singleton(SWAP_TEST_KEY)); - - assert Arrays.equals(val1, (byte[])primaryCache.localPeek(SWAP_TEST_KEY, CachePeekMode.ONHEAP)); - } - - /** * Test transaction behavior. * * @param caches Caches. http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java index 0b8ccdf..15eec59 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java @@ -17,7 +17,6 @@ package org.apache.ignite.internal.processors.cache.distributed.near; -import com.google.common.collect.ImmutableSet; import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -26,26 +25,20 @@ import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.concurrent.atomic.AtomicInteger; import javax.cache.expiry.Duration; import javax.cache.expiry.TouchedExpiryPolicy; +import com.google.common.collect.ImmutableSet; import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteLogger; import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.CachePeekMode; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; -import org.apache.ignite.events.Event; import org.apache.ignite.internal.util.lang.GridAbsPredicate; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.lang.IgnitePredicate; -import org.apache.ignite.resources.LoggerResource; import static java.util.concurrent.TimeUnit.MILLISECONDS; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; -import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_SWAPPED; -import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_UNSWAPPED; import static org.apache.ignite.testframework.GridTestUtils.waitForCondition; /** @@ -310,46 +303,4 @@ public class GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest extends GridCache assert c.localSize() == 0 : "Cache is not empty."; } - - /** - * - */ - private static class LocalListener implements IgnitePredicate<Event> { - /** Logger. */ - @LoggerResource - private IgniteLogger log; - - /** Swap events. */ - private final AtomicInteger swapEvts; - - /** Unswap events. */ - private final AtomicInteger unswapEvts; - - /** - * @param swapEvts Swap events. - * @param unswapEvts Unswap events. - */ - public LocalListener(AtomicInteger swapEvts, AtomicInteger unswapEvts) { - this.swapEvts = swapEvts; - this.unswapEvts = unswapEvts; - } - - /** {@inheritDoc} */ - @Override public boolean apply(Event evt) { - log.info("Received event: " + evt); - - switch (evt.type()) { - case EVT_CACHE_OBJECT_SWAPPED: - swapEvts.incrementAndGet(); - - break; - case EVT_CACHE_OBJECT_UNSWAPPED: - unswapEvts.incrementAndGet(); - - break; - } - - return true; - } - } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java index d5c5635..e5b72f8 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java @@ -19,40 +19,26 @@ package org.apache.ignite.internal.processors.cache.distributed.near; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import java.util.concurrent.Callable; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteAtomicLong; import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteLogger; import org.apache.ignite.cache.CachePeekMode; import org.apache.ignite.cache.affinity.Affinity; import org.apache.ignite.cache.affinity.AffinityKeyMapped; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.events.Event; import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.IgniteKernal; -import org.apache.ignite.internal.util.lang.GridAbsPredicate; import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.lang.IgnitePredicate; -import org.apache.ignite.resources.IgniteInstanceResource; -import org.apache.ignite.resources.LoggerResource; -import org.apache.ignite.testframework.GridTestUtils; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CachePeekMode.BACKUP; import static org.apache.ignite.cache.CachePeekMode.NEAR; -import static org.apache.ignite.cache.CachePeekMode.ONHEAP; import static org.apache.ignite.cache.CachePeekMode.PRIMARY; import static org.apache.ignite.cache.CacheRebalanceMode.SYNC; -import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_SWAPPED; -import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_UNSWAPPED; /** * Multi-node tests for partitioned cache. @@ -413,51 +399,6 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti /** * */ - private static class SwapUnswapLocalListener implements IgnitePredicate<Event> { - /** Logger. */ - @LoggerResource - private IgniteLogger log; - - /** Ignite. */ - @IgniteInstanceResource - private Ignite ignite; - - /** {@inheritDoc} */ - @Override public boolean apply(Event evt) { - log.info("Received event: " + evt); - - switch (evt.type()) { - case EVT_CACHE_OBJECT_SWAPPED: - // Run from another thread to avoid deadlock with striped pool. - GridTestUtils.runAsync(new Callable<Void>() { - @Override public Void call() throws Exception { - ignite.atomicLong("swapEvts", 0, false).incrementAndGet(); - - return null; - } - }); - - break; - case EVT_CACHE_OBJECT_UNSWAPPED: - // Run from another thread to avoid deadlock with striped pool. - GridTestUtils.runAsync(new Callable<Void>() { - @Override public Void call() throws Exception { - ignite.atomicLong("unswapEvts", 0, false).incrementAndGet(); - - return null; - } - }); - - break; - } - - return true; - } - } - - /** - * - */ private static class CheckAffinityTask extends TestIgniteIdxRunnable { /** Size. */ private final int size; http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedUnswapAdvancedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedUnswapAdvancedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedUnswapAdvancedSelfTest.java deleted file mode 100644 index 39e326a..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedUnswapAdvancedSelfTest.java +++ /dev/null @@ -1,151 +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.distributed.replicated; - -import java.util.Collections; -import java.util.concurrent.CountDownLatch; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CachePeekMode; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.events.Event; -import org.apache.ignite.internal.binary.BinaryMarshaller; -import org.apache.ignite.lang.IgnitePredicate; -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 java.util.concurrent.TimeUnit.SECONDS; -import static org.apache.ignite.cache.CacheMode.REPLICATED; -import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT; - -/** - * Advanced promote test for replicated cache. - */ -public class GridCacheReplicatedUnswapAdvancedSelfTest extends GridCommonAbstractTest { - /** IP finder. */ - private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); - - TcpDiscoverySpi discoSpi = new TcpDiscoverySpi(); - - discoSpi.setIpFinder(IP_FINDER); - - cfg.setDiscoverySpi(discoSpi); - - CacheConfiguration cacheCfg = defaultCacheConfiguration(); - - cacheCfg.setCacheMode(REPLICATED); - - cfg.setCacheConfiguration(cacheCfg); - - if (getTestIgniteInstanceName(1).equals(igniteInstanceName) || cfg.getMarshaller() instanceof BinaryMarshaller) - cfg.setClassLoader(getExternalClassLoader()); - - return cfg; - } - - /** - * @throws Exception If failed. - */ - public void testUnswapAdvanced() throws Exception { - fail("https://issues.apache.org/jira/browse/IGNITE-4551"); - - Ignite g1 = startGrid(1); - Ignite g2 = startGrid(2); - - assert g1.cluster().nodes().size() > 1 : "This test needs at least two grid nodes started."; - - IgniteCache<Object, Object> cache1 = g1.cache(null); - IgniteCache<Object, Object> cache2 = g2.cache(null); - - try { - ClassLoader ldr = grid(1).configuration().getClassLoader(); - - Object v = ldr.loadClass("org.apache.ignite.tests.p2p.CacheDeploymentTestValue3").newInstance(); - - info("v loader: " + v.getClass().getClassLoader()); - - final CountDownLatch putLatch = new CountDownLatch(1); - - g2.events().localListen(new IgnitePredicate<Event>() { - @Override public boolean apply(Event evt) { - assert evt.type() == EVT_CACHE_OBJECT_PUT; - - putLatch.countDown(); - - return true; - } - }, EVT_CACHE_OBJECT_PUT); - - String key = null; - - for (int i = 0; i < 1000; i++) { - String k = "key-" + i; - - if (affinity(cache1).isPrimary(g1.cluster().localNode(), k)) { - key = k; - - break; - } - } - - assertNotNull(key); - - // Put value into cache of the first grid. - cache1.put(key, v); - - assert putLatch.await(10, SECONDS); - - assert cache2.containsKey(key); - - Object v2 = cache2.get(key); - - info("v2 loader: " + v2.getClass().getClassLoader()); - - assert v2 != null; - assert v2.toString().equals(v.toString()); - assert !v2.getClass().getClassLoader().equals(getClass().getClassLoader()); - assert v2.getClass().getClassLoader().getClass().getName().contains("GridDeploymentClassLoader")|| - grid(2).configuration().getMarshaller() instanceof BinaryMarshaller; - - // To swap storage. - cache2.localEvict(Collections.<Object>singleton(key)); - - cache2.localPromote(Collections.singleton(key)); - - v2 = cache2.localPeek(key, CachePeekMode.ONHEAP); - - log.info("Unswapped entry value: " + v2); - - assert v2 != null; - - assert v2.getClass().getClassLoader().getClass().getName().contains("GridDeploymentClassLoader")| - grid(2).configuration().getMarshaller() instanceof BinaryMarshaller; - } - finally { - stopGrid(1); - stopGrid(2); - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQuerySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQuerySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQuerySelfTest.java index 06a89a4..62adb77 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQuerySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQuerySelfTest.java @@ -290,16 +290,6 @@ public class IndexingSpiQuerySelfTest extends TestCase { @Override public void remove(@Nullable String spaceName, Object key) throws IgniteSpiException { // No-op. } - - /** {@inheritDoc} */ - @Override public void onSwap(@Nullable String spaceName, Object key) throws IgniteSpiException { - // No-op. - } - - /** {@inheritDoc} */ - @Override public void onUnswap(@Nullable String spaceName, Object key, Object val) throws IgniteSpiException { - // No-op. - } } /** @@ -321,18 +311,6 @@ public class IndexingSpiQuerySelfTest extends TestCase { @Override public void remove(@Nullable String spaceName, Object key) throws IgniteSpiException { assertTrue(key instanceof BinaryObject); } - - /** {@inheritDoc} */ - @Override public void onSwap(@Nullable String spaceName, Object key) throws IgniteSpiException { - assertTrue(key instanceof BinaryObject); - } - - /** {@inheritDoc} */ - @Override public void onUnswap(@Nullable String spaceName, Object key, Object val) throws IgniteSpiException { - assertTrue(key instanceof BinaryObject); - - assertTrue(val instanceof BinaryObject); - } } /** http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQueryTxSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQueryTxSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQueryTxSelfTest.java index 5ce48aa..9d2b31c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQueryTxSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQueryTxSelfTest.java @@ -148,15 +148,5 @@ public class IndexingSpiQueryTxSelfTest extends GridCacheAbstractSelfTest { @Override public void remove(@Nullable String spaceName, Object key) throws IgniteSpiException { // No-op. } - - /** {@inheritDoc} */ - @Override public void onSwap(@Nullable String spaceName, Object key) throws IgniteSpiException { - // No-op. - } - - /** {@inheritDoc} */ - @Override public void onUnswap(@Nullable String spaceName, Object key, Object val) throws IgniteSpiException { - // No-op. - } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheSwapLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheSwapLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheSwapLoadTest.java deleted file mode 100644 index 436bc73..0000000 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheSwapLoadTest.java +++ /dev/null @@ -1,320 +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.loadtests.cache; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.Callable; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.events.CacheEvent; -import org.apache.ignite.events.Event; -import org.apache.ignite.internal.IgniteInternalFuture; -import org.apache.ignite.internal.util.typedef.CAX; -import org.apache.ignite.internal.util.typedef.CIX1; -import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.internal.util.typedef.G; -import org.apache.ignite.internal.util.typedef.X; -import org.apache.ignite.lang.IgnitePredicate; -import org.apache.ignite.testframework.GridTestUtils; -import org.jetbrains.annotations.Nullable; - -import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_SWAPPED; - -/** - * Cache+swap load test. - */ -public class GridCacheSwapLoadTest { - /** */ - private static final int LOG_MOD = 10000; - - /** */ - private static final int DFLT_KEY_CNT = 100000; - - /** */ - private static final float DFLT_GET_REMOVE_RATIO = 0.2f; - - /** */ - private static final int DFLT_PUT_THREAD_CNT = 5; - - /** */ - private static final int DFLT_GET_THREAD_CNT = 2; - - /** */ - private static final int DFLT_REMOVE_THREAD_CNT = 2; - - /** */ - private static final boolean DFLT_GET_REMOVE_ENABLED = true; - - /** */ - private static int keyCnt = DFLT_KEY_CNT; - - /** */ - private static float getRmvRatio = DFLT_GET_REMOVE_RATIO; - - /** */ - private static int putThreadCnt = DFLT_PUT_THREAD_CNT; - - /** */ - private static int getThreadCnt = DFLT_GET_THREAD_CNT; - - /** */ - private static int rmvThreadCnt = DFLT_REMOVE_THREAD_CNT; - - /** */ - private static boolean getRmvEnabled = DFLT_GET_REMOVE_ENABLED; - - /** */ - private static final CountDownLatch getRemoveStartedLatch = new CountDownLatch(1); - - /** */ - private static final BlockingQueue<Integer> swappedKeys = new LinkedBlockingQueue<>(); - - /** */ - private GridCacheSwapLoadTest() { - // No-op - } - - /** - * @param args Command line arguments. - */ - public static void main(String[] args) { - parseArgs(args); - - try (Ignite g = G.start("modules/core/src/test/config/spring-cache-swap.xml")) { - g.events().localListen(new IgnitePredicate<Event>() { - private final AtomicInteger cnt = new AtomicInteger(0); - - private final AtomicBoolean getRmvStartedGuard = new AtomicBoolean(false); - - @Override public boolean apply(Event evt) { - int cnt = this.cnt.incrementAndGet(); - - if (cnt % LOG_MOD == 0) - X.println(">>> Swap count: " + cnt); - - if (getRmvEnabled) { - CacheEvent ce = (CacheEvent) evt; - - Integer key = ce.key(); - - swappedKeys.add(key); - - if (swappedKeys.size() > keyCnt * getRmvRatio && - getRmvStartedGuard.compareAndSet(false, true)) { - getRemoveStartedLatch.countDown(); - - X.println(">>> Started get/remove."); - } - } - - return true; - } - }, EVT_CACHE_OBJECT_SWAPPED); - - Collection<IgniteInternalFuture<?>> futs = new ArrayList<>(3); - - long start = System.currentTimeMillis(); - - futs.add(doPut(g)); - - if (getRmvEnabled) - futs.addAll(doGetRemove(g)); - - wait(futs); - - X.println("Test finished in: " + (System.currentTimeMillis() - start)); - } - } - - /** - * @param args Command line arguments. - */ - private static void parseArgs(String[] args) { - try { - for (int i = 0; i < args.length; i++) { - String arg = args[i]; - - switch (arg) { - case "-k": - keyCnt = Integer.valueOf(args[++i]); break; - case "-r": - getRmvRatio = Float.valueOf(args[++i]); break; - case "-pt": - putThreadCnt = Integer.valueOf(args[++i]); break; - case "-gt": - getThreadCnt = Integer.valueOf(args[++i]); break; - case "-rt": - rmvThreadCnt = Integer.valueOf(args[++i]); break; - case "-dgr": - getRmvEnabled = false; break; - default: - usage(); - } - } - } - catch (Exception e) { - e.printStackTrace(); - - usage(); - } - - X.println(">>>"); - X.println(">>> Key count: " + keyCnt); - X.println(">>> Get/remove ratio: " + getRmvRatio); - X.println(">>> Put threads count: " + putThreadCnt); - X.println(">>> Get threads count: " + getThreadCnt); - X.println(">>> Remove threads count: " + rmvThreadCnt); - X.println(">>> Get/remove " + (getRmvEnabled ? "enabled" : "disabled") + "."); - X.println(">>>"); - } - - /** */ - private static void usage() { - X.println(">>>"); - X.println(">>> Usage: swaploadtest.sh -k <number of keys> -r <get/remove ratio> -pt <number of put threads>"); - X.println(">>> -gt <number of get threads> -rt <number of remove threads> -dgr"); - X.println(">>>"); - X.println(">>> -dgr disables get/remove threads."); - X.println(">>>"); - X.println(">>> All arguments are optional."); - X.println(">>>"); - - System.exit(1); - } - - /** - * @return Future. - */ - private static IgniteInternalFuture<?> doPut(final Ignite g) { - final AtomicInteger putKey = new AtomicInteger(0); - - return GridTestUtils.runMultiThreadedAsync(new CAX() { - @Override public void applyx() { - IgniteCache<Integer, Integer> cache = g.cache(null); - - assert cache != null; - - while (true) { - int i = putKey.incrementAndGet(); - - if (i % LOG_MOD == 0) - X.println(">>> Put count: " + i); - - if (i > keyCnt) - break; - - cache.put(i, i); - } - - X.println(">>> Thread '" + Thread.currentThread().getName() + "' stopped."); - } - }, putThreadCnt, "put-thread"); - } - - /** - * @return Futures. - */ - private static Collection<IgniteInternalFuture<Long>> doGetRemove(final Ignite g) { - final AtomicBoolean stop = new AtomicBoolean(false); - - return F.asList( - GridTestUtils.runMultiThreadedAsync(new Callable<Object>() { - @Nullable @Override public Object call() throws Exception { - getRemoveStartedLatch.await(); - - IgniteCache<Integer, Integer> cache = g.cache(null); - - assert cache != null; - - while (true) { - Integer i = swappedKeys.take(); - - if (i == null) - continue; - - Integer val = cache.get(i); - - assert val != null && val.equals(i); - - if (i % LOG_MOD == 0) - X.println(">>> Get/remove count: " + i); - - if (i == keyCnt || stop.get()) { - stop.set(true); - - break; - } - } - - X.println(">>> Thread '" + Thread.currentThread().getName() + "' stopped."); - - return null; - } - }, getThreadCnt, "get-thread"), - - GridTestUtils.runMultiThreadedAsync(new Callable<Object>() { - @Nullable @Override public Object call() throws Exception { - getRemoveStartedLatch.await(); - - IgniteCache<Integer, Integer> cache = g.cache(null); - - assert cache != null; - - while (true) { - Integer i = swappedKeys.take(); - - Integer val = cache.getAndRemove(i); - - assert val != null && val.equals(i); - - if (i % LOG_MOD == 0) - X.println(">>> Get/remove count: " + i); - - if (i == keyCnt || stop.get()) { - stop.set(true); - - break; - } - } - - X.println(">>> Thread '" + Thread.currentThread().getName() + "' stopped."); - - return null; - } - }, rmvThreadCnt, "remove-thread") - ); - } - - /** - * @param futs Futures. - */ - private static void wait(Iterable<IgniteInternalFuture<?>> futs) { - F.forEach(futs, new CIX1<IgniteInternalFuture<?>>() { - @Override public void applyx(IgniteInternalFuture<?> fut) throws IgniteCheckedException { - fut.get(); - } - }); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java index e37b572..d203794 100644 --- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java +++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java @@ -231,11 +231,6 @@ public class IgniteCacheProcessProxy<K, V> implements IgniteCache<K, V> { } /** {@inheritDoc} */ - @Override public void localPromote(Set<? extends K> keys) throws CacheException { - throw new UnsupportedOperationException("Method should be supported."); - } - - /** {@inheritDoc} */ @Override public int size(CachePeekMode... peekModes) throws CacheException { return compute.call(new SizeTask(cacheName, isAsync, peekModes, false)); } http://git-wip-us.apache.org/repos/asf/ignite/blob/0da8c70a/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 3876951..d0b74d6 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 @@ -71,7 +71,6 @@ import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCa import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedTxMultiThreadedSelfTest; import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedTxSingleThreadedSelfTest; import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedTxTimeoutSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedUnswapAdvancedSelfTest; import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheSyncReplicatedPreloadSelfTest; import org.apache.ignite.internal.processors.cache.distributed.replicated.GridReplicatedTxPreloadTest; import org.apache.ignite.internal.processors.cache.distributed.replicated.preloader.GridCacheReplicatedPreloadLifecycleSelfTest; @@ -128,7 +127,6 @@ public class IgniteCacheTestSuite3 extends TestSuite { suite.addTestSuite(IgniteCacheScanPredicateDeploymentSelfTest.class); suite.addTestSuite(GridCachePutArrayValueSelfTest.class); - suite.addTestSuite(GridCacheReplicatedUnswapAdvancedSelfTest.class); suite.addTestSuite(GridCacheReplicatedEvictionEventSelfTest.class); suite.addTestSuite(GridCacheReplicatedTxMultiThreadedSelfTest.class); suite.addTestSuite(GridCacheReplicatedPreloadEventsSelfTest.class);
