ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [5/9] ignite git commit: IGNITE-6115: Ignore page eviction mode if Ignite persistence is enabled. - Fixes #2523.
Date Thu, 31 Aug 2017 09:10:27 GMT
IGNITE-6115: Ignore page eviction mode if Ignite persistence is enabled. - Fixes #2523.

Signed-off-by: shroman <rshtykh@yahoo.com>


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

Branch: refs/heads/ignite-3478
Commit: f9be391856ceff2268249fccbfd3c5ca0132378e
Parents: eae6e3b
Author: shroman <rshtykh@yahoo.com>
Authored: Thu Aug 31 12:15:09 2017 +0900
Committer: shroman <rshtykh@yahoo.com>
Committed: Thu Aug 31 12:15:09 2017 +0900

----------------------------------------------------------------------
 .../GridCacheDatabaseSharedManager.java         | 31 ++++++++++++--------
 .../IgniteCacheDatabaseSharedManager.java       |  2 +-
 .../db/file/IgnitePdsEvictionTest.java          |  3 +-
 3 files changed, 21 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f9be3918/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
index b4502d2..c59cccc 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
@@ -478,6 +478,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
 
     /**
      * Try to register Metrics MBean.
+     *
      * @throws IgniteCheckedException If failed.
      */
     private void registrateMetricsMBean() throws IgniteCheckedException {
@@ -535,15 +536,16 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
                 }
 
                 if (totalSize == 0)
-                    return (float) 0;
+                    return (float)0;
 
-                return (float) loadSize / totalSize;
+                return (float)loadSize / totalSize;
             }
         };
     }
 
     /** {@inheritDoc} */
