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 2016/02/15 07:04:08 UTC
[01/11] ignite git commit: Added benchmarks for cache.invoke.
Repository: ignite
Updated Branches:
refs/heads/ignite-2407 6c2910439 -> b6b7110c9
Added benchmarks for cache.invoke.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/57236c62
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/57236c62
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/57236c62
Branch: refs/heads/ignite-2407
Commit: 57236c62e3050f602e05647dc71586615f27ec73
Parents: a32dfc4
Author: sboikov <sb...@gridgain.com>
Authored: Fri Feb 12 15:37:32 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Feb 12 15:37:32 2016 +0300
----------------------------------------------------------------------
.../yardstick/cache/IgniteInvokeBenchmark.java | 65 ++++++++++++++++++++
.../cache/IgniteInvokeTxBenchmark.java | 30 +++++++++
2 files changed, 95 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/57236c62/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteInvokeBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteInvokeBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteInvokeBenchmark.java
new file mode 100644
index 0000000..a1e80f0
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteInvokeBenchmark.java
@@ -0,0 +1,65 @@
+/*
+ * 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.yardstick.cache;
+
+import java.util.Map;
+import javax.cache.processor.MutableEntry;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheEntryProcessor;
+import org.apache.ignite.yardstick.cache.model.SampleValue;
+
+/**
+ * Ignite benchmark that performs invoke operations.
+ */
+public class IgniteInvokeBenchmark extends IgniteCacheAbstractBenchmark<Integer, Object> {
+ /** {@inheritDoc} */
+ @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+ int key = nextRandom(args.range());
+
+ cache.invoke(key, new SetValueEntryProcessor(new SampleValue(key)));
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteCache<Integer, Object> cache() {
+ return ignite().cache("atomic");
+ }
+
+ /**
+ *
+ */
+ public static class SetValueEntryProcessor implements CacheEntryProcessor<Integer, Object, Object> {
+ /** */
+ private Object val;
+
+ /**
+ * @param val Value.
+ */
+ public SetValueEntryProcessor(Object val) {
+ this.val = val;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Object process(MutableEntry<Integer, Object> entry, Object... args) {
+ entry.setValue(val);
+
+ return null;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/57236c62/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteInvokeTxBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteInvokeTxBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteInvokeTxBenchmark.java
new file mode 100644
index 0000000..8f05598
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteInvokeTxBenchmark.java
@@ -0,0 +1,30 @@
+/*
+ * 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.yardstick.cache;
+
+import org.apache.ignite.IgniteCache;
+
+/**
+ * Ignite benchmark that performs invoke operations.
+ */
+public class IgniteInvokeTxBenchmark extends IgniteInvokeBenchmark {
+ /** {@inheritDoc} */
+ @Override protected IgniteCache<Integer, Object> cache() {
+ return ignite().cache("tx");
+ }
+}
[06/11] ignite git commit: ignite-2640 Zookeeper test timeout
increased
Posted by sb...@apache.org.
ignite-2640 Zookeeper test timeout increased
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3df8547b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3df8547b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3df8547b
Branch: refs/heads/ignite-2407
Commit: 3df8547b73f16e075ec6249ae18b592b38a4cb26
Parents: a6b3ded
Author: agura <ag...@gridgain.com>
Authored: Fri Feb 12 15:07:40 2016 +0300
Committer: agura <ag...@gridgain.com>
Committed: Fri Feb 12 19:25:01 2016 +0300
----------------------------------------------------------------------
.../spi/discovery/tcp/ipfinder/zk/ZookeeperIpFinderTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3df8547b/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/zk/ZookeeperIpFinderTest.java
----------------------------------------------------------------------
diff --git a/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/zk/ZookeeperIpFinderTest.java b/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/zk/ZookeeperIpFinderTest.java
index cadd3a7..1b91163 100644
--- a/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/zk/ZookeeperIpFinderTest.java
+++ b/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/zk/ZookeeperIpFinderTest.java
@@ -367,7 +367,7 @@ public class ZookeeperIpFinderTest extends GridCommonAbstractTest {
return true;
}
}
- }, 5000);
+ }, 2 * 60000);
assertTrue(wait);
[10/11] ignite git commit: Warning when offHeapMaxMemory is
configured with OFFHEAP_VALUES mode
Posted by sb...@apache.org.
Warning when offHeapMaxMemory is configured with OFFHEAP_VALUES mode
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/46b6a763
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/46b6a763
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/46b6a763
Branch: refs/heads/ignite-2407
Commit: 46b6a7638a594dd99742cb7de99cacaa69b621f2
Parents: 0be55c6
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Fri Feb 12 15:21:00 2016 -0800
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Fri Feb 12 15:21:00 2016 -0800
----------------------------------------------------------------------
.../ignite/internal/processors/cache/GridCacheProcessor.java | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/46b6a763/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 4bf96d2..db9298f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -438,6 +438,12 @@ public class GridCacheProcessor extends GridProcessorAdapter {
switch (cc.getMemoryMode()) {
case OFFHEAP_VALUES: {
+ if (cacheType.userCache() && cc.getEvictionPolicy() == null && cc.getOffHeapMaxMemory() >= 0)
+ U.quietAndWarn(log, "Off heap maximum memory configuration property will be ignored for the " +
+ "cache working in OFFHEAP_VALUES mode (memory usage will be unlimited): " +
+ U.maskName(cc.getName()) + ". Consider configuring eviction policy or switching to " +
+ "OFFHEAP_TIERED mode or.");
+
if (cc.getOffHeapMaxMemory() < 0)
cc.setOffHeapMaxMemory(0); // Set to unlimited.
[08/11] ignite git commit: ignite-2588 Test fixed
Posted by sb...@apache.org.
ignite-2588 Test fixed
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/befb9de8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/befb9de8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/befb9de8
Branch: refs/heads/ignite-2407
Commit: befb9de80c798f20401f9f898836de0b4220cbac
Parents: b2e510a
Author: agura <ag...@gridgain.com>
Authored: Mon Feb 8 19:22:51 2016 +0300
Committer: agura <ag...@gridgain.com>
Committed: Fri Feb 12 19:30:00 2016 +0300
----------------------------------------------------------------------
.../apache/ignite/internal/GridAffinityNoCacheSelfTest.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/befb9de8/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityNoCacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityNoCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityNoCacheSelfTest.java
index 5561f35..25b637b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityNoCacheSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityNoCacheSelfTest.java
@@ -101,7 +101,7 @@ public class GridAffinityNoCacheSelfTest extends GridCommonAbstractTest {
/**
* @param key Key.
*/
- private void checkAffinityImplCacheDeleted(Object key) throws InterruptedException{
+ private void checkAffinityImplCacheDeleted(Object key) throws InterruptedException {
IgniteEx grid = grid(0);
final String cacheName = "cacheToBeDeleted";
@@ -118,7 +118,9 @@ public class GridAffinityNoCacheSelfTest extends GridCommonAbstractTest {
grid.cache(cacheName).destroy();
- assertAffinityMethodsException(affinity, key, n);
+ awaitPartitionMapExchange();
+
+ assertAffinityMethodsException(grid.affinity(cacheName), key, n);
}
/**
[07/11] ignite git commit: ignite-169
GridSessionCheckpointSelfTest.testSharedFsCheckpoint test fixed
Posted by sb...@apache.org.
ignite-169 GridSessionCheckpointSelfTest.testSharedFsCheckpoint test fixed
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b2e510aa
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b2e510aa
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b2e510aa
Branch: refs/heads/ignite-2407
Commit: b2e510aa2ebf7384e40002b1e7bfad0e16bf9ab4
Parents: 3df8547
Author: agura <ag...@gridgain.com>
Authored: Wed Feb 10 17:58:46 2016 +0300
Committer: agura <ag...@gridgain.com>
Committed: Fri Feb 12 19:27:50 2016 +0300
----------------------------------------------------------------------
.../ignite/session/GridSessionCheckpointAbstractSelfTest.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b2e510aa/modules/core/src/test/java/org/apache/ignite/session/GridSessionCheckpointAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/session/GridSessionCheckpointAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/session/GridSessionCheckpointAbstractSelfTest.java
index c087d38..42e71f9 100644
--- a/modules/core/src/test/java/org/apache/ignite/session/GridSessionCheckpointAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/session/GridSessionCheckpointAbstractSelfTest.java
@@ -29,6 +29,7 @@ import org.apache.ignite.IgniteException;
import org.apache.ignite.compute.ComputeJobAdapter;
import org.apache.ignite.compute.ComputeJobResult;
import org.apache.ignite.compute.ComputeTaskFuture;
+import org.apache.ignite.compute.ComputeTaskMapAsync;
import org.apache.ignite.compute.ComputeTaskName;
import org.apache.ignite.compute.ComputeTaskSession;
import org.apache.ignite.compute.ComputeTaskSessionFullSupport;
@@ -36,11 +37,11 @@ import org.apache.ignite.compute.ComputeTaskSessionScope;
import org.apache.ignite.compute.ComputeTaskSplitAdapter;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.util.typedef.G;
-import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.resources.IgniteInstanceResource;
import org.apache.ignite.resources.TaskSessionResource;
import org.apache.ignite.spi.checkpoint.CheckpointSpi;
+import org.apache.ignite.testframework.junits.IgniteTestResources;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.testframework.junits.common.GridCommonTest;
@@ -83,7 +84,7 @@ public abstract class GridSessionCheckpointAbstractSelfTest extends GridCommonAb
serState = spi.loadCheckpoint(globalKey);
- Marshaller marshaller = getTestResources().getMarshaller();
+ Marshaller marshaller = IgniteTestResources.getMarshaller();
assert marshaller != null;
@@ -173,6 +174,7 @@ public abstract class GridSessionCheckpointAbstractSelfTest extends GridCommonAb
/** */
@ComputeTaskName("GridCheckpointTestTask")
@ComputeTaskSessionFullSupport
+ @ComputeTaskMapAsync
private static class GridCheckpointTestTask extends ComputeTaskSplitAdapter<Object, Object> {
/** */
@TaskSessionResource
[02/11] ignite git commit: IGNITE-2430: Fixed binary builder
serialization logic for non-standard collections.
Posted by sb...@apache.org.
IGNITE-2430: Fixed binary builder serialization logic for non-standard collections.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/159b6cb4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/159b6cb4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/159b6cb4
Branch: refs/heads/ignite-2407
Commit: 159b6cb4e17da75b77c958f5ad2b7b3fb7596c63
Parents: 35b0e6b
Author: dkarachentsev <dk...@gridgain.com>
Authored: Fri Feb 12 16:02:32 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Feb 12 16:02:32 2016 +0300
----------------------------------------------------------------------
.../ignite/internal/binary/BinaryUtils.java | 4 +-
.../binary/builder/BinaryBuilderSerializer.java | 16 +++-
.../binary/builder/BinaryObjectBuilderImpl.java | 12 ++-
.../binary/builder/BinaryValueWithType.java | 3 +-
.../BinaryObjectBuilderAdditionalSelfTest.java | 91 +++++++++++++++++++-
...naryObjectBuilderDefaultMappersSelfTest.java | 30 +++++--
6 files changed, 141 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/159b6cb4/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
index c3343d4..8b5d780 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
@@ -1055,7 +1055,7 @@ public class BinaryUtils {
* @param cls Class.
* @return {@code True} if this is a special collection class.
*/
- private static boolean isSpecialCollection(Class cls) {
+ public static boolean isSpecialCollection(Class cls) {
return ArrayList.class.equals(cls) || LinkedList.class.equals(cls) ||
HashSet.class.equals(cls) || LinkedHashSet.class.equals(cls);
}
@@ -1066,7 +1066,7 @@ public class BinaryUtils {
* @param cls Class.
* @return {@code True} if this is a special map class.
*/
- private static boolean isSpecialMap(Class cls) {
+ public static boolean isSpecialMap(Class cls) {
return HashMap.class.equals(cls) || LinkedHashMap.class.equals(cls);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/159b6cb4/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryBuilderSerializer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryBuilderSerializer.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryBuilderSerializer.java
index 6e5a621..b296437 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryBuilderSerializer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryBuilderSerializer.java
@@ -50,6 +50,18 @@ class BinaryBuilderSerializer {
* @param val Value.
*/
public void writeValue(BinaryWriterExImpl writer, Object val) {
+ writeValue(writer, val, false, false);
+ }
+
+ /** *
+ * @param writer Writer.
+ * @param val Value.
+ * @param forceCol Whether to force collection type.
+ * @param forceMap Whether to force map type.
+ */
+ public void writeValue(BinaryWriterExImpl writer, Object val, boolean forceCol, boolean forceMap) {
+ assert !(forceCol && forceMap);
+
if (val == null) {
writer.writeByte(GridBinaryMarshaller.NULL);
@@ -113,7 +125,7 @@ class BinaryBuilderSerializer {
return;
}
- if (val instanceof Collection) {
+ if (forceCol || BinaryUtils.isSpecialCollection(val.getClass())) {
Collection<?> c = (Collection<?>)val;
writer.writeByte(GridBinaryMarshaller.COL);
@@ -129,7 +141,7 @@ class BinaryBuilderSerializer {
return;
}
- if (val instanceof Map) {
+ if (forceMap || BinaryUtils.isSpecialMap(val.getClass())) {
Map<?, ?> map = (Map<?, ?>)val;
writer.writeByte(GridBinaryMarshaller.MAP);
http://git-wip-us.apache.org/repos/asf/ignite/blob/159b6cb4/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
index e2290d6..9043a8b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
@@ -36,6 +36,7 @@ import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiTuple;
import org.jetbrains.annotations.Nullable;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
@@ -508,10 +509,19 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
/** {@inheritDoc} */
@Override public <T> BinaryObjectBuilder setField(String name, @Nullable T val, Class<? super T> type) {
+ byte typeId;
+
+ if (Collection.class.equals(type))
+ typeId = GridBinaryMarshaller.COL;
+ else if (Map.class.equals(type))
+ typeId = GridBinaryMarshaller.MAP;
+ else
+ typeId = BinaryUtils.typeByClass(type);
+
if (assignedVals == null)
assignedVals = new LinkedHashMap<>();
- assignedVals.put(name, new BinaryValueWithType(BinaryUtils.typeByClass(type), val));
+ assignedVals.put(name, new BinaryValueWithType(typeId, val));
return this;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/159b6cb4/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryValueWithType.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryValueWithType.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryValueWithType.java
index 9f43bdb..c5a3e0a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryValueWithType.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryValueWithType.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.binary.builder;
import org.apache.ignite.internal.binary.BinaryWriterExImpl;
+import org.apache.ignite.internal.binary.GridBinaryMarshaller;
import org.apache.ignite.internal.util.typedef.internal.S;
/**
@@ -44,7 +45,7 @@ class BinaryValueWithType implements BinaryLazyValue {
if (val instanceof BinaryBuilderSerializationAware)
((BinaryBuilderSerializationAware)val).writeTo(writer, ctx);
else
- ctx.writeValue(writer, val);
+ ctx.writeValue(writer, val, type == GridBinaryMarshaller.COL, type == GridBinaryMarshaller.MAP);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/159b6cb4/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderAdditionalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderAdditionalSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderAdditionalSelfTest.java
index 06e1e93..804c060 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderAdditionalSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderAdditionalSelfTest.java
@@ -30,10 +30,10 @@ import org.apache.ignite.binary.BinaryType;
import org.apache.ignite.configuration.BinaryConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.binary.mutabletest.GridBinaryTestClasses;
-import org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl;
import org.apache.ignite.internal.binary.builder.BinaryBuilderEnum;
+import org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl;
import org.apache.ignite.internal.binary.mutabletest.GridBinaryMarshalerAwareTestClass;
+import org.apache.ignite.internal.binary.mutabletest.GridBinaryTestClasses;
import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl;
import org.apache.ignite.internal.processors.cache.binary.IgniteBinaryImpl;
import org.apache.ignite.internal.util.lang.GridMapEntry;
@@ -43,12 +43,18 @@ import org.junit.Assert;
import java.lang.reflect.Field;
import java.math.BigDecimal;
+import java.math.BigInteger;
import java.sql.Timestamp;
+import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
import java.util.Date;
+import java.util.HashMap;
import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -1261,4 +1267,85 @@ public class BinaryObjectBuilderAdditionalSelfTest extends GridCommonAbstractTes
return new BinaryObjectBuilderImpl(processor.binaryContext(), processor.typeId(aCls.getName()),
processor.binaryContext().userTypeName(aCls.getName()));
}
+
+ /**
+ * Check that correct type is stored in binary object.
+ */
+ public void testCollectionsSerialization() {
+ final BinaryObjectBuilder root = newWrapper(BigInteger.class);
+
+ final List<Integer> arrList = new ArrayList<>();
+
+ arrList.add(Integer.MAX_VALUE);
+
+ final List<Integer> linkedList = new LinkedList<>();
+
+ linkedList.add(Integer.MAX_VALUE);
+
+ final Set<Integer> hashSet = new HashSet<>();
+
+ hashSet.add(Integer.MAX_VALUE);
+
+ final Set<Integer> linkedHashSet = new LinkedHashSet<>();
+
+ linkedHashSet.add(Integer.MAX_VALUE);
+
+ final Map<String, String> hashMap = new HashMap<>();
+
+ hashMap.put("key", "val");
+
+ final Map<String, String> linkedHashMap = new LinkedHashMap<>();
+
+ linkedHashMap.put("key", "val");
+
+ // collections
+ root.setField("arrayList", arrList);
+ root.setField("linkedList", linkedList);
+ root.setField("hashSet", hashSet);
+ root.setField("linkedHashSet", linkedHashSet);
+
+ root.setField("singletonList", Collections.singletonList(Integer.MAX_VALUE), Collection.class);
+ root.setField("singletonSet", Collections.singleton(Integer.MAX_VALUE), Collection.class);
+
+ // maps
+ root.setField("hashMap", hashMap);
+ root.setField("linkedHashMap", linkedHashMap);
+
+ root.setField("singletonMap", Collections.singletonMap("key", "val"), Map.class);
+
+ // objects
+ root.setField("asList", Collections.singletonList(Integer.MAX_VALUE));
+ root.setField("asSet", Collections.singleton(Integer.MAX_VALUE));
+ root.setField("asMap", Collections.singletonMap("key", "val"));
+ root.setField("asListHint", Collections.singletonList(Integer.MAX_VALUE), List.class);
+ root.setField("asSetHint", Collections.singleton(Integer.MAX_VALUE), Set.class);
+ root.setField("asMapHint", (AbstractMap) Collections.singletonMap("key", "val"), AbstractMap.class);
+
+ BinaryObject binaryObj = root.build();
+
+ final String COL = "Collection";
+ final String MAP = "Map";
+ final String OBJ = "Object";
+
+ assert COL.equals(binaryObj.type().fieldTypeName("arrayList"));
+ assert COL.equals(binaryObj.type().fieldTypeName("linkedList"));
+ assert COL.equals(binaryObj.type().fieldTypeName("hashSet"));
+ assert COL.equals(binaryObj.type().fieldTypeName("linkedHashSet"));
+ assert COL.equals(binaryObj.type().fieldTypeName("linkedHashSet"));
+ assert COL.equals(binaryObj.type().fieldTypeName("linkedHashSet"));
+
+ assert COL.equals(binaryObj.type().fieldTypeName("singletonList"));
+ assert COL.equals(binaryObj.type().fieldTypeName("singletonSet"));
+
+ assert MAP.equals(binaryObj.type().fieldTypeName("singletonMap"));
+
+ assert OBJ.equals(binaryObj.type().fieldTypeName("asList"));
+ assert OBJ.equals(binaryObj.type().fieldTypeName("asSet"));
+ assert OBJ.equals(binaryObj.type().fieldTypeName("asMap"));
+ assert OBJ.equals(binaryObj.type().fieldTypeName("asListHint"));
+ assert OBJ.equals(binaryObj.type().fieldTypeName("asSetHint"));
+ assert OBJ.equals(binaryObj.type().fieldTypeName("asMapHint"));
+
+ }
+
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/159b6cb4/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderDefaultMappersSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderDefaultMappersSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderDefaultMappersSelfTest.java
index 990c928..9659c39 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderDefaultMappersSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderDefaultMappersSelfTest.java
@@ -674,18 +674,24 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
builder.hashCode(100);
builder.setField("collectionField", Arrays.asList(new Value(1), new Value(2)));
+ builder.setField("collectionField2", Arrays.asList(new Value(1), new Value(2)), Collection.class);
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
assertEquals(100, po.hashCode());
- List<BinaryObject> list = po.field("collectionField");
+ List<Value> list = po.field("collectionField");
assertEquals(2, list.size());
+ assertEquals(1, list.get(0).i);
+ assertEquals(2, list.get(1).i);
- assertEquals(1, list.get(0).<Value>deserialize().i);
- assertEquals(2, list.get(1).<Value>deserialize().i);
+ List<BinaryObject> list2 = po.field("collectionField2");
+
+ assertEquals(2, list2.size());
+ assertEquals(1, list2.get(0).<Value>deserialize().i);
+ assertEquals(2, list2.get(1).<Value>deserialize().i);
}
/**
@@ -697,17 +703,27 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
builder.hashCode(100);
builder.setField("mapField", F.asMap(new Key(1), new Value(1), new Key(2), new Value(2)));
+ builder.setField("mapField2", F.asMap(new Key(1), new Value(1), new Key(2), new Value(2)), Map.class);
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
assertEquals(100, po.hashCode());
- Map<BinaryObject, BinaryObject> map = po.field("mapField");
+ // Test non-standard map.
+ Map<Key, Value> map = po.field("mapField");
assertEquals(2, map.size());
- for (Map.Entry<BinaryObject, BinaryObject> e : map.entrySet())
+ for (Map.Entry<Key, Value> e : map.entrySet())
+ assertEquals(e.getKey().i, e.getValue().i);
+
+ // Test binary map
+ Map<BinaryObject, BinaryObject> map2 = po.field("mapField2");
+
+ assertEquals(2, map2.size());
+
+ for (Map.Entry<BinaryObject, BinaryObject> e : map2.entrySet())
assertEquals(e.getKey().<Key>deserialize().i, e.getValue().<Value>deserialize().i);
}
@@ -723,7 +739,7 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
builder.setField("f", 111.111f);
builder.setField("iArr", new int[] {1, 2, 3});
builder.setField("obj", new Key(1));
- builder.setField("col", Arrays.asList(new Value(1), new Value(2)));
+ builder.setField("col", Arrays.asList(new Value(1), new Value(2)), Collection.class);
BinaryObject po = builder.build();
@@ -755,7 +771,7 @@ public class BinaryObjectBuilderDefaultMappersSelfTest extends GridCommonAbstrac
builder.setField("f", 111.111f);
builder.setField("iArr", new int[] {1, 2, 3});
builder.setField("obj", new Key(1));
- builder.setField("col", Arrays.asList(new Value(1), new Value(2)));
+ builder.setField("col", Arrays.asList(new Value(1), new Value(2)), Collection.class);
BinaryObject po = builder.build();
[03/11] ignite git commit: Merge remote-tracking branch
'origin/master'
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/master'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6c4bad17
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6c4bad17
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6c4bad17
Branch: refs/heads/ignite-2407
Commit: 6c4bad1758d7ff963a3bc1830d910732edd7db0b
Parents: 159b6cb 57236c6
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Feb 12 16:03:06 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Feb 12 16:03:06 2016 +0300
----------------------------------------------------------------------
.../apache/ignite/cache/CacheMemoryMode.java | 2 +
.../internal/GridMessageListenHandler.java | 16 ++
.../processors/cache/GridCacheAdapter.java | 7 +
.../processors/cache/GridCacheProcessor.java | 8 +-
.../processors/cache/GridCacheSwapManager.java | 3 +-
.../continuous/GridContinuousProcessor.java | 50 +++--
.../internal/GridAffinityNoCacheSelfTest.java | 4 +-
...eClientReconnectContinuousProcessorTest.java | 32 +++-
.../GridCacheOffHeapValuesEvictionSelfTest.java | 17 +-
.../GridCacheReplicatedPreloadSelfTest.java | 121 +++++++++---
...IgniteCacheContinuousQueryReconnectTest.java | 192 +++++++++++++++++++
.../tcp/TcpClientDiscoverySpiSelfTest.java | 2 +-
.../p2p/CacheDeploymentAffinityKeyMapper.java | 35 ++++
.../CacheDeploymentAlwaysTruePredicate2.java | 30 +++
...oymentCacheEntryEventSerializableFilter.java | 32 ++++
.../p2p/CacheDeploymentCacheEntryListener.java | 31 +++
...CacheDeploymentCachePluginConfiguration.java | 74 +++++++
...heDeploymentStoreSessionListenerFactory.java | 83 ++++++++
.../IgniteCacheQuerySelfTestSuite.java | 2 +
.../yardstick/cache/IgniteInvokeBenchmark.java | 65 +++++++
.../cache/IgniteInvokeTxBenchmark.java | 30 +++
21 files changed, 786 insertions(+), 50 deletions(-)
----------------------------------------------------------------------
[05/11] ignite git commit: ignite-2615 If swap is not enabled need
pass value evicted from offheap to query manager ignite-2622 Do not keep
custom messages data after message is processed ignite-2586 Fixed
GridCacheMapEntry.clear
Posted by sb...@apache.org.
ignite-2615 If swap is not enabled need pass value evicted from offheap to query manager
ignite-2622 Do not keep custom messages data after message is processed
ignite-2586 Fixed GridCacheMapEntry.clear
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a6b3dedd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a6b3dedd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a6b3dedd
Branch: refs/heads/ignite-2407
Commit: a6b3dedd381a71fec8dd9dcf944be2626336cc22
Parents: 3dce33f
Author: sboikov <sb...@gridgain.com>
Authored: Fri Feb 12 16:43:01 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Feb 12 16:43:01 2016 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheAdapter.java | 4 +-
.../cache/GridCacheClearAllRunnable.java | 2 +-
.../processors/cache/GridCacheEntryEx.java | 11 +-
.../processors/cache/GridCacheMapEntry.java | 102 ++--
.../processors/cache/GridCacheProcessor.java | 4 +-
.../processors/cache/GridCacheSwapManager.java | 43 +-
.../dht/GridDhtPartitionTopologyImpl.java | 7 +-
.../GridDhtPartitionsExchangeFuture.java | 6 +
.../ignite/spi/discovery/tcp/ServerImpl.java | 5 +
.../TcpDiscoveryCustomEventMessage.java | 10 +-
.../cache/CacheConfigurationLeakTest.java | 62 +++
.../processors/cache/GridCacheTestEntryEx.java | 5 +-
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 2 +-
.../testsuites/IgniteCacheTestSuite2.java | 2 +
.../CacheQueryOffheapEvictDataLostTest.java | 138 +++++
.../CacheRandomOperationsMultithreadedTest.java | 507 +++++++++++++++++++
.../IgniteCacheQuerySelfTestSuite.java | 3 +
.../IgniteCacheWithIndexingTestSuite.java | 2 +
18 files changed, 812 insertions(+), 103 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a6b3dedd/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 3fac207..535bc9d 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
@@ -1250,7 +1250,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
try {
if (e != null)
- e.clear(obsoleteVer, readers, null);
+ e.clear(obsoleteVer, readers);
}
catch (IgniteCheckedException ex) {
U.error(log, "Failed to clearLocally entry (will continue to clearLocally other entries): " + e,
@@ -4609,7 +4609,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
GridCacheEntryEx entry = ctx.isSwapOrOffheapEnabled() ? entryEx(cacheKey) : peekEx(cacheKey);
if (entry != null)
- return entry.clear(obsoleteVer, readers, null);
+ return entry.clear(obsoleteVer, readers);
}
catch (GridDhtInvalidPartitionException ignored) {
// No-op.
http://git-wip-us.apache.org/repos/asf/ignite/blob/a6b3dedd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java
index 77c5a55..ad8ade1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java
@@ -143,7 +143,7 @@ public class GridCacheClearAllRunnable<K, V> implements Runnable {
*/
protected void clearEntry(GridCacheEntryEx e) {
try {
- e.clear(obsoleteVer, readers, CU.empty0());
+ e.clear(obsoleteVer, readers);
}
catch (IgniteCheckedException ex) {
U.error(log, "Failed to clearLocally entry from cache (will continue to clearLocally other entries): " + e, ex);
http://git-wip-us.apache.org/repos/asf/ignite/blob/a6b3dedd/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 ccbaf38..9bee307 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
@@ -537,12 +537,10 @@ public interface GridCacheEntryEx {
*
* @param ver Obsolete version.
* @param readers Flag to clear readers as well.
- * @param filter Optional entry filter.
* @throws IgniteCheckedException If failed to remove from swap.
* @return {@code True} if entry was not being used, passed the filter and could be removed.
*/
- public boolean clear(GridCacheVersion ver, boolean readers,
- @Nullable CacheEntryPredicate[] filter) throws IgniteCheckedException;
+ public boolean clear(GridCacheVersion ver, boolean readers) throws IgniteCheckedException;
/**
* This locks is called by transaction manager during prepare step
@@ -922,7 +920,10 @@ public interface GridCacheEntryEx {
public void updateTtl(@Nullable GridCacheVersion ver, long ttl);
/**
- * Tries to do offheap -> swap eviction.
+ * Called when entry should be evicted from offheap.
+ * <p>
+ * If swap is enabled tries to do offheap -> swap eviction, otherwise evicted value should
+ * be passed to query manager.
*
* @param entry Serialized swap entry.
* @param evictVer Version when entry was selected for eviction.
@@ -931,7 +932,7 @@ public interface GridCacheEntryEx {
* @throws GridCacheEntryRemovedException If entry was removed.
* @return {@code True} if entry was obsoleted and written to swap.
*/
- public boolean offheapSwapEvict(byte[] entry, GridCacheVersion evictVer, GridCacheVersion obsoleteVer)
+ public boolean onOffheapEvict(byte[] entry, GridCacheVersion evictVer, GridCacheVersion obsoleteVer)
throws IgniteCheckedException, GridCacheEntryRemovedException;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/a6b3dedd/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 9336e0a..c1eeb5e 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
@@ -427,9 +427,9 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
}
/** {@inheritDoc} */
- @Override public boolean offheapSwapEvict(byte[] entry, GridCacheVersion evictVer, GridCacheVersion obsoleteVer)
+ @Override public boolean onOffheapEvict(byte[] entry, GridCacheVersion evictVer, GridCacheVersion obsoleteVer)
throws IgniteCheckedException, GridCacheEntryRemovedException {
- assert cctx.swap().swapEnabled() && cctx.swap().offHeapEnabled() : this;
+ assert cctx.swap().offHeapEnabled() && (cctx.swap().swapEnabled() || cctx.queries().enabled()) : this;
boolean obsolete;
@@ -444,12 +444,18 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
if (mvcc != null && !mvcc.isEmpty(obsoleteVer))
return false;
- if (cctx.swap().offheapSwapEvict(key, entry, partition(), evictVer)) {
+ if (cctx.swap().onOffheapEvict(key, entry, partition(), evictVer)) {
assert !hasValueUnlocked() : this;
obsolete = markObsolete0(obsoleteVer, false, null);
assert obsolete : this;
+
+ if (!cctx.swap().swapEnabled()) {
+ CacheObject val = cctx.swap().unmarshalSwapEntryValue(entry);
+
+ clearIndex(val);
+ }
}
else
obsolete = false;
@@ -2619,85 +2625,51 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
}
/** {@inheritDoc} */
- @Override public boolean clear(GridCacheVersion ver, boolean readers,
- @Nullable CacheEntryPredicate[] filter) throws IgniteCheckedException {
- boolean ret;
- boolean rmv;
- boolean marked;
-
- while (true) {
- ret = false;
- rmv = false;
- marked = false;
-
- // For optimistic check.
- GridCacheVersion startVer = null;
-
- if (!F.isEmptyOrNulls(filter)) {
- synchronized (this) {
- startVer = this.ver;
- }
-
- if (!cctx.isAll(this, filter))
- return false;
- }
-
- synchronized (this) {
- if (startVer != null && !startVer.equals(this.ver))
- // Version has changed since filter checking.
- continue;
-
- CacheObject val = saveValueForIndexUnlocked();
-
- try {
- if ((!hasReaders() || readers)) {
- // markObsolete will clear the value.
- if (!(marked = markObsolete0(ver, true, null))) {
- if (log.isDebugEnabled())
- log.debug("Entry could not be marked obsolete (it is still used): " + this);
+ @Override public boolean clear(GridCacheVersion ver, boolean readers) throws IgniteCheckedException {
+ synchronized (this) {
+ if (obsolete())
+ return false;
- break;
- }
+ CacheObject val = saveValueForIndexUnlocked();
- clearReaders();
- }
- else {
+ try {
+ if ((!hasReaders() || readers)) {
+ // markObsolete will clear the value.
+ if (!(markObsolete0(ver, true, null))) {
if (log.isDebugEnabled())
- log.debug("Entry could not be marked obsolete (it still has readers): " + this);
+ log.debug("Entry could not be marked obsolete (it is still used): " + this);
- break;
+ return false;
}
+
+ clearReaders();
}
- catch (GridCacheEntryRemovedException ignore) {
+ else {
if (log.isDebugEnabled())
- log.debug("Got removed entry when clearing (will simply return): " + this);
-
- ret = true;
+ log.debug("Entry could not be marked obsolete (it still has readers): " + this);
- break;
+ return false;
}
+ }
+ catch (GridCacheEntryRemovedException ignore) {
+ assert false;
- if (log.isDebugEnabled())
- log.debug("Entry has been marked obsolete: " + this);
-
- clearIndex(val);
+ return false;
+ }
- releaseSwap();
+ if (log.isDebugEnabled())
+ log.debug("Entry has been marked obsolete: " + this);
- ret = true;
- rmv = true;
+ clearIndex(val);
- break;
- }
+ releaseSwap();
}
- if (marked)
- onMarkedObsolete();
+ onMarkedObsolete();
- if (rmv)
- cctx.cache().removeEntry(this); // Clear cache.
+ cctx.cache().removeEntry(this); // Clear cache.
- return ret;
+ return true;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/a6b3dedd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 7a36e73..4bf96d2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -2868,9 +2868,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
try {
KeyCacheObject key = cctx.toCacheKeyObject(keyBytes);
- GridCacheSwapEntry swapEntry = GridCacheSwapEntryImpl.unmarshal(valBytes, true);
-
- CacheObject val = swapEntry.value();
+ CacheObject val = cctx.swap().unmarshalSwapEntryValue(valBytes);
assert val != null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/a6b3dedd/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 cbf09bc..37c7958 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
@@ -40,6 +40,7 @@ import org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersionAware;
import org.apache.ignite.internal.processors.offheap.GridOffHeapProcessor;
+import org.apache.ignite.internal.processors.query.GridQueryProcessor;
import org.apache.ignite.internal.util.GridCloseableIteratorAdapter;
import org.apache.ignite.internal.util.GridConcurrentHashSet;
import org.apache.ignite.internal.util.GridEmptyCloseableIterator;
@@ -106,8 +107,8 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
/** Soft iterator set. */
private final Collection<GridWeakIterator<Map.Entry>> itSet = new GridConcurrentHashSet<>();
- /** {@code True} if offheap to swap eviction is possible. */
- private boolean offheapToSwapEvicts;
+ /** {@code True} if need process evictions from offheap. */
+ private boolean unwindOffheapEvicts;
/** Values to be evicted from offheap to swap. */
private ThreadLocal<Collection<IgniteBiTuple<byte[], byte[]>>> offheapEvicts = new ThreadLocal<>();
@@ -141,7 +142,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
*
*/
public void unwindOffheapEvicts() {
- if (!offheapToSwapEvicts)
+ if (!unwindOffheapEvicts)
return;
Collection<IgniteBiTuple<byte[], byte[]>> evicts = offheapEvicts.get();
@@ -162,7 +163,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
GridCacheEntryEx entry = cctx.cache().entryEx(key);
try {
- if (entry.offheapSwapEvict(vb, evictVer, obsoleteVer))
+ if (entry.onOffheapEvict(vb, evictVer, obsoleteVer))
cctx.cache().removeEntry(entry);
break;
@@ -199,12 +200,12 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
GridOffHeapEvictListener lsnr;
- if (swapEnabled) {
- offheapToSwapEvicts = true;
+ if (swapEnabled || GridQueryProcessor.isEnabled(cctx.config())) {
+ unwindOffheapEvicts = true;
lsnr = new GridOffHeapEvictListener() {
@Override public void onEvict(int part, int hash, byte[] kb, byte[] vb) {
- assert offheapToSwapEvicts;
+ assert unwindOffheapEvicts;
onOffheapEvict();
@@ -1076,7 +1077,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
* @return {@code True} if removed.
* @throws IgniteCheckedException If failed.
*/
- boolean offheapSwapEvict(final KeyCacheObject key, byte[] entry, int part, final GridCacheVersion ver)
+ boolean onOffheapEvict(final KeyCacheObject key, byte[] entry, int part, final GridCacheVersion ver)
throws IgniteCheckedException {
assert offheapEnabled;
@@ -1096,13 +1097,14 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
Collection<GridCacheSwapListener> lsnrs = offheapLsnrs.get(part);
if (lsnrs != null) {
- GridCacheSwapEntry e = swapEntry(GridCacheSwapEntryImpl.unmarshal(entry, false));
+ GridCacheSwapEntry e = swapEntry(unmarshalSwapEntry(entry, false));
for (GridCacheSwapListener lsnr : lsnrs)
lsnr.onEntryUnswapped(part, key, e);
}
- cctx.swap().writeToSwap(part, key, entry);
+ if (swapEnabled)
+ cctx.swap().writeToSwap(part, key, entry);
}
return rmv;
@@ -2142,6 +2144,19 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
/**
* @param bytes Bytes to unmarshal.
+ * @return Unmarshalled values.
+ * @throws IgniteCheckedException If failed.
+ */
+ public CacheObject unmarshalSwapEntryValue(byte[] bytes) throws IgniteCheckedException {
+ GridCacheSwapEntry swapEntry = swapEntry(GridCacheSwapEntryImpl.unmarshal(bytes, true));
+
+ assert swapEntry != null && swapEntry.value() != null : swapEntry;
+
+ return swapEntry.value();
+ }
+
+ /**
+ * @param bytes Bytes to unmarshal.
* @param valOnly If {@code true} unmarshalls only value.
* @return Unmarshalled entry.
*/
@@ -2192,9 +2207,9 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
@Override protected Map.Entry<byte[], GridCacheSwapEntry> onNext() throws IgniteCheckedException {
Map.Entry<byte[], byte[]> e = iter.nextX();
- GridCacheSwapEntry unmarshalled = unmarshalSwapEntry(e.getValue(), false);
+ GridCacheSwapEntry unmarshalled = swapEntry(unmarshalSwapEntry(e.getValue(), false));
- return F.t(e.getKey(), swapEntry(unmarshalled));
+ return F.t(e.getKey(), unmarshalled);
}
/** {@inheritDoc} */
@@ -2500,9 +2515,9 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
/** {@inheritDoc} */
@Override public V getValue() {
try {
- GridCacheSwapEntry e = unmarshalSwapEntry(entry.getValue(), false);
+ GridCacheSwapEntry e = swapEntry(unmarshalSwapEntry(entry.getValue(), false));
- swapEntry(e);
+ assert e != null;
return e.value().value(cctx.cacheObjectContext(), false);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a6b3dedd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
index 0e579ac..bf2d2c6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
@@ -427,6 +427,8 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
if (node2part != null && node2part.valid())
checkEvictions(updateSeq);
+ updateRebalanceVersion();
+
consistencyCheck();
if (log.isDebugEnabled())
@@ -1365,11 +1367,14 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
*/
private void updateRebalanceVersion() {
if (!rebalancedTopVer.equals(topVer)) {
+ if (node2part == null || !node2part.valid())
+ return;
+
for (int i = 0; i < cctx.affinity().partitions(); i++) {
List<ClusterNode> affNodes = cctx.affinity().nodes(i, topVer);
// Topology doesn't contain server nodes (just clients).
- if (affNodes.isEmpty() || (node2part != null && !node2part.valid()))
+ if (affNodes.isEmpty())
continue;
List<ClusterNode> owners = owners(i);
http://git-wip-us.apache.org/repos/asf/ignite/blob/a6b3dedd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index 22fb59e..68a05e4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -46,6 +46,7 @@ import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
+import org.apache.ignite.internal.events.DiscoveryCustomEvent;
import org.apache.ignite.internal.managers.discovery.GridDiscoveryTopologySnapshot;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.DynamicCacheChangeRequest;
@@ -1132,6 +1133,11 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
cacheCtx.config().getAffinity().removeNode(exchId.nodeId());
}
+ reqs = null;
+
+ if (discoEvt instanceof DiscoveryCustomEvent)
+ ((DiscoveryCustomEvent)discoEvt).customMessage(null);
+
return true;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a6b3dedd/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index 0106b0a..fa0ae1c 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -4597,6 +4597,8 @@ class ServerImpl extends TcpDiscoveryImpl {
else
processCustomMessage(msg);
}
+
+ msg.message(null, msg.messageBytes());
}
else {
addMessage(new TcpDiscoveryDiscardMessage(getLocalNodeId(), msg.id(), true));
@@ -4655,6 +4657,9 @@ class ServerImpl extends TcpDiscoveryImpl {
notifyDiscoveryListener(msg);
}
+ if (msg.verified())
+ msg.message(null, msg.messageBytes());
+
if (sendMessageToRemotes(msg))
sendMessageAcrossRing(msg);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a6b3dedd/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryCustomEventMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryCustomEventMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryCustomEventMessage.java
index e10de46..9064080 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryCustomEventMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryCustomEventMessage.java
@@ -70,14 +70,8 @@ public class TcpDiscoveryCustomEventMessage extends TcpDiscoveryAbstractMessage
}
/**
- * @return Deserialized message,
- * @throws java.lang.Throwable if unmarshal failed.
- */
- @Nullable public DiscoverySpiCustomMessage message(@NotNull Marshaller marsh) throws Throwable {
- return message(marsh, null);
- }
-
- /**
+ * @param marsh Marshaller.
+ * @param ldr Classloader.
* @return Deserialized message,
* @throws java.lang.Throwable if unmarshal failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/a6b3dedd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConfigurationLeakTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConfigurationLeakTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConfigurationLeakTest.java
new file mode 100644
index 0000000..85d6de5
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConfigurationLeakTest.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ *
+ */
+public class CacheConfigurationLeakTest extends GridCommonAbstractTest {
+ /**
+ *
+ */
+ public CacheConfigurationLeakTest() {
+ super(true);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testCacheCreateLeak() throws Exception {
+ final Ignite ignite = grid();
+
+ GridTestUtils.runMultiThreaded(new IgniteInClosure<Integer>() {
+ @Override public void apply(Integer idx) {
+ for (int i = 0; i < 100; i++) {
+ CacheConfiguration ccfg = new CacheConfiguration();
+ ccfg.setName("cache-" + idx + "-" + i);
+ ccfg.setEvictionPolicy(new LruEvictionPolicy(1000));
+
+ IgniteCache cache = ignite.createCache(ccfg);
+
+ for (int k = 0; k < 5000; k++)
+ cache.put(k, new byte[1024]);
+
+ ignite.destroyCache(cache.getName());
+ }
+ }
+ }, 5, "cache-thread");
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a6b3dedd/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 f6eb430..e627083 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
@@ -572,8 +572,7 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
}
/** @inheritDoc */
- @Override public boolean clear(GridCacheVersion ver, boolean readers,
- @Nullable CacheEntryPredicate[] filter) throws IgniteCheckedException {
+ @Override public boolean clear(GridCacheVersion ver, boolean readers) throws IgniteCheckedException {
if (ver == null || ver.equals(this.ver)) {
val = null;
@@ -850,7 +849,7 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
}
/** {@inheritDoc} */
- @Override public boolean offheapSwapEvict(byte[] vb, GridCacheVersion evictVer, GridCacheVersion obsoleteVer)
+ @Override public boolean onOffheapEvict(byte[] vb, GridCacheVersion evictVer, GridCacheVersion obsoleteVer)
throws IgniteCheckedException, GridCacheEntryRemovedException {
return false;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a6b3dedd/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
index 7bb2cf3..7635f0b 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
@@ -1884,7 +1884,7 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
if (msg instanceof TcpDiscoveryCustomEventMessage) {
try {
DiscoveryCustomMessage custMsg = GridTestUtils.getFieldValue(
- ((TcpDiscoveryCustomEventMessage)msg).message(marsh), "delegate");
+ ((TcpDiscoveryCustomEventMessage)msg).message(marsh, U.gridClassLoader()), "delegate");
if (custMsg instanceof StartRoutineAckDiscoveryMessage) {
log.info("Skip message send and stop node: " + msg);
http://git-wip-us.apache.org/repos/asf/ignite/blob/a6b3dedd/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
index cadcba7..d83b272 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
@@ -22,6 +22,7 @@ import org.apache.ignite.cache.affinity.fair.FairAffinityFunctionBackupFilterSel
import org.apache.ignite.cache.affinity.fair.FairAffinityFunctionExcludeNeighborsSelfTest;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunctionBackupFilterSelfTest;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunctionExcludeNeighborsSelfTest;
+import org.apache.ignite.internal.processors.cache.CacheConfigurationLeakTest;
import org.apache.ignite.internal.processors.cache.CacheDhtLocalPartitionAfterRemoveSelfTest;
import org.apache.ignite.internal.processors.cache.CrossCacheTxRandomOperationsTest;
import org.apache.ignite.internal.processors.cache.GridCacheAtomicMessageCountSelfTest;
@@ -248,6 +249,7 @@ public class IgniteCacheTestSuite2 extends TestSuite {
suite.addTest(new TestSuite(IgniteDynamicCacheAndNodeStop.class));
suite.addTest(new TestSuite(CacheLockReleaseNodeLeaveTest.class));
suite.addTest(new TestSuite(NearCacheSyncUpdateTest.class));
+ suite.addTest(new TestSuite(CacheConfigurationLeakTest.class));
return suite;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a6b3dedd/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheQueryOffheapEvictDataLostTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheQueryOffheapEvictDataLostTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheQueryOffheapEvictDataLostTest.java
new file mode 100644
index 0000000..26e8300
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheQueryOffheapEvictDataLostTest.java
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.io.Serializable;
+import java.util.concurrent.ThreadLocalRandom;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy;
+import org.apache.ignite.cache.query.SqlQuery;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.cache.CacheMemoryMode.OFFHEAP_TIERED;
+import static org.apache.ignite.cache.CacheMemoryMode.ONHEAP_TIERED;
+
+/**
+ *
+ */
+public class CacheQueryOffheapEvictDataLostTest extends GridCommonAbstractTest {
+ /** */
+ private static final int KEYS = 100_000;
+
+ /**
+ *
+ */
+ public CacheQueryOffheapEvictDataLostTest() {
+ super(true);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration() throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration();
+
+ CacheConfiguration<Object, Object> ccfg1 = new CacheConfiguration<>();
+
+ ccfg1.setName("cache-1");
+ ccfg1.setMemoryMode(OFFHEAP_TIERED);
+ ccfg1.setOffHeapMaxMemory(1024);
+ ccfg1.setIndexedTypes(Integer.class, TestData.class);
+ ccfg1.setSwapEnabled(false);
+
+ CacheConfiguration<Object, Object> ccfg2 = new CacheConfiguration<>();
+
+ ccfg2.setName("cache-2");
+ ccfg2.setMemoryMode(ONHEAP_TIERED);
+ ccfg2.setEvictionPolicy(new LruEvictionPolicy(10));
+ ccfg2.setOffHeapMaxMemory(1024);
+ ccfg2.setIndexedTypes(Integer.class, TestData.class);
+ ccfg2.setSwapEnabled(false);
+
+ cfg.setCacheConfiguration(ccfg1, ccfg2);
+
+ return cfg;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testQueryDataLost() throws Exception {
+ final long stopTime = U.currentTimeMillis() + 30_000;
+
+ GridTestUtils.runMultiThreaded(new IgniteInClosure<Integer>() {
+ void putGet(IgniteCache<Object, Object> cache) {
+ ThreadLocalRandom rnd = ThreadLocalRandom.current();
+
+ for (int i = 0; i < KEYS; i++) {
+ cache.put(rnd.nextInt(KEYS), new TestData(i));
+
+ cache.get(rnd.nextInt(KEYS));
+ }
+ }
+
+ void query(IgniteCache<Object, Object> cache) {
+ SqlQuery<Object, Object> qry1 = new SqlQuery<>(TestData.class, "_key > ?");
+ qry1.setArgs(KEYS / 2);
+
+ cache.query(qry1).getAll();
+
+ SqlQuery<Object, Object> qry2 = new SqlQuery<>(TestData.class, "idxVal > ?");
+ qry2.setArgs(KEYS / 2);
+
+ cache.query(qry2).getAll();
+ }
+
+ @Override public void apply(Integer idx) {
+ IgniteCache<Object, Object> cache1 = grid().cache("cache-1");
+ IgniteCache<Object, Object> cache2 = grid().cache("cache-2");
+
+ while (U.currentTimeMillis() < stopTime) {
+ if (idx == 0) {
+ putGet(cache1);
+ putGet(cache2);
+ }
+ else {
+ query(cache1);
+ query(cache2);
+ }
+ }
+ }
+ }, 10, "test-thread");
+ }
+
+ /**
+ *
+ */
+ static class TestData implements Serializable {
+ /** */
+ @QuerySqlField(index = true)
+ private int idxVal;
+
+ /**
+ * @param idxVal Value.
+ */
+ public TestData(int idxVal) {
+ this.idxVal = idxVal;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a6b3dedd/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheRandomOperationsMultithreadedTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheRandomOperationsMultithreadedTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheRandomOperationsMultithreadedTest.java
new file mode 100644
index 0000000..dc0175d
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheRandomOperationsMultithreadedTest.java
@@ -0,0 +1,507 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.concurrent.ThreadLocalRandom;
+import javax.cache.Cache;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMemoryMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.eviction.EvictionPolicy;
+import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy;
+import org.apache.ignite.cache.query.ScanQuery;
+import org.apache.ignite.cache.query.SqlQuery;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteBiPredicate;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
+import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheMemoryMode.OFFHEAP_TIERED;
+import static org.apache.ignite.cache.CacheMemoryMode.ONHEAP_TIERED;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ *
+ */
+public class CacheRandomOperationsMultithreadedTest extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private static final int KEYS = 1000;
+
+ /** */
+ private static final int NODES = 4;
+
+ /** */
+ private boolean client;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+
+ cfg.setClientMode(client);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ startGridsMultiThreaded(NODES - 1);
+
+ client = true;
+
+ startGrid(NODES - 1);
+
+ super.beforeTestsStarted();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+
+ super.afterTestsStopped();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testAtomicOffheapTiered() throws Exception {
+ CacheConfiguration<Object, Object> ccfg = cacheConfiguration(PARTITIONED,
+ ATOMIC,
+ OFFHEAP_TIERED,
+ null,
+ false);
+
+ randomOperations(ccfg);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testAtomicOffheapTieredIndexing() throws Exception {
+ CacheConfiguration<Object, Object> ccfg = cacheConfiguration(PARTITIONED,
+ ATOMIC,
+ OFFHEAP_TIERED,
+ null,
+ true);
+
+ randomOperations(ccfg);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testAtomicOffheapEviction() throws Exception {
+ CacheConfiguration<Object, Object> ccfg = cacheConfiguration(PARTITIONED,
+ ATOMIC,
+ ONHEAP_TIERED,
+ new LruEvictionPolicy<>(10),
+ false);
+
+ randomOperations(ccfg);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testAtomicOffheapEvictionIndexing() throws Exception {
+ CacheConfiguration<Object, Object> ccfg = cacheConfiguration(PARTITIONED,
+ ATOMIC,
+ ONHEAP_TIERED,
+ new LruEvictionPolicy<>(10),
+ true);
+
+ randomOperations(ccfg);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testTxOffheapTiered() throws Exception {
+ CacheConfiguration<Object, Object> ccfg = cacheConfiguration(PARTITIONED,
+ TRANSACTIONAL,
+ OFFHEAP_TIERED,
+ null,
+ false);
+
+ randomOperations(ccfg);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testTxOffheapTieredIndexing() throws Exception {
+ CacheConfiguration<Object, Object> ccfg = cacheConfiguration(PARTITIONED,
+ TRANSACTIONAL,
+ OFFHEAP_TIERED,
+ null,
+ true);
+
+ randomOperations(ccfg);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testTxOffheapEviction() throws Exception {
+ CacheConfiguration<Object, Object> ccfg = cacheConfiguration(PARTITIONED,
+ TRANSACTIONAL,
+ ONHEAP_TIERED,
+ new LruEvictionPolicy<>(10),
+ false);
+
+ randomOperations(ccfg);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testTxOffheapEvictionIndexing() throws Exception {
+ CacheConfiguration<Object, Object> ccfg = cacheConfiguration(PARTITIONED,
+ TRANSACTIONAL,
+ ONHEAP_TIERED,
+ new LruEvictionPolicy<>(10),
+ true);
+
+ randomOperations(ccfg);
+ }
+
+ /**
+ * @param ccfg CacheConfiguration.
+ * @throws Exception If failed.
+ */
+ private void randomOperations(final CacheConfiguration<Object, Object> ccfg) throws Exception {
+ ignite(0).createCache(ccfg);
+
+ try {
+ final long stopTime = U.currentTimeMillis() + 30_000;
+
+ final boolean indexing = !F.isEmpty(ccfg.getIndexedTypes()) ||
+ !F.isEmpty(ccfg.getQueryEntities());
+
+ GridTestUtils.runMultiThreaded(new IgniteInClosure<Integer>() {
+ @Override public void apply(Integer idx) {
+ Ignite ignite = ignite(idx % NODES);
+
+ IgniteCache<Object, Object> cache = ignite.cache(ccfg.getName());
+
+ ThreadLocalRandom rnd = ThreadLocalRandom.current();
+
+ while (U.currentTimeMillis() < stopTime)
+ randomOperation(rnd, ignite, cache, indexing);
+ }
+ }, 1, "test-thread");
+ }
+ finally {
+ ignite(0).destroyCache(ccfg.getName());
+ }
+ }
+
+ /**
+ * @param rnd Random generator.
+ * @param ignite Node.
+ * @param cache Cache.
+ * @param indexing Indexing flag.
+ */
+ private void randomOperation(ThreadLocalRandom rnd,
+ Ignite ignite,
+ IgniteCache<Object, Object> cache,
+ boolean indexing) {
+ int r0 = rnd.nextInt(100);
+
+ if (r0 == 0)
+ cache.clear();
+ else if (r0 == 1)
+ cache.size();
+
+ switch (rnd.nextInt(14)) {
+ case 0: {
+ cache.put(key(rnd), value(rnd));
+
+ break;
+ }
+
+ case 1: {
+ cache.getAndPut(key(rnd), value(rnd));
+
+ break;
+ }
+
+ case 2: {
+ cache.get(key(rnd));
+
+ break;
+ }
+
+ case 3: {
+ cache.remove(key(rnd));
+
+ break;
+ }
+
+ case 4: {
+ cache.getAndRemove(key(rnd));
+
+ break;
+ }
+
+ case 5: {
+ Map<Object, Object> map = new TreeMap<>();
+
+ for (int i = 0; i < 50; i++)
+ map.put(key(rnd), value(rnd));
+
+ cache.putAll(map);
+
+ break;
+ }
+
+ case 6: {
+ cache.getAll(keys(50, rnd));
+
+ break;
+ }
+
+ case 7: {
+ cache.removeAll(keys(50, rnd));
+
+ break;
+ }
+
+ case 8: {
+ cache.putIfAbsent(key(rnd), value(rnd));
+
+ break;
+ }
+
+ case 9: {
+ cache.getAndPutIfAbsent(key(rnd), value(rnd));
+
+ break;
+ }
+
+ case 10: {
+ cache.replace(key(rnd), value(rnd));
+
+ break;
+ }
+
+ case 11: {
+ cache.getAndReplace(key(rnd), value(rnd));
+
+ break;
+ }
+
+ case 12: {
+ ScanQuery<Object, Object> qry = new ScanQuery<>();
+ qry.setFilter(new TestFilter());
+
+ List<Cache.Entry<Object, Object>> res = cache.query(qry).getAll();
+
+ assertTrue(res.size() >= 0);
+
+ break;
+ }
+
+ case 13: {
+ if (indexing) {
+ SqlQuery<Object, Object> qry = new SqlQuery<>(TestData.class, "where val1 > ?");
+ qry.setArgs(KEYS / 2);
+
+ List<Cache.Entry<Object, Object>> res = cache.query(qry).getAll();
+
+ assertTrue(res.size() >= 0);
+ }
+
+ break;
+ }
+
+ default:
+ fail();
+ }
+ }
+
+ /**
+ * @param cnt Number of keys.
+ * @param rnd Random generator.
+ * @return Keys.
+ */
+ private Set<Object> keys(int cnt, ThreadLocalRandom rnd) {
+ TreeSet<Object> keys = new TreeSet<>();
+
+ for (int i = 0; i < cnt; i++)
+ keys.add(key(rnd));
+
+ return keys;
+ }
+
+ /**
+ * @param rnd Random generator.
+ * @return Key.
+ */
+ private Object key(ThreadLocalRandom rnd) {
+ return new TestKey(rnd.nextInt(KEYS), rnd);
+ }
+
+ /**
+ * @param rnd Random generator.
+ * @return Value.
+ */
+ private Object value(ThreadLocalRandom rnd) {
+ return new TestData(rnd);
+ }
+
+ /**
+ * @param cacheMode Cache mode.
+ * @param atomicityMode Cache atomicity mode.
+ * @param memoryMode Cache memory mode.
+ * @param evictionPlc Eviction policy.
+ * @param indexing Indexing flag.
+ * @return Cache configuration.
+ */
+ private CacheConfiguration<Object, Object> cacheConfiguration(
+ CacheMode cacheMode,
+ CacheAtomicityMode atomicityMode,
+ CacheMemoryMode memoryMode,
+ @Nullable EvictionPolicy<Object, Object> evictionPlc,
+ boolean indexing) {
+ CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+
+ ccfg.setAtomicityMode(atomicityMode);
+ ccfg.setCacheMode(cacheMode);
+ ccfg.setMemoryMode(memoryMode);
+ ccfg.setWriteSynchronizationMode(FULL_SYNC);
+ ccfg.setAtomicWriteOrderMode(PRIMARY);
+ ccfg.setEvictionPolicy(evictionPlc);
+ ccfg.setOffHeapMaxMemory(0);
+
+ if (cacheMode == PARTITIONED)
+ ccfg.setBackups(1);
+
+ if (indexing)
+ ccfg.setIndexedTypes(TestKey.class, TestData.class);
+
+ return ccfg;
+ }
+
+ /**
+ *
+ */
+ static class TestFilter implements IgniteBiPredicate<Object, Object> {
+ /** {@inheritDoc} */
+ @Override public boolean apply(Object key, Object val) {
+ return ThreadLocalRandom.current().nextInt(10) == 0;
+ }
+ }
+
+ /**
+ *
+ */
+ static class TestKey implements Serializable, Comparable<TestKey> {
+ /** */
+ private int key;
+
+ /** */
+ private byte[] byteVal;
+
+ /** {@inheritDoc} */
+ @Override public int compareTo(TestKey o) {
+ return Integer.compare(key, o.key);
+ }
+
+ /**
+ * @param key Key.
+ * @param rnd Random generator.
+ */
+ public TestKey(int key, ThreadLocalRandom rnd) {
+ this.key = key;
+ byteVal = new byte[rnd.nextInt(100)];
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ TestKey testKey = (TestKey)o;
+
+ return key == testKey.key;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return key;
+ }
+ }
+
+ /**
+ *
+ */
+ static class TestData implements Serializable {
+ /** */
+ @QuerySqlField(index = true)
+ private int val1;
+
+ /** */
+ private long val2;
+
+ /** */
+ @QuerySqlField(index = true)
+ private String val3;
+
+ /** */
+ private byte[] val4;
+
+ /**
+ * @param rnd Random generator.
+ */
+ public TestData(ThreadLocalRandom rnd) {
+ val1 = rnd.nextInt();
+ val2 = val1;
+ val3 = String.valueOf(val1);
+ val4 = new byte[rnd.nextInt(1024)];
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a6b3dedd/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
index cecb8ad..f11c2f8 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
@@ -21,6 +21,7 @@ import junit.framework.TestSuite;
import org.apache.ignite.internal.processors.cache.CacheLocalQueryMetricsSelfTest;
import org.apache.ignite.internal.processors.cache.CachePartitionedQueryMetricsDistributedSelfTest;
import org.apache.ignite.internal.processors.cache.CachePartitionedQueryMetricsLocalSelfTest;
+import org.apache.ignite.internal.processors.cache.CacheQueryOffheapEvictDataLostTest;
import org.apache.ignite.internal.processors.cache.CacheReplicatedQueryMetricsDistributedSelfTest;
import org.apache.ignite.internal.processors.cache.CacheReplicatedQueryMetricsLocalSelfTest;
import org.apache.ignite.internal.processors.cache.CacheScanPartitionQueryFallbackSelfTest;
@@ -224,6 +225,8 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite {
suite.addTestSuite(GridOrderedMessageCancelSelfTest.class);
+ suite.addTestSuite(CacheQueryOffheapEvictDataLostTest.class);
+
// Ignite cache and H2 comparison.
suite.addTestSuite(BaseH2CompareQueryTest.class);
suite.addTestSuite(H2CompareBigQueryTest.class);
http://git-wip-us.apache.org/repos/asf/ignite/blob/a6b3dedd/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
index 550c69f..9ff7520 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
@@ -20,6 +20,7 @@ package org.apache.ignite.testsuites;
import junit.framework.TestSuite;
import org.apache.ignite.internal.processors.cache.CacheConfigurationP2PTest;
import org.apache.ignite.internal.processors.cache.CacheIndexStreamerTest;
+import org.apache.ignite.internal.processors.cache.CacheRandomOperationsMultithreadedTest;
import org.apache.ignite.internal.processors.cache.GridCacheOffHeapAndSwapSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheOffHeapSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheOffheapIndexEntryEvictTest;
@@ -70,6 +71,7 @@ public class IgniteCacheWithIndexingTestSuite extends TestSuite {
suite.addTestSuite(IgniteCacheConfigurationPrimitiveTypesSelfTest.class);
suite.addTestSuite(IgniteClientReconnectQueriesTest.class);
+ suite.addTestSuite(CacheRandomOperationsMultithreadedTest.class);
return suite;
}
[11/11] ignite git commit: Merge remote-tracking branch
'remotes/origin/master' into ignite-2407
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-2407
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b6b7110c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b6b7110c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b6b7110c
Branch: refs/heads/ignite-2407
Commit: b6b7110c920779a0e9bd460d59f547bb8a017f97
Parents: 6c29104 46b6a76
Author: sboikov <sb...@gridgain.com>
Authored: Mon Feb 15 09:03:43 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Feb 15 09:03:43 2016 +0300
----------------------------------------------------------------------
.../ignite/internal/binary/BinaryUtils.java | 4 +-
.../binary/builder/BinaryBuilderSerializer.java | 16 +-
.../binary/builder/BinaryObjectBuilderImpl.java | 12 +-
.../binary/builder/BinaryValueWithType.java | 3 +-
.../processors/cache/GridCacheAdapter.java | 4 +-
.../cache/GridCacheClearAllRunnable.java | 2 +-
.../processors/cache/GridCacheEntryEx.java | 11 +-
.../processors/cache/GridCacheMapEntry.java | 102 ++--
.../processors/cache/GridCacheProcessor.java | 10 +-
.../processors/cache/GridCacheSwapManager.java | 43 +-
.../dht/GridDhtPartitionTopologyImpl.java | 7 +-
.../GridDhtPartitionsExchangeFuture.java | 6 +
.../ignite/spi/discovery/tcp/ServerImpl.java | 5 +
.../TcpDiscoveryCustomEventMessage.java | 10 +-
.../apache/ignite/spi/indexing/IndexingSpi.java | 4 +-
.../internal/GridAffinityNoCacheSelfTest.java | 6 +-
.../BinaryObjectBuilderAdditionalSelfTest.java | 91 +++-
...naryObjectBuilderDefaultMappersSelfTest.java | 30 +-
.../cache/CacheConfigurationLeakTest.java | 62 +++
.../processors/cache/GridCacheTestEntryEx.java | 5 +-
.../GridSessionCheckpointAbstractSelfTest.java | 6 +-
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 2 +-
.../testsuites/IgniteCacheTestSuite2.java | 2 +
.../CacheQueryOffheapEvictDataLostTest.java | 138 +++++
.../CacheRandomOperationsMultithreadedTest.java | 507 +++++++++++++++++++
.../IgniteCacheQuerySelfTestSuite.java | 3 +
.../IgniteCacheWithIndexingTestSuite.java | 2 +
.../Binary/BinaryStructureTest.cs | 38 +-
.../Impl/Binary/BinaryReader.cs | 2 +-
.../yardstick/cache/IgniteInvokeBenchmark.java | 65 +++
.../cache/IgniteInvokeTxBenchmark.java | 30 ++
.../tcp/ipfinder/zk/ZookeeperIpFinderTest.java | 2 +-
32 files changed, 1093 insertions(+), 137 deletions(-)
----------------------------------------------------------------------
[04/11] ignite git commit: IGNITE-2625 .NET: Fixed field offset
calculation in BinaryReader.
Posted by sb...@apache.org.
IGNITE-2625 .NET: Fixed field offset calculation in BinaryReader.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3dce33f5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3dce33f5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3dce33f5
Branch: refs/heads/ignite-2407
Commit: 3dce33f5a007aa15adfc1e79b1ac96e86683e9fb
Parents: 6c4bad1
Author: Pavel Tupitsyn <pt...@gridgain.com>
Authored: Fri Feb 12 16:09:00 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Feb 12 16:09:00 2016 +0300
----------------------------------------------------------------------
.../Binary/BinaryStructureTest.cs | 38 ++++++++++++++------
.../Impl/Binary/BinaryReader.cs | 2 +-
2 files changed, 28 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3dce33f5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryStructureTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryStructureTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryStructureTest.cs
index 78ee8c0..1ab81c5 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryStructureTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryStructureTest.cs
@@ -20,9 +20,11 @@ namespace Apache.Ignite.Core.Tests.Binary
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
+ using System.IO;
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Impl;
using Apache.Ignite.Core.Impl.Binary;
+ using Apache.Ignite.Core.Impl.Binary.IO;
using NUnit.Framework;
/// <summary>
@@ -66,15 +68,29 @@ namespace Apache.Ignite.Core.Tests.Binary
Marshaller marsh = new Marshaller(cfg);
// 3. Marshal all data and ensure deserialized object is fine.
- foreach (BranchedType obj in objs)
+ // Use single stream to test object offsets
+ using (var stream = new BinaryHeapStream(128))
{
- Console.WriteLine(">>> Write object [mode=" + obj.mode + ']');
+ var writer = marsh.StartMarshal(stream);
- byte[] data = marsh.Marshal(obj);
+ foreach (var obj in objs)
+ {
+ Console.WriteLine(">>> Write object [mode=" + obj.mode + ']');
- BranchedType other = marsh.Unmarshal<BranchedType>(data);
+ writer.WriteObject(obj);
- Assert.IsTrue(obj.Equals(other));
+ }
+
+ stream.Seek(0, SeekOrigin.Begin);
+
+ var reader = marsh.StartUnmarshal(stream);
+
+ foreach (var obj in objs)
+ {
+ var other = reader.ReadObject<BranchedType>();
+
+ Assert.IsTrue(obj.Equals(other));
+ }
}
Console.WriteLine();
@@ -206,30 +222,30 @@ namespace Apache.Ignite.Core.Tests.Binary
break;
case 2:
- f2 = reader.ReadInt("f2");
- f3 = reader.ReadInt("f3");
f4 = reader.ReadInt("f4");
+ f3 = reader.ReadInt("f3");
+ f2 = reader.ReadInt("f2");
break;
case 3:
+ f5 = reader.ReadInt("f5");
f2 = reader.ReadInt("f2");
f3 = reader.ReadInt("f3");
- f5 = reader.ReadInt("f5");
break;
case 4:
- f2 = reader.ReadInt("f2");
- f3 = reader.ReadInt("f3");
f5 = reader.ReadInt("f5");
f6 = reader.ReadInt("f6");
+ f2 = reader.ReadInt("f2");
+ f3 = reader.ReadInt("f3");
break;
case 5:
- f2 = reader.ReadInt("f2");
f3 = reader.ReadInt("f3");
+ f2 = reader.ReadInt("f2");
f7 = reader.ReadInt("f7");
break;
http://git-wip-us.apache.org/repos/asf/ignite/blob/3dce33f5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
index 1c5c719..16aae93 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
@@ -938,7 +938,7 @@ namespace Apache.Ignite.Core.Impl.Binary
if (!_curSchemaMap.TryGetValue(fieldId, out pos))
return false;
- Stream.Seek(pos, SeekOrigin.Begin);
+ Stream.Seek(pos + _curPos, SeekOrigin.Begin);
}
return true;
[09/11] ignite git commit: JavaDoc fix
Posted by sb...@apache.org.
JavaDoc fix
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0be55c66
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0be55c66
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0be55c66
Branch: refs/heads/ignite-2407
Commit: 0be55c66f3212f9b638481fb47ba794527ce6250
Parents: befb9de
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Fri Feb 12 14:26:15 2016 -0800
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Fri Feb 12 14:26:15 2016 -0800
----------------------------------------------------------------------
.../main/java/org/apache/ignite/spi/indexing/IndexingSpi.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0be55c66/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingSpi.java
index b9d141e..a3ea33e 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingSpi.java
@@ -45,7 +45,7 @@ import org.jetbrains.annotations.Nullable;
* cfg.setIndexingSpi(spi);
*
* // Starts grid.
- * G.start(cfg);
+ * Ignition.start(cfg);
* </pre>
* Here is an example of how to configure SPI from Spring XML configuration file.
* <pre name="code" class="xml">
@@ -111,4 +111,4 @@ public interface IndexingSpi extends IgniteSpi {
* @throws IgniteSpiException If failed.
*/
public void onUnswap(@Nullable String spaceName, Object key, Object val) throws IgniteSpiException;
-}
\ No newline at end of file
+}