IGNITE-5479 - Cleanup public API for PersistentStoreConfiguration
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/689b1b6e Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/689b1b6e Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/689b1b6e Branch: refs/heads/ignite-5578-locJoin Commit: 689b1b6e9c3e723cf394c7ff2427097b21d96ce3 Parents: 21964fb Author: Alexey Goncharuk <alexey.goncha...@gmail.com> Authored: Thu Jul 13 10:12:01 2017 +0300 Committer: Alexey Goncharuk <alexey.goncha...@gmail.com> Committed: Thu Jul 13 10:12:01 2017 +0300 ---------------------------------------------------------------------- .../configuration/MemoryConfiguration.java | 4 +- .../MemoryPolicyConfiguration.java | 4 +- .../PersistentStoreConfiguration.java | 61 ++++++++++---------- .../GridCacheDatabaseSharedManager.java | 23 +++++--- .../IgniteCacheDatabaseSharedManager.java | 21 ++++--- .../wal/FileWriteAheadLogManager.java | 6 +- .../utils/PlatformConfigurationUtils.java | 4 +- .../node/VisorPersistentStoreConfiguration.java | 36 ++++++------ .../persistence/db/wal/IgnitePdsWalTlbTest.java | 2 +- .../Cache/PersistentStoreTest.cs | 8 ++- .../Config/spring-test.xml | 4 ++ .../IgniteConfigurationTest.cs | 8 ++- .../PersistentStoreConfiguration.cs | 31 ++++++---- modules/web-console/backend/app/mongo.js | 2 +- .../generator/ConfigurationGenerator.js | 8 +-- .../generator/defaults/Cluster.service.js | 2 +- .../configuration/clusters/persistence.pug | 2 +- 17 files changed, 128 insertions(+), 98 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/689b1b6e/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java index 5cf6cb7..f83d7d0 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java @@ -64,7 +64,7 @@ public class MemoryConfiguration implements Serializable { /** Default memory policy start size (256 MB). */ @SuppressWarnings("UnnecessaryBoxing") - public static final Long DFLT_MEMORY_POLICY_INITIAL_SIZE = new Long(256L * 1024 * 1024); + public static final long DFLT_MEMORY_POLICY_INITIAL_SIZE = 256L * 1024 * 1024; /** Fraction of available memory to allocate for default MemoryPolicy. */ private static final double DFLT_MEMORY_POLICY_FRACTION = 0.8; @@ -222,6 +222,8 @@ public class MemoryConfiguration implements Serializable { if (maxSize < DFLT_MEMORY_POLICY_INITIAL_SIZE) memPlc.setInitialSize(maxSize); + else + memPlc.setInitialSize(DFLT_MEMORY_POLICY_INITIAL_SIZE); memPlc.setMaxSize(maxSize); http://git-wip-us.apache.org/repos/asf/ignite/blob/689b1b6e/modules/core/src/main/java/org/apache/ignite/configuration/MemoryPolicyConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/MemoryPolicyConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/MemoryPolicyConfiguration.java index b496901..dff8b2b 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/MemoryPolicyConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/MemoryPolicyConfiguration.java @@ -78,7 +78,7 @@ public final class MemoryPolicyConfiguration implements Serializable { private String name = DFLT_MEM_PLC_DEFAULT_NAME; /** Memory policy start size. */ - private Long initialSize = MemoryConfiguration.DFLT_MEMORY_POLICY_INITIAL_SIZE; + private long initialSize; /** Memory policy maximum size. */ private long maxSize = MemoryConfiguration.DFLT_MEMORY_POLICY_MAX_SIZE; @@ -172,7 +172,7 @@ public final class MemoryPolicyConfiguration implements Serializable { * * @return Memory policy start size. */ - public Long getInitialSize() { + public long getInitialSize() { return initialSize; } http://git-wip-us.apache.org/repos/asf/ignite/blob/689b1b6e/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..e8a0ff4 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 @@ -44,10 +44,6 @@ public class PersistentStoreConfiguration implements Serializable { /** Default length of interval over which rate-based metric is calculated. */ public static final int DFLT_RATE_TIME_INTERVAL_MILLIS = 60_000; - /** */ - @SuppressWarnings("UnnecessaryBoxing") - public static final Long DFLT_CHECKPOINTING_PAGE_BUFFER_SIZE = new Long(256L * 1024 * 1024); - /** Default number of checkpointing threads. */ public static final int DFLT_CHECKPOINTING_THREADS = 1; @@ -70,7 +66,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,11 +86,11 @@ 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; + private long checkpointingPageBufSize; /** */ private int checkpointingThreads = DFLT_CHECKPOINTING_THREADS; @@ -124,10 +120,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; @@ -200,9 +196,10 @@ public class PersistentStoreConfiguration implements Serializable { /** * Gets amount of memory allocated for a checkpointing temporary buffer. * - * @return checkpointing page buffer size in bytes. + * @return Checkpointing page buffer size in bytes or {@code 0} for Ignite + * to choose the buffer size automatically. */ - public Long getCheckpointingPageBufferSize() { + public long getCheckpointingPageBufferSize() { return checkpointingPageBufSize; } @@ -211,7 +208,8 @@ public class PersistentStoreConfiguration implements Serializable { * copies of pages that are being written to disk and being update in parallel while the checkpointing is in * progress. * - * @param checkpointingPageBufSize checkpointing page buffer size in bytes. + * @param checkpointingPageBufSize Checkpointing page buffer size in bytes or {@code 0} for Ignite to + * choose the buffer size automatically. * @return {@code this} for chaining. */ public PersistentStoreConfiguration setCheckpointingPageBufferSize(long checkpointingPageBufSize) { @@ -243,21 +241,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 +474,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 +498,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/689b1b6e/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 9f2067a..d147f36 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 @@ -151,6 +151,9 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan /** */ public static final String IGNITE_PDS_CHECKPOINT_TEST_SKIP_SYNC = "IGNITE_PDS_CHECKPOINT_TEST_SKIP_SYNC"; + /** Default checkpointing page buffer size (may be adjusted by Ignite). */ + public static final Long DFLT_CHECKPOINTING_PAGE_BUFFER_SIZE = 256L * 1024 * 1024; + /** Skip sync. */ private final boolean skipSync = IgniteSystemProperties.getBoolean(IGNITE_PDS_CHECKPOINT_TEST_SKIP_SYNC); @@ -277,7 +280,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; @@ -375,10 +378,10 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan } /** - * @throws IgniteCheckedException If failed. + * */ - private void initDataBase() throws IgniteCheckedException { - Long cpBufSize = persistenceCfg.getCheckpointingPageBufferSize(); + private void initDataBase() { + long cpBufSize = persistenceCfg.getCheckpointingPageBufferSize(); if (persistenceCfg.getCheckpointingThreads() > 1) asyncRunner = new ThreadPoolExecutor( @@ -391,7 +394,9 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan // Intentionally use identity comparison to check if configuration default has changed. //noinspection NumberEquality - if (cpBufSize == PersistentStoreConfiguration.DFLT_CHECKPOINTING_PAGE_BUFFER_SIZE) { + if (cpBufSize == 0L) { + cpBufSize = DFLT_CHECKPOINTING_PAGE_BUFFER_SIZE; + MemoryConfiguration memCfg = cctx.kernalContext().config().getMemoryConfiguration(); assert memCfg != null; @@ -2928,10 +2933,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(); @@ -2965,7 +2970,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()) { @@ -2989,7 +2994,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/689b1b6e/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 c5f174c..c503fb4 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 @@ -295,15 +295,6 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap } /** - * @param dbCfg Database configuration. - * @param memPlcCfg MemoryPolicy configuration. - * @param memMetrics MemoryMetrics instance. - */ - private MemoryPolicy createDefaultMemoryPolicy(MemoryConfiguration dbCfg, MemoryPolicyConfiguration memPlcCfg, MemoryMetricsImpl memMetrics) { - return initMemory(dbCfg, memPlcCfg, memMetrics); - } - - /** * @param sysCacheInitSize Initial size of PageMemory to be created for system cache. * @param sysCacheMaxSize Maximum size of PageMemory to be created for system cache. * @@ -454,6 +445,14 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap * @throws IgniteCheckedException If config is invalid. */ private void checkPolicySize(MemoryPolicyConfiguration plcCfg) throws IgniteCheckedException { + boolean dfltInitSize = false; + + if (plcCfg.getInitialSize() == 0) { + plcCfg.setInitialSize(DFLT_MEMORY_POLICY_INITIAL_SIZE); + + dfltInitSize = true; + } + if (plcCfg.getInitialSize() < MIN_PAGE_MEMORY_SIZE) throw new IgniteCheckedException("MemoryPolicy must have size more than 10MB (use " + "MemoryPolicyConfiguration.initialSize property to set correct size in bytes) " + @@ -461,8 +460,8 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap ); if (plcCfg.getMaxSize() < plcCfg.getInitialSize()) { - // We will know for sure if initialSize has been changed if we compare Longs by "==". - if (plcCfg.getInitialSize() == DFLT_MEMORY_POLICY_INITIAL_SIZE) { + // If initial size was not set, use the max size. + if (dfltInitSize) { plcCfg.setInitialSize(plcCfg.getMaxSize()); LT.warn(log, "MemoryPolicy maxSize=" + U.readableSize(plcCfg.getMaxSize(), true) + http://git-wip-us.apache.org/repos/asf/ignite/blob/689b1b6e/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/689b1b6e/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 03b30db..8c9f5e1 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 @@ -1499,7 +1499,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()) @@ -1531,7 +1531,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/689b1b6e/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..128f43a 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,10 +39,10 @@ public class VisorPersistentStoreConfiguration extends VisorDataTransferObject { private long checkpointingFreq; /** Lock wait time. */ - private int lockWaitTime; + private long lockWaitTime; /** */ - private Long checkpointingPageBufSize; + private long checkpointingPageBufSize; /** */ private int checkpointingThreads; @@ -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(); @@ -138,7 +138,7 @@ public class VisorPersistentStoreConfiguration extends VisorDataTransferObject { /** * @return Checkpointing page buffer size in bytes. */ - public Long getCheckpointingPageBufferSize() { + public long getCheckpointingPageBufferSize() { return checkpointingPageBufSize; } @@ -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 getWalFsyncDelayNanos() { return walFsyncDelay; } @@ -258,8 +258,8 @@ public class VisorPersistentStoreConfiguration extends VisorDataTransferObject { @Override protected void writeExternalData(ObjectOutput out) throws IOException { U.writeString(out, persistenceStorePath); out.writeLong(checkpointingFreq); - out.writeInt(lockWaitTime); - out.writeObject(checkpointingPageBufSize); + out.writeLong(lockWaitTime); + out.writeLong(checkpointingPageBufSize); out.writeInt(checkpointingThreads); out.writeInt(walHistSize); out.writeInt(walSegments); @@ -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,8 +281,8 @@ 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(); - checkpointingPageBufSize = (Long)in.readObject(); + lockWaitTime = in.readLong(); + checkpointingPageBufSize = in.readLong(); checkpointingThreads = in.readInt(); walHistSize = in.readInt(); walSegments = 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/689b1b6e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgnitePdsWalTlbTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgnitePdsWalTlbTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgnitePdsWalTlbTest.java index a1a7286..fd0fd34 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgnitePdsWalTlbTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgnitePdsWalTlbTest.java @@ -31,7 +31,7 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import static org.apache.ignite.configuration.PersistentStoreConfiguration.DFLT_CHECKPOINTING_PAGE_BUFFER_SIZE; +import static org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager.DFLT_CHECKPOINTING_PAGE_BUFFER_SIZE; /** * http://git-wip-us.apache.org/repos/asf/ignite/blob/689b1b6e/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTest.cs index 3320dd7..d321639 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTest.cs @@ -59,7 +59,8 @@ namespace Apache.Ignite.Core.Tests.Cache PersistentStorePath = Path.Combine(_tempDir, "Store"), WalStorePath = Path.Combine(_tempDir, "WalStore"), WalArchivePath = Path.Combine(_tempDir, "WalArchive"), - MetricsEnabled = true + MetricsEnabled = true, + CheckpointingPageBufferSize = 1024 * 1024 // TODO: Use default (IGNITE-5717) } }; @@ -116,7 +117,10 @@ namespace Apache.Ignite.Core.Tests.Cache { var cfg = new IgniteConfiguration(GetTestConfiguration()) { - PersistentStoreConfiguration = new PersistentStoreConfiguration() + PersistentStoreConfiguration = new PersistentStoreConfiguration + { + CheckpointingPageBufferSize = 1024 * 1024 // TODO: Use default (IGNITE-5717) + } }; using (var ignite = Ignition.Start(cfg)) http://git-wip-us.apache.org/repos/asf/ignite/blob/689b1b6e/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/spring-test.xml ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/spring-test.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/spring-test.xml index dd0669a..31fa3b3 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/spring-test.xml +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/spring-test.xml @@ -56,5 +56,9 @@ </property> </bean> </property> + + <property name="persistentStoreConfiguration"> + <bean class="org.apache.ignite.configuration.PersistentStoreConfiguration"/> + </property> </bean> </beans> http://git-wip-us.apache.org/repos/asf/ignite/blob/689b1b6e/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs index 81fd226..93d6af3 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs @@ -316,6 +316,9 @@ namespace Apache.Ignite.Core.Tests Assert.AreEqual(MemoryPolicyConfiguration.DefaultMaxSize, plc.MaxSize); Assert.AreEqual(MemoryPolicyConfiguration.DefaultSubIntervals, plc.SubIntervals); Assert.AreEqual(MemoryPolicyConfiguration.DefaultRateTimeInterval, plc.RateTimeInterval); + + // Check PersistentStoreConfiguration defaults. + CheckDefaultProperties(resCfg.PersistentStoreConfiguration); } } @@ -532,8 +535,7 @@ namespace Apache.Ignite.Core.Tests Assert.AreEqual(PersistentStoreConfiguration.DefaultTlbSize, cfg.TlbSize); Assert.AreEqual(PersistentStoreConfiguration.DefaultCheckpointingFrequency, cfg.CheckpointingFrequency); Assert.AreEqual(PersistentStoreConfiguration.DefaultCheckpointingThreads, cfg.CheckpointingThreads); - Assert.AreEqual(PersistentStoreConfiguration.DefaultCheckpointingPageBufferSize, - cfg.CheckpointingPageBufferSize); + Assert.AreEqual(default(long), cfg.CheckpointingPageBufferSize); Assert.AreEqual(PersistentStoreConfiguration.DefaultLockWaitTime, cfg.LockWaitTime); Assert.AreEqual(PersistentStoreConfiguration.DefaultWalFlushFrequency, cfg.WalFlushFrequency); Assert.AreEqual(PersistentStoreConfiguration.DefaultWalFsyncDelayNanos, cfg.WalFsyncDelayNanos); @@ -546,6 +548,8 @@ namespace Apache.Ignite.Core.Tests Assert.IsFalse(cfg.MetricsEnabled); Assert.AreEqual(PersistentStoreConfiguration.DefaultSubIntervals, cfg.SubIntervals); Assert.AreEqual(PersistentStoreConfiguration.DefaultRateTimeInterval, cfg.RateTimeInterval); + Assert.AreEqual(PersistentStoreConfiguration.DefaultWalStorePath, cfg.WalStorePath); + Assert.AreEqual(PersistentStoreConfiguration.DefaultWalArchivePath, cfg.WalArchivePath); } /// <summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/689b1b6e/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..cac6cc8 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/PersistentStoreConfiguration.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/PersistentStoreConfiguration.cs @@ -30,11 +30,6 @@ namespace Apache.Ignite.Core.PersistentStore public class PersistentStoreConfiguration { /// <summary> - /// Default value for <see cref="CheckpointingPageBufferSize"/>. - /// </summary> - public const long DefaultCheckpointingPageBufferSize = 256L * 1024 * 1024; - - /// <summary> /// Default value for <see cref="CheckpointingThreads"/>. /// </summary> public const int DefaultCheckpointingThreads = 1; @@ -82,7 +77,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. @@ -97,11 +92,20 @@ namespace Apache.Ignite.Core.PersistentStore public static readonly TimeSpan DefaultRateTimeInterval = TimeSpan.FromSeconds(60); /// <summary> + /// Default value for <see cref="WalStorePath"/>. + /// </summary> + public const string DefaultWalStorePath = "db/wal"; + + /// <summary> + /// Default value for <see cref="WalArchivePath"/>. + /// </summary> + public const string DefaultWalArchivePath = "db/wal/archive"; + + /// <summary> /// Initializes a new instance of the <see cref="PersistentStoreConfiguration"/> class. /// </summary> public PersistentStoreConfiguration() { - CheckpointingPageBufferSize = DefaultCheckpointingPageBufferSize; CheckpointingThreads = DefaultCheckpointingThreads; CheckpointingFrequency = DefaultCheckpointingFrequency; LockWaitTime = DefaultLockWaitTime; @@ -114,6 +118,8 @@ namespace Apache.Ignite.Core.PersistentStore WalFsyncDelayNanos = DefaultWalFsyncDelayNanos; RateTimeInterval = DefaultRateTimeInterval; SubIntervals = DefaultSubIntervals; + WalArchivePath = DefaultWalArchivePath; + WalStorePath = DefaultWalStorePath; } /// <summary> @@ -137,7 +143,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 +172,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); @@ -188,8 +194,9 @@ namespace Apache.Ignite.Core.PersistentStore /// <summary> /// Gets or sets the size of the checkpointing page buffer. + /// <para /> + /// Default is <c>0</c>: Ignite will choose buffer size automatically. /// </summary> - [DefaultValue(DefaultCheckpointingPageBufferSize)] public long CheckpointingPageBufferSize { get; set; } /// <summary> @@ -227,12 +234,14 @@ namespace Apache.Ignite.Core.PersistentStore /// <summary> /// Gets or sets the path to the directory where WAL (Write Ahead Log) is stored. /// </summary> + [DefaultValue(DefaultWalStorePath)] public string WalStorePath { get; set; } /// <summary> /// Gets or sets the path to the directory where WAL (Write Ahead Log) archive is stored. /// Every WAL segment will be fully copied to this directory before it can be reused for WAL purposes. /// </summary> + [DefaultValue(DefaultWalArchivePath)] public string WalArchivePath { get; set; } /// <summary> @@ -256,7 +265,7 @@ namespace Apache.Ignite.Core.PersistentStore /// Gets or sets the WAL (Write Ahead Log) fsync (disk sync) delay, in nanoseconds /// </summary> [DefaultValue(DefaultWalFsyncDelayNanos)] - public int WalFsyncDelayNanos { get; set; } + public long WalFsyncDelayNanos { get; set; } /// <summary> /// Gets or sets the size of the WAL (Write Ahead Log) record iterator buffer, in bytes. http://git-wip-us.apache.org/repos/asf/ignite/blob/689b1b6e/modules/web-console/backend/app/mongo.js ---------------------------------------------------------------------- diff --git a/modules/web-console/backend/app/mongo.js b/modules/web-console/backend/app/mongo.js index aa11e0b..57af928 100644 --- a/modules/web-console/backend/app/mongo.js +++ b/modules/web-console/backend/app/mongo.js @@ -1006,7 +1006,7 @@ module.exports.factory = function(passportMongo, settings, pluginMongo, mongoose walSegmentSize: Number, walHistorySize: Number, walFlushFrequency: Number, - walFsyncDelay: Number, + walFsyncDelayNanos: Number, walRecordIteratorBufferSize: Number, lockWaitTime: Number, rateTimeInterval: Number, http://git-wip-us.apache.org/repos/asf/ignite/blob/689b1b6e/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js index 8c9b14c..8299b9b 100644 --- a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js +++ b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js @@ -1477,17 +1477,17 @@ export default class IgniteConfigurationGenerator { .boolProperty('metricsEnabled') .boolProperty('alwaysWriteFullPages') .intProperty('checkpointingFrequency') - .intProperty('checkpointingPageBufferSize') + .longProperty('checkpointingPageBufferSize') .intProperty('checkpointingThreads') .stringProperty('walStorePath') .stringProperty('walArchivePath') .intProperty('walSegments') .intProperty('walSegmentSize') .intProperty('walHistorySize') - .intProperty('walFlushFrequency') - .intProperty('walFsyncDelay') + .longProperty('walFlushFrequency') + .longProperty('walFsyncDelayNanos') .intProperty('walRecordIteratorBufferSize') - .intProperty('lockWaitTime') + .longProperty('lockWaitTime') .intProperty('rateTimeInterval') .intProperty('tlbSize') .intProperty('subIntervals'); http://git-wip-us.apache.org/repos/asf/ignite/blob/689b1b6e/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js index a4680bf..1c7fc44 100644 --- a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js +++ b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js @@ -340,7 +340,7 @@ const DFLT_CLUSTER = { walSegmentSize: 67108864, walHistorySize: 20, walFlushFrequency: 2000, - walFsyncDelay: 1, + walFsyncDelayNanos: 1000, walRecordIteratorBufferSize: 67108864, lockWaitTime: 10000, rateTimeInterval: 60000, http://git-wip-us.apache.org/repos/asf/ignite/blob/689b1b6e/modules/web-console/frontend/app/modules/states/configuration/clusters/persistence.pug ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/persistence.pug b/modules/web-console/frontend/app/modules/states/configuration/clusters/persistence.pug index 7fd0966..50a569b 100644 --- a/modules/web-console/frontend/app/modules/states/configuration/clusters/persistence.pug +++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/persistence.pug @@ -62,7 +62,7 @@ include /app/helpers/jade/mixins +number('WAL flush frequency:', `${model}.walFlushFrequency`, '"PersistenceWalFlushFrequency"', enabled, '2000', '1', 'How often will be fsync, in milliseconds. In background mode, exist thread which do fsync by timeout') .settings-row - +number('WAL fsync delay:', `${model}.walFsyncDelay`, '"PersistenceWalFsyncDelay"', enabled, '1', '1', 'WAL fsync delay, in nanoseconds') + +number('WAL fsync delay:', `${model}.walFsyncDelayNanos`, '"PersistenceWalFsyncDelay"', enabled, '1000', '1', 'WAL fsync delay, in nanoseconds') .settings-row +number('WAL record iterator buffer size:', `${model}.walRecordIteratorBufferSize`, '"PersistenceWalRecordIteratorBufferSize"', enabled, '67108864', '1', 'How many bytes iterator read from disk(for one reading), during go ahead WAL')