From 92cd9edae54c441ed2295bb682662ab15e597ee1 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Thu, 12 Feb 2026 23:40:19 +0300 Subject: [PATCH] IGNITE-27832 Remove MemoryConfiguration, PersistentStoreConfiguration --- .../FoldersReuseCompatibilityTest.java | 19 +- .../PersistenceBasicCompatibilityTest.java | 5 +- .../java/org/apache/ignite/MemoryMetrics.java | 10 +- .../configuration/IgniteConfiguration.java | 72 -- .../configuration/MemoryConfiguration.java | 318 -------- .../MemoryPolicyConfiguration.java | 391 ---------- .../PersistentStoreConfiguration.java | 690 ------------------ .../apache/ignite/internal/IgniteKernal.java | 23 +- .../ignite/internal/IgniteNodeAttributes.java | 4 - .../apache/ignite/internal/IgnitionEx.java | 129 ---- .../cache/ValidationOnNodeJoinUtils.java | 13 - .../GridCacheDatabaseSharedManager.java | 2 +- .../utils/PlatformConfigurationUtils.java | 170 ----- .../IgniteMarshallerCacheFSRestoreTest.java | 10 +- ...teTopologyValidatorGridSplitCacheTest.java | 8 +- .../MemoryPolicyConfigValidationTest.java | 407 ----------- .../MemoryPolicyInitializationTest.java | 324 -------- .../testsuites/IgniteCacheTestSuite2.java | 4 - .../Cache/CacheConfigurationTest.cs | 26 - .../Cache/MemoryMetricsTest.cs | 159 ---- .../Cache/PersistentStoreTestObsolete.cs | 186 ----- .../Config/full-config.xml | 11 - .../IgniteConfigurationSerializerTest.cs | 105 --- .../IgniteConfigurationTest.cs | 34 - .../Cache/Configuration/CacheConfiguration.cs | 12 - .../Configuration/DataPageEvictionMode.cs | 62 -- .../Configuration/MemoryConfiguration.cs | 178 ----- .../MemoryPolicyConfiguration.cs | 200 ----- .../Configuration/DataStorageConfiguration.cs | 2 +- .../dotnet/Apache.Ignite.Core/IIgnite.cs | 22 - .../Apache.Ignite.Core/IgniteConfiguration.cs | 58 -- .../IgniteConfigurationSection.xsd | 209 ------ .../PersistentStoreConfiguration.cs | 335 --------- 33 files changed, 29 insertions(+), 4169 deletions(-) delete mode 100644 modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/configuration/MemoryPolicyConfiguration.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/configuration/PersistentStoreConfiguration.java delete mode 100644 modules/core/src/test/java/org/apache/ignite/internal/processors/cache/MemoryPolicyConfigValidationTest.java delete mode 100644 modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicyInitializationTest.java delete mode 100644 modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/MemoryMetricsTest.cs delete mode 100644 modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTestObsolete.cs delete mode 100644 modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/DataPageEvictionMode.cs delete mode 100644 modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryConfiguration.cs delete mode 100644 modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryPolicyConfiguration.cs delete mode 100644 modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/PersistentStoreConfiguration.cs diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/FoldersReuseCompatibilityTest.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/FoldersReuseCompatibilityTest.java index 0d1ea6a7584bc..90679334d6cb7 100644 --- a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/FoldersReuseCompatibilityTest.java +++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/FoldersReuseCompatibilityTest.java @@ -25,10 +25,9 @@ import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; import org.apache.ignite.compatibility.testframework.junits.SkipTestIfIsJdkNewer; +import org.apache.ignite.configuration.DataRegionConfiguration; +import org.apache.ignite.configuration.DataStorageConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.configuration.MemoryConfiguration; -import org.apache.ignite.configuration.MemoryPolicyConfiguration; -import org.apache.ignite.configuration.PersistentStoreConfiguration; import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.processors.cache.GridCacheAbstractFullApiSelfTest; import org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree; @@ -174,16 +173,10 @@ private static class ConfigurationClosure implements IgniteInClosure - * Since there are can be several memory regions configured with {@link MemoryPolicyConfiguration} on an individual + * Since there are can be several data regions configured with {@link DataRegionConfiguration} on an individual * Apache Ignite node, the metrics for every region will be collected and obtained separately. *

* There are two ways to get the metrics of an Apache Ignite node. @@ -43,7 +43,7 @@ *

