You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/12/03 11:38:15 UTC

[GitHub] [ignite] RodionSmolnikovGG commented on a change in pull request #9612: IGNITE-15998 Add separate configuration for system data region.

RodionSmolnikovGG commented on a change in pull request #9612:
URL: https://github.com/apache/ignite/pull/9612#discussion_r761267422



##########
File path: modules/platforms/dotnet/Apache.Ignite.Core/Configuration/DataStorageConfiguration.cs
##########
@@ -478,13 +491,37 @@ internal void Write(IBinaryRawWriter writer)
         /// Gets or sets the size of a memory chunk reserved for system needs.
         /// </summary>
         [DefaultValue(DefaultSystemRegionInitialSize)]
-        public long SystemRegionInitialSize { get; set; }

Review comment:
       Should we mark this getter and setter as "Deprecated"?

##########
File path: modules/platforms/dotnet/Apache.Ignite.Core/Configuration/SystemDataRegionConfiguration.cs
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.Configuration
+{
+    using System.ComponentModel;
+    using System.Diagnostics;
+    using Apache.Ignite.Core.Binary;
+
+    /// <summary>
+    /// Data storage configuration for system cache.
+    /// </summary>
+    public class SystemDataRegionConfiguration

Review comment:
       Is there any tests on C#? Can this changes be checked by auto tests?

##########
File path: modules/platforms/dotnet/Apache.Ignite.Core/Configuration/DataStorageConfiguration.cs
##########
@@ -478,13 +491,37 @@ internal void Write(IBinaryRawWriter writer)
         /// Gets or sets the size of a memory chunk reserved for system needs.
         /// </summary>
         [DefaultValue(DefaultSystemRegionInitialSize)]
-        public long SystemRegionInitialSize { get; set; }
+        public long SystemRegionInitialSize
+        {
+            get => SystemDataRegionConfiguration?.InitialSize ?? SystemDataRegionConfiguration.DefaultInitialSize;
+            set
+            {
+                if (SystemDataRegionConfiguration == null)
+                {
+                    SystemDataRegionConfiguration = new SystemDataRegionConfiguration();
+                }
+
+                SystemDataRegionConfiguration.InitialSize = value;
+            }
+        }
 
         /// <summary>
         /// Gets or sets the maximum memory region size reserved for system needs.
         /// </summary>
         [DefaultValue(DefaultSystemRegionMaxSize)]
-        public long SystemRegionMaxSize { get; set; }
+        public long SystemRegionMaxSize
+        {
+            get => SystemDataRegionConfiguration?.MaxSize ?? SystemDataRegionConfiguration.DefaultMaxSize;
+            set
+            {
+                if (SystemDataRegionConfiguration == null)
+                {
+                    SystemDataRegionConfiguration = new SystemDataRegionConfiguration();

Review comment:
       Maybe initialize SystemDataRegionConfiguration in default constructor?

##########
File path: modules/core/src/main/java/org/apache/ignite/configuration/DataStorageConfiguration.java
##########
@@ -359,23 +348,23 @@ public DataStorageConfiguration() {
      * Initial size of a data region reserved for system cache.
      *
      * @return Size in bytes.
+     * @deprecated use {@link SystemDataRegionConfiguration#getInitialSize}.
      */
+    @Deprecated
     public long getSystemRegionInitialSize() {
-        return sysRegionInitSize;
+        return sysDataRegConf.getInitialSize();

Review comment:
       Not NPE safe

##########
File path: modules/platforms/dotnet/Apache.Ignite.Core/Configuration/DataStorageConfiguration.cs
##########
@@ -478,13 +491,37 @@ internal void Write(IBinaryRawWriter writer)
         /// Gets or sets the size of a memory chunk reserved for system needs.
         /// </summary>
         [DefaultValue(DefaultSystemRegionInitialSize)]
-        public long SystemRegionInitialSize { get; set; }
+        public long SystemRegionInitialSize
+        {
+            get => SystemDataRegionConfiguration?.InitialSize ?? SystemDataRegionConfiguration.DefaultInitialSize;
+            set
+            {
+                if (SystemDataRegionConfiguration == null)
+                {
+                    SystemDataRegionConfiguration = new SystemDataRegionConfiguration();
+                }
+
+                SystemDataRegionConfiguration.InitialSize = value;
+            }
+        }
 
         /// <summary>
         /// Gets or sets the maximum memory region size reserved for system needs.
         /// </summary>
         [DefaultValue(DefaultSystemRegionMaxSize)]

Review comment:
       Now there is 2 default values with the same meanings - SystemDataRegionConfiguration.DefaultMaxSize and DefaultSystemRegionMaxSize

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
##########
@@ -2860,7 +2860,7 @@ private void ackMemoryConfiguration() {
             return;
 
         U.log(log, "System cache's DataRegion size is configured to " +
-            (memCfg.getSystemRegionInitialSize() / (1024 * 1024)) + " MB. " +
+            (memCfg.getSystemDataRegionConfiguration().getInitialSize() / (1024 * 1024)) + " MB. " +

Review comment:
       Is it NPE safe? It will be greate to check this with a test. 

##########
File path: modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgnitionStartTest.cs
##########
@@ -114,7 +114,8 @@ public void TestIgniteStartsFromSpringXml()
                     DefaultDataRegionConfiguration = new DataRegionConfiguration
                     {
                         Name = "default"
-                    }
+                    },
+                    SystemDataRegionConfiguration = new SystemDataRegionConfiguration()

Review comment:
       This row is not needed in case of default constructor init

##########
File path: modules/core/src/main/java/org/apache/ignite/configuration/DataStorageConfiguration.java
##########
@@ -384,24 +373,24 @@ public DataStorageConfiguration setSystemRegionInitialSize(long sysRegionInitSiz
      * Maximum data region size reserved for system cache.
      *
      * @return Size in bytes.
+     * @deprecated use {@link SystemDataRegionConfiguration#getMaxSize()}.
      */
+    @Deprecated
     public long getSystemRegionMaxSize() {
-        return sysRegionMaxSize;
+        return sysDataRegConf.getMaxSize();

Review comment:
       Not NPE safe

##########
File path: modules/core/src/main/java/org/apache/ignite/configuration/SystemDataRegionConfiguration.java
##########
@@ -0,0 +1,93 @@
+/*
+ * 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;
+
+/**
+ * This class allows defining system data region configuration with various parameters for Apache Ignite
+ * page memory (see {@link DataStorageConfiguration}.
+ * This class is similiar to {@link DataRegionConfiguration}, but with restricted set of properties.
+ */
+public class SystemDataRegionConfiguration implements Serializable {
+    /** Serial version uid. */
+    private static final long serialVersionUID = 0L;
+
+    /** Default initial size of a memory chunk for the system cache (40 MB). */
+    private static final long DFLT_SYS_REG_INIT_SIZE = 40L * 1024 * 1024;
+
+    /** Default max size of a memory chunk for the system cache (100 MB). */
+    private static final long DFLT_SYS_REG_MAX_SIZE = 100L * 1024 * 1024;
+
+    /** Initial size of a memory chunk reserved for system cache. */
+    private long initSize = DFLT_SYS_REG_INIT_SIZE;
+
+    /** Maximum size of a memory chunk reserved for system cache. */
+    private long maxSize = DFLT_SYS_REG_MAX_SIZE;
+
+    /**
+     * Initial size of a data region reserved for system cache.
+     *
+     * @return Size in bytes.
+     */
+    public long getInitialSize() {
+        return initSize;
+    }
+
+    /**
+     * Sets initial size of a data region reserved for system cache.
+     *
+     * Default value is {@link #DFLT_SYS_REG_INIT_SIZE}
+     *
+     * @param initSize Size in bytes.
+     * @return {@code this} for chaining.
+     */
+    public SystemDataRegionConfiguration setInitialSize(long initSize) {
+        A.ensure(initSize > 0, "System region initial size can not be less zero.");

Review comment:
       less or equal

##########
File path: modules/core/src/main/java/org/apache/ignite/configuration/SystemDataRegionConfiguration.java
##########
@@ -0,0 +1,93 @@
+/*
+ * 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;
+
+/**
+ * This class allows defining system data region configuration with various parameters for Apache Ignite
+ * page memory (see {@link DataStorageConfiguration}.
+ * This class is similiar to {@link DataRegionConfiguration}, but with restricted set of properties.
+ */
+public class SystemDataRegionConfiguration implements Serializable {
+    /** Serial version uid. */
+    private static final long serialVersionUID = 0L;
+
+    /** Default initial size of a memory chunk for the system cache (40 MB). */
+    private static final long DFLT_SYS_REG_INIT_SIZE = 40L * 1024 * 1024;
+
+    /** Default max size of a memory chunk for the system cache (100 MB). */
+    private static final long DFLT_SYS_REG_MAX_SIZE = 100L * 1024 * 1024;
+
+    /** Initial size of a memory chunk reserved for system cache. */
+    private long initSize = DFLT_SYS_REG_INIT_SIZE;
+
+    /** Maximum size of a memory chunk reserved for system cache. */
+    private long maxSize = DFLT_SYS_REG_MAX_SIZE;
+
+    /**
+     * Initial size of a data region reserved for system cache.
+     *
+     * @return Size in bytes.
+     */
+    public long getInitialSize() {
+        return initSize;
+    }
+
+    /**
+     * Sets initial size of a data region reserved for system cache.
+     *
+     * Default value is {@link #DFLT_SYS_REG_INIT_SIZE}
+     *
+     * @param initSize Size in bytes.
+     * @return {@code this} for chaining.
+     */
+    public SystemDataRegionConfiguration setInitialSize(long initSize) {
+        A.ensure(initSize > 0, "System region initial size can not be less zero.");
+
+        this.initSize = initSize;
+
+        return this;
+    }
+
+    /**
+     * Maximum data region size reserved for system cache.
+     *
+     * @return Size in bytes.
+     */
+    public long getMaxSize() {
+        return maxSize;
+    }
+
+    /**
+     * Sets maximum data region size reserved for system cache. The total size should not be less than 10 MB
+     * due to internal data structures overhead.
+     *
+     * Default value is {@link #DFLT_SYS_REG_MAX_SIZE}.
+     *
+     * @param maxSize Maximum size in bytes for system cache data region.
+     * @return {@code this} for chaining.
+     */
+    public SystemDataRegionConfiguration setMaxSize(long maxSize) {
+        A.ensure(maxSize > 0, "System region max size can not be less zero.");

Review comment:
       less or equal

##########
File path: modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/IgnitePKIndexesMigrationToUnwrapPkTest.java
##########
@@ -248,14 +249,20 @@ private static void assertDontUsingPkIndex(IgniteEx igniteEx, String tblName) {
 
             cfg.setPeerClassLoadingEnabled(false);
 
-            DataStorageConfiguration memCfg = new DataStorageConfiguration()
+            DataStorageConfiguration storageCfg = new DataStorageConfiguration()
                 .setDefaultDataRegionConfiguration(
-                    new DataRegionConfiguration().setPersistenceEnabled(true)
-                        .setInitialSize(1024 * 1024 * 10).setMaxSize(1024 * 1024 * 15))
-                .setSystemRegionInitialSize(1024 * 1024 * 10)
-                .setSystemRegionMaxSize(1024 * 1024 * 15);
-
-            cfg.setDataStorageConfiguration(memCfg);
+                    new DataRegionConfiguration()
+                            .setPersistenceEnabled(true)
+                            .setInitialSize(1024 * 1024 * 10)
+                            .setMaxSize(1024 * 1024 * 15)
+                )
+                .setSystemDataRegionConfiguration(
+                    new SystemDataRegionConfiguration()
+                            .setInitialSize(10 * 1024 * 1024)

Review comment:
       multipliers in asc order, but for previous region is in desk - i'm asking make it the same way, holnig my monocle




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org