ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [10/15] ignite git commit: IGNITE-5094 - Fix data page eviction for near-enabled caches
Date Thu, 27 Apr 2017 12:57:23 GMT
IGNITE-5094 - Fix data page eviction for near-enabled caches


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c58b8a32
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c58b8a32
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c58b8a32

Branch: refs/heads/ignite-5072-merge
Commit: c58b8a3211f84a1ec1663ba4ed3fae79c432f23e
Parents: c294b27
Author: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Authored: Thu Apr 27 12:37:43 2017 +0300
Committer: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Committed: Thu Apr 27 12:38:07 2017 +0300

----------------------------------------------------------------------
 .../evict/PageAbstractEvictionTracker.java      |  7 ++---
 .../paged/PageEvictionAbstractTest.java         | 13 ++++++++-
 ...LruNearEnabledPageEvictionMultinodeTest.java | 28 ++++++++++++++++++++
 ...LruNearEnabledPageEvictionMultinodeTest.java | 28 ++++++++++++++++++++
 .../IgniteCacheEvictionSelfTestSuite.java       |  4 +++
 5 files changed, 76 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c58b8a32/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/evict/PageAbstractEvictionTracker.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/evict/PageAbstractEvictionTracker.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/evict/PageAbstractEvictionTracker.java
index 88de545..61f62fd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/evict/PageAbstractEvictionTracker.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/evict/PageAbstractEvictionTracker.java
@@ -39,13 +39,13 @@ public abstract class PageAbstractEvictionTracker implements PageEvictionTracker
     private static final int COMPACT_TS_SHIFT = 8; // Enough if grid works for less than
17 years.
 
     /** Millis in day. */
-    private final static int DAY = 24 * 60 * 60 * 1000;
+    private static final int DAY = 24 * 60 * 60 * 1000;
 
     /** Page memory. */
     protected final PageMemory pageMem;
 
     /** Tracking array size. */
-    final int trackingSize;
+    protected final int trackingSize;
 
     /** Base compact timestamp. */
     private final long baseCompactTs;
@@ -161,7 +161,8 @@ public abstract class PageAbstractEvictionTracker implements PageEvictionTracker
             if (!cacheCtx.userCache())
                 continue;
 
-            GridCacheEntryEx entryEx = cacheCtx.cache().entryEx(dataRow.key());
+            GridCacheEntryEx entryEx = cacheCtx.isNear() ? cacheCtx.near().dht().entryEx(dataRow.key())
:
+                cacheCtx.cache().entryEx(dataRow.key());
 
             evictionDone |= entryEx.evictInternal(GridCacheVersionManager.EVICT_VER, null,
true);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/c58b8a32/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionAbstractTest.java
index 3aee941..39927be 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionAbstractTest.java
@@ -25,6 +25,7 @@ import org.apache.ignite.configuration.DataPageEvictionMode;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.configuration.MemoryConfiguration;
 import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.NearCacheConfiguration;
 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;
@@ -70,6 +71,13 @@ public class PageEvictionAbstractTest extends GridCommonAbstractTest {
         return configuration;
     }
 
