ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ptupit...@apache.org
Subject ignite git commit: IGNITE-6216 .NET: PersistentStoreConfiguration.CheckpointWriteOrder
Date Wed, 27 Sep 2017 10:36:46 GMT
Repository: ignite
Updated Branches:
  refs/heads/master 4a095674e -> 12cbf75bb


IGNITE-6216 .NET: PersistentStoreConfiguration.CheckpointWriteOrder


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

Branch: refs/heads/master
Commit: 12cbf75bb70615cf31ac059e89dabac1dabce77e
Parents: 4a09567
Author: Pavel Tupitsyn <ptupitsyn@apache.org>
Authored: Wed Sep 27 13:36:38 2017 +0300
Committer: Pavel Tupitsyn <ptupitsyn@apache.org>
Committed: Wed Sep 27 13:36:38 2017 +0300

----------------------------------------------------------------------
 .../configuration/CheckpointWriteOrder.java     | 20 ++++++++++-
 .../utils/PlatformConfigurationUtils.java       |  5 ++-
 .../IgniteConfigurationSerializerTest.cs        |  6 ++--
 .../IgniteConfigurationTest.cs                  |  4 ++-
 .../Apache.Ignite.Core.csproj                   |  1 +
 .../IgniteConfigurationSection.xsd              | 12 +++++++
 .../PersistentStore/CheckpointWriteOrder.cs     | 37 ++++++++++++++++++++
 .../PersistentStoreConfiguration.cs             | 14 ++++++++
 8 files changed, 94 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/12cbf75b/modules/core/src/main/java/org/apache/ignite/configuration/CheckpointWriteOrder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CheckpointWriteOrder.java
b/modules/core/src/main/java/org/apache/ignite/configuration/CheckpointWriteOrder.java
index 31feaf6..950064d 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/CheckpointWriteOrder.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/CheckpointWriteOrder.java
@@ -16,6 +16,8 @@
 */
 package org.apache.ignite.configuration;
 
+import org.jetbrains.annotations.Nullable;
+
 /**
  * This enum defines order of writing pages to disk storage during checkpoint.
  */
