http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/main/java/org/apache/ignite/internal/util/portable/PortableRawWriterEx.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/portable/PortableRawWriterEx.java b/modules/core/src/main/java/org/apache/ignite/internal/util/portable/PortableRawWriterEx.java index 00c989e..df7c83c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/portable/PortableRawWriterEx.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/portable/PortableRawWriterEx.java @@ -17,6 +17,7 @@ package org.apache.ignite.internal.util.portable; +import org.apache.ignite.internal.processors.portable.*; import org.apache.ignite.portables.*; import org.jetbrains.annotations.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/main/java/org/apache/ignite/internal/visor/ggfs/VisorGgfsSamplingStateTask.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/ggfs/VisorGgfsSamplingStateTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/ggfs/VisorGgfsSamplingStateTask.java index 6df9bb4..6d27a29 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/ggfs/VisorGgfsSamplingStateTask.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/ggfs/VisorGgfsSamplingStateTask.java @@ -18,6 +18,7 @@ package org.apache.ignite.internal.visor.ggfs; import org.apache.ignite.*; +import org.apache.ignite.internal.processors.fs.*; import org.apache.ignite.lang.*; import org.apache.ignite.internal.processors.task.*; import org.apache.ignite.internal.visor.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java index 0f9079b..26cd263 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java @@ -22,6 +22,7 @@ import org.apache.ignite.cache.*; import org.apache.ignite.cluster.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; +import org.apache.ignite.internal.processors.fs.*; import org.apache.ignite.streamer.*; import org.apache.ignite.internal.visor.*; import org.apache.ignite.internal.visor.cache.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java index 9bb838c..dfca428 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java @@ -24,6 +24,7 @@ import org.apache.ignite.cache.eviction.lru.*; import org.apache.ignite.cache.eviction.random.*; import org.apache.ignite.cluster.*; import org.apache.ignite.events.*; +import org.apache.ignite.internal.processors.fs.*; import org.apache.ignite.lang.*; import org.apache.ignite.internal.visor.event.*; import org.apache.ignite.internal.visor.file.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/main/java/org/apache/ignite/plugin/PluginValidationException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/PluginValidationException.java b/modules/core/src/main/java/org/apache/ignite/plugin/PluginValidationException.java index 1c925bb..31f334f 100644 --- a/modules/core/src/main/java/org/apache/ignite/plugin/PluginValidationException.java +++ b/modules/core/src/main/java/org/apache/ignite/plugin/PluginValidationException.java @@ -18,7 +18,6 @@ package org.apache.ignite.plugin; import org.apache.ignite.*; -import org.gridgain.grid.*; import java.util.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeBatchWindow.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeBatchWindow.java b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeBatchWindow.java index 55a1259..53a40cc 100644 --- a/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeBatchWindow.java +++ b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeBatchWindow.java @@ -18,6 +18,7 @@ package org.apache.ignite.streamer.window; import org.apache.ignite.*; +import org.apache.ignite.internal.processors.streamer.*; import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.internal.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeSortedWindow.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeSortedWindow.java b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeSortedWindow.java index 8ea4de3..f2bfcf3 100644 --- a/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeSortedWindow.java +++ b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeSortedWindow.java @@ -17,6 +17,7 @@ package org.apache.ignite.streamer.window; +import org.apache.ignite.internal.processors.streamer.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.internal.util.typedef.*; import org.jetbrains.annotations.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeWindow.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeWindow.java b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeWindow.java index dd0796a..16033eb 100644 --- a/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeWindow.java +++ b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeWindow.java @@ -17,6 +17,7 @@ package org.apache.ignite.streamer.window; +import org.apache.ignite.internal.processors.streamer.*; import org.jdk8.backport.*; import org.jetbrains.annotations.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeWindowAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeWindowAdapter.java b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeWindowAdapter.java index 23cd7d6..ffc2fc2 100644 --- a/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeWindowAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeWindowAdapter.java @@ -18,6 +18,7 @@ package org.apache.ignite.streamer.window; import org.apache.ignite.*; +import org.apache.ignite.internal.processors.streamer.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.internal.util.lang.*; import org.jetbrains.annotations.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedTimeBatchWindow.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedTimeBatchWindow.java b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedTimeBatchWindow.java index 78427b9..8e534d4 100644 --- a/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedTimeBatchWindow.java +++ b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedTimeBatchWindow.java @@ -18,6 +18,7 @@ package org.apache.ignite.streamer.window; import org.apache.ignite.*; +import org.apache.ignite.internal.processors.streamer.*; import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.internal.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedTimeWindow.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedTimeWindow.java b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedTimeWindow.java index e4a06c0..457a345 100644 --- a/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedTimeWindow.java +++ b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedTimeWindow.java @@ -18,6 +18,7 @@ package org.apache.ignite.streamer.window; import org.apache.ignite.*; +import org.apache.ignite.internal.processors.streamer.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.typedef.internal.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerUnboundedWindow.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerUnboundedWindow.java b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerUnboundedWindow.java index 3bb4085..ef7900d 100644 --- a/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerUnboundedWindow.java +++ b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerUnboundedWindow.java @@ -17,6 +17,7 @@ package org.apache.ignite.streamer.window; +import org.apache.ignite.internal.processors.streamer.*; import org.jdk8.backport.*; import java.util.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerWindowAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerWindowAdapter.java b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerWindowAdapter.java index 7633ba6..18337e4 100644 --- a/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerWindowAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerWindowAdapter.java @@ -18,6 +18,7 @@ package org.apache.ignite.streamer.window; import org.apache.ignite.*; +import org.apache.ignite.internal.processors.streamer.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.lang.*; import org.apache.ignite.lifecycle.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/test/java/org/apache/ignite/internal/GridUpdateNotifierSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridUpdateNotifierSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridUpdateNotifierSelfTest.java new file mode 100644 index 0000000..6edfa1b --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/GridUpdateNotifierSelfTest.java @@ -0,0 +1,92 @@ +/* + * 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; + +import org.apache.ignite.internal.*; +import org.apache.ignite.testframework.junits.common.*; +import org.jetbrains.annotations.*; + +import java.util.concurrent.*; + +/** + * Update notifier test. + */ +@GridCommonTest(group = "Kernal Self") +public class GridUpdateNotifierSelfTest extends GridCommonAbstractTest { + /** {@inheritDoc} */ + @Override protected long getTestTimeout() { + return 30 * 1000; + } + + /** + * @throws Exception If failed. + */ + public void testNotifier() throws Exception { + GridUpdateNotifier ntf = new GridUpdateNotifier(null, GridProperties.get("ignite.version"), + GridKernal.SITE, TEST_GATEWAY, false); + + ntf.checkForNewVersion(new SelfExecutor(), log); + + String ver = ntf.latestVersion(); + + info("Latest version: " + ver); + + assertNotNull("GridGain latest version has not been detected.", ver); + + ntf.reportStatus(log); + } + + /** + * Executor that runs task in current thread. + */ + private static class SelfExecutor implements Executor { + /** {@inheritDoc} */ + @Override public void execute(@NotNull Runnable r) { + r.run(); + } + } + + /** + * Test kernal gateway that always return uninitialized user stack trace. + */ + private static final GridKernalGateway TEST_GATEWAY = new GridKernalGateway() { + @Override public void lightCheck() throws IllegalStateException {} + + @Override public void readLock() throws IllegalStateException {} + + @Override public void setState(GridKernalState state) {} + + @Override public GridKernalState getState() { + return null; + } + + @Override public void readUnlock() {} + + @Override public void writeLock() {} + + @Override public void writeUnlock() {} + + @Override public void addStopListener(Runnable lsnr) {} + + @Override public void removeStopListener(Runnable lsnr) {} + + @Override public String userStackTrace() { + return null; + } + }; +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapSelfTest.java new file mode 100644 index 0000000..12e35c9 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapSelfTest.java @@ -0,0 +1,384 @@ +/* + * 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.cache.*; +import org.apache.ignite.configuration.*; +import org.apache.ignite.spi.discovery.tcp.*; +import org.apache.ignite.spi.discovery.tcp.ipfinder.*; +import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; +import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.testframework.junits.common.*; + +import java.util.*; +import java.util.concurrent.*; +import java.util.concurrent.atomic.*; + +import static org.apache.ignite.cache.GridCacheMode.*; +import static org.apache.ignite.cache.GridCacheWriteSynchronizationMode.*; + +/** + * Grid cache concurrent hash map self test. + */ +public class GridCacheConcurrentMapSelfTest extends GridCommonAbstractTest { + /** Ip finder. */ + private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); + + /** {@inheritDoc} */ + @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { + IgniteConfiguration cfg = super.getConfiguration(gridName); + + CacheConfiguration cc = defaultCacheConfiguration(); + + cc.setCacheMode(LOCAL); + cc.setWriteSynchronizationMode(FULL_SYNC); + cc.setStartSize(4); + + TcpDiscoverySpi disco = new TcpDiscoverySpi(); + + disco.setIpFinder(ipFinder); + + cfg.setDiscoverySpi(disco); + + cfg.setCacheConfiguration(cc); + + return cfg; + } + + /** {@inheritDoc} */ + @Override protected void beforeTest() throws Exception { + startGrid(); + } + + /** {@inheritDoc} */ + @Override protected void afterTest() throws Exception { + stopAllGrids(); + } + + /** + * @throws Exception If failed. + */ + public void testRehash() throws Exception { + GridCache<Integer, String> c = grid().cache(null); + + int cnt = 100 * 1024; + + for (int i = 0; i < cnt; i++) { + c.put(i, Integer.toString(i)); + + if (i > 0 && i % 50000 == 0) + info(">>> " + i + " puts completed"); + } + + for (int i = 0; i < cnt; i++) + assertEquals(Integer.toString(i), c.get(i)); + + assertEquals(cnt, c.size()); + + int idx = 0; + + for (GridCacheEntry<Integer, String> e : c.entrySet()) { + assertNotNull(e.peek()); + + idx++; + } + + assertEquals(cnt, idx); + } + + /** + * @throws Exception If failed. + */ + public void testRehashRandom() throws Exception { + GridCache<Integer, String> c = grid().cache(null); + + int cnt = 100 * 1024; + + Random rnd = new Random(); + + Map<Integer, String> puts = new HashMap<>(); + + for (int i = 0; i < cnt * 2; i++) { + int key = rnd.nextInt(cnt); + + c.put(key, Integer.toString(key)); + + puts.put(key, Integer.toString(key)); + + if (i > 0 && i % 50000 == 0) + info(">>> " + i + " puts completed"); + } + + for (Integer key : puts.keySet()) + assertEquals(Integer.toString(key), c.get(key)); + + assertEquals(puts.size(), c.size()); + + int idx = 0; + + for (GridCacheEntry<Integer, String> e : c.entrySet()) { + assertNotNull(e.peek()); + + idx++; + } + + assertEquals(puts.size(), idx); + } + + /** + * @throws Exception If failed. + */ + public void testRehashMultithreaded1() throws Exception { + final AtomicInteger tidGen = new AtomicInteger(); + + final Random rand = new Random(); + + final int cnt = 100 * 1024; + + multithreaded(new Callable<Object>() { + @SuppressWarnings("UnusedAssignment") + @Override public Object call() throws Exception { + GridCache<Integer, String> c = grid().cache(null); + + int tid = tidGen.getAndIncrement(); + + int start = 2 * 1024 * tid; + + Iterator<String> it1 = null; + Iterator<GridCacheEntry<Integer, String>> it2 = null; + Iterator<Integer> it3 = null; + + boolean created = false; + + for (int i = start; i < start + cnt; i++) { + int key = i % cnt; + + if (!created && i >= start + tid * 100) { + if (it1 == null) + it1 = c.values().iterator(); + + if (it2 == null) + it2 = c.entrySet().iterator(); + + if (it3 == null) + it3 = c.keySet().iterator(); + + created = true; + } + + c.put(key, Integer.toString(key)); + + c.get(rand.nextInt(cnt)); + } + + // Go through iterators. + while(it1.hasNext()) + it1.next(); + + while(it2.hasNext()) + it2.next(); + + while(it3.hasNext()) + it3.next(); + + // Make sure that hard references are gone. + it1 = null; + it2 = null; + it3 = null; + + for (int i = start; i < start + cnt; i++) { + int key = i % cnt; + + assertEquals(Integer.toString(key), c.get(key)); + } + + assertEquals(cnt, c.size()); + + int idx = 0; + + for (GridCacheEntry<Integer, String> e : c.entrySet()) { + assertNotNull(e.peek()); + + idx++; + } + + assertEquals(cnt, idx); + + System.gc(); + + return null; + } + }, 10); + + cache().get(rand.nextInt(cnt)); + + System.gc(); + + Thread.sleep(1000); + + cache().get(rand.nextInt(cnt)); + + assertEquals(0, local().map.iteratorMapSize()); + } + + /** + * @throws Exception If failed. + */ + public void testRehashMultithreaded2() throws Exception { + final AtomicInteger tidGen = new AtomicInteger(0); + + final Random rand = new Random(); + + final int cnt = 100 * 1024; + + multithreaded(new Callable<Object>() { + @SuppressWarnings("UnusedAssignment") + @Override public Object call() throws Exception { + GridCache<Integer, String> c = grid().cache(null); + + int tid = tidGen.getAndIncrement(); + + int start = 2 * 1024 * tid; + + Iterator<String> it1 = null; + Iterator<GridCacheEntry<Integer, String>> it2 = null; + Iterator<Integer> it3 = null; + + boolean forgot = false; + + for (int i = start; i < start + cnt; i++) { + int key = i % cnt; + + if (!forgot && i >= start + tid * 100) { + if (it1 == null) + it1 = c.values().iterator(); + + if (it2 == null) + it2 = c.entrySet().iterator(); + + if (it3 == null) + it3 = c.keySet().iterator(); + } + + c.put(key, Integer.toString(key)); + + c.get(rand.nextInt(cnt)); + + if (!forgot && i == cnt) { + info("Forgetting iterators [it1=" + it1 + ", it2=" + it2 + ", it3=" + it3 + ']'); + + // GC + it1 = null; + it2 = null; + it3 = null; + + forgot = true; + } + } + + // Make sure that hard references are gone. + it1 = null; + it2 = null; + it3 = null; + + for (int i = start; i < start + cnt; i++) { + int key = i % cnt; + + assertEquals(Integer.toString(key), c.get(key)); + } + + assertEquals(cnt, c.size()); + + int idx = 0; + + for (GridCacheEntry<Integer, String> e : c.entrySet()) { + assertNotNull(e.peek()); + + idx++; + } + + assertEquals(cnt, idx); + + System.gc(); + + return null; + } + }, 10); + + cache().get(rand.nextInt(cnt)); + + System.gc(); + + Thread.sleep(1000); + + cache().get(rand.nextInt(cnt)); + + assertEquals(0, local().map.iteratorMapSize()); + } + + /** + * @throws Exception If failed. + */ + @SuppressWarnings("ResultOfObjectAllocationIgnored") + public void testEmptyWeakIterator() throws Exception { + final GridCache<Integer, String> c = grid().cache(null); + + for (int i = 0; i < 100; i++) { + multithreaded(new Callable<Object>() { + @SuppressWarnings("UnusedAssignment") + @Override public Object call() throws Exception { + Iterator<String> it1 = c.values().iterator(); + Iterator<GridCacheEntry<Integer, String>> it2 = c.entrySet().iterator(); + Iterator<Integer> it3 = c.keySet().iterator(); + + for (int i = 0; i < 1000; i++) { + c.put(i, String.valueOf(i)); + + if (i == 0) { + it1.hasNext(); + it2.hasNext(); + it3.hasNext(); + } + } + + // Make sure that hard references are gone. + it1 = null; + it2 = null; + it3 = null; + + System.gc(); + + return null; + } + }, 10); + + for (int r = 0; r < 10; r++) { + System.gc(); + + c.get(100); + + if (local().map.iteratorMapSize() == 0) + break; + else + U.sleep(500); + } + + assertEquals(0, local().map.iteratorMapSize()); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryMemorySizeSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryMemorySizeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryMemorySizeSelfTest.java new file mode 100644 index 0000000..ae89830 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryMemorySizeSelfTest.java @@ -0,0 +1,315 @@ +/* + * 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.*; +import org.apache.ignite.cache.*; +import org.apache.ignite.configuration.*; +import org.apache.ignite.internal.processors.cache.*; +import org.apache.ignite.marshaller.*; +import org.apache.ignite.marshaller.optimized.*; +import org.apache.ignite.spi.discovery.tcp.*; +import org.apache.ignite.spi.discovery.tcp.ipfinder.*; +import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; +import org.apache.ignite.internal.processors.cache.distributed.dht.*; +import org.apache.ignite.internal.processors.cache.distributed.near.*; +import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.testframework.junits.common.*; + +import java.io.*; +import java.lang.reflect.*; +import java.util.*; + +import static org.apache.ignite.cache.GridCacheAtomicityMode.*; +import static org.apache.ignite.cache.GridCacheDistributionMode.*; +import static org.apache.ignite.cache.GridCacheMode.*; + +/** + * Tests from {@link GridCacheEntry#memorySize()} method. + */ +public class GridCacheEntryMemorySizeSelfTest extends GridCommonAbstractTest { + /** IP finder. */ + private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); + + /** Null reference size (optimized marshaller writes one byte for null reference). */ + private static final int NULL_REF_SIZE = 1; + + /** Entry overhead. */ + private static final int ENTRY_OVERHEAD; + + /** Replicated entry overhead. */ + private static final int REPLICATED_ENTRY_OVERHEAD; + + /** DHT entry overhead. */ + private static final int DHT_ENTRY_OVERHEAD; + + /** Near entry overhead. */ + private static final int NEAR_ENTRY_OVERHEAD; + + /** Reader size. */ + private static final int READER_SIZE = 24; + + /** Key size in bytes. */ + private static final int KEY_SIZE; + + /** 1KB value size in bytes. */ + private static final int ONE_KB_VAL_SIZE; + + /** 2KB value size in bytes. */ + private static final int TWO_KB_VAL_SIZE; + + /** + * + */ + static { + try { + ENTRY_OVERHEAD = U.<Integer>staticField(GridCacheMapEntry.class, "SIZE_OVERHEAD"); + DHT_ENTRY_OVERHEAD = U.<Integer>staticField(GridDhtCacheEntry.class, "DHT_SIZE_OVERHEAD"); + NEAR_ENTRY_OVERHEAD = U.<Integer>staticField(GridNearCacheEntry.class, "NEAR_SIZE_OVERHEAD"); + REPLICATED_ENTRY_OVERHEAD = DHT_ENTRY_OVERHEAD; + + IgniteMarshaller marsh = new IgniteOptimizedMarshaller(); + + KEY_SIZE = marsh.marshal(1).length; + ONE_KB_VAL_SIZE = marsh.marshal(new Value(new byte[1024])).length; + TWO_KB_VAL_SIZE = marsh.marshal(new Value(new byte[2048])).length; + } + catch (IgniteCheckedException e) { + throw new IgniteException(e); + } + } + + /** Cache mode. */ + private GridCacheMode mode; + + /** Near cache enabled flag. */ + private boolean nearEnabled; + + /** {@inheritDoc} */ + @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { + IgniteConfiguration cfg = super.getConfiguration(gridName); + + CacheConfiguration cacheCfg = defaultCacheConfiguration(); + + cacheCfg.setCacheMode(mode); + cacheCfg.setDistributionMode(nearEnabled ? NEAR_PARTITIONED : PARTITIONED_ONLY); + cacheCfg.setWriteSynchronizationMode(GridCacheWriteSynchronizationMode.FULL_SYNC); + cacheCfg.setAtomicityMode(TRANSACTIONAL); + + if (mode == PARTITIONED) + cacheCfg.setBackups(0); + + cfg.setCacheConfiguration(cacheCfg); + + TcpDiscoverySpi disco = new TcpDiscoverySpi(); + + disco.setIpFinder(IP_FINDER); + + cfg.setDiscoverySpi(disco); + + return cfg; + } + + /** @throws Exception If failed. */ + public void testLocal() throws Exception { + mode = LOCAL; + + try { + GridCache<Integer, Value> cache = startGrid().cache(null); + + assertTrue(cache.putx(1, new Value(new byte[1024]))); + assertTrue(cache.putx(2, new Value(new byte[2048]))); + + assertEquals(KEY_SIZE + NULL_REF_SIZE + ENTRY_OVERHEAD + extrasSize(cache.entry(0)), + cache.entry(0).memorySize()); + assertEquals(KEY_SIZE + ONE_KB_VAL_SIZE + ENTRY_OVERHEAD + extrasSize(cache.entry(1)), + cache.entry(1).memorySize()); + assertEquals(KEY_SIZE + TWO_KB_VAL_SIZE + ENTRY_OVERHEAD + extrasSize(cache.entry(2)), + cache.entry(2).memorySize()); + } + finally { + stopAllGrids(); + } + } + + /** @throws Exception If failed. */ + public void testReplicated() throws Exception { + mode = REPLICATED; + + try { + GridCache<Integer, Value> cache = startGrid().cache(null); + + assertTrue(cache.putx(1, new Value(new byte[1024]))); + assertTrue(cache.putx(2, new Value(new byte[2048]))); + + assertEquals(KEY_SIZE + NULL_REF_SIZE + ENTRY_OVERHEAD + REPLICATED_ENTRY_OVERHEAD + + extrasSize(cache.entry(0)), cache.entry(0).memorySize()); + assertEquals(KEY_SIZE + ONE_KB_VAL_SIZE + ENTRY_OVERHEAD + REPLICATED_ENTRY_OVERHEAD + + extrasSize(cache.entry(1)), cache.entry(1).memorySize()); + assertEquals(KEY_SIZE + TWO_KB_VAL_SIZE + ENTRY_OVERHEAD + REPLICATED_ENTRY_OVERHEAD + + extrasSize(cache.entry(2)), cache.entry(2).memorySize()); + } + finally { + stopAllGrids(); + } + } + + /** @throws Exception If failed. */ + public void testPartitionedNearEnabled() throws Exception { + mode = PARTITIONED; + nearEnabled = true; + + try { + startGridsMultiThreaded(2); + + int[] keys = new int[3]; + + int key = 0; + + for (int i = 0; i < keys.length; i++) { + while (true) { + key++; + + if (grid(0).mapKeyToNode(null, key).equals(grid(0).localNode())) { + if (i > 0) + assertTrue(cache(0).putx(key, new Value(new byte[i * 1024]))); + + keys[i] = key; + + break; + } + } + } + + // Create near entries. + assertNotNull(cache(1).get(keys[1])); + assertNotNull(cache(1).get(keys[2])); + + assertEquals(KEY_SIZE + NULL_REF_SIZE + ENTRY_OVERHEAD + DHT_ENTRY_OVERHEAD + + extrasSize(cache(0).entry(keys[0])), cache(0).entry(keys[0]).memorySize()); + assertEquals(KEY_SIZE + ONE_KB_VAL_SIZE + ENTRY_OVERHEAD + DHT_ENTRY_OVERHEAD + READER_SIZE + + extrasSize(cache(0).entry(keys[1])), cache(0).entry(keys[1]).memorySize()); + assertEquals(KEY_SIZE + TWO_KB_VAL_SIZE + ENTRY_OVERHEAD + DHT_ENTRY_OVERHEAD + READER_SIZE + + extrasSize(cache(0).entry(keys[2])), cache(0).entry(keys[2]).memorySize()); + + assertEquals(KEY_SIZE + NULL_REF_SIZE + ENTRY_OVERHEAD + NEAR_ENTRY_OVERHEAD + + extrasSize(cache(1).entry(keys[0])), cache(1).entry(keys[0]).memorySize()); + assertEquals(KEY_SIZE + ONE_KB_VAL_SIZE + ENTRY_OVERHEAD + NEAR_ENTRY_OVERHEAD + + extrasSize(cache(1).entry(keys[1])), cache(1).entry(keys[1]).memorySize()); + assertEquals(KEY_SIZE + TWO_KB_VAL_SIZE + ENTRY_OVERHEAD + NEAR_ENTRY_OVERHEAD + + extrasSize(cache(1).entry(keys[2])), cache(1).entry(keys[2]).memorySize()); + } + finally { + stopAllGrids(); + } + } + + /** @throws Exception If failed. */ + public void testPartitionedNearDisabled() throws Exception { + mode = PARTITIONED; + nearEnabled = false; + + try { + startGridsMultiThreaded(2); + + int[] keys = new int[3]; + + int key = 0; + + for (int i = 0; i < keys.length; i++) { + while (true) { + key++; + + if (grid(0).mapKeyToNode(null, key).equals(grid(0).localNode())) { + if (i > 0) + assertTrue(cache(0).putx(key, new Value(new byte[i * 1024]))); + + keys[i] = key; + + break; + } + } + } + + // Create near entries. + assertNotNull(cache(1).get(keys[1])); + assertNotNull(cache(1).get(keys[2])); + + assertEquals(KEY_SIZE + NULL_REF_SIZE + ENTRY_OVERHEAD + DHT_ENTRY_OVERHEAD + + extrasSize(cache(0).entry(keys[0])), cache(0).entry(keys[0]).memorySize()); + assertEquals(KEY_SIZE + ONE_KB_VAL_SIZE + ENTRY_OVERHEAD + DHT_ENTRY_OVERHEAD + + extrasSize(cache(0).entry(keys[1])), cache(0).entry(keys[1]).memorySize()); + assertEquals(KEY_SIZE + TWO_KB_VAL_SIZE + ENTRY_OVERHEAD + DHT_ENTRY_OVERHEAD + + extrasSize(cache(0).entry(keys[2])), cache(0).entry(keys[2]).memorySize()); + + // Do not test other node since there are no backups. + } + finally { + stopAllGrids(); + } + } + + /** + * Get entry extras size. + * + * @param entry Entry. + * @return Extras size. + * @throws Exception If failed. + */ + private int extrasSize(GridCacheEntry entry) throws Exception { + Method mthd = GridCacheMapEntry.class.getDeclaredMethod("extrasSize"); + + mthd.setAccessible(true); + + GridCacheContext ctx = U.field(entry, "ctx"); + + GridCacheEntryEx entry0 = ((GridCacheEntryImpl)entry).entryEx(false, ctx.discovery().topologyVersion()); + + return (Integer)mthd.invoke(entry0); + } + + /** Value. */ + @SuppressWarnings("UnusedDeclaration") + private static class Value implements Serializable { + /** Byte array. */ + private byte[] arr; + + /** @param arr Byte array. */ + private Value(byte[] arr) { + this.arr = arr; + } + + /** {@inheritDoc} */ + @Override public boolean equals(Object o) { + if (this == o) + return true; + + if (o == null || getClass() != o.getClass()) + return false; + + Value val = (Value)o; + + return Arrays.equals(arr, val.arr); + } + + /** {@inheritDoc} */ + @Override public int hashCode() { + return arr != null ? Arrays.hashCode(arr) : 0; + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccFlagsTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccFlagsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccFlagsTest.java new file mode 100644 index 0000000..da53fc9 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccFlagsTest.java @@ -0,0 +1,142 @@ +/* + * 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.cache.*; +import org.apache.ignite.configuration.*; +import org.apache.ignite.internal.*; +import org.apache.ignite.internal.processors.cache.*; +import org.apache.ignite.testframework.junits.common.*; + +import java.util.*; + +import static org.apache.ignite.cache.GridCacheMode.*; + +/** + * Tests flags correctness. + */ +public class GridCacheMvccFlagsTest extends GridCommonAbstractTest { + /** Grid. */ + private GridKernal grid; + + /** + * + */ + public GridCacheMvccFlagsTest() { + super(true /*start grid. */); + } + + /** {@inheritDoc} */ + @Override protected void beforeTest() throws Exception { + grid = (GridKernal)grid(); + } + + /** {@inheritDoc} */ + @Override protected void afterTest() throws Exception { + grid = null; + } + + /** {@inheritDoc} */ + @Override protected IgniteConfiguration getConfiguration() throws Exception { + IgniteConfiguration cfg = super.getConfiguration(); + + CacheConfiguration cacheCfg = defaultCacheConfiguration(); + + cacheCfg.setCacheMode(REPLICATED); + + cfg.setCacheConfiguration(cacheCfg); + + return cfg; + } + + /** + * + */ + public void testAllTrueFlags() { + GridCacheAdapter<String, String> cache = grid.internalCache(); + + GridCacheTestEntryEx<String, String> entry = new GridCacheTestEntryEx<>(cache.context(), "1"); + + UUID id = UUID.randomUUID(); + + GridCacheVersion ver = new GridCacheVersion(1, 0, 0, 0, 0); + + GridCacheMvccCandidate<String> c = new GridCacheMvccCandidate<>( + entry, + id, + id, + ver, + 1, + ver, + 0, + true, + true, + true, + true, + true, + true + ); + + c.setOwner(); + c.setReady(); + c.setUsed(); + + short flags = c.flags(); + + info("Candidate: " + c); + + for (GridCacheMvccCandidate.Mask mask : GridCacheMvccCandidate.Mask.values()) + assertTrue("Candidate: " + c, mask.get(flags)); + } + + /** + * + */ + public void testAllFalseFlags() { + GridCacheAdapter<String, String> cache = grid.internalCache(); + + GridCacheTestEntryEx<String, String> entry = new GridCacheTestEntryEx<>(cache.context(), "1"); + + UUID id = UUID.randomUUID(); + + GridCacheVersion ver = new GridCacheVersion(1, 0, 0, 0, 0); + + GridCacheMvccCandidate<String> c = new GridCacheMvccCandidate<>( + entry, + id, + id, + ver, + 1, + ver, + 0, + false, + false, + false, + false, + false, + false + ); + + short flags = c.flags(); + + info("Candidate: " + c); + + for (GridCacheMvccCandidate.Mask mask : GridCacheMvccCandidate.Mask.values()) + assertFalse("Mask check failed [mask=" + mask + ", c=" + c + ']', mask.get(flags)); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java new file mode 100644 index 0000000..a61c24c --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java @@ -0,0 +1,821 @@ +/* + * 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.*; +import org.apache.ignite.cache.*; +import org.apache.ignite.internal.processors.cache.*; +import org.apache.ignite.lang.*; +import org.apache.ignite.internal.processors.cache.transactions.*; +import org.apache.ignite.internal.processors.dr.*; +import org.apache.ignite.internal.util.lang.*; +import org.apache.ignite.internal.util.typedef.*; +import org.jetbrains.annotations.*; + +import javax.cache.expiry.*; +import javax.cache.processor.*; +import java.util.*; + +/** + * Test entry. + */ +public class GridCacheTestEntryEx<K, V> extends GridMetadataAwareAdapter implements GridCacheEntryEx<K, V> { + /** Key. */ + private K key; + + /** Val. */ + private V val; + + /** TTL. */ + private long ttl; + + /** Version. */ + private GridCacheVersion ver = new GridCacheVersion(0, 0, 0, 1, 0); + + /** Obsolete version. */ + private GridCacheVersion obsoleteVer = ver; + + /** MVCC. */ + private GridCacheMvcc<K> mvcc; + + /** + * @param ctx Context. + * @param key Key. + */ + public GridCacheTestEntryEx(GridCacheContext<K, V> ctx, K key) { + mvcc = new GridCacheMvcc<>(ctx); + + this.key = key; + } + + /** + * @param ctx Context. + * @param key Key. + * @param val Value. + */ + public GridCacheTestEntryEx(GridCacheContext<K, V> ctx, K key, V val) { + mvcc = new GridCacheMvcc<>(ctx); + + this.key = key; + this.val = val; + } + + /** {@inheritDoc} */ + @Override public int memorySize() throws IgniteCheckedException { + return 1024; + } + + /** {@inheritDoc} */ + @Override public boolean isInternal() { + return key instanceof GridCacheInternal; + } + + /** {@inheritDoc} */ + @Override public boolean isDht() { + return false; + } + + /** {@inheritDoc} */ + @Override public boolean isNear() { + return false; + } + + /** {@inheritDoc} */ + @Override public boolean isReplicated() { + return false; + } + + /** {@inheritDoc} */ + @Override public boolean isLocal() { + return false; + } + + /** {@inheritDoc} */ + @Override public boolean detached() { + return false; + } + + /** {@inheritDoc} */ + @Nullable @Override public GridCacheContext<K, V> context() { + return null; + } + + /** {@inheritDoc} */ + @Nullable @Override public GridCacheEntry<K, V> evictWrap() { + return null; + } + + /** {@inheritDoc} */ + @Override public int partition() { + return 0; + } + + /** {@inheritDoc} */ + @Override public boolean partitionValid() { + return true; + } + + /** + * @param threadId Thread ID. + * @param ver Lock version. + * @param timeout Lock acquisition timeout. + * @param reenter Reentry flag ({@code true} if reentry is allowed). + * @param tx Transaction flag. + * @return New lock candidate if lock was added, or current owner if lock was reentered, + * or <tt>null</tt> if lock was owned by another thread and timeout is negative. + */ + @Nullable public GridCacheMvccCandidate<K> addLocal( + long threadId, + GridCacheVersion ver, + long timeout, + boolean reenter, + boolean tx) { + return mvcc.addLocal( + this, + threadId, + ver, + timeout, + reenter, + tx, + false + ); + } + + /** + * Adds new lock candidate. + * + * @param nodeId Node ID. + * @param threadId Thread ID. + * @param ver Lock version. + * @param timeout Lock acquire timeout. + * @param ec Not used. + * @param tx Transaction flag. + * @return Remote candidate. + */ + public GridCacheMvccCandidate<K> addRemote(UUID nodeId, long threadId, GridCacheVersion ver, long timeout, + boolean ec, boolean tx) { + return mvcc.addRemote(this, nodeId, null, threadId, ver, timeout, tx, true, false); + } + + /** + * Adds new lock candidate. + * + * @param nodeId Node ID. + * @param threadId Thread ID. + * @param ver Lock version. + * @param timeout Lock acquire timeout. + * @param tx Transaction flag. + * @return Remote candidate. + */ + public GridCacheMvccCandidate<K> addNearLocal(UUID nodeId, long threadId, GridCacheVersion ver, long timeout, + boolean tx) { + return mvcc.addNearLocal(this, nodeId, null, threadId, ver, timeout, tx, true); + } + + /** + * + * @param baseVer Base version. + */ + public void salvageRemote(GridCacheVersion baseVer) { + mvcc.salvageRemote(baseVer); + } + + /** + * Moves completed candidates right before the base one. Note that + * if base is not found, then nothing happens and {@code false} is + * returned. + * + * @param baseVer Base version. + * @param committedVers Committed versions relative to base. + * @param rolledbackVers Rolled back versions relative to base. + * @return Lock owner. + */ + @Nullable public GridCacheMvccCandidate<K> orderCompleted(GridCacheVersion baseVer, + Collection<GridCacheVersion> committedVers, Collection<GridCacheVersion> rolledbackVers) { + return mvcc.orderCompleted(baseVer, committedVers, rolledbackVers); + } + + /** + * @param ver Version. + */ + public void doneRemote(GridCacheVersion ver) { + mvcc.doneRemote(ver, Collections.<GridCacheVersion>emptyList(), + Collections.<GridCacheVersion>emptyList(), Collections.<GridCacheVersion>emptyList()); + } + + /** + * @param baseVer Base version. + * @param owned Owned. + */ + public void orderOwned(GridCacheVersion baseVer, GridCacheVersion owned) { + mvcc.markOwned(baseVer, owned); + } + + /** + * @param ver Lock version to acquire or set to ready. + * @return Current owner. + */ + @Nullable public GridCacheMvccCandidate<K> readyLocal(GridCacheVersion ver) { + return mvcc.readyLocal(ver); + } + + /** + * @param ver Ready near lock version. + * @param mapped Mapped version. + * @param committedVers Committed versions. + * @param rolledbackVers Rolled back versions. + * @param pending Pending versions. + * @return Lock owner. + */ + @Nullable public GridCacheMvccCandidate<K> readyNearLocal(GridCacheVersion ver, GridCacheVersion mapped, + Collection<GridCacheVersion> committedVers, Collection<GridCacheVersion> rolledbackVers, + Collection<GridCacheVersion> pending) { + return mvcc.readyNearLocal(ver, mapped, committedVers, rolledbackVers, pending); + } + + /** + * @param cand Candidate to set to ready. + * @return Current owner. + */ + @Nullable public GridCacheMvccCandidate<K> readyLocal(GridCacheMvccCandidate<K> cand) { + return mvcc.readyLocal(cand); + } + + /** + * Local local release. + * @return Removed lock candidate or <tt>null</tt> if candidate was not removed. + */ + @Nullable public GridCacheMvccCandidate<K> releaseLocal() { + return releaseLocal(Thread.currentThread().getId()); + } + + /** + * Local release. + * + * @param threadId ID of the thread. + * @return Current owner. + */ + @Nullable public GridCacheMvccCandidate<K> releaseLocal(long threadId) { + return mvcc.releaseLocal(threadId); + } + + /** + * + */ + public void recheckLock() { + mvcc.recheck(); + } + + /** {@inheritDoc} */ + @Override public GridCacheEntryInfo<K, V> info() { + GridCacheEntryInfo<K, V> info = new GridCacheEntryInfo<>(); + + info.key(key()); + info.value(val); + info.ttl(ttl()); + info.expireTime(expireTime()); + info.keyBytes(keyBytes()); + info.valueBytes(valueBytes().getIfMarshaled()); + info.version(version()); + + return info; + } + + /** {@inheritDoc} */ + @Override public boolean valid(long topVer) { + return true; + } + + /** @inheritDoc */ + @Override public K key() { + return key; + } + + /** {@inheritDoc} */ + @Override public IgniteTxKey<K> txKey() { + return new IgniteTxKey<>(key, 0); + } + + /** @inheritDoc */ + @Override public V rawGet() { + return val; + } + + /** {@inheritDoc} */ + @Override public V rawGetOrUnmarshal(boolean tmp) throws IgniteCheckedException { + return val; + } + + /** {@inheritDoc} */ + @Override public boolean hasValue() { + return val != null; + } + + /** @inheritDoc */ + @Override public V rawPut(V val, long ttl) { + V old = this.val; + + this.ttl = ttl; + this.val = val; + + return old; + } + + /** @inheritDoc */ + @Override public GridCacheEntry<K, V> wrap(boolean prjAware) { + assert false; return null; + } + + /** {@inheritDoc} */ + @Override public GridCacheEntry<K, V> wrapFilterLocked() throws IgniteCheckedException { + assert false; return null; + } + + /** @inheritDoc */ + @Override public GridCacheVersion obsoleteVersion() { + return obsoleteVer; + } + + /** @inheritDoc */ + @Override public boolean obsolete() { + return obsoleteVer != null; + } + + /** {@inheritDoc} */ + @Override public boolean obsolete(GridCacheVersion exclude) { + return obsoleteVer != null && !obsoleteVer.equals(exclude); + } + + /** @inheritDoc */ + @Override public boolean invalidate(@Nullable GridCacheVersion curVer, GridCacheVersion newVer) + throws IgniteCheckedException { + assert false; return false; + } + + /** @inheritDoc */ + @Override public boolean invalidate(@Nullable IgnitePredicate<GridCacheEntry<K, V>>[] filter) + throws GridCacheEntryRemovedException, IgniteCheckedException { + assert false; return false; + } + + /** @inheritDoc */ + @Override public boolean compact(@Nullable IgnitePredicate<GridCacheEntry<K, V>>[] filter) + throws GridCacheEntryRemovedException, IgniteCheckedException { + assert false; return false; + } + + /** @inheritDoc */ + @Override public boolean evictInternal(boolean swap, GridCacheVersion obsoleteVer, + @Nullable IgnitePredicate<GridCacheEntry<K, V>>[] filter) { + assert false; return false; + } + + /** {@inheritDoc} */ + @Override public GridCacheBatchSwapEntry<K, V> evictInBatchInternal(GridCacheVersion obsoleteVer) + throws IgniteCheckedException { + assert false; return null; + } + + /** @inheritDoc */ + @Override public boolean isNew() { + assert false; return false; + } + + /** {@inheritDoc} */ + @Override public boolean isNewLocked() throws GridCacheEntryRemovedException { + assert false; return false; + } + + /** @inheritDoc */ + @Override public V innerGet(@Nullable IgniteTxEx<K, V> tx, + boolean readSwap, + boolean readThrough, + boolean failFast, + boolean unmarshal, + boolean updateMetrics, + boolean evt, + boolean tmp, + UUID subjId, + Object transformClo, + String taskName, + IgnitePredicate<GridCacheEntry<K, V>>[] filter, + @Nullable IgniteCacheExpiryPolicy expiryPlc) { + return val; + } + + /** @inheritDoc */ + @Override public V innerReload(IgnitePredicate<GridCacheEntry<K, V>>[] filter) { + return val; + } + + /** @inheritDoc */ + @Override public GridCacheUpdateTxResult<V> innerSet(@Nullable IgniteTxEx<K, V> tx, UUID evtNodeId, UUID affNodeId, + @Nullable V val, @Nullable byte[] valBytes, boolean writeThrough, boolean retval, long ttl, + boolean evt, boolean metrics, long topVer, IgnitePredicate<GridCacheEntry<K, V>>[] filter, GridDrType drType, + long drExpireTime, @Nullable GridCacheVersion drVer, UUID subjId, String taskName) throws IgniteCheckedException, + GridCacheEntryRemovedException { + return new GridCacheUpdateTxResult<>(true, rawPut(val, ttl)); + } + + /** {@inheritDoc} */ + @Override public GridTuple3<Boolean, V, EntryProcessorResult<Object>> innerUpdateLocal(GridCacheVersion ver, + GridCacheOperation op, + @Nullable Object writeObj, + @Nullable Object[] invokeArgs, + boolean writeThrough, + boolean retval, + @Nullable ExpiryPolicy expiryPlc, + boolean evt, + boolean metrics, + @Nullable IgnitePredicate<GridCacheEntry<K, V>>[] filter, + boolean intercept, + UUID subjId, + String taskName) + throws IgniteCheckedException, GridCacheEntryRemovedException { + return new GridTuple3<>(false, null, null); + } + + /** {@inheritDoc} */ + @Override public GridCacheUpdateAtomicResult<K, V> innerUpdate( + GridCacheVersion ver, + UUID evtNodeId, + UUID affNodeId, + GridCacheOperation op, + @Nullable Object val, + @Nullable byte[] valBytes, + @Nullable Object[] invokeArgs, + boolean writeThrough, + boolean retval, + @Nullable IgniteCacheExpiryPolicy expiryPlc, + boolean evt, + boolean metrics, + boolean primary, + boolean checkVer, + @Nullable IgnitePredicate<GridCacheEntry<K, V>>[] filter, + GridDrType drType, + long drTtl, + long drExpireTime, + @Nullable GridCacheVersion drVer, + boolean drResolve, + boolean intercept, + UUID subjId, + String taskName) throws IgniteCheckedException, + GridCacheEntryRemovedException { + return new GridCacheUpdateAtomicResult<>(true, + rawPut((V)val, 0), + (V)val, + null, + 0L, + 0L, + null, + null, + true); + } + + /** @inheritDoc */ + @Override public GridCacheUpdateTxResult<V> innerRemove(@Nullable IgniteTxEx<K, V> tx, UUID evtNodeId, + UUID affNodeId, boolean writeThrough, boolean retval, boolean evt, boolean metrics, long topVer, + IgnitePredicate<GridCacheEntry<K, V>>[] filter, GridDrType drType, @Nullable GridCacheVersion drVer, UUID subjId, + String taskName) + throws IgniteCheckedException, GridCacheEntryRemovedException { + obsoleteVer = ver; + + V old = val; + + val = null; + + return new GridCacheUpdateTxResult<>(true, old); + } + + /** @inheritDoc */ + @Override public boolean clear(GridCacheVersion ver, boolean readers, + @Nullable IgnitePredicate<GridCacheEntry<K, V>>[] filter) throws IgniteCheckedException { + if (ver == null || ver.equals(this.ver)) { + val = null; + + return true; + } + + return false; + } + + /** @inheritDoc */ + @Override public boolean tmLock(IgniteTxEx<K, V> tx, long timeout) { + assert false; return false; + } + + /** @inheritDoc */ + @Override public void txUnlock(IgniteTxEx<K, V> tx) { + assert false; + } + + /** @inheritDoc */ + @Override public boolean removeLock(GridCacheVersion ver) { + GridCacheMvccCandidate<K> doomed = mvcc.candidate(ver); + + mvcc.remove(ver); + + return doomed != null; + } + + /** @inheritDoc */ + @Override public boolean markObsolete(GridCacheVersion ver) { + if (ver == null || ver.equals(obsoleteVer)) { + obsoleteVer = ver; + + val = null; + + return true; + } + + return false; + } + + /** {@inheritDoc} */ + @Override public void onMarkedObsolete() { + // No-op. + } + + /** {@inheritDoc} */ + @Override public boolean markObsoleteIfEmpty(GridCacheVersion ver) { + if (val == null) + obsoleteVer = ver; + + return obsoleteVer != null; + } + + /** {@inheritDoc} */ + @Override public boolean markObsoleteVersion(GridCacheVersion ver) { + if (this.ver.equals(ver)) { + obsoleteVer = ver; + + return true; + } + + return false; + } + + /** @inheritDoc */ + @Override public byte[] keyBytes() { + assert false; return null; + } + + /** @inheritDoc */ + @Override public byte[] getOrMarshalKeyBytes() { + assert false; return null; + } + + /** @inheritDoc */ + @Override public GridCacheVersion version() { + return ver; + } + + /** @inheritDoc */ + @Override public V peek(GridCachePeekMode mode, IgnitePredicate<GridCacheEntry<K, V>>[] filter) { + return val; + } + + /** @inheritDoc */ + @Override public GridTuple<V> peek0(boolean failFast, GridCachePeekMode mode, + IgnitePredicate<GridCacheEntry<K, V>>[] filter, IgniteTxEx<K, V> tx) + throws GridCacheEntryRemovedException, GridCacheFilterFailedException, IgniteCheckedException { + return F.t(val); + } + + /** @inheritDoc */ + @Override public V peek(Collection<GridCachePeekMode> modes, IgnitePredicate<GridCacheEntry<K, V>>[] filter) + throws GridCacheEntryRemovedException { + return val; + } + + /** @inheritDoc */ + @Override public V peekFailFast(GridCachePeekMode mode, + IgnitePredicate<GridCacheEntry<K, V>>[] filter) { + assert false; return null; + } + + /** {@inheritDoc} */ + @Override public V poke(V val) throws GridCacheEntryRemovedException, IgniteCheckedException { + V old = this.val; + + this.val = val; + + return old; + } + + /** @inheritDoc */ + @Override public boolean initialValue(V val, @Nullable byte[] valBytes, GridCacheVersion ver, long ttl, + long expireTime, boolean preload, long topVer, GridDrType drType) throws IgniteCheckedException, + GridCacheEntryRemovedException { + assert false; return false; + } + + /** @inheritDoc */ + @Override public boolean initialValue(K key, GridCacheSwapEntry<V> unswapped) { + assert false; return false; + } + + /** @inheritDoc */ + @Override public boolean versionedValue(V val, GridCacheVersion curVer, GridCacheVersion newVer) { + assert false; return false; + } + + /** @inheritDoc */ + @Override public boolean hasLockCandidate(GridCacheVersion ver) { + return mvcc.hasCandidate(ver); + } + + /** @inheritDoc */ + @Override public boolean lockedByAny(GridCacheVersion... exclude) { + return !mvcc.isEmpty(exclude); + } + + /** @inheritDoc */ + @Override public boolean lockedByThread() { + return lockedByThread(Thread.currentThread().getId()); + } + + /** @inheritDoc */ + @Override public boolean lockedLocally(GridCacheVersion lockVer) { + return mvcc.isLocallyOwned(lockVer); + } + + /** {@inheritDoc} */ + @Override public boolean lockedLocallyByIdOrThread(GridCacheVersion lockVer, long threadId) + throws GridCacheEntryRemovedException { + return lockedLocally(lockVer) || lockedByThread(threadId); + } + + /** @inheritDoc */ + @Override public boolean lockedByThread(long threadId, GridCacheVersion exclude) { + return mvcc.isLocallyOwnedByThread(threadId, false, exclude); + } + + /** @inheritDoc */ + @Override public boolean lockedByThread(long threadId) { + return mvcc.isLocallyOwnedByThread(threadId, true); + } + + /** @inheritDoc */ + @Override public boolean lockedBy(GridCacheVersion ver) { + return mvcc.isOwnedBy(ver); + } + + /** @inheritDoc */ + @Override public boolean lockedByThreadUnsafe(long threadId) { + return mvcc.isLocallyOwnedByThread(threadId, true); + } + + /** @inheritDoc */ + @Override public boolean lockedByUnsafe(GridCacheVersion ver) { + return mvcc.isOwnedBy(ver); + } + + /** @inheritDoc */ + @Override public boolean lockedLocallyUnsafe(GridCacheVersion lockVer) { + return mvcc.isLocallyOwned(lockVer); + } + + /** @inheritDoc */ + @Override public boolean hasLockCandidateUnsafe(GridCacheVersion ver) { + return mvcc.hasCandidate(ver); + } + + /** @inheritDoc */ + @Override public Collection<GridCacheMvccCandidate<K>> localCandidates(GridCacheVersion... exclude) { + return mvcc.localCandidates(exclude); + } + + /** @inheritDoc */ + public Collection<GridCacheMvccCandidate<K>> localCandidates(boolean reentries, GridCacheVersion... exclude) { + return mvcc.localCandidates(reentries, exclude); + } + + /** @inheritDoc */ + @Override public Collection<GridCacheMvccCandidate<K>> remoteMvccSnapshot(GridCacheVersion... exclude) { + return mvcc.remoteCandidates(exclude); + } + + /** {@inheritDoc} */ + @Override public GridCacheMvccCandidate<K> localCandidate(long threadId) throws GridCacheEntryRemovedException { + return mvcc.localCandidate(threadId); + } + + /** @inheritDoc */ + @Override public GridCacheMvccCandidate<K> candidate(GridCacheVersion ver) { + return mvcc.candidate(ver); + } + + /** {@inheritDoc} */ + @Override public GridCacheMvccCandidate<K> candidate(UUID nodeId, long threadId) + throws GridCacheEntryRemovedException { + return mvcc.remoteCandidate(nodeId, threadId); + } + + /** + * @return Any MVCC owner. + */ + public GridCacheMvccCandidate<K> anyOwner() { + return mvcc.anyOwner(); + } + + /** @inheritDoc */ + @Override public GridCacheMvccCandidate<K> localOwner() { + return mvcc.localOwner(); + } + + /** @inheritDoc */ + @Override public void keyBytes(byte[] keyBytes) { + assert false; + } + + /** @inheritDoc */ + @Override public GridCacheValueBytes valueBytes() { + assert false; return GridCacheValueBytes.nil(); + } + + /** @inheritDoc */ + @Override public GridCacheValueBytes valueBytes(GridCacheVersion ver) { + assert false; return GridCacheValueBytes.nil(); + } + + /** {@inheritDoc} */ + @Override public long rawExpireTime() { + return 0; + } + + /** @inheritDoc */ + @Override public long expireTime() { + return 0; + } + + /** {@inheritDoc} */ + @Override public long expireTimeUnlocked() { + return 0; + } + + /** {@inheritDoc} */ + @Override public boolean onTtlExpired(GridCacheVersion obsoleteVer) { + return false; + } + + /** {@inheritDoc} */ + @Override public long rawTtl() { + return ttl; + } + + /** @inheritDoc */ + @Override public long ttl() { + return ttl; + } + + /** @inheritDoc */ + @Override public void updateTtl(GridCacheVersion ver, long ttl) { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public V unswap() throws IgniteCheckedException { + return null; + } + + /** {@inheritDoc} */ + @Override public V unswap(boolean ignoreFlags, boolean needVal) throws IgniteCheckedException { + return null; + } + + /** {@inheritDoc} */ + @Override public boolean hasLockCandidate(long threadId) throws GridCacheEntryRemovedException { + return localCandidate(threadId) != null; + } + + /** {@inheritDoc} */ + @Override public boolean deleted() { + return false; + } + + /** {@inheritDoc} */ + @Override public boolean obsoleteOrDeleted() { + return false; + } + + /** {@inheritDoc} */ + @Override public long startVersion() { + return 0; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStoreAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStoreAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStoreAbstractSelfTest.java new file mode 100644 index 0000000..27e09c0 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStoreAbstractSelfTest.java @@ -0,0 +1,191 @@ +/* + * 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.internal.processors.cache.*; +import org.apache.ignite.lang.*; +import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.testframework.junits.common.*; +import org.gridgain.grid.kernal.processors.cache.*; + +import java.util.*; +import java.util.concurrent.*; +import java.util.concurrent.atomic.*; + +/** + * Harness for {@link GridCacheWriteBehindStore} tests. + */ +public abstract class GridCacheWriteBehindStoreAbstractSelfTest extends GridCommonAbstractTest { + /** Write cache size. */ + public static final int CACHE_SIZE = 1024; + + /** Value dump interval. */ + public static final int FLUSH_FREQUENCY = 1000; + + /** Underlying store. */ + protected GridCacheTestStore delegate = new GridCacheTestStore(); + + /** Tested store. */ + protected GridCacheWriteBehindStore<Integer, String> store; + + /** {@inheritDoc} */ + @Override protected void afterTestsStopped() throws Exception { + delegate = null; + store = null; + + super.afterTestsStopped(); + } + + /** + * Initializes store. + * + * @param flushThreadCnt Count of flush threads + * @throws Exception If failed. + */ + protected void initStore(int flushThreadCnt) throws Exception { + store = new GridCacheWriteBehindStore<>("", "", log, delegate); + + store.setFlushFrequency(FLUSH_FREQUENCY); + + store.setFlushSize(CACHE_SIZE); + + store.setFlushThreadCount(flushThreadCnt); + + delegate.reset(); + + store.start(); + } + + /** + * Shutdowns store. + * + * @throws Exception If failed. + */ + protected void shutdownStore() throws Exception { + store.stop(); + + assertTrue("Store cache must be empty after shutdown", store.writeCache().isEmpty()); + } + + /** + * Performs multiple put, get and remove operations in several threads on a store. After + * all threads finished their operations, returns the total set of keys that should be + * in underlying store. + * + * @param threadCnt Count of threads that should update keys. + * @param keysPerThread Count of unique keys assigned to a thread. + * @return Set of keys that was totally put in store. + * @throws Exception If failed. + */ + protected Set<Integer> runPutGetRemoveMultithreaded(int threadCnt, final int keysPerThread) throws Exception { + final ConcurrentMap<String, Set<Integer>> perThread = new ConcurrentHashMap<>(); + + final AtomicBoolean running = new AtomicBoolean(true); + + final AtomicInteger cntr = new AtomicInteger(); + + final AtomicInteger operations = new AtomicInteger(); + + IgniteFuture<?> fut = multithreadedAsync(new Runnable() { + @SuppressWarnings({"NullableProblems"}) + @Override public void run() { + // Initialize key set for this thread. + Set<Integer> set = new HashSet<>(); + + Set<Integer> old = perThread.putIfAbsent(Thread.currentThread().getName(), set); + + if (old != null) + set = old; + + List<Integer> original = new ArrayList<>(); + + Random rnd = new Random(); + + for (int i = 0; i < keysPerThread; i++) + original.add(cntr.getAndIncrement()); + + try { + while (running.get()) { + int op = rnd.nextInt(3); + int idx = rnd.nextInt(keysPerThread); + + int key = original.get(idx); + + switch (op) { + case 0: + store.write(new CacheEntryImpl<>(key, "val" + key)); + set.add(key); + + operations.incrementAndGet(); + + break; + + case 1: + store.delete(key); + set.remove(key); + + operations.incrementAndGet(); + + break; + + case 2: + default: + store.write(new CacheEntryImpl<>(key, "broken")); + + String val = store.load(key); + + assertEquals("Invalid intermediate value: " + val, "broken", val); + + store.write(new CacheEntryImpl<>(key, "val" + key)); + + set.add(key); + + // 2 put operations performed here. + operations.incrementAndGet(); + operations.incrementAndGet(); + operations.incrementAndGet(); + + break; + } + } + } + catch (Exception e) { + error("Unexpected exception in put thread", e); + + assert false; + } + } + }, threadCnt, "put"); + + U.sleep(10000); + + running.set(false); + + fut.get(); + + log().info(">>> " + operations + " operations performed totally"); + + Set<Integer> total = new HashSet<>(); + + for (Set<Integer> threadVals : perThread.values()) { + total.addAll(threadVals); + } + + return total; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractPartitionedOnlyByteArrayValuesSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractPartitionedOnlyByteArrayValuesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractPartitionedOnlyByteArrayValuesSelfTest.java index 4e95880..08ed107 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractPartitionedOnlyByteArrayValuesSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractPartitionedOnlyByteArrayValuesSelfTest.java @@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.cache.distributed.dht; import org.apache.ignite.cache.*; import org.apache.ignite.configuration.*; +import org.apache.ignite.internal.processors.cache.distributed.*; import org.apache.ignite.spi.swapspace.file.*; import static org.apache.ignite.cache.GridCacheAtomicWriteOrderMode.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicExpiredEntriesPreloadSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicExpiredEntriesPreloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicExpiredEntriesPreloadSelfTest.java index 34cdf21..afc34ef 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicExpiredEntriesPreloadSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicExpiredEntriesPreloadSelfTest.java @@ -18,6 +18,7 @@ package org.apache.ignite.internal.processors.cache.distributed.dht; import org.apache.ignite.cache.*; +import org.apache.ignite.internal.processors.cache.distributed.*; import static org.apache.ignite.cache.GridCacheAtomicityMode.*; import static org.apache.ignite.cache.GridCacheMode.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicReloadAllSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicReloadAllSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicReloadAllSelfTest.java index f9fa4e3..a0e0f17 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicReloadAllSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicReloadAllSelfTest.java @@ -18,6 +18,7 @@ package org.apache.ignite.internal.processors.cache.distributed.dht; import org.apache.ignite.cache.*; +import org.apache.ignite.internal.processors.cache.distributed.*; import static org.apache.ignite.cache.GridCacheAtomicityMode.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheClientOnlySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheClientOnlySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheClientOnlySelfTest.java index 621001b..4434179 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheClientOnlySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheClientOnlySelfTest.java @@ -18,6 +18,7 @@ package org.apache.ignite.internal.processors.cache.distributed.dht; import org.apache.ignite.cache.*; +import org.apache.ignite.internal.processors.cache.distributed.*; import static org.apache.ignite.cache.GridCacheDistributionMode.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedPreloadRestartSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedPreloadRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedPreloadRestartSelfTest.java index 40b4756..e017284 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedPreloadRestartSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedPreloadRestartSelfTest.java @@ -17,6 +17,8 @@ package org.apache.ignite.internal.processors.cache.distributed.dht; +import org.apache.ignite.internal.processors.cache.distributed.*; + /** * Colocated preload restart test. */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedPrimarySyncSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedPrimarySyncSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedPrimarySyncSelfTest.java index 194f40d..f092eb7 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedPrimarySyncSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedPrimarySyncSelfTest.java @@ -18,6 +18,7 @@ package org.apache.ignite.internal.processors.cache.distributed.dht; import org.apache.ignite.cache.*; +import org.apache.ignite.internal.processors.cache.distributed.*; import static org.apache.ignite.cache.GridCacheDistributionMode.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedReloadAllSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedReloadAllSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedReloadAllSelfTest.java index fec34e8..d8e5ad6 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedReloadAllSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedReloadAllSelfTest.java @@ -17,6 +17,8 @@ package org.apache.ignite.internal.processors.cache.distributed.dht; +import org.apache.ignite.internal.processors.cache.distributed.*; + /** * Tests reloadAll for colocated cache. */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxPessimisticOriginatingNodeFailureSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxPessimisticOriginatingNodeFailureSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxPessimisticOriginatingNodeFailureSelfTest.java index 428c2af..d6945ab 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxPessimisticOriginatingNodeFailureSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxPessimisticOriginatingNodeFailureSelfTest.java @@ -18,6 +18,7 @@ package org.apache.ignite.internal.processors.cache.distributed.dht; import org.apache.ignite.cache.*; +import org.apache.ignite.internal.processors.cache.distributed.*; import org.apache.ignite.internal.processors.cache.distributed.near.*; import org.apache.ignite.internal.util.typedef.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySetSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySetSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySetSelfTest.java index 3f78671..8b77230 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySetSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySetSelfTest.java @@ -18,6 +18,7 @@ package org.apache.ignite.internal.processors.cache.distributed.dht; import org.apache.ignite.cache.*; +import org.apache.ignite.internal.processors.cache.distributed.*; import static org.apache.ignite.cache.GridCacheMode.*; import static org.apache.ignite.cache.GridCacheDistributionMode.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtExpiredEntriesPreloadSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtExpiredEntriesPreloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtExpiredEntriesPreloadSelfTest.java index b055d10..8dce0ba 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtExpiredEntriesPreloadSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtExpiredEntriesPreloadSelfTest.java @@ -18,6 +18,7 @@ package org.apache.ignite.internal.processors.cache.distributed.dht; import org.apache.ignite.cache.*; +import org.apache.ignite.internal.processors.cache.distributed.*; import static org.apache.ignite.cache.GridCacheMode.*; import static org.apache.ignite.cache.GridCacheDistributionMode.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bda1cbfd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtTxPreloadSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtTxPreloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtTxPreloadSelfTest.java index e742a18..e44cb92 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtTxPreloadSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtTxPreloadSelfTest.java @@ -18,6 +18,7 @@ package org.apache.ignite.internal.processors.cache.distributed.dht; import org.apache.ignite.cache.*; +import org.apache.ignite.internal.processors.cache.distributed.*; import static org.apache.ignite.cache.GridCacheMode.*; import static org.apache.ignite.cache.GridCacheDistributionMode.*;