* Memory metrics collection is not a free operation and might affect performance of an application. This is the reason * why the metrics are turned off by default. To enable the collection you can use both - * {@link MemoryPolicyConfiguration#setMetricsEnabled(boolean)} configuration property. + * {@link DataStorageConfiguration#setMetricsEnabled(boolean)} configuration property. * * @deprecated Check the {@link ReadOnlyMetricRegistry} with "name=io.dataregion.{data_region_name}" instead. */ diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java index 8909b3d6fad3e..c767e193730ef 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java @@ -535,14 +535,6 @@ public class IgniteConfiguration { /** Custom executor configurations. */ private ExecutorConfiguration[] execCfgs; - /** Page memory configuration. */ - @Deprecated - private MemoryConfiguration memCfg; - - /** Persistence store configuration. */ - @Deprecated - private PersistentStoreConfiguration pstCfg; - /** Page memory configuration. */ private DataStorageConfiguration dsCfg; @@ -651,8 +643,6 @@ public IgniteConfiguration(IgniteConfiguration cfg) { binaryCfg = cfg.getBinaryConfiguration(); clusterStateOnStart = cfg.getClusterStateOnStart(); dsCfg = cfg.getDataStorageConfiguration(); - memCfg = cfg.getMemoryConfiguration(); - pstCfg = cfg.getPersistentStoreConfiguration(); cacheCfg = cfg.getCacheConfiguration(); cacheKeyCfg = cfg.getCacheKeyConfiguration(); cacheSanityCheckEnabled = cfg.isCacheSanityCheckEnabled(); @@ -2634,68 +2624,6 @@ public IgniteConfiguration setDataStorageConfiguration(DataStorageConfiguration return this; } - /** - * Gets page memory configuration. - * - * @return Memory configuration. - * @deprecated Use {@link DataStorageConfiguration} instead. - */ - @Deprecated - public MemoryConfiguration getMemoryConfiguration() { - return memCfg; - } - - /** - * Sets page memory configuration. - * - * @param memCfg Memory configuration. - * @return {@code this} for chaining. - * @deprecated Use {@link DataStorageConfiguration} instead. - */ - @Deprecated - public IgniteConfiguration setMemoryConfiguration(MemoryConfiguration memCfg) { - this.memCfg = memCfg; - - return this; - } - - /** - * Gets persistence configuration used by Apache Ignite Persistent Store. - * - * @return Persistence configuration. - * - * @deprecated Part of old API. Use {@link DataStorageConfiguration} for configuring persistence instead. - */ - @Deprecated - public PersistentStoreConfiguration getPersistentStoreConfiguration() { - return pstCfg; - } - - /** - * @return Flag {@code true} if persistence is enabled, {@code false} if disabled. - * - * @deprecated Part of legacy configuration API. Doesn't work if new configuration API is used. - */ - @Deprecated - public boolean isPersistentStoreEnabled() { - return pstCfg != null; - } - - /** - * Sets persistence configuration activating Apache Ignite Persistent Store. - * - * @param pstCfg Persistence configuration. - * @return {@code this} for chaining. - * - * @deprecated Part of old API. Use {@link DataStorageConfiguration} for configuring persistence instead. - */ - @Deprecated - public IgniteConfiguration setPersistentStoreConfiguration(PersistentStoreConfiguration pstCfg) { - this.pstCfg = pstCfg; - - return this; - } - /** * Gets flag indicating whether the cluster will be active on start. If cluster is not active on start, * there will be no cache partition map exchanges performed until the cluster is activated. This should 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 deleted file mode 100644 index 8d9ffbed35add..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.configuration; - -import java.io.Serializable; -import org.apache.ignite.internal.util.typedef.internal.A; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.util.typedef.internal.U; - -/** - * A page memory configuration for an Apache Ignite node. The page memory is a manageable off-heap based memory - * architecture that divides all expandable memory regions into pages of fixed size - * (see {@link MemoryConfiguration#getPageSize()}. An individual page can store one or many cache key-value entries - * that allows reusing the memory in the most efficient way and avoid memory fragmentation issues. - *

- * By default, the page memory allocates a single expandable memory region using settings of - * {@link MemoryConfiguration#createDefaultPolicyConfig()}. All the caches that will be configured in an application - * will be mapped to this memory region by default, thus, all the cache data will reside in that memory region. - *

- * If initial size of the default memory region doesn't satisfy requirements or it's required to have multiple memory - * regions with different properties then {@link MemoryPolicyConfiguration} can be used for both scenarios. - * For instance, using memory policies you can define memory regions of different maximum size, eviction policies, - * swapping options, etc. Once you define a new memory region you can bind particular Ignite caches to it. - *

- * To learn more about memory policies refer to {@link MemoryPolicyConfiguration} documentation. - *

Sample configuration below shows how to make 5 GB memory regions the default one for Apache Ignite:

- *
- *     {@code
- *     
- *         
- *             
- *             
- *
- *             
- *                 
- *                     
- *                         
- *                         
- *                     
- *                 
- *             
- *         
- *     
- *     }
- * 
- * - * @deprecated Use {@link DataStorageConfiguration} instead. - */ -@Deprecated -public class MemoryConfiguration implements Serializable { - /** */ - private static final long serialVersionUID = 0L; - - /** Default memory policy start size (256 MB). */ - public static final long DFLT_MEMORY_POLICY_INITIAL_SIZE = 256L * 1024 * 1024; - - /** Fraction of available memory to allocate for default DataRegion. */ - private static final double DFLT_MEMORY_POLICY_FRACTION = 0.2; - - /** Default memory policy's size is 20% of physical memory available on current machine. */ - public static final long DFLT_MEMORY_POLICY_MAX_SIZE = Math.max( - (long)(DFLT_MEMORY_POLICY_FRACTION * U.getTotalMemoryAvailable()), - DFLT_MEMORY_POLICY_INITIAL_SIZE); - - /** Default initial size of a memory chunk for the system cache (40 MB). */ - private static final long DFLT_SYS_CACHE_INIT_SIZE = 40L * 1024 * 1024; - - /** Default max size of a memory chunk for the system cache (100 MB). */ - private static final long DFLT_SYS_CACHE_MAX_SIZE = 100L * 1024 * 1024; - - /** Default memory page size. */ - public static final int DFLT_PAGE_SIZE = 4 * 1024; - - /** This name is assigned to default DataRegion if no user-defined default MemPlc is specified */ - public static final String DFLT_MEM_PLC_DEFAULT_NAME = "default"; - - /** Size of a memory chunk reserved for system cache initially. */ - private long sysCacheInitSize = DFLT_SYS_CACHE_INIT_SIZE; - - /** Maximum size of system cache. */ - private long sysCacheMaxSize = DFLT_SYS_CACHE_MAX_SIZE; - - /** Memory page size. */ - private int pageSize; - - /** Concurrency level. */ - private int concLvl; - - /** A name of the memory policy that defines the default memory region. */ - private String dfltMemPlcName = DFLT_MEM_PLC_DEFAULT_NAME; - - /** Size of memory (in bytes) to use for default DataRegion. */ - private long dfltMemPlcSize = DFLT_MEMORY_POLICY_MAX_SIZE; - - /** Memory policies. */ - private MemoryPolicyConfiguration[] memPlcs; - - /** - * Initial size of a memory region reserved for system cache. - * - * @return Size in bytes. - */ - public long getSystemCacheInitialSize() { - return sysCacheInitSize; - } - - /** - * Sets initial size of a memory region reserved for system cache. - * - * Default value is {@link #DFLT_SYS_CACHE_INIT_SIZE} - * - * @param sysCacheInitSize Size in bytes. - * - * @return {@code this} for chaining. - */ - public MemoryConfiguration setSystemCacheInitialSize(long sysCacheInitSize) { - A.ensure(sysCacheInitSize > 0, "System cache initial size can not be less zero."); - - this.sysCacheInitSize = sysCacheInitSize; - - return this; - } - - /** - * Maximum memory region size reserved for system cache. - * - * @return Size in bytes. - */ - public long getSystemCacheMaxSize() { - return sysCacheMaxSize; - } - - /** - * Sets maximum memory region size reserved for system cache. The total size should not be less than 10 MB - * due to internal data structures overhead. - * - * @param sysCacheMaxSize Maximum size in bytes for system cache memory region. - * - * @return {@code this} for chaining. - */ - public MemoryConfiguration setSystemCacheMaxSize(long sysCacheMaxSize) { - A.ensure(sysCacheMaxSize > 0, "System cache max size can not be less zero."); - - this.sysCacheMaxSize = sysCacheMaxSize; - - return this; - } - - /** - * The pages memory consists of one or more expandable memory regions defined by {@link MemoryPolicyConfiguration}. - * Every memory region is split on pages of fixed size that store actual cache entries. - * - * @return Page size in bytes. - */ - public int getPageSize() { - return pageSize; - } - - /** - * Changes the page size. - * - * Default value is {@link #DFLT_PAGE_SIZE} - * - * @param pageSize Page size in bytes. - * @return {@code this} for chaining. - */ - public MemoryConfiguration setPageSize(int pageSize) { - A.ensure(pageSize >= 1024 && pageSize <= 16 * 1024, "Page size must be between 1kB and 16kB."); - A.ensure(U.isPow2(pageSize), "Page size must be a power of 2."); - - this.pageSize = pageSize; - - return this; - } - - /** - * Gets an array of all memory policies configured. Apache Ignite will instantiate a dedicated memory region per - * policy. An Apache Ignite cache can be mapped to a specific policy with - * {@link CacheConfiguration#setMemoryPolicyName(String)} method. - * - * @return Array of configured memory policies. - */ - public MemoryPolicyConfiguration[] getMemoryPolicies() { - return memPlcs; - } - - /** - * Sets memory policies configurations. - * - * @param memPlcs Memory policies configurations. - * @return {@code this} for chaining. - */ - public MemoryConfiguration setMemoryPolicies(MemoryPolicyConfiguration... memPlcs) { - this.memPlcs = memPlcs; - - return this; - } - - /** - * Creates a configuration for the default memory policy that will instantiate the default memory region. - * To override settings of the default memory policy in order to create the default memory region with different - * parameters, create own memory policy first, pass it to - * {@link MemoryConfiguration#setMemoryPolicies(MemoryPolicyConfiguration...)} method and change the name of the - * default memory policy with {@link MemoryConfiguration#setDefaultMemoryPolicyName(String)}. - * - * @return default Memory policy configuration. - */ - public MemoryPolicyConfiguration createDefaultPolicyConfig() { - MemoryPolicyConfiguration memPlc = new MemoryPolicyConfiguration(); - - long maxSize = dfltMemPlcSize; - - if (maxSize < DFLT_MEMORY_POLICY_INITIAL_SIZE) - memPlc.setInitialSize(maxSize); - else - memPlc.setInitialSize(DFLT_MEMORY_POLICY_INITIAL_SIZE); - - memPlc.setMaxSize(maxSize); - - return memPlc; - } - - /** - * Returns the number of concurrent segments in Ignite internal page mapping tables. By default equals - * to the number of available CPUs multiplied by 4. - * - * @return Mapping table concurrency level. - */ - public int getConcurrencyLevel() { - return concLvl; - } - - /** - * Sets the number of concurrent segments in Ignite internal page mapping tables. - * - * @param concLvl Mapping table concurrency level. - * @return {@code this} for chaining. - */ - public MemoryConfiguration setConcurrencyLevel(int concLvl) { - this.concLvl = concLvl; - - return this; - } - - /** - * Gets a size for default memory policy overridden by user. - * - * @return Default memory policy size overridden by user or {@link #DFLT_MEMORY_POLICY_MAX_SIZE} if nothing was specified. - */ - public long getDefaultMemoryPolicySize() { - return dfltMemPlcSize; - } - - /** - * Overrides size of default memory policy which is created automatically. - * - * If user doesn't specify any memory policy configuration, a default one with default size - * (20% of available RAM) is created by Ignite. - * - * This property allows user to specify desired size of default memory policy - * without having to use more verbose syntax of MemoryPolicyConfiguration elements. - * - * @param dfltMemPlcSize Size of default memory policy overridden by user. - * @return {@code this} for chaining. - */ - public MemoryConfiguration setDefaultMemoryPolicySize(long dfltMemPlcSize) { - this.dfltMemPlcSize = dfltMemPlcSize; - - return this; - } - - /** - * Gets a name of default memory policy. - * - * @return A name of a custom memory policy configured with {@code MemoryConfiguration} or {@code null} of the - * default policy is used. - */ - public String getDefaultMemoryPolicyName() { - return dfltMemPlcName; - } - - /** - * Sets the name for the default memory policy that will initialize the default memory region. - * To set own default memory policy, create the policy first, pass it to - * {@link MemoryConfiguration#setMemoryPolicies(MemoryPolicyConfiguration...)} method and change the name of the - * default memory policy with {@code MemoryConfiguration#setDefaultMemoryPolicyName(String)}. - * - * If nothing is specified by user, it is set to {@link #DFLT_MEM_PLC_DEFAULT_NAME} value. - * - * @param dfltMemPlcName Name of a memory policy to be used as default one. - * @return {@code this} for chaining. - */ - public MemoryConfiguration setDefaultMemoryPolicyName(String dfltMemPlcName) { - this.dfltMemPlcName = dfltMemPlcName; - - return this; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(MemoryConfiguration.class, this); - } -} 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 deleted file mode 100644 index f3c8ebb881b24..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/configuration/MemoryPolicyConfiguration.java +++ /dev/null @@ -1,391 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.configuration; - -import java.io.Serializable; -import org.apache.ignite.MemoryMetrics; -import org.apache.ignite.internal.mem.IgniteOutOfMemoryException; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.mxbean.MetricsMxBean; - -import static org.apache.ignite.configuration.MemoryConfiguration.DFLT_MEM_PLC_DEFAULT_NAME; - -/** - * This class allows defining custom memory policies' configurations with various parameters for Apache Ignite - * page memory (see {@link MemoryConfiguration}. For each configured memory policy Apache Ignite instantiates - * respective memory regions with different parameters like maximum size, eviction policy, swapping options, etc. - * An Apache Ignite cache can be mapped to a particular policy using - * {@link CacheConfiguration#setMemoryPolicyName(String)} method. - *

Sample configuration below shows how to configure several memory policies:

- *
- *     {@code
- *     
- *         
- *             
- *             
- *
- *             
- *                 
- *                      
- *                          
- *                          
- *                      
- *
- *                      
- *                          
- *                          
- *                          
- *                      
- *
- *                      
- *                          
- *                          
- *                          
- *                          
- *                      
- *                  
- *              
- *     }
- * 
- * - * @deprecated Use {@link DataRegionConfiguration} instead. - */ -@Deprecated -public final class MemoryPolicyConfiguration implements Serializable { - /** */ - private static final long serialVersionUID = 0L; - - /** Default metrics enabled flag. */ - public static final boolean DFLT_METRICS_ENABLED = false; - - /** Default amount of sub intervals to calculate {@link MemoryMetrics#getAllocationRate()} metric. */ - public static final int DFLT_SUB_INTERVALS = 5; - - /** Default length of interval over which {@link MemoryMetrics#getAllocationRate()} metric is calculated. */ - public static final int DFLT_RATE_TIME_INTERVAL_MILLIS = 60_000; - - /** Memory policy name. */ - private String name = DFLT_MEM_PLC_DEFAULT_NAME; - - /** Memory policy start size. */ - private long initialSize; - - /** Memory policy maximum size. */ - private long maxSize = MemoryConfiguration.DFLT_MEMORY_POLICY_MAX_SIZE; - - /** An optional path to a memory mapped file for this memory policy. */ - private String swapFilePath; - - /** An algorithm for memory pages eviction. */ - private DataPageEvictionMode pageEvictionMode = DataPageEvictionMode.DISABLED; - - /** - * A threshold for memory pages eviction initiation. For instance, if the threshold is 0.9 it means that the page - * memory will start the eviction only after 90% memory region (defined by this policy) is occupied. - */ - private double evictionThreshold = 0.9; - - /** Minimum number of empty pages in reuse lists. */ - private int emptyPagesPoolSize = 100; - - /** - * Flag to enable the memory metrics collection for this memory policy. - */ - private boolean metricsEnabled = DFLT_METRICS_ENABLED; - - /** Number of sub-intervals the whole {@link #setRateTimeInterval(long)} will be split into to calculate - * {@link MemoryMetrics#getAllocationRate()} and {@link MemoryMetrics#getEvictionRate()} rates (5 by default). - *

- * Setting it to a bigger value will result in more precise calculation and smaller drops of - * {@link MemoryMetrics#getAllocationRate()} metric when next sub-interval has to be recycled but introduces bigger - * calculation overhead. */ - private int subIntervals = DFLT_SUB_INTERVALS; - - /** - * Time interval (in milliseconds) for {@link MemoryMetrics#getAllocationRate()} - * and {@link MemoryMetrics#getEvictionRate()} monitoring purposes. - *

- * For instance, after setting the interval to 60_000 milliseconds, subsequent calls to {@link MemoryMetrics#getAllocationRate()} - * will return average allocation rate (pages per second) for the last minute. - */ - private long rateTimeInterval = DFLT_RATE_TIME_INTERVAL_MILLIS; - - /** - * Gets memory policy name. - * - * @return Memory policy name. - */ - public String getName() { - return name; - } - - /** - * Sets memory policy name. The name must be non empty and must not be equal to the reserved 'sysMemPlc' one. - * - * If not specified, {@link MemoryConfiguration#DFLT_MEM_PLC_DEFAULT_NAME} value is used. - * - * @param name Memory policy name. - * @return {@code this} for chaining. - */ - public MemoryPolicyConfiguration setName(String name) { - this.name = name; - - return this; - } - - /** - * Maximum memory region size defined by this memory policy. If the whole data can not fit into the memory region - * an out of memory exception will be thrown. - * - * @return Size in bytes. - */ - public long getMaxSize() { - return maxSize; - } - - /** - * Sets maximum memory region size defined by this memory policy. The total size should not be less than 10 MB - * due to the internal data structures overhead. - * - * @param maxSize Maximum memory policy size in bytes. - * @return {@code this} for chaining. - */ - public MemoryPolicyConfiguration setMaxSize(long maxSize) { - this.maxSize = maxSize; - - return this; - } - - /** - * Gets initial memory region size defined by this memory policy. When the used memory size exceeds this value, - * new chunks of memory will be allocated. - * - * @return Memory policy start size. - */ - public long getInitialSize() { - return initialSize; - } - - /** - * Sets initial memory region size defined by this memory policy. When the used memory size exceeds this value, - * new chunks of memory will be allocated. - * - * @param initialSize Memory policy initial size. - * @return {@code this} for chaining. - */ - public MemoryPolicyConfiguration setInitialSize(long initialSize) { - this.initialSize = initialSize; - - return this; - } - - /** - * A path to the memory-mapped files the memory region defined by this memory policy will be mapped to. Having - * the path set, allows relying on swapping capabilities of an underlying operating system for the memory region. - * - * @return A path to the memory-mapped files or {@code null} if this feature is not used for the memory region - * defined by this memory policy. - */ - public String getSwapFilePath() { - return swapFilePath; - } - - /** - * Sets a path to the memory-mapped file. - * - * @param swapFilePath A Path to the memory mapped file. - * @return {@code this} for chaining. - */ - public MemoryPolicyConfiguration setSwapFilePath(String swapFilePath) { - this.swapFilePath = swapFilePath; - - return this; - } - - /** - * Gets memory pages eviction mode. If {@link DataPageEvictionMode#DISABLED} is used (default) then an out of - * memory exception will be thrown if the memory region usage, defined by this memory policy, goes beyond its - * capacity which is {@link #getMaxSize()}. - * - * @return Memory pages eviction algorithm. {@link DataPageEvictionMode#DISABLED} used by default. - */ - public DataPageEvictionMode getPageEvictionMode() { - return pageEvictionMode; - } - - /** - * Sets memory pages eviction mode. - * - * @param evictionMode Eviction mode. - * @return {@code this} for chaining. - */ - public MemoryPolicyConfiguration setPageEvictionMode(DataPageEvictionMode evictionMode) { - pageEvictionMode = evictionMode; - - return this; - } - - /** - * Gets a threshold for memory pages eviction initiation. For instance, if the threshold is 0.9 it means that the - * page memory will start the eviction only after 90% of the memory region (defined by this policy) is occupied. - * - * @return Memory pages eviction threshold. - */ - public double getEvictionThreshold() { - return evictionThreshold; - } - - /** - * Sets memory pages eviction threshold. - * - * @param evictionThreshold Eviction threshold. - * @return {@code this} for chaining. - */ - public MemoryPolicyConfiguration setEvictionThreshold(double evictionThreshold) { - this.evictionThreshold = evictionThreshold; - - return this; - } - - /** - * Specifies the minimal number of empty pages to be present in reuse lists for this memory policy. - * This parameter ensures that Ignite will be able to successfully evict old data entries when the size of - * (key, value) pair is slightly larger than page size / 2. - * Increase this parameter if cache can contain very big entries (total size of pages in this pool should be enough - * to contain largest cache entry). - * Increase this parameter if {@link IgniteOutOfMemoryException} occurred with enabled page eviction. - * - * @return Minimum number of empty pages in reuse list. - */ - public int getEmptyPagesPoolSize() { - return emptyPagesPoolSize; - } - - /** - * Specifies the minimal number of empty pages to be present in reuse lists for this memory policy. - * This parameter ensures that Ignite will be able to successfully evict old data entries when the size of - * (key, value) pair is slightly larger than page size / 2. - * Increase this parameter if cache can contain very big entries (total size of pages in this pool should be enough - * to contain largest cache entry). - * Increase this parameter if {@link IgniteOutOfMemoryException} occurred with enabled page eviction. - * - * @param emptyPagesPoolSize Empty pages pool size. - * @return {@code this} for chaining. - */ - public MemoryPolicyConfiguration setEmptyPagesPoolSize(int emptyPagesPoolSize) { - this.emptyPagesPoolSize = emptyPagesPoolSize; - - return this; - } - - /** - * Gets whether memory metrics are enabled by default on node startup. - * - * @return Metrics enabled flag. - */ - public boolean isMetricsEnabled() { - return metricsEnabled; - } - - /** - * Sets memory metrics enabled flag. If this flag is {@code true}, metrics will be enabled on node startup. - * - * @param metricsEnabled Metrics enabled flag. - * @return {@code this} for chaining. - */ - public MemoryPolicyConfiguration setMetricsEnabled(boolean metricsEnabled) { - this.metricsEnabled = metricsEnabled; - - return this; - } - - /** - * Gets time interval for {@link MemoryMetrics#getAllocationRate()} - * and {@link MemoryMetrics#getEvictionRate()} monitoring purposes. - *

- * For instance, after setting the interval to 60_000 milliseconds, - * subsequent calls to {@link MemoryMetrics#getAllocationRate()} - * will return average allocation rate (pages per second) for the last minute. - * - * @return Time interval over which allocation rate is calculated. - * @deprecated Use {@link MetricsMxBean#configureHitRateMetric(String, long)} instead. - */ - @Deprecated - public long getRateTimeInterval() { - return rateTimeInterval; - } - - /** - * Sets time interval for {@link MemoryMetrics#getAllocationRate()} - * and {@link MemoryMetrics#getEvictionRate()} monitoring purposes. - *

- * For instance, after setting the interval to 60 seconds, - * subsequent calls to {@link MemoryMetrics#getAllocationRate()} - * will return average allocation rate (pages per second) for the last minute. - * - * @param rateTimeInterval Time interval used for allocation and eviction rates calculations. - * @return {@code this} for chaining. - * @deprecated Use {@link MetricsMxBean#configureHitRateMetric(String, long)} instead. - */ - @Deprecated - public MemoryPolicyConfiguration setRateTimeInterval(long rateTimeInterval) { - this.rateTimeInterval = rateTimeInterval; - - return this; - } - - /** - * Gets a number of sub-intervals the whole {@link #setRateTimeInterval(long)} - * will be split into to calculate {@link MemoryMetrics#getAllocationRate()} - * and {@link MemoryMetrics#getEvictionRate()} rates (5 by default). - *

- * Setting it to a bigger value will result in more precise calculation and smaller drops of - * {@link MemoryMetrics#getAllocationRate()} metric when next sub-interval has to be recycled but introduces bigger - * calculation overhead. - * - * @return number of sub intervals. - * @deprecated Use {@link MetricsMxBean#configureHitRateMetric(String, long)} instead. - */ - @Deprecated - public int getSubIntervals() { - return subIntervals; - } - - /** - * Sets a number of sub-intervals the whole {@link #setRateTimeInterval(long)} will be split into to calculate - * {@link MemoryMetrics#getAllocationRate()} and {@link MemoryMetrics#getEvictionRate()} rates (5 by default). - *

- * Setting it to a bigger value will result in more precise calculation and smaller drops of - * {@link MemoryMetrics#getAllocationRate()} metric when next sub-interval has to be recycled but introduces bigger - * calculation overhead. - * - * @param subIntervals A number of sub-intervals. - * @return {@code this} for chaining. - * @deprecated Use {@link MetricsMxBean#configureHitRateMetric(String, long)} instead. - */ - @Deprecated - public MemoryPolicyConfiguration setSubIntervals(int subIntervals) { - this.subIntervals = subIntervals; - - return this; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(MemoryPolicyConfiguration.class, this); - } -} 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 deleted file mode 100644 index 947b3478e82e2..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/configuration/PersistentStoreConfiguration.java +++ /dev/null @@ -1,690 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.configuration; - -import java.io.Serializable; -import org.apache.ignite.IgniteSystemProperties; -import org.apache.ignite.internal.processors.cache.persistence.file.AsyncFileIOFactory; -import org.apache.ignite.internal.processors.cache.persistence.file.FileIOFactory; -import org.apache.ignite.internal.processors.cache.persistence.file.RandomAccessFileIOFactory; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.mxbean.MetricsMxBean; - -/** - * Configures Apache Ignite Persistent store. - * @deprecated Use {@link DataStorageConfiguration} instead. - */ -@Deprecated -public class PersistentStoreConfiguration implements Serializable { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - public static final int DFLT_CHECKPOINTING_FREQ = 180000; - - /** Lock default wait time, 10 sec. */ - public static final int DFLT_LOCK_WAIT_TIME = 10 * 1000; - - /** */ - public static final boolean DFLT_METRICS_ENABLED = false; - - /** Default amount of sub intervals to calculate rate-based metric. */ - public static final int DFLT_SUB_INTERVALS = 5; - - /** Default length of interval over which rate-based metric is calculated. */ - public static final int DFLT_RATE_TIME_INTERVAL_MILLIS = 60_000; - - /** Default number of checkpointing threads. */ - public static final int DFLT_CHECKPOINTING_THREADS = 4; - - /** Default checkpoint write order. */ - public static final CheckpointWriteOrder DFLT_CHECKPOINT_WRITE_ORDER = CheckpointWriteOrder.SEQUENTIAL; - - /** Default number of checkpoints to be kept in WAL after checkpoint is finished */ - public static final int DFLT_WAL_HISTORY_SIZE = 20; - - /** */ - public static final int DFLT_WAL_SEGMENTS = 10; - - /** Default WAL file segment size, 64MBytes */ - public static final int DFLT_WAL_SEGMENT_SIZE = 64 * 1024 * 1024; - - /** Default wal mode. */ - public static final WALMode DFLT_WAL_MODE = WALMode.LOG_ONLY; - - /** Default Wal flush frequency. */ - public static final int DFLT_WAL_FLUSH_FREQ = 2000; - - /** Default wal fsync delay. */ - 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; - - /** Default wal always write full pages. */ - public static final boolean DFLT_WAL_ALWAYS_WRITE_FULL_PAGES = false; - - /** Default write throttling enabled. */ - public static final boolean DFLT_WRITE_THROTTLING_ENABLED = false; - - /** */ - private String persistenceStorePath; - - /** Checkpointing frequency. */ - private long checkpointingFreq = DFLT_CHECKPOINTING_FREQ; - - /** Lock wait time, in milliseconds. */ - private long lockWaitTime = DFLT_LOCK_WAIT_TIME; - - /** */ - private long checkpointingPageBufSize; - - /** */ - private int checkpointingThreads = DFLT_CHECKPOINTING_THREADS; - - /** Checkpoint write order. */ - private CheckpointWriteOrder checkpointWriteOrder = DFLT_CHECKPOINT_WRITE_ORDER; - - /** Number of checkpoints to keep */ - private int walHistSize = DFLT_WAL_HISTORY_SIZE; - - /** Number of work WAL segments. */ - private int walSegments = DFLT_WAL_SEGMENTS; - - /** Size of one WAL segment in bytes. 64 Mb is used by default. Maximum value is 2Gb */ - private int walSegmentSize = DFLT_WAL_SEGMENT_SIZE; - - /** Directory where WAL is stored (work directory) */ - private String walStorePath = DataStorageConfiguration.DFLT_WAL_PATH; - - /** WAL archive path. */ - private String walArchivePath = DataStorageConfiguration.DFLT_WAL_ARCHIVE_PATH; - - /** Metrics enabled flag. */ - private boolean metricsEnabled = DFLT_METRICS_ENABLED; - - /** Wal mode. */ - private WALMode walMode = DFLT_WAL_MODE; - - /** WAl buffer size. */ - private int walBuffSize/* = DFLT_WAL_BUFF_SIZE*/; - - /** Wal flush frequency in milliseconds. */ - private long walFlushFreq = DFLT_WAL_FLUSH_FREQ; - - /** Wal fsync delay. */ - private long walFsyncDelay = DFLT_WAL_FSYNC_DELAY; - - /** Wal record iterator buffer size. */ - private int walRecordIterBuffSize = DFLT_WAL_RECORD_ITERATOR_BUFFER_SIZE; - - /** Always write full pages. */ - private boolean alwaysWriteFullPages = DFLT_WAL_ALWAYS_WRITE_FULL_PAGES; - - /** Factory to provide I/O interface for files */ - private FileIOFactory fileIOFactory = - IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_USE_ASYNC_FILE_IO_FACTORY, false) ? - new AsyncFileIOFactory() : new RandomAccessFileIOFactory(); - - /** - * Number of sub-intervals the whole {@link #setRateTimeInterval(long)} will be split into to calculate - * rate-based metrics. - *

- * Setting it to a bigger value will result in more precise calculation and smaller drops of - * rate-based metrics when next sub-interval has to be recycled but introduces bigger - * calculation overhead. - */ - private int subIntervals = DFLT_SUB_INTERVALS; - - /** Time interval (in milliseconds) for rate-based metrics. */ - private long rateTimeInterval = DFLT_RATE_TIME_INTERVAL_MILLIS; - - /** - * Time interval (in milliseconds) for running auto archiving for incompletely WAL segment - */ - private long walAutoArchiveAfterInactivity = -1; - - /** - * If true, threads that generate dirty pages too fast during ongoing checkpoint will be throttled. - */ - private boolean writeThrottlingEnabled = DFLT_WRITE_THROTTLING_ENABLED; - - /** - * @return Path the root directory where the Persistent Store will persist data and indexes. - */ - public String getPersistentStorePath() { - return persistenceStorePath; - } - - /** - * Sets a path to the root directory where the Persistent Store will persist data and indexes. - * By default the Persistent Store's files are located under Ignite work directory. - * - * @param persistenceStorePath Persistence store path. - * @return {@code this} for chaining. - */ - public PersistentStoreConfiguration setPersistentStorePath(String persistenceStorePath) { - this.persistenceStorePath = persistenceStorePath; - - return this; - } - - /** - * Gets checkpointing frequency. - * - * @return checkpointing frequency in milliseconds. - */ - public long getCheckpointingFrequency() { - return checkpointingFreq <= 0 ? DFLT_CHECKPOINTING_FREQ : checkpointingFreq; - } - - /** - * Sets the checkpointing frequency which is a minimal interval when the dirty pages will be written - * to the Persistent Store. If the rate is high, checkpointing will be triggered more frequently. - * - * @param checkpointingFreq checkpointing frequency in milliseconds. - * @return {@code this} for chaining. - */ - public PersistentStoreConfiguration setCheckpointingFrequency(long checkpointingFreq) { - this.checkpointingFreq = checkpointingFreq; - - return this; - } - - /** - * Gets amount of memory allocated for a checkpointing temporary buffer. - * - * @return Checkpointing page buffer size in bytes or {@code 0} for Ignite - * to choose the buffer size automatically. - */ - public long getCheckpointingPageBufferSize() { - return checkpointingPageBufSize; - } - - /** - * Sets amount of memory allocated for the checkpointing temporary buffer. The buffer is used to create temporary - * 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 or {@code 0} for Ignite to - * choose the buffer size automatically. - * @return {@code this} for chaining. - */ - public PersistentStoreConfiguration setCheckpointingPageBufferSize(long checkpointingPageBufSize) { - this.checkpointingPageBufSize = checkpointingPageBufSize; - - return this; - } - - /** - * Gets a number of threads to use for the checkpointing purposes. - * - * @return Number of checkpointing threads. - */ - public int getCheckpointingThreads() { - return checkpointingThreads; - } - - /** - * Sets a number of threads to use for the checkpointing purposes. - * - * @param checkpointingThreads Number of checkpointing threads. Four threads are used by default. - * @return {@code this} for chaining. - */ - public PersistentStoreConfiguration setCheckpointingThreads(int checkpointingThreads) { - this.checkpointingThreads = checkpointingThreads; - - return this; - } - - /** - * Time out in milliseonds to wait when acquiring persistence store lock file before failing the - * local node. - * - * @return Lock wait time in milliseconds. - */ - public long getLockWaitTime() { - return lockWaitTime; - } - - /** - * Time out in milliseconds to wait when acquiring persistence store lock file before failing the - * local node. - * - * @param lockWaitTime Lock wait time in milliseconds. - * @return {@code this} for chaining. - */ - public PersistentStoreConfiguration setLockWaitTime(long lockWaitTime) { - this.lockWaitTime = lockWaitTime; - - return this; - } - - /** - * Gets a total number of checkpoints to keep in the WAL history. - * - * @return Number of checkpoints to keep in WAL after a checkpoint is finished. - */ - public int getWalHistorySize() { - return walHistSize <= 0 ? DFLT_WAL_HISTORY_SIZE : walHistSize; - } - - /** - * Sets a total number of checkpoints to keep in the WAL history. - * - * @param walHistSize Number of checkpoints to keep after a checkpoint is finished. - * @return {@code this} for chaining. - */ - public PersistentStoreConfiguration setWalHistorySize(int walHistSize) { - this.walHistSize = walHistSize; - - return this; - } - - /** - * Gets a number of WAL segments to work with. - * - * @return Number of work WAL segments. - */ - public int getWalSegments() { - return walSegments <= 0 ? DFLT_WAL_SEGMENTS : walSegments; - } - - /** - * Sets a number of WAL segments to work with. For performance reasons, - * the whole WAL is split into files of fixed length called segments. - * - * @param walSegments Number of WAL segments. - * @return {@code this} for chaining. - */ - public PersistentStoreConfiguration setWalSegments(int walSegments) { - this.walSegments = walSegments; - - return this; - } - - /** - * Gets size of a WAL segment in bytes. - * - * @return WAL segment size. - */ - public int getWalSegmentSize() { - return walSegmentSize <= 0 ? DFLT_WAL_SEGMENT_SIZE : walSegmentSize; - } - - /** - * Sets size of a WAL segment. - * - * @param walSegmentSize WAL segment size. 64 MB is used by default. Maximum value is 2Gb - * @return {@code this} for chaining. - */ - public PersistentStoreConfiguration setWalSegmentSize(int walSegmentSize) { - this.walSegmentSize = walSegmentSize; - - return this; - } - - /** - * Gets a path to the directory where WAL is stored. - * - * @return WAL persistence path, absolute or relative to Ignite work directory. - */ - public String getWalStorePath() { - return walStorePath; - } - - /** - * Sets a path to the directory where WAL is stored . If this path is relative, it will be resolved - * relatively to Ignite work directory. - * - * @param walStorePath WAL persistence path, absolute or relative to Ignite work directory. - * @return {@code this} for chaining. - */ - public PersistentStoreConfiguration setWalStorePath(String walStorePath) { - this.walStorePath = walStorePath; - - return this; - } - - /** - * Gets a path to the WAL archive directory. - * - * @return WAL archive directory. - */ - public String getWalArchivePath() { - return walArchivePath; - } - - /** - * Sets a path for the WAL archive directory. Every WAL segment will be fully copied to this directory before - * it can be reused for WAL purposes. - * - * @param walArchivePath WAL archive directory. - * @return {@code this} for chaining. - */ - public PersistentStoreConfiguration setWalArchivePath(String walArchivePath) { - this.walArchivePath = walArchivePath; - - return this; - } - - /** - * Gets flag indicating whether persistence metrics collection is enabled. - * Default value is {@link #DFLT_METRICS_ENABLED}. - * - * @return Metrics enabled flag. - */ - public boolean isMetricsEnabled() { - return metricsEnabled; - } - - /** - * Sets flag indicating whether persistence metrics collection is enabled. - * - * @param metricsEnabled Metrics enabled flag. - * @return {@code this} for chaining. - */ - public PersistentStoreConfiguration setMetricsEnabled(boolean metricsEnabled) { - this.metricsEnabled = metricsEnabled; - - return this; - } - - /** - * @return Flag indicating whether write throttling is enabled. - */ - public boolean isWriteThrottlingEnabled() { - return writeThrottlingEnabled; - } - - /** - * Sets flag indicating whether write throttling is enabled. - * - * @param writeThrottlingEnabled Write throttling enabled flag. - * @return {@code this} for chaining. - */ - public PersistentStoreConfiguration setWriteThrottlingEnabled(boolean writeThrottlingEnabled) { - this.writeThrottlingEnabled = writeThrottlingEnabled; - - return this; - } - - /** - * Gets the length of the time interval for rate-based metrics. This interval defines a window over which - * hits will be tracked. Default value is {@link #DFLT_RATE_TIME_INTERVAL_MILLIS}. - * - * @return Time interval in milliseconds. - * @deprecated Use {@link MetricsMxBean#configureHitRateMetric(String, long)} instead. - */ - @Deprecated - public long getRateTimeInterval() { - return rateTimeInterval; - } - - /** - * Sets the length of the time interval for rate-based metrics. This interval defines a window over which - * hits will be tracked. - * - * @param rateTimeInterval Time interval in milliseconds. - * @return {@code this} for chaining. - * @deprecated Use {@link MetricsMxBean#configureHitRateMetric(String, long)} instead. - */ - @Deprecated - public PersistentStoreConfiguration setRateTimeInterval(long rateTimeInterval) { - this.rateTimeInterval = rateTimeInterval; - - return this; - } - - /** - * Gets the number of sub-intervals to split the {@link #getRateTimeInterval()} into to track the update history. - * Default value is {@link #DFLT_SUB_INTERVALS}. - * - * @return The number of sub-intervals for history tracking. - * @deprecated Use {@link MetricsMxBean#configureHitRateMetric(String, long)} instead. - */ - @Deprecated - public int getSubIntervals() { - return subIntervals; - } - - /** - * Sets the number of sub-intervals to split the {@link #getRateTimeInterval()} into to track the update history. - * - * @param subIntervals The number of sub-intervals for history tracking. - * @return {@code this} for chaining. - * @deprecated Use {@link MetricsMxBean#configureHitRateMetric(String, long)} instead. - */ - @Deprecated - public PersistentStoreConfiguration setSubIntervals(int subIntervals) { - this.subIntervals = subIntervals; - - return this; - } - - /** - * Type define behavior wal fsync. - * Different type provide different guarantees for consistency. - * - * @return WAL mode. - */ - public WALMode getWalMode() { - return walMode == null ? DFLT_WAL_MODE : walMode; - } - - /** - * @param walMode Wal mode. - * @return {@code this} for chaining. - */ - public PersistentStoreConfiguration setWalMode(WALMode walMode) { - if (walMode == WALMode.DEFAULT) - walMode = WALMode.FSYNC; - - this.walMode = walMode; - - return this; - } - - /** - * Property defines size of WAL buffer. - * Each WAL record will be serialized to this buffer before write in WAL file. - * - * @return WAL buffer size. - * @deprecated Instead {@link #getWalBufferSize()} should be used. - */ - @Deprecated - public int getTlbSize() { - return getWalBufferSize(); - } - - /** - * @param tlbSize WAL buffer size. - * @return {@code this} for chaining. - * @deprecated Instead {@link #setWalBufferSize(int walBuffSize)} should be used. - */ - @Deprecated - public PersistentStoreConfiguration setTlbSize(int tlbSize) { - return setWalBufferSize(tlbSize); - } - - /** - * Property defines size of WAL buffer. - * Each WAL record will be serialized to this buffer before write in WAL file. - * - * @return WAL buffer size. - */ - @Deprecated - public int getWalBufferSize() { - return walBuffSize <= 0 ? getWalSegmentSize() / 4 : walBuffSize; - } - - /** - * @param walBuffSize WAL buffer size. - * @return {@code this} for chaining. - */ - @Deprecated - public PersistentStoreConfiguration setWalBufferSize(int walBuffSize) { - this.walBuffSize = walBuffSize; - - return this; - } - - /** - * This property define how often WAL will be fsync-ed in {@code BACKGROUND} mode. Ignored for - * all other WAL modes. - * - * @return WAL flush frequency, in milliseconds. - */ - public long getWalFlushFrequency() { - return walFlushFreq; - } - - /** - * 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. - * @return {@code this} for chaining. - */ - public PersistentStoreConfiguration setWalFlushFrequency(long walFlushFreq) { - this.walFlushFreq = walFlushFreq; - - return this; - } - - /** - * @return The fsync delay, in nanoseconds. - */ - public long getWalFsyncDelayNanos() { - return walFsyncDelay <= 0 ? DFLT_WAL_FSYNC_DELAY : walFsyncDelay; - } - - /** - * @param walFsyncDelayNanos Wal fsync delay, in nanoseconds. - * @return {@code this} for chaining. - */ - public PersistentStoreConfiguration setWalFsyncDelayNanos(long walFsyncDelayNanos) { - walFsyncDelay = walFsyncDelayNanos; - - return this; - } - - /** - * Property define how many bytes iterator read from - * disk (for one reading), during go ahead wal. - * - * @return Record iterator buffer size. - */ - public int getWalRecordIteratorBufferSize() { - return walRecordIterBuffSize <= 0 ? DFLT_WAL_RECORD_ITERATOR_BUFFER_SIZE : walRecordIterBuffSize; - } - - /** - * @param walRecordIterBuffSize Wal record iterator buffer size. - * @return {@code this} for chaining. - */ - public PersistentStoreConfiguration setWalRecordIteratorBufferSize(int walRecordIterBuffSize) { - this.walRecordIterBuffSize = walRecordIterBuffSize; - - return this; - } - - /** - * @return Whether full page must be always written. - */ - public boolean isAlwaysWriteFullPages() { - return alwaysWriteFullPages; - } - - /** - * @param alwaysWriteFullPages Always write full pages. - * @return {@code this} for chaining. - */ - public PersistentStoreConfiguration setAlwaysWriteFullPages(boolean alwaysWriteFullPages) { - this.alwaysWriteFullPages = alwaysWriteFullPages; - - return this; - } - - /** - * Factory to provide implementation of FileIO interface - * which is used for any file read/write operations - * - * @return File I/O factory - */ - public FileIOFactory getFileIOFactory() { - return fileIOFactory; - } - - /** - * @param fileIOFactory File I/O factory - * @return {@code this} for chaining. - */ - public PersistentStoreConfiguration setFileIOFactory(FileIOFactory fileIOFactory) { - this.fileIOFactory = fileIOFactory; - - return this; - } - - /** - * Note: setting this value with {@link WALMode#FSYNC} may generate file size overhead for WAL segments in case - * grid is used rarely. - * - * @param walAutoArchiveAfterInactivity time in millis to run auto archiving segment (even if incomplete) after last - * record logging.
Positive value enables incomplete segment archiving after timeout (inactivity).
Zero or - * negative value disables auto archiving. - * @return current configuration instance for chaining - */ - public PersistentStoreConfiguration setWalAutoArchiveAfterInactivity(long walAutoArchiveAfterInactivity) { - this.walAutoArchiveAfterInactivity = walAutoArchiveAfterInactivity; - - return this; - } - - /** - * @return time in millis to run auto archiving WAL segment (even if incomplete) after last record log - */ - public long getWalAutoArchiveAfterInactivity() { - return walAutoArchiveAfterInactivity; - } - - /** - * This property defines order of writing pages to disk storage during checkpoint. - * - * @return Checkpoint write order. - */ - public CheckpointWriteOrder getCheckpointWriteOrder() { - return checkpointWriteOrder; - } - - /** - * This property defines order of writing pages to disk storage during checkpoint. - * - * @param checkpointWriteOrder Checkpoint write order. - * @return {@code this} for chaining. - */ - public PersistentStoreConfiguration setCheckpointWriteOrder(CheckpointWriteOrder checkpointWriteOrder) { - this.checkpointWriteOrder = checkpointWriteOrder; - - return this; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(PersistentStoreConfiguration.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java index e4dfba6d877ae..600e9810a371a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java @@ -84,7 +84,6 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.CollectionConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.configuration.MemoryConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.events.EventType; import org.apache.ignite.internal.binary.BinaryMarshaller; @@ -254,7 +253,6 @@ import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER_COMPACT_FOOTER; import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER_USE_BINARY_STRING_SER_VER_2; import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER_USE_DFLT_SUID; -import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MEMORY_CONFIG; import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_NODE_CONSISTENT_ID; import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PEER_CLASSLOADING; import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PREFIX; @@ -1602,7 +1600,7 @@ private void fillNodeAttributes(boolean notifyEnabled) throws IgniteCheckedExcep add(ATTR_REST_PORT_RANGE, cfg.getConnectorConfiguration().getPortRange()); // Save data storage configuration. - addDataStorageConfigurationAttributes(); + add(ATTR_DATA_STORAGE_CONFIG, ctx.marshallerContext().jdkMarshaller().marshal(cfg.getDataStorageConfiguration())); // Save transactions configuration. add(ATTR_TX_SERIALIZABLE_ENABLED, cfg.getTransactionConfiguration().isTxSerializableEnabled()); @@ -1636,25 +1634,6 @@ else if (userAttrs != null && userAttrs.get(IGNITE_DATA_CENTER_ID) != null) } } - /** - * @throws IgniteCheckedException If duplicated SPI name found. - */ - private void addDataStorageConfigurationAttributes() throws IgniteCheckedException { - MemoryConfiguration memCfg = cfg.getMemoryConfiguration(); - - // Save legacy memory configuration if it's present. - if (memCfg != null) { - // Page size initialization is suspended, see IgniteCacheDatabaseSharedManager#checkPageSize. - // We should copy initialized value from new configuration. - memCfg.setPageSize(cfg.getDataStorageConfiguration().getPageSize()); - - add(ATTR_MEMORY_CONFIG, memCfg); - } - - // Save data storage configuration. - add(ATTR_DATA_STORAGE_CONFIG, ctx.marshallerContext().jdkMarshaller().marshal(cfg.getDataStorageConfiguration())); - } - /** * Add SPI version and class attributes into node attributes. * diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java index a5fc9270d40b7..d0425038af1c3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java @@ -183,10 +183,6 @@ public final class IgniteNodeAttributes { /** */ public static final String ATTR_DATA_STREAMER_POOL_SIZE = ATTR_PREFIX + ".data.streamer.pool.size"; - /** Memory configuration. */ - @Deprecated - public static final String ATTR_MEMORY_CONFIG = ATTR_PREFIX + ".memory"; - /** Data storage configuration. */ public static final String ATTR_DATA_STORAGE_CONFIG = ATTR_PREFIX + ".data.storage.config"; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java index 2864009c84a90..7f4529a6a1951 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java @@ -61,15 +61,10 @@ import org.apache.ignite.compute.ComputeJob; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.ConnectorConfiguration; -import org.apache.ignite.configuration.DataRegionConfiguration; import org.apache.ignite.configuration.DataStorageConfiguration; import org.apache.ignite.configuration.DeploymentMode; import org.apache.ignite.configuration.ExecutorConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.configuration.MemoryConfiguration; -import org.apache.ignite.configuration.MemoryPolicyConfiguration; -import org.apache.ignite.configuration.PersistentStoreConfiguration; -import org.apache.ignite.configuration.SystemDataRegionConfiguration; import org.apache.ignite.configuration.TransactionConfiguration; import org.apache.ignite.failure.FailureContext; import org.apache.ignite.failure.FailureType; @@ -144,8 +139,6 @@ import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CacheRebalanceMode.SYNC; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; -import static org.apache.ignite.configuration.MemoryConfiguration.DFLT_MEMORY_POLICY_MAX_SIZE; -import static org.apache.ignite.configuration.MemoryConfiguration.DFLT_MEM_PLC_DEFAULT_NAME; import static org.apache.ignite.internal.IgniteComponentType.SPRING; import static org.apache.ignite.internal.processors.task.TaskExecutionOptions.options; import static org.apache.ignite.internal.util.IgniteUtils.EMPTY_STRS; @@ -1946,12 +1939,6 @@ private void initializeDataStorageConfiguration(IgniteConfiguration cfg) throws DataStorageConfiguration dsCfg = cfg.getDataStorageConfiguration(); if (dsCfg != null) { - if (cfg.getMemoryConfiguration() != null || cfg.getPersistentStoreConfiguration() != null) { - throw new IgniteCheckedException("Data storage can be configured with either legacy " + - "(MemoryConfiguration, PersistentStoreConfiguration) or new (DataStorageConfiguration) classes, " + - "but not both."); - } - List extraStorages = F.asList(dsCfg.getExtraStoragePaths()); if (extraStorages.size() != new HashSet<>(extraStorages).size() @@ -1974,9 +1961,6 @@ private void initializeDataStorageConfiguration(IgniteConfiguration cfg) throws } } - if (cfg.getMemoryConfiguration() != null || cfg.getPersistentStoreConfiguration() != null) - convertLegacyDataStorageConfigurationToNew(cfg); - if (!cfg.isClientMode() && cfg.getDataStorageConfiguration() == null) cfg.setDataStorageConfiguration(new DataStorageConfiguration()); } @@ -2612,117 +2596,4 @@ public static void initializeDefaultMBeanServer(IgniteConfiguration myCfg) { if (myCfg.getMBeanServer() == null && !IGNITE_MBEANS_DISABLED) myCfg.setMBeanServer(ManagementFactory.getPlatformMBeanServer()); } - - /** - * @param cfg Ignite Configuration with legacy data storage configuration. - */ - private static void convertLegacyDataStorageConfigurationToNew( - IgniteConfiguration cfg) throws IgniteCheckedException { - PersistentStoreConfiguration psCfg = cfg.getPersistentStoreConfiguration(); - - boolean persistenceEnabled = psCfg != null; - - DataStorageConfiguration dsCfg = new DataStorageConfiguration(); - - MemoryConfiguration memCfg = cfg.getMemoryConfiguration() != null ? - cfg.getMemoryConfiguration() : new MemoryConfiguration(); - - dsCfg.setConcurrencyLevel(memCfg.getConcurrencyLevel()); - dsCfg.setPageSize(memCfg.getPageSize()); - - dsCfg.setSystemDataRegionConfiguration( - new SystemDataRegionConfiguration() - .setInitialSize(memCfg.getSystemCacheInitialSize()) - .setMaxSize(memCfg.getSystemCacheMaxSize()) - ); - - List optionalDataRegions = new ArrayList<>(); - - boolean customDfltPlc = false; - - if (memCfg.getMemoryPolicies() != null) { - for (MemoryPolicyConfiguration mpc : memCfg.getMemoryPolicies()) { - DataRegionConfiguration region = new DataRegionConfiguration(); - - region.setPersistenceEnabled(persistenceEnabled); - - if (mpc.getInitialSize() != 0L) - region.setInitialSize(mpc.getInitialSize()); - - region.setEmptyPagesPoolSize(mpc.getEmptyPagesPoolSize()); - region.setEvictionThreshold(mpc.getEvictionThreshold()); - region.setMaxSize(mpc.getMaxSize()); - region.setName(mpc.getName()); - region.setPageEvictionMode(mpc.getPageEvictionMode()); - region.setMetricsRateTimeInterval(mpc.getRateTimeInterval()); - region.setMetricsSubIntervalCount(mpc.getSubIntervals()); - region.setSwapPath(mpc.getSwapFilePath()); - region.setMetricsEnabled(mpc.isMetricsEnabled()); - - if (persistenceEnabled) - region.setCheckpointPageBufferSize(psCfg.getCheckpointingPageBufferSize()); - - if (mpc.getName() == null) { - throw new IgniteCheckedException(new IllegalArgumentException( - "User-defined MemoryPolicyConfiguration must have non-null and non-empty name.")); - } - - if (mpc.getName().equals(memCfg.getDefaultMemoryPolicyName())) { - customDfltPlc = true; - - dsCfg.setDefaultDataRegionConfiguration(region); - } - else - optionalDataRegions.add(region); - } - } - - if (!optionalDataRegions.isEmpty()) - dsCfg.setDataRegionConfigurations(optionalDataRegions.toArray( - new DataRegionConfiguration[optionalDataRegions.size()])); - - if (!customDfltPlc) { - if (!DFLT_MEM_PLC_DEFAULT_NAME.equals(memCfg.getDefaultMemoryPolicyName())) { - throw new IgniteCheckedException(new IllegalArgumentException("User-defined default MemoryPolicy " + - "name must be presented among configured MemoryPolices: " + memCfg.getDefaultMemoryPolicyName())); - } - - dsCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration() - .setMaxSize(memCfg.getDefaultMemoryPolicySize()) - .setName(memCfg.getDefaultMemoryPolicyName()) - .setPersistenceEnabled(persistenceEnabled)); - } - else { - if (memCfg.getDefaultMemoryPolicySize() != DFLT_MEMORY_POLICY_MAX_SIZE) - throw new IgniteCheckedException(new IllegalArgumentException("User-defined MemoryPolicy " + - "configuration and defaultMemoryPolicySize properties are set at the same time.")); - } - - if (persistenceEnabled) { - dsCfg.setCheckpointFrequency(psCfg.getCheckpointingFrequency()); - dsCfg.setCheckpointThreads(psCfg.getCheckpointingThreads()); - dsCfg.setCheckpointWriteOrder(psCfg.getCheckpointWriteOrder()); - dsCfg.setFileIOFactory(psCfg.getFileIOFactory()); - dsCfg.setLockWaitTime(psCfg.getLockWaitTime()); - dsCfg.setStoragePath(psCfg.getPersistentStorePath()); - dsCfg.setMetricsRateTimeInterval(psCfg.getRateTimeInterval()); - dsCfg.setMetricsSubIntervalCount(psCfg.getSubIntervals()); - dsCfg.setWalThreadLocalBufferSize(psCfg.getTlbSize()); - dsCfg.setWalArchivePath(psCfg.getWalArchivePath()); - dsCfg.setWalAutoArchiveAfterInactivity(psCfg.getWalAutoArchiveAfterInactivity()); - dsCfg.setWalFlushFrequency(psCfg.getWalFlushFrequency()); - dsCfg.setWalFsyncDelayNanos(psCfg.getWalFsyncDelayNanos()); - dsCfg.setWalHistorySize(psCfg.getWalHistorySize()); - dsCfg.setWalMode(psCfg.getWalMode()); - dsCfg.setWalRecordIteratorBufferSize(psCfg.getWalRecordIteratorBufferSize()); - dsCfg.setWalSegments(psCfg.getWalSegments()); - dsCfg.setWalSegmentSize(psCfg.getWalSegmentSize()); - dsCfg.setWalPath(psCfg.getWalStorePath()); - dsCfg.setAlwaysWriteFullPages(psCfg.isAlwaysWriteFullPages()); - dsCfg.setMetricsEnabled(psCfg.isMetricsEnabled()); - dsCfg.setWriteThrottlingEnabled(psCfg.isWriteThrottlingEnabled()); - } - - cfg.setDataStorageConfiguration(dsCfg); - } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ValidationOnNodeJoinUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ValidationOnNodeJoinUtils.java index 96c6d8e8aff50..078db92dcc8c8 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ValidationOnNodeJoinUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ValidationOnNodeJoinUtils.java @@ -44,7 +44,6 @@ import org.apache.ignite.configuration.DeploymentMode; import org.apache.ignite.configuration.DiskPageCompression; import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.configuration.MemoryConfiguration; import org.apache.ignite.configuration.TransactionConfiguration; import org.apache.ignite.internal.GridKernalContext; import org.apache.ignite.internal.IgniteNodeAttributes; @@ -579,18 +578,6 @@ private static void checkMemoryConfiguration(ClusterNode rmt, GridKernalContext if (dsCfgBytes instanceof byte[]) dsCfg = ctx.marshallerContext().jdkMarshaller().unmarshal((byte[])dsCfgBytes, U.resolveClassLoader(ctx.config())); - if (dsCfg == null) { - // Try to use legacy memory configuration. - MemoryConfiguration memCfg = rmt.attribute(IgniteNodeAttributes.ATTR_MEMORY_CONFIG); - - if (memCfg != null) { - dsCfg = new DataStorageConfiguration(); - - // All properties that are used in validation should be converted here. - dsCfg.setPageSize(memCfg.getPageSize()); - } - } - if (dsCfg != null) { DataStorageConfiguration locDsCfg = ctx.config().getDataStorageConfiguration(); 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 3b2d876769b4f..13d496db4b72c 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 @@ -210,7 +210,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan @SystemProperty(value = "Enables log checkpoint read lock holders") public static final String IGNITE_PDS_LOG_CP_READ_LOCK_HOLDERS = "IGNITE_PDS_LOG_CP_READ_LOCK_HOLDERS"; - /** MemoryPolicyConfiguration name reserved for meta store. */ + /** {@link DataRegionConfiguration} name reserved for meta store. */ public static final String METASTORE_DATA_REGION_NAME = "metastoreMemPlc"; /** Name of the system view for a system {@link MetaStorage}. */ 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 6f97090a92903..4e6afa965b7ce 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 @@ -66,10 +66,7 @@ import org.apache.ignite.configuration.DiskPageCompression; import org.apache.ignite.configuration.ExecutorConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.configuration.MemoryConfiguration; -import org.apache.ignite.configuration.MemoryPolicyConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; -import org.apache.ignite.configuration.PersistentStoreConfiguration; import org.apache.ignite.configuration.PlatformCacheConfiguration; import org.apache.ignite.configuration.SqlConnectorConfiguration; import org.apache.ignite.configuration.SystemDataRegionConfiguration; @@ -897,9 +894,6 @@ else if (consId != null) { break; } - if (in.readBoolean()) - cfg.setMemoryConfiguration(readMemoryConfiguration(in)); - if (in.readBoolean()) cfg.setSqlConnectorConfiguration(readSqlConnectorConfiguration(in)); @@ -909,9 +903,6 @@ else if (consId != null) { if (!in.readBoolean()) // ClientConnectorConfigurationEnabled override cfg.setClientConnectorConfiguration(null); - if (in.readBoolean()) - cfg.setPersistentStoreConfiguration(readPersistentStoreConfiguration(in)); - if (in.readBoolean()) cfg.setDataStorageConfiguration(readDataStorageConfiguration(in)); @@ -1509,16 +1500,12 @@ else if (evtStorageSpi instanceof MemoryEventStorageSpi) { w.writeLong(((MemoryEventStorageSpi)evtStorageSpi).getExpireAgeMs()); } - writeMemoryConfiguration(w, cfg.getMemoryConfiguration()); - writeSqlConnectorConfiguration(w, cfg.getSqlConnectorConfiguration()); writeClientConnectorConfiguration(w, cfg.getClientConnectorConfiguration()); w.writeBoolean(cfg.getClientConnectorConfiguration() != null); - writePersistentStoreConfiguration(w, cfg.getPersistentStoreConfiguration()); - writeDataStorageConfiguration(w, cfg.getDataStorageConfiguration()); writeSslContextFactory(w, cfg.getSslContextFactory()); @@ -1785,93 +1772,6 @@ private static PlatformCachePluginConfigurationClosure cachePluginConfiguration( return factory.create(); } - /** - * Reads the memory configuration. - * - * @param in Reader - * @return Config. - */ - @SuppressWarnings("deprecation") - private static MemoryConfiguration readMemoryConfiguration(BinaryRawReader in) { - MemoryConfiguration res = new MemoryConfiguration(); - - res.setSystemCacheInitialSize(in.readLong()) - .setSystemCacheMaxSize(in.readLong()) - .setPageSize(in.readInt()) - .setConcurrencyLevel(in.readInt()) - .setDefaultMemoryPolicyName(in.readString()); - - int cnt = in.readInt(); - - if (cnt > 0) { - MemoryPolicyConfiguration[] plcs = new MemoryPolicyConfiguration[cnt]; - - for (int i = 0; i < cnt; i++) { - MemoryPolicyConfiguration cfg = new MemoryPolicyConfiguration(); - - cfg.setName(in.readString()) - .setInitialSize(in.readLong()) - .setMaxSize(in.readLong()) - .setSwapFilePath(in.readString()) - .setPageEvictionMode(DataPageEvictionMode.values()[in.readInt()]) - .setEvictionThreshold(in.readDouble()) - .setEmptyPagesPoolSize(in.readInt()) - .setMetricsEnabled(in.readBoolean()) - .setSubIntervals(in.readInt()) - .setRateTimeInterval(in.readLong()); - - plcs[i] = cfg; - } - - res.setMemoryPolicies(plcs); - } - - return res; - } - - /** - * Writes the memory configuration. - * - * @param w Writer. - * @param cfg Config. - */ - @SuppressWarnings("deprecation") - private static void writeMemoryConfiguration(BinaryRawWriter w, MemoryConfiguration cfg) { - if (cfg == null) { - w.writeBoolean(false); - return; - } - - w.writeBoolean(true); - - w.writeLong(cfg.getSystemCacheInitialSize()); - w.writeLong(cfg.getSystemCacheMaxSize()); - w.writeInt(cfg.getPageSize()); - w.writeInt(cfg.getConcurrencyLevel()); - w.writeString(cfg.getDefaultMemoryPolicyName()); - - MemoryPolicyConfiguration[] plcs = cfg.getMemoryPolicies(); - - if (plcs != null) { - w.writeInt(plcs.length); - - for (MemoryPolicyConfiguration plc : plcs) { - w.writeString(plc.getName()); - w.writeLong(plc.getInitialSize()); - w.writeLong(plc.getMaxSize()); - w.writeString(plc.getSwapFilePath()); - w.writeInt(plc.getPageEvictionMode().ordinal()); - w.writeDouble(plc.getEvictionThreshold()); - w.writeInt(plc.getEmptyPagesPoolSize()); - w.writeBoolean(plc.isMetricsEnabled()); - w.writeInt(plc.getSubIntervals()); - w.writeLong(plc.getRateTimeInterval()); - } - } - else - w.writeInt(0); - } - /** * Reads the SQL connector configuration. * @@ -1992,38 +1892,6 @@ private static void writeClientConnectorConfiguration(BinaryRawWriter w, ClientC w.writeBoolean(false); } - /** - * Reads the persistence store connector configuration. - * - * @param in Reader. - * @return Config. - */ - @SuppressWarnings("deprecation") - private static PersistentStoreConfiguration readPersistentStoreConfiguration(BinaryRawReader in) { - return new PersistentStoreConfiguration() - .setPersistentStorePath(in.readString()) - .setCheckpointingFrequency(in.readLong()) - .setCheckpointingPageBufferSize(in.readLong()) - .setCheckpointingThreads(in.readInt()) - .setLockWaitTime((int)in.readLong()) - .setWalHistorySize(in.readInt()) - .setWalSegments(in.readInt()) - .setWalSegmentSize(in.readInt()) - .setWalStorePath(in.readString()) - .setWalArchivePath(in.readString()) - .setWalMode(WALMode.fromOrdinal(in.readInt())) - .setWalBufferSize(in.readInt()) - .setWalFlushFrequency((int)in.readLong()) - .setWalFsyncDelayNanos(in.readLong()) - .setWalRecordIteratorBufferSize(in.readInt()) - .setAlwaysWriteFullPages(in.readBoolean()) - .setMetricsEnabled(in.readBoolean()) - .setSubIntervals(in.readInt()) - .setRateTimeInterval(in.readLong()) - .setCheckpointWriteOrder(CheckpointWriteOrder.fromOrdinal(in.readInt())) - .setWriteThrottlingEnabled(in.readBoolean()); - } - /** * Reads the data storage configuration. * @@ -2121,44 +1989,6 @@ private static SslContextFactory readSslContextFactory(BinaryRawReader in) { return f; } - /** - * Writes the persistent store configuration. - * - * @param w Writer. - */ - @SuppressWarnings("deprecation") - private static void writePersistentStoreConfiguration(BinaryRawWriter w, PersistentStoreConfiguration cfg) { - assert w != null; - - if (cfg != null) { - w.writeBoolean(true); - - w.writeString(cfg.getPersistentStorePath()); - w.writeLong(cfg.getCheckpointingFrequency()); - w.writeLong(cfg.getCheckpointingPageBufferSize()); - w.writeInt(cfg.getCheckpointingThreads()); - w.writeLong(cfg.getLockWaitTime()); - w.writeInt(cfg.getWalHistorySize()); - w.writeInt(cfg.getWalSegments()); - w.writeInt(cfg.getWalSegmentSize()); - w.writeString(cfg.getWalStorePath()); - w.writeString(cfg.getWalArchivePath()); - w.writeInt(cfg.getWalMode().ordinal()); - w.writeInt(cfg.getWalBufferSize()); - w.writeLong(cfg.getWalFlushFrequency()); - w.writeLong(cfg.getWalFsyncDelayNanos()); - w.writeInt(cfg.getWalRecordIteratorBufferSize()); - w.writeBoolean(cfg.isAlwaysWriteFullPages()); - w.writeBoolean(cfg.isMetricsEnabled()); - w.writeInt(cfg.getSubIntervals()); - w.writeLong(cfg.getRateTimeInterval()); - w.writeInt(cfg.getCheckpointWriteOrder().ordinal()); - w.writeBoolean(cfg.isWriteThrottlingEnabled()); - } - else - w.writeBoolean(false); - } - /** * Writes the data storage configuration. * diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheFSRestoreTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheFSRestoreTest.java index 8dc02770f9d6a..fb5496ef596a9 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheFSRestoreTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheFSRestoreTest.java @@ -30,8 +30,9 @@ import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.cluster.ClusterState; import org.apache.ignite.configuration.CacheConfiguration; +import org.apache.ignite.configuration.DataRegionConfiguration; +import org.apache.ignite.configuration.DataStorageConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.configuration.PersistentStoreConfiguration; import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage; import org.apache.ignite.internal.processors.marshaller.MappingProposedMessage; @@ -93,8 +94,11 @@ private static class SimpleValue { cfg.setCacheConfiguration(singleCacheCfg); //persistence must be enabled to verify restoring mappings from FS case - if (isPersistenceEnabled) - cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration()); + if (isPersistenceEnabled) { + cfg.setDataStorageConfiguration(new DataStorageConfiguration() + .setDefaultDataRegionConfiguration(new DataRegionConfiguration() + .setPersistenceEnabled(true))); + } return cfg; } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorGridSplitCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorGridSplitCacheTest.java index 08ba9b809bf01..abdadc1ade892 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorGridSplitCacheTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorGridSplitCacheTest.java @@ -30,8 +30,9 @@ import org.apache.ignite.cache.affinity.Affinity; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.configuration.CacheConfiguration; +import org.apache.ignite.configuration.DataRegionConfiguration; +import org.apache.ignite.configuration.DataStorageConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.configuration.MemoryConfiguration; import org.apache.ignite.configuration.TopologyValidator; import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCacheTopologySplitAbstractTest; @@ -158,8 +159,9 @@ private int segment(int discoPort) { } cfg.setUserAttributes(userAttrs); - cfg.setMemoryConfiguration(new MemoryConfiguration(). - setDefaultMemoryPolicySize((50L << 20) + (100L << 20) * CACHES_CNT / GRID_CNT)); + cfg.setDataStorageConfiguration(new DataStorageConfiguration() + .setDefaultDataRegionConfiguration(new DataRegionConfiguration() + .setInitialSize((50L << 20) + (100L << 20) * CACHES_CNT / GRID_CNT))); return cfg; } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/MemoryPolicyConfigValidationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/MemoryPolicyConfigValidationTest.java deleted file mode 100644 index 643e154d5dfcb..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/MemoryPolicyConfigValidationTest.java +++ /dev/null @@ -1,407 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache; - -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.configuration.MemoryConfiguration; -import org.apache.ignite.configuration.MemoryPolicyConfiguration; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Test; - -/** - * - */ -public class MemoryPolicyConfigValidationTest extends GridCommonAbstractTest { - /** */ - private static final String VALID_DEFAULT_MEM_PLC_NAME = "valid_dlft_mem_plc"; - - /** */ - private static final String VALID_USER_MEM_PLC_NAME = "valid_user_mem_plc"; - - /** */ - private static final String MISSING_DEFAULT_MEM_PLC_NAME = "missing_mem_plc"; - - /** Configuration violation type to check. */ - private ValidationViolationType violationType; - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(gridName); - - MemoryConfiguration memCfg = new MemoryConfiguration(); - - MemoryPolicyConfiguration[] plcs = null; - - switch (violationType) { - case NAMES_CONFLICT: - plcs = createPlcsWithNamesConflictCfg(); - - break; - - case SYSTEM_MEMORY_POLICY_NAME_MISUSE: - plcs = createPlcWithReservedNameMisuseCfg(); - - break; - - case TOO_SMALL_MEMORY_SIZE: - plcs = createTooSmallMemoryCfg(); - - break; - - case NULL_NAME_ON_USER_DEFINED_POLICY: - plcs = createPlcWithNullName(); - - break; - - case MISSING_USER_DEFINED_DEFAULT: - plcs = createMissingUserDefinedDefault(); - - memCfg.setDefaultMemoryPolicyName(MISSING_DEFAULT_MEM_PLC_NAME); - - break; - - case TOO_SMALL_USER_DEFINED_DFLT_MEM_PLC_SIZE: - memCfg.setDefaultMemoryPolicySize(1); - - break; - - case DEFAULT_SIZE_IS_DEFINED_TWICE: - plcs = createValidUserDefault(); - - memCfg.setDefaultMemoryPolicyName(VALID_DEFAULT_MEM_PLC_NAME); - memCfg.setDefaultMemoryPolicySize(10L * 1014 * 1024); - - break; - - case MAX_SIZE_IS_SMALLER_THAN_INITIAL_SIZE: - plcs = createMaxSizeSmallerThanInitialSize(); - - break; - - case LTE_ZERO_RATE_TIME_INTERVAL: - plcs = createRateTimeIntervalIsNegative(); - - break; - - case LTE_ZERO_SUB_INTERVALS: - plcs = createSubIntervalsIsNegative(); - - break; - - default: - fail("Violation type was not configured: " + violationType); - } - - memCfg.setMemoryPolicies(plcs); - - cfg.setMemoryConfiguration(memCfg); - - return cfg; - } - - /** - * - */ - private MemoryPolicyConfiguration[] createSubIntervalsIsNegative() { - MemoryPolicyConfiguration[] res = new MemoryPolicyConfiguration[1]; - - res[0] = createMemoryPolicy(VALID_DEFAULT_MEM_PLC_NAME, 100L * 1024 * 1024, 100L * 1024 * 1024); - res[0].setSubIntervals(-10); - - return res; - } - - /** - * - */ - private MemoryPolicyConfiguration[] createRateTimeIntervalIsNegative() { - MemoryPolicyConfiguration[] res = new MemoryPolicyConfiguration[1]; - - res[0] = createMemoryPolicy(VALID_DEFAULT_MEM_PLC_NAME, 100L * 1024 * 1024, 100L * 1024 * 1024); - res[0].setRateTimeInterval(-10); - - return res; - } - - /** - * - */ - private MemoryPolicyConfiguration[] createValidUserDefault() { - MemoryPolicyConfiguration[] res = new MemoryPolicyConfiguration[1]; - - res[0] = createMemoryPolicy(VALID_DEFAULT_MEM_PLC_NAME, 100L * 1024 * 1024, 100L * 1024 * 1024); - - return res; - } - - /** - * - */ - private MemoryPolicyConfiguration[] createMissingUserDefinedDefault() { - MemoryPolicyConfiguration[] res = new MemoryPolicyConfiguration[1]; - - res[0] = createMemoryPolicy(VALID_USER_MEM_PLC_NAME, 10L * 1024 * 1024, 10L * 1024 * 1024); - - return res; - } - - /** - * - */ - private MemoryPolicyConfiguration[] createPlcWithNullName() { - MemoryPolicyConfiguration[] res = new MemoryPolicyConfiguration[1]; - - res[0] = createMemoryPolicy(null, 10L * 1024 * 1024, 10L * 1024 * 1024); - - return res; - } - - /** - * - */ - private MemoryPolicyConfiguration[] createTooSmallMemoryCfg() { - MemoryPolicyConfiguration[] res = new MemoryPolicyConfiguration[1]; - - res[0] = createMemoryPolicy(VALID_DEFAULT_MEM_PLC_NAME, 10, 10); - - return res; - } - - /** - * - */ - private MemoryPolicyConfiguration[] createPlcWithReservedNameMisuseCfg() { - MemoryPolicyConfiguration[] res = new MemoryPolicyConfiguration[1]; - - res[0] = createMemoryPolicy("sysMemPlc", 10L * 1024 * 1024, 10L * 1024 * 1024); - - return res; - } - - /** - * - */ - private MemoryPolicyConfiguration[] createPlcsWithNamesConflictCfg() { - MemoryPolicyConfiguration[] res = new MemoryPolicyConfiguration[2]; - - res[0] = createMemoryPolicy("cflt0", 10L * 1024 * 1024, 10L * 1024 * 1024); - res[1] = createMemoryPolicy("cflt0", 10L * 1024 * 1024, 10L * 1024 * 1024); - - return res; - } - - /** - * - */ - private MemoryPolicyConfiguration[] createMaxSizeSmallerThanInitialSize() { - MemoryPolicyConfiguration[] res = new MemoryPolicyConfiguration[1]; - - res[0] = createMemoryPolicy("invalidSize", 100L * 1024 * 1024, 10L * 1024 * 1024); - - return res; - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - super.afterTest(); - - stopAllGrids(); - } - - /** - * @param name Name of MemoryPolicyConfiguration. - * @param initialSize Initial size of MemoryPolicyConfiguration in bytes. - * @param maxSize Max size of MemoryPolicyConfiguration in bytes. - */ - private MemoryPolicyConfiguration createMemoryPolicy(String name, long initialSize, long maxSize) { - MemoryPolicyConfiguration plc = new MemoryPolicyConfiguration(); - - plc.setName(name); - plc.setInitialSize(initialSize); - plc.setMaxSize(maxSize); - - return plc; - } - - /** - * 'sysMemPlc' name is reserved for MemoryPolicyConfiguration for system caches. - */ - @Test - public void testReservedMemoryPolicyMisuse() throws Exception { - violationType = ValidationViolationType.SYSTEM_MEMORY_POLICY_NAME_MISUSE; - - doTest(violationType); - } - - /** - * If user defines default is must be presented among configured memory policies. - */ - @Test - public void testMissingUserDefinedDefault() throws Exception { - violationType = ValidationViolationType.MISSING_USER_DEFINED_DEFAULT; - - doTest(violationType); - } - - /** - * Names of all MemoryPolicies must be distinct. - */ - @Test - public void testNamesConflict() throws Exception { - violationType = ValidationViolationType.NAMES_CONFLICT; - - doTest(violationType); - } - - /** - * User-defined policy must have a non-null non-empty name. - */ - @Test - public void testNullNameOnUserDefinedPolicy() throws Exception { - violationType = ValidationViolationType.NULL_NAME_ON_USER_DEFINED_POLICY; - - doTest(violationType); - } - - /** - * MemoryPolicy must be configured with size of at least 1MB. - */ - @Test - public void testMemoryTooSmall() throws Exception { - violationType = ValidationViolationType.TOO_SMALL_MEMORY_SIZE; - - doTest(violationType); - } - - /** - * MemoryPolicy must be configured with size of at least 1MB. - */ - @Test - public void testMaxSizeSmallerThanInitialSize() throws Exception { - violationType = ValidationViolationType.MAX_SIZE_IS_SMALLER_THAN_INITIAL_SIZE; - - doTest(violationType); - } - - /** - * User-defined size of default MemoryPolicy must be at least 1MB. - */ - @Test - public void testUserDefinedDefaultMemoryTooSmall() throws Exception { - violationType = ValidationViolationType.TOO_SMALL_USER_DEFINED_DFLT_MEM_PLC_SIZE; - - doTest(violationType); - } - - /** - * Defining size of default MemoryPolicy twice with and through defaultMemoryPolicySize property - * and using MemoryPolicyConfiguration description is prohibited. - */ - @Test - public void testDefaultMemoryPolicySizeDefinedTwice() throws Exception { - violationType = ValidationViolationType.DEFAULT_SIZE_IS_DEFINED_TWICE; - - doTest(violationType); - } - - /** - * - */ - @Test - public void testRateTimeIntervalPropertyIsNegative() throws Exception { - violationType = ValidationViolationType.LTE_ZERO_RATE_TIME_INTERVAL; - - doTest(violationType); - } - - /** - * - */ - @Test - public void testSubIntervalsPropertyIsNegative() throws Exception { - violationType = ValidationViolationType.LTE_ZERO_SUB_INTERVALS; - - doTest(violationType); - } - - /** - * Tries to start ignite node with invalid configuration and checks that corresponding exception is thrown. - * - * @param violationType Configuration violation type. - */ - private void doTest(ValidationViolationType violationType) throws Exception { - try { - startGrid(0); - } - catch (IgniteCheckedException e) { - Throwable c = e.getCause(); - - assertTrue(c != null); - assertTrue(c.getMessage().contains(violationType.violationMsg)); - - return; - } - - fail("Expected exception hasn't been thrown"); - } - - /** - * - */ - private enum ValidationViolationType { - /** */ - NAMES_CONFLICT("have the same name"), - - /** */ - SYSTEM_MEMORY_POLICY_NAME_MISUSE("name is reserved for internal use"), - - /** */ - TOO_SMALL_MEMORY_SIZE("must have size more than 10MB"), - - /** */ - NULL_NAME_ON_USER_DEFINED_POLICY("must have non-null and non-empty name"), - - /** */ - MISSING_USER_DEFINED_DEFAULT("name must be presented among configured"), - - /** */ - DEFAULT_SIZE_IS_DEFINED_TWICE("properties are set at the same time."), - - /** */ - TOO_SMALL_USER_DEFINED_DFLT_MEM_PLC_SIZE("must have size more than 10MB"), - - /** */ - MAX_SIZE_IS_SMALLER_THAN_INITIAL_SIZE("must not be smaller than initialSize"), - - /** Case when rateTimeInterval property of MemoryPolicyConfiguration is less than or equals zero. */ - LTE_ZERO_RATE_TIME_INTERVAL("Rate time interval must be greater than zero"), - - /** Case when subIntervals property of MemoryPolicyConfiguration is less than or equals zero. */ - LTE_ZERO_SUB_INTERVALS("Sub intervals must be greater than zero"); - - /** - * @param violationMsg Violation message. - */ - ValidationViolationType(String violationMsg) { - this.violationMsg = violationMsg; - } - - /** */ - String violationMsg; - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicyInitializationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicyInitializationTest.java deleted file mode 100644 index 70f88cbae1103..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicyInitializationTest.java +++ /dev/null @@ -1,324 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.persistence; - -import java.util.Collection; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.configuration.MemoryConfiguration; -import org.apache.ignite.configuration.MemoryPolicyConfiguration; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.processors.cache.GridCacheContext; -import org.apache.ignite.internal.processors.cache.IgniteCacheProxy; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Test; - -import static org.apache.ignite.configuration.MemoryConfiguration.DFLT_MEM_PLC_DEFAULT_NAME; -import static org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor.VOLATILE_DATA_REGION_NAME; - -/** - * - */ -public class MemoryPolicyInitializationTest extends GridCommonAbstractTest { - /** */ - private static final String CUSTOM_NON_DEFAULT_MEM_PLC_NAME = "custom_mem_plc"; - - /** */ - private static final long USER_CUSTOM_MEM_PLC_SIZE = 89L * 1024 * 1024; - - /** */ - private static final long USER_DEFAULT_MEM_PLC_SIZE = 99L * 1024 * 1024; - - /** */ - private MemoryConfiguration memCfg; - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); - - cfg.setMemoryConfiguration(memCfg); - - return cfg; - } - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - memCfg = null; - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - stopAllGrids(); - } - - /** - * Verifies that expected memory policies are allocated when used doesn't provide any MemoryPolicyConfiguration. - */ - @Test - public void testNoConfigProvided() throws Exception { - memCfg = null; - - IgniteEx ignite = startGrid(0); - - Collection allMemPlcs = ignite.context().cache().context().database().dataRegions(); - - assertEquals(3, allMemPlcs.size()); - - verifyDefaultAndSystemMemoryPolicies(allMemPlcs); - } - - /** - * Verifies that expected memory policies are allocated when used provides MemoryPolicyConfiguration - * with non-default custom MemoryPolicy. - */ - @Test - public void testCustomConfigNoDefault() throws Exception { - prepareCustomNoDefaultConfig(); - - IgniteEx ignite = startGrid(0); - - Collection allMemPlcs = ignite.context().cache().context().database().dataRegions(); - - assertEquals(4, allMemPlcs.size()); - - verifyDefaultAndSystemMemoryPolicies(allMemPlcs); - - assertTrue("Custom non-default memory policy is not presented", - isMemoryPolicyPresented(allMemPlcs, CUSTOM_NON_DEFAULT_MEM_PLC_NAME)); - } - - /** - * User is allowed to configure memory policy with 'default' name, - * in that case Ignite instance will use this user-defined memory policy as a default one. - */ - @Test - public void testCustomConfigOverridesDefault() throws Exception { - prepareCustomConfigWithOverridingDefault(); - - IgniteEx ignite = startGrid(0); - - IgniteCacheDatabaseSharedManager dbMgr = ignite.context().cache().context().database(); - - Collection allMemPlcs = dbMgr.dataRegions(); - - assertEquals(3, allMemPlcs.size()); - - verifyDefaultAndSystemMemoryPolicies(allMemPlcs); - - DataRegion dfltMemPlc = U.field(dbMgr, "dfltDataRegion"); - - assertEquals(dfltMemPlc.config().getMaxSize(), USER_DEFAULT_MEM_PLC_SIZE); - } - - /** - * User is allowed to define fully custom memory policy and make it default by setting its name to memory config. - * - * At the same time user still can create a memory policy with name 'default' - * which although won't be used as default. - */ - @Test - public void testCustomConfigOverridesDefaultNameAndDeclaresDefault() throws Exception { - prepareCustomConfigWithOverriddenDefaultName(); - - IgniteEx ignite = startGrid(0); - - IgniteCacheDatabaseSharedManager dbMgr = ignite.context().cache().context().database(); - - Collection allMemPlcs = dbMgr.dataRegions(); - - assertEquals(4, allMemPlcs.size()); - - verifyDefaultAndSystemMemoryPolicies(allMemPlcs); - - DataRegion dfltMemPlc = U.field(dbMgr, "dfltDataRegion"); - - assertEquals(dfltMemPlc.config().getMaxSize(), USER_CUSTOM_MEM_PLC_SIZE); - } - - /** - * Test for verification that caches with not specified memory policy name, - * with specified default memory policy name and specified custom memory policy name - * all started with correct memory policy. - */ - @Test - public void testCachesOnOverriddenMemoryPolicy() throws Exception { - prepareCustomConfigWithOverridingDefaultAndCustom(); - - IgniteEx ignite = startGrid(0); - - CacheConfiguration cache1Cfg = new CacheConfiguration() - .setName("cache1"); - - IgniteCache cache1 = ignite.createCache(cache1Cfg); - - verifyCacheMemoryPolicy(cache1, DFLT_MEM_PLC_DEFAULT_NAME); - - CacheConfiguration cache2Cfg = new CacheConfiguration() - .setName("cache2") - .setMemoryPolicyName(CUSTOM_NON_DEFAULT_MEM_PLC_NAME); - - IgniteCache cache2 = ignite.createCache(cache2Cfg); - - verifyCacheMemoryPolicy(cache2, CUSTOM_NON_DEFAULT_MEM_PLC_NAME); - - CacheConfiguration cache3Cfg = new CacheConfiguration() - .setName("cache3") - .setMemoryPolicyName(DFLT_MEM_PLC_DEFAULT_NAME); - - IgniteCache cache3 = ignite.createCache(cache3Cfg); - - verifyCacheMemoryPolicy(cache3, DFLT_MEM_PLC_DEFAULT_NAME); - } - - /** - * Test for verification that caches with not specified memory policy name, - * with specified default memory policy name and specified custom memory policy name - * all started with correct memory policy. - */ - @Test - public void testCachesOnUserDefinedDefaultMemoryPolicy() throws Exception { - prepareCustomConfigWithOverriddenDefaultName(); - - IgniteEx ignite = startGrid(0); - - CacheConfiguration cache1Cfg = new CacheConfiguration() - .setName("cache1"); - - IgniteCache cache1 = ignite.createCache(cache1Cfg); - - verifyCacheMemoryPolicy(cache1, CUSTOM_NON_DEFAULT_MEM_PLC_NAME); - - CacheConfiguration cache2Cfg = new CacheConfiguration() - .setName("cache2") - .setMemoryPolicyName(CUSTOM_NON_DEFAULT_MEM_PLC_NAME); - - IgniteCache cache2 = ignite.createCache(cache2Cfg); - - verifyCacheMemoryPolicy(cache2, CUSTOM_NON_DEFAULT_MEM_PLC_NAME); - - CacheConfiguration cache3Cfg = new CacheConfiguration() - .setName("cache3") - .setMemoryPolicyName(DFLT_MEM_PLC_DEFAULT_NAME); - - IgniteCache cache3 = ignite.createCache(cache3Cfg); - - verifyCacheMemoryPolicy(cache3, DFLT_MEM_PLC_DEFAULT_NAME); - } - - /** - * @param cache Cache. - * @param plcName Policy name. - */ - private void verifyCacheMemoryPolicy(IgniteCache cache, String plcName) { - GridCacheContext ctx = ((IgniteCacheProxy)cache).context(); - - assertEquals(plcName, ctx.dataRegion().config().getName()); - } - - /** - * - */ - private void prepareCustomConfigWithOverriddenDefaultName() { - memCfg = new MemoryConfiguration(); - - memCfg.setDefaultMemoryPolicyName(CUSTOM_NON_DEFAULT_MEM_PLC_NAME); - - memCfg.setMemoryPolicies(new MemoryPolicyConfiguration() - .setName(CUSTOM_NON_DEFAULT_MEM_PLC_NAME) - .setInitialSize(USER_CUSTOM_MEM_PLC_SIZE) - .setMaxSize(USER_CUSTOM_MEM_PLC_SIZE), - - new MemoryPolicyConfiguration() - .setName(DFLT_MEM_PLC_DEFAULT_NAME) - .setInitialSize(USER_CUSTOM_MEM_PLC_SIZE) - .setMaxSize(USER_DEFAULT_MEM_PLC_SIZE) - ); - } - - /** - * - */ - private void prepareCustomConfigWithOverridingDefault() { - memCfg = new MemoryConfiguration(); - - memCfg.setMemoryPolicies(new MemoryPolicyConfiguration() - .setName(DFLT_MEM_PLC_DEFAULT_NAME) - .setInitialSize(USER_CUSTOM_MEM_PLC_SIZE) - .setMaxSize(USER_DEFAULT_MEM_PLC_SIZE) - ); - } - - /** - * - */ - private void prepareCustomConfigWithOverridingDefaultAndCustom() { - memCfg = new MemoryConfiguration(); - - memCfg.setMemoryPolicies(new MemoryPolicyConfiguration() - .setName(DFLT_MEM_PLC_DEFAULT_NAME) - .setInitialSize(USER_CUSTOM_MEM_PLC_SIZE) - .setMaxSize(USER_DEFAULT_MEM_PLC_SIZE), - - new MemoryPolicyConfiguration() - .setName(CUSTOM_NON_DEFAULT_MEM_PLC_NAME) - .setInitialSize(USER_CUSTOM_MEM_PLC_SIZE) - .setMaxSize(USER_CUSTOM_MEM_PLC_SIZE) - ); - } - - /** - * @param allMemPlcs Collection of all memory policies. - */ - private void verifyDefaultAndSystemMemoryPolicies(Collection allMemPlcs) { - assertTrue("Default memory policy is not presented", - isMemoryPolicyPresented(allMemPlcs, DFLT_MEM_PLC_DEFAULT_NAME)); - - assertTrue("System memory policy is not presented", - isMemoryPolicyPresented(allMemPlcs, IgniteCacheDatabaseSharedManager.SYSTEM_DATA_REGION_NAME)); - - assertTrue("Volatile memory policy is not presented", - isMemoryPolicyPresented(allMemPlcs, VOLATILE_DATA_REGION_NAME)); - } - - /** - * - */ - private void prepareCustomNoDefaultConfig() { - memCfg = new MemoryConfiguration(); - - memCfg.setMemoryPolicies(new MemoryPolicyConfiguration() - .setName(CUSTOM_NON_DEFAULT_MEM_PLC_NAME) - .setInitialSize(USER_CUSTOM_MEM_PLC_SIZE) - .setMaxSize(USER_CUSTOM_MEM_PLC_SIZE) - ); - } - - /** - * @param memPlcs Collection of memory policies. - * @param nameToVerify Excepted name of memory policy. - */ - private boolean isMemoryPolicyPresented(Collection memPlcs, String nameToVerify) { - for (DataRegion memPlc : memPlcs) { - if (nameToVerify.equals(memPlc.config().getName())) - return true; - } - - return false; - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java index 97a6ab93f69e4..b89ea7a0a4df7 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java @@ -58,7 +58,6 @@ import org.apache.ignite.internal.processors.cache.IgniteNearClientCacheCloseTest; import org.apache.ignite.internal.processors.cache.IgniteOnePhaseCommitInvokeTest; import org.apache.ignite.internal.processors.cache.IgniteOnePhaseCommitNearReadersTest; -import org.apache.ignite.internal.processors.cache.MemoryPolicyConfigValidationTest; import org.apache.ignite.internal.processors.cache.NoPresentCacheInterceptorOnClientTest; import org.apache.ignite.internal.processors.cache.NonAffinityCoordinatorDynamicStartStopTest; import org.apache.ignite.internal.processors.cache.RebalanceIteratorLargeEntriesOOMTest; @@ -161,7 +160,6 @@ import org.apache.ignite.internal.processors.cache.distributed.near.NearCacheSyncUpdateTest; import org.apache.ignite.internal.processors.cache.distributed.near.NoneRebalanceModeSelfTest; import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedJobExecutionTest; -import org.apache.ignite.internal.processors.cache.persistence.MemoryPolicyInitializationTest; import org.apache.ignite.internal.processors.continuous.IgniteContinuousQueryMetadataUpdateTest; import org.apache.ignite.internal.processors.continuous.IgniteNoCustomEventsOnNodeStart; import org.apache.ignite.testframework.GridTestUtils; @@ -329,8 +327,6 @@ public static List> suite(Collection ignoredTests) { // Configuration validation GridTestUtils.addTestIfNeeded(suite, CacheConfigurationLeakTest.class, ignoredTests); - GridTestUtils.addTestIfNeeded(suite, MemoryPolicyConfigValidationTest.class, ignoredTests); - GridTestUtils.addTestIfNeeded(suite, MemoryPolicyInitializationTest.class, ignoredTests); GridTestUtils.addTestIfNeeded(suite, CacheGroupLocalConfigurationSelfTest.class, ignoredTests); // Affinity and collocation diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs index ed1b7e20ce231..3ec9bd709d42b 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs @@ -72,26 +72,6 @@ public void FixtureSetUp() }, IgniteInstanceName = CacheName, BinaryConfiguration = new BinaryConfiguration(typeof(Entity)), -#pragma warning disable 618 - MemoryConfiguration = new MemoryConfiguration - { - MemoryPolicies = new[] - { - new MemoryPolicyConfiguration - { - Name = "myMemPolicy", - InitialSize = 77 * 1024 * 1024, - MaxSize = 99 * 1024 * 1024 - }, - new MemoryPolicyConfiguration - { - Name = MemoryConfiguration.DefaultDefaultMemoryPolicyName, - InitialSize = 55 * 1024 * 1024, - MaxSize = 88 * 1024 * 1024 - } - } - }, -#pragma warning restore 618 DataStorageConfiguration = null, SpringConfigUrl = Path.Combine("Config", "cache-default.xml") }; @@ -322,9 +302,6 @@ private static void AssertConfigsAreEqual(CacheConfiguration x, CacheConfigurati Assert.AreEqual(x.WriteBehindFlushFrequency, y.WriteBehindFlushFrequency); Assert.AreEqual(x.WriteBehindFlushSize, y.WriteBehindFlushSize); Assert.AreEqual(x.EnableStatistics, y.EnableStatistics); -#pragma warning disable 618 - Assert.AreEqual(x.MemoryPolicyName, y.MemoryPolicyName); -#pragma warning restore 618 Assert.AreEqual(x.PartitionLossPolicy, y.PartitionLossPolicy); Assert.AreEqual(x.WriteBehindCoalescing, y.WriteBehindCoalescing); Assert.AreEqual(x.GroupName, y.GroupName); @@ -688,9 +665,6 @@ public static CacheConfiguration GetCustomCacheConfiguration(string name = null) }, ExpiryPolicyFactory = new ExpiryFactory(), EnableStatistics = true, -#pragma warning disable 618 - MemoryPolicyName = "myMemPolicy", -#pragma warning restore 618 PartitionLossPolicy = PartitionLossPolicy.ReadOnlySafe, PluginConfigurations = new[] { new MyPluginConfiguration() }, SqlIndexMaxInlineSize = 10000, diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/MemoryMetricsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/MemoryMetricsTest.cs deleted file mode 100644 index b993aa2e935fd..0000000000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/MemoryMetricsTest.cs +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma warning disable 618 -namespace Apache.Ignite.Core.Tests.Cache -{ - using System.Linq; - using Apache.Ignite.Core.Cache; - using Apache.Ignite.Core.Cache.Configuration; - using NUnit.Framework; - - ///

- /// Memory metrics tests. - /// - public class MemoryMetricsTest - { - /** */ - private const string MemoryPolicyWithMetrics = "plcWithMetrics"; - - /** */ - private const string MemoryPolicyNoMetrics = "plcNoMetrics"; - - /// - /// Tests the memory metrics. - /// - [Test] - public void TestMemoryMetrics() - { - var ignite = StartIgniteWithTwoPolicies(); - - // Verify metrics. - var metrics = ignite.GetMemoryMetrics().OrderBy(x => x.Name).ToArray(); - Assert.AreEqual(4, metrics.Length); // two defined plus system and volatile. - - var emptyMetrics = metrics[0]; - Assert.AreEqual(MemoryPolicyNoMetrics, emptyMetrics.Name); - AssertMetricsAreEmpty(emptyMetrics); - - var memMetrics = metrics[1]; - Assert.AreEqual(MemoryPolicyWithMetrics, memMetrics.Name); - Assert.Greater(memMetrics.AllocationRate, 0); - Assert.AreEqual(0, memMetrics.EvictionRate); - Assert.AreEqual(0, memMetrics.LargeEntriesPagesPercentage); - Assert.Greater(memMetrics.PageFillFactor, 0); - Assert.Greater(memMetrics.TotalAllocatedPages, 1000); - - var sysMetrics = metrics[2]; - Assert.AreEqual("sysMemPlc", sysMetrics.Name); - AssertMetricsAreEmpty(sysMetrics); - - var volatileMetrics = metrics[3]; - Assert.AreEqual("volatileDsMemPlc", volatileMetrics.Name); - AssertMetricsAreEmpty(volatileMetrics); - - // Metrics by name. - emptyMetrics = ignite.GetMemoryMetrics(MemoryPolicyNoMetrics); - Assert.AreEqual(MemoryPolicyNoMetrics, emptyMetrics.Name); - AssertMetricsAreEmpty(emptyMetrics); - - memMetrics = ignite.GetMemoryMetrics(MemoryPolicyWithMetrics); - Assert.AreEqual(MemoryPolicyWithMetrics, memMetrics.Name); - Assert.Greater(memMetrics.AllocationRate, 0); - Assert.AreEqual(0, memMetrics.EvictionRate); - Assert.AreEqual(0, memMetrics.LargeEntriesPagesPercentage); - Assert.Greater(memMetrics.PageFillFactor, 0); - Assert.Greater(memMetrics.TotalAllocatedPages, 1000); - - sysMetrics = ignite.GetMemoryMetrics("sysMemPlc"); - Assert.AreEqual("sysMemPlc", sysMetrics.Name); - AssertMetricsAreEmpty(sysMetrics); - - // Invalid name. - Assert.IsNull(ignite.GetMemoryMetrics("boo")); - } - - /// - /// Asserts that metrics are empty. - /// - private static void AssertMetricsAreEmpty(IMemoryMetrics metrics) - { - Assert.AreEqual(0, metrics.AllocationRate); - Assert.AreEqual(0, metrics.EvictionRate); - Assert.AreEqual(0, metrics.LargeEntriesPagesPercentage); - Assert.AreEqual(0, metrics.PageFillFactor); - } - - /// - /// Starts the ignite with two policies. - /// - private static IIgnite StartIgniteWithTwoPolicies() - { - var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration()) - { - DataStorageConfiguration = null, - MemoryConfiguration = new MemoryConfiguration - { - DefaultMemoryPolicyName = MemoryPolicyWithMetrics, - MemoryPolicies = new[] - { - new MemoryPolicyConfiguration - { - Name = MemoryPolicyWithMetrics, - MetricsEnabled = true - }, - new MemoryPolicyConfiguration - { - Name = MemoryPolicyNoMetrics, - MetricsEnabled = false - } - } - } - }; - - var ignite = Ignition.Start(cfg); - - // Create caches and do some things with them. - var cacheNoMetrics = ignite.CreateCache(new CacheConfiguration("cacheNoMetrics") - { - MemoryPolicyName = MemoryPolicyNoMetrics - }); - - cacheNoMetrics.Put(1, 1); - cacheNoMetrics.Get(1); - - var cacheWithMetrics = ignite.CreateCache(new CacheConfiguration("cacheWithMetrics") - { - MemoryPolicyName = MemoryPolicyWithMetrics - }); - - cacheWithMetrics.Put(1, 1); - cacheWithMetrics.Get(1); - - return ignite; - } - - /// - /// Tears down the test. - /// - [TearDown] - public void TearDown() - { - Ignition.StopAll(true); - } - } -} diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTestObsolete.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTestObsolete.cs deleted file mode 100644 index dd3d2e2ccce99..0000000000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTestObsolete.cs +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma warning disable 618 // Obsolete. -namespace Apache.Ignite.Core.Tests.Cache -{ - using System.IO; - using Apache.Ignite.Core.Common; - using Apache.Ignite.Core.PersistentStore; - using NUnit.Framework; - - /// - /// Tests the persistent store. Uses the obsolete API. See for the actual API. - /// - [Category(TestUtils.CategoryIntensive)] - public class PersistentStoreTestObsolete - { - /** Temp dir for WAL. */ - private readonly string _tempDir = PathUtils.GetTempDirectoryName(); - - /// - /// Tears down the test. - /// - [TearDown] - public void TearDown() - { - Ignition.StopAll(true); - - if (Directory.Exists(_tempDir)) - { - Directory.Delete(_tempDir, true); - } - } - - /// - /// Tests that cache data survives node restart. - /// - [Test] - public void TestCacheDataSurvivesNodeRestart() - { - var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration()) - { - PersistentStoreConfiguration = new PersistentStoreConfiguration - { - PersistentStorePath = Path.Combine(_tempDir, "Store"), - WalStorePath = Path.Combine(_tempDir, "WalStore"), - WalArchivePath = Path.Combine(_tempDir, "WalArchive"), - MetricsEnabled = true - }, - DataStorageConfiguration = null - }; - - const string cacheName = "persistentCache"; - - // Start Ignite, put data, stop. - using (var ignite = Ignition.Start(cfg)) - { - ignite.SetActive(true); - - var cache = ignite.CreateCache(cacheName); - - cache[1] = 1; - } - - // Verify directories. - Assert.IsTrue(Directory.Exists(cfg.PersistentStoreConfiguration.PersistentStorePath)); - Assert.IsTrue(Directory.Exists(cfg.PersistentStoreConfiguration.WalStorePath)); - Assert.IsTrue(Directory.Exists(cfg.PersistentStoreConfiguration.WalArchivePath)); - - // Start Ignite, verify data survival. - using (var ignite = Ignition.Start(cfg)) - { - ignite.SetActive(true); - - var cache = ignite.GetCache(cacheName); - - Assert.AreEqual(1, cache[1]); - } - - // Delete store directory. - Directory.Delete(_tempDir, true); - - // Start Ignite, verify data loss. - using (var ignite = Ignition.Start(cfg)) - { - ignite.SetActive(true); - - Assert.IsFalse(ignite.GetCacheNames().Contains(cacheName)); - } - } - - /// - /// Tests the grid activation with persistence (inactive by default). - /// - [Test] - public void TestGridActivationWithPersistence() - { - var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration()) - { - PersistentStoreConfiguration = new PersistentStoreConfiguration(), - DataStorageConfiguration = null - }; - - // Default config, inactive by default (IsActiveOnStart is ignored when persistence is enabled). - using (var ignite = Ignition.Start(cfg)) - { - CheckIsActive(ignite, false); - - ignite.SetActive(true); - CheckIsActive(ignite, true); - - ignite.SetActive(false); - CheckIsActive(ignite, false); - } - } - - /// - /// Tests the grid activation without persistence (active by default). - /// - [Test] - public void TestGridActivationNoPersistence() - { - var cfg = TestUtils.GetTestConfiguration(); - Assert.IsTrue(cfg.IsActiveOnStart); - - using (var ignite = Ignition.Start(cfg)) - { - CheckIsActive(ignite, true); - - ignite.SetActive(false); - CheckIsActive(ignite, false); - - ignite.SetActive(true); - CheckIsActive(ignite, true); - } - - cfg.IsActiveOnStart = false; - - using (var ignite = Ignition.Start(cfg)) - { - CheckIsActive(ignite, false); - - ignite.SetActive(true); - CheckIsActive(ignite, true); - - ignite.SetActive(false); - CheckIsActive(ignite, false); - } - } - - /// - /// Checks active state. - /// - private static void CheckIsActive(IIgnite ignite, bool isActive) - { - Assert.AreEqual(isActive, ignite.IsActive()); - - if (isActive) - { - var cache = ignite.GetOrCreateCache("default"); - cache[1] = 1; - Assert.AreEqual(1, cache[1]); - } - else - { - var ex = Assert.Throws(() => ignite.GetOrCreateCache("default")); - Assert.AreEqual("Can not perform the operation because the cluster is inactive.", - ex.Message.Substring(0, 62)); - } - } - } -} diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/full-config.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/full-config.xml index ba7332f64fa46..1c9b785f10192 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/full-config.xml +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/full-config.xml @@ -128,21 +128,10 @@ - - - - - - someId012 diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs index f20976fcbfdb5..bb2d59d456366 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs @@ -52,15 +52,11 @@ namespace Apache.Ignite.Core.Tests using Apache.Ignite.Core.Failure; using Apache.Ignite.Core.Lifecycle; using Apache.Ignite.Core.Log; - using Apache.Ignite.Core.PersistentStore; using Apache.Ignite.Core.Plugin.Cache; using Apache.Ignite.Core.Tests.Binary; using Apache.Ignite.Core.Tests.Plugin; using Apache.Ignite.Core.Transactions; using NUnit.Framework; - using CheckpointWriteOrder = Apache.Ignite.Core.PersistentStore.CheckpointWriteOrder; - using DataPageEvictionMode = Apache.Ignite.Core.Cache.Configuration.DataPageEvictionMode; - using WalMode = Apache.Ignite.Core.PersistentStore.WalMode; /// /// Tests serialization. @@ -237,26 +233,6 @@ public void TestPredefinedXml() Assert.AreEqual(23.45, eventStorage.ExpirationTimeout.TotalSeconds); Assert.AreEqual(129, eventStorage.MaxEventCount); - var memCfg = cfg.MemoryConfiguration; - Assert.IsNotNull(memCfg); - Assert.AreEqual(3, memCfg.ConcurrencyLevel); - Assert.AreEqual("dfPlc", memCfg.DefaultMemoryPolicyName); - Assert.AreEqual(45, memCfg.PageSize); - Assert.AreEqual(67, memCfg.SystemCacheInitialSize); - Assert.AreEqual(68, memCfg.SystemCacheMaxSize); - - var memPlc = memCfg.MemoryPolicies.Single(); - Assert.AreEqual(1, memPlc.EmptyPagesPoolSize); - Assert.AreEqual(0.2, memPlc.EvictionThreshold); - Assert.AreEqual("dfPlc", memPlc.Name); - Assert.AreEqual(DataPageEvictionMode.RandomLru, memPlc.PageEvictionMode); - Assert.AreEqual("abc", memPlc.SwapFilePath); - Assert.AreEqual(89, memPlc.InitialSize); - Assert.AreEqual(98, memPlc.MaxSize); - Assert.IsTrue(memPlc.MetricsEnabled); - Assert.AreEqual(9, memPlc.SubIntervals); - Assert.AreEqual(TimeSpan.FromSeconds(62), memPlc.RateTimeInterval); - Assert.AreEqual(PeerAssemblyLoadingMode.CurrentAppDomain, cfg.PeerAssemblyLoadingMode); var sql = cfg.SqlConnectorConfiguration; @@ -284,30 +260,6 @@ public void TestPredefinedXml() Assert.AreEqual(20, client.ThinClientConfiguration.MaxActiveTxPerConnection); Assert.AreEqual(21, client.ThinClientConfiguration.MaxActiveComputeTasksPerConnection); - var pers = cfg.PersistentStoreConfiguration; - - Assert.AreEqual(true, pers.AlwaysWriteFullPages); - Assert.AreEqual(TimeSpan.FromSeconds(1), pers.CheckpointingFrequency); - Assert.AreEqual(2, pers.CheckpointingPageBufferSize); - Assert.AreEqual(3, pers.CheckpointingThreads); - Assert.AreEqual(TimeSpan.FromSeconds(4), pers.LockWaitTime); - Assert.AreEqual("foo", pers.PersistentStorePath); - Assert.AreEqual(5, pers.TlbSize); - Assert.AreEqual("bar", pers.WalArchivePath); - Assert.AreEqual(TimeSpan.FromSeconds(6), pers.WalFlushFrequency); - Assert.AreEqual(7, pers.WalFsyncDelayNanos); - Assert.AreEqual(8, pers.WalHistorySize); - Assert.AreEqual(WalMode.None, pers.WalMode); - Assert.AreEqual(9, pers.WalRecordIteratorBufferSize); - Assert.AreEqual(10, pers.WalSegments); - Assert.AreEqual(11, pers.WalSegmentSize); - Assert.AreEqual("baz", pers.WalStorePath); - Assert.IsTrue(pers.MetricsEnabled); - Assert.AreEqual(3, pers.SubIntervals); - Assert.AreEqual(TimeSpan.FromSeconds(6), pers.RateTimeInterval); - Assert.AreEqual(CheckpointWriteOrder.Random, pers.CheckpointWriteOrder); - Assert.IsTrue(pers.WriteThrottlingEnabled); - var listeners = cfg.LocalEventListeners; Assert.AreEqual(2, listeners.Count); @@ -805,7 +757,6 @@ private static IgniteConfiguration GetTestConfig() { new MyPluginConfiguration() }, - MemoryPolicyName = "somePolicy", PartitionLossPolicy = PartitionLossPolicy.ReadOnlyAll, GroupName = "abc", SqlIndexMaxInlineSize = 24, @@ -917,38 +868,6 @@ private static IgniteConfiguration GetTestConfig() ExpirationTimeout = TimeSpan.FromMilliseconds(12345), MaxEventCount = 257 }, - MemoryConfiguration = new MemoryConfiguration - { - ConcurrencyLevel = 3, - DefaultMemoryPolicyName = "somePolicy", - PageSize = 4, - SystemCacheInitialSize = 5, - SystemCacheMaxSize = 6, - MemoryPolicies = new[] - { - new MemoryPolicyConfiguration - { - Name = "myDefaultPlc", - PageEvictionMode = DataPageEvictionMode.Random2Lru, - InitialSize = 245 * 1024 * 1024, - MaxSize = 345 * 1024 * 1024, - EvictionThreshold = 0.88, - EmptyPagesPoolSize = 77, - SwapFilePath = "myPath1", - RateTimeInterval = TimeSpan.FromSeconds(22), - SubIntervals = 99 - }, - new MemoryPolicyConfiguration - { - Name = "customPlc", - PageEvictionMode = DataPageEvictionMode.RandomLru, - EvictionThreshold = 0.77, - EmptyPagesPoolSize = 66, - SwapFilePath = "somePath2", - MetricsEnabled = true - } - } - }, PeerAssemblyLoadingMode = PeerAssemblyLoadingMode.CurrentAppDomain, ClientConnectorConfiguration = new ClientConnectorConfiguration { @@ -970,30 +889,6 @@ private static IgniteConfiguration GetTestConfig() MaxActiveComputeTasksPerConnection = 9 } }, - PersistentStoreConfiguration = new PersistentStoreConfiguration - { - AlwaysWriteFullPages = true, - CheckpointingFrequency = TimeSpan.FromSeconds(25), - CheckpointingPageBufferSize = 28 * 1024 * 1024, - CheckpointingThreads = 2, - LockWaitTime = TimeSpan.FromSeconds(5), - PersistentStorePath = Path.GetTempPath(), - TlbSize = 64 * 1024, - WalArchivePath = Path.GetTempPath(), - WalFlushFrequency = TimeSpan.FromSeconds(3), - WalFsyncDelayNanos = 3, - WalHistorySize = 10, - WalMode = WalMode.Background, - WalRecordIteratorBufferSize = 32 * 1024 * 1024, - WalSegments = 6, - WalSegmentSize = 5 * 1024 * 1024, - WalStorePath = Path.GetTempPath(), - SubIntervals = 25, - MetricsEnabled = true, - RateTimeInterval = TimeSpan.FromDays(1), - CheckpointWriteOrder = CheckpointWriteOrder.Random, - WriteThrottlingEnabled = true - }, IsActiveOnStart = false, ConsistentId = "myId123", LocalEventListeners = new[] diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs index 08955e65b0199..eb805e7c9c394 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs @@ -42,11 +42,9 @@ namespace Apache.Ignite.Core.Tests using Apache.Ignite.Core.Events; using Apache.Ignite.Core.Impl; using Apache.Ignite.Core.Impl.Common; - using Apache.Ignite.Core.PersistentStore; using Apache.Ignite.Core.Tests.Plugin; using Apache.Ignite.Core.Transactions; using NUnit.Framework; - using WalMode = Apache.Ignite.Core.PersistentStore.WalMode; /// /// Tests code-based configuration. @@ -69,7 +67,6 @@ public void FixtureTearDown() public void TestDefaultConfigurationProperties() { CheckDefaultProperties(new IgniteConfiguration()); - CheckDefaultProperties(new PersistentStoreConfiguration()); CheckDefaultProperties(new DataStorageConfiguration()); CheckDefaultProperties(new DataRegionConfiguration()); CheckDefaultProperties(new ClientConnectorConfiguration()); @@ -97,11 +94,8 @@ public void TestDefaultValueAttributes() CheckDefaultValueAttributes(new AtomicConfiguration()); CheckDefaultValueAttributes(new TransactionConfiguration()); CheckDefaultValueAttributes(new MemoryEventStorageSpi()); - CheckDefaultValueAttributes(new MemoryConfiguration()); - CheckDefaultValueAttributes(new MemoryPolicyConfiguration()); CheckDefaultValueAttributes(new SqlConnectorConfiguration()); CheckDefaultValueAttributes(new ClientConnectorConfiguration()); - CheckDefaultValueAttributes(new PersistentStoreConfiguration()); CheckDefaultValueAttributes(new IgniteClientConfiguration()); CheckDefaultValueAttributes(new TransactionClientConfiguration()); CheckDefaultValueAttributes(new QueryIndex()); @@ -565,34 +559,6 @@ private static void CheckDefaultProperties(IgniteConfiguration cfg) Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.QueryThreadPoolSize); } - /// - /// Checks the default properties. - /// - /// Config. - private static void CheckDefaultProperties(PersistentStoreConfiguration cfg) - { - Assert.AreEqual(PersistentStoreConfiguration.DefaultTlbSize, cfg.TlbSize); - Assert.AreEqual(PersistentStoreConfiguration.DefaultCheckpointingFrequency, cfg.CheckpointingFrequency); - Assert.AreEqual(PersistentStoreConfiguration.DefaultCheckpointingThreads, cfg.CheckpointingThreads); - Assert.AreEqual(default(long), cfg.CheckpointingPageBufferSize); - Assert.AreEqual(PersistentStoreConfiguration.DefaultLockWaitTime, cfg.LockWaitTime); - Assert.AreEqual(PersistentStoreConfiguration.DefaultWalFlushFrequency, cfg.WalFlushFrequency); - Assert.AreEqual(PersistentStoreConfiguration.DefaultWalFsyncDelayNanos, cfg.WalFsyncDelayNanos); - Assert.AreEqual(PersistentStoreConfiguration.DefaultWalHistorySize, cfg.WalHistorySize); - Assert.AreEqual(PersistentStoreConfiguration.DefaultWalRecordIteratorBufferSize, - cfg.WalRecordIteratorBufferSize); - Assert.AreEqual(PersistentStoreConfiguration.DefaultWalSegmentSize, cfg.WalSegmentSize); - Assert.AreEqual(PersistentStoreConfiguration.DefaultWalSegments, cfg.WalSegments); - Assert.AreEqual(WalMode.Default, cfg.WalMode); - 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); - Assert.AreEqual(PersistentStoreConfiguration.DefaultCheckpointWriteOrder, cfg.CheckpointWriteOrder); - Assert.AreEqual(PersistentStoreConfiguration.DefaultWriteThrottlingEnabled, cfg.WriteThrottlingEnabled); - } - /// /// Checks the default properties. /// diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs index 56681cf7457fe..ef71ba04a47c9 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs @@ -827,18 +827,6 @@ internal void Validate(ILogger log) [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public ICollection PluginConfigurations { get; set; } - /// - /// Gets or sets the name of the for this cache. - /// See . - /// - [Obsolete("Use DataRegionName.")] - [XmlIgnore] - public string MemoryPolicyName - { - get { return DataRegionName; } - set { DataRegionName = value; } - } - /// /// Gets or sets the name of the data region, see . /// diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/DataPageEvictionMode.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/DataPageEvictionMode.cs deleted file mode 100644 index 57e60d9df2fe0..0000000000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/DataPageEvictionMode.cs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -namespace Apache.Ignite.Core.Cache.Configuration -{ - using System; - - /// - /// Memory page eviction mode. - /// Only data pages, that store key-value entries, are eligible for eviction. - /// The other types of pages, like index or system pages, are not evictable. - /// - [Obsolete("Use Apache.Ignite.Core.Configuration.DataPageEvictionMode")] - public enum DataPageEvictionMode - { - /// - /// Eviction is disabled. - /// - Disabled, - - /// - /// Random-LRU algorithm. - /// - /// Once a memory region defined by a memory policy is configured, an off-heap array is allocated to track - /// last usage timestamp for every individual data page. The size of the array equals to - /// / . - /// - /// When a data page is accessed, its timestamp gets updated in the tracking array. The page index in the - /// tracking array equals to pageAddress / . - /// - /// When some pages need to be evicted, the algorithm randomly chooses 5 indexes from the tracking array and - /// evicts a page with the latest timestamp. If some of the indexes point to non-data pages - /// (index or system pages) then the algorithm picks other pages. - /// - RandomLru, - - /// - /// Activates Random-2-LRU algorithm which is a scan resistant version of Random-LRU. - /// - /// This algorithm differs from Random-LRU only in a way that two latest access timestamps are stored for every - /// data page. At the eviction time, a minimum between two latest timestamps is taken for further - /// comparison with minimums of other pages that might be evicted. LRU-2 outperforms LRU by - /// resolving "one-hit wonder" problem - if a data page is accessed rarely, but accidentally accessed once, - /// its protected from eviction for a long time. - /// - Random2Lru - } -} \ No newline at end of file diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryConfiguration.cs deleted file mode 100644 index c735b3c3960cf..0000000000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryConfiguration.cs +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -namespace Apache.Ignite.Core.Cache.Configuration -{ - using System; - using System.Collections.Generic; - using System.ComponentModel; - using System.Diagnostics; - using System.Diagnostics.CodeAnalysis; - using System.Linq; - using Apache.Ignite.Core.Binary; - using Apache.Ignite.Core.Common; - using Apache.Ignite.Core.Configuration; - using Apache.Ignite.Core.Impl.Common; - - /// - /// A page memory configuration for an Apache Ignite node. The page memory is a manageable off-heap based - /// memory architecture that divides all continuously allocated memory regions into pages of fixed size. - /// An individual page can store one or many cache key-value entries that allows reusing the memory - /// in the most efficient way and avoid memory fragmentation issues. - /// - /// By default, the page memory allocates a single continuous memory region. All the caches that - /// will be configured in an application will be mapped to this memory region by default, - /// thus, all the cache data will reside in that memory region. - /// - /// If initial size of the default memory region doesn't satisfy requirements or it's - /// required to have multiple memory regions with different properties - /// then can be used for both scenarios. - /// For instance, using memory policies you can define memory regions of different maximum size, - /// eviction policies, swapping options, etc. Once you define a new memory region you can bind - /// particular Ignite caches to it. - /// To learn more about memory policies refer to documentation. - /// - /// Obsolete, use . - /// - [Obsolete("Use DataStorageConfiguration.")] - public class MemoryConfiguration - { - /// - /// Default size of a memory chunk reserved for system cache initially. - /// - public const long DefaultSystemCacheInitialSize = 40 * 1024 * 1024; - - /// - /// Default max size of a memory chunk for the system cache. - /// - public const long DefaultSystemCacheMaxSize = 100 * 1024 * 1024; - - /// - /// The default page size. - /// - public const int DefaultPageSize = 4 * 1024; - - /// - /// The default value for . - /// - public const string DefaultDefaultMemoryPolicyName = "default"; - - /// - /// Initializes a new instance of the class. - /// - public MemoryConfiguration() - { - SystemCacheInitialSize = DefaultSystemCacheInitialSize; - SystemCacheMaxSize = DefaultSystemCacheMaxSize; - PageSize = DefaultPageSize; - DefaultMemoryPolicyName = DefaultDefaultMemoryPolicyName; - } - - /// - /// Initializes a new instance of the class. - /// - /// The reader. - public MemoryConfiguration(IBinaryRawReader reader) // Should be internal. - { - IgniteArgumentCheck.NotNull(reader, "reader"); - - SystemCacheInitialSize = reader.ReadLong(); - SystemCacheMaxSize = reader.ReadLong(); - PageSize = reader.ReadInt(); - ConcurrencyLevel = reader.ReadInt(); - DefaultMemoryPolicyName = reader.ReadString(); - - var count = reader.ReadInt(); - - if (count > 0) - { - MemoryPolicies = Enumerable.Range(0, count) - .Select(x => new MemoryPolicyConfiguration(reader)) - .ToArray(); - } - } - - /// - /// Writes this instance to a writer. - /// - /// The writer. - internal void Write(IBinaryRawWriter writer) - { - Debug.Assert(writer != null); - - writer.WriteLong(SystemCacheInitialSize); - writer.WriteLong(SystemCacheMaxSize); - writer.WriteInt(PageSize); - writer.WriteInt(ConcurrencyLevel); - writer.WriteString(DefaultMemoryPolicyName); - - if (MemoryPolicies != null) - { - writer.WriteInt(MemoryPolicies.Count); - - foreach (var policy in MemoryPolicies) - { - if (policy == null) - { - throw new IgniteException("MemoryConfiguration.MemoryPolicies must not contain null items."); - } - - policy.Write(writer); - } - } - else - { - writer.WriteInt(0); - } - } - - /// - /// Gets or sets the size of a memory chunk reserved for system cache needs. - /// - [DefaultValue(DefaultSystemCacheInitialSize)] - public long SystemCacheInitialSize { get; set; } - - /// - /// Gets or sets the maximum memory region size reserved for system cache. - /// - [DefaultValue(DefaultSystemCacheMaxSize)] - public long SystemCacheMaxSize { get; set; } - - /// - /// Gets or sets the size of the memory page. - /// - [DefaultValue(DefaultPageSize)] - public int PageSize { get; set; } - - /// - /// Gets or sets the number of concurrent segments in Ignite internal page mapping tables. - /// - public int ConcurrencyLevel { get;set; } - - /// - /// Gets or sets the name of the default memory policy in . - /// - [DefaultValue(DefaultDefaultMemoryPolicyName)] - public string DefaultMemoryPolicyName { get; set; } - - /// - /// Gets or sets the memory policies. - /// - [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] - public ICollection MemoryPolicies { get; set; } - } -} diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryPolicyConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryPolicyConfiguration.cs deleted file mode 100644 index 00e66476d7b61..0000000000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryPolicyConfiguration.cs +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -namespace Apache.Ignite.Core.Cache.Configuration -{ - using System; - using System.ComponentModel; - using System.Diagnostics.CodeAnalysis; - using Apache.Ignite.Core.Binary; - using Apache.Ignite.Core.Configuration; - using Apache.Ignite.Core.Impl; - using Apache.Ignite.Core.Impl.Binary; - - /// - /// Defines page memory policy configuration. See . - /// Obsolete, use . - /// - [Obsolete("Use DataRegionConfiguration.")] - public class MemoryPolicyConfiguration - { - /// - /// The default eviction threshold. - /// - public const double DefaultEvictionThreshold = 0.9; - - /// - /// The default empty pages pool size. - /// - public const int DefaultEmptyPagesPoolSize = 100; - - /// - /// The default initial size. - /// - public const long DefaultInitialSize = 256 * 1024 * 1024; - - /// - /// The default maximum size, equals to 20% of total RAM. - /// - public static readonly long DefaultMaxSize = - (long) ((long) (MemoryInfo.MemoryLimit ?? 2048L * 1024 * 1024) * 0.2); - - /// - /// The default sub intervals. - /// - [SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", - Justification = "Consistency with Java config")] - public const int DefaultSubIntervals = 5; - - /// - /// The default rate time interval. - /// - public static readonly TimeSpan DefaultRateTimeInterval = TimeSpan.FromSeconds(60); - - /// - /// Initializes a new instance of the class. - /// - public MemoryPolicyConfiguration() - { - EvictionThreshold = DefaultEvictionThreshold; - EmptyPagesPoolSize = DefaultEmptyPagesPoolSize; - Name = MemoryConfiguration.DefaultDefaultMemoryPolicyName; - InitialSize = DefaultInitialSize; - MaxSize = DefaultMaxSize; - SubIntervals = DefaultSubIntervals; - RateTimeInterval = DefaultRateTimeInterval; - } - - /// - /// Initializes a new instance of the class. - /// - /// The reader. - internal MemoryPolicyConfiguration(IBinaryRawReader reader) - { - Name = reader.ReadString(); - InitialSize = reader.ReadLong(); - MaxSize = reader.ReadLong(); - SwapFilePath = reader.ReadString(); - PageEvictionMode = (DataPageEvictionMode) reader.ReadInt(); - EvictionThreshold = reader.ReadDouble(); - EmptyPagesPoolSize = reader.ReadInt(); - MetricsEnabled = reader.ReadBoolean(); - SubIntervals = reader.ReadInt(); - RateTimeInterval = reader.ReadLongAsTimespan(); - } - - /// - /// Writes this instance to a writer. - /// - internal void Write(IBinaryRawWriter writer) - { - writer.WriteString(Name); - writer.WriteLong(InitialSize); - writer.WriteLong(MaxSize); - writer.WriteString(SwapFilePath); - writer.WriteInt((int) PageEvictionMode); - writer.WriteDouble(EvictionThreshold); - writer.WriteInt(EmptyPagesPoolSize); - writer.WriteBoolean(MetricsEnabled); - writer.WriteInt(SubIntervals); - writer.WriteTimeSpanAsLong(RateTimeInterval); - } - - /// - /// Gets or sets the memory policy name. - /// Defaults to . - /// - [DefaultValue(MemoryConfiguration.DefaultDefaultMemoryPolicyName)] - public string Name { get; set; } - - /// - /// Gets or sets initial memory region size defined by this memory policy. - /// When the used memory size exceeds this value, new chunks of memory will be allocated. - /// - [DefaultValue(DefaultInitialSize)] - public long InitialSize { get; set; } - - /// - /// Sets maximum memory region size defined by this memory policy. The total size should not be less - /// than 10 MB due to internal data structures overhead. - /// - public long MaxSize { get; set; } - - /// - /// Gets or sets the the path to the memory-mapped file the memory region defined by this memory policy - /// will be mapped to. Having the path set, allows relying on swapping capabilities of an underlying - /// operating system for the memory region. - /// - /// Null for no swap. - /// - public string SwapFilePath { get; set; } - - /// - /// Gets or sets the page eviction mode. If is used (default) - /// then an out of memory exception will be thrown if the memory region usage, - /// defined by this memory policy, goes beyond . - /// - public DataPageEvictionMode PageEvictionMode { get; set; } - - /// - /// Gets or sets the threshold for memory pages eviction initiation. For instance, if the threshold is 0.9 - /// it means that the page memory will start the eviction only after 90% of the memory region - /// (defined by this policy) is occupied. - /// - [DefaultValue(DefaultEvictionThreshold)] - public double EvictionThreshold { get; set; } - - /// - /// Gets or sets the minimal number of empty pages to be present in reuse lists for this memory policy. - /// This parameter ensures that Ignite will be able to successfully evict old data entries when the size of - /// (key, value) pair is slightly larger than page size / 2. - /// Increase this parameter if cache can contain very big entries (total size of pages in this pool - /// should be enough to contain largest cache entry). - /// - [DefaultValue(DefaultEmptyPagesPoolSize)] - public int EmptyPagesPoolSize { get;set; } - - /// - /// Gets or sets a value indicating whether memory metrics should be enabled. - /// - /// Metrics can be retrieved with method. - /// - public bool MetricsEnabled { get; set; } - - /// - /// Gets or sets the rate time interval for - /// and monitoring purposes. - /// - /// For instance, after setting the interval to 60 seconds, subsequent calls - /// to will return average allocation - /// rate (pages per second) for the last minute. - /// - [DefaultValue(typeof(TimeSpan), "00:01:00")] - public TimeSpan RateTimeInterval { get; set; } - - /// - /// Gets or sets the number of sub intervals to split into to calculate - /// and . - /// - /// Bigger value results in more accurate metrics. - /// - [DefaultValue(DefaultSubIntervals)] - [SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", - Justification = "Consistency with Java config")] - public int SubIntervals { get; set; } - } -} diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/DataStorageConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/DataStorageConfiguration.cs index 81d1b91e429ba..8d31e48045d0b 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/DataStorageConfiguration.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/DataStorageConfiguration.cs @@ -447,7 +447,7 @@ internal void Write(IBinaryRawWriter writer) /// /// Gets or sets a value indicating whether to enable data storage metrics. - /// See . + /// See . /// public bool MetricsEnabled { get; set; } diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs index dd72c71a94ee0..5be2d62d95bbd 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs @@ -393,28 +393,6 @@ ICache GetOrCreateNearCache(string name, NearCacheConfiguration /// Names of caches to reset partitions for. void ResetLostPartitions(params string[] cacheNames); - /// - /// Gets a collection of memory metrics, one for each . - /// - /// Memory metrics should be enabled with . - /// - /// Obsolete, use . - /// - [Obsolete("Use GetDataRegionMetrics.")] - ICollection GetMemoryMetrics(); - - /// - /// Gets the memory metrics for the specified memory policy. - /// - /// To get metrics for the default memory region, - /// use . - /// - /// Obsolete, use . - /// - /// Name of the memory policy. - [Obsolete("Use GetDataRegionMetrics.")] - IMemoryMetrics GetMemoryMetrics(string memoryPolicyName); - /// /// Changes Ignite grid state to active or inactive. /// diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs index cd252fa1c33f7..401500d5255d2 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs @@ -49,7 +49,6 @@ namespace Apache.Ignite.Core using Apache.Ignite.Core.Impl.Ssl; using Apache.Ignite.Core.Lifecycle; using Apache.Ignite.Core.Log; - using Apache.Ignite.Core.PersistentStore; using Apache.Ignite.Core.Plugin; using Apache.Ignite.Core.Ssl; using Apache.Ignite.Core.Transactions; @@ -500,18 +499,6 @@ internal void Write(BinaryWriter writer) memEventStorage.Write(writer); } -#pragma warning disable 618 // Obsolete - if (MemoryConfiguration != null) - { - writer.WriteBoolean(true); - MemoryConfiguration.Write(writer); - } - else - { - writer.WriteBoolean(false); - } -#pragma warning restore 618 - // SQL connector. #pragma warning disable 618 // Obsolete if (SqlConnectorConfiguration != null) @@ -538,19 +525,6 @@ internal void Write(BinaryWriter writer) writer.WriteBoolean(ClientConnectorConfigurationEnabled); - // Persistence. -#pragma warning disable 618 // Obsolete - if (PersistentStoreConfiguration != null) - { - writer.WriteBoolean(true); - PersistentStoreConfiguration.Write(writer); - } - else - { - writer.WriteBoolean(false); - } -#pragma warning restore 618 - // Data storage. if (DataStorageConfiguration != null) { @@ -819,13 +793,6 @@ private void ReadCore(BinaryReader r) break; } - if (r.ReadBoolean()) - { -#pragma warning disable 618 // Obsolete - MemoryConfiguration = new MemoryConfiguration(r); -#pragma warning restore 618 // Obsolete - } - // SQL. if (r.ReadBoolean()) { @@ -842,14 +809,6 @@ private void ReadCore(BinaryReader r) ClientConnectorConfigurationEnabled = r.ReadBoolean(); - // Persistence. - if (r.ReadBoolean()) - { -#pragma warning disable 618 // Obsolete - PersistentStoreConfiguration = new PersistentStoreConfiguration(r); -#pragma warning restore 618 - } - // Data storage. if (r.ReadBoolean()) { @@ -1416,15 +1375,6 @@ public TimeSpan ClientFailureDetectionTimeout /// public IEventStorageSpi EventStorageSpi { get; set; } - /// - /// Gets or sets the page memory configuration. - /// for more details. - /// - /// Obsolete, use . - /// - [Obsolete("Use DataStorageConfiguration.")] - public MemoryConfiguration MemoryConfiguration { get; set; } - /// /// Gets or sets the data storage configuration. /// @@ -1564,14 +1514,6 @@ public TimeSpan LongQueryWarningTimeout set { _longQueryWarningTimeout = value; } } - /// - /// Gets or sets the persistent store configuration. - /// - /// Obsolete, use . - /// - [Obsolete("Use DataStorageConfiguration.")] - public PersistentStoreConfiguration PersistentStoreConfiguration { get; set; } - /// /// Gets or sets a value indicating whether grid should be active on start. /// See also and . diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd index 9dd4779dd9925..b08004c1f580d 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd +++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd @@ -1399,103 +1399,6 @@ - - - Page memory configuration. - - - - - - Memory policies. - - - - - - - - Minimal number of empty pages to be present in reuse lists for this memory policy. - - - - - Threshold for memory pages eviction initiation. For instance, if the threshold is 0.9 it means that the page memory will start the eviction only after 90% of the memory region (defined by this policy) is occupied. - - - - - Memory policy name. - - - - - Page eviction mode. - - - - - Initial memory region size defined by this memory policy. - - - - - Maximum memory region size defined by this memory policy. - - - - - Path to the memory-mapped file the memory region defined by this memory policy will be mapped to. - - - - - Enable memory metrics. - - - - - Number of sub intervals to split RateTimeInterval into. - - - - - Rate time interval for AllocationRate and EvictionRate monitoring. - - - - - - - - - - - Number of concurrent segments in Ignite internal page mapping tables. - - - - - Name of the default memory policy in MemoryPolicies. - - - - - Size of the memory page. - - - - - Initial size of a memory chunk reserved for system cache needs. - - - - - Maximum size of a memory chunk reserved for system cache needs. - - - - SQL connector configuration (JDBC and ODBC). @@ -1639,118 +1542,6 @@ - - - Persistent store configuration. Obsolete, use DataStorageConfiguration. - - - - - Path where data and indexes will be persisted. - - - - - Checkpointing frequency which is a minimal interval when the dirty pages will be written to the Persistent Store. - - - - - Size of the checkpointing page buffer. - - - - - Number of threads for checkpointing. - - - - - Persistent manager file lock wait time. - - - - - Number of checkpoints to store in WAL (Write Ahead Log) history. - - - - - Number of WAL (Write Ahead Log) segments to work with. - - - - - Size of the WAL (Write Ahead Log) segment. - - - - - Path to the directory where WAL (Write Ahead Log) is stored. - - - - - Path to the directory where WAL (Write Ahead Log) archive is stored. - - - - - WAL (Write Ahead Log) mode. - - - - - Size of the TLB (Thread-Local Buffer), in bytes. - - - - - WAL (Write Ahead Log) flush frequency. - - - - - WAL (Write Ahead Log) fsync (disk sync) delay, in nanoseconds. - - - - - Size of the WAL (Write Ahead Log) record iterator buffer, in bytes. - - - - - Whether full pages should always be written. - - - - - Enable persistent store metrics. - - - - - Number of sub intervals to split RateTimeInterval into. - - - - - Rate time interval. - - - - - Checkpoint page write order on disk. - - - - - Threads that generate dirty pages too fast during ongoing checkpoint will be throttled. - - - - Data storage configuration. diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/PersistentStoreConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/PersistentStoreConfiguration.cs deleted file mode 100644 index aec4c3ae549b1..0000000000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/PersistentStoreConfiguration.cs +++ /dev/null @@ -1,335 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -namespace Apache.Ignite.Core.PersistentStore -{ - using System; - using System.ComponentModel; - using System.Diagnostics; - using System.Diagnostics.CodeAnalysis; - using Apache.Ignite.Core.Binary; - using Apache.Ignite.Core.Configuration; - using Apache.Ignite.Core.Impl.Binary; - - /// - /// Configures Apache Ignite persistent store. - /// - /// Obsolete, use . - /// - [Obsolete("Use DataStorageConfiguration.")] - public class PersistentStoreConfiguration - { - /// - /// Default value for . - /// - public const int DefaultCheckpointingThreads = 4; - - /// - /// Default value for . - /// - public static readonly TimeSpan DefaultCheckpointingFrequency = TimeSpan.FromSeconds(180); - - /// - /// Default value for . - /// - public static readonly TimeSpan DefaultLockWaitTime = TimeSpan.FromSeconds(10); - - /// - /// Default value for . - /// - public const int DefaultWalHistorySize = 20; - - /// - /// Default value for . - /// - public const int DefaultWalSegments = 10; - - /// - /// Default value for . - /// - public const int DefaultWalSegmentSize = 64 * 1024 * 1024; - - /// - /// Default value for . - /// - public const int DefaultTlbSize = 128 * 1024; - - /// - /// Default value for . - /// - public static readonly TimeSpan DefaultWalFlushFrequency = TimeSpan.FromSeconds(2); - - /// - /// Default value for . - /// - public const int DefaultWalRecordIteratorBufferSize = 64 * 1024 * 1024; - - /// - /// Default value for . - /// - public const long DefaultWalFsyncDelayNanos = 1000; - - /// - /// The default sub intervals. - /// - [SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", - Justification = "Consistency with Java config")] - public const int DefaultSubIntervals = 5; - - /// - /// The default rate time interval. - /// - public static readonly TimeSpan DefaultRateTimeInterval = TimeSpan.FromSeconds(60); - - /// - /// Default value for . - /// - public const string DefaultWalStorePath = "db/wal"; - - /// - /// Default value for . - /// - public const string DefaultWalArchivePath = "db/wal/archive"; - - /// - /// Default value for . - /// - public const CheckpointWriteOrder DefaultCheckpointWriteOrder = CheckpointWriteOrder.Sequential; - - /// - /// Default value for . - /// - public const bool DefaultWriteThrottlingEnabled = false; - - /// - /// Initializes a new instance of the class. - /// - public PersistentStoreConfiguration() - { - CheckpointingThreads = DefaultCheckpointingThreads; - CheckpointingFrequency = DefaultCheckpointingFrequency; - LockWaitTime = DefaultLockWaitTime; - WalHistorySize = DefaultWalHistorySize; - WalSegments = DefaultWalSegments; - WalSegmentSize = DefaultWalSegmentSize; - TlbSize = DefaultTlbSize; - WalFlushFrequency = DefaultWalFlushFrequency; - WalRecordIteratorBufferSize = DefaultWalRecordIteratorBufferSize; - WalFsyncDelayNanos = DefaultWalFsyncDelayNanos; - RateTimeInterval = DefaultRateTimeInterval; - SubIntervals = DefaultSubIntervals; - WalArchivePath = DefaultWalArchivePath; - WalStorePath = DefaultWalStorePath; - CheckpointWriteOrder = DefaultCheckpointWriteOrder; - WriteThrottlingEnabled = DefaultWriteThrottlingEnabled; - } - - /// - /// Initializes a new instance of the class. - /// - /// The reader. - internal PersistentStoreConfiguration(IBinaryRawReader reader) - { - Debug.Assert(reader != null); - - PersistentStorePath = reader.ReadString(); - CheckpointingFrequency = reader.ReadLongAsTimespan(); - CheckpointingPageBufferSize = reader.ReadLong(); - CheckpointingThreads = reader.ReadInt(); - LockWaitTime = reader.ReadLongAsTimespan(); - WalHistorySize = reader.ReadInt(); - WalSegments = reader.ReadInt(); - WalSegmentSize = reader.ReadInt(); - WalStorePath = reader.ReadString(); - WalArchivePath = reader.ReadString(); - WalMode = (WalMode)reader.ReadInt(); - TlbSize = reader.ReadInt(); - WalFlushFrequency = reader.ReadLongAsTimespan(); - WalFsyncDelayNanos = reader.ReadLong(); - WalRecordIteratorBufferSize = reader.ReadInt(); - AlwaysWriteFullPages = reader.ReadBoolean(); - MetricsEnabled = reader.ReadBoolean(); - SubIntervals = reader.ReadInt(); - RateTimeInterval = reader.ReadLongAsTimespan(); - CheckpointWriteOrder = (CheckpointWriteOrder) reader.ReadInt(); - WriteThrottlingEnabled = reader.ReadBoolean(); - } - - /// - /// Writes this instance to the specified writer. - /// - /// The writer. - internal void Write(IBinaryRawWriter writer) - { - Debug.Assert(writer != null); - - writer.WriteString(PersistentStorePath); - writer.WriteTimeSpanAsLong(CheckpointingFrequency); - writer.WriteLong(CheckpointingPageBufferSize); - writer.WriteInt(CheckpointingThreads); - writer.WriteTimeSpanAsLong(LockWaitTime); - writer.WriteInt(WalHistorySize); - writer.WriteInt(WalSegments); - writer.WriteInt(WalSegmentSize); - writer.WriteString(WalStorePath); - writer.WriteString(WalArchivePath); - writer.WriteInt((int)WalMode); - writer.WriteInt(TlbSize); - writer.WriteTimeSpanAsLong(WalFlushFrequency); - writer.WriteLong(WalFsyncDelayNanos); - writer.WriteInt(WalRecordIteratorBufferSize); - writer.WriteBoolean(AlwaysWriteFullPages); - writer.WriteBoolean(MetricsEnabled); - writer.WriteInt(SubIntervals); - writer.WriteTimeSpanAsLong(RateTimeInterval); - writer.WriteInt((int) CheckpointWriteOrder); - writer.WriteBoolean(WriteThrottlingEnabled); - } - - /// - /// Gets or sets the path where data and indexes will be persisted. - /// - public string PersistentStorePath { get; set; } - - /// - /// Gets or sets the checkpointing frequency which is a minimal interval when the dirty pages will be written - /// to the Persistent Store. - /// - [DefaultValue(typeof(TimeSpan), "00:03:00")] - public TimeSpan CheckpointingFrequency { get; set; } - - /// - /// Gets or sets the size of the checkpointing page buffer. - /// - /// Default is 0: Ignite will choose buffer size automatically. - /// - public long CheckpointingPageBufferSize { get; set; } - - /// - /// Gets or sets the number of threads for checkpointing. - /// - [DefaultValue(DefaultCheckpointingThreads)] - public int CheckpointingThreads { get; set; } - - /// - /// Gets or sets the persistent manager file lock wait time. - /// - [DefaultValue(typeof(TimeSpan), "00:00:10")] - public TimeSpan LockWaitTime { get; set; } - - /// - /// Gets or sets the number of checkpoints to store in WAL (Write Ahead Log) history. - /// - [DefaultValue(DefaultWalHistorySize)] - public int WalHistorySize { get; set; } - - /// - /// Gets or sets a number of WAL (Write Ahead Log) segments to work with. - /// For performance reasons, the whole WAL is split into files of fixed length called segments. - /// - [DefaultValue(DefaultWalSegments)] - public int WalSegments { get; set; } - - /// - /// Gets or sets the size of the WAL (Write Ahead Log) segment. - /// For performance reasons, the whole WAL is split into files of fixed length called segments. - /// - [DefaultValue(DefaultWalSegmentSize)] - public int WalSegmentSize { get; set; } - - /// - /// Gets or sets the path to the directory where WAL (Write Ahead Log) is stored. - /// - [DefaultValue(DefaultWalStorePath)] - public string WalStorePath { get; set; } - - /// - /// 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. - /// - [DefaultValue(DefaultWalArchivePath)] - public string WalArchivePath { get; set; } - - /// - /// Gets or sets the WAL (Write Ahead Log) mode. - /// - public WalMode WalMode { get; set; } - - /// - /// Gets or sets the size of the TLB (Thread-Local Buffer), in bytes. - /// - [DefaultValue(DefaultTlbSize)] - public int TlbSize { get; set; } - - /// - /// Gets or sets the WAL (Write Ahead Log) flush frequency. - /// - [DefaultValue(typeof(TimeSpan), "00:00:02")] - public TimeSpan WalFlushFrequency { get; set; } - - /// - /// Gets or sets the WAL (Write Ahead Log) fsync (disk sync) delay, in nanoseconds - /// - [DefaultValue(DefaultWalFsyncDelayNanos)] - public long WalFsyncDelayNanos { get; set; } - - /// - /// Gets or sets the size of the WAL (Write Ahead Log) record iterator buffer, in bytes. - /// - [DefaultValue(DefaultWalRecordIteratorBufferSize)] - public int WalRecordIteratorBufferSize { get; set; } - - /// - /// Gets or sets a value indicating whether full pages should always be written. - /// - public bool AlwaysWriteFullPages { get; set; } - - /// - /// Gets or sets a value indicating whether to enable persistent store metrics. - /// See . - /// - public bool MetricsEnabled { get; set; } - - /// - /// Gets or sets the length of the time interval for rate-based metrics. - /// This interval defines a window over which hits will be tracked. - /// - [DefaultValue(typeof(TimeSpan), "00:01:00")] - public TimeSpan RateTimeInterval { get; set; } - - /// - /// Number of sub-intervals to split the into to track the update history. - /// - [DefaultValue(DefaultSubIntervals)] - [SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", - Justification = "Consistency with Java config")] - public int SubIntervals { get; set; } - - /// - /// Gets or sets the checkpoint page write order on disk. - /// - [DefaultValue(DefaultCheckpointWriteOrder)] - public CheckpointWriteOrder CheckpointWriteOrder { get; set; } - - /// - /// Gets or sets a value indicating whether threads that generate dirty - /// pages too fast during ongoing checkpoint will be throttled. - /// - [DefaultValue(DefaultWriteThrottlingEnabled)] - public bool WriteThrottlingEnabled { get; set; } - } -}