@@ -29,5 +31,21 @@ public enum CheckpointWriteOrder {
      * All checkpoint pages are collected into single list and sorted by page index.
      * Provides almost sequential disk writes, which can be much faster on some SSD models.
      */
-    SEQUENTIAL
+    SEQUENTIAL;
+
+    /**
+     * Enumerated values.
+     */
+    private static final CheckpointWriteOrder[] VALS = values();
+
+    /**
+     * Efficiently gets enumerated value from its ordinal.
+     *
+     * @param ord Ordinal value.
+     * @return Enumerated value or {@code null} if ordinal out of range.
+     */
+    @Nullable
+    public static CheckpointWriteOrder fromOrdinal(int ord) {
+        return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12cbf75b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
index dc45166..513a463 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
@@ -54,6 +54,7 @@ import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy;
 import org.apache.ignite.configuration.AtomicConfiguration;
 import org.apache.ignite.configuration.BinaryConfiguration;
 import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.CheckpointWriteOrder;
 import org.apache.ignite.configuration.ClientConnectorConfiguration;
 import org.apache.ignite.configuration.DataPageEvictionMode;
 import org.apache.ignite.configuration.IgniteConfiguration;
@@ -1571,7 +1572,8 @@ public class PlatformConfigurationUtils {
                 .setAlwaysWriteFullPages(in.readBoolean())
                 .setMetricsEnabled(in.readBoolean())
                 .setSubIntervals(in.readInt())
-                .setRateTimeInterval(in.readLong());
+                .setRateTimeInterval(in.readLong())
+                .setCheckpointWriteOrder(CheckpointWriteOrder.fromOrdinal(in.readInt()));
     }
 
     /**
@@ -1604,6 +1606,7 @@ public class PlatformConfigurationUtils {
             w.writeBoolean(cfg.isMetricsEnabled());
             w.writeInt(cfg.getSubIntervals());
             w.writeLong(cfg.getRateTimeInterval());
+            w.writeInt(cfg.getCheckpointWriteOrder().ordinal());
 
         } else {
             w.writeBoolean(false);

http://git-wip-us.apache.org/repos/asf/ignite/blob/12cbf75b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
index 2177c6a..ec87bfe 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
@@ -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'
/>
+                            <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' />
                             <consistentId type='System.String'>someId012</consistentId>
                         </igniteConfig>";
 
@@ -332,6 +332,7 @@ namespace Apache.Ignite.Core.Tests
             Assert.IsTrue(pers.MetricsEnabled);
             Assert.AreEqual(3, pers.SubIntervals);
             Assert.AreEqual(TimeSpan.FromSeconds(6), pers.RateTimeInterval);
+            Assert.AreEqual(CheckpointWriteOrder.Random, pers.CheckpointWriteOrder);
         }
 
         /// <summary>
@@ -879,7 +880,8 @@ namespace Apache.Ignite.Core.Tests
                     WalStorePath = Path.GetTempPath(),
                     SubIntervals = 25,
                     MetricsEnabled = true,
-                    RateTimeInterval = TimeSpan.FromDays(1)
+                    RateTimeInterval = TimeSpan.FromDays(1),
+                    CheckpointWriteOrder = CheckpointWriteOrder.Random
                 },
                 IsActiveOnStart = false,
                 ConsistentId = "myId123"

http://git-wip-us.apache.org/repos/asf/ignite/blob/12cbf75b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
index 4f8014f..995924a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
@@ -587,6 +587,7 @@ namespace Apache.Ignite.Core.Tests
             Assert.AreEqual(PersistentStoreConfiguration.DefaultRateTimeInterval, cfg.RateTimeInterval);
             Assert.AreEqual(PersistentStoreConfiguration.DefaultWalStorePath, cfg.WalStorePath);
             Assert.AreEqual(PersistentStoreConfiguration.DefaultWalArchivePath, cfg.WalArchivePath);
+            Assert.AreEqual(PersistentStoreConfiguration.DefaultCheckpointWriteOrder, cfg.CheckpointWriteOrder);
         }
 
         /// <summary>
@@ -824,7 +825,8 @@ namespace Apache.Ignite.Core.Tests
                     WalStorePath = Path.GetTempPath(),
                     MetricsEnabled = true,
                     SubIntervals = 7,
-                    RateTimeInterval = TimeSpan.FromSeconds(9)
+                    RateTimeInterval = TimeSpan.FromSeconds(9),
+                    CheckpointWriteOrder = CheckpointWriteOrder.Random
                 },
                 ConsistentId = new MyConsistentId {Data = "abc"}
             };

http://git-wip-us.apache.org/repos/asf/ignite/blob/12cbf75b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index 3c0641d..9d4069c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -121,6 +121,7 @@
     <Compile Include="Impl\PersistentStore\PersistentStoreMetrics.cs" />
     <Compile Include="Impl\PlatformDisposableTargetAdapter.cs" />
     <Compile Include="Impl\PlatformJniTarget.cs" />
+    <Compile Include="PersistentStore\CheckpointWriteOrder.cs" />
     <Compile Include="PersistentStore\IPersistentStoreMetrics.cs" />
     <Compile Include="PersistentStore\Package-Info.cs" />
     <Compile Include="PersistentStore\PersistentStoreConfiguration.cs" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/12cbf75b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
index 19ce110..9920956 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
@@ -112,6 +112,13 @@
         </xs:restriction>
     </xs:simpleType>
 
+    <xs:simpleType name="checkpointWriteOrder" final="restriction">
+        <xs:restriction base="xs:string">
+            <xs:enumeration value="Random" />
+            <xs:enumeration value="Sequential" />
+        </xs:restriction>
+    </xs:simpleType>
+
     <xs:element name="igniteConfiguration">
         <xs:annotation>
             <xs:documentation>Ignite configuration root.</xs:documentation>
@@ -1456,6 +1463,11 @@
                                 <xs:documentation>Rate time interval.</xs:documentation>
                             </xs:annotation>
                         </xs:attribute>
+                        <xs:attribute name="checkpointWriteOrder" type="checkpointWriteOrder">
+                            <xs:annotation>
+                                <xs:documentation>Checkpoint page write order on disk.</xs:documentation>
+                            </xs:annotation>
+                        </xs:attribute>
                     </xs:complexType>
                 </xs:element>
                 <xs:element name="pluginConfigurations" minOccurs="0">

http://git-wip-us.apache.org/repos/asf/ignite/blob/12cbf75b/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/CheckpointWriteOrder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/CheckpointWriteOrder.cs
b/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/CheckpointWriteOrder.cs
new file mode 100644
index 0000000..ba1153d
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/CheckpointWriteOrder.cs
@@ -0,0 +1,37 @@
+/*
+ * 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
+{
+    /// <summary>
+    /// Defines checkpoint pages order on disk.
+    /// </summary>
+    public enum CheckpointWriteOrder
+    {
+        /// <summary>
+        /// Pages are written in order provided by checkpoint pages collection iterator
+        /// (which is basically a hashtable).
+        /// </summary>
+        Random,
+
+        /// <summary>
+        /// All checkpoint pages are collected into single list and sorted by page index.
+        /// Provides almost sequential disk writes, which can be much faster on some SSD
models.
+        /// </summary>
+        Sequential
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12cbf75b/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/PersistentStoreConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/PersistentStoreConfiguration.cs
b/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/PersistentStoreConfiguration.cs
index 8ba45e5..f71f50e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/PersistentStoreConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/PersistentStoreConfiguration.cs
@@ -102,6 +102,11 @@ namespace Apache.Ignite.Core.PersistentStore
         public const string DefaultWalArchivePath = "db/wal/archive";
 
         /// <summary>
+        /// Default value for <see cref="CheckpointWriteOrder"/>.
+        /// </summary>
+        public const CheckpointWriteOrder DefaultCheckpointWriteOrder = CheckpointWriteOrder.Sequential;
+
+        /// <summary>
         /// Initializes a new instance of the <see cref="PersistentStoreConfiguration"/>
class.
         /// </summary>
         public PersistentStoreConfiguration()
@@ -120,6 +125,7 @@ namespace Apache.Ignite.Core.PersistentStore
             SubIntervals = DefaultSubIntervals;
             WalArchivePath = DefaultWalArchivePath;
             WalStorePath = DefaultWalStorePath;
+            CheckpointWriteOrder = DefaultCheckpointWriteOrder;
         }
 
         /// <summary>
@@ -149,6 +155,7 @@ namespace Apache.Ignite.Core.PersistentStore
             MetricsEnabled = reader.ReadBoolean();
             SubIntervals = reader.ReadInt();
             RateTimeInterval = reader.ReadLongAsTimespan();
+            CheckpointWriteOrder = (CheckpointWriteOrder) reader.ReadInt();
         }
 
         /// <summary>
@@ -178,6 +185,7 @@ namespace Apache.Ignite.Core.PersistentStore
             writer.WriteBoolean(MetricsEnabled);
             writer.WriteInt(SubIntervals);
             writer.WriteTimeSpanAsLong(RateTimeInterval);
+            writer.WriteInt((int) CheckpointWriteOrder);
         }
 
         /// <summary>
@@ -298,5 +306,11 @@ namespace Apache.Ignite.Core.PersistentStore
         [SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly",
             Justification = "Consistency with Java config")]
         public int SubIntervals { get; set; }
+
+        /// <summary>
+        /// Gets or sets the checkpoint page write order on disk.
+        /// </summary>
+        [DefaultValue(DefaultCheckpointWriteOrder)]
+        public CheckpointWriteOrder CheckpointWriteOrder { get; set; }
     }
 }


Mime
View raw message