-    @Override public void readCheckpointAndRestoreMemory(List<DynamicCacheDescriptor>
cachesToStart) throws IgniteCheckedException {
+    @Override public void readCheckpointAndRestoreMemory(
+        List<DynamicCacheDescriptor> cachesToStart) throws IgniteCheckedException {
         checkpointReadLock();
 
         try {
@@ -688,7 +690,8 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
     @Override protected void checkPolicyEvictionProperties(MemoryPolicyConfiguration plcCfg,
MemoryConfiguration dbCfg)
         throws IgniteCheckedException {
         if (plcCfg.getPageEvictionMode() != DataPageEvictionMode.DISABLED)
-            throw new IgniteCheckedException("Page eviction is not compatible with persistence:
" + plcCfg.getName());
+            U.warn(log, "Page eviction mode for [" + plcCfg.getName() + "] memory region
is ignored " +
+                "because Ignite Native Persistence is enabled");
     }
 
     /**
@@ -858,7 +861,8 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
     }
 
     /**
-     * Gets the checkpoint read lock. While this lock is held, checkpoint thread will not
acquiSnapshotWorkerre memory state.
+     * Gets the checkpoint read lock. While this lock is held, checkpoint thread will not
acquiSnapshotWorkerre memory
+     * state.
      */
     @SuppressWarnings("LockAcquiredButNotSafelyReleased")
     @Override public void checkpointReadLock() {
@@ -909,7 +913,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
             return true;
 
         for (MemoryPolicy memPlc : memPlcs) {
-            PageMemoryEx pageMemEx = (PageMemoryEx) memPlc.pageMemory();
+            PageMemoryEx pageMemEx = (PageMemoryEx)memPlc.pageMemory();
 
             if (!pageMemEx.safeToUpdate())
                 return false;
@@ -1302,6 +1306,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
 
     /**
      * Loads WAL pointer from CP file
+     *
      * @param cpMarkerFile Checkpoint mark file.
      * @return WAL pointer.
      * @throws IgniteCheckedException If failed to read mark file.
@@ -1706,7 +1711,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
         List<IgniteBiTuple<PageMemory, Collection<FullPageId>>> cpEntities
= new ArrayList<>(memPolicies.size());
 
         for (MemoryPolicy memPlc : memPolicies) {
-            PageMemoryEx pageMem = (PageMemoryEx) memPlc.pageMemory();
+            PageMemoryEx pageMem = (PageMemoryEx)memPlc.pageMemory();
             cpEntities.add(new IgniteBiTuple<PageMemory, Collection<FullPageId>>(pageMem,
                 (pageMem).beginCheckpoint()));
         }
@@ -1719,7 +1724,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
         int cpPagesCnt = 0;
 
         for (IgniteBiTuple<PageMemory, Collection<FullPageId>> e : cpEntities)
{
-            PageMemoryEx pageMem = (PageMemoryEx) e.get1();
+            PageMemoryEx pageMem = (PageMemoryEx)e.get1();
 
             Collection<FullPageId> cpPages = e.get2();
 
@@ -2251,7 +2256,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
                 if (printCheckpointStats) {
                     if (log.isInfoEnabled())
                         LT.info(log, String.format("Skipping checkpoint (no pages were modified)
[" +
-                            "checkpointLockWait=%dms, checkpointLockHoldTime=%dms, reason='%s']",
+                                "checkpointLockWait=%dms, checkpointLockHoldTime=%dms, reason='%s']",
                             tracker.lockWaitDuration(),
                             tracker.lockHoldDuration(),
                             curr.reason));
@@ -2290,7 +2295,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
             int pagesNum = 0;
 
             for (MemoryPolicy memPlc : memoryPolicies()) {
-                GridMultiCollectionWrapper<FullPageId> nextCpPagesCol = ((PageMemoryEx)
memPlc.pageMemory()).beginCheckpoint();
+                GridMultiCollectionWrapper<FullPageId> nextCpPagesCol = ((PageMemoryEx)memPlc.pageMemory()).beginCheckpoint();
 
                 pagesNum += nextCpPagesCol.size();
 
@@ -2403,7 +2408,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
         /** */
         private CheckpointMetricsTracker tracker;
 
-        /** Collection of page IDs to write under this task. Overall pages to write may be
greater than this collection*/
+        /** Collection of page IDs to write under this task. Overall pages to write may be
greater than this collection */
         private Collection<FullPageId> writePageIds;
 
         /** */
@@ -2415,11 +2420,12 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
         /** Counter for all written pages. May be shared between several workers */
         private AtomicInteger writtenPagesCntr;
 
-        /** Total pages to write, counter may be greater than {@link #writePageIds} size*/
+        /** Total pages to write, counter may be greater than {@link #writePageIds} size
*/
         private final int totalPagesToWrite;
 
         /**
          * Creates task for write pages
+         *
          * @param tracker
          * @param writePageIds Collection of page IDs to write.
          * @param updStores
@@ -2810,7 +2816,6 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
         }
 
         /**
-         *
          * @param cacheId Cache ID.
          * @param partId Partition ID.
          * @return Reserved counter or null if couldn't reserve.

http://git-wip-us.apache.org/repos/asf/ignite/blob/f9be3918/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
index 69feac8..37e0108 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
@@ -901,7 +901,7 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
      * @param pageMem Page memory.
      */
     private PageEvictionTracker createPageEvictionTracker(MemoryPolicyConfiguration plc,
PageMemory pageMem) {
-        if (plc.getPageEvictionMode() == DataPageEvictionMode.DISABLED)
+        if (plc.getPageEvictionMode() == DataPageEvictionMode.DISABLED || cctx.gridConfig().isPersistentStoreEnabled())
             return new NoOpPageEvictionTracker();
 
         assert pageMem instanceof PageMemoryNoStoreImpl : pageMem.getClass();

http://git-wip-us.apache.org/repos/asf/ignite/blob/f9be3918/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsEvictionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsEvictionTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsEvictionTest.java
index d7790c3..8544cf1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsEvictionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsEvictionTest.java
@@ -23,6 +23,7 @@ import java.util.List;
 import java.util.concurrent.Callable;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataPageEvictionMode;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.configuration.MemoryConfiguration;
 import org.apache.ignite.configuration.MemoryPolicyConfiguration;
@@ -84,6 +85,7 @@ public class IgnitePdsEvictionTest extends GridCommonAbstractTest {
         MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
         memPlcCfg.setInitialSize(MEMORY_LIMIT);
         memPlcCfg.setMaxSize(MEMORY_LIMIT);
+        memPlcCfg.setPageEvictionMode(DataPageEvictionMode.RANDOM_LRU);
         memPlcCfg.setName("dfltMemPlc");
 
         memCfg.setPageSize(PAGE_SIZE);
@@ -94,7 +96,6 @@ public class IgnitePdsEvictionTest extends GridCommonAbstractTest {
         return memCfg;
     }
 
-
     /** {@inheritDoc} */
     @Override protected void beforeTestsStarted() throws Exception {
         super.beforeTestsStarted();


Mime
View raw message