+    /**
+     * @return Near enabled flag.
+     */
+    protected boolean nearEnabled() {
+        return false;
+    }
+
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception
{
         IgniteConfiguration cfg = super.getConfiguration(gridName);
@@ -102,7 +110,7 @@ public class PageEvictionAbstractTest extends GridCommonAbstractTest {
      * @param memoryPlcName Memory policy name.
      * @return Cache configuration.
      */
-    protected static CacheConfiguration<Object, Object> cacheConfig(
+    protected CacheConfiguration<Object, Object> cacheConfig(
         @NotNull String name,
         String memoryPlcName,
         CacheMode cacheMode,
@@ -120,6 +128,9 @@ public class PageEvictionAbstractTest extends GridCommonAbstractTest {
         if (cacheMode == CacheMode.PARTITIONED)
             cacheConfiguration.setBackups(1);
 
+        if (nearEnabled())
+            cacheConfiguration.setNearConfiguration(new NearCacheConfiguration<>());
+
         return cacheConfiguration;
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/c58b8a32/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/Random2LruNearEnabledPageEvictionMultinodeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/Random2LruNearEnabledPageEvictionMultinodeTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/Random2LruNearEnabledPageEvictionMultinodeTest.java
new file mode 100644
index 0000000..252fc5b
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/Random2LruNearEnabledPageEvictionMultinodeTest.java
@@ -0,0 +1,28 @@
+/*
+ * 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.eviction.paged;
+
+/**
+ *
+ */
+public class Random2LruNearEnabledPageEvictionMultinodeTest extends Random2LruPageEvictionMultinodeTest
{
+    /** {@inheritDoc} */
+    @Override protected boolean nearEnabled() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c58b8a32/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/RandomLruNearEnabledPageEvictionMultinodeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/RandomLruNearEnabledPageEvictionMultinodeTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/RandomLruNearEnabledPageEvictionMultinodeTest.java
new file mode 100644
index 0000000..c9ee647
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/RandomLruNearEnabledPageEvictionMultinodeTest.java
@@ -0,0 +1,28 @@
+/*
+ * 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.eviction.paged;
+
+/**
+ *
+ */
+public class RandomLruNearEnabledPageEvictionMultinodeTest extends RandomLruPageEvictionMultinodeTest
{
+    /** {@inheritDoc} */
+    @Override protected boolean nearEnabled() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c58b8a32/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheEvictionSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheEvictionSelfTestSuite.java
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheEvictionSelfTestSuite.java
index 1bdfdd1..9f03c60 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheEvictionSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheEvictionSelfTestSuite.java
@@ -35,8 +35,10 @@ import org.apache.ignite.internal.processors.cache.eviction.lru.LruNearEvictionP
 import org.apache.ignite.internal.processors.cache.eviction.lru.LruNearOnlyNearEvictionPolicySelfTest;
 import org.apache.ignite.internal.processors.cache.eviction.paged.PageEvictionReadThroughTest;
 import org.apache.ignite.internal.processors.cache.eviction.paged.PageEvictionTouchOrderTest;
+import org.apache.ignite.internal.processors.cache.eviction.paged.Random2LruNearEnabledPageEvictionMultinodeTest;
 import org.apache.ignite.internal.processors.cache.eviction.paged.Random2LruPageEvictionMultinodeTest;
 import org.apache.ignite.internal.processors.cache.eviction.paged.Random2LruPageEvictionWithRebalanceTest;
+import org.apache.ignite.internal.processors.cache.eviction.paged.RandomLruNearEnabledPageEvictionMultinodeTest;
 import org.apache.ignite.internal.processors.cache.eviction.paged.RandomLruPageEvictionMultinodeTest;
 import org.apache.ignite.internal.processors.cache.eviction.paged.RandomLruPageEvictionWithRebalanceTest;
 import org.apache.ignite.internal.processors.cache.eviction.sorted.SortedEvictionPolicySelfTest;
@@ -70,7 +72,9 @@ public class IgniteCacheEvictionSelfTestSuite extends TestSuite {
         suite.addTest(new TestSuite(GridCacheEvictableEntryEqualsSelfTest.class));
 
         suite.addTest(new TestSuite(RandomLruPageEvictionMultinodeTest.class));
+        suite.addTest(new TestSuite(RandomLruNearEnabledPageEvictionMultinodeTest.class));
         suite.addTest(new TestSuite(Random2LruPageEvictionMultinodeTest.class));
+        suite.addTest(new TestSuite(Random2LruNearEnabledPageEvictionMultinodeTest.class));
         suite.addTest(new TestSuite(RandomLruPageEvictionWithRebalanceTest.class));
         suite.addTest(new TestSuite(Random2LruPageEvictionWithRebalanceTest.class));
         suite.addTest(new TestSuite(PageEvictionTouchOrderTest.class));


Mime
View raw message