You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by se...@apache.org on 2015/06/23 22:15:41 UTC
[1/6] incubator-ignite git commit: ignite-973-2 - read offheap value
before remove
Repository: incubator-ignite
Updated Branches:
refs/heads/ignite-973-2 [created] 108788b97
ignite-973-2 - read offheap value before remove
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/260dc2dd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/260dc2dd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/260dc2dd
Branch: refs/heads/ignite-973-2
Commit: 260dc2dd4978d0a57732b7edd0aa0b043d4eff4c
Parents: 285d790
Author: S.Vladykin <sv...@gridgain.com>
Authored: Tue Jun 23 15:28:24 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Tue Jun 23 15:28:24 2015 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheSwapManager.java | 192 +++++++++++--------
.../query/h2/opt/GridH2KeyValueRowOffheap.java | 8 +-
2 files changed, 118 insertions(+), 82 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/260dc2dd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
index f709e03..e45ec2d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
@@ -535,21 +535,9 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
// First try removing from offheap.
if (offheapEnabled) {
- byte[] entryBytes = offheap.remove(spaceName, part, key, key.valueBytes(cctx.cacheObjectContext()));
-
- if (cctx.config().isStatisticsEnabled()) {
- if (entryBytes != null)
- cctx.cache().metrics0().onOffHeapRemove();
-
- cctx.cache().metrics0().onOffHeapRead(entryBytes != null);
- }
-
- if (entryBytes != null) {
- GridCacheSwapEntry entry = swapEntry(unmarshalSwapEntry(entryBytes));
-
- if (entry == null)
- return null;
+ GridCacheSwapEntry entry = removeFromOffheap(key, key.valueBytes(cctx.cacheObjectContext()), part);
+ if (entry != null) {
// Always fire this event, since preloading depends on it.
onOffHeaped(part, key, entry);
@@ -569,11 +557,6 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
null,
null);
- GridCacheQueryManager qryMgr = cctx.queries();
-
- if (qryMgr != null)
- qryMgr.onUnswap(key, entry.value());
-
return entry;
}
}
@@ -737,6 +720,47 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
}
/**
+ * @param key Key.
+ * @param keyBytes Key bytes.
+ * @param part Partition.
+ * @return Swap entry.
+ * @throws IgniteCheckedException If failed.
+ */
+ @Nullable private GridCacheSwapEntry removeFromOffheap(KeyCacheObject key, byte[] keyBytes, int part)
+ throws IgniteCheckedException {
+ final GridCacheQueryManager qryMgr = cctx.queries();
+
+ GridCacheSwapEntry entry;
+
+ if (qryMgr != null) {
+ entry = readOffheapBeforeRemove(key, keyBytes, part);
+
+ if (entry != null) {
+ if (offheap.removex(spaceName, part, key, keyBytes)) {
+ if (cctx.config().isStatisticsEnabled())
+ cctx.cache().metrics0().onOffHeapRemove();
+ }
+ else
+ entry = null; // Failed to remove -> reset to null.
+ }
+ }
+ else {
+ byte[] entryBytes = offheap.remove(spaceName, part, key, keyBytes);
+
+ if (entryBytes != null) {
+ if (cctx.config().isStatisticsEnabled())
+ cctx.cache().metrics0().onOffHeapRemove();
+
+ entry = swapEntry(unmarshalSwapEntry(entryBytes));
+ }
+ else
+ entry = null;
+ }
+
+ return entry;
+ }
+
+ /**
* @param keys Collection of keys to remove from swap.
* @return Collection of swap entries.
* @throws IgniteCheckedException If failed,
@@ -759,40 +783,30 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
for (KeyCacheObject key : keys) {
int part = cctx.affinity().partition(key);
- byte[] entryBytes = offheap.remove(spaceName, part, key, key.valueBytes(cctx.cacheObjectContext()));
+ GridCacheSwapEntry entry = removeFromOffheap(key, key.valueBytes(cctx.cacheObjectContext()), part);
- if(entryBytes != null && cctx.config().isStatisticsEnabled())
- cctx.cache().metrics0().onOffHeapRemove();
+ if (entry != null) {
+ // Always fire this event, since preloading depends on it.
+ onOffHeaped(part, key, entry);
- if (entryBytes != null) {
- GridCacheSwapEntry entry = swapEntry(unmarshalSwapEntry(entryBytes));
+ if (cctx.events().isRecordable(EVT_CACHE_OBJECT_FROM_OFFHEAP))
+ cctx.events().addEvent(part, key, cctx.nodeId(), (IgniteUuid)null, null,
+ EVT_CACHE_OBJECT_FROM_OFFHEAP, null, false, null, true, null, null, null);
- if (entry != null) {
- // Always fire this event, since preloading depends on it.
- onOffHeaped(part, key, entry);
-
- if (cctx.events().isRecordable(EVT_CACHE_OBJECT_FROM_OFFHEAP))
- cctx.events().addEvent(part, key, cctx.nodeId(), (IgniteUuid)null, null,
- EVT_CACHE_OBJECT_FROM_OFFHEAP, null, false, null, true, null, null, null);
-
- if (qryMgr != null)
- qryMgr.onUnswap(key, entry.value());
-
- GridCacheBatchSwapEntry unswapped = new GridCacheBatchSwapEntry(key,
- part,
- ByteBuffer.wrap(entry.valueBytes()),
- entry.type(),
- entry.version(), entry.ttl(),
- entry.expireTime(),
- entry.keyClassLoaderId(),
- entry.valueClassLoaderId());
+ GridCacheBatchSwapEntry unswapped = new GridCacheBatchSwapEntry(key,
+ part,
+ ByteBuffer.wrap(entry.valueBytes()),
+ entry.type(),
+ entry.version(), entry.ttl(),
+ entry.expireTime(),
+ entry.keyClassLoaderId(),
+ entry.valueClassLoaderId());
- unswapped.value(entry.value());
+ unswapped.value(entry.value());
- res.add(unswapped);
+ res.add(unswapped);
- continue;
- }
+ continue;
}
if (swapEnabled) {
@@ -940,6 +954,34 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
}
/**
+ * Reads value from offheap and unswaps it for indexing.
+ *
+ * @param key Key.
+ * @param keyBytes Key bytes.
+ * @param part Partition.
+ * @return Swap entry.
+ * @throws IgniteCheckedException If failed.
+ */
+ public GridCacheSwapEntry readOffheapBeforeRemove(KeyCacheObject key, byte[] keyBytes, int part)
+ throws IgniteCheckedException {
+ assert cctx.queries() != null;
+
+ byte[] val = offheap.get(spaceName, part, key, keyBytes);
+
+ if (val != null) {
+ GridCacheSwapEntry entry = swapEntry(unmarshalSwapEntry(val));
+
+ if (entry != null) {
+ cctx.queries().onUnswap(key, entry.value());
+
+ return entry;
+ }
+ }
+
+ return null;
+ }
+
+ /**
* @param key Key to remove.
* @throws IgniteCheckedException If failed.
*/
@@ -951,42 +993,17 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
final GridCacheQueryManager qryMgr = cctx.queries();
- CI1<byte[]> c = qryMgr == null ? null : new CI1<byte[]>() {
- @Override public void apply(byte[] rmv) {
- if (rmv == null)
- return;
-
- try {
- if (cctx.config().isStatisticsEnabled())
- cctx.cache().metrics0().onSwapRemove();
-
- GridCacheSwapEntry entry = swapEntry(unmarshalSwapEntry(rmv));
-
- if (entry == null)
- return;
-
- qryMgr.onUnswap(key, entry.value());
- }
- catch (IgniteCheckedException e) {
- throw new IgniteException(e);
- }
- }
- };
-
int part = cctx.affinity().partition(key);
// First try offheap.
if (offheapEnabled) {
- // TODO Pass closure c to offheap.remove and apply it before the actual remove.
- byte[] val = offheap.remove(spaceName, part, key, key.valueBytes(cctx.cacheObjectContext()));
+ byte[] keyBytes = key.valueBytes(cctx.cacheObjectContext());
- if (val != null) {
+ if ((qryMgr == null || readOffheapBeforeRemove(key, keyBytes, part) != null) &&
+ offheap.removex(spaceName, part, key, keyBytes)) {
if (cctx.config().isStatisticsEnabled())
cctx.cache().metrics0().onOffHeapRemove();
- if (c != null)
- c.apply(val);
-
return;
}
}
@@ -998,7 +1015,30 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
swapMgr.remove(spaceName,
swapKey,
- c,
+ new CI1<byte[]>() {
+ @Override public void apply(byte[] rmv) {
+ if (rmv == null)
+ return;
+
+ try {
+ if (cctx.config().isStatisticsEnabled())
+ cctx.cache().metrics0().onSwapRemove();
+
+ if (qryMgr == null)
+ return;
+
+ GridCacheSwapEntry entry = swapEntry(unmarshalSwapEntry(rmv));
+
+ if (entry == null)
+ return;
+
+ qryMgr.onUnswap(key, entry.value());
+ }
+ catch (IgniteCheckedException e) {
+ throw new IgniteException(e);
+ }
+ }
+ },
cctx.deploy().globalLoader());
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/260dc2dd/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOffheap.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOffheap.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOffheap.java
index f89591a..1f54713 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOffheap.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOffheap.java
@@ -236,12 +236,8 @@ public class GridH2KeyValueRowOffheap extends GridH2AbstractKeyValueRow {
try {
GridUnsafeMemory mem = desc.memory();
- if (mem.readLongVolatile(p + OFFSET_VALUE_REF) != 0) {
- if (beforeRmv)
- return; // The offheap value is in its place, nothing to do here.
- else
- throw new IllegalStateException("Unswap without swap: " + p);
- }
+ if (mem.readLongVolatile(p + OFFSET_VALUE_REF) != 0)
+ return; // The offheap value is in its place, nothing to do here.
Value v = peekValue(VAL_COL);
[3/6] incubator-ignite git commit: Merge branch 'ignite-sprint-7' of
https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-973-2
Posted by se...@apache.org.
Merge branch 'ignite-sprint-7' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-973-2
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b7bb2514
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b7bb2514
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b7bb2514
Branch: refs/heads/ignite-973-2
Commit: b7bb251493e314ab05227052eab7a1eda9402ee5
Parents: 4b5e89f 2bb6e0f
Author: S.Vladykin <sv...@gridgain.com>
Authored: Tue Jun 23 15:29:32 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Tue Jun 23 15:29:32 2015 +0300
----------------------------------------------------------------------
examples/pom.xml | 2 +-
modules/aop/pom.xml | 2 +-
modules/aws/pom.xml | 2 +-
modules/clients/pom.xml | 2 +-
modules/cloud/pom.xml | 2 +-
modules/codegen/pom.xml | 2 +-
modules/core/pom.xml | 2 +-
.../processors/hadoop/HadoopJobInfo.java | 4 +-
.../hadoop/counter/HadoopCounterWriter.java | 5 +-
.../processors/task/GridTaskProcessor.java | 23 +-
.../core/src/main/resources/ignite.properties | 2 +-
.../GridTaskFailoverAffinityRunTest.java | 170 +++++++++++++
...ridCachePartitionNotLoadedEventSelfTest.java | 82 +++++++
.../distributed/IgniteCacheManyClientsTest.java | 1 +
.../IgniteCacheTxMessageRecoveryTest.java | 5 +
...idCacheNearOnlyMultiNodeFullApiSelfTest.java | 2 +-
.../GridCacheReplicatedFailoverSelfTest.java | 5 +
.../testframework/junits/GridAbstractTest.java | 2 +-
.../ignite/testsuites/IgniteCacheTestSuite.java | 4 +-
.../testsuites/IgniteComputeGridTestSuite.java | 1 +
.../ignite/util/TestTcpCommunicationSpi.java | 21 ++
modules/extdata/p2p/pom.xml | 2 +-
modules/extdata/uri/pom.xml | 2 +-
modules/gce/pom.xml | 2 +-
modules/geospatial/pom.xml | 2 +-
modules/hadoop/pom.xml | 80 +-----
.../fs/IgniteHadoopFileSystemCounterWriter.java | 9 +-
.../processors/hadoop/HadoopClassLoader.java | 29 +++
.../processors/hadoop/HadoopDefaultJobInfo.java | 27 +--
.../internal/processors/hadoop/HadoopUtils.java | 237 ------------------
.../hadoop/SecondaryFileSystemProvider.java | 3 +-
.../hadoop/fs/HadoopFileSystemCacheUtils.java | 241 +++++++++++++++++++
.../hadoop/fs/HadoopFileSystemsUtils.java | 11 +
.../hadoop/fs/HadoopLazyConcurrentMap.java | 5 +
.../hadoop/jobtracker/HadoopJobTracker.java | 25 +-
.../child/HadoopChildProcessRunner.java | 3 +-
.../processors/hadoop/v2/HadoopV2Job.java | 84 ++++++-
.../hadoop/v2/HadoopV2JobResourceManager.java | 22 +-
.../hadoop/v2/HadoopV2TaskContext.java | 37 ++-
.../apache/ignite/igfs/IgfsEventsTestSuite.java | 5 +-
.../processors/hadoop/HadoopMapReduceTest.java | 2 +-
.../processors/hadoop/HadoopTasksV1Test.java | 7 +-
.../processors/hadoop/HadoopTasksV2Test.java | 7 +-
.../processors/hadoop/HadoopV2JobSelfTest.java | 6 +-
.../collections/HadoopAbstractMapTest.java | 3 +-
.../testsuites/IgniteHadoopTestSuite.java | 2 +-
.../IgniteIgfsLinuxAndMacOSTestSuite.java | 3 +-
modules/hibernate/pom.xml | 2 +-
modules/indexing/pom.xml | 2 +-
...QueryOffheapEvictsMultiThreadedSelfTest.java | 5 +
.../IgniteCacheQuerySelfTestSuite.java | 2 +-
modules/jcl/pom.xml | 2 +-
modules/jta/pom.xml | 2 +-
modules/log4j/pom.xml | 2 +-
modules/mesos/pom.xml | 2 +-
modules/rest-http/pom.xml | 2 +-
modules/scalar-2.10/pom.xml | 2 +-
modules/scalar/pom.xml | 2 +-
modules/schedule/pom.xml | 2 +-
modules/schema-import/pom.xml | 2 +-
modules/slf4j/pom.xml | 2 +-
modules/spark-2.10/pom.xml | 2 +-
modules/spark/pom.xml | 2 +-
modules/spring/pom.xml | 2 +-
modules/ssh/pom.xml | 2 +-
modules/tools/pom.xml | 2 +-
modules/urideploy/pom.xml | 2 +-
modules/visor-console-2.10/pom.xml | 2 +-
modules/visor-console/pom.xml | 2 +-
modules/visor-plugins/pom.xml | 2 +-
modules/web/pom.xml | 2 +-
.../IgniteWebSessionSelfTestSuite.java | 2 +-
modules/yardstick/pom.xml | 2 +-
pom.xml | 2 +-
74 files changed, 825 insertions(+), 429 deletions(-)
----------------------------------------------------------------------
[4/6] incubator-ignite git commit: ignite-973-2 - enabled test
Posted by se...@apache.org.
ignite-973-2 - enabled test
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e0b573b1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e0b573b1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e0b573b1
Branch: refs/heads/ignite-973-2
Commit: e0b573b1337b88691f2d69087ac64cad531c8b9e
Parents: b7bb251
Author: S.Vladykin <sv...@gridgain.com>
Authored: Tue Jun 23 15:30:59 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Tue Jun 23 15:30:59 2015 +0300
----------------------------------------------------------------------
.../IgniteCacheQueryOffheapEvictsMultiThreadedSelfTest.java | 5 -----
1 file changed, 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e0b573b1/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryOffheapEvictsMultiThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryOffheapEvictsMultiThreadedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryOffheapEvictsMultiThreadedSelfTest.java
index e131470..dc25af5 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryOffheapEvictsMultiThreadedSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryOffheapEvictsMultiThreadedSelfTest.java
@@ -22,11 +22,6 @@ package org.apache.ignite.internal.processors.cache;
*/
public class IgniteCacheQueryOffheapEvictsMultiThreadedSelfTest extends IgniteCacheQueryOffheapMultiThreadedSelfTest {
/** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-971");
- }
-
- /** {@inheritDoc} */
@Override protected boolean evictsEnabled() {
return true;
}
[5/6] incubator-ignite git commit: ignite-973-2 - swap read before
remove
Posted by se...@apache.org.
ignite-973-2 - swap read before remove
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e1243b40
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e1243b40
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e1243b40
Branch: refs/heads/ignite-973-2
Commit: e1243b40537ac883271eb7cab492e8ef86f7b330
Parents: e0b573b
Author: S.Vladykin <sv...@gridgain.com>
Authored: Tue Jun 23 23:13:03 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Tue Jun 23 23:13:03 2015 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheSwapManager.java | 98 +++++++++++++-------
.../inmemory/GridTestSwapSpaceSpi.java | 3 +-
.../processors/query/h2/opt/GridH2Table.java | 2 +-
.../cache/IgniteCacheOffheapEvictQueryTest.java | 2 +-
4 files changed, 66 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1243b40/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
index e45ec2d..7595a1d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
@@ -582,6 +582,13 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
part,
key.valueBytes(cctx.cacheObjectContext()));
+ ClassLoader ldr = cctx.deploy().globalLoader();
+
+ GridCacheQueryManager qryMgr = cctx.queries();
+
+ if (qryMgr != null && !readSwapBeforeRemove(key, swapKey, ldr))
+ return null; // Not found.
+
swapMgr.remove(spaceName, swapKey, new CI1<byte[]>() {
@Override public void apply(byte[] rmv) {
if (cctx.config().isStatisticsEnabled())
@@ -597,7 +604,6 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
t.set(entry);
CacheObject v = entry.value();
- byte[] valBytes = entry.valueBytes();
// Event notification.
if (cctx.events().isRecordable(EVT_CACHE_OBJECT_UNSWAPPED)) {
@@ -621,18 +627,13 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
// Always fire this event, since preloading depends on it.
onUnswapped(part, key, entry);
-
- GridCacheQueryManager qryMgr = cctx.queries();
-
- if (qryMgr != null)
- qryMgr.onUnswap(key, v);
}
catch (IgniteCheckedException e) {
err.set(e);
}
}
}
- }, cctx.deploy().globalLoader());
+ }, ldr);
if (err.get() != null)
throw err.get();
@@ -839,7 +840,17 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
assert swapEnabled;
assert unprocessedKeys != null;
- // Swap is enabled.
+ ClassLoader ldr = cctx.deploy().globalLoader();
+
+ if (qryMgr != null) { // Unswap for indexing.
+ Iterator<SwapKey> iter = unprocessedKeys.iterator();
+
+ while (iter.hasNext()) {
+ if (!readSwapBeforeRemove(null, iter.next(), ldr))
+ iter.remove(); // We will not do unswapping further -> need to skip the key.
+ }
+ }
+
final GridTuple<IgniteCheckedException> err = F.t1();
swapMgr.removeAll(spaceName,
@@ -891,9 +902,6 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
// Always fire this event, since preloading depends on it.
onUnswapped(swapKey.partition(), key, entry);
-
- if (qryMgr != null)
- qryMgr.onUnswap(key, entry.value());
}
catch (IgniteCheckedException e) {
err.set(e);
@@ -901,7 +909,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
}
}
},
- cctx.deploy().globalLoader());
+ ldr);
if (err.get() != null)
throw err.get();
@@ -923,7 +931,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
boolean rmv = offheap.removex(spaceName, part, key, key.valueBytes(cctx.cacheObjectContext()));
- if(rmv && cctx.config().isStatisticsEnabled())
+ if (rmv && cctx.config().isStatisticsEnabled())
cctx.cache().metrics0().onOffHeapRemove();
return rmv;
@@ -982,6 +990,37 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
}
/**
+ * Reads value from swap and unswaps it to indexing.
+ *
+ * @param key Key.
+ * @param swapKey Swap key.
+ * @param ldr Class loader.
+ * @return {@code true} If read and unswapped successfully.
+ * @throws IgniteCheckedException If failed.
+ */
+ private boolean readSwapBeforeRemove(@Nullable KeyCacheObject key, SwapKey swapKey, ClassLoader ldr)
+ throws IgniteCheckedException {
+ assert cctx.queries() != null;
+
+ byte[] entryBytes = swapMgr.read(spaceName, swapKey, ldr);
+
+ if (entryBytes == null)
+ return false;
+
+ GridCacheSwapEntry entry = swapEntry(unmarshalSwapEntry(entryBytes));
+
+ if (entry == null)
+ return false;
+
+ if (key == null)
+ key = cctx.toCacheKeyObject(swapKey.keyBytes());
+
+ cctx.queries().onUnswap(key, entry.value());
+
+ return true;
+ }
+
+ /**
* @param key Key to remove.
* @throws IgniteCheckedException If failed.
*/
@@ -1013,33 +1052,20 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
part,
key.valueBytes(cctx.cacheObjectContext()));
+ ClassLoader ldr = cctx.deploy().globalLoader();
+
+ if (qryMgr != null && !readSwapBeforeRemove(key, swapKey, ldr))
+ return; // Not found.
+
swapMgr.remove(spaceName,
swapKey,
- new CI1<byte[]>() {
+ cctx.config().isStatisticsEnabled() ? new CI1<byte[]>() {
@Override public void apply(byte[] rmv) {
- if (rmv == null)
- return;
-
- try {
- if (cctx.config().isStatisticsEnabled())
- cctx.cache().metrics0().onSwapRemove();
-
- if (qryMgr == null)
- return;
-
- GridCacheSwapEntry entry = swapEntry(unmarshalSwapEntry(rmv));
-
- if (entry == null)
- return;
-
- qryMgr.onUnswap(key, entry.value());
- }
- catch (IgniteCheckedException e) {
- throw new IgniteException(e);
- }
+ if (rmv != null)
+ cctx.cache().metrics0().onSwapRemove();
}
- },
- cctx.deploy().globalLoader());
+ } : null,
+ ldr);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1243b40/modules/core/src/test/java/org/apache/ignite/spi/swapspace/inmemory/GridTestSwapSpaceSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/swapspace/inmemory/GridTestSwapSpaceSpi.java b/modules/core/src/test/java/org/apache/ignite/spi/swapspace/inmemory/GridTestSwapSpaceSpi.java
index d8303a4..2a3c940 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/swapspace/inmemory/GridTestSwapSpaceSpi.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/swapspace/inmemory/GridTestSwapSpaceSpi.java
@@ -285,7 +285,8 @@ public class GridTestSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceS
byte[] val = data.remove(key);
if (val != null) {
- c.apply(val);
+ if (c != null)
+ c.apply(val);
fireEvent(EVT_SWAP_SPACE_DATA_REMOVED, name, key.keyBytes());
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1243b40/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
index 92991af..86dbf06 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
@@ -393,7 +393,7 @@ public class GridH2Table extends TableBase {
for (int i = 2, len = idxs.size(); i < len; i++) {
Row res = index(i).remove(old);
- assert eq(pk, res, old): "\n" + old + "\n" + res;
+ assert eq(pk, res, old): "\n" + old + "\n" + res + "\n" + i + " -> " + index(i).getName();
}
}
else
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1243b40/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapEvictQueryTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapEvictQueryTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapEvictQueryTest.java
index 45d744e..f9ff69e 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapEvictQueryTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapEvictQueryTest.java
@@ -86,7 +86,7 @@ public class IgniteCacheOffheapEvictQueryTest extends GridCommonAbstractTest {
*/
public void testEvictAndRemove() throws Exception {
final int KEYS_CNT = 3000;
- final int THREADS_CNT = 50;
+ final int THREADS_CNT = 250;
final IgniteCache<Integer,Integer> c = startGrid().cache(null);
[6/6] incubator-ignite git commit: Merge branch 'ignite-sprint-7' of
https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-973-2
Posted by se...@apache.org.
Merge branch 'ignite-sprint-7' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-973-2
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/108788b9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/108788b9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/108788b9
Branch: refs/heads/ignite-973-2
Commit: 108788b979306fe3398996eb60057a4c3c5afc39
Parents: e1243b4 359b431
Author: S.Vladykin <sv...@gridgain.com>
Authored: Tue Jun 23 23:13:27 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Tue Jun 23 23:13:27 2015 +0300
----------------------------------------------------------------------
.../configuration/IgniteReflectionFactory.java | 81 ++++++++++++++++++--
.../distributed/dht/GridDhtLocalPartition.java | 3 +-
.../dht/atomic/GridDhtAtomicCache.java | 9 +--
3 files changed, 82 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
[2/6] incubator-ignite git commit: ignite-973-2 - simplify test
Posted by se...@apache.org.
ignite-973-2 - simplify test
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/4b5e89fa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/4b5e89fa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/4b5e89fa
Branch: refs/heads/ignite-973-2
Commit: 4b5e89fa8246c36322b6f66af10379f6941091c6
Parents: 260dc2d
Author: S.Vladykin <sv...@gridgain.com>
Authored: Tue Jun 23 15:28:51 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Tue Jun 23 15:28:51 2015 +0300
----------------------------------------------------------------------
.../processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4b5e89fa/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
index 3e50443..97426c9 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
@@ -32,7 +32,7 @@ import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.spi.discovery.tcp.*;
import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
-import org.apache.ignite.spi.swapspace.file.*;
+import org.apache.ignite.spi.swapspace.inmemory.*;
import org.apache.ignite.testframework.junits.common.*;
import org.jetbrains.annotations.*;
@@ -82,7 +82,7 @@ public class IgniteCacheQueryMultiThreadedSelfTest extends GridCommonAbstractTes
cfg.setDiscoverySpi(disco);
- cfg.setSwapSpaceSpi(new FileSwapSpaceSpi());
+ cfg.setSwapSpaceSpi(new GridTestSwapSpaceSpi());
cfg.setCacheConfiguration(cacheConfiguration());