Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id F3659200D1F for ; Thu, 28 Sep 2017 12:58:15 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id F1DC51609EF; Thu, 28 Sep 2017 10:58:15 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id EF2B7160BD5 for ; Thu, 28 Sep 2017 12:58:14 +0200 (CEST) Received: (qmail 81349 invoked by uid 500); 28 Sep 2017 10:58:14 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 81243 invoked by uid 99); 28 Sep 2017 10:58:14 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Sep 2017 10:58:14 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 1D248F5BD5; Thu, 28 Sep 2017 10:58:11 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: sboikov@apache.org To: commits@ignite.apache.org Date: Thu, 28 Sep 2017 10:58:16 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [06/19] ignite git commit: IGNITE-6216 .NET: PersistentStoreConfiguration.CheckpointWriteOrder archived-at: Thu, 28 Sep 2017 10:58:16 -0000 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/ignite-3478 Commit: 12cbf75bb70615cf31ac059e89dabac1dabce77e Parents: 4a09567 Author: Pavel Tupitsyn Authored: Wed Sep 27 13:36:38 2017 +0300 Committer: Pavel Tupitsyn 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 - + someId012 "; @@ -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); } /// @@ -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); } /// @@ -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 @@ + 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 @@ + + + + + + + Ignite configuration root. @@ -1456,6 +1463,11 @@ Rate time interval. + + + Checkpoint page write order on disk. + + 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 +{ + /// + /// Defines checkpoint pages order on disk. + /// + public enum CheckpointWriteOrder + { + /// + /// Pages are written in order provided by checkpoint pages collection iterator + /// (which is basically a hashtable). + /// + Random, + + /// + /// 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 + } +} 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"; /// + /// Default value for . + /// + public const CheckpointWriteOrder DefaultCheckpointWriteOrder = CheckpointWriteOrder.Sequential; + + /// /// Initializes a new instance of the class. /// public PersistentStoreConfiguration() @@ -120,6 +125,7 @@ namespace Apache.Ignite.Core.PersistentStore SubIntervals = DefaultSubIntervals; WalArchivePath = DefaultWalArchivePath; WalStorePath = DefaultWalStorePath; + CheckpointWriteOrder = DefaultCheckpointWriteOrder; } /// @@ -149,6 +155,7 @@ namespace Apache.Ignite.Core.PersistentStore MetricsEnabled = reader.ReadBoolean(); SubIntervals = reader.ReadInt(); RateTimeInterval = reader.ReadLongAsTimespan(); + CheckpointWriteOrder = (CheckpointWriteOrder) reader.ReadInt(); } /// @@ -178,6 +185,7 @@ namespace Apache.Ignite.Core.PersistentStore writer.WriteBoolean(MetricsEnabled); writer.WriteInt(SubIntervals); writer.WriteTimeSpanAsLong(RateTimeInterval); + writer.WriteInt((int) CheckpointWriteOrder); } /// @@ -298,5 +306,11 @@ namespace Apache.Ignite.Core.PersistentStore [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; } } }