You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/04/03 11:17:48 UTC
[1/9] incubator-ignite git commit: ignite-645 Remove GridCachePeekMode
Repository: incubator-ignite
Updated Branches:
refs/heads/ignite-sprint-3 c4611b83a -> adba7eba7
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
index 1ab738f..a0d9f03 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
@@ -158,13 +158,13 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
assertTrue(cache1.containsKey(1));
assertTrue(cache1.containsKey(2));
- assertNotNull(near(cache1).peek(1));
- assertNotNull(near(cache1).peek(2));
- assertNotNull(dht(cache1).peek(1));
- assertNull(dht(cache1).peek(2));
+ assertNotNull(nearPeek(cache1, 1));
+ assertNotNull(nearPeek(cache1, 2));
+ assertNotNull(dhtPeek(cache1, 1));
+ assertNull(dhtPeek(cache1, 2));
- assertNull(near(cache2).peek(1));
- assertNotNull(dht(cache2).peek(2));
+ assertNull(nearPeek(cache2, 1));
+ assertNotNull(dhtPeek(cache2, 2));
// Node2 should have node1 in reader's map, since request to
// put key 2 came from node1.
@@ -177,7 +177,7 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
assertEquals("v1", cache2.get(1));
// Check that key1 is in near cache of cache2.
- assertNotNull(near(cache2).peek(1));
+ assertNotNull(nearPeek(cache2, 1));
// Now node1 should have node2 in readers map.
assertTrue(e1.readers().contains(n2.id()));
@@ -185,8 +185,8 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
// Evict locally from cache2.
cache2.localEvict(Collections.singleton(1));
- assertNull(near(cache2).peek(1));
- assertNull(dht(cache2).peek(1));
+ assertNull(nearPeek(cache2, 1));
+ assertNull(dhtPeek(cache2, 1));
// Node 1 still has node2 in readers map.
assertTrue(e1.readers().contains(n2.id()));
@@ -240,10 +240,10 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
assertTrue(cache1.containsKey(1));
assertTrue(cache2.containsKey(1));
- assertEquals("v1", near(cache1).peek(1));
- assertEquals("v1", near(cache2).peek(1));
- assertEquals("v1", dht(cache1).peek(1));
- assertEquals("v1", dht(cache2).peek(1));
+ assertEquals("v1", nearPeek(cache1, 1));
+ assertEquals("v1", nearPeek(cache2, 1));
+ assertEquals("v1", dhtPeek(cache1, 1));
+ assertEquals("v1", dhtPeek(cache2, 1));
assertNull(near(cache1).peekNearOnly(1));
assertNull(near(cache2).peekNearOnly(1));
@@ -256,10 +256,10 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
assertTrue(cache1.containsKey(2));
assertTrue(cache2.containsKey(2));
- assertEquals("v2", near(cache1).peek(2));
- assertEquals("v2", near(cache2).peek(2));
- assertEquals("v2", dht(cache1).peek(2));
- assertEquals("v2", dht(cache2).peek(2));
+ assertEquals("v2", nearPeek(cache1, 2));
+ assertEquals("v2", nearPeek(cache2, 2));
+ assertEquals("v2", dhtPeek(cache1, 2));
+ assertEquals("v2", dhtPeek(cache2, 2));
assertNull(near(cache1).peekNearOnly(2));
assertNull(near(cache2).peekNearOnly(2));
@@ -284,7 +284,7 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
cache2.localEvict(Collections.singleton(1));
assertNull(near(cache2).peekNearOnly(1));
- assertEquals("v1", dht(cache2).peek(1));
+ assertEquals("v1", dhtPeek(cache2, 1));
assertEquals("v1", cache1.getAndPut(1, "z1"));
@@ -292,7 +292,7 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
assertFalse(e1.readers().contains(n2.id()));
assertNull(near(cache2).peekNearOnly(1));
- assertEquals("z1", dht(cache2).peek(1));
+ assertEquals("z1", dhtPeek(cache2, 1));
}
/** @throws Exception If failed. */
@@ -443,9 +443,9 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
assertNull(cache.getAndPut(key1, val1));
- assertEquals(val1, dht(0).peek(key1));
- assertEquals(val1, dht(1).peek(key1));
- assertNull(dht(2).peek(key1));
+ assertEquals(val1, dhtPeek(0, key1));
+ assertEquals(val1, dhtPeek(1, key1));
+ assertNull(dhtPeek(2, key1));
assertNull(near(0).peekNearOnly(key1));
assertNull(near(1).peekNearOnly(key1));
@@ -453,9 +453,9 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
cache.put(key2, val2);
- assertNull(dht(0).peek(key2));
- assertEquals(val2, dht(1).peek(key2));
- assertEquals(val2, dht(2).peek(key2));
+ assertNull(dhtPeek(0, key2));
+ assertEquals(val2, dhtPeek(1, key2));
+ assertEquals(val2, dhtPeek(2, key2));
assertEquals(val2, near(0).peekNearOnly(key2));
assertNull(near(1).peekNearOnly(key2));
@@ -465,9 +465,9 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
cache.put(key2, val22);
- assertNull(dht(0).peek(key2));
- assertEquals(val22, dht(1).peek(key2));
- assertEquals(val22, dht(2).peek(key2));
+ assertNull(dhtPeek(0, key2));
+ assertEquals(val22, dhtPeek(1, key2));
+ assertEquals(val22, dhtPeek(2, key2));
assertEquals(val22, near(0).peekNearOnly(key2));
assertNull(near(1).peekNearOnly(key2));
@@ -475,9 +475,9 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
cache.remove(key2);
- assertNull(dht(0).peek(key2));
- assertNull(dht(1).peek(key2));
- assertNull(dht(2).peek(key2));
+ assertNull(dhtPeek(0, key2));
+ assertNull(dhtPeek(1, key2));
+ assertNull(dhtPeek(2, key2));
assertNull(near(0).peekNearOnly(key2));
assertNull(near(1).peekNearOnly(key2));
@@ -485,9 +485,9 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
cache.remove(key1);
- assertNull(dht(0).peek(key1));
- assertNull(dht(1).peek(key1));
- assertNull(dht(2).peek(key1));
+ assertNull(dhtPeek(0, key1));
+ assertNull(dhtPeek(1, key1));
+ assertNull(dhtPeek(2, key1));
assertNull(near(0).peekNearOnly(key1));
assertNull(near(1).peekNearOnly(key1));
@@ -536,9 +536,9 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
try {
assertNull(cache.getAndPut(key1, val1));
- assertEquals(val1, dht(0).peek(key1));
- assertEquals(val1, dht(1).peek(key1));
- assertNull(dht(2).peek(key1));
+ assertEquals(val1, dhtPeek(0, key1));
+ assertEquals(val1, dhtPeek(1, key1));
+ assertNull(dhtPeek(2, key1));
// Since near entry holds the lock, it should
// contain correct value.
@@ -549,9 +549,9 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
cache.put(key2, val2);
- assertNull(dht(0).peek(key2));
- assertEquals(val2, dht(1).peek(key2));
- assertEquals(val2, dht(2).peek(key2));
+ assertNull(dhtPeek(0, key2));
+ assertEquals(val2, dhtPeek(1, key2));
+ assertEquals(val2, dhtPeek(2, key2));
assertEquals(val2, near(0).peekNearOnly(key2));
assertNull(near(1).peekNearOnly(key2));
@@ -561,9 +561,9 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
cache.put(key2, val22);
- assertNull(dht(0).peek(key2));
- assertEquals(val22, dht(1).peek(key2));
- assertEquals(val22, dht(2).peek(key2));
+ assertNull(dhtPeek(0, key2));
+ assertEquals(val22, dhtPeek(1, key2));
+ assertEquals(val22, dhtPeek(2, key2));
assertEquals(val22, near(0).peekNearOnly(key2));
assertNull(near(1).peekNearOnly(key2));
@@ -571,9 +571,9 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
cache.remove(key2);
- assertNull(dht(0).peek(key2));
- assertNull(dht(1).peek(key2));
- assertNull(dht(2).peek(key2));
+ assertNull(dhtPeek(0, key2));
+ assertNull(dhtPeek(1, key2));
+ assertNull(dhtPeek(2, key2));
assertNull(dht(0).peekEx(key2));
assertNotNull(dht(1).peekEx(key2));
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
index 51c2047..9ebbebc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
@@ -148,7 +148,6 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest {
/**
* @throws Exception If test failed.
*/
- @SuppressWarnings({"BusyWait"})
public void testIntegrity() throws Exception {
preloadMode = SYNC;
@@ -188,12 +187,14 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest {
assertEquals(EVT_CACHE_REBALANCE_STARTED, iter.next().type());
assertEquals(EVT_CACHE_REBALANCE_STOPPED, iter.next().type());
- GridCacheAdapter<Integer, String> cache2 = ((IgniteKernal)g2).internalCache(null);
+ IgniteCache<Integer, String> cache2 = g2.cache(null);
+
+ assertEquals("val1", cache2.localPeek(1, CachePeekMode.ONHEAP));
+ assertEquals("val2", cache2.localPeek(2, CachePeekMode.ONHEAP));
- assertEquals("val1", cache2.peek(1));
- assertEquals("val2", cache2.peek(2));
+ GridCacheAdapter<Integer, String> cacheAdapter2 = ((IgniteKernal)g2).internalCache(null);
- GridCacheEntryEx e2 = cache2.peekEx(1);
+ GridCacheEntryEx e2 = cacheAdapter2.peekEx(1);
assert e2 != null;
assert e2 != e1;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java
index b110bfa..96229c0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java
@@ -209,7 +209,8 @@ public class IgfsProcessorSelfTest extends IgfsCommonAbstractTest {
IgfsFileImpl info = (IgfsFileImpl)igfs.info(path);
for (int i = 0; i < nodesCount(); i++) {
- IgfsFileInfo fileInfo = (IgfsFileInfo)grid(i).cachex(metaCacheName).peek(info.fileId());
+ IgfsFileInfo fileInfo =
+ (IgfsFileInfo)grid(i).cachex(metaCacheName).localPeek(info.fileId(), ONHEAP_PEEK_MODES, null);
assertNotNull(fileInfo);
assertNotNull(fileInfo.listing());
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java
index 3a49e6c..2b6c62a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java
@@ -404,7 +404,7 @@ public class IgfsSizeSelfTest extends IgfsCommonAbstractTest {
// Await for actual delete to occur.
for (IgfsBlock block : file.blocks()) {
for (int i = 0; i < GRID_CNT; i++) {
- while (cache(grid(i).localNode().id()).peek(block.key()) != null)
+ while (localPeek(cache(grid(i).localNode().id()), block.key()) != null)
U.sleep(100);
}
}
@@ -651,39 +651,6 @@ public class IgfsSizeSelfTest extends IgfsCommonAbstractTest {
}
/**
- * Create block key.
- *
- * @param path Path.
- * @param blockId Block ID.
- * @return Block key.
- * @throws Exception If failed.
- */
- private IgfsBlockKey blockKey(IgfsPath path, long blockId) throws Exception {
- IgfsEx igfs0 = (IgfsEx)grid(0).fileSystem(IGFS_NAME);
-
- IgniteUuid fileId = igfs0.context().meta().fileId(path);
-
- return new IgfsBlockKey(fileId, null, true, blockId);
- }
-
- /**
- * Determine primary node for the given block key.
- *
- * @param key Block key.
- * @return Node ID.
- */
- private UUID primary(IgfsBlockKey key) {
- IgniteEx grid = grid(0);
-
- for (ClusterNode node : grid.cluster().nodes()) {
- if (grid.affinity(DATA_CACHE_NAME).isPrimary(node, key))
- return node.id();
- }
-
- return null;
- }
-
- /**
* Determine primary and backup node IDs for the given block key.
*
* @param key Block key.
@@ -714,17 +681,6 @@ public class IgfsSizeSelfTest extends IgfsCommonAbstractTest {
}
/**
- * Get IGFS of the given node.
- *
- * @param ignite Node;
- * @return IGFS.
- * @throws Exception If failed.
- */
- private IgfsImpl igfs(Ignite ignite) throws Exception {
- return (IgfsImpl) ignite.fileSystem(IGFS_NAME);
- }
-
- /**
* Get data cache for the given node ID.
*
* @param nodeId Node ID.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
index 9dd40d0..b890692 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
@@ -52,6 +52,9 @@ import static org.apache.ignite.internal.processors.cache.GridCacheUtils.*;
* Super class for all common tests.
*/
public abstract class GridCommonAbstractTest extends GridAbstractTest {
+ /**Cache peek modes array that consist of only ONHEAP mode. */
+ protected static final CachePeekMode[] ONHEAP_PEEK_MODES = new CachePeekMode[] {CachePeekMode.ONHEAP};
+
/**
* @param startGrid If {@code true}, then grid node will be auto-started.
*/
@@ -552,6 +555,45 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
}
/**
+ * @param key Key.
+ */
+ protected <K, V> V dhtPeek(K key) throws IgniteCheckedException {
+ return localPeek(this.<K, V>dht(), key);
+ }
+
+ /**
+ * @param idx Index.
+ * @param key Key.
+ */
+ protected <K, V> V dhtPeek(int idx, K key) throws IgniteCheckedException {
+ return localPeek(this.<K, V>dht(idx), key);
+ }
+
+ /**
+ * @param cache Cache.
+ * @param key Key.
+ */
+ protected <K, V> V nearPeek(IgniteCache<K, V> cache, K key) throws IgniteCheckedException {
+ return localPeek(near(cache), key);
+ }
+
+ /**
+ * @param cache Cache.
+ * @param key Key.
+ */
+ protected static <K, V> V dhtPeek(IgniteCache<K, V> cache, K key) throws IgniteCheckedException {
+ return localPeek(dht(cache), key);
+ }
+
+ /**
+ * @param cache Cache.
+ * @param key Key.
+ */
+ protected static <K, V> V localPeek(GridCacheAdapter<K, V> cache, K key) throws IgniteCheckedException {
+ return cache.localPeek(key, ONHEAP_PEEK_MODES, null);
+ }
+
+ /**
* @param comp Compute.
* @param task Task.
* @param arg Task argument.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridIndexingWithNoopSwapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridIndexingWithNoopSwapSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridIndexingWithNoopSwapSelfTest.java
index c650b6b..ad41bc5 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridIndexingWithNoopSwapSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridIndexingWithNoopSwapSelfTest.java
@@ -99,7 +99,7 @@ public class GridIndexingWithNoopSwapSelfTest extends GridCommonAbstractTest {
cache.put(i, new ObjectValue("test" + i, i));
for (int i = 0; i < cnt; i++) {
- assertNotNull(cache.peek(i));
+ assertNotNull(localPeek(cache, i));
cache.evict(i); // Swap.
}
[8/9] incubator-ignite git commit: Merge branch 'ignite-645' into
ignite-sprint-3
Posted by sb...@apache.org.
Merge branch 'ignite-645' into ignite-sprint-3
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/7cb512ac
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/7cb512ac
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/7cb512ac
Branch: refs/heads/ignite-sprint-3
Commit: 7cb512acae1476f6d740e8cb79cbd8fa9f8314a0
Parents: d173f37 6a721d7
Author: Andrey Gura <ag...@gridgain.com>
Authored: Fri Apr 3 12:04:43 2015 +0300
Committer: Andrey Gura <ag...@gridgain.com>
Committed: Fri Apr 3 12:04:43 2015 +0300
----------------------------------------------------------------------
.../cache/CacheEvictableEntryImpl.java | 11 +-
.../processors/cache/CacheProjection.java | 36 ---
.../processors/cache/GridCacheAdapter.java | 257 +------------------
.../cache/GridCacheDeploymentManager.java | 7 +-
.../processors/cache/GridCacheEntryEx.java | 55 +---
.../processors/cache/GridCacheMapEntry.java | 232 +----------------
.../processors/cache/GridCachePeekMode.java | 81 ------
.../cache/GridCacheProjectionImpl.java | 11 -
.../processors/cache/GridCacheProxyImpl.java | 24 --
.../processors/cache/GridCacheUtils.java | 11 -
.../distributed/dht/GridDhtCacheAdapter.java | 9 +-
.../dht/atomic/GridDhtAtomicCache.java | 29 +--
.../dht/colocated/GridDhtColocatedCache.java | 30 +--
.../distributed/near/GridNearCacheAdapter.java | 72 +-----
.../distributed/near/GridNearTxRemote.java | 11 +-
.../processors/task/GridTaskProcessor.java | 9 +-
.../resources/META-INF/classnames.properties | 1 -
.../GridCachePreloadingEvictionsSelfTest.java | 4 +-
.../processors/cache/GridCacheTestEntryEx.java | 40 +--
...GridCacheDhtEvictionNearReadersSelfTest.java | 14 +-
.../dht/GridCacheDhtEvictionSelfTest.java | 24 +-
.../dht/GridCacheDhtMappingSelfTest.java | 2 +-
.../near/GridCacheNearMultiNodeSelfTest.java | 103 +++-----
.../near/GridCacheNearOneNodeSelfTest.java | 33 +--
.../near/GridCacheNearReadersSelfTest.java | 154 +++++------
.../GridCacheReplicatedPreloadSelfTest.java | 11 +-
.../processors/igfs/IgfsProcessorSelfTest.java | 3 +-
.../processors/igfs/IgfsSizeSelfTest.java | 46 +---
.../junits/common/GridCommonAbstractTest.java | 42 +++
.../cache/GridIndexingWithNoopSwapSelfTest.java | 2 +-
30 files changed, 291 insertions(+), 1073 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7cb512ac/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7cb512ac/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7cb512ac/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7cb512ac/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7cb512ac/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7cb512ac/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7cb512ac/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
[2/9] incubator-ignite git commit: ignite-645 Remove GridCachePeekMode
Posted by sb...@apache.org.
ignite-645 Remove GridCachePeekMode
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/dfb4679f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/dfb4679f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/dfb4679f
Branch: refs/heads/ignite-sprint-3
Commit: dfb4679f912eb226b04c20b29e6e2d6872e95b9f
Parents: 35d05e9
Author: Andrey Gura <ag...@gridgain.com>
Authored: Mon Mar 30 21:57:29 2015 +0300
Committer: Andrey Gura <ag...@gridgain.com>
Committed: Wed Apr 1 11:55:02 2015 +0300
----------------------------------------------------------------------
.../cache/CacheEvictableEntryImpl.java | 11 +-
.../processors/cache/CacheProjection.java | 36 ---
.../processors/cache/GridCacheAdapter.java | 257 +------------------
.../cache/GridCacheDeploymentManager.java | 7 +-
.../processors/cache/GridCacheEntryEx.java | 42 +--
.../processors/cache/GridCacheMapEntry.java | 183 +------------
.../processors/cache/GridCachePeekMode.java | 81 ------
.../cache/GridCacheProjectionImpl.java | 11 -
.../processors/cache/GridCacheProxyImpl.java | 24 --
.../processors/cache/GridCacheUtils.java | 11 -
.../distributed/dht/GridDhtCacheAdapter.java | 9 +-
.../dht/atomic/GridDhtAtomicCache.java | 29 +--
.../dht/colocated/GridDhtColocatedCache.java | 45 +---
.../distributed/near/GridNearCacheAdapter.java | 54 +---
.../distributed/near/GridNearTxRemote.java | 11 +-
.../processors/task/GridTaskProcessor.java | 9 +-
.../resources/META-INF/classnames.properties | 1 -
.../GridCachePreloadingEvictionsSelfTest.java | 4 +-
.../processors/cache/GridCacheTestEntryEx.java | 31 +--
...GridCacheDhtEvictionNearReadersSelfTest.java | 14 +-
.../dht/GridCacheDhtEvictionSelfTest.java | 24 +-
.../dht/GridCacheDhtMappingSelfTest.java | 2 +-
.../near/GridCacheNearMultiNodeSelfTest.java | 72 ++----
.../near/GridCacheNearOneNodeSelfTest.java | 25 +-
.../near/GridCacheNearReadersSelfTest.java | 92 +++----
.../GridCacheReplicatedPreloadSelfTest.java | 11 +-
.../processors/igfs/IgfsProcessorSelfTest.java | 3 +-
.../processors/igfs/IgfsSizeSelfTest.java | 46 +---
.../junits/common/GridCommonAbstractTest.java | 42 +++
.../cache/GridIndexingWithNoopSwapSelfTest.java | 2 +-
30 files changed, 253 insertions(+), 936 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEvictableEntryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEvictableEntryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEvictableEntryImpl.java
index 6144807..5d6062e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEvictableEntryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEvictableEntryImpl.java
@@ -76,16 +76,18 @@ public class CacheEvictableEntryImpl<K, V> implements EvictableEntry<K, V> {
/**
* @return Peeks value.
*/
- @SuppressWarnings("unchecked")
@Nullable public V peek() {
try {
- CacheObject val = cached.peek(GridCachePeekMode.GLOBAL);
+ CacheObject val = cached.peek(true, false, false, null);
return val != null ? val.<V>value(cached.context().cacheObjectContext(), false) : null;
}
catch (GridCacheEntryRemovedException e) {
return null;
}
+ catch (IgniteCheckedException e) {
+ throw new IgniteException(e);
+ }
}
/** {@inheritDoc} */
@@ -114,13 +116,16 @@ public class CacheEvictableEntryImpl<K, V> implements EvictableEntry<K, V> {
return null;
try {
- CacheObject val = e.peek(GridCachePeekMode.GLOBAL, CU.empty0());
+ CacheObject val = e.peek(true, false, false, null);
return val != null ? val.<V>value(cached.context().cacheObjectContext(), false) : null;
}
catch (GridCacheEntryRemovedException ignored) {
// No-op.
}
+ catch (IgniteCheckedException ex) {
+ throw new IgniteException(ex);
+ }
}
}
catch (GridCacheFilterFailedException ignored) {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java
index 0ff316d..b17fdac 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java
@@ -336,23 +336,6 @@ public interface CacheProjection<K, V> extends Iterable<Cache.Entry<K, V>> {
public IgniteInternalFuture<V> reloadAsync(K key);
/**
- * Peeks at in-memory cached value using default {@link GridCachePeekMode#SMART}
- * peek mode.
- * <p>
- * This method will not load value from any persistent store or from a remote node.
- * <h2 class="header">Transactions</h2>
- * This method does not participate in any transactions, however, it will
- * peek at transactional value according to the {@link GridCachePeekMode#SMART} mode
- * semantics. If you need to look at global cached value even from within transaction,
- * you can use {@link GridCache#peek(Object, Collection)} method.
- *
- * @param key Entry key.
- * @return Peeked value.
- * @throws NullPointerException If key is {@code null}.
- */
- @Nullable public V peek(K key);
-
- /**
* @param key Key.
* @param peekModes Peek modes.
* @param plc Expiry policy if TTL should be updated.
@@ -370,25 +353,6 @@ public interface CacheProjection<K, V> extends Iterable<Cache.Entry<K, V>> {
public Iterable<Cache.Entry<K, V>> localEntries(CachePeekMode[] peekModes) throws IgniteCheckedException;
/**
- * Peeks at cached value using optional set of peek modes. This method will sequentially
- * iterate over given peek modes in the order passed in, and try to peek at value using
- * each peek mode. Once a {@code non-null} value is found, it will be immediately returned.
- * <p>
- * Note that if modes are not provided this method works exactly the same way as
- * {@link #peek(Object)}, implicitly using {@link GridCachePeekMode#SMART} mode.
- * <h2 class="header">Transactions</h2>
- * This method does not participate in any transactions, however, it may
- * peek at transactional value depending on the peek modes used.
- *
- * @param key Entry key.
- * @param modes Optional set of peek modes.
- * @return Peeked value.
- * @throws IgniteCheckedException If peek operation failed.
- * @throws NullPointerException If key is {@code null}.
- */
- @Nullable public V peek(K key, @Nullable Collection<GridCachePeekMode> modes) throws IgniteCheckedException;
-
- /**
* Retrieves value mapped to the specified key from cache. Value will only be returned if
* its entry passed the optional filter provided. Filter check is atomic, and therefore the
* returned value is guaranteed to be consistent with the filter. The return value of {@code null}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 02429b3..e749af7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -59,11 +59,9 @@ import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.locks.*;
-import static java.util.Collections.*;
import static org.apache.ignite.IgniteSystemProperties.*;
import static org.apache.ignite.events.EventType.*;
import static org.apache.ignite.internal.GridClosureCallMode.*;
-import static org.apache.ignite.internal.processors.cache.GridCachePeekMode.*;
import static org.apache.ignite.internal.processors.dr.GridDrType.*;
import static org.apache.ignite.internal.processors.task.GridTaskThreadContextKey.*;
import static org.apache.ignite.transactions.TransactionConcurrency.*;
@@ -820,219 +818,6 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
return null;
}
- /** {@inheritDoc} */
- @Override public V peek(K key) {
- return peek(key, (CacheEntryPredicate)null);
- }
-
- /** {@inheritDoc} */
- @Override public V peek(K key, @Nullable Collection<GridCachePeekMode> modes) throws IgniteCheckedException {
- return peek0(key, modes, ctx.tm().localTxx());
- }
-
- /**
- * @param failFast Fail fast flag.
- * @param key Key.
- * @param mode Peek mode.
- * @param filter Filter.
- * @return Peeked value.
- * @throws GridCacheFilterFailedException If filter failed.
- */
- @Nullable protected GridTuple<V> peek0(boolean failFast, K key, GridCachePeekMode mode,
- @Nullable CacheEntryPredicate... filter) throws GridCacheFilterFailedException {
- A.notNull(key, "key");
-
- if (keyCheck)
- validateCacheKey(key);
-
- ctx.checkSecurity(GridSecurityPermission.CACHE_READ);
-
- GridCacheEntryEx e = null;
-
- try {
- KeyCacheObject cacheKey = ctx.toCacheKeyObject(key);
-
- e = peekEx(cacheKey);
-
- if (e != null) {
- GridTuple<CacheObject> peek = e.peek0(failFast, mode, filter, ctx.tm().localTxx());
-
- if (peek != null) {
- CacheObject v = peek.get();
-
- Object val0 = CU.value(v, ctx, true);
-
- val0 = ctx.unwrapPortableIfNeeded(val0, ctx.keepPortable());
-
- return F.t((V)val0);
- }
- }
-
- IgniteInternalTx tx = ctx.tm().localTx();
-
- if (tx != null) {
- GridTuple<CacheObject> peek = tx.peek(ctx, failFast, cacheKey, filter);
-
- if (peek != null) {
- CacheObject v = peek.get();
-
- Object val0 = CU.value(v, ctx, true);
-
- val0 = ctx.unwrapPortableIfNeeded(val0, ctx.keepPortable());
-
- return F.t((V)val0);
- }
- }
-
- return null;
- }
- catch (GridCacheEntryRemovedException ignore) {
- if (log.isDebugEnabled())
- log.debug("Got removed entry during 'peek': " + e);
-
- return null;
- }
- catch (IgniteCheckedException ex) {
- throw new IgniteException(ex);
- }
- }
-
- /**
- * @param key Key.
- * @param modes Peek modes.
- * @param tx Transaction to peek at (if modes contains TX value).
- * @return Peeked value.
- * @throws IgniteCheckedException In case of error.
- */
- @Nullable protected V peek0(K key, @Nullable Collection<GridCachePeekMode> modes, IgniteInternalTx tx)
- throws IgniteCheckedException {
- try {
- GridTuple<V> peek = peek0(false, key, modes, tx);
-
- return peek != null ? peek.get() : null;
- }
- catch (GridCacheFilterFailedException ex) {
- ex.printStackTrace();
-
- assert false; // Should never happen.
-
- return null;
- }
- }
-
- /**
- * @param failFast If {@code true}, then filter failure will result in exception.
- * @param key Key.
- * @param modes Peek modes.
- * @param tx Transaction to peek at (if modes contains TX value).
- * @return Peeked value.
- * @throws IgniteCheckedException In case of error.
- * @throws GridCacheFilterFailedException If filer validation failed.
- */
- @Nullable protected GridTuple<V> peek0(boolean failFast, K key, @Nullable Collection<GridCachePeekMode> modes,
- IgniteInternalTx tx) throws IgniteCheckedException, GridCacheFilterFailedException {
- if (F.isEmpty(modes))
- return F.t(peek(key, (CacheEntryPredicate)null));
-
- assert modes != null;
-
- A.notNull(key, "key");
-
- if (keyCheck)
- validateCacheKey(key);
-
- ctx.checkSecurity(GridSecurityPermission.CACHE_READ);
-
- KeyCacheObject cacheKey = ctx.toCacheKeyObject(key);
-
- GridCacheEntryEx e = peekEx(cacheKey);
-
- try {
- for (GridCachePeekMode m : modes) {
- GridTuple<CacheObject> val = null;
-
- if (e != null)
- val = e.peek0(failFast, m, null, tx);
- else if (m == TX || m == SMART)
- val = tx != null ? tx.peek(ctx, failFast, cacheKey, null) : null;
- else if (m == SWAP)
- val = peekSwap(cacheKey);
- else if (m == DB) {
- Object v = peekDb(cacheKey);
-
- if (v != null)
- return new GridTuple<>((V)v);
- }
-
- if (val != null)
- return F.t(CU.<V>value(val.get(), ctx, true));
- }
- }
- catch (GridCacheEntryRemovedException ignore) {
- if (log.isDebugEnabled())
- log.debug("Got removed entry during 'peek': " + e);
- }
-
- return null;
- }
-
- /**
- * @param key Key to read from swap storage.
- * @return Value from swap storage.
- * @throws IgniteCheckedException In case of any errors.
- */
- @Nullable private GridTuple<CacheObject> peekSwap(KeyCacheObject key) throws IgniteCheckedException {
- GridCacheSwapEntry e = ctx.swap().read(key, true, true);
-
- return e != null ? F.t(e.value()) : null;
- }
-
- /**
- * @param key Key to read from persistent store.
- * @return Value from persistent store.
- * @throws IgniteCheckedException In case of any errors.
- */
- @Nullable private Object peekDb(KeyCacheObject key) throws IgniteCheckedException {
- return ctx.store().loadFromStore(ctx.tm().localTxx(), key);
- }
-
- /**
- * @param keys Keys.
- * @param modes Modes.
- * @param tx Transaction.
- * @param skipped Keys skipped during filter validation.
- * @return Peeked values.
- * @throws IgniteCheckedException If failed.
- */
- protected Map<K, V> peekAll0(@Nullable Collection<? extends K> keys, @Nullable Collection<GridCachePeekMode> modes,
- IgniteInternalTx tx, @Nullable Collection<K> skipped) throws IgniteCheckedException {
- if (F.isEmpty(keys))
- return emptyMap();
-
- if (keyCheck)
- validateCacheKeys(keys);
-
- Map<K, V> ret = new HashMap<>(keys.size(), 1.0f);
-
- for (K k : keys) {
- try {
- GridTuple<V> val = peek0(skipped != null, k, modes, tx);
-
- if (val != null)
- ret.put(k, val.get());
- }
- catch (GridCacheFilterFailedException ignored) {
- if (log.isDebugEnabled())
- log.debug("Filter validation failed for key: " + k);
-
- if (skipped != null)
- skipped.add(k);
- }
- }
-
- return ret;
- }
-
/**
* Undeploys and removes all entries for class loader.
*
@@ -1688,17 +1473,10 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
if (set || wasNew)
map.put(key, cacheVal);
else {
- try {
- GridTuple<CacheObject> v = entry.peek0(false, GLOBAL, null, null);
+ CacheObject v = entry.peek(true, false, false, null);
- if (v != null)
- map.put(key, v.get());
- }
- catch (GridCacheFilterFailedException ex) {
- ex.printStackTrace();
-
- assert false;
- }
+ if (v != null)
+ map.put(key, v);
}
}
@@ -1807,8 +1585,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
if (ctx.config().getInterceptor() != null)
fut = fut.chain(new CX1<IgniteInternalFuture<V>, V>() {
- @Override
- public V applyx(IgniteInternalFuture<V> f) throws IgniteCheckedException {
+ @Override public V applyx(IgniteInternalFuture<V> f) throws IgniteCheckedException {
return (V)ctx.config().getInterceptor().onGet(key, f.get());
}
});
@@ -2450,7 +2227,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
return syncOp(new SyncOp<Map<K, EntryProcessorResult<T>>>(keys.size() == 1) {
@Nullable @Override public Map<K, EntryProcessorResult<T>> op(IgniteTxLocalAdapter tx)
- throws IgniteCheckedException {
+ throws IgniteCheckedException {
Map<? extends K, EntryProcessor<K, V, Object>> invokeMap = F.viewAsMap(keys,
new C1<K, EntryProcessor<K, V, Object>>() {
@Override public EntryProcessor apply(K k) {
@@ -4756,26 +4533,6 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
}
/**
- * @param key Key.
- * @param filter Filter to evaluate.
- * @return Peeked value.
- */
- public V peek(K key, @Nullable CacheEntryPredicate filter) {
- try {
- GridTuple<V> peek = peek0(false, key, SMART, filter);
-
- return peek != null ? peek.get() : null;
- }
- catch (GridCacheFilterFailedException e) {
- e.printStackTrace();
-
- assert false; // Should never happen.
-
- return null;
- }
- }
-
- /**
* @param filter Filters to evaluate.
* @return Entry set.
*/
@@ -5170,9 +4927,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
modes.swap = true;
}
else {
- for (int i = 0; i < peekModes.length; i++) {
- CachePeekMode peekMode = peekModes[i];
-
+ for (CachePeekMode peekMode : peekModes) {
A.notNull(peekMode, "peekMode");
switch (peekMode) {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java
index ee17893..8273b24 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java
@@ -211,8 +211,7 @@ public class GridCacheDeploymentManager<K, V> extends GridCacheSharedManagerAdap
undeploys.put(ctx.name(), queue = new ArrayList<>());
queue.add(new CA() {
- @Override
- public void apply() {
+ @Override public void apply() {
onUndeploy0(ldr, ctx);
}
});
@@ -310,7 +309,7 @@ public class GridCacheDeploymentManager<K, V> extends GridCacheSharedManagerAdap
Object val0;
try {
- CacheObject v = entry.peek(GridCachePeekMode.GLOBAL, CU.empty0());
+ CacheObject v = entry.peek(true, false, false, null);
key0 = key.value(cache.context().cacheObjectContext(), false);
@@ -321,7 +320,7 @@ public class GridCacheDeploymentManager<K, V> extends GridCacheSharedManagerAdap
catch (GridCacheEntryRemovedException ignore) {
return false;
}
- catch (IgniteException ignore) {
+ catch (IgniteCheckedException | IgniteException ignore) {
// Peek can throw runtime exception if unmarshalling failed.
return true;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
index 10176d9..adeb95b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
@@ -561,17 +561,6 @@ public interface GridCacheEntryEx {
/**
* Peeks into entry without loading value or updating statistics.
*
- * @param mode Peek mode.
- * @param filter Optional filter.
- * @return Value.
- * @throws GridCacheEntryRemovedException If entry has been removed.
- */
- @Nullable public CacheObject peek(GridCachePeekMode mode, CacheEntryPredicate... filter)
- throws GridCacheEntryRemovedException;
-
- /**
- * Peeks into entry without loading value or updating statistics.
- *
* @param heap Read from heap flag.
* @param offheap Read from offheap flag.
* @param swap Read from swap flag.
@@ -591,30 +580,19 @@ public interface GridCacheEntryEx {
/**
* Peeks into entry without loading value or updating statistics.
*
- * @param modes Peek modes.
- * @param filter Optional filter.
+ * @param heap Heap.
+ * @param offheap Offheap.
+ * @param swap Swap.
+ * @param plc Policy.
* @return Value.
* @throws GridCacheEntryRemovedException If entry has been removed.
+ * @throws IgniteCheckedException If failed.
*/
- @Nullable public CacheObject peek(Collection<GridCachePeekMode> modes,
- CacheEntryPredicate... filter) throws GridCacheEntryRemovedException;
-
- /**
- * @param failFast Fail-fast flag.
- * @param mode Peek mode.
- * @param filter Filter.
- * @param tx Transaction to peek value at (if mode is TX value).
- * @return Peeked value.
- * @throws IgniteCheckedException In case of error.
- * @throws GridCacheEntryRemovedException If removed.
- * @throws GridCacheFilterFailedException If filter failed.
- */
- @SuppressWarnings({"RedundantTypeArguments"})
- @Nullable public GridTuple<CacheObject> peek0(boolean failFast,
- GridCachePeekMode mode,
- @Nullable CacheEntryPredicate[] filter,
- @Nullable IgniteInternalTx tx)
- throws GridCacheEntryRemovedException, GridCacheFilterFailedException, IgniteCheckedException;
+ @Nullable public CacheObject peek(boolean heap,
+ boolean offheap,
+ boolean swap,
+ @Nullable IgniteCacheExpiryPolicy plc)
+ throws GridCacheEntryRemovedException, IgniteCheckedException;
/**
* This method overwrites current in-memory value with new value.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index 58ff57f..14fa2f7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -47,7 +47,6 @@ import java.util.concurrent.atomic.*;
import static org.apache.ignite.events.EventType.*;
import static org.apache.ignite.internal.processors.dr.GridDrType.*;
-import static org.apache.ignite.transactions.TransactionState.*;
/**
* Adapter for cache entry.
@@ -2755,25 +2754,6 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
}
/** {@inheritDoc} */
- @Nullable @Override public CacheObject peek(GridCachePeekMode mode,
- CacheEntryPredicate[] filter)
- throws GridCacheEntryRemovedException {
- try {
- GridTuple<CacheObject> peek = peek0(false, mode, filter, cctx.tm().localTxx());
-
- return peek != null ? peek.get() : null;
- }
- catch (GridCacheFilterFailedException ignore) {
- assert false;
-
- return null;
- }
- catch (IgniteCheckedException e) {
- throw new IgniteException("Unable to perform entry peek() operation.", e);
- }
- }
-
- /** {@inheritDoc} */
@Nullable @Override public CacheObject peek(boolean heap,
boolean offheap,
boolean swap,
@@ -2807,88 +2787,17 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
}
/** {@inheritDoc} */
- @Override public CacheObject peek(Collection<GridCachePeekMode> modes,
- CacheEntryPredicate[] filter)
- throws GridCacheEntryRemovedException {
- assert modes != null;
-
- for (GridCachePeekMode mode : modes) {
- try {
- GridTuple<CacheObject> val = peek0(false, mode, filter, cctx.tm().localTxx());
-
- if (val != null)
- return val.get();
- }
- catch (GridCacheFilterFailedException ignored) {
- assert false;
-
- return null;
- }
- catch (IgniteCheckedException e) {
- throw new IgniteException("Unable to perform entry peek() operation.", e);
- }
- }
-
- return null;
- }
-
- /**
- * @param failFast Fail-fast flag.
- * @param mode Peek mode.
- * @param filter Filter.
- * @param tx Transaction to peek value at (if mode is TX value).
- * @return Peeked value.
- * @throws IgniteCheckedException In case of error.
- * @throws GridCacheEntryRemovedException If removed.
- * @throws GridCacheFilterFailedException If filter failed.
- */
- @SuppressWarnings({"RedundantTypeArguments"})
- @Nullable @Override public GridTuple<CacheObject> peek0(boolean failFast, GridCachePeekMode mode,
- CacheEntryPredicate[] filter, @Nullable IgniteInternalTx tx)
- throws GridCacheEntryRemovedException, GridCacheFilterFailedException, IgniteCheckedException {
- assert tx == null || tx.local();
+ @Nullable @Override public CacheObject peek(
+ boolean heap,
+ boolean offheap,
+ boolean swap,
+ @Nullable IgniteCacheExpiryPolicy plc)
+ throws GridCacheEntryRemovedException, IgniteCheckedException {
+ IgniteInternalTx tx = cctx.tm().localTxx();
AffinityTopologyVersion topVer = tx != null ? tx.topologyVersion() : cctx.affinity().affinityTopologyVersion();
- switch (mode) {
- case TX:
- return peekTx(failFast, filter, tx);
-
- case GLOBAL:
- return peekGlobal(failFast, topVer, filter, null);
-
- case NEAR_ONLY:
- return peekGlobal(failFast, topVer, filter, null);
-
- case PARTITIONED_ONLY:
- return peekGlobal(failFast, topVer, filter, null);
-
- case SMART:
- /*
- * If there is no ongoing transaction, or transaction is NOT in ACTIVE state,
- * which means that it is either rolling back, preparing to commit, or committing,
- * then we only check the global cache storage because value has already been
- * validated against filter and enlisted into transaction and, therefore, second
- * validation against the same enlisted value will be invalid (it will always be false).
- *
- * However, in ACTIVE state, we must also validate against other values that
- * may have enlisted into the same transaction and that's why we pass 'true'
- * to 'e.peek(true)' method in this case.
- */
- return tx == null || tx.state() != ACTIVE ? peekGlobal(failFast, topVer, filter, null) :
- peekTxThenGlobal(failFast, filter, tx);
-
- case SWAP:
- return peekSwap(failFast, filter);
-
- case DB:
- return F.t(peekDb(failFast, filter));
-
- default: // Should never be reached.
- assert false;
-
- return null;
- }
+ return peek(heap, offheap, swap, topVer, plc);
}
/** {@inheritDoc} */
@@ -2952,31 +2861,6 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
* @param tx Transaction to peek value at (if mode is TX value).
* @return Peeked value.
* @throws GridCacheFilterFailedException If filter failed.
- * @throws GridCacheEntryRemovedException If entry got removed.
- * @throws IgniteCheckedException If unexpected cache failure occurred.
- */
- @Nullable private GridTuple<CacheObject> peekTxThenGlobal(boolean failFast,
- CacheEntryPredicate[] filter,
- IgniteInternalTx tx)
- throws GridCacheFilterFailedException, GridCacheEntryRemovedException, IgniteCheckedException
- {
- GridTuple<CacheObject> peek = peekTx(failFast, filter, tx);
-
- // If transaction has value (possibly null, which means value is to be deleted).
- if (peek != null)
- return peek;
-
- AffinityTopologyVersion topVer = tx == null ? cctx.affinity().affinityTopologyVersion() : tx.topologyVersion();
-
- return peekGlobal(failFast, topVer, filter, null);
- }
-
- /**
- * @param failFast Fail fast flag.
- * @param filter Filter.
- * @param tx Transaction to peek value at (if mode is TX value).
- * @return Peeked value.
- * @throws GridCacheFilterFailedException If filter failed.
*/
@Nullable private GridTuple<CacheObject> peekTx(boolean failFast,
CacheEntryPredicate[] filter,
@@ -3043,52 +2927,6 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
}
/**
- * @param failFast Fail fast flag.
- * @param filter Filter.
- * @return Value from swap storage.
- * @throws IgniteCheckedException In case of any errors.
- * @throws GridCacheFilterFailedException If filter failed.
- */
- @SuppressWarnings({"unchecked"})
- @Nullable private GridTuple<CacheObject> peekSwap(boolean failFast,
- CacheEntryPredicate[] filter)
- throws IgniteCheckedException, GridCacheFilterFailedException
- {
- if (!cctx.isAll(this, filter))
- return F.t(CU.failed(failFast));
-
- synchronized (this) {
- if (checkExpired())
- return null;
- }
-
- GridCacheSwapEntry e = cctx.swap().read(this, false, true, true);
-
- return e != null ? F.t(e.value()) : null;
- }
-
- /**
- * @param failFast Fail fast flag.
- * @param filter Filter.
- * @return Value from persistent store.
- * @throws IgniteCheckedException In case of any errors.
- * @throws GridCacheFilterFailedException If filter failed.
- */
- @SuppressWarnings({"unchecked"})
- @Nullable private CacheObject peekDb(boolean failFast, CacheEntryPredicate[] filter)
- throws IgniteCheckedException, GridCacheFilterFailedException {
- if (!cctx.isAll(this, filter))
- return CU.failed(failFast);
-
- synchronized (this) {
- if (checkExpired())
- return null;
- }
-
- return cctx.toCacheObject(cctx.store().loadFromStore(cctx.tm().localTxx(), key));
- }
-
- /**
* TODO: GG-4009: do we need to generate event and invalidate value?
*
* @return {@code true} if expired.
@@ -3790,11 +3628,14 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
return null;
try {
- return e.peek(GridCachePeekMode.GLOBAL, CU.empty0());
+ return e.peek(true, false, false, null);
}
catch (GridCacheEntryRemovedException ignored) {
// No-op.
}
+ catch (IgniteCheckedException ex) {
+ throw new IgniteException(ex);
+ }
}
}
catch (GridCacheFilterFailedException ignored) {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePeekMode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePeekMode.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePeekMode.java
deleted file mode 100644
index 0aef1ee..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePeekMode.java
+++ /dev/null
@@ -1,81 +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.jetbrains.annotations.*;
-
-/**
- * Enumeration of all supported cache peek modes. Peek modes can be passed into various
- * {@code 'CacheProjection.peek(..)'} and {@code Entry.peek(..)} methods.
- * <p>
- * The following modes are supported:
- * <ul>
- * <li>{@link #TX}</li>
- * <li>{@link #GLOBAL}</li>
- * <li>{@link #SMART}</li>
- * <li>{@link #SWAP}</li>
- * <li>{@link #DB}</li>
- * </ul>
- */
-public enum GridCachePeekMode {
- /** Peeks value only from in-transaction memory of an ongoing transaction, if any. */
- TX,
-
- /** Peeks at cache global (not in-transaction) memory. */
- GLOBAL,
-
- /**
- * In this mode value is peeked from in-transaction memory first using {@link #TX}
- * mode and then, if it has not been found there, {@link #GLOBAL} mode is used to
- * search in committed cached values.
- */
- SMART,
-
- /** Peeks value only from off-heap or cache swap storage without loading swapped value into cache. */
- SWAP,
-
- /** Peek value from the underlying persistent storage without loading this value into cache. */
- DB,
-
- /**
- * Peek value from near cache only (don't peek from partitioned cache).
- * In case of {@link org.apache.ignite.cache.CacheMode#LOCAL} or {@link org.apache.ignite.cache.CacheMode#REPLICATED} cache,
- * behaves as {@link #GLOBAL} mode.
- */
- NEAR_ONLY,
-
- /**
- * Peek value from partitioned cache only (skip near cache).
- * In case of {@link org.apache.ignite.cache.CacheMode#LOCAL} or {@link org.apache.ignite.cache.CacheMode#REPLICATED} cache,
- * behaves as {@link #GLOBAL} mode.
- */
- PARTITIONED_ONLY;
-
- /** Enumerated values. */
- private static final GridCachePeekMode[] VALS = values();
-
- /**
- * Efficiently gets enumerated value from its ordinal.
- *
- * @param ord Ordinal value.
- * @return Enumerated value or {@code null} if ordinal out of range.
- */
- @Nullable public static GridCachePeekMode fromOrdinal(byte ord) {
- return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java
index 53d353f..9730c39 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java
@@ -25,7 +25,6 @@ import org.apache.ignite.internal.processors.cache.dr.*;
import org.apache.ignite.internal.processors.cache.query.*;
import org.apache.ignite.internal.processors.cache.transactions.*;
import org.apache.ignite.internal.processors.cache.version.*;
-import org.apache.ignite.internal.util.future.*;
import org.apache.ignite.internal.util.tostring.*;
import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.internal.util.typedef.internal.*;
@@ -584,11 +583,6 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V
}
/** {@inheritDoc} */
- @Override public V peek(K key) {
- return cache.peek(key);
- }
-
- /** {@inheritDoc} */
@Nullable @Override public V localPeek(K key,
CachePeekMode[] peekModes,
@Nullable IgniteCacheExpiryPolicy plc)
@@ -603,11 +597,6 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V
}
/** {@inheritDoc} */
- @Override public V peek(K key, @Nullable Collection<GridCachePeekMode> modes) throws IgniteCheckedException {
- return cache.peek(key, modes);
- }
-
- /** {@inheritDoc} */
@Nullable @Override public Cache.Entry<K, V> entry(K key) {
return cache.entry(key);
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
index d2a561a..2e8449e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
@@ -1123,18 +1123,6 @@ public class GridCacheProxyImpl<K, V> implements GridCacheProxy<K, V>, Externali
}
/** {@inheritDoc} */
- @Nullable @Override public V peek(K key) {
- GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
-
- try {
- return delegate.peek(key);
- }
- finally {
- gate.leave(prev);
- }
- }
-
- /** {@inheritDoc} */
@Nullable @Override public V localPeek(K key,
CachePeekMode[] peekModes,
@Nullable IgniteCacheExpiryPolicy plc)
@@ -1163,18 +1151,6 @@ public class GridCacheProxyImpl<K, V> implements GridCacheProxy<K, V>, Externali
}
/** {@inheritDoc} */
- @Nullable @Override public V peek(K key, @Nullable Collection<GridCachePeekMode> modes) throws IgniteCheckedException {
- GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
-
- try {
- return delegate.peek(key, modes);
- }
- finally {
- gate.leave(prev);
- }
- }
-
- /** {@inheritDoc} */
@Nullable @Override public Cache.Entry<K, V> entry(K key) {
GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index 8f48d3d..8c72bc2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -56,7 +56,6 @@ import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
import static org.apache.ignite.internal.GridTopic.*;
import static org.apache.ignite.internal.IgniteNodeAttributes.*;
import static org.apache.ignite.internal.processors.cache.GridCacheOperation.*;
-import static org.apache.ignite.internal.processors.cache.GridCachePeekMode.*;
/**
* Cache utility methods.
@@ -77,9 +76,6 @@ public class GridCacheUtils {
/** Default mask name. */
private static final String DEFAULT_MASK_NAME = "<default>";
- /** Peek flags. */
- private static final GridCachePeekMode[] PEEK_FLAGS = new GridCachePeekMode[] { GLOBAL, SWAP };
-
/** TTL: minimum positive value. */
public static final long TTL_MINIMUM = 1L;
@@ -1026,13 +1022,6 @@ public class GridCacheUtils {
}
/**
- * @return Peek flags.
- */
- public static GridCachePeekMode[] peekFlags() {
- return PEEK_FLAGS;
- }
-
- /**
* @param log Logger.
* @param excl Excludes.
* @return Future listener that logs errors.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
index 6c27566..475fea6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.processors.cache.distributed.dht;
import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
import org.apache.ignite.cluster.*;
import org.apache.ignite.internal.*;
import org.apache.ignite.internal.processors.affinity.*;
@@ -874,8 +875,12 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
Cache.Entry<K, V> entry = (Cache.Entry<K, V>)o;
- return partId == ctx.affinity().partition(entry.getKey()) &&
- F.eq(entry.getValue(), peek(entry.getKey()));
+ try {
+ return partId == ctx.affinity().partition(entry.getKey()) &&
+ F.eq(entry.getValue(), localPeek(entry.getKey(), new CachePeekMode[] {CachePeekMode.ONHEAP}, null));
+ } catch (IgniteCheckedException e) {
+ throw new IgniteException(e);
+ }
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index c376fa0..2d7f58f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
import org.apache.ignite.cluster.*;
import org.apache.ignite.internal.*;
import org.apache.ignite.internal.cluster.*;
@@ -33,7 +34,6 @@ import org.apache.ignite.internal.processors.cache.version.*;
import org.apache.ignite.internal.processors.timeout.*;
import org.apache.ignite.internal.util.*;
import org.apache.ignite.internal.util.future.*;
-import org.apache.ignite.internal.util.lang.*;
import org.apache.ignite.internal.util.tostring.*;
import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.internal.util.typedef.internal.*;
@@ -56,7 +56,6 @@ import static org.apache.ignite.IgniteSystemProperties.*;
import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.*;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
import static org.apache.ignite.internal.processors.cache.GridCacheOperation.*;
-import static org.apache.ignite.internal.processors.cache.GridCachePeekMode.*;
import static org.apache.ignite.internal.processors.cache.GridCacheUtils.*;
import static org.apache.ignite.internal.processors.dr.GridDrType.*;
@@ -254,27 +253,11 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
/** {@inheritDoc} */
@Override public Cache.Entry<K, V> entry(K key) throws GridDhtInvalidPartitionException {
- return new CacheEntryImpl<>(key, peek(key));
- }
-
- /** {@inheritDoc} */
- @SuppressWarnings("ConstantConditions")
- @Override public V peek(K key, @Nullable Collection<GridCachePeekMode> modes) throws IgniteCheckedException {
- GridTuple<V> val = null;
-
- if (ctx.isReplicated() || !modes.contains(NEAR_ONLY)) {
- try {
- val = peek0(true, key, modes, ctx.tm().txx());
- }
- catch (GridCacheFilterFailedException ignored) {
- if (log.isDebugEnabled())
- log.debug("Filter validation failed for key: " + key);
-
- return null;
- }
+ try {
+ return new CacheEntryImpl<>(key, localPeek(key, new CachePeekMode[] {CachePeekMode.ONHEAP}, null));
+ } catch (IgniteCheckedException e) {
+ throw new IgniteException(e);
}
-
- return val != null ? val.get() : null;
}
/** {@inheritDoc} */
@@ -1783,8 +1766,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
if (hasNear) {
if (primary && updRes.sendToDht()) {
if (!ctx.affinity().belongs(node, entry.partition(), topVer)) {
- GridCacheVersionConflictContext ctx = updRes.conflictResolveResult();
-
// If put the same value as in request then do not need to send it back.
if (op == TRANSFORM || writeVal != updRes.newValue()) {
res.addNearValue(i,
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
index eb6d9a6..8d4f153 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.processors.cache.distributed.dht.colocated;
import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
import org.apache.ignite.cluster.*;
import org.apache.ignite.internal.*;
import org.apache.ignite.internal.processors.affinity.*;
@@ -28,7 +29,6 @@ import org.apache.ignite.internal.processors.cache.distributed.near.*;
import org.apache.ignite.internal.processors.cache.transactions.*;
import org.apache.ignite.internal.processors.cache.version.*;
import org.apache.ignite.internal.util.future.*;
-import org.apache.ignite.internal.util.lang.*;
import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.plugin.security.*;
@@ -39,8 +39,6 @@ import javax.cache.*;
import java.io.*;
import java.util.*;
-import static org.apache.ignite.internal.processors.cache.GridCachePeekMode.*;
-
/**
* Colocated cache.
*/
@@ -82,14 +80,13 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
map.setEntryFactory(new GridCacheMapEntryFactory() {
/** {@inheritDoc} */
@Override public GridCacheMapEntry create(GridCacheContext ctx,
- AffinityTopologyVersion topVer,
- KeyCacheObject key,
- int hash,
- CacheObject val,
- GridCacheMapEntry next,
- long ttl,
- int hdrId)
- {
+ AffinityTopologyVersion topVer,
+ KeyCacheObject key,
+ int hash,
+ CacheObject val,
+ GridCacheMapEntry next,
+ long ttl,
+ int hdrId) {
return new GridDhtColocatedCacheEntry(ctx, topVer, key, hash, val, next, ttl, hdrId);
}
});
@@ -134,25 +131,6 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
}
/** {@inheritDoc} */
- @Override public V peek(K key, @Nullable Collection<GridCachePeekMode> modes) throws IgniteCheckedException {
- GridTuple<V> val = null;
-
- if (!modes.contains(NEAR_ONLY)) {
- try {
- val = peek0(true, key, modes, ctx.tm().txx());
- }
- catch (GridCacheFilterFailedException ignored) {
- if (log.isDebugEnabled())
- log.debug("Filter validation failed for key: " + key);
-
- return null;
- }
- }
-
- return val != null ? val.get() : null;
- }
-
- /** {@inheritDoc} */
@Override public boolean isLocked(K key) {
KeyCacheObject cacheKey = ctx.toCacheKeyObject(key);
@@ -410,7 +388,12 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
/** {@inheritDoc} */
@Override public Cache.Entry<K, V> entry(K key) throws GridDhtInvalidPartitionException {
- return new CacheEntryImpl<>(key, peek(key));
+ try {
+ return new CacheEntryImpl<>(key, localPeek(key, new CachePeekMode[] {CachePeekMode.ONHEAP}, null));
+ }
+ catch (IgniteCheckedException e) {
+ throw new IgniteException(e);
+ }
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
index 75c8978..241af05 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
@@ -27,7 +27,6 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.*;
import org.apache.ignite.internal.processors.cache.transactions.*;
import org.apache.ignite.internal.processors.cache.version.*;
import org.apache.ignite.internal.util.future.*;
-import org.apache.ignite.internal.util.lang.*;
import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.lang.*;
@@ -38,8 +37,6 @@ import javax.cache.expiry.*;
import java.io.*;
import java.util.*;
-import static org.apache.ignite.internal.processors.cache.GridCachePeekMode.*;
-
/**
* Common logic for near caches.
*/
@@ -443,7 +440,11 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
@Override public Cache.Entry<K, V> entry(K key) {
// We don't try wrap entry from near or dht cache.
// Created object will be wrapped once some method is called.
- return new CacheEntryImpl<>(key, peek(key));
+ try {
+ return new CacheEntryImpl<>(key, localPeek(key, new CachePeekMode[] {CachePeekMode.ONHEAP}, null));
+ } catch (IgniteCheckedException e) {
+ throw new IgniteException(e);
+ }
}
/**
@@ -454,11 +455,9 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
*/
@Nullable public V peekNearOnly(K key) {
try {
- GridTuple<V> peek = peek0(true, key, SMART, CU.empty0());
-
- return peek != null ? peek.get() : null;
+ return localPeek(key, new CachePeekMode[] {CachePeekMode.ONHEAP}, null);
}
- catch (GridCacheFilterFailedException ignored) {
+ catch (IgniteCheckedException ignored) {
if (log.isDebugEnabled())
log.debug("Filter validation failed for key: " + key);
@@ -467,45 +466,6 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
}
/** {@inheritDoc} */
- @Override public V peek(K key, @Nullable CacheEntryPredicate filter) {
- try {
- GridTuple<V> res = peek0(false, key, SMART, filter);
-
- if (res != null)
- return res.get();
- }
- catch (GridCacheFilterFailedException e) {
- e.printStackTrace();
-
- assert false : "Filter should not fail since fail-fast is false";
- }
-
- return dht().peek(key, filter);
- }
-
- /** {@inheritDoc} */
- @Override public V peek(K key, @Nullable Collection<GridCachePeekMode> modes) throws IgniteCheckedException {
- GridTuple<V> val = null;
-
- if (!modes.contains(PARTITIONED_ONLY)) {
- try {
- val = peek0(true, key, modes, ctx.tm().txx());
- }
- catch (GridCacheFilterFailedException ignored) {
- if (log.isDebugEnabled())
- log.debug("Filter validation failed for key: " + key);
-
- return null;
- }
- }
-
- if (val != null)
- return val.get();
-
- return !modes.contains(NEAR_ONLY) ? dht().peek(key, modes) : null;
- }
-
- /** {@inheritDoc} */
@Override public boolean clearLocally0(K key, @Nullable CacheEntryPredicate[] filter) {
return super.clearLocally0(key, filter) | dht().clearLocally0(key, filter);
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxRemote.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxRemote.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxRemote.java
index 9969f65..8c597e2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxRemote.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxRemote.java
@@ -26,15 +26,12 @@ import org.apache.ignite.internal.processors.cache.version.*;
import org.apache.ignite.internal.util.*;
import org.apache.ignite.internal.util.tostring.*;
import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.transactions.*;
import org.jetbrains.annotations.*;
import java.io.*;
import java.util.*;
-import static org.apache.ignite.internal.processors.cache.GridCachePeekMode.*;
-
/**
* Transaction created by system implicitly on remote nodes.
*/
@@ -296,7 +293,9 @@ public class GridNearTxRemote extends GridDistributedTxRemoteAdapter {
cached.unswap();
try {
- if (cached.peek(GLOBAL, CU.empty0()) == null && cached.evictInternal(false, xidVer, null)) {
+ CacheObject val = cached.peek(true, false, false, null);
+
+ if (val == null && cached.evictInternal(false, xidVer, null)) {
evicted.add(entry.txKey());
return false;
@@ -350,7 +349,9 @@ public class GridNearTxRemote extends GridDistributedTxRemoteAdapter {
else {
cached.unswap();
- if (cached.peek(GLOBAL, CU.empty0()) == null && cached.evictInternal(false, xidVer, null)) {
+ CacheObject peek = cached.peek(true, false, false, null);
+
+ if (peek == null && cached.evictInternal(false, xidVer, null)) {
cached.context().cache().removeIfObsolete(key.key());
evicted.add(key);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java
index 9eac084..4add987 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.processors.task;
import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
import org.apache.ignite.cluster.*;
import org.apache.ignite.compute.*;
import org.apache.ignite.events.*;
@@ -343,7 +344,13 @@ public class GridTaskProcessor extends GridProcessorAdapter {
assert ctx.security().enabled();
- return tasksMetaCache.peek(new GridTaskNameHashKey(taskNameHash));
+ try {
+ return tasksMetaCache.localPeek(
+ new GridTaskNameHashKey(taskNameHash), new CachePeekMode[] {CachePeekMode.ONHEAP}, null);
+ }
+ catch (IgniteCheckedException e) {
+ throw new IgniteException(e);
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/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 ccc6aae..21cc7a3 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -381,7 +381,6 @@ org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$3
org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$4
org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeFutureSet
org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$MessageHandler
-org.apache.ignite.internal.processors.cache.GridCachePeekMode
org.apache.ignite.internal.processors.cache.GridCacheProcessor$2
org.apache.ignite.internal.processors.cache.GridCacheProcessor$3
org.apache.ignite.internal.processors.cache.GridCacheProcessor$4
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java
index 3624b58..89646e9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java
@@ -18,6 +18,7 @@
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.events.*;
import org.apache.ignite.internal.*;
@@ -95,7 +96,6 @@ public class GridCachePreloadingEvictionsSelfTest extends GridCommonAbstractTest
/**
* @throws Exception If failed.
*/
- @SuppressWarnings("BusyWait")
public void testEvictions() throws Exception {
try {
final Ignite ignite1 = startGrid(1);
@@ -240,7 +240,7 @@ public class GridCachePreloadingEvictionsSelfTest extends GridCommonAbstractTest
", s2=" + cache2.size() + ']';
for (Integer key : cache1.keySet()) {
- Object e = cache1.peek(key);
+ Object e = cache1.localPeek(key, new CachePeekMode[] {CachePeekMode.ONHEAP}, null);
if (e != null)
assert cache2.containsKey(key) : "Cache2 does not contain key: " + key;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/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
index 1d86984..9bdde1b 100644
--- 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
@@ -24,7 +24,6 @@ import org.apache.ignite.internal.processors.cache.transactions.*;
import org.apache.ignite.internal.processors.cache.version.*;
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.*;
@@ -607,25 +606,6 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
return ver;
}
- /** @inheritDoc */
- @Override public CacheObject peek(GridCachePeekMode mode, CacheEntryPredicate[] filter) {
- return val;
- }
-
- /** @inheritDoc */
- @Override public GridTuple<CacheObject> peek0(boolean failFast, GridCachePeekMode mode,
- CacheEntryPredicate[] filter, IgniteInternalTx tx)
- throws GridCacheEntryRemovedException, GridCacheFilterFailedException, IgniteCheckedException {
- return F.t(val);
- }
-
- /** @inheritDoc */
- @Override public CacheObject peek(Collection<GridCachePeekMode> modes,
- CacheEntryPredicate[] filter)
- throws GridCacheEntryRemovedException {
- return val;
- }
-
/** {@inheritDoc} */
@Override public CacheObject poke(CacheObject val) throws GridCacheEntryRemovedException, IgniteCheckedException {
CacheObject old = this.val;
@@ -859,4 +839,15 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
{
return null;
}
+
+ /** {@inheritDoc} */
+ @Nullable @Override public CacheObject peek(
+ boolean heap,
+ boolean offheap,
+ boolean swap,
+ @Nullable IgniteCacheExpiryPolicy plc)
+ throws GridCacheEntryRemovedException, IgniteCheckedException {
+ return null;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionNearReadersSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionNearReadersSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionNearReadersSelfTest.java
index cf1882a..99b95ce 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionNearReadersSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionNearReadersSelfTest.java
@@ -256,7 +256,7 @@ public class GridCacheDhtEvictionNearReadersSelfTest extends GridCommonAbstractT
assert entryPrimary != null;
assert entryBackup != null;
- assertEquals(val, nearOther.peek(key));
+ assertEquals(val, localPeek(nearOther, key));
assertTrue(!entryPrimary.readers().isEmpty());
@@ -268,13 +268,13 @@ public class GridCacheDhtEvictionNearReadersSelfTest extends GridCommonAbstractT
futBackup.get(3000);
futPrimary.get(3000);
- assertNull(dhtPrimary.peek(key));
- assertNull(nearPrimary.peek(key));
+ assertNull(localPeek(dhtPrimary, key));
+ assertNull(localPeek(nearPrimary, key));
- assertNull(dhtBackup.peek(key));
- assertNull(nearBackup.peek(key));
+ assertNull(localPeek(dhtBackup, key));
+ assertNull(localPeek(nearBackup, key));
- assertNull(dhtOther.peek(key));
- assertNull(nearOther.peek(key));
+ assertNull(localPeek(dhtOther, key));
+ assertNull(localPeek(nearOther, key));
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionSelfTest.java
index 3b16864..39ef872 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionSelfTest.java
@@ -210,11 +210,11 @@ public class GridCacheDhtEvictionSelfTest extends GridCommonAbstractTest {
// Put on primary node.
nearPrimary.put(key, val, null);
- assertEquals(val, nearPrimary.peek(key));
- assertEquals(val, dhtPrimary.peek(key));
+ assertEquals(val, localPeek(nearPrimary, key));
+ assertEquals(val, localPeek(dhtPrimary, key));
- assertEquals(val, nearBackup.peek(key));
- assertEquals(val, dhtBackup.peek(key));
+ assertEquals(val, localPeek(nearBackup, key));
+ assertEquals(val, localPeek(dhtBackup, key));
GridDhtCacheEntry entryPrimary = (GridDhtCacheEntry)dhtPrimary.peekEx(key);
GridDhtCacheEntry entryBackup = (GridDhtCacheEntry)dhtBackup.peekEx(key);
@@ -281,11 +281,11 @@ public class GridCacheDhtEvictionSelfTest extends GridCommonAbstractTest {
for (Integer key : keys) {
String val = "v" + key;
- assertEquals(val, nearPrimary.peek(key));
- assertEquals(val, dhtPrimary.peek(key));
+ assertEquals(val, localPeek(nearPrimary, key));
+ assertEquals(val, localPeek(dhtPrimary, key));
- assertEquals(val, nearBackup.peek(key));
- assertEquals(val, dhtBackup.peek(key));
+ assertEquals(val, localPeek(nearBackup, key));
+ assertEquals(val, localPeek(dhtBackup, key));
}
final AtomicInteger cntBackup = new AtomicInteger();
@@ -324,8 +324,8 @@ public class GridCacheDhtEvictionSelfTest extends GridCommonAbstractTest {
for (Integer key : keys) {
String msg = "Failed key: " + key;
- assertNull(msg, nearBackup.peek(key));
- assertNull(msg, dhtBackup.peek(key));
+ assertNull(msg, localPeek(nearBackup, key));
+ assertNull(msg, localPeek(dhtBackup, key));
assertNull(msg, nearBackup.peekEx(key));
assertNull(msg, dhtBackup.peekEx(key));
}
@@ -333,8 +333,8 @@ public class GridCacheDhtEvictionSelfTest extends GridCommonAbstractTest {
for (Integer key : keys) {
String msg = "Failed key: " + key;
- assertNull(msg, nearPrimary.peek(key));
- assertNull(msg, dhtPrimary.peek(key));
+ assertNull(msg, localPeek(nearPrimary, key));
+ assertNull(msg, localPeek(dhtPrimary, key));
assertNull(msg, nearPrimary.peekEx(key));
assertNull(dhtPrimary.peekEx(key));
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMappingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMappingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMappingSelfTest.java
index 682a321..bf8a27b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMappingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMappingSelfTest.java
@@ -90,7 +90,7 @@ public class GridCacheDhtMappingSelfTest extends GridCommonAbstractTest {
GridDhtCacheAdapter<Integer, Integer> dht = ((GridNearCacheAdapter<Integer, Integer>)
((IgniteKernal)g).<Integer, Integer>internalCache()).dht();
- if (dht.peek(kv) != null) {
+ if (localPeek(dht, kv) != null) {
info("Key found on node: " + g.cluster().localNode().id());
cnt++;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
index b3b04e0..8a9816d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
@@ -44,7 +44,6 @@ import java.util.concurrent.locks.*;
import static org.apache.ignite.cache.CacheAtomicityMode.*;
import static org.apache.ignite.cache.CacheMode.*;
-import static org.apache.ignite.internal.processors.cache.GridCachePeekMode.*;
import static org.apache.ignite.transactions.TransactionConcurrency.*;
import static org.apache.ignite.transactions.TransactionIsolation.*;
@@ -186,15 +185,6 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
}
/**
- * @param g Grid.
- * @return Dht cache.
- */
- @SuppressWarnings({"unchecked", "TypeMayBeWeakened"})
- private GridNearCacheAdapter<Integer, String> near(Ignite g) {
- return (GridNearCacheAdapter)((IgniteKernal)g).internalCache();
- }
-
- /**
* @param idx Index.
* @return Affinity.
*/
@@ -359,7 +349,7 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
GridCacheAdapter<Integer, String> dhtCache = dht(G.ignite(n.id()));
- String s = dhtCache.peek(key);
+ String s = dhtCache.localPeek(key, new CachePeekMode[] {CachePeekMode.ONHEAP}, null);
assert s != null : "Value is null for key: " + key;
assertEquals(s, Integer.toString(key));
@@ -392,7 +382,7 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
if (entry != null)
assertNull("Unexpected entry: " + entry, entry.rawGetOrUnmarshal(false));
- assertNotNull(dht(primaryGrid(3)).peek(3));
+ assertNotNull(localPeek(dht(primaryGrid(3)), 3));
tx.commit();
}
@@ -409,8 +399,8 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
assertEquals("2", near.localPeek(2, CachePeekMode.ONHEAP));
assertEquals("3", near.localPeek(3, CachePeekMode.ONHEAP));
- assertEquals("2", dht(primaryGrid(2)).peek(2));
- assertEquals("3", dht(primaryGrid(3)).peek(3));
+ assertEquals("2", localPeek(dht(primaryGrid(2)), 2));
+ assertEquals("3", localPeek(dht(primaryGrid(3)), 3));
assertEquals(2, near.localSize());
assertEquals(2, near.localSize());
@@ -425,7 +415,7 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
assertEquals("2", near.localPeek(2, CachePeekMode.ONHEAP));
assertEquals("2", near.get(2));
- assertEquals("2", dht(primaryGrid(2)).peek(2));
+ assertEquals("2", localPeek(dht(primaryGrid(2)), 2));
assertEquals(1, near.localSize());
assertEquals(1, near.localSize());
@@ -454,7 +444,7 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
info("Primary grid for key 3: " + U.toShortString(primaryIgnite.cluster().localNode()));
- assertEquals("3", dht(primaryIgnite).peek(3));
+ assertEquals("3", localPeek(dht(primaryIgnite), 3));
assertEquals(1, near.localSize());
assertEquals(1, near.localSize());
@@ -469,7 +459,7 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
for (Ignite b : backups) {
info("Backup grid for key 3: " + U.toShortString(b.cluster().localNode()));
- assertEquals("3", dht(b).peek(3));
+ assertEquals("3", localPeek(dht(b), 3));
assertEquals(1, dht(b).size());
}
@@ -492,8 +482,8 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
assertEquals("2", near.get(2));
assertEquals("3", near.get(3));
- assertEquals("2", dht(primaryGrid(2)).peek(2));
- assertEquals("3", dht(primaryGrid(3)).peek(3));
+ assertEquals("2", localPeek(dht(primaryGrid(2)), 2));
+ assertEquals("3", localPeek(dht(primaryGrid(3)), 3));
assertEquals(2, near.localSize());
assertEquals(2, near.localSize());
@@ -519,7 +509,7 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
assertEquals("2", near.get(2));
assertEquals("3", near.get(3));
- assertNotNull(dht(primaryGrid(3)).peek(3, F.asList(GLOBAL)));
+ assertNotNull(dht(primaryGrid(3)).localPeek(3, new CachePeekMode[] {CachePeekMode.ONHEAP}, null));
tx.commit();
}
@@ -536,8 +526,8 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
assertEquals("2", near.localPeek(2, CachePeekMode.ONHEAP));
assertEquals("3", near.localPeek(3, CachePeekMode.ONHEAP));
- assertEquals("2", dht(primaryGrid(2)).peek(2));
- assertEquals("3", dht(primaryGrid(3)).peek(3));
+ assertEquals("2", localPeek(dht(primaryGrid(2)), 2));
+ assertEquals("3", localPeek(dht(primaryGrid(3)), 3));
assertEquals(2, near.localSize());
assertEquals(2, near.localSize());
@@ -604,8 +594,8 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
assertNull(near0.peekNearOnly(key));
assertNull(near1.peekNearOnly(key));
- assertEquals(val, dht0.peek(key));
- assertEquals(val, dht1.peek(key));
+ assertEquals(val, localPeek(dht0, key));
+ assertEquals(val, localPeek(dht1, key));
}
/** @throws Exception If failed. */
@@ -688,8 +678,8 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
assertTrue("Invalid near entry [hash=" + nearEntry2, nearEntry2.valid(topVer));
assertEquals(val, cache.localPeek(key, CachePeekMode.ONHEAP));
- assertEquals(val, dht(0).peek(key));
- assertEquals(val, dht(1).peek(key));
+ assertEquals(val, dhtPeek(0, key));
+ assertEquals(val, dhtPeek(1, key));
GridNearCacheEntry nearEntry3 = nearEntry(0, key);
@@ -707,7 +697,7 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
assertEquals(val, cache.getAndRemove(key));
assertNull(cache.localPeek(key, CachePeekMode.ONHEAP));
- assertNull(dht(primaryGrid(key)).peek(key));
+ assertNull(localPeek(dht(primaryGrid(key)), key));
assertTrue(cache.isLocalLocked(key, false));
assertTrue(cache.isLocalLocked(key, true));
@@ -753,7 +743,7 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
near.put(key, val);
assertEquals(val, near.localPeek(key, CachePeekMode.ONHEAP));
- assertEquals(val, dht(primaryGrid(key)).peek(key));
+ assertEquals(val, localPeek(dht(primaryGrid(key)), key));
assertTrue(near.isLocalLocked(key, false));
assertTrue(near.isLocalLocked(key, true));
@@ -765,7 +755,7 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
assertEquals(val, near.getAndRemove(key));
assertNull(near.localPeek(key, CachePeekMode.ONHEAP));
- assertNull(dht(primaryGrid(key)).peek(key));
+ assertNull(localPeek(dht(primaryGrid(key)), key));
assertTrue(near.isLocalLocked(key, false));
assertTrue(near.isLocalLocked(key, true));
@@ -811,8 +801,8 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
cache.put(key, val);
- assertEquals(val, dht(0).peek(key));
- assertEquals(val, dht(1).peek(key));
+ assertEquals(val, dhtPeek(0, key));
+ assertEquals(val, dhtPeek(1, key));
assertNull(near(0).peekNearOnly(key));
assertNull(near(1).peekNearOnly(key));
@@ -829,8 +819,8 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
else
assertEquals(val, cache.get(key));
- assertEquals(val, dht(0).peek(key));
- assertEquals(val, dht(1).peek(key));
+ assertEquals(val, dhtPeek(0, key));
+ assertEquals(val, dhtPeek(1, key));
assertNull(near(0).peekNearOnly(key));
assertNull(near(1).peekNearOnly(key));
@@ -857,8 +847,8 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
cache.put(key, val);
- assertEquals(val, dht(0).peek(key));
- assertEquals(val, dht(1).peek(key));
+ assertEquals(val, dhtPeek(0, key));
+ assertEquals(val, dhtPeek(1, key));
assertNull(near(0).peekNearOnly(key));
assertNull(near(1).peekNearOnly(key));
@@ -882,8 +872,8 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
assertTrue(cache.remove(key));
}
- assertNull(dht(0).peek(key));
- assertNull(dht(1).peek(key));
+ assertNull(dhtPeek(0, key));
+ assertNull(dhtPeek(1, key));
assertNull(near(0).peekNearOnly(key));
assertNull(near(1).peekNearOnly(key));
@@ -926,14 +916,6 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
return map.get(key);
}
- /**
- * @param key Key.
- * @return {@code True} if has value.
- */
- boolean hasValue(Integer key) {
- return map.containsKey(key);
- }
-
/** @return {@code True} if empty. */
boolean isEmpty() {
return map.isEmpty();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dfb4679f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
index d361d91..3cc4e01 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
@@ -27,7 +27,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
import org.apache.ignite.testframework.junits.common.*;
import org.apache.ignite.transactions.*;
-import javax.cache.configuration.*;
import java.util.concurrent.*;
import java.util.concurrent.locks.*;
@@ -132,7 +131,7 @@ public class GridCacheNearOneNodeSelfTest extends GridCommonAbstractTest {
assertEquals(1, near.size());
assertEquals(1, near.size());
- String d = dht.peek(1);
+ String d = localPeek(dht, 1);
assert d != null;
assertEquals(d, "1");
@@ -163,7 +162,6 @@ public class GridCacheNearOneNodeSelfTest extends GridCommonAbstractTest {
GridCacheEntryEx entry = dht.peekEx(2);
assert entry == null || entry.rawGetOrUnmarshal(false) == null : "Invalid entry: " + entry;
- assert dht.peek(3) != null;
tx.commit();
}
@@ -215,13 +213,13 @@ public class GridCacheNearOneNodeSelfTest extends GridCommonAbstractTest {
near.put(1, "1");
assertEquals("1", near.localPeek(1, CachePeekMode.ONHEAP));
- assertEquals("1", dht().peek(1));
+ assertEquals("1", dhtPeek(1));
assertEquals("1", near.get(1));
assertEquals("1", near.getAndRemove(1));
assertNull(near.localPeek(1, CachePeekMode.ONHEAP));
- assertNull(dht().peek(1));
+ assertNull(dhtPeek(1));
assertTrue(near.isLocalLocked(1, false));
assertTrue(near.isLocalLocked(1, true));
@@ -246,7 +244,7 @@ public class GridCacheNearOneNodeSelfTest extends GridCommonAbstractTest {
near.put(1, "1");
assertEquals("1", near.localPeek(1, CachePeekMode.ONHEAP));
- assertEquals("1", dht().peek(1));
+ assertEquals("1", dhtPeek(1));
assertTrue(near.isLocalLocked(1, false));
assertTrue(near.isLocalLocked(1, true));
@@ -258,7 +256,7 @@ public class GridCacheNearOneNodeSelfTest extends GridCommonAbstractTest {
assertEquals("1", near.getAndRemove(1));
assertNull(near.localPeek(1, CachePeekMode.ONHEAP));
- assertNull(dht().peek(1));
+ assertNull(dhtPeek(1));
assertTrue(near.isLocalLocked(1, false));
assertTrue(near.isLocalLocked(1, true));
@@ -284,7 +282,7 @@ public class GridCacheNearOneNodeSelfTest extends GridCommonAbstractTest {
cache.put(1, "val1");
- assertEquals("val1", dht().peek(1));
+ assertEquals("val1", dhtPeek(1));
assertNull(near().peekNearOnly(1));
Transaction tx = grid().transactions().txStart(PESSIMISTIC, REPEATABLE_READ);
@@ -293,7 +291,7 @@ public class GridCacheNearOneNodeSelfTest extends GridCommonAbstractTest {
tx.commit();
- assertEquals("val1", dht().peek(1));
+ assertEquals("val1", dhtPeek(1));
assertNull(near().peekNearOnly(1));
}
@@ -303,7 +301,7 @@ public class GridCacheNearOneNodeSelfTest extends GridCommonAbstractTest {
cache.put(1, "val1");
- assertEquals("val1", dht().peek(1));
+ assertEquals("val1", dhtPeek(1));
assertNull(near().peekNearOnly(1));
Transaction tx = grid().transactions().txStart(PESSIMISTIC, REPEATABLE_READ);
@@ -314,7 +312,7 @@ public class GridCacheNearOneNodeSelfTest extends GridCommonAbstractTest {
tx.commit();
- assertNull(dht().peek(1));
+ assertNull(dhtPeek(1));
assertNull(near().peekNearOnly(1));
}
@@ -337,11 +335,6 @@ public class GridCacheNearOneNodeSelfTest extends GridCommonAbstractTest {
create = true;
}
- /** @param create Create flag. */
- void create(boolean create) {
- this.create = create;
- }
-
/** @return Create flag. */
boolean isCreate() {
return create;
[9/9] incubator-ignite git commit: Merge branch 'ignite-sprint-3' of
https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-sprint-3
Posted by sb...@apache.org.
Merge branch 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-sprint-3
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/adba7eba
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/adba7eba
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/adba7eba
Branch: refs/heads/ignite-sprint-3
Commit: adba7eba7c417b9aa29ec8f731712546721a2c7d
Parents: 7cb512a c4611b8
Author: Andrey Gura <ag...@gridgain.com>
Authored: Fri Apr 3 12:17:08 2015 +0300
Committer: Andrey Gura <ag...@gridgain.com>
Committed: Fri Apr 3 12:17:08 2015 +0300
----------------------------------------------------------------------
.../ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
[4/9] incubator-ignite git commit: # ignite-645 review
Posted by sb...@apache.org.
# ignite-645 review
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/282e8a57
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/282e8a57
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/282e8a57
Branch: refs/heads/ignite-sprint-3
Commit: 282e8a5717722eafeec0bb7abb5b2e75f8399f9e
Parents: 7f69f2a
Author: sboikov <se...@inria.fr>
Authored: Wed Apr 1 23:25:08 2015 +0300
Committer: sboikov <se...@inria.fr>
Committed: Wed Apr 1 23:25:08 2015 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheEntryEx.java | 8 ++++----
.../processors/cache/GridCacheMapEntry.java | 13 -------------
.../cache/distributed/dht/GridDhtCacheAdapter.java | 6 +++---
.../distributed/dht/atomic/GridDhtAtomicCache.java | 6 +++---
.../dht/colocated/GridDhtColocatedCache.java | 17 +++++++++--------
.../distributed/near/GridNearCacheAdapter.java | 14 ++++++--------
.../processors/task/GridTaskProcessor.java | 2 +-
7 files changed, 26 insertions(+), 40 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/282e8a57/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
index adeb95b..c0f1d35 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
@@ -580,10 +580,10 @@ public interface GridCacheEntryEx {
/**
* Peeks into entry without loading value or updating statistics.
*
- * @param heap Heap.
- * @param offheap Offheap.
- * @param swap Swap.
- * @param plc Policy.
+ * @param heap Read from heap flag.
+ * @param offheap Read from offheap flag.
+ * @param swap Read from swap flag.
+ * @param plc Expiry policy if TTL should be updated.
* @return Value.
* @throws GridCacheEntryRemovedException If entry has been removed.
* @throws IgniteCheckedException If failed.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/282e8a57/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index 5bc255f..45fbced 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -2857,19 +2857,6 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
/**
* @param failFast Fail fast flag.
- * @param filter Filter.
- * @param tx Transaction to peek value at (if mode is TX value).
- * @return Peeked value.
- * @throws GridCacheFilterFailedException If filter failed.
- */
- @Nullable private GridTuple<CacheObject> peekTx(boolean failFast,
- CacheEntryPredicate[] filter,
- @Nullable IgniteInternalTx tx) throws GridCacheFilterFailedException {
- return tx == null ? null : tx.peek(cctx, failFast, key, filter);
- }
-
- /**
- * @param failFast Fail fast flag.
* @param topVer Topology version.
* @param filter Filter.
* @param expiryPlc Optional expiry policy.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/282e8a57/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
index 475fea6..c9a23b6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.processors.cache.distributed.dht;
import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
import org.apache.ignite.cluster.*;
import org.apache.ignite.internal.*;
import org.apache.ignite.internal.processors.affinity.*;
@@ -877,8 +876,9 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
try {
return partId == ctx.affinity().partition(entry.getKey()) &&
- F.eq(entry.getValue(), localPeek(entry.getKey(), new CachePeekMode[] {CachePeekMode.ONHEAP}, null));
- } catch (IgniteCheckedException e) {
+ F.eq(entry.getValue(), localPeek(entry.getKey(), CachePeekModes.ONHEAP_ONLY, null));
+ }
+ catch (IgniteCheckedException e) {
throw new IgniteException(e);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/282e8a57/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 2d7f58f..b8639d9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
import org.apache.ignite.cluster.*;
import org.apache.ignite.internal.*;
import org.apache.ignite.internal.cluster.*;
@@ -254,8 +253,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
/** {@inheritDoc} */
@Override public Cache.Entry<K, V> entry(K key) throws GridDhtInvalidPartitionException {
try {
- return new CacheEntryImpl<>(key, localPeek(key, new CachePeekMode[] {CachePeekMode.ONHEAP}, null));
- } catch (IgniteCheckedException e) {
+ return new CacheEntryImpl<>(key, localPeek(key, CachePeekModes.ONHEAP_ONLY, null));
+ }
+ catch (IgniteCheckedException e) {
throw new IgniteException(e);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/282e8a57/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
index 8d4f153..0782a37 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
@@ -80,13 +80,14 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
map.setEntryFactory(new GridCacheMapEntryFactory() {
/** {@inheritDoc} */
@Override public GridCacheMapEntry create(GridCacheContext ctx,
- AffinityTopologyVersion topVer,
- KeyCacheObject key,
- int hash,
- CacheObject val,
- GridCacheMapEntry next,
- long ttl,
- int hdrId) {
+ AffinityTopologyVersion topVer,
+ KeyCacheObject key,
+ int hash,
+ CacheObject val,
+ GridCacheMapEntry next,
+ long ttl,
+ int hdrId)
+ {
return new GridDhtColocatedCacheEntry(ctx, topVer, key, hash, val, next, ttl, hdrId);
}
});
@@ -389,7 +390,7 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
/** {@inheritDoc} */
@Override public Cache.Entry<K, V> entry(K key) throws GridDhtInvalidPartitionException {
try {
- return new CacheEntryImpl<>(key, localPeek(key, new CachePeekMode[] {CachePeekMode.ONHEAP}, null));
+ return new CacheEntryImpl<>(key, localPeek(key, CachePeekModes.ONHEAP_ONLY, null));
}
catch (IgniteCheckedException e) {
throw new IgniteException(e);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/282e8a57/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
index 241af05..b08a49b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
@@ -441,8 +441,9 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
// We don't try wrap entry from near or dht cache.
// Created object will be wrapped once some method is called.
try {
- return new CacheEntryImpl<>(key, localPeek(key, new CachePeekMode[] {CachePeekMode.ONHEAP}, null));
- } catch (IgniteCheckedException e) {
+ return new CacheEntryImpl<>(key, localPeek(key, CachePeekModes.ONHEAP_ONLY, null));
+ }
+ catch (IgniteCheckedException e) {
throw new IgniteException(e);
}
}
@@ -455,13 +456,10 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
*/
@Nullable public V peekNearOnly(K key) {
try {
- return localPeek(key, new CachePeekMode[] {CachePeekMode.ONHEAP}, null);
+ return localPeek(key, CachePeekModes.ONHEAP_ONLY, null);
}
- catch (IgniteCheckedException ignored) {
- if (log.isDebugEnabled())
- log.debug("Filter validation failed for key: " + key);
-
- return null;
+ catch (IgniteCheckedException e) {
+ throw new IgniteException(e);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/282e8a57/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java
index 4add987..274310e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java
@@ -346,7 +346,7 @@ public class GridTaskProcessor extends GridProcessorAdapter {
try {
return tasksMetaCache.localPeek(
- new GridTaskNameHashKey(taskNameHash), new CachePeekMode[] {CachePeekMode.ONHEAP}, null);
+ new GridTaskNameHashKey(taskNameHash), CachePeekModes.ONHEAP_ONLY, null);
}
catch (IgniteCheckedException e) {
throw new IgniteException(e);
[5/9] incubator-ignite git commit: # ignite-645
Posted by sb...@apache.org.
# ignite-645
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ef095dc6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ef095dc6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ef095dc6
Branch: refs/heads/ignite-sprint-3
Commit: ef095dc64346ad8c9d3a641e8d1554bb18e97a11
Parents: 282e8a5
Author: sboikov <sb...@gridgain.com>
Authored: Thu Apr 2 09:48:35 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Apr 2 09:48:35 2015 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheEntryEx.java | 13 -------
.../processors/cache/GridCacheMapEntry.java | 36 --------------------
.../processors/cache/GridCacheTestEntryEx.java | 9 -----
3 files changed, 58 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ef095dc6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
index c0f1d35..52b6a38 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
@@ -595,19 +595,6 @@ public interface GridCacheEntryEx {
throws GridCacheEntryRemovedException, IgniteCheckedException;
/**
- * This method overwrites current in-memory value with new value.
- * <p>
- * Note that this method is non-transactional and non-distributed and should almost
- * never be used. It is meant to be used when fixing some heurisitic error state.
- *
- * @param val Value to set.
- * @return Previous value.
- * @throws IgniteCheckedException If poke operation failed.
- * @throws GridCacheEntryRemovedException if entry was unexpectedly removed.
- */
- public CacheObject poke(CacheObject val) throws GridCacheEntryRemovedException, IgniteCheckedException;
-
- /**
* Sets new value if current version is <tt>0</tt>
*
* @param val New value.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ef095dc6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index 45fbced..11ee7d9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -2800,42 +2800,6 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
return peek(heap, offheap, swap, topVer, plc);
}
- /** {@inheritDoc} */
- @Override public CacheObject poke(CacheObject val) throws GridCacheEntryRemovedException, IgniteCheckedException {
- assert val != null;
-
- CacheObject old;
-
- synchronized (this) {
- checkObsolete();
-
- if (isNew() || !valid(AffinityTopologyVersion.NONE))
- unswap(true);
-
- if (deletedUnlocked())
- return null;
-
- old = rawGetOrUnmarshalUnlocked(false);
-
- GridCacheVersion nextVer = nextVersion();
-
- // Update index inside synchronization since it can be updated
- // in load methods without actually holding entry lock.
- long expireTime = expireTimeExtras();
-
- val = cctx.kernalContext().cacheObjects().prepareForCache(val, cctx);
-
- updateIndex(val, expireTime, nextVer, old);
-
- update(val, expireTime, ttlExtras(), nextVer);
- }
-
- if (log.isDebugEnabled())
- log.debug("Poked cache entry [newVal=" + val + ", oldVal=" + old + ", entry=" + this + ']');
-
- return old;
- }
-
/**
* Checks that entries in group locks transactions are not locked during commit.
*
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ef095dc6/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
index 9bdde1b..a21fea5 100644
--- 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
@@ -606,15 +606,6 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
return ver;
}
- /** {@inheritDoc} */
- @Override public CacheObject poke(CacheObject val) throws GridCacheEntryRemovedException, IgniteCheckedException {
- CacheObject old = this.val;
-
- this.val = val;
-
- return old;
- }
-
/** @inheritDoc */
@Override public boolean initialValue(
CacheObject val,
[6/9] incubator-ignite git commit: ignite-645 review fixes
Posted by sb...@apache.org.
ignite-645 review fixes
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/07ed759a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/07ed759a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/07ed759a
Branch: refs/heads/ignite-sprint-3
Commit: 07ed759a89d49e35ec0ef3122e69e094af666f8c
Parents: ef095dc
Author: Andrey Gura <ag...@gridgain.com>
Authored: Thu Apr 2 15:25:24 2015 +0300
Committer: Andrey Gura <ag...@gridgain.com>
Committed: Thu Apr 2 15:25:24 2015 +0300
----------------------------------------------------------------------
.../distributed/near/GridNearCacheAdapter.java | 24 --------
.../near/GridCacheNearMultiNodeSelfTest.java | 31 +++++-----
.../near/GridCacheNearOneNodeSelfTest.java | 8 +--
.../near/GridCacheNearReadersSelfTest.java | 62 ++++++++++----------
4 files changed, 49 insertions(+), 76 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/07ed759a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
index b08a49b..e05ec2e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
@@ -419,15 +419,6 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
return super.evict(key, filter) & dht().evict(key, filter);
}
- /**
- * @param key Key to evict.
- * @param filter Optional filter.
- * @return {@code True} if evicted.
- */
- public boolean evictNearOnly(K key, @Nullable CacheEntryPredicate[] filter) {
- return super.evict(key, filter);
- }
-
/** {@inheritDoc} */
@Override public void evictAll(Collection<? extends K> keys,
@Nullable CacheEntryPredicate[] filter) {
@@ -448,21 +439,6 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
}
}
- /**
- * Peeks only near cache without looking into DHT cache.
- *
- * @param key Key.
- * @return Peeked value.
- */
- @Nullable public V peekNearOnly(K key) {
- try {
- return localPeek(key, CachePeekModes.ONHEAP_ONLY, null);
- }
- catch (IgniteCheckedException e) {
- throw new IgniteException(e);
- }
- }
-
/** {@inheritDoc} */
@Override public boolean clearLocally0(K key, @Nullable CacheEntryPredicate[] filter) {
return super.clearLocally0(key, filter) | dht().clearLocally0(key, filter);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/07ed759a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
index 8a9816d..548564a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
@@ -585,14 +585,11 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
cache.put(key, val);
- GridNearCacheAdapter<Integer, String> near0 = near(0);
- GridNearCacheAdapter<Integer, String> near1 = near(1);
-
GridDhtCacheAdapter<Integer, String> dht0 = dht(0);
GridDhtCacheAdapter<Integer, String> dht1 = dht(1);
- assertNull(near0.peekNearOnly(key));
- assertNull(near1.peekNearOnly(key));
+ assertNull(near(0).peekEx(key));
+ assertNull(near(1).peekEx(key));
assertEquals(val, localPeek(dht0, key));
assertEquals(val, localPeek(dht1, key));
@@ -690,8 +687,8 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
assertNotNull(nearEntry3);
assertTrue("Invalid near entry: " + nearEntry3, nearEntry3.valid(topVer));
- assertNotNull(near(0).peekNearOnly(key));
- assertNull(near(1).peekNearOnly(key));
+ assertNotNull(near(0).peekEx(key));
+ assertNull(near(1).peekEx(key));
assertEquals(val, cache.get(key));
assertEquals(val, cache.getAndRemove(key));
@@ -706,8 +703,8 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
lock.unlock();
}
- assertNull(near(0).peekNearOnly(key));
- assertNull(near(1).peekNearOnly(key));
+ assertNull(near(0).peekEx(key));
+ assertNull(near(1).peekEx(key));
assertFalse(near(0).isLockedNearOnly(key));
assertFalse(cache.isLocalLocked(key, true));
@@ -804,8 +801,8 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
assertEquals(val, dhtPeek(0, key));
assertEquals(val, dhtPeek(1, key));
- assertNull(near(0).peekNearOnly(key));
- assertNull(near(1).peekNearOnly(key));
+ assertNull(near(0).peekEx(key));
+ assertNull(near(1).peekEx(key));
if (transactional()) {
@@ -822,8 +819,8 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
assertEquals(val, dhtPeek(0, key));
assertEquals(val, dhtPeek(1, key));
- assertNull(near(0).peekNearOnly(key));
- assertNull(near(1).peekNearOnly(key));
+ assertNull(near(0).peekEx(key));
+ assertNull(near(1).peekEx(key));
}
/** @throws Exception If failed. */
@@ -850,8 +847,8 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
assertEquals(val, dhtPeek(0, key));
assertEquals(val, dhtPeek(1, key));
- assertNull(near(0).peekNearOnly(key));
- assertNull(near(1).peekNearOnly(key));
+ assertNull(near(0).peekEx(key));
+ assertNull(near(1).peekEx(key));
if (transactional()) {
try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
@@ -875,8 +872,8 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
assertNull(dhtPeek(0, key));
assertNull(dhtPeek(1, key));
- assertNull(near(0).peekNearOnly(key));
- assertNull(near(1).peekNearOnly(key));
+ assertNull(near(0).peekEx(key));
+ assertNull(near(1).peekEx(key));
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/07ed759a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
index 3cc4e01..d73c8ab 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
@@ -283,7 +283,7 @@ public class GridCacheNearOneNodeSelfTest extends GridCommonAbstractTest {
cache.put(1, "val1");
assertEquals("val1", dhtPeek(1));
- assertNull(near().peekNearOnly(1));
+ assertNull(near().peekEx(1));
Transaction tx = grid().transactions().txStart(PESSIMISTIC, REPEATABLE_READ);
@@ -292,7 +292,7 @@ public class GridCacheNearOneNodeSelfTest extends GridCommonAbstractTest {
tx.commit();
assertEquals("val1", dhtPeek(1));
- assertNull(near().peekNearOnly(1));
+ assertNull(near().peekEx(1));
}
/** @throws Exception If failed. */
@@ -302,7 +302,7 @@ public class GridCacheNearOneNodeSelfTest extends GridCommonAbstractTest {
cache.put(1, "val1");
assertEquals("val1", dhtPeek(1));
- assertNull(near().peekNearOnly(1));
+ assertNull(near().peekEx(1));
Transaction tx = grid().transactions().txStart(PESSIMISTIC, REPEATABLE_READ);
@@ -313,7 +313,7 @@ public class GridCacheNearOneNodeSelfTest extends GridCommonAbstractTest {
tx.commit();
assertNull(dhtPeek(1));
- assertNull(near().peekNearOnly(1));
+ assertNull(near().peekEx(1));
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/07ed759a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
index a0d9f03..59378bb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
@@ -245,8 +245,8 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
assertEquals("v1", dhtPeek(cache1, 1));
assertEquals("v1", dhtPeek(cache2, 1));
- assertNull(near(cache1).peekNearOnly(1));
- assertNull(near(cache2).peekNearOnly(1));
+ assertNull(near(cache1).peekEx(1));
+ assertNull(near(cache2).peekEx(1));
GridDhtCacheEntry e1 = (GridDhtCacheEntry)dht(cache1).entryEx(1);
@@ -261,8 +261,8 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
assertEquals("v2", dhtPeek(cache1, 2));
assertEquals("v2", dhtPeek(cache2, 2));
- assertNull(near(cache1).peekNearOnly(2));
- assertNull(near(cache2).peekNearOnly(2));
+ assertNull(near(cache1).peekEx(2));
+ assertNull(near(cache2).peekEx(2));
GridDhtCacheEntry c2e2 = (GridDhtCacheEntry)dht(cache2).entryEx(2);
@@ -274,7 +274,7 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
assertEquals("v1", cache2.get(1));
// Since DHT cache2 has the value, Near cache2 should not have it.
- assertNull(near(cache2).peekNearOnly(1));
+ assertNull(near(cache2).peekEx(1));
// Since v1 was retrieved locally from cache2, cache1 should not know about it.
assertFalse(e1.readers().contains(n2.id()));
@@ -283,7 +283,7 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
// It should not be successful since it's not allowed to evict entry on backup node.
cache2.localEvict(Collections.singleton(1));
- assertNull(near(cache2).peekNearOnly(1));
+ assertNull(near(cache2).peekEx(1));
assertEquals("v1", dhtPeek(cache2, 1));
assertEquals("v1", cache1.getAndPut(1, "z1"));
@@ -291,7 +291,7 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
// Node 1 should not have node2 in readers map.
assertFalse(e1.readers().contains(n2.id()));
- assertNull(near(cache2).peekNearOnly(1));
+ assertNull(near(cache2).peekEx(1));
assertEquals("z1", dhtPeek(cache2, 1));
}
@@ -447,9 +447,9 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
assertEquals(val1, dhtPeek(1, key1));
assertNull(dhtPeek(2, key1));
- assertNull(near(0).peekNearOnly(key1));
- assertNull(near(1).peekNearOnly(key1));
- assertNull(near(2).peekNearOnly(key1));
+ assertNull(near(0).peekEx(key1));
+ assertNull(near(1).peekEx(key1));
+ assertNull(near(2).peekEx(key1));
cache.put(key2, val2);
@@ -457,9 +457,9 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
assertEquals(val2, dhtPeek(1, key2));
assertEquals(val2, dhtPeek(2, key2));
- assertEquals(val2, near(0).peekNearOnly(key2));
- assertNull(near(1).peekNearOnly(key2));
- assertNull(near(2).peekNearOnly(key2));
+ assertEquals(val2, near(0).peekEx(key2).wrap().getValue());
+ assertNull(near(1).peekEx(key2));
+ assertNull(near(2).peekEx(key2));
String val22 = val2 + "2";
@@ -469,9 +469,9 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
assertEquals(val22, dhtPeek(1, key2));
assertEquals(val22, dhtPeek(2, key2));
- assertEquals(val22, near(0).peekNearOnly(key2));
- assertNull(near(1).peekNearOnly(key2));
- assertNull(near(2).peekNearOnly(key2));
+ assertEquals(val22, near(0).peekEx(key2).wrap().getValue());
+ assertNull(near(1).peekEx(key2));
+ assertNull(near(2).peekEx(key2));
cache.remove(key2);
@@ -479,9 +479,9 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
assertNull(dhtPeek(1, key2));
assertNull(dhtPeek(2, key2));
- assertNull(near(0).peekNearOnly(key2));
- assertNull(near(1).peekNearOnly(key2));
- assertNull(near(2).peekNearOnly(key2));
+ assertNull(near(0).peekEx(key2));
+ assertNull(near(1).peekEx(key2));
+ assertNull(near(2).peekEx(key2));
cache.remove(key1);
@@ -489,9 +489,9 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
assertNull(dhtPeek(1, key1));
assertNull(dhtPeek(2, key1));
- assertNull(near(0).peekNearOnly(key1));
- assertNull(near(1).peekNearOnly(key1));
- assertNull(near(2).peekNearOnly(key1));
+ assertNull(near(0).peekEx(key1));
+ assertNull(near(1).peekEx(key1));
+ assertNull(near(2).peekEx(key1));
for (int i = 0; i < grids; i++) {
assert !jcache(i).isLocalLocked(key1, false);
@@ -542,10 +542,10 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
// Since near entry holds the lock, it should
// contain correct value.
- assertEquals(val1, near(0).peekNearOnly(key1));
+ assertEquals(val1, near(0).peekEx(key1).wrap().getValue());
- assertNull(near(1).peekNearOnly(key1));
- assertNull(near(2).peekNearOnly(key1));
+ assertNull(near(1).peekEx(key1));
+ assertNull(near(2).peekEx(key1));
cache.put(key2, val2);
@@ -553,9 +553,9 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
assertEquals(val2, dhtPeek(1, key2));
assertEquals(val2, dhtPeek(2, key2));
- assertEquals(val2, near(0).peekNearOnly(key2));
- assertNull(near(1).peekNearOnly(key2));
- assertNull(near(2).peekNearOnly(key2));
+ assertEquals(val2, near(0).peekEx(key2).wrap().getValue());
+ assertNull(near(1).peekEx(key2));
+ assertNull(near(2).peekEx(key2));
String val22 = val2 + "2";
@@ -565,9 +565,9 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
assertEquals(val22, dhtPeek(1, key2));
assertEquals(val22, dhtPeek(2, key2));
- assertEquals(val22, near(0).peekNearOnly(key2));
- assertNull(near(1).peekNearOnly(key2));
- assertNull(near(2).peekNearOnly(key2));
+ assertEquals(val22, near(0).peekEx(key2).wrap().getValue());
+ assertNull(near(1).peekEx(key2));
+ assertNull(near(2).peekEx(key2));
cache.remove(key2);
[7/9] incubator-ignite git commit: Merge branch 'ignite-sprint-3'
into ignite-645
Posted by sb...@apache.org.
Merge branch 'ignite-sprint-3' into ignite-645
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/6a721d76
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/6a721d76
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/6a721d76
Branch: refs/heads/ignite-sprint-3
Commit: 6a721d76d7625a8c9bc645e785136fce4551c514
Parents: 07ed759 07ca9fa
Author: Andrey Gura <ag...@gridgain.com>
Authored: Thu Apr 2 15:26:10 2015 +0300
Committer: Andrey Gura <ag...@gridgain.com>
Committed: Thu Apr 2 15:26:10 2015 +0300
----------------------------------------------------------------------
DEVNOTES.txt | 2 +
examples/pom-standalone.xml | 1 -
ipc/shmem/README.txt | 2 +-
.../transactions/IgniteTxLocalAdapter.java | 4 +-
.../visor/cache/VisorCacheConfiguration.java | 81 +++++--------
.../cache/VisorCacheNearConfiguration.java | 11 +-
.../visor/node/VisorGridConfiguration.java | 28 ++++-
.../internal/visor/util/VisorMimeTypes.java | 4 +-
.../resources/META-INF/classnames.properties | 79 ++++---------
.../ignite/IgniteCacheAffinitySelfTest.java | 2 +
.../GridCacheOnCopyFlagAbstractSelfTest.java | 16 +--
.../processors/igfs/IgsfStartCacheTest.java | 115 +++++++++++++++++++
.../GridUriDeploymentFileResourceLoader.java | 2 +-
parent/pom.xml | 10 +-
14 files changed, 230 insertions(+), 127 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6a721d76/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
[3/9] incubator-ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-sprint-3' into ignite-645
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-sprint-3' into ignite-645
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/7f69f2ae
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/7f69f2ae
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/7f69f2ae
Branch: refs/heads/ignite-sprint-3
Commit: 7f69f2aee4251e0a78ca563c5fc8fd139f875e3f
Parents: dfb4679 ed6632a
Author: sboikov <se...@inria.fr>
Authored: Wed Apr 1 22:54:21 2015 +0300
Committer: sboikov <se...@inria.fr>
Committed: Wed Apr 1 22:54:21 2015 +0300
----------------------------------------------------------------------
examples/pom.xml | 19 +-
examples/schema-import/pom.xml | 10 +-
.../examples/datagrid/CacheQueryExample.java | 12 +-
modules/aop/pom.xml | 6 +-
modules/aws/pom.xml | 4 +-
modules/clients/pom.xml | 10 +-
modules/codegen/pom.xml | 4 +-
modules/core/pom.xml | 8 +-
.../apache/ignite/cache/CachingProvider.java | 2 +-
.../store/jdbc/CacheAbstractJdbcStore.java | 2 +-
.../cache/store/jdbc/CacheJdbcBlobStore.java | 9 +-
.../configuration/FileSystemConfiguration.java | 6 +
.../ignite/internal/GridCachePluginContext.java | 2 +-
.../apache/ignite/internal/IgniteKernal.java | 5 +-
.../cache/CacheObjectByteArrayImpl.java | 2 +-
.../processors/cache/CacheObjectContext.java | 14 +-
.../processors/cache/CacheObjectImpl.java | 10 +-
.../cache/DynamicCacheDescriptor.java | 2 +-
.../processors/cache/GridCacheAdapter.java | 4 +-
.../processors/cache/GridCacheMapEntry.java | 2 +-
.../processors/cache/GridCacheProcessor.java | 66 ++--
.../cache/query/GridCacheQueryManager.java | 16 +-
.../continuous/CacheContinuousQueryManager.java | 28 ++
.../IgniteCacheObjectProcessorImpl.java | 173 +++++++----
.../processors/igfs/IgfsDataManager.java | 11 +-
.../processors/igfs/IgfsFileAffinityRange.java | 23 +-
.../processors/igfs/IgfsHelperImpl.java | 3 +-
.../processors/plugin/CachePluginManager.java | 2 +-
.../ignite/plugin/CachePluginConfiguration.java | 5 +-
.../ignite/plugin/CachePluginContext.java | 2 +-
.../ignite/plugin/CachePluginProvider.java | 3 +-
.../spi/discovery/tcp/TcpDiscoverySpi.java | 9 +-
.../ignite/startup/BasicWarmupClosure.java | 2 +-
.../IgniteCacheAtomicLocalStoreValueTest.java | 49 +++
...iteCacheAtomicNearEnabledStoreValueTest.java | 30 ++
...maryWriteOrderNearEnabledStoreValueTest.java | 31 ++
...heAtomicPrimaryWriteOrderStoreValueTest.java | 32 ++
.../cache/IgniteCacheAtomicStoreValueTest.java | 55 ++++
.../IgniteCacheStoreValueAbstractTest.java | 311 +++++++++++++++++++
.../cache/IgniteCacheTxLocalStoreValueTest.java | 49 +++
.../IgniteCacheTxNearEnabledStoreValueTest.java | 30 ++
.../cache/IgniteCacheTxStoreValueTest.java | 49 +++
...IgniteCacheJdbcBlobStoreNodeRestartTest.java | 52 ++++
...IgniteCacheStoreNodeRestartAbstractTest.java | 116 +++++++
.../junits/common/GridCommonAbstractTest.java | 2 +-
.../ignite/testsuites/IgniteCacheTestSuite.java | 11 +
modules/extdata/p2p/pom.xml | 4 +-
modules/extdata/uri/pom.xml | 4 +-
modules/geospatial/pom.xml | 4 +-
modules/hadoop/pom.xml | 8 +-
modules/hibernate/pom.xml | 6 +-
.../hibernate/CacheHibernateBlobStore.java | 9 +-
.../CacheHibernateBlobStoreNodeRestartTest.java | 52 ++++
.../testsuites/IgniteHibernateTestSuite.java | 2 +
modules/indexing/pom.xml | 4 +-
.../processors/query/h2/IgniteH2Indexing.java | 4 +-
modules/jcl/pom.xml | 4 +-
modules/jta/pom.xml | 4 +-
modules/log4j/pom.xml | 4 +-
modules/rest-http/pom.xml | 2 +-
modules/scalar/pom.xml | 10 +-
modules/schedule/pom.xml | 4 +-
modules/schema-import/pom.xml | 2 +-
modules/slf4j/pom.xml | 2 +-
modules/spring/pom.xml | 8 +-
modules/ssh/pom.xml | 8 +-
.../ant/beautifier/GridJavadocAntTask.java | 8 +-
modules/urideploy/pom.xml | 6 +-
modules/visor-console/pom.xml | 8 +-
.../scala/org/apache/ignite/visor/visor.scala | 2 +-
modules/visor-plugins/pom.xml | 2 +-
modules/web/pom.xml | 8 +-
modules/yardstick/pom.xml | 6 +-
pom.xml | 56 ++--
74 files changed, 1249 insertions(+), 285 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7f69f2ae/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7f69f2ae/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7f69f2ae/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------