ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [08/11] ignite git commit: IGNITE-5545: fix for Ignite PDS1: ignitePdsCheckpointSimulationTest 2 tests failed, code commenting
Date Wed, 21 Jun 2017 10:26:08 GMT
IGNITE-5545: fix for Ignite PDS1: ignitePdsCheckpointSimulationTest 2 tests failed, code commenting


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: 3aca39ea31d7496bed3a4088ab9a8b8eb6905695
Parents: 9a05260
Author: dpavlov <dpavlov@gridgain.com>
Authored: Tue Jun 20 18:17:45 2017 +0300
Committer: dpavlov <dpavlov@gridgain.com>
Committed: Tue Jun 20 18:17:45 2017 +0300

----------------------------------------------------------------------
 .../pagemem/wal/record/CheckpointRecord.java    | 26 ++++++---
 .../internal/pagemem/wal/record/WALRecord.java  |  2 +-
 .../GridCacheDatabaseSharedManager.java         |  8 ++-
 ...gnitePdsRecoveryAfterFileCorruptionTest.java |  4 +-
 ...ckpointSimulationWithRealCpDisabledTest.java | 61 ++------------------
 5 files changed, 30 insertions(+), 71 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3aca39ea/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/CheckpointRecord.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/CheckpointRecord.java
b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/CheckpointRecord.java
index 6337f99..807bb83 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/CheckpointRecord.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/CheckpointRecord.java
@@ -23,15 +23,16 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
+import org.jetbrains.annotations.Nullable;
 
 /**
- *
+ * Checkpoint (begin) record
  */
 public class CheckpointRecord extends WALRecord {
     /** Checkpoint ID. */
     private UUID cpId;
 
-    /** todo ?, always false */
+    /** always false */
     private boolean end;
 
     /** */
@@ -42,18 +43,27 @@ public class CheckpointRecord extends WALRecord {
 
     /**
      * @param cpMark Checkpoint mark.
-     * @param end Checkpoint end flag - deprecated todo ?, always false
      */
-    public CheckpointRecord(WALPointer cpMark, boolean end) {
-        this(UUID.randomUUID(), cpMark, end);
+    public CheckpointRecord(@Nullable WALPointer cpMark) {
+        this(UUID.randomUUID(), cpMark);
+    }
+
+    /**
+     * @param cpId Checkpoint ID.
+     * @param cpMark Checkpoint mark.
+     */
+    public CheckpointRecord(UUID cpId, @Nullable WALPointer cpMark) {
+        this.cpId = cpId;
+        this.cpMark = cpMark;
     }
 
     /**
+     * Constructor kept for serializer
      * @param cpId Checkpoint ID.
      * @param cpMark Checkpoint mark.
-     * @param end Checkpoint end flag - deprecated todo ?, always false
+     * @param end Checkpoint end flag - deprecated expected to be always false
      */
-    public CheckpointRecord(UUID cpId, WALPointer cpMark, boolean end) {
+    public CheckpointRecord(UUID cpId, @Nullable WALPointer cpMark, boolean end) {
         this.cpId = cpId;
         this.end = end;
         this.cpMark = cpMark;
@@ -97,7 +107,7 @@ public class CheckpointRecord extends WALRecord {
     }
 
     /**
-     * @return Checkpoint end flag.
+     * @return Checkpoint end flag, now always false
      */
     public boolean end() {
         return end;

http://git-wip-us.apache.org/repos/asf/ignite/blob/3aca39ea/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/WALRecord.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/WALRecord.java
b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/WALRecord.java
index c97f8f0..678e1fa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/WALRecord.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/WALRecord.java
@@ -38,7 +38,7 @@ public abstract class WALRecord {
         /** */
         DATA_RECORD,
 
-        /** */
+        /** Checkpoint (begin) record */
         CHECKPOINT_RECORD,
 
         /** */

http://git-wip-us.apache.org/repos/asf/ignite/blob/3aca39ea/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 008bf9e..88e37e7 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
@@ -246,7 +246,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
     /** */
     private FilePageStoreManager storeMgr;
 
-    /** */
+    /** Checkpoint metadata directory ("cp"), contains files with checkpoint start and end
*/
     private File cpDir;
 
     /** */
@@ -2109,7 +2109,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
          */
         @SuppressWarnings("TooBroadScope")
         private Checkpoint markCheckpointBegin(CheckpointMetricsTracker tracker) throws IgniteCheckedException
{
-            CheckpointRecord cpRec = new CheckpointRecord(null, false);
+            CheckpointRecord cpRec = new CheckpointRecord(null);
 
             WALPointer cpPtr = null;
 
@@ -2581,7 +2581,9 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
     }
 
     /**
-     * Checkpoint history.
+     * Checkpoint history. Holds chronological ordered map with {@link CheckpointEntry}s.
+     * Data is loaded from corresponding checkpoint directory.
+     * This directory holds files for checkpoint start and end.
      */
     @SuppressWarnings("PublicInnerClass")
     public class CheckpointHistory {

http://git-wip-us.apache.org/repos/asf/ignite/blob/3aca39ea/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRecoveryAfterFileCorruptionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRecoveryAfterFileCorruptionTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRecoveryAfterFileCorruptionTest.java
index 68aadca..6847482 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRecoveryAfterFileCorruptionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRecoveryAfterFileCorruptionTest.java
@@ -244,7 +244,7 @@ public class IgnitePdsRecoveryAfterFileCorruptionTest extends GridCommonAbstract
         final int cacheId, FullPageId[] pages
     ) throws Exception {
         // Mark the start position.
-        CheckpointRecord cpRec = new CheckpointRecord(null, false);
+        CheckpointRecord cpRec = new CheckpointRecord(null);
 
         WALPointer start = wal.log(cpRec);
 
@@ -338,7 +338,7 @@ public class IgnitePdsRecoveryAfterFileCorruptionTest extends GridCommonAbstract
             info("Finished checkpoint");
         }
 
-        wal.fsync(wal.log(new CheckpointRecord(null, false)));
+        wal.fsync(wal.log(new CheckpointRecord(null)));
 
         for (FullPageId fullId : pages) {
             long page = mem.acquirePage(fullId.cacheId(), fullId.pageId());

http://git-wip-us.apache.org/repos/asf/ignite/blob/3aca39ea/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimulationWithRealCpDisabledTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimulationWithRealCpDisabledTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimulationWithRealCpDisabledTest.java
index 035693a..e70c56e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimulationWithRealCpDisabledTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimulationWithRealCpDisabledTest.java
@@ -94,11 +94,6 @@ public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends
GridCom
     /** Cache name. */
     private static final String cacheName = "cache";
 
-    /**
-     * toggle flag, inline if CP end record is not possible
-     */
-    private static final boolean cpEndRecord = false;
-
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception
{
         IgniteConfiguration cfg = super.getConfiguration(gridName);
@@ -221,7 +216,7 @@ public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends
GridCom
 
         IgniteWriteAheadLogManager wal = shared.wal();
 
-        WALPointer start = wal.log(new CheckpointRecord(null, false));
+        WALPointer start = wal.log(new CheckpointRecord(null));
 
         final FullPageId[] initWrites = new FullPageId[10];
 
@@ -335,20 +330,13 @@ public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends
GridCom
 
         UUID cpId = UUID.randomUUID();
 
-        WALPointer start = wal.log(new CheckpointRecord(cpId, null, false));
+        WALPointer start = wal.log(new CheckpointRecord(cpId, null));
 
         wal.fsync(start);
 
         for (DataEntry entry : entries)
             wal.log(new DataRecord(entry));
 
-        WALPointer end;
-        if (cpEndRecord) {
-            end = wal.log(new CheckpointRecord(cpId, start, true));
-
-            wal.fsync(end);
-        }
-
         // Data will not be written to the page store.
         stopAllGrids();
 
@@ -408,23 +396,6 @@ public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends
GridCom
 
                 idx++;
             }
-
-
-
-            if(cpEndRecord) {
-                IgniteBiTuple<WALPointer, WALRecord> tup = it.nextX();
-                WALRecord walRecord = tup.get2();
-                boolean exp = walRecord instanceof CheckpointRecord;
-                assert exp : walRecord;
-
-                assertEquals(end, tup.get1());
-
-                cpRec = (CheckpointRecord)tup.get2();
-
-                assertEquals(cpId, cpRec.checkpointId());
-                assertEquals(start, cpRec.checkpointMark());
-                assertTrue(cpRec.end());
-            }
         }
     }
 
@@ -462,7 +433,7 @@ public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends
GridCom
 
         UUID cpId = UUID.randomUUID();
 
-        WALPointer start = wal.log(new CheckpointRecord(cpId, null, false));
+        WALPointer start = wal.log(new CheckpointRecord(cpId, null));
 
         wal.fsync(start);
 
@@ -476,13 +447,6 @@ public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends
GridCom
             ig.context().cache().context().database().checkpointReadUnlock();
         }
 
-        WALPointer end;
-        if(cpEndRecord) {
-            end = wal.log(new CheckpointRecord(cpId, start, true));
-
-            wal.fsync(end);
-        }
-
         // Data will not be written to the page store.
         stopAllGrids();
 
@@ -532,20 +496,6 @@ public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends
GridCom
 
                 idx++;
             }
-
-            if(cpEndRecord) {
-                tup = it.nextX();
-
-                assert tup.get2() instanceof CheckpointRecord;
-
-                assertEquals(end, tup.get1());
-
-                cpRec = (CheckpointRecord)tup.get2();
-
-                assertEquals(cpId, cpRec.checkpointId());
-                assertEquals(start, cpRec.checkpointMark());
-                assertTrue(cpRec.end());
-            }
         }
     }
 
@@ -802,7 +752,7 @@ public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends
GridCom
         final ReadWriteLock updLock = new ReentrantReadWriteLock();
 
         // Mark the start position.
-        CheckpointRecord cpRec = new CheckpointRecord(null, false);
+        CheckpointRecord cpRec = new CheckpointRecord(null);
 
         WALPointer start = wal.log(cpRec);
 
@@ -1004,9 +954,6 @@ public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends
GridCom
 
         updFut.get();
 
-        // Mark the end.
-        wal.fsync(wal.log(new CheckpointRecord(cpRec.checkpointId(), start, true)));
-
         assertEquals(0, mem.activePagesCount());
 
         for (FullPageId fullId : pages) {


Mime
View raw message