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 0EFCF200C61 for ; Tue, 25 Apr 2017 17:51:46 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 0D93D160BB8; Tue, 25 Apr 2017 15:51:46 +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 09113160B9E for ; Tue, 25 Apr 2017 17:51:44 +0200 (CEST) Received: (qmail 38095 invoked by uid 500); 25 Apr 2017 15:51:44 -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 38080 invoked by uid 99); 25 Apr 2017 15:51:44 -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; Tue, 25 Apr 2017 15:51:44 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 238ABDF97F; Tue, 25 Apr 2017 15:51:44 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ptupitsyn@apache.org To: commits@ignite.apache.org Date: Tue, 25 Apr 2017 15:51:44 -0000 Message-Id: <0cac6bb4e6d3420b80ac12da37af67ed@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/3] ignite git commit: .NET: Update memory policy properties archived-at: Tue, 25 Apr 2017 15:51:46 -0000 Repository: ignite Updated Branches: refs/heads/ignite-5024 5b35ebcda -> 29402d00b .NET: Update memory policy properties Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/30700df7 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/30700df7 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/30700df7 Branch: refs/heads/ignite-5024 Commit: 30700df7a8796e2b9ad914f6dd2e8d113ecb3e20 Parents: 5b35ebc Author: Pavel Tupitsyn Authored: Tue Apr 25 18:25:39 2017 +0300 Committer: Pavel Tupitsyn Committed: Tue Apr 25 18:25:39 2017 +0300 ---------------------------------------------------------------------- .../utils/PlatformConfigurationUtils.java | 2 ++ .../Cache/CacheConfigurationTest.cs | 2 +- .../IgniteConfigurationSerializerTest.cs | 6 ++--- .../IgniteConfigurationTest.cs | 6 ++--- .../Cache/Configuration/DataPageEvictionMode.cs | 4 +-- .../Configuration/MemoryPolicyConfiguration.cs | 27 +++++++++++++++----- 6 files changed, 32 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/30700df7/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 5fdcc6a..b0d75ad 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 @@ -1343,6 +1343,7 @@ public class PlatformConfigurationUtils { MemoryPolicyConfiguration cfg = new MemoryPolicyConfiguration(); cfg.setName(in.readString()) + .setInitialSize(in.readLong()) .setMaxSize(in.readLong()) .setSwapFilePath(in.readString()) .setPageEvictionMode(DataPageEvictionMode.values()[in.readInt()]) @@ -1384,6 +1385,7 @@ public class PlatformConfigurationUtils { 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()); http://git-wip-us.apache.org/repos/asf/ignite/blob/30700df7/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs ---------------------------------------------------------------------- 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 67184a6..19a6635 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs @@ -72,7 +72,7 @@ namespace Apache.Ignite.Core.Tests.Cache new MemoryPolicyConfiguration { Name = "myMemPolicy", - Size = 99 * 1024 * 1024 + MaxSize = 99 * 1024 * 1024 } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/30700df7/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 31dd887..6a7aef0 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs @@ -269,7 +269,7 @@ namespace Apache.Ignite.Core.Tests Assert.AreEqual("dfPlc", memPlc.Name); Assert.AreEqual(DataPageEvictionMode.RandomLru, memPlc.PageEvictionMode); Assert.AreEqual("abc", memPlc.SwapFilePath); - Assert.AreEqual(89, memPlc.Size); + Assert.AreEqual(89, memPlc.MaxSize); } /// @@ -812,7 +812,7 @@ namespace Apache.Ignite.Core.Tests { Name = "myDefaultPlc", PageEvictionMode = DataPageEvictionMode.Random2Lru, - Size = 345 * 1024 * 1024, + MaxSize = 345 * 1024 * 1024, EvictionThreshold = 0.88, EmptyPagesPoolSize = 77, SwapFilePath = "myPath1" @@ -821,7 +821,7 @@ namespace Apache.Ignite.Core.Tests { Name = "customPlc", PageEvictionMode = DataPageEvictionMode.RandomLru, - Size = 456 * 1024 * 1024, + MaxSize = 456 * 1024 * 1024, EvictionThreshold = 0.77, EmptyPagesPoolSize = 66, SwapFilePath = "somePath2" http://git-wip-us.apache.org/repos/asf/ignite/blob/30700df7/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 8da2616..82c8886 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs @@ -212,7 +212,7 @@ namespace Apache.Ignite.Core.Tests var resPlc = resMemCfg.MemoryPolicies.Skip(i).First(); Assert.AreEqual(plc.PageEvictionMode, resPlc.PageEvictionMode); - Assert.AreEqual(plc.Size, resPlc.Size); + Assert.AreEqual(plc.MaxSize, resPlc.MaxSize); Assert.AreEqual(plc.EmptyPagesPoolSize, resPlc.EmptyPagesPoolSize); Assert.AreEqual(plc.EvictionThreshold, resPlc.EvictionThreshold); Assert.AreEqual(plc.Name, resPlc.Name); @@ -575,7 +575,7 @@ namespace Apache.Ignite.Core.Tests { Name = "myDefaultPlc", PageEvictionMode = DataPageEvictionMode.Random2Lru, - Size = 345 * 1024 * 1024, + MaxSize = 345 * 1024 * 1024, EvictionThreshold = 0.88, EmptyPagesPoolSize = 77, SwapFilePath = "myPath1" @@ -584,7 +584,7 @@ namespace Apache.Ignite.Core.Tests { Name = "customPlc", PageEvictionMode = DataPageEvictionMode.RandomLru, - Size = 456 * 1024 * 1024, + MaxSize = 456 * 1024 * 1024, EvictionThreshold = 0.77, EmptyPagesPoolSize = 66, SwapFilePath = "somePath2" http://git-wip-us.apache.org/repos/asf/ignite/blob/30700df7/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/DataPageEvictionMode.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/DataPageEvictionMode.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/DataPageEvictionMode.cs index f3897e6..a6263d7 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/DataPageEvictionMode.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/DataPageEvictionMode.cs @@ -34,10 +34,10 @@ namespace Apache.Ignite.Core.Cache.Configuration /// /// 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 / . + /// 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 http://git-wip-us.apache.org/repos/asf/ignite/blob/30700df7/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryPolicyConfiguration.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryPolicyConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryPolicyConfiguration.cs index 9e21910..bef57d6 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryPolicyConfiguration.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryPolicyConfiguration.cs @@ -36,12 +36,18 @@ namespace Apache.Ignite.Core.Cache.Configuration public const int DefaultEmptyPagesPoolSize = 100; /// + /// The default initial size. + /// + public const long DefaultInitialSize = 256 * 1024 * 1024; + + /// /// Initializes a new instance of the class. /// public MemoryPolicyConfiguration() { EvictionThreshold = DefaultEvictionThreshold; EmptyPagesPoolSize = DefaultEmptyPagesPoolSize; + InitialSize = DefaultInitialSize; } /// @@ -51,7 +57,8 @@ namespace Apache.Ignite.Core.Cache.Configuration internal MemoryPolicyConfiguration(IBinaryRawReader reader) { Name = reader.ReadString(); - Size = reader.ReadLong(); + InitialSize = reader.ReadLong(); + MaxSize = reader.ReadLong(); SwapFilePath = reader.ReadString(); PageEvictionMode = (DataPageEvictionMode) reader.ReadInt(); EvictionThreshold = reader.ReadDouble(); @@ -64,7 +71,8 @@ namespace Apache.Ignite.Core.Cache.Configuration internal void Write(IBinaryRawWriter writer) { writer.WriteString(Name); - writer.WriteLong(Size); + writer.WriteLong(InitialSize); + writer.WriteLong(MaxSize); writer.WriteString(SwapFilePath); writer.WriteInt((int) PageEvictionMode); writer.WriteDouble(EvictionThreshold); @@ -77,10 +85,17 @@ namespace Apache.Ignite.Core.Cache.Configuration public string Name { get; set; } /// - /// Gets or sets the 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. + /// 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 Size { get; set; } + public long MaxSize { get; set; } /// /// Gets or sets the the path to the memory-mapped file the memory region defined by this memory policy @@ -94,7 +109,7 @@ namespace Apache.Ignite.Core.Cache.Configuration /// /// 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 . + /// defined by this memory policy, goes beyond . /// public DataPageEvictionMode PageEvictionMode { get; set; }