ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [08/50] ignite git commit: WAL history size: code commenting
Date Tue, 20 Jun 2017 06:00:10 GMT
WAL history size: code commenting


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: c8d572fdd724177b4e88c416bc21243a5ee4f733
Parents: f391196
Author: dpavlov <dpavlov@gridgain.com>
Authored: Fri Jun 16 17:58:45 2017 +0300
Committer: dpavlov <dpavlov@gridgain.com>
Committed: Fri Jun 16 17:59:46 2017 +0300

----------------------------------------------------------------------
 .../PersistentStoreConfiguration.java           |  8 ++++----
 .../pagemem/wal/IgniteWriteAheadLogManager.java |  3 ++-
 .../GridCacheDatabaseSharedManager.java         | 10 +++++++---
 .../cache/persistence/wal/FileWALPointer.java   |  4 ++--
 .../wal/FileWriteAheadLogManager.java           | 21 +++++++++++---------
 5 files changed, 27 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c8d572fd/modules/core/src/main/java/org/apache/ignite/configuration/PersistentStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/PersistentStoreConfiguration.java
b/modules/core/src/main/java/org/apache/ignite/configuration/PersistentStoreConfiguration.java
index 86f0bd7..1d41d41 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/PersistentStoreConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/PersistentStoreConfiguration.java
@@ -49,7 +49,7 @@ public class PersistentStoreConfiguration implements Serializable {
     /** Default number of checkpointing threads. */
     public static final int DFLT_CHECKPOINTING_THREADS = 1;
 
-    /** */
+    /** Default number of checkpoints to be kept in WAL after checkpoint is finished */
     public static final int DFLT_WAL_HISTORY_SIZE = 20;
 
     /** */
@@ -97,7 +97,7 @@ public class PersistentStoreConfiguration implements Serializable {
     /** */
     private int checkpointingThreads = DFLT_CHECKPOINTING_THREADS;
 
-    /** */
+    /** Number of checkpoints to keep */
     private int walHistSize = DFLT_WAL_HISTORY_SIZE;
 
     /** Number of work WAL segments. */
@@ -256,7 +256,7 @@ public class PersistentStoreConfiguration implements Serializable {
     /**
      * Gets a total number of checkpoints to keep in the WAL history.
      *
-     * @return Number of WAL segments to keep after a checkpoint is finished.
+     * @return Number of checkpoints to keep in WAL after a checkpoint is finished.
      */
     public int getWalHistorySize() {
         return walHistSize <= 0 ? DFLT_WAL_HISTORY_SIZE : walHistSize;
@@ -265,7 +265,7 @@ public class PersistentStoreConfiguration implements Serializable {
     /**
      * Sets a total number of checkpoints to keep in the WAL history.
      *
-     * @param walHistSize Number of WAL segments to keep after a checkpoint is finished.
+     * @param walHistSize Number of checkpoints to keep after a checkpoint is finished.
      * @return {@code this} for chaining.
      */
     public PersistentStoreConfiguration setWalHistorySize(int walHistSize) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/c8d572fd/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/IgniteWriteAheadLogManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/IgniteWriteAheadLogManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/IgniteWriteAheadLogManager.java
index 187df8d..ce28ff2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/IgniteWriteAheadLogManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/IgniteWriteAheadLogManager.java
@@ -107,7 +107,8 @@ public interface IgniteWriteAheadLogManager extends GridCacheSharedManager,
Igni
     public int walArchiveSegments();
 
     /**
-     * @param ptr Pointer.
+     * Checks if WAL segment is under lock or reserved
+     * @param ptr Pointer to check.
      * @return True if given pointer is located in reserved segment.
      */
     public boolean reserved(WALPointer ptr);

http://git-wip-us.apache.org/repos/asf/ignite/blob/c8d572fd/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 9bc56e7..1a7fc5b 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
@@ -1313,6 +1313,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.
@@ -2587,7 +2588,10 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
      */
     @SuppressWarnings("PublicInnerClass")
     public class CheckpointHistory {
-        /** */
+        /**
+         * Maps checkpoint's timestamp (from CP file name) to CP entry.
+         * Using TS provides historical order of CP entries in map ( first is oldest )
+         */
         private final NavigableMap<Long, CheckpointEntry> histMap = new ConcurrentSkipListMap<>();
 
         /**
@@ -2768,7 +2772,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
         @SuppressWarnings("unused")
         private volatile int initGuard;
 
-        /** Checkpoint ID. Initalized lazily. */
+        /** Checkpoint ID. Initialized lazily. */
         private UUID cpId;
 
         /** Cache states. Initialized lazily. */
@@ -2781,7 +2785,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
          * Lazy entry constructor.
          *
          * @param cpTs Checkpoint timestamp.
-         * @param cpMark Checkpoint WAL mark.
+         * @param cpMark Checkpoint end mark (WAL pointer).
          */
         private CheckpointEntry(long cpTs, WALPointer cpMark) {
             assert cpMark != null;

http://git-wip-us.apache.org/repos/asf/ignite/blob/c8d572fd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWALPointer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWALPointer.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWALPointer.java
index 033b1c4..b6ddfb8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWALPointer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWALPointer.java
@@ -24,7 +24,7 @@ import org.apache.ignite.internal.util.typedef.internal.S;
  * File WAL pointer.
  */
 public class FileWALPointer implements WALPointer, Comparable<FileWALPointer> {
-    /** */
+    /** Absolute WAL segment file index (incrementing counter) */
     private final long idx;
 
     /** */
@@ -37,7 +37,7 @@ public class FileWALPointer implements WALPointer, Comparable<FileWALPointer>
{
     private boolean forceFlush;
 
     /**
-     * @param idx File timestamp index.
+     * @param idx Absolute WAL segment file index (incremental counter)
      * @param fileOffset Offset in file, from the beginning.
      * @param len Record length.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/c8d572fd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
index 4ec1efd..225776d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
@@ -69,6 +69,7 @@ import org.apache.ignite.internal.util.typedef.internal.SB;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.lang.IgnitePredicate;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -512,6 +513,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter
impl
 
         assert ptr instanceof FileWALPointer : ptr;
 
+        // File pointer bound: older entries will be deleted from archive
         FileWALPointer fPtr = (FileWALPointer)ptr;
 
         FileDescriptor[] descs = scan(walArchiveDir.listFiles(WAL_SEGMENT_FILE_FILTER));
@@ -521,7 +523,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter
impl
         FileArchiver archiver0 = archiver;
 
         for (FileDescriptor desc : descs) {
-            // Do not delete reserved segment and any segment after it.
+            // Do not delete reserved or locked segment and any segment after it.
             if (archiver0 != null && archiver0.reserved(desc.idx))
                 return deleted;
 
@@ -738,7 +740,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter
impl
      * Calling this method signals we are done with the segment and it can be archived.
      * If we don't have prepared file yet and achiever is busy this method blocks
      *
-     * @param curIdx current segment released by WAL writer
+     * @param curIdx current absolute segment released by WAL writer
      * @return Initialized file handle.
      * @throws StorageException If IO exception occurred.
      * @throws IgniteCheckedException If failed.
@@ -1014,7 +1016,8 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter
impl
         }
 
         /**
-         * @param absIdx Index for reservation.
+         * Check if WAL segment locked or reserved
+         * @param absIdx Index for check reservation.
          * @return {@code True} if index is reserved.
          */
         private synchronized boolean reserved(long absIdx) {
@@ -1328,10 +1331,10 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter
impl
         }
 
         /**
-         * @param file File.
-         * @param idx Absolute WAL segment file index.
+         * @param file WAL segment file.
+         * @param idx Absolute WAL segment file index. For null value index is restored from
file name
          */
-        private FileDescriptor(File file, Long idx) {
+        private FileDescriptor(@NotNull File file, @Nullable Long idx) {
             this.file = file;
 
             String fileName = file.getName();
@@ -1411,7 +1414,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter
impl
         /** */
         protected FileChannel ch;
 
-        /** */
+        /** Absolute WAL segment file index (incremental counter) */
         protected final long idx;
 
         /** */
@@ -1419,7 +1422,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter
impl
 
         /**
          * @param file File.
-         * @param idx Index.
+         * @param idx Absolute WAL segment file index (incremental counter).
          */
         private FileHandle(RandomAccessFile file, long idx, String gridName) {
             this.file = file;
@@ -1447,7 +1450,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter
impl
 
         /**
          * @param file File to read.
-         * @param idx File index.
+         * @param idx Absolute WAL segment file index (incremental counter).
          * @param ser Entry serializer.
          * @param in File input.
          */


Mime
View raw message