Repository: ignite
Updated Branches:
  refs/heads/ignite-5479 [created] 727df1871


IGNITE-5479 - PersistentStoreConfiguration improvements


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

Branch: refs/heads/ignite-5479
Commit: b3df5117a4cf764e6ccf8f23bd072df427f9bfbc
Parents: c52d2bf
Author: Alexey Goncharuk <alexey.goncha...@gmail.com>
Authored: Mon Jul 10 16:33:12 2017 +0300
Committer: Alexey Goncharuk <alexey.goncha...@gmail.com>
Committed: Mon Jul 10 16:33:12 2017 +0300

----------------------------------------------------------------------
 .../PersistentStoreConfiguration.java           | 47 +++++++++++---------
 .../GridCacheDatabaseSharedManager.java         | 10 ++---
 .../wal/FileWriteAheadLogManager.java           |  6 +--
 .../utils/PlatformConfigurationUtils.java       |  4 +-
 .../node/VisorPersistentStoreConfiguration.java | 28 ++++++------
 .../PersistentStoreConfiguration.cs             |  6 +--
 6 files changed, 53 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b3df5117/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 4792483..1d4e2ec 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
@@ -70,7 +70,7 @@ public class PersistentStoreConfiguration implements 
Serializable {
     public static final int DFLT_WAL_FLUSH_FREQ = 2000;
 
     /** Default wal fsync delay. */
-    public static final int DFLT_WAL_FSYNC_DELAY = 1;
+    public static final int DFLT_WAL_FSYNC_DELAY = 1000;
 
     /** Default wal record iterator buffer size. */
     public static final int DFLT_WAL_RECORD_ITERATOR_BUFFER_SIZE = 64 * 1024 * 
1024;
@@ -90,8 +90,8 @@ public class PersistentStoreConfiguration implements 
Serializable {
     /** Checkpointing frequency. */
     private long checkpointingFreq = DFLT_CHECKPOINTING_FREQ;
 
-    /** Lock wait time. */
-    private int lockWaitTime = DFLT_LOCK_WAIT_TIME;
+    /** Lock wait time, in milliseconds. */
+    private long lockWaitTime = DFLT_LOCK_WAIT_TIME;
 
     /** */
     private Long checkpointingPageBufSize = 
DFLT_CHECKPOINTING_PAGE_BUFFER_SIZE;
@@ -124,10 +124,10 @@ public class PersistentStoreConfiguration implements 
Serializable {
     private int tlbSize = DFLT_TLB_SIZE;
 
     /** Wal flush frequency in milliseconds. */
-    private int walFlushFreq = DFLT_WAL_FLUSH_FREQ;
+    private long walFlushFreq = DFLT_WAL_FLUSH_FREQ;
 
     /** Wal fsync delay. */
-    private int walFsyncDelay = DFLT_WAL_FSYNC_DELAY;
+    private long walFsyncDelay = DFLT_WAL_FSYNC_DELAY;
 
     /** Wal record iterator buffer size. */
     private int walRecordIterBuffSize = DFLT_WAL_RECORD_ITERATOR_BUFFER_SIZE;
@@ -243,21 +243,23 @@ public class PersistentStoreConfiguration implements 
Serializable {
     }
 
     /**
-     * Time out in second, while wait and try get file lock for start persist 
manager.
+     * Time out in milliseonds to wait when acquiring persistence store lock 
file before failing the
+     * local node.
      *
-     * @return Time for wait.
+     * @return Lock wait time in milliseconds.
      */
-    public int getLockWaitTime() {
+    public long getLockWaitTime() {
         return lockWaitTime;
     }
 
     /**
-     * Time out in milliseconds, while wait and try get file lock for start 
persist manager.
+     * Time out in milliseconds  to wait when acquiring persistence store lock 
file before failing the
+     * local node.
      *
-     * @param lockWaitTime Lock wait time.
+     * @param lockWaitTime Lock wait time in milliseconds.
      * @return {@code this} for chaining.
      */
-    public PersistentStoreConfiguration setLockWaitTime(int lockWaitTime) {
+    public PersistentStoreConfiguration setLockWaitTime(long lockWaitTime) {
         this.lockWaitTime = lockWaitTime;
 
         return this;
@@ -474,19 +476,22 @@ public class PersistentStoreConfiguration implements 
Serializable {
     }
 
     /**
-     *  Property define how often will be fsync, in milliseconds.
-     *  In background mode, exist thread which do fsync by timeout.
+     *  This property define how often WAL will be fsync-ed in {@code 
BACKGROUND} mode. Ignored for
+     *  all other WAL modes.
      *
-     * @return Flush frequency.
+     * @return WAL flush frequency, in milliseconds.
      */
-    public int getWalFlushFrequency() {
+    public long getWalFlushFrequency() {
         return walFlushFreq;
     }
 
     /**
-     * @param walFlushFreq Wal flush frequency, in milliseconds.
+     *  This property define how often WAL will be fsync-ed in {@code 
BACKGROUND} mode. Ignored for
+     *  all other WAL modes.
+     *
+     * @param walFlushFreq WAL flush frequency, in milliseconds.
      */
-    public PersistentStoreConfiguration setWalFlushFrequency(int walFlushFreq) 
{
+    public PersistentStoreConfiguration setWalFlushFrequency(long 
walFlushFreq) {
         this.walFlushFreq = walFlushFreq;
 
         return this;
@@ -495,15 +500,15 @@ public class PersistentStoreConfiguration implements 
Serializable {
     /**
      * Gets the fsync delay, in nanoseconds.
      */
-    public int getWalFsyncDelay() {
+    public long getWalFsyncDelayNanos() {
         return walFsyncDelay <= 0 ? DFLT_WAL_FSYNC_DELAY : walFsyncDelay;
     }
 
     /**
-     * @param walFsyncDelay Wal fsync delay, in nanoseconds.
+     * @param walFsyncDelayNanos Wal fsync delay, in nanoseconds.
      */
-    public PersistentStoreConfiguration setWalFsyncDelay(int walFsyncDelay) {
-        this.walFsyncDelay = walFsyncDelay;
+    public PersistentStoreConfiguration setWalFsyncDelayNanos(long 
walFsyncDelayNanos) {
+        walFsyncDelay = walFsyncDelayNanos;
 
         return this;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/b3df5117/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 5136731..cf395a0 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
@@ -276,7 +276,7 @@ public class GridCacheDatabaseSharedManager extends 
IgniteCacheDatabaseSharedMan
     private FileLockHolder fileLockHolder;
 
     /** Lock wait time. */
-    private final int lockWaitTime;
+    private final long lockWaitTime;
 
     /** */
     private Map<Integer, Map<Integer, T2<Long, WALPointer>>> 
reservedForExchange;
@@ -2903,10 +2903,10 @@ public class GridCacheDatabaseSharedManager extends 
IgniteCacheDatabaseSharedMan
         }
 
         /**
-         * @param lockWaitTime During which time thread will try capture file 
lock.
+         * @param lockWaitTimeMillis During which time thread will try capture 
file lock.
          * @throws IgniteCheckedException If failed to capture file lock.
          */
-        public void tryLock(int lockWaitTime) throws IgniteCheckedException {
+        public void tryLock(long lockWaitTimeMillis) throws 
IgniteCheckedException {
             assert lockFile != null;
 
             FileChannel ch = lockFile.getChannel();
@@ -2940,7 +2940,7 @@ public class GridCacheDatabaseSharedManager extends 
IgniteCacheDatabaseSharedMan
                 String content = null;
 
                 // Try to get lock, if not available wait 1 sec and re-try.
-                for (int i = 0; i < lockWaitTime; i += 1000) {
+                for (int i = 0; i < lockWaitTimeMillis; i += 1000) {
                     try {
                         lock = ch.tryLock(0, 1, false);
                         if (lock != null && lock.isValid()) {
@@ -2964,7 +2964,7 @@ public class GridCacheDatabaseSharedManager extends 
IgniteCacheDatabaseSharedMan
                 if (content == null)
                     content = readContent();
 
-                failMsg = "Failed to acquire file lock during " + 
(lockWaitTime / 1000) +
+                failMsg = "Failed to acquire file lock during " + 
(lockWaitTimeMillis / 1000) +
                     " sec, (locked by " + content + "): " + 
file.getAbsolutePath();
             }
             catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/b3df5117/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 5c112fb..897f903 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
@@ -124,7 +124,7 @@ public class FileWriteAheadLogManager extends 
GridCacheSharedManagerAdapter impl
     private final int tlbSize;
 
     /** WAL flush frequency. Makes sense only for {@link WALMode#BACKGROUND} 
log WALMode. */
-    private final int flushFreq;
+    private final long flushFreq;
 
     /** Fsync delay. */
     private final long fsyncDelay;
@@ -229,7 +229,7 @@ public class FileWriteAheadLogManager extends 
GridCacheSharedManagerAdapter impl
         mode = psCfg.getWalMode();
         tlbSize = psCfg.getTlbSize();
         flushFreq = psCfg.getWalFlushFrequency();
-        fsyncDelay = psCfg.getWalFsyncDelay();
+        fsyncDelay = psCfg.getWalFsyncDelayNanos();
         alwaysWriteFullPages = psCfg.isAlwaysWriteFullPages();
         ioFactory = psCfg.getFileIOFactory();
         walAutoArchiveAfterInactivity = 
psCfg.getWalAutoArchiveAfterInactivity();
@@ -1666,7 +1666,7 @@ public class FileWriteAheadLogManager extends 
GridCacheSharedManagerAdapter impl
         /** Condition activated each time writeBuffer() completes. Used to 
wait previously flushed write to complete */
         private final Condition writeComplete = lock.newCondition();
 
-        /** Condition for timed wait of several threads, see {@link 
PersistentStoreConfiguration#getWalFsyncDelay()} */
+        /** Condition for timed wait of several threads, see {@link 
PersistentStoreConfiguration#getWalFsyncDelayNanos()} */
         private final Condition fsync = lock.newCondition();
 
         /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/b3df5117/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
index d513071..53d5d3b 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
@@ -1503,7 +1503,7 @@ public class PlatformConfigurationUtils {
                 .setWalMode(WALMode.fromOrdinal(in.readInt()))
                 .setTlbSize(in.readInt())
                 .setWalFlushFrequency((int) in.readLong())
-                .setWalFsyncDelay(in.readInt())
+                .setWalFsyncDelayNanos(in.readLong())
                 .setWalRecordIteratorBufferSize(in.readInt())
                 .setAlwaysWriteFullPages(in.readBoolean())
                 .setMetricsEnabled(in.readBoolean())
@@ -1535,7 +1535,7 @@ public class PlatformConfigurationUtils {
             w.writeInt(cfg.getWalMode().ordinal());
             w.writeInt(cfg.getTlbSize());
             w.writeLong(cfg.getWalFlushFrequency());
-            w.writeInt(cfg.getWalFsyncDelay());
+            w.writeLong(cfg.getWalFsyncDelayNanos());
             w.writeInt(cfg.getWalRecordIteratorBufferSize());
             w.writeBoolean(cfg.isAlwaysWriteFullPages());
             w.writeBoolean(cfg.isMetricsEnabled());

http://git-wip-us.apache.org/repos/asf/ignite/blob/b3df5117/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistentStoreConfiguration.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistentStoreConfiguration.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistentStoreConfiguration.java
index 3559845..5b973ed 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistentStoreConfiguration.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistentStoreConfiguration.java
@@ -39,7 +39,7 @@ public class VisorPersistentStoreConfiguration extends 
VisorDataTransferObject {
     private long checkpointingFreq;
 
     /** Lock wait time. */
-    private int lockWaitTime;
+    private long lockWaitTime;
 
     /** */
     private Long checkpointingPageBufSize;
@@ -72,10 +72,10 @@ public class VisorPersistentStoreConfiguration extends 
VisorDataTransferObject {
     private int tlbSize;
 
     /** Wal flush frequency. */
-    private int walFlushFreq;
+    private long walFlushFreq;
 
-    /** Wal fsync delay. */
-    private int walFsyncDelay;
+    /** Wal fsync delay in nanoseconds. */
+    private long walFsyncDelay;
 
     /** Wal record iterator buffer size. */
     private int walRecordIterBuffSize;
@@ -114,7 +114,7 @@ public class VisorPersistentStoreConfiguration extends 
VisorDataTransferObject {
         walMode = cfg.getWalMode();
         tlbSize = cfg.getTlbSize();
         walFlushFreq = cfg.getWalFlushFrequency();
-        walFsyncDelay = cfg.getWalFsyncDelay();
+        walFsyncDelay = cfg.getWalFsyncDelayNanos();
         walRecordIterBuffSize = cfg.getWalRecordIteratorBufferSize();
         alwaysWriteFullPages = cfg.isAlwaysWriteFullPages();
         subIntervals = cfg.getSubIntervals();
@@ -152,7 +152,7 @@ public class VisorPersistentStoreConfiguration extends 
VisorDataTransferObject {
     /**
      * @return Time for wait.
      */
-    public int getLockWaitTime() {
+    public long getLockWaitTime() {
         return lockWaitTime;
     }
 
@@ -229,14 +229,14 @@ public class VisorPersistentStoreConfiguration extends 
VisorDataTransferObject {
     /**
      * @return Flush frequency.
      */
-    public int getWalFlushFrequency() {
+    public long getWalFlushFrequency() {
         return walFlushFreq;
     }
 
     /**
      * Gets the fsync delay, in nanoseconds.
      */
-    public int getWalFsyncDelay() {
+    public long getWalFsyncDelay() {
         return walFsyncDelay;
     }
 
@@ -258,7 +258,7 @@ public class VisorPersistentStoreConfiguration extends 
VisorDataTransferObject {
     @Override protected void writeExternalData(ObjectOutput out) throws 
IOException {
         U.writeString(out, persistenceStorePath);
         out.writeLong(checkpointingFreq);
-        out.writeInt(lockWaitTime);
+        out.writeLong(lockWaitTime);
         out.writeObject(checkpointingPageBufSize);
         out.writeInt(checkpointingThreads);
         out.writeInt(walHistSize);
@@ -269,8 +269,8 @@ public class VisorPersistentStoreConfiguration extends 
VisorDataTransferObject {
         out.writeBoolean(metricsEnabled);
         U.writeEnum(out, walMode);
         out.writeInt(tlbSize);
-        out.writeInt(walFlushFreq);
-        out.writeInt(walFsyncDelay);
+        out.writeLong(walFlushFreq);
+        out.writeLong(walFsyncDelay);
         out.writeInt(walRecordIterBuffSize);
         out.writeBoolean(alwaysWriteFullPages);
         out.writeInt(subIntervals);
@@ -281,7 +281,7 @@ public class VisorPersistentStoreConfiguration extends 
VisorDataTransferObject {
     @Override protected void readExternalData(byte protoVer, ObjectInput in) 
throws IOException, ClassNotFoundException {
         persistenceStorePath = U.readString(in);
         checkpointingFreq = in.readLong();
-        lockWaitTime = in.readInt();
+        lockWaitTime = in.readLong();
         checkpointingPageBufSize = (Long)in.readObject();
         checkpointingThreads = in.readInt();
         walHistSize = in.readInt();
@@ -292,8 +292,8 @@ public class VisorPersistentStoreConfiguration extends 
VisorDataTransferObject {
         metricsEnabled = in.readBoolean();
         walMode = WALMode.fromOrdinal(in.readByte());
         tlbSize = in.readInt();
-        walFlushFreq = in.readInt();
-        walFsyncDelay = in.readInt();
+        walFlushFreq = in.readLong();
+        walFsyncDelay = in.readLong();
         walRecordIterBuffSize = in.readInt();
         alwaysWriteFullPages = in.readBoolean();
         subIntervals = in.readInt();

http://git-wip-us.apache.org/repos/asf/ignite/blob/b3df5117/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/PersistentStoreConfiguration.cs
----------------------------------------------------------------------
diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/PersistentStoreConfiguration.cs
 
b/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/PersistentStoreConfiguration.cs
index 43b17ac..3fc22d6 100644
--- 
a/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/PersistentStoreConfiguration.cs
+++ 
b/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/PersistentStoreConfiguration.cs
@@ -82,7 +82,7 @@ namespace Apache.Ignite.Core.PersistentStore
         /// <summary>
         /// Default value for <see cref="WalFsyncDelayNanos"/>.
         /// </summary>
-        public const int DefaultWalFsyncDelayNanos = 1;
+        public const long DefaultWalFsyncDelayNanos = 1000;
 
         /// <summary>
         /// The default sub intervals.
@@ -137,7 +137,7 @@ namespace Apache.Ignite.Core.PersistentStore
             WalMode = (WalMode)reader.ReadInt();
             TlbSize = reader.ReadInt();
             WalFlushFrequency = reader.ReadLongAsTimespan();
-            WalFsyncDelayNanos = reader.ReadInt();
+            WalFsyncDelayNanos = reader.ReadLong();
             WalRecordIteratorBufferSize = reader.ReadInt();
             AlwaysWriteFullPages = reader.ReadBoolean();
             MetricsEnabled = reader.ReadBoolean();
@@ -166,7 +166,7 @@ namespace Apache.Ignite.Core.PersistentStore
             writer.WriteInt((int)WalMode);
             writer.WriteInt(TlbSize);
             writer.WriteTimeSpanAsLong(WalFlushFrequency);
-            writer.WriteInt(WalFsyncDelayNanos);
+            writer.WriteLong(WalFsyncDelayNanos);
             writer.WriteInt(WalRecordIteratorBufferSize);
             writer.WriteBoolean(AlwaysWriteFullPages);
             writer.WriteBoolean(MetricsEnabled);

Reply via email to