IGNITE-6516 .NET: PersistentStoreConfiguration.WriteThrottlingEnabled
authorPavel Tupitsyn <ptupitsyn@apache.org>
Thu, 28 Sep 2017 16:17:18 +0000 (19:17 +0300)
committerPavel Tupitsyn <ptupitsyn@apache.org>
Thu, 28 Sep 2017 16:17:18 +0000 (19:17 +0300)
modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/PersistentStoreConfiguration.cs

index fe214da..aa4f168 100644 (file)
@@ -1578,7 +1578,8 @@ public class PlatformConfigurationUtils {
                 .setMetricsEnabled(in.readBoolean())
                 .setSubIntervals(in.readInt())
                 .setRateTimeInterval(in.readLong())
-                .setCheckpointWriteOrder(CheckpointWriteOrder.fromOrdinal(in.readInt()));
+                .setCheckpointWriteOrder(CheckpointWriteOrder.fromOrdinal(in.readInt()))
+                .setWriteThrottlingEnabled(in.readBoolean());
     }
 
     /**
@@ -1612,6 +1613,7 @@ public class PlatformConfigurationUtils {
             w.writeInt(cfg.getSubIntervals());
             w.writeLong(cfg.getRateTimeInterval());
             w.writeInt(cfg.getCheckpointWriteOrder().ordinal());
+            w.writeBoolean(cfg.isWriteThrottlingEnabled());
 
         } else {
             w.writeBoolean(false);
index 2530243..83700cb 100644 (file)
@@ -143,7 +143,7 @@ namespace Apache.Ignite.Core.Tests
                             </memoryConfiguration>
                             <sqlConnectorConfiguration host='bar' port='10' portRange='11' socketSendBufferSize='12' socketReceiveBufferSize='13' tcpNoDelay='true' maxOpenCursorsPerConnection='14' threadPoolSize='15' />
                             <clientConnectorConfiguration host='bar' port='10' portRange='11' socketSendBufferSize='12' socketReceiveBufferSize='13' tcpNoDelay='true' maxOpenCursorsPerConnection='14' threadPoolSize='15' />
-                            <persistentStoreConfiguration alwaysWriteFullPages='true' checkpointingFrequency='00:00:1' checkpointingPageBufferSize='2' checkpointingThreads='3' lockWaitTime='00:00:04' persistentStorePath='foo' tlbSize='5' walArchivePath='bar' walFlushFrequency='00:00:06' walFsyncDelayNanos='7' walHistorySize='8' walMode='None' walRecordIteratorBufferSize='9' walSegments='10' walSegmentSize='11' walStorePath='baz' metricsEnabled='true' rateTimeInterval='0:0:6' subIntervals='3' checkpointWriteOrder='Random' />
+                            <persistentStoreConfiguration alwaysWriteFullPages='true' checkpointingFrequency='00:00:1' checkpointingPageBufferSize='2' checkpointingThreads='3' lockWaitTime='00:00:04' persistentStorePath='foo' tlbSize='5' walArchivePath='bar' walFlushFrequency='00:00:06' walFsyncDelayNanos='7' walHistorySize='8' walMode='None' walRecordIteratorBufferSize='9' walSegments='10' walSegmentSize='11' walStorePath='baz' metricsEnabled='true' rateTimeInterval='0:0:6' subIntervals='3' checkpointWriteOrder='Random' writeThrottlingEnabled='true' />
                             <consistentId type='System.String'>someId012</consistentId>
                             <localEventListeners>
                               <localEventListener type='Apache.Ignite.Core.Events.LocalEventListener`1[[Apache.Ignite.Core.Events.CacheRebalancingEvent]]'>
@@ -349,6 +349,7 @@ namespace Apache.Ignite.Core.Tests
             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);
@@ -906,7 +907,8 @@ namespace Apache.Ignite.Core.Tests
                     SubIntervals = 25,
                     MetricsEnabled = true,
                     RateTimeInterval = TimeSpan.FromDays(1),
-                    CheckpointWriteOrder = CheckpointWriteOrder.Random
+                    CheckpointWriteOrder = CheckpointWriteOrder.Random,
+                    WriteThrottlingEnabled = true
                 },
                 IsActiveOnStart = false,
                 ConsistentId = "myId123",
index 995924a..efa404d 100644 (file)
@@ -277,6 +277,8 @@ namespace Apache.Ignite.Core.Tests
                 Assert.AreEqual(pers.MetricsEnabled, resPers.MetricsEnabled);
                 Assert.AreEqual(pers.RateTimeInterval, resPers.RateTimeInterval);
                 Assert.AreEqual(pers.SubIntervals, resPers.SubIntervals);
+                Assert.AreEqual(pers.CheckpointWriteOrder, resPers.CheckpointWriteOrder);
+                Assert.AreEqual(pers.WriteThrottlingEnabled, resPers.WriteThrottlingEnabled);
             }
         }
 
@@ -588,6 +590,7 @@ namespace Apache.Ignite.Core.Tests
             Assert.AreEqual(PersistentStoreConfiguration.DefaultWalStorePath, cfg.WalStorePath);
             Assert.AreEqual(PersistentStoreConfiguration.DefaultWalArchivePath, cfg.WalArchivePath);
             Assert.AreEqual(PersistentStoreConfiguration.DefaultCheckpointWriteOrder, cfg.CheckpointWriteOrder);
+            Assert.AreEqual(PersistentStoreConfiguration.DefaultWriteThrottlingEnabled, cfg.WriteThrottlingEnabled);
         }
 
         /// <summary>
@@ -826,7 +829,8 @@ namespace Apache.Ignite.Core.Tests
                     MetricsEnabled = true,
                     SubIntervals = 7,
                     RateTimeInterval = TimeSpan.FromSeconds(9),
-                    CheckpointWriteOrder = CheckpointWriteOrder.Random
+                    CheckpointWriteOrder = CheckpointWriteOrder.Random,
+                    WriteThrottlingEnabled = true
                 },
                 ConsistentId = new MyConsistentId {Data = "abc"}
             };
index 80bacf4..6788ef0 100644 (file)
                                 <xs:documentation>Checkpoint page write order on disk.</xs:documentation>
                             </xs:annotation>
                         </xs:attribute>
+                        <xs:attribute name="writeThrottlingEnabled" type="xs:boolean">
+                            <xs:annotation>
+                                <xs:documentation>Threads that generate dirty pages too fast during ongoing checkpoint will be throttled.</xs:documentation>
+                            </xs:annotation>
+                        </xs:attribute>
                     </xs:complexType>
                 </xs:element>
                 <xs:element name="pluginConfigurations" minOccurs="0">
index f71f50e..7a2248a 100644 (file)
@@ -107,6 +107,11 @@ namespace Apache.Ignite.Core.PersistentStore
         public const CheckpointWriteOrder DefaultCheckpointWriteOrder = CheckpointWriteOrder.Sequential;
 
         /// <summary>
+        /// Default value for <see cref="WriteThrottlingEnabled"/>.
+        /// </summary>
+        public const bool DefaultWriteThrottlingEnabled = false;
+
+        /// <summary>
         /// Initializes a new instance of the <see cref="PersistentStoreConfiguration"/> class.
         /// </summary>
         public PersistentStoreConfiguration()
@@ -126,6 +131,7 @@ namespace Apache.Ignite.Core.PersistentStore
             WalArchivePath = DefaultWalArchivePath;
             WalStorePath = DefaultWalStorePath;
             CheckpointWriteOrder = DefaultCheckpointWriteOrder;
+            WriteThrottlingEnabled = DefaultWriteThrottlingEnabled;
         }
 
         /// <summary>
@@ -156,6 +162,7 @@ namespace Apache.Ignite.Core.PersistentStore
             SubIntervals = reader.ReadInt();
             RateTimeInterval = reader.ReadLongAsTimespan();
             CheckpointWriteOrder = (CheckpointWriteOrder) reader.ReadInt();
+            WriteThrottlingEnabled = reader.ReadBoolean();
         }
 
         /// <summary>
@@ -186,6 +193,7 @@ namespace Apache.Ignite.Core.PersistentStore
             writer.WriteInt(SubIntervals);
             writer.WriteTimeSpanAsLong(RateTimeInterval);
             writer.WriteInt((int) CheckpointWriteOrder);
+            writer.WriteBoolean(WriteThrottlingEnabled);
         }
 
         /// <summary>
@@ -312,5 +320,12 @@ namespace Apache.Ignite.Core.PersistentStore
         /// </summary>
         [DefaultValue(DefaultCheckpointWriteOrder)]
         public CheckpointWriteOrder CheckpointWriteOrder { get; set; }
+
+        /// <summary>
+        /// Gets or sets a value indicating whether threads that generate dirty
+        /// pages too fast during ongoing checkpoint will be throttled.
+        /// </summary>
+        [DefaultValue(DefaultWriteThrottlingEnabled)]
+        public bool WriteThrottlingEnabled { get; set; }
     }
 }