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/12 08:05:05 UTC
[1/5] ignite git commit: Fix R# analysis warnings
Repository: ignite
Updated Branches:
refs/heads/ignite-2586 9d5656724 -> b09455776
Fix R# analysis warnings
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/877be93e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/877be93e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/877be93e
Branch: refs/heads/ignite-2586
Commit: 877be93ee35afddcc126a147cfd3cd1dda4a46ce
Parents: 0491a5f
Author: Pavel Tupitsyn <pt...@gridgain.com>
Authored: Thu Feb 11 16:31:28 2016 +0300
Committer: Pavel Tupitsyn <pt...@gridgain.com>
Committed: Thu Feb 11 16:31:28 2016 +0300
----------------------------------------------------------------------
.../Impl/Common/IgniteConfigurationXmlSerializer.cs | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/877be93e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs
index af25bfa..c27012a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs
@@ -23,7 +23,6 @@ namespace Apache.Ignite.Core.Impl.Common
using System.ComponentModel;
using System.Configuration;
using System.Diagnostics;
- using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using System.Xml;
@@ -99,14 +98,13 @@ namespace Apache.Ignite.Core.Impl.Common
/// <summary>
/// Writes the property of a basic type (primitives, strings, types).
/// </summary>
- [SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
private static void WriteBasicProperty(object obj, XmlWriter writer, Type valueType, PropertyInfo property)
{
var converter = GetConverter(property, valueType);
var stringValue = converter.ConvertToInvariantString(obj);
- writer.WriteString(stringValue);
+ writer.WriteString(stringValue ?? "");
}
/// <summary>
@@ -125,7 +123,6 @@ namespace Apache.Ignite.Core.Impl.Common
/// <summary>
/// Writes the complex property (nested object).
/// </summary>
- [SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
private static void WriteComplexProperty(object obj, XmlWriter writer, Type valueType)
{
var props = GetNonDefaultProperties(obj).ToList();
@@ -139,7 +136,7 @@ namespace Apache.Ignite.Core.Impl.Common
{
var converter = GetConverter(prop, prop.PropertyType);
var stringValue = converter.ConvertToInvariantString(prop.GetValue(obj, null));
- writer.WriteAttributeString(PropertyNameToXmlName(prop.Name), stringValue);
+ writer.WriteAttributeString(PropertyNameToXmlName(prop.Name), stringValue ?? "");
}
// Write elements
[2/5] ignite git commit: IGNITE-2555
Posted by sb...@apache.org.
IGNITE-2555
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/35b0e6bf
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/35b0e6bf
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/35b0e6bf
Branch: refs/heads/ignite-2586
Commit: 35b0e6bf149bb86a3eefefcbc657c822e25681f3
Parents: 877be93
Author: ruskim <ru...@gmail.com>
Authored: Thu Feb 11 18:53:50 2016 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Thu Feb 11 18:53:50 2016 +0300
----------------------------------------------------------------------
.../apache/ignite/internal/IgniteKernal.java | 14 ++-
.../internal/GridNodeMetricsLogSelfTest.java | 98 ++++++++++++++++++++
.../ignite/testsuites/IgniteBasicTestSuite.java | 2 +
3 files changed, 113 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/35b0e6bf/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index e3017ff..5d8daf6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -989,6 +989,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
double avgCpuLoadPct = m.getAverageCpuLoad() * 100;
double gcPct = m.getCurrentGcCpuLoad() * 100;
+ //Heap params
long heapUsed = m.getHeapMemoryUsed();
long heapMax = m.getHeapMemoryMaximum();
@@ -997,6 +998,15 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
double freeHeapPct = heapMax > 0 ? ((double)((heapMax - heapUsed) * 100)) / heapMax : -1;
+ //Non heap params
+ long nonHeapUsed = m.getNonHeapMemoryUsed();
+ long nonHeapMax = m.getNonHeapMemoryMaximum();
+
+ long nonHeapUsedInMBytes = nonHeapUsed / 1024 / 1024;
+ long nonHeapCommInMBytes = m.getNonHeapMemoryCommitted() / 1024 / 1024;
+
+ double freeNonHeapPct = nonHeapMax > 0 ? ((double)((nonHeapMax - nonHeapUsed) * 100)) / nonHeapMax : -1;
+
int hosts = 0;
int nodes = 0;
int cpus = 0;
@@ -1046,12 +1056,14 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
String msg = NL +
"Metrics for local node (to disable set 'metricsLogFrequency' to 0)" + NL +
- " ^-- Node [id=" + id + ", name=" + name() + "]" + NL +
+ " ^-- Node [id=" + id + ", name=" + name() + ", uptime=" + getUpTimeFormatted() + "]" + NL +
" ^-- H/N/C [hosts=" + hosts + ", nodes=" + nodes + ", CPUs=" + cpus + "]" + NL +
" ^-- CPU [cur=" + dblFmt.format(cpuLoadPct) + "%, avg=" +
dblFmt.format(avgCpuLoadPct) + "%, GC=" + dblFmt.format(gcPct) + "%]" + NL +
" ^-- Heap [used=" + dblFmt.format(heapUsedInMBytes) + "MB, free=" +
dblFmt.format(freeHeapPct) + "%, comm=" + dblFmt.format(heapCommInMBytes) + "MB]" + NL +
+ " ^-- Non heap [used=" + dblFmt.format(nonHeapUsedInMBytes) + "MB, free=" +
+ dblFmt.format(freeNonHeapPct) + "%, comm=" + dblFmt.format(nonHeapCommInMBytes) + "MB]" + NL +
" ^-- Public thread pool [active=" + pubPoolActiveThreads + ", idle=" +
pubPoolIdleThreads + ", qSize=" + pubPoolQSize + "]" + NL +
" ^-- System thread pool [active=" + sysPoolActiveThreads + ", idle=" +
http://git-wip-us.apache.org/repos/asf/ignite/blob/35b0e6bf/modules/core/src/test/java/org/apache/ignite/internal/GridNodeMetricsLogSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridNodeMetricsLogSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridNodeMetricsLogSelfTest.java
new file mode 100644
index 0000000..fe5922e
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridNodeMetricsLogSelfTest.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal;
+
+
+import java.io.StringWriter;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.testframework.junits.common.GridCommonTest;
+import org.apache.log4j.Layout;
+import org.apache.log4j.Logger;
+import org.apache.log4j.SimpleLayout;
+import org.apache.log4j.WriterAppender;
+
+/**
+ * Check logging local node metrics
+ */
+@SuppressWarnings({"ProhibitedExceptionDeclared"})
+@GridCommonTest(group = "Kernal")
+public class GridNodeMetricsLogSelfTest extends GridCommonAbstractTest {
+ /** */
+
+ public GridNodeMetricsLogSelfTest() {
+ super(false);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"unchecked"})
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ cfg.setMetricsLogFrequency(1000);
+
+ return cfg;
+ }
+
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testNodeMetricsLog() throws Exception {
+ // Log to string, to check log content
+ Layout layout = new SimpleLayout();
+
+ StringWriter strWr = new StringWriter();
+
+ WriterAppender app = new WriterAppender(layout, strWr);
+
+ Logger.getRootLogger().addAppender(app);
+
+ Ignite g1 = startGrid(1);
+
+ IgniteCache<Integer, String> cache1 = g1.createCache("TestCache1");
+
+ cache1.put(1, "one");
+
+ Ignite g2 = startGrid(2);
+
+ IgniteCache<Integer, String> cache2 = g2.createCache("TestCache2");
+
+ cache2.put(2, "two");
+
+ Thread.sleep(10000);
+
+ //Check that nodes are alie
+ assert cache1.get(1).equals("one");
+ assert cache2.get(2).equals("two");
+
+ String fullLog = strWr.toString();
+
+ Logger.getRootLogger().removeAppender(app);
+
+ assert fullLog.contains("Metrics for local node");
+ assert fullLog.contains("uptime=");
+ assert fullLog.contains("Non heap");
+ assert fullLog.contains("Outbound messages queue");
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/35b0e6bf/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
index c904ef4..3903910 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
@@ -25,6 +25,7 @@ import org.apache.ignite.internal.ClusterGroupSelfTest;
import org.apache.ignite.internal.GridFailFastNodeFailureDetectionSelfTest;
import org.apache.ignite.internal.GridLifecycleAwareSelfTest;
import org.apache.ignite.internal.GridLifecycleBeanSelfTest;
+import org.apache.ignite.internal.GridNodeMetricsLogSelfTest;
import org.apache.ignite.internal.GridProjectionForCachesSelfTest;
import org.apache.ignite.internal.GridReduceSelfTest;
import org.apache.ignite.internal.GridReleaseTypeSelfTest;
@@ -114,6 +115,7 @@ public class IgniteBasicTestSuite extends TestSuite {
suite.addTestSuite(IgniteSlowClientDetectionSelfTest.class);
GridTestUtils.addTestIfNeeded(suite, IgniteDaemonNodeMarshallerCacheTest.class, ignoredTests);
suite.addTestSuite(IgniteMarshallerCacheConcurrentReadWriteTest.class);
+ suite.addTestSuite(GridNodeMetricsLogSelfTest.class);
suite.addTestSuite(IgniteExceptionInNioWorkerSelfTest.class);
[3/5] ignite git commit: ignite-2615
Posted by sb...@apache.org.
ignite-2615
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9a354283
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9a354283
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9a354283
Branch: refs/heads/ignite-2586
Commit: 9a3542834e8c4cf3248c4f84939961123d8bc838
Parents: 9d56567
Author: sboikov <sb...@gridgain.com>
Authored: Fri Feb 12 09:13:40 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Feb 12 09:13:40 2016 +0300
----------------------------------------------------------------------
.../CacheQueryOffheapEvictDataLostTest.java | 138 +++++++++++++++++++
1 file changed, 138 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/9a354283/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;
+ }
+ }
+}
[5/5] ignite git commit: ignite-2586 If swap is not enabled need pass
value evicted from offheap to query manager
Posted by sb...@apache.org.
ignite-2586 If swap is not enabled need pass value evicted from offheap to query manager
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b0945577
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b0945577
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b0945577
Branch: refs/heads/ignite-2586
Commit: b094557765cb284f089647c680d77878215da939
Parents: 84de111
Author: sboikov <sb...@gridgain.com>
Authored: Fri Feb 12 10:04:25 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Feb 12 10:04:25 2016 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheEntryEx.java | 7 +++-
.../processors/cache/GridCacheMapEntry.java | 12 ++++--
.../processors/cache/GridCacheProcessor.java | 4 +-
.../processors/cache/GridCacheSwapManager.java | 43 +++++++++++++-------
.../processors/cache/GridCacheTestEntryEx.java | 2 +-
.../IgniteCacheQuerySelfTestSuite.java | 3 ++
6 files changed, 48 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b0945577/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 953c301..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
@@ -920,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.
@@ -929,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/b0945577/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 1c8fa53..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;
http://git-wip-us.apache.org/repos/asf/ignite/blob/b0945577/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 5acad6c..a45c2e0 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/b0945577/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 37b5e15..08fe5a0 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
@@ -39,6 +39,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;
@@ -105,8 +106,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<>();
@@ -140,7 +141,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
*
*/
public void unwindOffheapEvicts() {
- if (!offheapToSwapEvicts)
+ if (!unwindOffheapEvicts)
return;
Collection<IgniteBiTuple<byte[], byte[]>> evicts = offheapEvicts.get();
@@ -161,7 +162,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;
@@ -198,12 +199,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();
@@ -1075,7 +1076,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;
@@ -1095,13 +1096,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;
@@ -2141,6 +2143,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.
*/
@@ -2191,9 +2206,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} */
@@ -2499,9 +2514,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/b0945577/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 e983c7e..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
@@ -849,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/b0945577/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 3cd4579..ceed4aa 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;
@@ -222,6 +223,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);
[4/5] ignite git commit: Merge remote-tracking branch
'remotes/origin/master' into ignite-2586
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-2586
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/84de1111
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/84de1111
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/84de1111
Branch: refs/heads/ignite-2586
Commit: 84de1111c08ade200e4514e06ff305412e686afb
Parents: 9a35428 35b0e6b
Author: sboikov <sb...@gridgain.com>
Authored: Fri Feb 12 09:14:04 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Feb 12 09:14:04 2016 +0300
----------------------------------------------------------------------
.../apache/ignite/internal/IgniteKernal.java | 14 ++-
.../internal/GridNodeMetricsLogSelfTest.java | 98 ++++++++++++++++++++
.../ignite/testsuites/IgniteBasicTestSuite.java | 2 +
.../Common/IgniteConfigurationXmlSerializer.cs | 7 +-
4 files changed, 115 insertions(+), 6 deletions(-)
----------------------------------------------------------------------