You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/10/24 08:47:08 UTC
[01/50] [abbrv] ignite git commit: IGNITE-6627 .NET: Fix
serialization of enums within generic collections
Repository: ignite
Updated Branches:
refs/heads/ignite-3478-tree 27ed61570 -> f7a1b8b4f
IGNITE-6627 .NET: Fix serialization of enums within generic collections
* Fix EnumEqualityComparer serialization
* Fix enum arrays serialization
* Fix empty objects missing metadata
This closes #2864
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/93bf555a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/93bf555a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/93bf555a
Branch: refs/heads/ignite-3478-tree
Commit: 93bf555a98c472ff7028a641b32ef5d8ba8df7cd
Parents: ec12824
Author: Alexey Popov <ta...@gmail.com>
Authored: Tue Oct 17 14:45:42 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Tue Oct 17 14:45:42 2017 +0300
----------------------------------------------------------------------
.../Apache.Ignite.Core.Tests.csproj | 2 +
.../Serializable/GenericCollectionsTest.cs | 112 +++++++++++++++++++
.../Client/Cache/CacheTest.cs | 76 +++++++++++++
.../Client/Cache/EmptyObject.cs | 54 +++++++++
.../Impl/Binary/BinarySystemHandlers.cs | 16 +--
.../Impl/Binary/BinaryWriter.cs | 7 ++
.../Impl/Binary/SerializableSerializer.cs | 11 +-
.../Binary/Structure/BinaryStructureTracker.cs | 12 +-
8 files changed, 274 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/93bf555a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
index ec85ca2..7ec75af 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
@@ -78,6 +78,7 @@
<Compile Include="Binary\BinaryReaderWriterTest.cs" />
<Compile Include="Binary\BinarySelfTestSimpleName.cs" />
<Compile Include="Binary\EnumsTestOnline.cs" />
+ <Compile Include="Binary\Serializable\GenericCollectionsTest.cs" />
<Compile Include="Cache\PersistentStoreTest.cs" />
<Compile Include="Cache\Query\Linq\CacheLinqTest.CompiledQuery.cs" />
<Compile Include="Cache\Query\Linq\CacheLinqTest.DateTime.cs" />
@@ -94,6 +95,7 @@
<Compile Include="Cache\Store\CacheStoreSessionTestSharedFactory.cs" />
<Compile Include="Client\Cache\CacheTest.cs" />
<Compile Include="Client\Cache\CacheTestNoMeta.cs" />
+ <Compile Include="Client\Cache\EmptyObject.cs" />
<Compile Include="Client\Cache\ScanQueryTest.cs" />
<Compile Include="Client\Cache\Person.cs" />
<Compile Include="Client\ClientTestBase.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/93bf555a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/GenericCollectionsTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/GenericCollectionsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/GenericCollectionsTest.cs
new file mode 100644
index 0000000..cfbe824d
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/GenericCollectionsTest.cs
@@ -0,0 +1,112 @@
+/*
+ * 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.Tests.Binary.Serializable
+{
+ using System.Collections.Generic;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Tests Generic collections serializtion/deserialization scenarios.
+ /// </summary>
+ public class GenericCollectionsTest
+ {
+ /// <summary>
+ /// Tests Dictionary.
+ /// </summary>
+ [Test]
+ public void TestDictionary()
+ {
+ TestCollection(new Dictionary<int, int> {{1, 1}, {2, 2}});
+ TestCollection(new Dictionary<ByteEnum, int> {{ByteEnum.One, 1}, {ByteEnum.Two, 2}});
+ TestCollection(new Dictionary<IntEnum, int> {{IntEnum.One, 1}, {IntEnum.Two, 2}});
+ }
+
+ /// <summary>
+ /// Tests SortedDictionary.
+ /// </summary>
+ [Test]
+ public void TestSortedDictionary()
+ {
+ TestCollection(new SortedDictionary<int, int> {{1, 1}, {2, 2}});
+ TestCollection(new SortedDictionary<ByteEnum, int> {{ByteEnum.One, 1}, {ByteEnum.Two, 2}});
+ TestCollection(new SortedDictionary<IntEnum, int> {{IntEnum.One, 1}, {IntEnum.Two, 2}});
+ }
+
+ /// <summary>
+ /// Tests List.
+ /// </summary>
+ [Test]
+ public void TestList()
+ {
+ TestCollection(new List<int> {1, 2});
+ TestCollection(new List<ByteEnum> {ByteEnum.One, ByteEnum.Two});
+ TestCollection(new List<IntEnum> {IntEnum.One, IntEnum.Two});
+ }
+
+ /// <summary>
+ /// Tests LinkedList.
+ /// </summary>
+ [Test]
+ public void TestLinkedList()
+ {
+ TestCollection(new LinkedList<int>(new List<int> { 1, 2 }));
+ TestCollection(new LinkedList<ByteEnum>(new List<ByteEnum> {ByteEnum.One, ByteEnum.Two}));
+ TestCollection(new LinkedList<IntEnum>(new List<IntEnum> {IntEnum.One, IntEnum.Two}));
+ }
+
+ /// <summary>
+ /// Tests HashSet.
+ /// </summary>
+ [Test]
+ public void TestHashSet()
+ {
+ TestCollection(new HashSet<int> {1, 2});
+ TestCollection(new HashSet<ByteEnum> {ByteEnum.One, ByteEnum.Two});
+ TestCollection(new HashSet<IntEnum> {IntEnum.One, IntEnum.Two});
+ }
+
+ /// <summary>
+ /// Tests SortedSet.
+ /// </summary>
+ [Test]
+ public void TestSortedSet()
+ {
+ TestCollection(new SortedSet<int> {1, 2});
+ TestCollection(new SortedSet<ByteEnum> {ByteEnum.One, ByteEnum.Two});
+ TestCollection(new SortedSet<IntEnum> {IntEnum.One, IntEnum.Two});
+ }
+
+ private static void TestCollection<T>(ICollection<T> collection)
+ {
+ var res = TestUtils.SerializeDeserialize(collection);
+ Assert.AreEqual(collection, res);
+ }
+
+ private enum ByteEnum : byte
+ {
+ One = 1,
+ Two = 2,
+ }
+
+ private enum IntEnum
+ {
+ One = 1,
+ Two = 2,
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/93bf555a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/CacheTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/CacheTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/CacheTest.cs
index 083038a..f2dd1de 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/CacheTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/CacheTest.cs
@@ -68,6 +68,22 @@ namespace Apache.Ignite.Core.Tests.Client.Cache
}
/// <summary>
+ /// Tests the cache put / get for Empty object type.
+ /// </summary>
+ [Test]
+ public void TestPutGetEmptyObject()
+ {
+ using (var client = GetClient())
+ {
+ var serverCache = GetCache<EmptyObject>();
+ var clientCache = client.GetCache<int, EmptyObject>(CacheName);
+
+ serverCache.Put(1, new EmptyObject());
+ Assert.IsNotNull(clientCache.Get(1));
+ }
+ }
+
+ /// <summary>
/// Tests the cache put / get with user data types.
/// </summary>
[Test]
@@ -116,6 +132,60 @@ namespace Apache.Ignite.Core.Tests.Client.Cache
}
/// <summary>
+ /// Tests the cache put / get for Dictionary with Enum keys.
+ /// </summary>
+ [Test]
+ public void TestPutGetDictionary([Values(true, false)] bool compactFooter)
+ {
+ var cfg = GetClientConfiguration();
+
+ cfg.BinaryConfiguration = new BinaryConfiguration
+ {
+ CompactFooter = compactFooter
+ };
+
+ using (var client = Ignition.StartClient(cfg))
+ {
+ var dict = new Dictionary<ByteEnum, int> { { ByteEnum.One, 1 }, { ByteEnum.Two, 2 } };
+
+ var serverCache = GetCache<Dictionary<ByteEnum, int>>();
+ var clientCache = client.GetCache<int, Dictionary<ByteEnum, int>>(CacheName);
+
+ serverCache.Put(1, dict);
+ var res = clientCache.Get(1);
+
+ Assert.AreEqual(dict, res);
+ }
+ }
+
+ /// <summary>
+ /// Tests the cache put / get for HashSet with Enum keys.
+ /// </summary>
+ [Test]
+ public void TestPutGetHashSet([Values(true, false)] bool compactFooter)
+ {
+ var cfg = GetClientConfiguration();
+
+ cfg.BinaryConfiguration = new BinaryConfiguration
+ {
+ CompactFooter = compactFooter
+ };
+
+ using (var client = Ignition.StartClient(cfg))
+ {
+ var hashSet = new HashSet<ByteEnum> { ByteEnum.One, ByteEnum.Two };
+
+ var serverCache = GetCache<HashSet<ByteEnum>>();
+ var clientCache = client.GetCache<int, HashSet<ByteEnum>>(CacheName);
+
+ serverCache.Put(1, hashSet);
+ var res = clientCache.Get(1);
+
+ Assert.AreEqual(hashSet, res);
+ }
+ }
+
+ /// <summary>
/// Tests the TryGet method.
/// </summary>
[Test]
@@ -779,5 +849,11 @@ namespace Apache.Ignite.Core.Tests.Client.Cache
{
public Container Inner;
}
+
+ public enum ByteEnum : byte
+ {
+ One = 1,
+ Two = 2,
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/93bf555a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/EmptyObject.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/EmptyObject.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/EmptyObject.cs
new file mode 100644
index 0000000..47db939
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/EmptyObject.cs
@@ -0,0 +1,54 @@
+/*
+ * 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.Tests.Client.Cache
+{
+ using System;
+ using System.Runtime.Serialization;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Object with no fields.
+ /// </summary>
+ [Serializable]
+ public class EmptyObject : ISerializable
+ {
+ /// <summary>
+ /// Initializes a new instance of the EmptyObject class.
+ /// </summary>
+ public EmptyObject()
+ {
+ // No-op.
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the EmptyObject class.
+ /// </summary>
+ private EmptyObject(SerializationInfo info, StreamingContext context)
+ {
+ Assert.AreEqual(StreamingContextStates.All, context.State);
+ Assert.IsNull(context.Context);
+ }
+
+ /** <inheritdoc /> */
+ public void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ Assert.AreEqual(StreamingContextStates.All, context.State);
+ Assert.IsNull(context.Context);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/93bf555a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
index f55a11f..3f16bc0 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
@@ -110,9 +110,9 @@ namespace Apache.Ignite.Core.Impl.Binary
// 13. Arbitrary dictionary.
ReadHandlers[BinaryTypeId.Dictionary] = new BinarySystemReader(ReadDictionary);
-
- // 14. Enum.
- ReadHandlers[BinaryTypeId.ArrayEnum] = new BinarySystemReader(ReadEnumArray);
+
+ // 14. Enum. Should be read as Array, see WriteEnumArray implementation.
+ ReadHandlers[BinaryTypeId.ArrayEnum] = new BinarySystemReader(ReadArray);
}
/// <summary>
@@ -473,16 +473,6 @@ namespace Apache.Ignite.Core.Impl.Binary
ctx.WriteInt(binEnum.EnumValue);
}
- /**
- * <summary>Read enum array.</summary>
- */
- private static object ReadEnumArray(BinaryReader ctx, Type type)
- {
- var elemType = type.GetElementType() ?? typeof(object);
-
- return BinaryUtils.ReadTypedArray(ctx, true, elemType);
- }
-
/// <summary>
/// Reads the array.
/// </summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/93bf555a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
index f59f17c..b98ad5f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
@@ -1493,6 +1493,13 @@ namespace Apache.Ignite.Core.Impl.Binary
{
Debug.Assert(desc != null);
+ if (!desc.UserType && (fields == null || fields.Count == 0))
+ {
+ // System types with no fields (most of them) do not need to be sent.
+ // AffinityKey is an example of system type with metadata.
+ return;
+ }
+
if (_metas == null)
{
_metas = new Dictionary<int, BinaryType>(1)
http://git-wip-us.apache.org/repos/asf/ignite/blob/93bf555a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableSerializer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableSerializer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableSerializer.cs
index e660cff..80f267a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableSerializer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableSerializer.cs
@@ -304,9 +304,16 @@ namespace Apache.Ignite.Core.Impl.Binary
{
return new TypeResolver().ResolveType(serInfo.FullTypeName, serInfo.AssemblyName);
}
-
- if (serInfo.ObjectType != serializable.GetType())
+
+ if (serInfo.ObjectType != serializable.GetType() &&
+ typeof(ISerializable).IsAssignableFrom(serInfo.ObjectType))
{
+ // serInfo.ObjectType should be ISerializable. There is a known case for generic collections:
+ // serializable is EnumEqualityComparer : ISerializable
+ // and serInfo.ObjectType is ObjectEqualityComparer (does not implement ISerializable interface).
+ // Please read a possible explanation here:
+ // http://dotnetstudio.blogspot.ru/2012/06/net-35-to-net-40-enum.html
+
return serInfo.ObjectType;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/93bf555a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureTracker.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureTracker.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureTracker.cs
index 8f44e00..3517342 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureTracker.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureTracker.cs
@@ -110,11 +110,21 @@ namespace Apache.Ignite.Core.Impl.Binary.Structure
var fields = metaHnd.OnObjectWriteFinished();
- // A new schema may be added, but no new fields.
+ // A new schema may be added, but no new fields.
// In this case, we should still call SaveMetadata even if fields are null
writer.SaveMetadata(_desc, fields);
}
}
+ else
+ {
+ // Special case when the object is with no properties.
+ // Save meta to Marshaller.
+ writer.Marshaller.GetBinaryTypeHandler(_desc);
+
+ // Save meta to cluster.
+ writer.SaveMetadata(_desc, null);
+ return;
+ }
}
/// <summary>
[10/50] [abbrv] ignite git commit: IGNITE-6675 .NET: Fix ignored
IgniteConfiguration.IgniteHome
Posted by sb...@apache.org.
IGNITE-6675 .NET: Fix ignored IgniteConfiguration.IgniteHome
This closes #2886
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8f23bca2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8f23bca2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8f23bca2
Branch: refs/heads/ignite-3478-tree
Commit: 8f23bca2e0599eec15d059f2ed7b14dd4fe93aa9
Parents: b8128e1
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Oct 19 18:42:12 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Oct 19 18:42:12 2017 +0300
----------------------------------------------------------------------
.../Apache.Ignite.Core.Tests/DeploymentTest.cs | 33 ++------------------
.../IgniteConfigurationTest.cs | 3 ++
.../IgniteManagerTest.cs | 10 +++++-
.../Apache.Ignite.Core/IgniteConfiguration.cs | 1 +
4 files changed, 15 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f23bca2/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs
index cb97076..1d80c60 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs
@@ -21,6 +21,7 @@ namespace Apache.Ignite.Core.Tests
using System.IO;
using System.Linq;
using Apache.Ignite.Core.Compute;
+ using Apache.Ignite.Core.Impl;
using Apache.Ignite.Core.Impl.Common;
using Apache.Ignite.Core.Resource;
using Apache.Ignite.Core.Tests.Process;
@@ -38,7 +39,7 @@ namespace Apache.Ignite.Core.Tests
public void TestCustomDeployment()
{
// Create temp folder
- var folder = GetTempFolder();
+ var folder = IgniteUtils.GetTempDirectoryName();
// Copy jars
var home = IgniteHome.Resolve(null);
@@ -139,36 +140,6 @@ namespace Apache.Ignite.Core.Tests
}
}
- /// <summary>
- /// Gets the temporary folder.
- /// </summary>
- private static string GetTempFolder()
- {
- const string prefix = "ig-test-";
- var temp = Path.GetTempPath();
-
- for (int i = 0; i < int.MaxValue; i++)
- {
- {
- try
- {
- var path = Path.Combine(temp, prefix + i);
-
- if (Directory.Exists(path))
- Directory.Delete(path, true);
-
- return Directory.CreateDirectory(path).FullName;
- }
- catch (Exception)
- {
- // Ignore
- }
- }
- }
-
- throw new InvalidOperationException();
- }
-
#pragma warning disable 649
/// <summary>
/// Function that returns process path.
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f23bca2/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 3fd4772..cde216b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
@@ -36,6 +36,7 @@ namespace Apache.Ignite.Core.Tests
using Apache.Ignite.Core.Discovery.Tcp.Static;
using Apache.Ignite.Core.Events;
using Apache.Ignite.Core.Impl;
+ using Apache.Ignite.Core.Impl.Common;
using Apache.Ignite.Core.PersistentStore;
using Apache.Ignite.Core.Tests.Plugin;
using Apache.Ignite.Core.Transactions;
@@ -131,6 +132,7 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(ip.Endpoints, resIp.Endpoints.Take(2).Select(x => x.Trim('/')).ToArray());
Assert.AreEqual(cfg.IgniteInstanceName, resCfg.IgniteInstanceName);
+ Assert.AreEqual(cfg.IgniteHome, resCfg.IgniteHome);
Assert.AreEqual(cfg.IncludedEventTypes, resCfg.IncludedEventTypes);
Assert.AreEqual(cfg.MetricsExpireTime, resCfg.MetricsExpireTime);
Assert.AreEqual(cfg.MetricsHistorySize, resCfg.MetricsHistorySize);
@@ -682,6 +684,7 @@ namespace Apache.Ignite.Core.Tests
TopologyHistorySize = 1234567
},
IgniteInstanceName = "gridName1",
+ IgniteHome = IgniteHome.Resolve(null),
IncludedEventTypes = EventType.DiscoveryAll,
MetricsExpireTime = TimeSpan.FromMinutes(7),
MetricsHistorySize = 125,
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f23bca2/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteManagerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteManagerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteManagerTest.cs
index 2b73da9..c019f0c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteManagerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteManagerTest.cs
@@ -19,6 +19,7 @@ namespace Apache.Ignite.Core.Tests
{
using System;
using System.IO;
+ using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Impl.Common;
using NUnit.Framework;
@@ -39,7 +40,14 @@ namespace Apache.Ignite.Core.Tests
try
{
- Assert.IsTrue(Directory.Exists(IgniteHome.Resolve(null)));
+ var home = IgniteHome.Resolve(null);
+ Assert.IsTrue(Directory.Exists(home));
+
+ // Invalid home.
+ var cfg = new IgniteConfiguration {IgniteHome = @"c:\foo\bar"};
+ var ex = Assert.Throws<IgniteException>(() => IgniteHome.Resolve(new IgniteConfiguration(cfg)));
+ Assert.AreEqual(string.Format(
+ "IgniteConfiguration.IgniteHome is not valid: '{0}'", cfg.IgniteHome), ex.Message);
}
finally
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f23bca2/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
index a7a5ff4..b0fe0df 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
@@ -734,6 +734,7 @@ namespace Apache.Ignite.Core
}
SpringConfigUrl = cfg.SpringConfigUrl;
+ IgniteHome = cfg.IgniteHome;
JvmClasspath = cfg.JvmClasspath;
JvmOptions = cfg.JvmOptions;
Assemblies = cfg.Assemblies;
[49/50] [abbrv] ignite git commit: Merge remote-tracking branch
'origin/master'
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/master'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2bc75a3f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2bc75a3f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2bc75a3f
Branch: refs/heads/ignite-3478-tree
Commit: 2bc75a3f775f10afab369d7e357af748cf11922e
Parents: 5f69d26 22ee726
Author: sboikov <sb...@gridgain.com>
Authored: Tue Oct 24 11:24:23 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Oct 24 11:24:23 2017 +0300
----------------------------------------------------------------------
.../persistence/pagemem/PageMemoryImpl.java | 37 +++++++++++---------
1 file changed, 21 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
[34/50] [abbrv] ignite git commit: ignite-6519 Race in
SplitAwareTopologyValidator on activator and server node join
Posted by sb...@apache.org.
ignite-6519 Race in SplitAwareTopologyValidator on activator and server node join
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5d90b8fe
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5d90b8fe
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5d90b8fe
Branch: refs/heads/ignite-3478-tree
Commit: 5d90b8feb5eb65ce190ca4106d31f386c7be42a3
Parents: 01daee6
Author: Alexandr Kuramshin <ak...@gridgain.com>
Authored: Mon Oct 23 15:28:28 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Oct 23 15:28:28 2017 +0300
----------------------------------------------------------------------
.../internal/TestRecordingCommunicationSpi.java | 12 +
...niteTopologyValidatorGridSplitCacheTest.java | 358 +++++++++++++++----
.../IgniteCacheTopologySplitAbstractTest.java | 266 ++++++++++++++
3 files changed, 564 insertions(+), 72 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5d90b8fe/modules/core/src/test/java/org/apache/ignite/internal/TestRecordingCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/TestRecordingCommunicationSpi.java b/modules/core/src/test/java/org/apache/ignite/internal/TestRecordingCommunicationSpi.java
index ab61687..cf4f059 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/TestRecordingCommunicationSpi.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/TestRecordingCommunicationSpi.java
@@ -27,6 +27,7 @@ import java.util.Set;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteException;
import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.managers.communication.GridIoMessage;
import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -71,6 +72,12 @@ public class TestRecordingCommunicationSpi extends TcpCommunicationSpi {
/** {@inheritDoc} */
@Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackC)
throws IgniteSpiException {
+ // All ignite code expects that 'send' fails after discovery listener for node fail finished.
+ if (getSpiContext().node(node.id()) == null) {
+ throw new IgniteSpiException(new ClusterTopologyCheckedException("Failed to send message" +
+ " (node left topology): " + node));
+ }
+
if (msg instanceof GridIoMessage) {
GridIoMessage ioMsg = (GridIoMessage)msg;
@@ -115,6 +122,11 @@ public class TestRecordingCommunicationSpi extends TcpCommunicationSpi {
super.sendMessage(node, msg, ackC);
}
+ /** {@inheritDoc} */
+ @Override public void sendMessage(ClusterNode node, Message msg) throws IgniteSpiException {
+ sendMessage(node, msg, null);
+ }
+
/**
* @param recordP Record predicate.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/5d90b8fe/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorGridSplitCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorGridSplitCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorGridSplitCacheTest.java
index 1f3b875..1885e9a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorGridSplitCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorGridSplitCacheTest.java
@@ -17,32 +17,43 @@
package org.apache.ignite.internal.processors.cache;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cache.affinity.Affinity;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.MemoryConfiguration;
import org.apache.ignite.configuration.TopologyValidator;
import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCacheTopologySplitAbstractTest;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.resources.CacheNameResource;
import org.apache.ignite.resources.IgniteInstanceResource;
import org.apache.ignite.resources.LoggerResource;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.PRIMARY_SYNC;
+import static org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.DFLT_PORT;
/**
* Tests complex scenario with topology validator. Grid is split between to data centers, defined by attribute {@link
* #DC_NODE_ATTR}. If only nodes from single DC are left in topology, grid is moved into inoperative state until special
* activator node'll enter a topology, enabling grid operations.
*/
-public class IgniteTopologyValidatorGridSplitCacheTest extends GridCommonAbstractTest {
+public class IgniteTopologyValidatorGridSplitCacheTest extends IgniteCacheTopologySplitAbstractTest {
+
/** */
private static final String DC_NODE_ATTR = "dc";
@@ -50,10 +61,10 @@ public class IgniteTopologyValidatorGridSplitCacheTest extends GridCommonAbstrac
private static final String ACTIVATOR_NODE_ATTR = "split.resolved";
/** */
- private static final int GRID_CNT = 8;
+ private static final int GRID_CNT = 32;
/** */
- private static final int CACHES_CNT = 100;
+ private static final int CACHES_CNT = 50;
/** */
private static final int RESOLVER_GRID_IDX = GRID_CNT;
@@ -62,7 +73,62 @@ public class IgniteTopologyValidatorGridSplitCacheTest extends GridCommonAbstrac
private static final int CONFIGLESS_GRID_IDX = GRID_CNT + 1;
/** */
- private boolean useCacheGrp = false;
+ private static final String STATIC_IP = "127.0.0.1";
+
+ /** */
+ private static final Collection<String> SEG_FINDER_0;
+
+ /** */
+ private static final Collection<String> SEG_FINDER_1;
+
+ /** */
+ private static final Collection<String> SEG_FINDER_ALL;
+
+ static {
+ Collection<String> seg0 = new ArrayList<>();
+
+ Collection<String> seg1 = new ArrayList<>();
+
+ for (int i = 0; i < GRID_CNT; i += 2) {
+ seg0.add(STATIC_IP + ':' + (DFLT_PORT + i));
+
+ seg1.add(STATIC_IP + ':' + (DFLT_PORT + i + 1));
+ }
+ SEG_FINDER_0 = Collections.unmodifiableCollection(seg0);
+
+ SEG_FINDER_1 = Collections.unmodifiableCollection(seg1);
+
+ SEG_FINDER_ALL = F.concat(false, SEG_FINDER_0, SEG_FINDER_1);
+ }
+
+ /** */
+ private boolean useCacheGrp;
+
+ /** */
+ private int getDiscoPort(int gridIdx) {
+ return DFLT_PORT + gridIdx;
+ }
+
+ /** */
+ private boolean isDiscoPort(int port) {
+ return port >= DFLT_PORT &&
+ port <= (DFLT_PORT + TcpDiscoverySpi.DFLT_PORT_RANGE);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected boolean isBlocked(int locPort, int rmtPort) {
+ return isDiscoPort(locPort) && isDiscoPort(rmtPort) && segment(locPort) != segment(rmtPort);
+ }
+
+ /** */
+ private int segment(int discoPort) {
+ return (discoPort - DFLT_PORT) % 2;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected int segment(ClusterNode node) {
+ return node.attribute(DC_NODE_ATTR);
+ }
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
@@ -70,17 +136,32 @@ public class IgniteTopologyValidatorGridSplitCacheTest extends GridCommonAbstrac
int idx = getTestIgniteInstanceIndex(gridName);
- cfg.setUserAttributes(F.asMap(DC_NODE_ATTR, idx % 2));
+ Map<String, Object> userAttrs = new HashMap<>(4);
+
+ int segment = idx % 2;
+
+ userAttrs.put(DC_NODE_ATTR, segment);
+
+ TcpDiscoverySpi disco = (TcpDiscoverySpi)cfg.getDiscoverySpi();
+
+ disco.setLocalPort(getDiscoPort(idx));
+
+ disco.setIpFinder(new TcpDiscoveryVmIpFinder().setAddresses(segmented() ?
+ (segment == 0 ? SEG_FINDER_0 : SEG_FINDER_1) : SEG_FINDER_ALL));
if (idx != CONFIGLESS_GRID_IDX) {
if (idx == RESOLVER_GRID_IDX) {
cfg.setClientMode(true);
- cfg.setUserAttributes(F.asMap(ACTIVATOR_NODE_ATTR, "true"));
+ userAttrs.put(ACTIVATOR_NODE_ATTR, "true");
}
else
cfg.setActiveOnStart(false);
}
+ cfg.setUserAttributes(userAttrs);
+
+ cfg.setMemoryConfiguration(new MemoryConfiguration().
+ setDefaultMemoryPolicySize((50L << 20) + (100L << 20) * CACHES_CNT / GRID_CNT));
return cfg;
}
@@ -129,6 +210,12 @@ public class IgniteTopologyValidatorGridSplitCacheTest extends GridCommonAbstrac
stopAllGrids();
}
+ /** */
+ protected void stopGrids(int... grids) {
+ for (int idx : grids)
+ stopGrid(idx);
+ }
+
/**
* Tests topology split scenario.
*
@@ -149,8 +236,8 @@ public class IgniteTopologyValidatorGridSplitCacheTest extends GridCommonAbstrac
/**
* Tests topology split scenario.
- * @param useCacheGrp Use cache group.
*
+ * @param useCacheGrp Use cache group.
* @throws Exception If failed.
*/
private void testTopologyValidator0(boolean useCacheGrp) throws Exception {
@@ -161,31 +248,26 @@ public class IgniteTopologyValidatorGridSplitCacheTest extends GridCommonAbstrac
grid.getOrCreateCaches(getCacheConfigurations());
// Init grid index arrays
- int[] dc1 = new int[GRID_CNT / 2];
+ int[] seg1 = new int[GRID_CNT / 2];
- for (int i = 0; i < dc1.length; ++i)
- dc1[i] = i * 2 + 1;
+ for (int i = 0; i < seg1.length; ++i)
+ seg1[i] = i * 2 + 1;
- int[] dc0 = new int[GRID_CNT - dc1.length];
+ int[] seg0 = new int[GRID_CNT - seg1.length];
- for (int i = 0; i < dc0.length; ++i)
- dc0[i] = i * 2;
+ for (int i = 0; i < seg0.length; ++i)
+ seg0[i] = i * 2;
// Tests what each node is able to do puts.
- tryPut(dc0);
-
- tryPut(dc1);
+ tryPut(seg0, seg1);
clearAll();
// Force segmentation.
- for (int idx : dc1)
- stopGrid(idx);
-
- awaitPartitionMapExchange();
+ splitAndWait();
try {
- tryPut(dc0);
+ tryPut(seg0, seg1);
fail();
}
@@ -196,24 +278,41 @@ public class IgniteTopologyValidatorGridSplitCacheTest extends GridCommonAbstrac
// Repair split by adding activator node in topology.
resolveSplit();
- tryPut(dc0);
+ tryPut(seg0);
clearAll();
+ try {
+ tryPut(seg1);
+
+ fail();
+ }
+ catch (Exception e) {
+ // No-op.
+ }
+
+ stopGrids(seg1);
+
// Fix split by adding node from second DC.
+ unsplit();
+
startGrid(CONFIGLESS_GRID_IDX);
awaitPartitionMapExchange();
+ tryPut(seg0);
+
tryPut(CONFIGLESS_GRID_IDX);
+ clearAll();
+
// Force split by removing last node from second DC.
stopGrid(CONFIGLESS_GRID_IDX);
awaitPartitionMapExchange();
try {
- tryPut(dc0);
+ tryPut(seg0);
fail();
}
@@ -221,10 +320,13 @@ public class IgniteTopologyValidatorGridSplitCacheTest extends GridCommonAbstrac
// No-op.
}
+ // Repair split with concurrent server node join race.
+ resolveSplitWithRace(CONFIGLESS_GRID_IDX);
+
// Repair split by adding activator node in topology.
resolveSplit();
- tryPut(dc0);
+ tryPut(seg0);
clearAll();
@@ -233,9 +335,7 @@ public class IgniteTopologyValidatorGridSplitCacheTest extends GridCommonAbstrac
awaitPartitionMapExchange();
- for (int i = 0; i < dc0.length; i++) {
- int idx = dc0[i];
-
+ for (int idx : seg0) {
if (idx == 0)
continue;
@@ -249,7 +349,7 @@ public class IgniteTopologyValidatorGridSplitCacheTest extends GridCommonAbstrac
awaitPartitionMapExchange();
- assertEquals("Expecting put count", CACHES_CNT * dc0.length, tryPut(dc0));
+ assertEquals("Expecting put count", CACHES_CNT * seg0.length, tryPut(seg0));
}
/**
@@ -277,39 +377,132 @@ public class IgniteTopologyValidatorGridSplitCacheTest extends GridCommonAbstrac
}
/**
- * @param grids Grids to test.
+ * Resolves split by client node join with server node join race simulation.
+ *
+ * @param srvNode server node index to simulate join race
+ * @throws Exception If failed.
*/
- private int tryPut(int... grids) {
+ private void resolveSplitWithRace(int srvNode) throws Exception {
+ startGrid(RESOLVER_GRID_IDX);
+
+ startGrid(srvNode);
+
+ awaitPartitionMapExchange();
+
+ tryPut(srvNode);
+
+ clearAll();
+
+ stopGrid(srvNode);
+
+ awaitPartitionMapExchange();
+
+ try {
+ tryPut(0);
+
+ fail();
+ }
+ catch (Exception e) {
+ // No-op.
+ }
+
+ stopGrid(RESOLVER_GRID_IDX);
+ }
+
+ /**
+ * @param idx Grid to test.
+ * @return number of successful puts to caches
+ * @throws IgniteException If all tries to put was failed.
+ * @throws AssertionError If some of tries to put was failed.
+ */
+ private int tryPut(int idx) {
+ IgniteEx g = grid(idx);
+
int putCnt = 0;
- for (int i = 0; i < grids.length; i++) {
- IgniteEx g = grid(grids[i]);
- for (int cnt = 0; cnt < CACHES_CNT; cnt++) {
- String cacheName = testCacheName(cnt);
+ IgniteException ex = null;
- for (int k = 0; k < 100; k++) {
- if (g.affinity(cacheName).isPrimary(g.localNode(), k)) {
- IgniteCache<Object, Object> cache = g.cache(cacheName);
+ for (int cnt = 0; cnt < CACHES_CNT; cnt++) {
+ String cacheName = testCacheName(cnt);
- try {
- cache.put(k, k);
- }
- catch (Throwable t) {
- log.error("Failed to put entry: [cache=" + cacheName + ", key=" + k + ", nodeId=" +
- g.name() + ']', t);
+ int key = -1;
- throw t;
- }
+ Affinity<Object> aff = g.affinity(cacheName);
+
+ for (int k = 0; k < aff.partitions(); k++) {
+ if (aff.isPrimary(g.cluster().localNode(), k)) {
+ key = k;
- assertEquals(1, cache.localSize());
+ break;
+ }
+ }
- putCnt++;
+ assertTrue("Failed to find affinity key [gridIdx=" + idx +", cache=" + cacheName + ']',
+ key != -1);
- break;
- }
+ IgniteCache<Object, Object> cache = g.cache(cacheName);
+
+ try {
+ cache.put(key, key);
+
+ assertEquals(1, cache.localSize());
+
+ if (ex != null)
+ throw new AssertionError("Successful tryPut after failure [gridIdx=" + idx +
+ ", cacheName=" + cacheName + ']', ex);
+
+ putCnt++;
+ }
+ catch (Throwable t) {
+ IgniteException e = new IgniteException("Failed to put entry [cache=" + cacheName + ", key=" +
+ key + ']', t);
+
+ log.error(e.getMessage(), e.getCause());
+
+ if (ex == null)
+ ex = new IgniteException("Failed to put entry [node=" + g.name() + ']');
+
+ ex.addSuppressed(t);
+ }
+ }
+ if (ex != null)
+ throw ex;
+
+ return putCnt;
+ }
+
+ /**
+ * @param grids Grids to test.
+ * @return number of successful puts to caches
+ * @throws IgniteException If all tries to put was failed.
+ * @throws AssertionError If some of tries to put was failed.
+ */
+ private int tryPut(int[]... grids) {
+ int putCnt = 0;
+
+ IgniteException ex = null;
+
+ for (int[] idxs : grids) {
+ for (int idx : idxs) {
+ try {
+ int cnt = tryPut(idx);
+
+ if (ex != null)
+ throw new AssertionError("Successful tryPut after failure [gridIdx=" + idx +
+ ", sucessful puts = " + cnt + ']', ex);
+
+ putCnt += cnt;
+ }
+ catch (Exception e) {
+ if (ex == null)
+ ex = new IgniteException("Failed to put entry");
+
+ ex.addSuppressed(e);
}
}
}
+ if (ex != null)
+ throw ex;
return putCnt;
}
@@ -318,20 +511,21 @@ public class IgniteTopologyValidatorGridSplitCacheTest extends GridCommonAbstrac
* Prevents cache from performing any operation if only nodes from single data center are left in topology.
*/
private static class SplitAwareTopologyValidator implements TopologyValidator {
+
/** */
private static final long serialVersionUID = 0L;
/** */
@CacheNameResource
- private String cacheName;
+ private transient String cacheName;
/** */
@IgniteInstanceResource
- private Ignite ignite;
+ private transient Ignite ignite;
/** */
@LoggerResource
- private IgniteLogger log;
+ private transient IgniteLogger log;
/** State. */
private transient State state;
@@ -340,12 +534,13 @@ public class IgniteTopologyValidatorGridSplitCacheTest extends GridCommonAbstrac
@Override public boolean validate(Collection<ClusterNode> nodes) {
initIfNeeded(nodes);
- if (!F.view(nodes, new IgnitePredicate<ClusterNode>() {
+ for (ClusterNode node : F.view(nodes, new IgnitePredicate<ClusterNode>() {
@Override public boolean apply(ClusterNode node) {
return !node.isClient() && node.attribute(DC_NODE_ATTR) == null;
}
- }).isEmpty()) {
- log.error("No valid server nodes are detected in topology: [cacheName=" + cacheName + ']');
+ })) {
+ log.error("Not valid server nodes are detected in topology: [cacheName=" + cacheName + ", node=" +
+ node + ']');
return false;
}
@@ -353,7 +548,7 @@ public class IgniteTopologyValidatorGridSplitCacheTest extends GridCommonAbstrac
boolean segmented = segmented(nodes);
if (!segmented)
- state = State.VALID; // Also clears possible REPAIRED state.
+ state = State.VALID; // Also clears possible BEFORE_REPAIRED and REPAIRED states.
else {
if (state == State.REPAIRED) // Any topology change in segmented grid in repaired mode is valid.
return true;
@@ -361,23 +556,40 @@ public class IgniteTopologyValidatorGridSplitCacheTest extends GridCommonAbstrac
// Find discovery event node.
ClusterNode evtNode = evtNode(nodes);
- if (activator(evtNode)) {
- if (log.isInfoEnabled())
- log.info("Grid segmentation is repaired: [cacheName=" + cacheName + ']');
-
- state = State.REPAIRED;
- }
+ if (activator(evtNode))
+ state = State.BEFORE_REPARED;
else {
- if (state == State.VALID) {
- if (log.isInfoEnabled())
- log.info("Grid segmentation is detected: [cacheName=" + cacheName + ']');
+ if (state == State.BEFORE_REPARED) {
+ boolean activatorLeft = true;
+
+ // Check if activator is no longer in topology.
+ for (ClusterNode node : nodes) {
+ if (node.isClient() && activator(node)) {
+ activatorLeft = false;
+
+ break;
+ }
+ }
+
+ if (activatorLeft) {
+ if (log.isInfoEnabled())
+ log.info("Grid segmentation is repaired: [cacheName=" + cacheName + ']');
+
+ state = State.REPAIRED; // Switch to REPAIRED state only when activator leaves.
+ } // Else stay in BEFORE_REPARED state.
}
+ else {
+ if (state == State.VALID) {
+ if (log.isInfoEnabled())
+ log.info("Grid segmentation is detected: [cacheName=" + cacheName + ']');
+ }
- state = State.NOTVALID;
+ state = State.NOTVALID;
+ }
}
}
- return state != State.NOTVALID;
+ return state == State.VALID || state == State.REPAIRED;
}
/** */
@@ -418,7 +630,7 @@ public class IgniteTopologyValidatorGridSplitCacheTest extends GridCommonAbstrac
// Search for activator node in history on start.
long topVer = evtNode(nodes).order();
- while(topVer > 0) {
+ while (topVer > 0) {
Collection<ClusterNode> top = ignite.cluster().topology(topVer--);
// Stop on reaching history limit.
@@ -460,11 +672,13 @@ public class IgniteTopologyValidatorGridSplitCacheTest extends GridCommonAbstrac
/** States. */
private enum State {
- /** Topology valid. */
+ /** Topology is valid. */
VALID,
- /** Topology not valid */
+ /** Topology is not valid */
NOTVALID,
- /** Topology repaired (valid) */
+ /** Before topology will be repaired (valid) */
+ BEFORE_REPARED,
+ /** Topology is repaired (valid) */
REPAIRED;
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5d90b8fe/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheTopologySplitAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheTopologySplitAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheTopologySplitAbstractTest.java
new file mode 100644
index 0000000..196681d
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheTopologySplitAbstractTest.java
@@ -0,0 +1,266 @@
+/*
+ * 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.internal.processors.cache.distributed.dht;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.SocketTimeoutException;
+import java.util.Collection;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.TestRecordingCommunicationSpi;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.lang.IgniteBiPredicate;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.spi.IgniteSpiOperationTimeoutException;
+import org.apache.ignite.spi.IgniteSpiOperationTimeoutHelper;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ * Abstract class for tests over split in two half topology.
+ */
+public abstract class IgniteCacheTopologySplitAbstractTest extends GridCommonAbstractTest {
+
+ /** Segmentation state. */
+ private volatile boolean segmented;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ cfg.setFailureDetectionTimeout(3_000L);
+
+ cfg.setDiscoverySpi(new SplitTcpDiscoverySpi());
+
+ cfg.setCommunicationSpi(new TestRecordingCommunicationSpi());
+
+ return cfg;
+ }
+
+ /**
+ * Trigger segmentation and wait for results. Should be called on stable topology.
+ *
+ * @throws InterruptedException If interrupted while waiting.
+ * @throws IgniteCheckedException On error.
+ */
+ protected void splitAndWait() throws InterruptedException, IgniteCheckedException {
+ if (log.isInfoEnabled())
+ log.info(">>> Simulating split");
+
+ long topVer = grid(0).cluster().topologyVersion();
+
+ // Trigger segmentation.
+ segmented = true;
+
+ for (Ignite ignite : G.allGrids()) {
+ TestRecordingCommunicationSpi comm = (TestRecordingCommunicationSpi)
+ ignite.configuration().getCommunicationSpi();
+
+ comm.blockMessages(new SegmentBlocker(ignite.cluster().localNode()));
+ }
+
+ Collection<Ignite> seg0 = F.view(G.allGrids(), new IgnitePredicate<Ignite>() {
+ @Override public boolean apply(Ignite ignite) {
+ return segment(ignite.cluster().localNode()) == 0;
+ }
+ });
+
+ Collection<Ignite> seg1 = F.view(G.allGrids(), new IgnitePredicate<Ignite>() {
+ @Override public boolean apply(Ignite ignite) {
+ return segment(ignite.cluster().localNode()) == 1;
+ }
+ });
+
+ for (Ignite grid : seg0)
+ ((IgniteKernal)grid).context().discovery().topologyFuture(topVer + seg1.size()).get();
+
+ for (Ignite grid : seg1)
+ ((IgniteKernal)grid).context().discovery().topologyFuture(topVer + seg0.size()).get();
+
+ // awaitPartitionMapExchange won't work because coordinator is wrong for second segment.
+ for (Ignite grid : G.allGrids())
+ ((IgniteKernal)grid).context().cache().context().exchange().lastTopologyFuture().get();
+
+ if (log.isInfoEnabled())
+ log.info(">>> Finished waiting for split");
+ }
+
+ /**
+ * Restore initial state
+ */
+ protected void unsplit() {
+ if (log.isInfoEnabled())
+ log.info(">>> Restoring from split");
+
+ segmented = false;
+
+ for (Ignite ignite : G.allGrids()) {
+ TestRecordingCommunicationSpi comm = (TestRecordingCommunicationSpi)
+ ignite.configuration().getCommunicationSpi();
+
+ comm.stopBlock();
+ }
+ }
+
+ /**
+ * @return Segmented status.
+ */
+ protected boolean segmented() {
+ return segmented;
+ }
+
+ /**
+ * Defines split matrix.
+ *
+ * @param locPort Local port.
+ * @param rmtPort Rmt port.
+ * @return {@code true} is link is blocked.
+ */
+ protected abstract boolean isBlocked(int locPort, int rmtPort);
+
+ /**
+ * Defines instance segment: 0 or 1.
+ *
+ * @param node Node.
+ * @return Index of instance segment.
+ */
+ protected abstract int segment(ClusterNode node);
+
+ /**
+ * Discovery SPI which can simulate network split.
+ */
+ protected class SplitTcpDiscoverySpi extends TcpDiscoverySpi {
+ /**
+ * @param sockAddr Remote socket address.
+ * @return Segmented status.
+ */
+ protected boolean segmented(InetSocketAddress sockAddr) {
+ if (!segmented)
+ return false;
+
+ int rmtPort = sockAddr.getPort();
+
+ boolean b = isBlocked(getLocalPort(), rmtPort);
+
+ if (b && log.isDebugEnabled())
+ log.debug("Block cross-segment communication [locPort=" + getLocalPort() + ", rmtPort=" + rmtPort + ']');
+
+ return b;
+ }
+
+ /**
+ * @param sockAddr Socket address.
+ * @param timeout Socket timeout.
+ * @throws SocketTimeoutException If segmented.
+ */
+ protected void checkSegmented(InetSocketAddress sockAddr, long timeout) throws SocketTimeoutException {
+ if (segmented(sockAddr)) {
+ if (timeout > 0) {
+ try {
+ Thread.sleep(timeout);
+ }
+ catch (InterruptedException e) {
+ // No-op.
+ }
+ }
+
+ throw new SocketTimeoutException("Fake socket timeout.");
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override protected Socket openSocket(Socket sock, InetSocketAddress remAddr,
+ IgniteSpiOperationTimeoutHelper timeoutHelper) throws IOException, IgniteSpiOperationTimeoutException {
+ checkSegmented(remAddr, timeoutHelper.nextTimeoutChunk(getSocketTimeout()));
+
+ return super.openSocket(sock, remAddr, timeoutHelper);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeToSocket(
+ Socket sock,
+ TcpDiscoveryAbstractMessage msg,
+ byte[] data,
+ long timeout
+ ) throws IOException {
+ checkSegmented((InetSocketAddress)sock.getRemoteSocketAddress(), timeout);
+
+ super.writeToSocket(sock, msg, data, timeout);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeToSocket(Socket sock,
+ OutputStream out,
+ TcpDiscoveryAbstractMessage msg,
+ long timeout) throws IOException, IgniteCheckedException {
+ checkSegmented((InetSocketAddress)sock.getRemoteSocketAddress(), timeout);
+
+ super.writeToSocket(sock, out, msg, timeout);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeToSocket(
+ Socket sock,
+ TcpDiscoveryAbstractMessage msg,
+ long timeout
+ ) throws IOException, IgniteCheckedException {
+ checkSegmented((InetSocketAddress)sock.getRemoteSocketAddress(), timeout);
+
+ super.writeToSocket(sock, msg, timeout);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeToSocket(TcpDiscoveryAbstractMessage msg, Socket sock, int res,
+ long timeout) throws IOException {
+ checkSegmented((InetSocketAddress)sock.getRemoteSocketAddress(), timeout);
+
+ super.writeToSocket(msg, sock, res, timeout);
+ }
+ }
+
+ /** */
+ protected class SegmentBlocker implements IgniteBiPredicate<ClusterNode, Message> {
+ /** */
+ private final ClusterNode locNode;
+
+ /**
+ * @param locNode Local node.
+ */
+ SegmentBlocker(ClusterNode locNode) {
+ assert locNode != null;
+
+ this.locNode = locNode;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean apply(ClusterNode node, Message message) {
+ return segment(locNode) != segment(node);
+ }
+ }
+}
\ No newline at end of file
[17/50] [abbrv] ignite git commit: IGNITE-6030 Allow enabling
persistence per data region
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicyInitializationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicyInitializationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicyInitializationTest.java
index 842f618..fb1574d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicyInitializationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicyInitializationTest.java
@@ -73,7 +73,7 @@ public class MemoryPolicyInitializationTest extends GridCommonAbstractTest {
IgniteEx ignite = startGrid(0);
- Collection<MemoryPolicy> allMemPlcs = ignite.context().cache().context().database().memoryPolicies();
+ Collection<DataRegion> allMemPlcs = ignite.context().cache().context().database().dataRegions();
assertTrue(allMemPlcs.size() == 2);
@@ -89,7 +89,7 @@ public class MemoryPolicyInitializationTest extends GridCommonAbstractTest {
IgniteEx ignite = startGrid(0);
- Collection<MemoryPolicy> allMemPlcs = ignite.context().cache().context().database().memoryPolicies();
+ Collection<DataRegion> allMemPlcs = ignite.context().cache().context().database().dataRegions();
assertTrue(allMemPlcs.size() == 3);
@@ -110,13 +110,13 @@ public class MemoryPolicyInitializationTest extends GridCommonAbstractTest {
IgniteCacheDatabaseSharedManager dbMgr = ignite.context().cache().context().database();
- Collection<MemoryPolicy> allMemPlcs = dbMgr.memoryPolicies();
+ Collection<DataRegion> allMemPlcs = dbMgr.dataRegions();
assertTrue(allMemPlcs.size() == 2);
verifyDefaultAndSystemMemoryPolicies(allMemPlcs);
- MemoryPolicy dfltMemPlc = U.field(dbMgr, "dfltMemPlc");
+ DataRegion dfltMemPlc = U.field(dbMgr, "dfltDataRegion");
assertTrue(dfltMemPlc.config().getMaxSize() == USER_DEFAULT_MEM_PLC_SIZE);
}
@@ -134,13 +134,13 @@ public class MemoryPolicyInitializationTest extends GridCommonAbstractTest {
IgniteCacheDatabaseSharedManager dbMgr = ignite.context().cache().context().database();
- Collection<MemoryPolicy> allMemPlcs = dbMgr.memoryPolicies();
+ Collection<DataRegion> allMemPlcs = dbMgr.dataRegions();
assertTrue(allMemPlcs.size() == 3);
verifyDefaultAndSystemMemoryPolicies(allMemPlcs);
- MemoryPolicy dfltMemPlc = U.field(dbMgr, "dfltMemPlc");
+ DataRegion dfltMemPlc = U.field(dbMgr, "dfltDataRegion");
assertTrue(dfltMemPlc.config().getMaxSize() == USER_CUSTOM_MEM_PLC_SIZE);
}
@@ -220,7 +220,7 @@ public class MemoryPolicyInitializationTest extends GridCommonAbstractTest {
private void verifyCacheMemoryPolicy(IgniteCache cache, String plcName) {
GridCacheContext ctx = ((IgniteCacheProxy) cache).context();
- assertEquals(plcName, ctx.memoryPolicy().config().getName());
+ assertEquals(plcName, ctx.dataRegion().config().getName());
}
/**
@@ -278,12 +278,12 @@ public class MemoryPolicyInitializationTest extends GridCommonAbstractTest {
/**
* @param allMemPlcs Collection of all memory policies.
*/
- private void verifyDefaultAndSystemMemoryPolicies(Collection<MemoryPolicy> allMemPlcs) {
+ private void verifyDefaultAndSystemMemoryPolicies(Collection<DataRegion> allMemPlcs) {
assertTrue("Default memory policy is not presented",
isMemoryPolicyPresented(allMemPlcs, DFLT_MEM_PLC_DEFAULT_NAME));
assertTrue("System memory policy is not presented",
- isMemoryPolicyPresented(allMemPlcs, IgniteCacheDatabaseSharedManager.SYSTEM_MEMORY_POLICY_NAME));
+ isMemoryPolicyPresented(allMemPlcs, IgniteCacheDatabaseSharedManager.SYSTEM_DATA_REGION_NAME));
}
/**
@@ -303,8 +303,8 @@ public class MemoryPolicyInitializationTest extends GridCommonAbstractTest {
* @param memPlcs Collection of memory policies.
* @param nameToVerify Excepted name of memory policy.
*/
- private boolean isMemoryPolicyPresented(Collection<MemoryPolicy> memPlcs, String nameToVerify) {
- for (MemoryPolicy memPlc : memPlcs) {
+ private boolean isMemoryPolicyPresented(Collection<DataRegion> memPlcs, String nameToVerify) {
+ for (DataRegion memPlc : memPlcs) {
if (nameToVerify.equals(memPlc.config().getName()))
return true;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsCacheRestoreTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsCacheRestoreTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsCacheRestoreTest.java
index 25626f4..577cf9a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsCacheRestoreTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsCacheRestoreTest.java
@@ -21,9 +21,9 @@ import java.util.Arrays;
import java.util.List;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
@@ -40,6 +40,9 @@ public class IgnitePdsCacheRestoreTest extends GridCommonAbstractTest {
/** */
private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+ /** Non-persistent data region name. */
+ private static final String NO_PERSISTENCE_REGION = "no-persistence-region";
+
/** */
private CacheConfiguration[] ccfgs;
@@ -55,17 +58,18 @@ public class IgnitePdsCacheRestoreTest extends GridCommonAbstractTest {
ccfgs = null;
}
- MemoryConfiguration memCfg = new MemoryConfiguration();
- memCfg.setPageSize(1024);
- memCfg.setDefaultMemoryPolicySize(10 * 1024 * 1024);
-
- cfg.setMemoryConfiguration(memCfg);
-
- PersistentStoreConfiguration pCfg = new PersistentStoreConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(10 * 1024 * 1024).setPersistenceEnabled(true))
+ .setPageSize(1024)
+ .setWalMode(WALMode.LOG_ONLY);
- pCfg.setWalMode(WALMode.LOG_ONLY);
+ memCfg.setDataRegionConfigurations(new DataRegionConfiguration()
+ .setMaxSize(10 * 1024 * 1024)
+ .setName(NO_PERSISTENCE_REGION)
+ .setPersistenceEnabled(false));
- cfg.setPersistentStoreConfiguration(pCfg);
+ cfg.setDataStorageConfiguration(memCfg);
return cfg;
}
@@ -137,14 +141,22 @@ public class IgnitePdsCacheRestoreTest extends GridCommonAbstractTest {
IgniteCache<Object, Object> cache2 = ignite(2).cache("c2");
+ IgniteCache<Object, Object> cache3 = ignite(2).cache("c3");
+
for (Integer key : keys) {
assertEquals(key, cache1.get(key));
assertNull(cache2.get(key));
+ assertNull(cache3.get(key));
+
cache2.put(key, key);
assertEquals(key, cache2.get(key));
+
+ cache3.put(key, key);
+
+ assertEquals(key, cache3.get(key));
}
List<Integer> nearKeys = nearKeys(cache1, 10, 0);
@@ -152,6 +164,10 @@ public class IgnitePdsCacheRestoreTest extends GridCommonAbstractTest {
for (Integer key : nearKeys) {
assertNull(cache1.get(key));
assertNull(cache2.get(key));
+ assertNull(cache3.get(key));
+
+ cache3.put(key, key);
+ assertEquals(key, cache3.get(key));
cache2.put(key, key);
assertEquals(key, cache2.get(key));
@@ -165,6 +181,8 @@ public class IgnitePdsCacheRestoreTest extends GridCommonAbstractTest {
awaitPartitionMapExchange();
for (Integer key : nearKeys) {
+ assertEquals(key, cache3.get(key));
+
assertEquals(key, cache2.get(key));
assertEquals(key, cache1.get(key));
@@ -186,10 +204,13 @@ public class IgnitePdsCacheRestoreTest extends GridCommonAbstractTest {
* @return Configurations set 1.
*/
private CacheConfiguration[] configurations2() {
- CacheConfiguration[] ccfgs = new CacheConfiguration[2];
+ CacheConfiguration[] ccfgs = new CacheConfiguration[3];
ccfgs[0] = cacheConfiguration("c1");
ccfgs[1] = cacheConfiguration("c2");
+ ccfgs[2] = cacheConfiguration("c3");
+
+ ccfgs[2].setDataRegionName(NO_PERSISTENCE_REGION);
return ccfgs;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsMultiNodePutGetRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsMultiNodePutGetRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsMultiNodePutGetRestartTest.java
index b8db802..615e108 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsMultiNodePutGetRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsMultiNodePutGetRestartTest.java
@@ -30,9 +30,10 @@ import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.BinaryConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -40,7 +41,6 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.apache.ignite.configuration.MemoryConfiguration;
import static org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.DFLT_STORE_DIR;
@@ -61,18 +61,12 @@ public class IgnitePdsMultiNodePutGetRestartTest extends GridCommonAbstractTest
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(100 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setInitialSize(100 * 1024 * 1024);
- memPlcCfg.setMaxSize(100 * 1024 * 1024);
-
- dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
- dbCfg.setMemoryPolicies(memPlcCfg);
-
- cfg.setMemoryConfiguration(dbCfg);
+ cfg.setDataStorageConfiguration(memCfg);
CacheConfiguration ccfg = new CacheConfiguration(CACHE_NAME);
@@ -86,7 +80,6 @@ public class IgnitePdsMultiNodePutGetRestartTest extends GridCommonAbstractTest
cfg.setCacheConfiguration(ccfg);
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(IP_FINDER));
cfg.setMarshaller(null);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPageEvictionDuringPartitionClearTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPageEvictionDuringPartitionClearTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPageEvictionDuringPartitionClearTest.java
index c1bec35..3dfdc57 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPageEvictionDuringPartitionClearTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPageEvictionDuringPartitionClearTest.java
@@ -25,10 +25,9 @@ import org.apache.ignite.cache.CacheRebalanceMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
@@ -60,26 +59,12 @@ public class IgnitePdsPageEvictionDuringPartitionClearTest extends GridCommonAbs
cfg.setCacheConfiguration(ccfg);
// Intentionally set small page cache size.
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(70 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setInitialSize(70 * 1024 * 1024);
- memPlcCfg.setMaxSize(70 * 1024 * 1024);
-
- memPlcCfg.setName("dfltMemPlc");
-
- MemoryConfiguration memCfg = new MemoryConfiguration();
-
- memCfg.setMemoryPolicies(memPlcCfg);
-
- memCfg.setDefaultMemoryPolicyName(memPlcCfg.getName());
-
- cfg.setMemoryConfiguration(memCfg);
-
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setWalMode(WALMode.LOG_ONLY)
- );
+ cfg.setDataStorageConfiguration(memCfg);
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPageEvictionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPageEvictionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPageEvictionTest.java
index 13cd8b4..47d0cb2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPageEvictionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPageEvictionTest.java
@@ -27,10 +27,10 @@ import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -58,22 +58,14 @@ public class IgnitePdsPageEvictionTest extends GridCommonAbstractTest {
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(50 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY)
+ .setPageSize(1024)
+ .setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);
- memCfg.setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);
-
- memCfg.setPageSize(1024);
-
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setInitialSize(50 * 1024 * 1024);
- memPlcCfg.setMaxSize(50 * 1024 * 1024);
-
- memCfg.setMemoryPolicies(memPlcCfg);
- memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
CacheConfiguration<DbKey, DbValue> ccfg = new CacheConfiguration<>(CACHE_NAME);
@@ -84,8 +76,6 @@ public class IgnitePdsPageEvictionTest extends GridCommonAbstractTest {
cfg.setCacheConfiguration(ccfg);
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
-
cfg.setDiscoverySpi(
new TcpDiscoverySpi()
.setIpFinder(IP_FINDER)
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsRebalancingOnNotStableTopologyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsRebalancingOnNotStableTopologyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsRebalancingOnNotStableTopologyTest.java
index 546a87a..893ecb5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsRebalancingOnNotStableTopologyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsRebalancingOnNotStableTopologyTest.java
@@ -28,10 +28,10 @@ import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.PartitionLossPolicy;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.testframework.junits.multijvm.IgniteProcessProxy;
@@ -167,23 +167,13 @@ public class IgnitePdsRebalancingOnNotStableTopologyTest extends GridCommonAbstr
cfg.setCacheConfiguration(ccfg);
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setCheckpointingFrequency(CHECKPOINT_FREQUENCY)
- );
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(200 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY)
+ .setCheckpointFrequency(CHECKPOINT_FREQUENCY);
- MemoryConfiguration memCfg = new MemoryConfiguration();
-
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setInitialSize(200 * 1024 * 1024);
- memPlcCfg.setMaxSize(200 * 1024 * 1024);
-
- memCfg.setMemoryPolicies(memPlcCfg);
- memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsTransactionsHangTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsTransactionsHangTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsTransactionsHangTest.java
index 7e8cfac..f3aee08 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsTransactionsHangTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsTransactionsHangTest.java
@@ -32,10 +32,9 @@ import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.BinaryConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.TransactionConfiguration;
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -123,26 +122,21 @@ public class IgnitePdsTransactionsHangTest extends GridCommonAbstractTest {
cfg.setTransactionConfiguration(txCfg);
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setWalHistorySize(1)
- .setCheckpointingFrequency(CHECKPOINT_FREQUENCY)
- );
+ DataRegionConfiguration memPlcCfg = new DataRegionConfiguration();
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
+ memPlcCfg.setName("dfltDataRegion");
memPlcCfg.setInitialSize(PAGE_CACHE_SIZE * 1024 * 1024);
memPlcCfg.setMaxSize(PAGE_CACHE_SIZE * 1024 * 1024);
+ memPlcCfg.setPersistenceEnabled(true);
- MemoryConfiguration memCfg = new MemoryConfiguration();
-
- memCfg.setMemoryPolicies(memPlcCfg);
- memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
+ DataStorageConfiguration memCfg = new DataStorageConfiguration();
+ memCfg.setDefaultDataRegionConfiguration(memPlcCfg);
+ memCfg.setWalHistorySize(1);
+ memCfg.setCheckpointFrequency(CHECKPOINT_FREQUENCY);
memCfg.setPageSize(PAGE_SIZE * 1024);
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWholeClusterRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWholeClusterRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWholeClusterRestartTest.java
index df5bfdf..91380f0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWholeClusterRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWholeClusterRestartTest.java
@@ -28,10 +28,9 @@ import org.apache.ignite.cache.CacheRebalanceMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.spi.checkpoint.noop.NoopCheckpointSpi;
@@ -56,18 +55,12 @@ public class IgnitePdsWholeClusterRestartTest extends GridCommonAbstractTest {
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(100 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setInitialSize(100 * 1024 * 1024);
- memPlcCfg.setMaxSize(100 * 1024 * 1024);
-
- dbCfg.setMemoryPolicies(memPlcCfg);
- dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(dbCfg);
+ cfg.setDataStorageConfiguration(memCfg);
CacheConfiguration ccfg1 = new CacheConfiguration();
@@ -85,11 +78,6 @@ public class IgnitePdsWholeClusterRestartTest extends GridCommonAbstractTest {
cfg.setCacheConfiguration(ccfg1);
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setWalMode(WALMode.LOG_ONLY)
- );
-
cfg.setConsistentId(gridName);
return cfg;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/DefaultPageSizeBackwardsCompatibilityTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/DefaultPageSizeBackwardsCompatibilityTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/DefaultPageSizeBackwardsCompatibilityTest.java
index e577886..9e01f7b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/DefaultPageSizeBackwardsCompatibilityTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/DefaultPageSizeBackwardsCompatibilityTest.java
@@ -23,10 +23,9 @@ import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
@@ -58,20 +57,20 @@ public class DefaultPageSizeBackwardsCompatibilityTest extends GridCommonAbstrac
TcpDiscoverySpi discoverySpi = (TcpDiscoverySpi)cfg.getDiscoverySpi();
discoverySpi.setIpFinder(IP_FINDER);
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration();
if (set2kPageSize)
memCfg.setPageSize(2048);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
+ DataRegionConfiguration memPlcCfg = new DataRegionConfiguration();
memPlcCfg.setMaxSize(100 * 1000 * 1000);
+ memPlcCfg.setName("dfltDataRegion");
+ memPlcCfg.setPersistenceEnabled(true);
- memPlcCfg.setName("dfltMemPlc");
+ memCfg.setDefaultDataRegionConfiguration(memPlcCfg);
+ memCfg.setCheckpointFrequency(3_000);
- memCfg.setMemoryPolicies(memPlcCfg);
- memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
CacheConfiguration ccfg1 = new CacheConfiguration();
@@ -82,8 +81,6 @@ public class DefaultPageSizeBackwardsCompatibilityTest extends GridCommonAbstrac
cfg.setCacheConfiguration(ccfg1);
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration().setCheckpointingFrequency(3_000));
-
cfg.setConsistentId(gridName);
return cfg;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCacheIntegrationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCacheIntegrationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCacheIntegrationTest.java
index d36894f..7d51b46 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCacheIntegrationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCacheIntegrationTest.java
@@ -31,10 +31,9 @@ import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.BinaryConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
@@ -65,25 +64,13 @@ public class IgnitePdsCacheIntegrationTest extends GridCommonAbstractTest {
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(100 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY)
+ .setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);
- dbCfg.setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);
-
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setInitialSize(100 * 1024 * 1024);
- memPlcCfg.setMaxSize(100 * 1024 * 1024);
-
- dbCfg.setMemoryPolicies(memPlcCfg);
- dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setWalMode(WALMode.LOG_ONLY)
- );
-
- cfg.setMemoryConfiguration(dbCfg);
+ cfg.setDataStorageConfiguration(memCfg);
CacheConfiguration ccfg = new CacheConfiguration(CACHE_NAME);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimulationWithRealCpDisabledTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimulationWithRealCpDisabledTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimulationWithRealCpDisabledTest.java
index b4c32d8..5ae8969 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimulationWithRealCpDisabledTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimulationWithRealCpDisabledTest.java
@@ -37,9 +37,9 @@ import java.nio.ByteOrder;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.CacheRebalanceMode;
import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
@@ -106,15 +106,12 @@ public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends GridCom
cfg.setCacheConfiguration(ccfg);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
-
- cfg.setMemoryConfiguration(dbCfg);
-
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setCheckpointingFrequency(500)
+ cfg.setDataStorageConfiguration(
+ new DataStorageConfiguration()
+ .setCheckpointFrequency(500)
.setWalMode(WALMode.LOG_ONLY)
.setAlwaysWriteFullPages(true)
+ .setDefaultDataRegionConfiguration(new DataRegionConfiguration().setPersistenceEnabled(true))
);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
@@ -163,7 +160,7 @@ public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends GridCom
// Otherwise we will violate page store integrity rules.
ig.cache(cacheName).put(0, 0);
- PageMemory mem = shared.database().memoryPolicy(null).pageMemory();
+ PageMemory mem = shared.database().dataRegion(null).pageMemory();
IgniteBiTuple<Map<FullPageId, Integer>, WALPointer> res;
@@ -192,7 +189,7 @@ public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends GridCom
dbMgr.enableCheckpoints(false).get();
- mem = shared.database().memoryPolicy(null).pageMemory();
+ mem = shared.database().dataRegion(null).pageMemory();
verifyReads(res.get1(), mem, res.get2(), shared.wal());
}
@@ -214,7 +211,7 @@ public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends GridCom
// Disable integrated checkpoint thread.
dbMgr.enableCheckpoints(false);
- PageMemory mem = shared.database().memoryPolicy(null).pageMemory();
+ PageMemory mem = shared.database().dataRegion(null).pageMemory();
IgniteWriteAheadLogManager wal = shared.wal();
@@ -415,7 +412,7 @@ public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends GridCom
int cacheId = sharedCtx.cache().cache(cacheName).context().cacheId();
GridCacheDatabaseSharedManager db = (GridCacheDatabaseSharedManager)sharedCtx.database();
- PageMemory pageMem = sharedCtx.database().memoryPolicy(null).pageMemory();
+ PageMemory pageMem = sharedCtx.database().dataRegion(null).pageMemory();
IgniteWriteAheadLogManager wal = sharedCtx.wal();
db.enableCheckpoints(false).get();
@@ -520,7 +517,7 @@ public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends GridCom
// Disable integrated checkpoint thread.
dbMgr.enableCheckpoints(false);
- PageMemoryEx mem = (PageMemoryEx) dbMgr.memoryPolicy(null).pageMemory();
+ PageMemoryEx mem = (PageMemoryEx) dbMgr.dataRegion(null).pageMemory();
ig.context().cache().context().database().checkpointReadLock();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsEvictionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsEvictionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsEvictionTest.java
index a9b0892..47a4b7b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsEvictionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsEvictionTest.java
@@ -24,10 +24,10 @@ import java.util.concurrent.Callable;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.DataPageEvictionMode;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.pagemem.FullPageId;
@@ -69,9 +69,7 @@ public class IgnitePdsEvictionTest extends GridCommonAbstractTest {
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
final IgniteConfiguration cfg = super.getConfiguration(gridName);
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
-
- cfg.setMemoryConfiguration(createDbConfig());
+ cfg.setDataStorageConfiguration(createDbConfig());
cfg.setCacheConfiguration(new CacheConfiguration<>(cacheName));
@@ -81,19 +79,20 @@ public class IgnitePdsEvictionTest extends GridCommonAbstractTest {
/**
* @return DB config.
*/
- private MemoryConfiguration createDbConfig() {
- final MemoryConfiguration memCfg = new MemoryConfiguration();
+ private DataStorageConfiguration createDbConfig() {
+ final DataStorageConfiguration memCfg = new DataStorageConfiguration();
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
+ DataRegionConfiguration memPlcCfg = new DataRegionConfiguration();
memPlcCfg.setInitialSize(MEMORY_LIMIT);
memPlcCfg.setMaxSize(MEMORY_LIMIT);
memPlcCfg.setPageEvictionMode(DataPageEvictionMode.RANDOM_LRU);
- memPlcCfg.setName("dfltMemPlc");
+ memPlcCfg.setName("dfltDataRegion");
+ memPlcCfg.setPersistenceEnabled(true);
memCfg.setPageSize(PAGE_SIZE);
memCfg.setConcurrencyLevel(NUMBER_OF_SEGMENTS);
- memCfg.setMemoryPolicies(memPlcCfg);
- memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
+ memCfg.setDefaultDataRegionConfiguration(memPlcCfg);
+ memCfg.setWalMode(WALMode.LOG_ONLY);
return memCfg;
}
@@ -290,7 +289,7 @@ public class IgnitePdsEvictionTest extends GridCommonAbstractTest {
final IgniteCacheDatabaseSharedManager db = sharedCtx.database();
- return db.memoryPolicy(null).pageMemory();
+ return db.dataRegion(null).pageMemory();
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsNoActualWalHistoryTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsNoActualWalHistoryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsNoActualWalHistoryTest.java
index 1779fce..61f92c5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsNoActualWalHistoryTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsNoActualWalHistoryTest.java
@@ -27,9 +27,9 @@ import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.BinaryConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager;
@@ -59,19 +59,19 @@ public class IgnitePdsNoActualWalHistoryTest extends GridCommonAbstractTest {
cfg.setCacheConfiguration(ccfg);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration dbCfg = new DataStorageConfiguration();
dbCfg.setPageSize(4 * 1024);
- cfg.setMemoryConfiguration(dbCfg);
+ cfg.setDataStorageConfiguration(dbCfg);
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setWalSegmentSize(4 * 1024 * 1024)
- .setWalHistorySize(2)
- .setWalSegments(10)
- .setWalMode(WALMode.LOG_ONLY)
- );
+ dbCfg.setWalSegmentSize(4 * 1024 * 1024)
+ .setWalHistorySize(2)
+ .setWalSegments(10)
+ .setWalMode(WALMode.LOG_ONLY)
+ .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setMaxSize(100 * 1024 * 1024)
+ .setPersistenceEnabled(true));
cfg.setMarshaller(null);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsThreadInterruptionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsThreadInterruptionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsThreadInterruptionTest.java
index 2a00768..4b55aed 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsThreadInterruptionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsThreadInterruptionTest.java
@@ -17,22 +17,20 @@
package org.apache.ignite.internal.processors.cache.persistence.db.file;
+import java.util.concurrent.atomic.AtomicReference;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.processors.cache.persistence.file.AsyncFileIOFactory;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.jsr166.ThreadLocalRandom8;
-import java.util.concurrent.atomic.AtomicReference;
-
import static org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.DFLT_STORE_DIR;
/**
@@ -59,9 +57,7 @@ public class IgnitePdsThreadInterruptionTest extends GridCommonAbstractTest {
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
final IgniteConfiguration cfg = super.getConfiguration(gridName);
- cfg.setPersistentStoreConfiguration(storeConfiguration());
-
- cfg.setMemoryConfiguration(memoryConfiguration());
+ cfg.setDataStorageConfiguration(memoryConfiguration());
cfg.setCacheConfiguration(new CacheConfiguration<>(cacheName));
@@ -69,36 +65,19 @@ public class IgnitePdsThreadInterruptionTest extends GridCommonAbstractTest {
}
/**
- * @return Store config.
- */
- private PersistentStoreConfiguration storeConfiguration() {
- PersistentStoreConfiguration cfg = new PersistentStoreConfiguration();
-
- cfg.setWalMode(WALMode.LOG_ONLY);
-
- cfg.setWalFsyncDelayNanos(0);
-
- cfg.setFileIOFactory(new AsyncFileIOFactory());
-
- return cfg;
- }
-
- /**
* @return Memory config.
*/
- private MemoryConfiguration memoryConfiguration() {
- final MemoryConfiguration memCfg = new MemoryConfiguration();
-
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
- // memPlcCfg.setPageEvictionMode(RANDOM_LRU); TODO Fix NPE on start.
- memPlcCfg.setName("dfltMemPlc");
-
- memCfg.setPageSize(PAGE_SIZE);
- memCfg.setConcurrencyLevel(1);
- memCfg.setMemoryPolicies(memPlcCfg);
- memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- return memCfg;
+ private DataStorageConfiguration memoryConfiguration() {
+ return new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setName("dfltMemPlc")
+ .setPersistenceEnabled(true)
+ /*.setPageEvictionMode(DataPageEvictionMode.RANDOM_LRU) TODO: fix NPE on start */)
+ .setPageSize(PAGE_SIZE)
+ .setConcurrencyLevel(1)
+ .setWalMode(WALMode.LOG_ONLY)
+ .setWalFsyncDelayNanos(0)
+ .setFileIOFactory(new AsyncFileIOFactory());
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/filename/IgniteUidAsConsistentIdMigrationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/filename/IgniteUidAsConsistentIdMigrationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/filename/IgniteUidAsConsistentIdMigrationTest.java
index fe7e4df..1f322de 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/filename/IgniteUidAsConsistentIdMigrationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/filename/IgniteUidAsConsistentIdMigrationTest.java
@@ -27,10 +27,9 @@ import java.util.regex.Pattern;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.internal.processors.cache.persistence.filename.PdsConsistentIdProcessor;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.GridStringLogger;
@@ -129,7 +128,7 @@ public class IgniteUidAsConsistentIdMigrationTest extends GridCommonAbstractTest
if (configuredConsistentId != null)
cfg.setConsistentId(configuredConsistentId);
- final PersistentStoreConfiguration psCfg = new PersistentStoreConfiguration();
+ final DataStorageConfiguration dsCfg = new DataStorageConfiguration();
if (placeStorageInTemp) {
final File tempDir = new File(System.getProperty("java.io.tmpdir"));
@@ -138,19 +137,16 @@ public class IgniteUidAsConsistentIdMigrationTest extends GridCommonAbstractTest
pstWalStoreCustomPath = new File(tempDir, "WalStore");
pstWalArchCustomPath = new File(tempDir, "WalArchive");
- psCfg.setPersistentStorePath(pstStoreCustomPath.getAbsolutePath());
- psCfg.setWalStorePath(pstWalStoreCustomPath.getAbsolutePath());
- psCfg.setWalArchivePath(pstWalArchCustomPath.getAbsolutePath());
+ dsCfg.setStoragePath(pstStoreCustomPath.getAbsolutePath());
+ dsCfg.setWalPath(pstWalStoreCustomPath.getAbsolutePath());
+ dsCfg.setWalArchivePath(pstWalArchCustomPath.getAbsolutePath());
}
- cfg.setPersistentStoreConfiguration(psCfg);
+ dsCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setMaxSize(32 * 1024 * 1024)
+ .setPersistenceEnabled(true));
- final MemoryConfiguration memCfg = new MemoryConfiguration();
- final MemoryPolicyConfiguration memPolCfg = new MemoryPolicyConfiguration();
-
- memPolCfg.setMaxSize(32 * 1024 * 1024); // we don't need much memory for this test
- memCfg.setMemoryPolicies(memPolCfg);
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(dsCfg);
if (strLog != null)
cfg.setGridLogger(strLog);
@@ -665,8 +661,8 @@ public class IgniteUidAsConsistentIdMigrationTest extends GridCommonAbstractTest
*/
private void assertPdsDirsDefaultExist(String subDirName) throws IgniteCheckedException {
assertDirectoryExist("binary_meta", subDirName);
- assertDirectoryExist(PersistentStoreConfiguration.DFLT_WAL_STORE_PATH, subDirName);
- assertDirectoryExist(PersistentStoreConfiguration.DFLT_WAL_ARCHIVE_PATH, subDirName);
+ assertDirectoryExist(DataStorageConfiguration.DFLT_WAL_PATH, subDirName);
+ assertDirectoryExist(DataStorageConfiguration.DFLT_WAL_ARCHIVE_PATH, subDirName);
assertDirectoryExist(PdsConsistentIdProcessor.DB_DEFAULT_FOLDER, subDirName);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgnitePdsWalTlbTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgnitePdsWalTlbTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgnitePdsWalTlbTest.java
index a06d587..5700eb3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgnitePdsWalTlbTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgnitePdsWalTlbTest.java
@@ -21,9 +21,9 @@ import javax.cache.CacheException;
import org.apache.ignite.IgniteDataStreamer;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -52,24 +52,14 @@ public class IgnitePdsWalTlbTest extends GridCommonAbstractTest {
cfg.setCacheConfiguration(ccfg);
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(100 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY)
+ .setCheckpointPageBufferSize(DFLT_CHECKPOINTING_PAGE_BUFFER_SIZE + 1)
+ .setWalThreadLocalBufferSize(640000000);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setInitialSize(100 * 1024 * 1024);
- memPlcCfg.setMaxSize(100 * 1024 * 1024);
-
- memCfg.setMemoryPolicies(memPlcCfg);
- memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(memCfg);
-
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setCheckpointingPageBufferSize(DFLT_CHECKPOINTING_PAGE_BUFFER_SIZE + 1)
- .setTlbSize(640000000)
- );
+ cfg.setDataStorageConfiguration(memCfg);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushFailoverTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushFailoverTest.java
index 12ec6ef..af8f679 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushFailoverTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushFailoverTest.java
@@ -24,10 +24,9 @@ import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.GridKernalState;
import org.apache.ignite.internal.IgniteEx;
@@ -83,23 +82,15 @@ public class IgniteWalFlushFailoverTest extends GridCommonAbstractTest {
cfg.setCacheConfiguration(cacheCfg);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration()
- .setName("dfltMemPlc")
- .setInitialSize(2 * 1024L * 1024L * 1024L);
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(2048L * 1024 * 1024).setPersistenceEnabled(true))
+ .setFileIOFactory(new FailingFileIOFactory())
+ .setWalMode(WALMode.BACKGROUND)
+ // Setting WAL Segment size to high values forces flushing by timeout.
+ .setWalSegmentSize(flushByTimeout ? 500_000 : 50_000);
- MemoryConfiguration memCfg = new MemoryConfiguration()
- .setMemoryPolicies(memPlcCfg)
- .setDefaultMemoryPolicyName(memPlcCfg.getName());
-
- cfg.setMemoryConfiguration(memCfg);
-
- PersistentStoreConfiguration storeCfg = new PersistentStoreConfiguration()
- .setFileIOFactory(new FailingFileIOFactory())
- .setWalMode(WALMode.BACKGROUND)
- // Setting WAL Segment size to high values forces flushing by timeout.
- .setWalSegmentSize(flushByTimeout ? 500_000 : 50_000);
-
- cfg.setPersistentStoreConfiguration(storeCfg);
+ cfg.setDataStorageConfiguration(memCfg);
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java
index 5d5458e..35d85d1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java
@@ -27,10 +27,10 @@ import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager;
@@ -57,20 +57,12 @@ public class IgniteWalHistoryReservationsTest extends GridCommonAbstractTest {
cfg.setClientMode(client);
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(200 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY);
- long memSize = 200L * 1024L * 1024L;
-
- memCfg.setMemoryPolicies(
- new MemoryPolicyConfiguration()
- .setInitialSize(memSize)
- .setMaxSize(memSize)
- .setName("dfltMemPlc")
- );
-
- memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
CacheConfiguration ccfg1 = new CacheConfiguration();
@@ -82,8 +74,6 @@ public class IgniteWalHistoryReservationsTest extends GridCommonAbstractTest {
cfg.setCacheConfiguration(ccfg1);
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
-
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryPPCTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryPPCTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryPPCTest.java
new file mode 100644
index 0000000..f3c2c99
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryPPCTest.java
@@ -0,0 +1,321 @@
+/*
+ * 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.internal.processors.cache.persistence.db.wal;
+
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheRebalanceMode;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+import org.apache.ignite.configuration.BinaryConfiguration;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ *
+ */
+public class IgniteWalRecoveryPPCTest extends GridCommonAbstractTest {
+ /** */
+ private boolean fork;
+
+ /** */
+ public static final String CACHE_NAME_1 = "cache_1";
+
+ /** */
+ public static final String CACHE_NAME_2 = "cache_2";
+
+ /** */
+ public static final String MEM_PLC_NO_PDS = "mem_plc_2";
+
+ /** */
+ private int walSegmentSize;
+
+ /** Logger only. */
+ private boolean logOnly;
+
+ /** {@inheritDoc} */
+ @Override protected boolean isMultiJvm() {
+ return fork;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ CacheConfiguration<Integer, IndexedObject> ccfg = new CacheConfiguration<>(CACHE_NAME_1);
+
+ ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
+ ccfg.setRebalanceMode(CacheRebalanceMode.SYNC);
+ ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));
+
+ cfg.setCacheConfiguration(ccfg);
+
+ CacheConfiguration<Integer, IndexedObject> ccfg2 = new CacheConfiguration<>(CACHE_NAME_2);
+
+ ccfg2.setAtomicityMode(CacheAtomicityMode.ATOMIC);
+ ccfg2.setRebalanceMode(CacheRebalanceMode.SYNC);
+ ccfg2.setAffinity(new RendezvousAffinityFunction(false, 32));
+ ccfg2.setDataRegionName(MEM_PLC_NO_PDS);
+
+ cfg.setCacheConfiguration(ccfg, ccfg2);
+
+ DataStorageConfiguration dbCfg = new DataStorageConfiguration();
+ dbCfg.setPageSize(4 * 1024);
+
+ DataRegionConfiguration memPlcCfg = new DataRegionConfiguration();
+ memPlcCfg.setInitialSize(1024 * 1024 * 1024);
+ memPlcCfg.setMaxSize(1024 * 1024 * 1024);
+ memPlcCfg.setPersistenceEnabled(true);
+
+ dbCfg.setDefaultDataRegionConfiguration(memPlcCfg);
+
+ DataRegionConfiguration memPlcCfg2 = new DataRegionConfiguration();
+ memPlcCfg2.setName(MEM_PLC_NO_PDS);
+ memPlcCfg2.setInitialSize(1024 * 1024 * 1024);
+ memPlcCfg2.setMaxSize(1024 * 1024 * 1024);
+ memPlcCfg2.setPersistenceEnabled(false);
+
+ dbCfg.setDataRegionConfigurations(memPlcCfg2);
+
+ dbCfg.setWalRecordIteratorBufferSize(1024 * 1024);
+
+ dbCfg.setWalHistorySize(2);
+
+ dbCfg.setWalMode(WALMode.LOG_ONLY);
+
+ if (walSegmentSize != 0)
+ dbCfg.setWalSegmentSize(walSegmentSize);
+
+ cfg.setDataStorageConfiguration(dbCfg);
+
+ cfg.setMarshaller(null);
+
+ BinaryConfiguration binCfg = new BinaryConfiguration();
+
+ binCfg.setCompactFooter(false);
+
+ cfg.setBinaryConfiguration(binCfg);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ stopAllGrids();
+
+ deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+
+ deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
+ }
+
+ /**
+ * @throws Exception if failed.
+ */
+ public void testWalSimple() throws Exception {
+ try {
+ IgniteEx ignite = startGrid(1);
+
+ ignite.active(true);
+
+ IgniteCache<Object, Object> cache1 = ignite.cache(CACHE_NAME_1);
+ IgniteCache<Object, Object> cache2 = ignite.cache(CACHE_NAME_2);
+
+ info(" --> step1");
+
+ for (int i = 0; i < 10_000; i += 2) {
+ cache1.put(i, new IndexedObject(i));
+ cache2.put(i, new IndexedObject(i + 1));
+ }
+
+ info(" --> step2");
+
+ for (int i = 0; i < 10_000; i += 3) {
+ cache1.put(i, new IndexedObject(i * 2));
+ cache2.put(i, new IndexedObject(i * 2 + 1));
+ }
+
+ info(" --> step3");
+
+ for (int i = 0; i < 10_000; i += 7) {
+ cache1.put(i, new IndexedObject(i * 3));
+ cache2.put(i, new IndexedObject(i * 3 + 1));
+ }
+
+ info(" --> check1");
+
+ // Check.
+ for (int i = 0; i < 10_000; i++) {
+ IndexedObject o;
+ IndexedObject o1;
+
+ if (i % 7 == 0) {
+ o = new IndexedObject(i * 3);
+ o1 = new IndexedObject(i * 3 + 1);
+ }
+ else if (i % 3 == 0) {
+ o = new IndexedObject(i * 2);
+ o1 = new IndexedObject(i * 2 + 1);
+ }
+ else if (i % 2 == 0) {
+ o = new IndexedObject(i);
+ o1 = new IndexedObject(i + 1);
+ }
+ else {
+ o = null;
+ o1 = null;
+ }
+
+ assertEquals(o, cache1.get(i));
+ assertEquals(o1, cache2.get(i));
+ }
+
+ stopGrid(1);
+
+ ignite = startGrid(1);
+
+ ignite.active(true);
+
+ cache1 = ignite.cache(CACHE_NAME_1);
+ cache2 = ignite.cache(CACHE_NAME_2);
+
+ info(" --> check2");
+
+ // Check.
+ for (int i = 0; i < 10_000; i++) {
+ IndexedObject o;
+
+ if (i % 7 == 0)
+ o = new IndexedObject(i * 3);
+ else if (i % 3 == 0)
+ o = new IndexedObject(i * 2);
+ else if (i % 2 == 0)
+ o = new IndexedObject(i);
+ else
+ o = null;
+
+ assertEquals(o, cache1.get(i));
+ assertEquals(null, cache2.get(i));
+ }
+
+ info(" --> ok");
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ *
+ */
+ public void testDynamicallyStartedNonPersistentCache() throws Exception {
+ try {
+ IgniteEx ignite = startGrid(1);
+
+ ignite.active(true);
+
+ IgniteCache<Integer, Object> dynamicPersistent = ignite.getOrCreateCache(
+ new CacheConfiguration<Integer, Object>()
+ .setAtomicityMode(CacheAtomicityMode.ATOMIC)
+ .setRebalanceMode(CacheRebalanceMode.SYNC)
+ .setName("dynamicPersistent")
+ .setAffinity(new RendezvousAffinityFunction(false, 32)));
+
+ IgniteCache<Integer, Object> dynamicVolatile = ignite.getOrCreateCache(
+ new CacheConfiguration<Integer, Object>()
+ .setAtomicityMode(CacheAtomicityMode.ATOMIC)
+ .setRebalanceMode(CacheRebalanceMode.SYNC)
+ .setDataRegionName(MEM_PLC_NO_PDS)
+ .setName("dynamicVolatile")
+ .setAffinity(new RendezvousAffinityFunction(false, 32)));
+
+ for (int i = 0; i < 10_000; i++) {
+ dynamicPersistent.put(i, new IndexedObject(i));
+ dynamicVolatile.put(i, new IndexedObject(i + 1));
+ }
+
+ stopGrid(1);
+
+ ignite = startGrid(1);
+
+ ignite.active(true);
+
+ dynamicPersistent = ignite.cache("dynamicPersistent");
+ dynamicVolatile = ignite.cache("dynamicVolatile");
+
+ for (int i = 0; i < 10_000; i++)
+ assertEquals(new IndexedObject(i), dynamicPersistent.get(i));
+
+ assertNull(dynamicVolatile);
+
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ *
+ */
+ private static class IndexedObject {
+ /** */
+ @QuerySqlField(index = true)
+ private int iVal;
+
+ /**
+ * @param iVal Integer value.
+ */
+ private IndexedObject(int iVal) {
+ this.iVal = iVal;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+
+ if (!(o instanceof IndexedObject))
+ return false;
+
+ IndexedObject that = (IndexedObject)o;
+
+ return iVal == that.iVal;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return iVal;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(IndexedObject.class, this);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoverySeveralRestartsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoverySeveralRestartsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoverySeveralRestartsTest.java
index 9497dc6..699fe81 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoverySeveralRestartsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoverySeveralRestartsTest.java
@@ -28,10 +28,9 @@ import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.BinaryConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -80,25 +79,13 @@ public class IgniteWalRecoverySeveralRestartsTest extends GridCommonAbstractTest
cfg.setCacheConfiguration(ccfg);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(500 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY)
+ .setPageSize(PAGE_SIZE);
- dbCfg.setPageSize(PAGE_SIZE);
-
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setInitialSize(500 * 1024 * 1024);
- memPlcCfg.setMaxSize(500 * 1024 * 1024);
-
- dbCfg.setMemoryPolicies(memPlcCfg);
- dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(dbCfg);
-
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setWalMode(WALMode.LOG_ONLY)
- );
+ cfg.setDataStorageConfiguration(memCfg);
cfg.setMarshaller(null);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryTest.java
index bf8cd85..b357877 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryTest.java
@@ -48,10 +48,9 @@ import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.BinaryConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
@@ -136,34 +135,30 @@ public class IgniteWalRecoveryTest extends GridCommonAbstractTest {
cfg.setCacheConfiguration(ccfg);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration dbCfg = new DataStorageConfiguration();
dbCfg.setPageSize(4 * 1024);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
+ DataRegionConfiguration memPlcCfg = new DataRegionConfiguration();
- memPlcCfg.setName("dfltMemPlc");
+ memPlcCfg.setName("dfltDataRegion");
memPlcCfg.setInitialSize(1024 * 1024 * 1024);
memPlcCfg.setMaxSize(1024 * 1024 * 1024);
+ memPlcCfg.setPersistenceEnabled(true);
- dbCfg.setMemoryPolicies(memPlcCfg);
- dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
+ dbCfg.setDefaultDataRegionConfiguration(memPlcCfg);
- cfg.setMemoryConfiguration(dbCfg);
+ dbCfg.setWalRecordIteratorBufferSize(1024 * 1024);
- PersistentStoreConfiguration pCfg = new PersistentStoreConfiguration();
-
- pCfg.setWalRecordIteratorBufferSize(1024 * 1024);
-
- pCfg.setWalHistorySize(2);
+ dbCfg.setWalHistorySize(2);
if (logOnly)
- pCfg.setWalMode(WALMode.LOG_ONLY);
+ dbCfg.setWalMode(WALMode.LOG_ONLY);
if (walSegmentSize != 0)
- pCfg.setWalSegmentSize(walSegmentSize);
+ dbCfg.setWalSegmentSize(walSegmentSize);
- cfg.setPersistentStoreConfiguration(pCfg);
+ cfg.setDataStorageConfiguration(dbCfg);
cfg.setMarshaller(null);
@@ -976,7 +971,7 @@ public class IgniteWalRecoveryTest extends GridCommonAbstractTest {
delta.applyDelta(sharedCtx
.database()
- .memoryPolicy(null)
+ .dataRegion(null)
.pageMemory(),
((DirectBuffer)buf1).address());
@@ -990,7 +985,7 @@ public class IgniteWalRecoveryTest extends GridCommonAbstractTest {
info("Done apply...");
- PageMemoryEx pageMem = (PageMemoryEx)db.memoryPolicy(null).pageMemory();
+ PageMemoryEx pageMem = (PageMemoryEx)db.dataRegion(null).pageMemory();
for (Map.Entry<FullPageId, byte[]> entry : rolledPages.entrySet()) {
FullPageId fullId = entry.getKey();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalSerializerVersionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalSerializerVersionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalSerializerVersionTest.java
index ddf74c8..7500fdc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalSerializerVersionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalSerializerVersionTest.java
@@ -22,8 +22,9 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager;
import org.apache.ignite.internal.pagemem.wal.WALIterator;
@@ -63,7 +64,10 @@ public class IgniteWalSerializerVersionTest extends GridCommonAbstractTest {
cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(IP_FINDER));
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
+ cfg.setDataStorageConfiguration(new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setPersistenceEnabled(true)
+ .setMaxSize(100 * 1024 * 1024)));
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalRecoveryTxLogicalRecordsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalRecoveryTxLogicalRecordsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalRecoveryTxLogicalRecordsTest.java
index f5d46e2..10b6110 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalRecoveryTxLogicalRecordsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalRecoveryTxLogicalRecordsTest.java
@@ -38,9 +38,9 @@ import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.BinaryConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.pagemem.PageIdAllocator;
import org.apache.ignite.internal.pagemem.store.PageStore;
@@ -107,20 +107,20 @@ public class WalRecoveryTxLogicalRecordsTest extends GridCommonAbstractTest {
else
cfg.setCacheConfiguration(ccfg);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration dbCfg = new DataStorageConfiguration();
dbCfg.setPageSize(pageSize);
- cfg.setMemoryConfiguration(dbCfg);
+ dbCfg.setWalHistorySize(WAL_HIST_SIZE);
- PersistentStoreConfiguration pCfg = new PersistentStoreConfiguration();
-
- pCfg.setWalHistorySize(WAL_HIST_SIZE);
+ dbCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setMaxSize(100 * 1024 * 1024)
+ .setPersistenceEnabled(true));
if (checkpointFreq != null)
- pCfg.setCheckpointingFrequency(checkpointFreq);
+ dbCfg.setCheckpointFrequency(checkpointFreq);
- cfg.setPersistentStoreConfiguration(pCfg);
+ cfg.setDataStorageConfiguration(dbCfg);
cfg.setMarshaller(null);
[28/50] [abbrv] ignite git commit: IGNITE-6515 .NET: Enable
persistence on per-cache basis
Posted by sb...@apache.org.
IGNITE-6515 .NET: Enable persistence on per-cache basis
This closes #2891
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ab08be83
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ab08be83
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ab08be83
Branch: refs/heads/ignite-3478-tree
Commit: ab08be83ccc6fe1997ef80c25c3b48d45f410b56
Parents: ec9a945
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Fri Oct 20 14:38:11 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Fri Oct 20 14:38:11 2017 +0300
----------------------------------------------------------------------
.../platform/cluster/PlatformClusterGroup.java | 90 ++++
.../utils/PlatformConfigurationUtils.java | 174 ++++++-
.../Apache.Ignite.Core.Tests.csproj | 5 +-
.../Cache/CacheConfigurationTest.cs | 6 +
.../Cache/DataRegionMetricsTest.cs | 153 ++++++
.../Cache/DataStorageMetricsTest.cs | 107 +++++
.../Cache/MemoryMetricsTest.cs | 1 +
.../Cache/PersistenceTest.cs | 235 ++++++++++
.../Cache/PersistentStoreTest.cs | 189 --------
.../Cache/PersistentStoreTestObsolete.cs | 190 ++++++++
.../Config/full-config.xml | 18 +
.../Config/spring-test.xml | 18 +-
.../IgniteConfigurationSerializerTest.cs | 135 +++++-
.../IgniteConfigurationTest.cs | 227 +++++----
.../Apache.Ignite.Core.csproj | 10 +
.../Cache/Configuration/CacheConfiguration.cs | 21 +-
.../Cache/Configuration/DataPageEvictionMode.cs | 3 +
.../Cache/Configuration/MemoryConfiguration.cs | 5 +
.../Configuration/MemoryPolicyConfiguration.cs | 3 +
.../Apache.Ignite.Core/Cache/IMemoryMetrics.cs | 4 +
.../Configuration/CheckpointWriteOrder.cs | 37 ++
.../Configuration/DataPageEvictionMode.cs | 59 +++
.../Configuration/DataRegionConfiguration.cs | 213 +++++++++
.../Configuration/DataStorageConfiguration.cs | 466 +++++++++++++++++++
.../Apache.Ignite.Core/Configuration/WalMode.cs | 45 ++
.../Apache.Ignite.Core/IDataRegionMetrics.cs | 55 +++
.../Apache.Ignite.Core/IDataStorageMetrics.cs | 87 ++++
.../dotnet/Apache.Ignite.Core/IIgnite.cs | 33 ++
.../Apache.Ignite.Core/IgniteConfiguration.cs | 40 +-
.../IgniteConfigurationSection.xsd | 273 ++++++++++-
.../Impl/Cache/MemoryMetrics.cs | 2 +
.../Impl/Cluster/ClusterGroupImpl.cs | 53 +++
.../Common/IgniteConfigurationXmlSerializer.cs | 11 +-
.../Impl/DataRegionMetrics.cs | 61 +++
.../Impl/DataStorageMetrics.cs | 87 ++++
.../dotnet/Apache.Ignite.Core/Impl/Ignite.cs | 22 +
.../PersistentStore/PersistentStoreMetrics.cs | 2 +
.../PersistentStore/CheckpointWriteOrder.cs | 3 +
.../PersistentStore/IPersistentStoreMetrics.cs | 2 +
.../PersistentStoreConfiguration.cs | 4 +
.../PersistentStore/WalMode.cs | 3 +
41 files changed, 2801 insertions(+), 351 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java
index 7c1c03e..ef382d6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java
@@ -21,6 +21,8 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.UUID;
+import org.apache.ignite.DataRegionMetrics;
+import org.apache.ignite.DataStorageMetrics;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteCluster;
@@ -142,6 +144,14 @@ public class PlatformClusterGroup extends PlatformAbstractTarget {
/** */
private static final int OP_GET_SERVICES = 34;
+ /** */
+ private static final int OP_DATA_REGION_METRICS = 35;
+
+ /** */
+ private static final int OP_DATA_REGION_METRICS_BY_NAME = 36;
+
+ /** */
+ private static final int OP_DATA_STORAGE_METRICS = 37;
/** Projection. */
private final ClusterGroupEx prj;
@@ -187,6 +197,26 @@ public class PlatformClusterGroup extends PlatformAbstractTarget {
break;
}
+ case OP_DATA_STORAGE_METRICS: {
+ DataStorageMetrics metrics = prj.ignite().dataStorageMetrics();
+
+ writeDataStorageMetrics(writer, metrics);
+
+ break;
+ }
+
+ case OP_DATA_REGION_METRICS: {
+ Collection<DataRegionMetrics> metrics = prj.ignite().dataRegionMetrics();
+
+ writer.writeInt(metrics.size());
+
+ for (DataRegionMetrics m : metrics) {
+ writeDataRegionMetrics(writer, m);
+ }
+
+ break;
+ }
+
default:
super.processOutStream(type, writer);
}
@@ -287,6 +317,22 @@ public class PlatformClusterGroup extends PlatformAbstractTarget {
break;
}
+ case OP_DATA_REGION_METRICS_BY_NAME: {
+ String name = reader.readString();
+
+ DataRegionMetrics metrics = platformCtx.kernalContext().grid().dataRegionMetrics(name);
+
+ if (metrics != null) {
+ writer.writeBoolean(true);
+ writeDataRegionMetrics(writer, metrics);
+ }
+ else {
+ writer.writeBoolean(false);
+ }
+
+ break;
+ }
+
default:
super.processInStreamOutStream(type, reader, writer);
}
@@ -479,6 +525,7 @@ public class PlatformClusterGroup extends PlatformAbstractTarget {
* @param writer Writer.
* @param metrics Metrics.
*/
+ @SuppressWarnings("deprecation")
private static void writeMemoryMetrics(BinaryRawWriter writer, MemoryMetrics metrics) {
assert writer != null;
assert metrics != null;
@@ -492,11 +539,30 @@ public class PlatformClusterGroup extends PlatformAbstractTarget {
}
/**
+ * Writes the data region metrics.
+ *
+ * @param writer Writer.
+ * @param metrics Metrics.
+ */
+ private static void writeDataRegionMetrics(BinaryRawWriter writer, DataRegionMetrics metrics) {
+ assert writer != null;
+ assert metrics != null;
+
+ writer.writeString(metrics.getName());
+ writer.writeLong(metrics.getTotalAllocatedPages());
+ writer.writeFloat(metrics.getAllocationRate());
+ writer.writeFloat(metrics.getEvictionRate());
+ writer.writeFloat(metrics.getLargeEntriesPagesPercentage());
+ writer.writeFloat(metrics.getPagesFillFactor());
+ }
+
+ /**
* Writes persistent store metrics.
*
* @param writer Writer.
* @param metrics Metrics
*/
+ @SuppressWarnings("deprecation")
private void writePersistentStoreMetrics(BinaryRawWriter writer, PersistenceMetrics metrics) {
assert writer != null;
assert metrics != null;
@@ -514,4 +580,28 @@ public class PlatformClusterGroup extends PlatformAbstractTarget {
writer.writeLong(metrics.getLastCheckpointDataPagesNumber());
writer.writeLong(metrics.getLastCheckpointCopiedOnWritePagesNumber());
}
+
+ /**
+ * Writes data storage metrics.
+ *
+ * @param writer Writer.
+ * @param metrics Metrics
+ */
+ private void writeDataStorageMetrics(BinaryRawWriter writer, DataStorageMetrics metrics) {
+ assert writer != null;
+ assert metrics != null;
+
+ writer.writeFloat(metrics.getWalLoggingRate());
+ writer.writeFloat(metrics.getWalWritingRate());
+ writer.writeInt(metrics.getWalArchiveSegments());
+ writer.writeFloat(metrics.getWalFsyncTimeAverage());
+ writer.writeLong(metrics.getLastCheckpointDuration());
+ writer.writeLong(metrics.getLastCheckpointLockWaitDuration());
+ writer.writeLong(metrics.getLastCheckpointMarkDuration());
+ writer.writeLong(metrics.getLastCheckpointPagesWriteDuration());
+ writer.writeLong(metrics.getLastCheckpointFsyncDuration());
+ writer.writeLong(metrics.getLastCheckpointTotalPagesNumber());
+ writer.writeLong(metrics.getLastCheckpointDataPagesNumber());
+ writer.writeLong(metrics.getLastCheckpointCopiedOnWritePagesNumber());
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/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 24f4438..9711e62 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
@@ -57,6 +57,8 @@ 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.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.MemoryConfiguration;
import org.apache.ignite.configuration.MemoryPolicyConfiguration;
@@ -184,10 +186,11 @@ public class PlatformConfigurationUtils {
ccfg.setWriteThrough(in.readBoolean());
ccfg.setStatisticsEnabled(in.readBoolean());
- String memoryPolicyName = in.readString();
+ String dataRegionName = in.readString();
- if (memoryPolicyName != null)
- ccfg.setMemoryPolicyName(memoryPolicyName);
+ if (dataRegionName != null)
+ //noinspection deprecation
+ ccfg.setMemoryPolicyName(dataRegionName);
ccfg.setPartitionLossPolicy(PartitionLossPolicy.fromOrdinal((byte)in.readInt()));
ccfg.setGroupName(in.readString());
@@ -717,6 +720,9 @@ public class PlatformConfigurationUtils {
if (in.readBoolean())
cfg.setPersistentStoreConfiguration(readPersistentStoreConfiguration(in));
+ if (in.readBoolean())
+ cfg.setDataStorageConfiguration(readDataStorageConfiguration(in));
+
readPluginConfiguration(cfg, in);
readLocalEventListeners(cfg, in);
@@ -873,6 +879,7 @@ public class PlatformConfigurationUtils {
writer.writeBoolean(ccfg.isReadThrough());
writer.writeBoolean(ccfg.isWriteThrough());
writer.writeBoolean(ccfg.isStatisticsEnabled());
+ //noinspection deprecation
writer.writeString(ccfg.getMemoryPolicyName());
writer.writeInt(ccfg.getPartitionLossPolicy().ordinal());
writer.writeString(ccfg.getGroupName());
@@ -1194,6 +1201,8 @@ public class PlatformConfigurationUtils {
writePersistentStoreConfiguration(w, cfg.getPersistentStoreConfiguration());
+ writeDataStorageConfiguration(w, cfg.getDataStorageConfiguration());
+
w.writeString(cfg.getIgniteHome());
w.writeLong(ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getInit());
@@ -1403,6 +1412,7 @@ public class PlatformConfigurationUtils {
* @param in Reader
* @return Config.
*/
+ @SuppressWarnings("deprecation")
private static MemoryConfiguration readMemoryConfiguration(BinaryRawReader in) {
MemoryConfiguration res = new MemoryConfiguration();
@@ -1446,6 +1456,7 @@ public class PlatformConfigurationUtils {
* @param w Writer.
* @param cfg Config.
*/
+ @SuppressWarnings("deprecation")
private static void writeMemoryConfiguration(BinaryRawWriter w, MemoryConfiguration cfg) {
if (cfg == null) {
w.writeBoolean(false);
@@ -1575,6 +1586,7 @@ public class PlatformConfigurationUtils {
* @param in Reader.
* @return Config.
*/
+ @SuppressWarnings("deprecation")
private static PersistentStoreConfiguration readPersistentStoreConfiguration(BinaryRawReader in) {
return new PersistentStoreConfiguration()
.setPersistentStorePath(in.readString())
@@ -1601,10 +1613,64 @@ public class PlatformConfigurationUtils {
}
/**
+ * Reads the data storage configuration.
+ *
+ * @param in Reader.
+ * @return Config.
+ */
+ private static DataStorageConfiguration readDataStorageConfiguration(BinaryRawReader in) {
+ DataStorageConfiguration res = new DataStorageConfiguration()
+ .setStoragePath(in.readString())
+ .setCheckpointFrequency(in.readLong())
+ .setCheckpointPageBufferSize(in.readLong())
+ .setCheckpointThreads(in.readInt())
+ .setLockWaitTime((int) in.readLong())
+ .setWalHistorySize(in.readInt())
+ .setWalSegments(in.readInt())
+ .setWalSegmentSize(in.readInt())
+ .setWalPath(in.readString())
+ .setWalArchivePath(in.readString())
+ .setWalMode(WALMode.fromOrdinal(in.readInt()))
+ .setWalThreadLocalBufferSize(in.readInt())
+ .setWalFlushFrequency((int) in.readLong())
+ .setWalFsyncDelayNanos(in.readLong())
+ .setWalRecordIteratorBufferSize(in.readInt())
+ .setAlwaysWriteFullPages(in.readBoolean())
+ .setMetricsEnabled(in.readBoolean())
+ .setMetricsSubIntervalCount(in.readInt())
+ .setMetricsRateTimeInterval(in.readLong())
+ .setCheckpointWriteOrder(CheckpointWriteOrder.fromOrdinal(in.readInt()))
+ .setWriteThrottlingEnabled(in.readBoolean())
+ .setSystemRegionInitialSize(in.readLong())
+ .setSystemRegionMaxSize(in.readLong())
+ .setPageSize(in.readInt())
+ .setConcurrencyLevel(in.readInt());
+
+ int cnt = in.readInt();
+
+ if (cnt > 0) {
+ DataRegionConfiguration[] regs = new DataRegionConfiguration[cnt];
+
+ for (int i = 0; i < cnt; i++) {
+ regs[i] = readDataRegionConfiguration(in);
+ }
+
+ res.setDataRegionConfigurations(regs);
+ }
+
+ if (in.readBoolean()) {
+ res.setDefaultDataRegionConfiguration(readDataRegionConfiguration(in));
+ }
+
+ return res;
+ }
+
+ /**
* Writes the persistent store configuration.
*
* @param w Writer.
*/
+ @SuppressWarnings("deprecation")
private static void writePersistentStoreConfiguration(BinaryRawWriter w, PersistentStoreConfiguration cfg) {
assert w != null;
@@ -1639,6 +1705,108 @@ public class PlatformConfigurationUtils {
}
/**
+ * Writes the data storage configuration.
+ *
+ * @param w Writer.
+ */
+ private static void writeDataStorageConfiguration(BinaryRawWriter w, DataStorageConfiguration cfg) {
+ assert w != null;
+
+ if (cfg != null) {
+ w.writeBoolean(true);
+
+ w.writeString(cfg.getStoragePath());
+ w.writeLong(cfg.getCheckpointFrequency());
+ w.writeLong(cfg.getCheckpointPageBufferSize());
+ w.writeInt(cfg.getCheckpointThreads());
+ w.writeLong(cfg.getLockWaitTime());
+ w.writeInt(cfg.getWalHistorySize());
+ w.writeInt(cfg.getWalSegments());
+ w.writeInt(cfg.getWalSegmentSize());
+ w.writeString(cfg.getWalPath());
+ w.writeString(cfg.getWalArchivePath());
+ w.writeInt(cfg.getWalMode().ordinal());
+ w.writeInt(cfg.getWalThreadLocalBufferSize());
+ w.writeLong(cfg.getWalFlushFrequency());
+ w.writeLong(cfg.getWalFsyncDelayNanos());
+ w.writeInt(cfg.getWalRecordIteratorBufferSize());
+ w.writeBoolean(cfg.isAlwaysWriteFullPages());
+ w.writeBoolean(cfg.isMetricsEnabled());
+ w.writeInt(cfg.getMetricsSubIntervalCount());
+ w.writeLong(cfg.getMetricsRateTimeInterval());
+ w.writeInt(cfg.getCheckpointWriteOrder().ordinal());
+ w.writeBoolean(cfg.isWriteThrottlingEnabled());
+ w.writeLong(cfg.getSystemRegionInitialSize());
+ w.writeLong(cfg.getSystemRegionMaxSize());
+ w.writeInt(cfg.getPageSize());
+ w.writeInt(cfg.getConcurrencyLevel());
+
+ if (cfg.getDataRegionConfigurations() != null) {
+ w.writeInt(cfg.getDataRegionConfigurations().length);
+
+ for (DataRegionConfiguration d : cfg.getDataRegionConfigurations()) {
+ writeDataRegionConfiguration(w, d);
+ }
+ } else {
+ w.writeInt(0);
+ }
+
+ if (cfg.getDefaultDataRegionConfiguration() != null) {
+ w.writeBoolean(true);
+ writeDataRegionConfiguration(w, cfg.getDefaultDataRegionConfiguration());
+ } else {
+ w.writeBoolean(false);
+ }
+ } else {
+ w.writeBoolean(false);
+ }
+ }
+
+ /**
+ * Writes the data region configuration.
+ *
+ * @param w Writer.
+ */
+ private static void writeDataRegionConfiguration(BinaryRawWriter w, DataRegionConfiguration cfg) {
+ assert w != null;
+ assert cfg != null;
+
+ w.writeString(cfg.getName());
+ w.writeBoolean(cfg.isPersistenceEnabled());
+ w.writeLong(cfg.getInitialSize());
+ w.writeLong(cfg.getMaxSize());
+ w.writeString(cfg.getSwapPath());
+ w.writeInt(cfg.getPageEvictionMode().ordinal());
+ w.writeDouble(cfg.getEvictionThreshold());
+ w.writeInt(cfg.getEmptyPagesPoolSize());
+ w.writeBoolean(cfg.isMetricsEnabled());
+ w.writeInt(cfg.getMetricsSubIntervalCount());
+ w.writeLong(cfg.getMetricsRateTimeInterval());
+ }
+
+ /**
+ * Reads the data region configuration.
+ *
+ * @param r Reader.
+ */
+ private static DataRegionConfiguration readDataRegionConfiguration(BinaryRawReader r) {
+ assert r != null;
+
+ return new DataRegionConfiguration()
+ .setName(r.readString())
+ .setPersistenceEnabled(r.readBoolean())
+ .setInitialSize(r.readLong())
+ .setMaxSize(r.readLong())
+ .setSwapPath(r.readString())
+ .setPageEvictionMode(DataPageEvictionMode.fromOrdinal(r.readInt()))
+ .setEvictionThreshold(r.readDouble())
+ .setEmptyPagesPoolSize(r.readInt())
+ .setMetricsEnabled(r.readBoolean())
+ .setMetricsSubIntervalCount(r.readInt())
+ .setMetricsRateTimeInterval(r.readLong());
+ }
+
+ /**
* Reads the plugin configuration.
*
* @param cfg Ignite configuration to update.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
index 7ec75af..1d17757 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
@@ -79,7 +79,10 @@
<Compile Include="Binary\BinarySelfTestSimpleName.cs" />
<Compile Include="Binary\EnumsTestOnline.cs" />
<Compile Include="Binary\Serializable\GenericCollectionsTest.cs" />
- <Compile Include="Cache\PersistentStoreTest.cs" />
+ <Compile Include="Cache\DataRegionMetricsTest.cs" />
+ <Compile Include="Cache\DataStorageMetricsTest.cs" />
+ <Compile Include="Cache\PersistenceTest.cs" />
+ <Compile Include="Cache\PersistentStoreTestObsolete.cs" />
<Compile Include="Cache\Query\Linq\CacheLinqTest.CompiledQuery.cs" />
<Compile Include="Cache\Query\Linq\CacheLinqTest.DateTime.cs" />
<Compile Include="Cache\Query\Linq\CacheLinqTest.Aggregates.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/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 ddf669d..4f13172 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
@@ -71,6 +71,7 @@ namespace Apache.Ignite.Core.Tests.Cache
},
IgniteInstanceName = CacheName,
BinaryConfiguration = new BinaryConfiguration(typeof(Entity)),
+#pragma warning disable 618
MemoryConfiguration = new MemoryConfiguration
{
MemoryPolicies = new[]
@@ -83,6 +84,7 @@ namespace Apache.Ignite.Core.Tests.Cache
}
}
},
+#pragma warning restore 618
SpringConfigUrl = "Config\\cache-default.xml"
};
@@ -297,7 +299,9 @@ namespace Apache.Ignite.Core.Tests.Cache
Assert.AreEqual(x.WriteBehindFlushFrequency, y.WriteBehindFlushFrequency);
Assert.AreEqual(x.WriteBehindFlushSize, y.WriteBehindFlushSize);
Assert.AreEqual(x.EnableStatistics, y.EnableStatistics);
+#pragma warning disable 618
Assert.AreEqual(x.MemoryPolicyName, y.MemoryPolicyName);
+#pragma warning restore 618
Assert.AreEqual(x.PartitionLossPolicy, y.PartitionLossPolicy);
Assert.AreEqual(x.WriteBehindCoalescing, y.WriteBehindCoalescing);
Assert.AreEqual(x.GroupName, y.GroupName);
@@ -626,7 +630,9 @@ namespace Apache.Ignite.Core.Tests.Cache
},
ExpiryPolicyFactory = new ExpiryFactory(),
EnableStatistics = true,
+#pragma warning disable 618
MemoryPolicyName = "myMemPolicy",
+#pragma warning restore 618
PartitionLossPolicy = PartitionLossPolicy.ReadOnlySafe,
PluginConfigurations = new[] { new MyPluginConfiguration() },
SqlIndexMaxInlineSize = 10000
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/DataRegionMetricsTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/DataRegionMetricsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/DataRegionMetricsTest.cs
new file mode 100644
index 0000000..dd1cf53
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/DataRegionMetricsTest.cs
@@ -0,0 +1,153 @@
+/*
+ * 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.Tests.Cache
+{
+ using System.Linq;
+ using Apache.Ignite.Core.Cache.Configuration;
+ using Apache.Ignite.Core.Configuration;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Data region metrics test.
+ /// </summary>
+ public class DataRegionMetricsTest
+ {
+ /** */
+ private const string RegionWithMetrics = "regWithMetrics";
+
+ /** */
+ private const string RegionNoMetrics = "regNoMetrics";
+
+ /// <summary>
+ /// Tests the memory metrics.
+ /// </summary>
+ [Test]
+ public void TestMemoryMetrics()
+ {
+ var ignite = StartIgniteWithTwoDataRegions();
+
+ // Verify metrics.
+ var metrics = ignite.GetDataRegionMetrics().OrderBy(x => x.Name).ToArray();
+ Assert.AreEqual(3, metrics.Length); // two defined plus system.
+
+ var emptyMetrics = metrics[0];
+ Assert.AreEqual(RegionNoMetrics, emptyMetrics.Name);
+ AssertMetricsAreEmpty(emptyMetrics);
+
+ var memMetrics = metrics[1];
+ Assert.AreEqual(RegionWithMetrics, memMetrics.Name);
+ Assert.Greater(memMetrics.AllocationRate, 0);
+ Assert.AreEqual(0, memMetrics.EvictionRate);
+ Assert.AreEqual(0, memMetrics.LargeEntriesPagesPercentage);
+ Assert.Greater(memMetrics.PageFillFactor, 0);
+ Assert.Greater(memMetrics.TotalAllocatedPages, 1000);
+
+ var sysMetrics = metrics[2];
+ Assert.AreEqual("sysMemPlc", sysMetrics.Name);
+ AssertMetricsAreEmpty(sysMetrics);
+
+ // Metrics by name.
+ emptyMetrics = ignite.GetDataRegionMetrics(RegionNoMetrics);
+ Assert.AreEqual(RegionNoMetrics, emptyMetrics.Name);
+ AssertMetricsAreEmpty(emptyMetrics);
+
+ memMetrics = ignite.GetDataRegionMetrics(RegionWithMetrics);
+ Assert.AreEqual(RegionWithMetrics, memMetrics.Name);
+ Assert.Greater(memMetrics.AllocationRate, 0);
+ Assert.AreEqual(0, memMetrics.EvictionRate);
+ Assert.AreEqual(0, memMetrics.LargeEntriesPagesPercentage);
+ Assert.Greater(memMetrics.PageFillFactor, 0);
+ Assert.Greater(memMetrics.TotalAllocatedPages, 1000);
+
+ sysMetrics = ignite.GetDataRegionMetrics("sysMemPlc");
+ Assert.AreEqual("sysMemPlc", sysMetrics.Name);
+ AssertMetricsAreEmpty(sysMetrics);
+
+ // Invalid name.
+ Assert.IsNull(ignite.GetDataRegionMetrics("boo"));
+ }
+
+ /// <summary>
+ /// Asserts that metrics are empty.
+ /// </summary>
+ private static void AssertMetricsAreEmpty(IDataRegionMetrics metrics)
+ {
+ Assert.AreEqual(0, metrics.AllocationRate);
+ Assert.AreEqual(0, metrics.EvictionRate);
+ Assert.AreEqual(0, metrics.LargeEntriesPagesPercentage);
+ Assert.AreEqual(0, metrics.PageFillFactor);
+ Assert.AreEqual(0, metrics.TotalAllocatedPages);
+ }
+
+ /// <summary>
+ /// Starts the ignite with two policies.
+ /// </summary>
+ private static IIgnite StartIgniteWithTwoDataRegions()
+ {
+ var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
+ {
+ DataStorageConfiguration = new DataStorageConfiguration()
+ {
+ DefaultDataRegionConfiguration = new DataRegionConfiguration
+ {
+ Name = RegionWithMetrics,
+ MetricsEnabled = true
+ },
+ DataRegionConfigurations = new[]
+ {
+ new DataRegionConfiguration
+ {
+ Name = RegionNoMetrics,
+ MetricsEnabled = false
+ }
+ }
+ }
+ };
+
+ var ignite = Ignition.Start(cfg);
+
+ // Create caches and do some things with them.
+ var cacheNoMetrics = ignite.CreateCache<int, int>(new CacheConfiguration("cacheNoMetrics")
+ {
+ DataRegionName = RegionNoMetrics
+ });
+
+ cacheNoMetrics.Put(1, 1);
+ cacheNoMetrics.Get(1);
+
+ var cacheWithMetrics = ignite.CreateCache<int, int>(new CacheConfiguration("cacheWithMetrics")
+ {
+ DataRegionName = RegionWithMetrics
+ });
+
+ cacheWithMetrics.Put(1, 1);
+ cacheWithMetrics.Get(1);
+
+ return ignite;
+ }
+
+ /// <summary>
+ /// Tears down the test.
+ /// </summary>
+ [TearDown]
+ public void TearDown()
+ {
+ Ignition.StopAll(true);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/DataStorageMetricsTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/DataStorageMetricsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/DataStorageMetricsTest.cs
new file mode 100644
index 0000000..b24c20b
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/DataStorageMetricsTest.cs
@@ -0,0 +1,107 @@
+/*
+ * 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.Tests.Cache
+{
+ using System;
+ using System.IO;
+ using System.Linq;
+ using Apache.Ignite.Core.Configuration;
+ using Apache.Ignite.Core.Impl;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Tests <see cref="IDataStorageMetrics"/>.
+ /// </summary>
+ public class DataStorageMetricsTest
+ {
+ /** Temp dir for WAL. */
+ private readonly string _tempDir = IgniteUtils.GetTempDirectoryName();
+
+ /// <summary>
+ /// Tests the data storage metrics.
+ /// </summary>
+ [Test]
+ public void TestDataStorageMetrics()
+ {
+ var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
+ {
+ DataStorageConfiguration = new DataStorageConfiguration
+ {
+ CheckpointFrequency = TimeSpan.FromSeconds(1),
+ MetricsEnabled = true,
+ WalMode = WalMode.LogOnly,
+ DefaultDataRegionConfiguration = new DataRegionConfiguration
+ {
+ PersistenceEnabled = true,
+ Name = "foobar"
+ }
+ },
+ WorkDirectory = _tempDir
+ };
+
+ using (var ignite = Ignition.Start(cfg))
+ {
+ ignite.SetActive(true);
+
+ var cache = ignite.CreateCache<int, object>("c");
+
+ cache.PutAll(Enumerable.Range(1, 10)
+ .ToDictionary(x => x, x => (object) new {Name = x.ToString(), Id = x}));
+
+ // Wait for checkpoint and metrics update and verify.
+ IDataStorageMetrics metrics = null;
+
+ Assert.IsTrue(TestUtils.WaitForCondition(() =>
+ {
+ // ReSharper disable once AccessToDisposedClosure
+ metrics = ignite.GetDataStorageMetrics();
+
+ return metrics.LastCheckpointTotalPagesNumber > 0;
+ }, 10000));
+
+ Assert.IsNotNull(metrics);
+
+ Assert.AreEqual(0, metrics.WalArchiveSegments);
+ Assert.AreEqual(0, metrics.WalFsyncTimeAverage);
+
+ Assert.AreEqual(77, metrics.LastCheckpointTotalPagesNumber);
+ Assert.AreEqual(10, metrics.LastCheckpointDataPagesNumber);
+ Assert.AreEqual(0, metrics.LastCheckpointCopiedOnWritePagesNumber);
+ Assert.AreEqual(TimeSpan.Zero, metrics.LastCheckpointLockWaitDuration);
+
+ Assert.Greater(metrics.LastCheckpointPagesWriteDuration, TimeSpan.Zero);
+ Assert.Greater(metrics.LastCheckpointMarkDuration, TimeSpan.Zero);
+ Assert.Greater(metrics.LastCheckpointDuration, TimeSpan.Zero);
+ Assert.Greater(metrics.LastCheckpointFsyncDuration, TimeSpan.Zero);
+
+ Assert.Greater(metrics.LastCheckpointDuration, metrics.LastCheckpointMarkDuration);
+ Assert.Greater(metrics.LastCheckpointDuration, metrics.LastCheckpointPagesWriteDuration);
+ Assert.Greater(metrics.LastCheckpointDuration, metrics.LastCheckpointFsyncDuration);
+ }
+ }
+
+ /// <summary>
+ /// Tears down the test.
+ /// </summary>
+ [TearDown]
+ public void TearDown()
+ {
+ Directory.Delete(_tempDir, true);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/MemoryMetricsTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/MemoryMetricsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/MemoryMetricsTest.cs
index 1aad823..7ccee94 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/MemoryMetricsTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/MemoryMetricsTest.cs
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+#pragma warning disable 618
namespace Apache.Ignite.Core.Tests.Cache
{
using System.Linq;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistenceTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistenceTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistenceTest.cs
new file mode 100644
index 0000000..b2e4d05
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistenceTest.cs
@@ -0,0 +1,235 @@
+/*
+ * 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.Tests.Cache
+{
+ using System;
+ using System.IO;
+ using Apache.Ignite.Core.Cache.Configuration;
+ using Apache.Ignite.Core.Common;
+ using Apache.Ignite.Core.Configuration;
+ using Apache.Ignite.Core.Impl;
+ using NUnit.Framework;
+ using DataPageEvictionMode = Apache.Ignite.Core.Configuration.DataPageEvictionMode;
+
+ /// <summary>
+ /// Tests disk persistence.
+ /// </summary>
+ public class PersistenceTest
+ {
+ /** Temp dir for WAL. */
+ private readonly string _tempDir = IgniteUtils.GetTempDirectoryName();
+
+ /// <summary>
+ /// Tears down the test.
+ /// </summary>
+ [TearDown]
+ public void TearDown()
+ {
+ Ignition.StopAll(true);
+
+ if (Directory.Exists(_tempDir))
+ {
+ Directory.Delete(_tempDir, true);
+ }
+ }
+
+ /// <summary>
+ /// Tests that cache data survives node restart.
+ /// </summary>
+ [Test]
+ public void TestCacheDataSurvivesNodeRestart()
+ {
+ var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
+ {
+ DataStorageConfiguration = new DataStorageConfiguration
+ {
+ StoragePath = Path.Combine(_tempDir, "Store"),
+ WalPath = Path.Combine(_tempDir, "WalStore"),
+ WalArchivePath = Path.Combine(_tempDir, "WalArchive"),
+ MetricsEnabled = true,
+ DefaultDataRegionConfiguration = new DataRegionConfiguration
+ {
+ PageEvictionMode = DataPageEvictionMode.Disabled,
+ Name = DataStorageConfiguration.DefaultDataRegionName,
+ PersistenceEnabled = true
+ },
+ DataRegionConfigurations = new[]
+ {
+ new DataRegionConfiguration
+ {
+ Name = "volatileRegion",
+ PersistenceEnabled = false
+ }
+ }
+ }
+ };
+
+ const string cacheName = "persistentCache";
+ const string volatileCacheName = "volatileCache";
+
+ // Start Ignite, put data, stop.
+ using (var ignite = Ignition.Start(cfg))
+ {
+ ignite.SetActive(true);
+
+ // Create cache with default region (persistence enabled), add data.
+ var cache = ignite.CreateCache<int, int>(cacheName);
+ cache[1] = 1;
+
+ // Check some metrics.
+ CheckDataStorageMetrics(ignite);
+
+ // Create cache with non-persistent region.
+ var volatileCache = ignite.CreateCache<int, int>(new CacheConfiguration
+ {
+ Name = volatileCacheName,
+ DataRegionName = "volatileRegion"
+ });
+ volatileCache[2] = 2;
+ }
+
+ // Verify directories.
+ Assert.IsTrue(Directory.Exists(cfg.DataStorageConfiguration.StoragePath));
+ Assert.IsTrue(Directory.Exists(cfg.DataStorageConfiguration.WalPath));
+ Assert.IsTrue(Directory.Exists(cfg.DataStorageConfiguration.WalArchivePath));
+
+ // Start Ignite, verify data survival.
+ using (var ignite = Ignition.Start(cfg))
+ {
+ ignite.SetActive(true);
+
+ // Persistent cache already exists and contains data.
+ var cache = ignite.GetCache<int, int>(cacheName);
+ Assert.AreEqual(1, cache[1]);
+
+ // Non-persistent cache does not exist.
+ var ex = Assert.Throws<ArgumentException>(() => ignite.GetCache<int, int>(volatileCacheName));
+ Assert.AreEqual("Cache doesn't exist: volatileCache", ex.Message);
+ }
+
+ // Delete store directory.
+ Directory.Delete(_tempDir, true);
+
+ // Start Ignite, verify data loss.
+ using (var ignite = Ignition.Start(cfg))
+ {
+ ignite.SetActive(true);
+
+ Assert.IsFalse(ignite.GetCacheNames().Contains(cacheName));
+ }
+ }
+
+ /// <summary>
+ /// Checks the data storage metrics.
+ /// </summary>
+ private static void CheckDataStorageMetrics(IIgnite ignite)
+ {
+ // Check metrics.
+ var metrics = ignite.GetDataStorageMetrics();
+ Assert.Greater(metrics.WalLoggingRate, 0);
+ Assert.Greater(metrics.WalWritingRate, 0);
+ Assert.Greater(metrics.WalFsyncTimeAverage, 0);
+ }
+
+ /// <summary>
+ /// Tests the grid activation with persistence (inactive by default).
+ /// </summary>
+ [Test]
+ public void TestGridActivationWithPersistence()
+ {
+ var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
+ {
+ DataStorageConfiguration = new DataStorageConfiguration
+ {
+ DefaultDataRegionConfiguration = new DataRegionConfiguration
+ {
+ PersistenceEnabled = true,
+ Name = "foo"
+ }
+ }
+ };
+
+ // Default config, inactive by default (IsActiveOnStart is ignored when persistence is enabled).
+ using (var ignite = Ignition.Start(cfg))
+ {
+ CheckIsActive(ignite, false);
+
+ ignite.SetActive(true);
+ CheckIsActive(ignite, true);
+
+ ignite.SetActive(false);
+ CheckIsActive(ignite, false);
+ }
+ }
+
+ /// <summary>
+ /// Tests the grid activation without persistence (active by default).
+ /// </summary>
+ [Test]
+ public void TestGridActivationNoPersistence()
+ {
+ var cfg = TestUtils.GetTestConfiguration();
+ Assert.IsTrue(cfg.IsActiveOnStart);
+
+ using (var ignite = Ignition.Start(cfg))
+ {
+ CheckIsActive(ignite, true);
+
+ ignite.SetActive(false);
+ CheckIsActive(ignite, false);
+
+ ignite.SetActive(true);
+ CheckIsActive(ignite, true);
+ }
+
+ cfg.IsActiveOnStart = false;
+
+ using (var ignite = Ignition.Start(cfg))
+ {
+ CheckIsActive(ignite, false);
+
+ ignite.SetActive(true);
+ CheckIsActive(ignite, true);
+
+ ignite.SetActive(false);
+ CheckIsActive(ignite, false);
+ }
+ }
+
+ /// <summary>
+ /// Checks active state.
+ /// </summary>
+ private static void CheckIsActive(IIgnite ignite, bool isActive)
+ {
+ Assert.AreEqual(isActive, ignite.IsActive());
+
+ if (isActive)
+ {
+ var cache = ignite.GetOrCreateCache<int, int>("default");
+ cache[1] = 1;
+ Assert.AreEqual(1, cache[1]);
+ }
+ else
+ {
+ var ex = Assert.Throws<IgniteException>(() => ignite.GetOrCreateCache<int, int>("default"));
+ Assert.AreEqual("Can not perform the operation because the cluster is inactive.",
+ ex.Message.Substring(0, 62));
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTest.cs
deleted file mode 100644
index a592859..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTest.cs
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * 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.Tests.Cache
-{
- using System.IO;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl;
- using Apache.Ignite.Core.PersistentStore;
- using NUnit.Framework;
-
- /// <summary>
- /// Tests the persistent store.
- /// </summary>
- public class PersistentStoreTest
- {
- /** Temp dir for WAL. */
- private readonly string _tempDir = IgniteUtils.GetTempDirectoryName();
-
- /// <summary>
- /// Tears down the test.
- /// </summary>
- [TearDown]
- public void TearDown()
- {
- Ignition.StopAll(true);
-
- if (Directory.Exists(_tempDir))
- {
- Directory.Delete(_tempDir, true);
- }
- }
-
- /// <summary>
- /// Tests that cache data survives node restart.
- /// </summary>
- [Test]
- public void TestCacheDataSurvivesNodeRestart()
- {
- var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
- {
- PersistentStoreConfiguration = new PersistentStoreConfiguration
- {
- PersistentStorePath = Path.Combine(_tempDir, "Store"),
- WalStorePath = Path.Combine(_tempDir, "WalStore"),
- WalArchivePath = Path.Combine(_tempDir, "WalArchive"),
- MetricsEnabled = true
- }
- };
-
- const string cacheName = "persistentCache";
-
- // Start Ignite, put data, stop.
- using (var ignite = Ignition.Start(cfg))
- {
- ignite.SetActive(true);
-
- var cache = ignite.CreateCache<int, int>(cacheName);
-
- cache[1] = 1;
-
- // Check some metrics.
- var metrics = ignite.GetPersistentStoreMetrics();
- Assert.Greater(metrics.WalLoggingRate, 0);
- Assert.Greater(metrics.WalWritingRate, 0);
- Assert.Greater(metrics.WalFsyncTimeAverage, 0);
- }
-
- // Verify directories.
- Assert.IsTrue(Directory.Exists(cfg.PersistentStoreConfiguration.PersistentStorePath));
- Assert.IsTrue(Directory.Exists(cfg.PersistentStoreConfiguration.WalStorePath));
- Assert.IsTrue(Directory.Exists(cfg.PersistentStoreConfiguration.WalArchivePath));
-
- // Start Ignite, verify data survival.
- using (var ignite = Ignition.Start(cfg))
- {
- ignite.SetActive(true);
-
- var cache = ignite.GetCache<int, int>(cacheName);
-
- Assert.AreEqual(1, cache[1]);
- }
-
- // Delete store directory.
- Directory.Delete(_tempDir, true);
-
- // Start Ignite, verify data loss.
- using (var ignite = Ignition.Start(cfg))
- {
- ignite.SetActive(true);
-
- Assert.IsFalse(ignite.GetCacheNames().Contains(cacheName));
- }
- }
-
- /// <summary>
- /// Tests the grid activation with persistence (inactive by default).
- /// </summary>
- [Test]
- public void TestGridActivationWithPersistence()
- {
- var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
- {
- PersistentStoreConfiguration = new PersistentStoreConfiguration()
- };
-
- // Default config, inactive by default (IsActiveOnStart is ignored when persistence is enabled).
- using (var ignite = Ignition.Start(cfg))
- {
- CheckIsActive(ignite, false);
-
- ignite.SetActive(true);
- CheckIsActive(ignite, true);
-
- ignite.SetActive(false);
- CheckIsActive(ignite, false);
- }
- }
-
- /// <summary>
- /// Tests the grid activation without persistence (active by default).
- /// </summary>
- [Test]
- public void TestGridActivationNoPersistence()
- {
- var cfg = TestUtils.GetTestConfiguration();
- Assert.IsTrue(cfg.IsActiveOnStart);
-
- using (var ignite = Ignition.Start(cfg))
- {
- CheckIsActive(ignite, true);
-
- ignite.SetActive(false);
- CheckIsActive(ignite, false);
-
- ignite.SetActive(true);
- CheckIsActive(ignite, true);
- }
-
- cfg.IsActiveOnStart = false;
-
- using (var ignite = Ignition.Start(cfg))
- {
- CheckIsActive(ignite, false);
-
- ignite.SetActive(true);
- CheckIsActive(ignite, true);
-
- ignite.SetActive(false);
- CheckIsActive(ignite, false);
- }
- }
-
- /// <summary>
- /// Checks active state.
- /// </summary>
- private static void CheckIsActive(IIgnite ignite, bool isActive)
- {
- Assert.AreEqual(isActive, ignite.IsActive());
-
- if (isActive)
- {
- var cache = ignite.GetOrCreateCache<int, int>("default");
- cache[1] = 1;
- Assert.AreEqual(1, cache[1]);
- }
- else
- {
- var ex = Assert.Throws<IgniteException>(() => ignite.GetOrCreateCache<int, int>("default"));
- Assert.AreEqual("Can not perform the operation because the cluster is inactive.",
- ex.Message.Substring(0, 62));
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTestObsolete.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTestObsolete.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTestObsolete.cs
new file mode 100644
index 0000000..a6b9b3b
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTestObsolete.cs
@@ -0,0 +1,190 @@
+/*
+ * 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.
+ */
+
+#pragma warning disable 618 // Obsolete.
+namespace Apache.Ignite.Core.Tests.Cache
+{
+ using System.IO;
+ using Apache.Ignite.Core.Common;
+ using Apache.Ignite.Core.Impl;
+ using Apache.Ignite.Core.PersistentStore;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Tests the persistent store. Uses the obsolete API. See <see cref="PersistenceTest"/> for the actual API.
+ /// </summary>
+ public class PersistentStoreTestObsolete
+ {
+ /** Temp dir for WAL. */
+ private readonly string _tempDir = IgniteUtils.GetTempDirectoryName();
+
+ /// <summary>
+ /// Tears down the test.
+ /// </summary>
+ [TearDown]
+ public void TearDown()
+ {
+ Ignition.StopAll(true);
+
+ if (Directory.Exists(_tempDir))
+ {
+ Directory.Delete(_tempDir, true);
+ }
+ }
+
+ /// <summary>
+ /// Tests that cache data survives node restart.
+ /// </summary>
+ [Test]
+ public void TestCacheDataSurvivesNodeRestart()
+ {
+ var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
+ {
+ PersistentStoreConfiguration = new PersistentStoreConfiguration
+ {
+ PersistentStorePath = Path.Combine(_tempDir, "Store"),
+ WalStorePath = Path.Combine(_tempDir, "WalStore"),
+ WalArchivePath = Path.Combine(_tempDir, "WalArchive"),
+ MetricsEnabled = true
+ }
+ };
+
+ const string cacheName = "persistentCache";
+
+ // Start Ignite, put data, stop.
+ using (var ignite = Ignition.Start(cfg))
+ {
+ ignite.SetActive(true);
+
+ var cache = ignite.CreateCache<int, int>(cacheName);
+
+ cache[1] = 1;
+
+ // Check some metrics.
+ var metrics = ignite.GetPersistentStoreMetrics();
+ Assert.Greater(metrics.WalLoggingRate, 0);
+ Assert.Greater(metrics.WalWritingRate, 0);
+ Assert.Greater(metrics.WalFsyncTimeAverage, 0);
+ }
+
+ // Verify directories.
+ Assert.IsTrue(Directory.Exists(cfg.PersistentStoreConfiguration.PersistentStorePath));
+ Assert.IsTrue(Directory.Exists(cfg.PersistentStoreConfiguration.WalStorePath));
+ Assert.IsTrue(Directory.Exists(cfg.PersistentStoreConfiguration.WalArchivePath));
+
+ // Start Ignite, verify data survival.
+ using (var ignite = Ignition.Start(cfg))
+ {
+ ignite.SetActive(true);
+
+ var cache = ignite.GetCache<int, int>(cacheName);
+
+ Assert.AreEqual(1, cache[1]);
+ }
+
+ // Delete store directory.
+ Directory.Delete(_tempDir, true);
+
+ // Start Ignite, verify data loss.
+ using (var ignite = Ignition.Start(cfg))
+ {
+ ignite.SetActive(true);
+
+ Assert.IsFalse(ignite.GetCacheNames().Contains(cacheName));
+ }
+ }
+
+ /// <summary>
+ /// Tests the grid activation with persistence (inactive by default).
+ /// </summary>
+ [Test]
+ public void TestGridActivationWithPersistence()
+ {
+ var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
+ {
+ PersistentStoreConfiguration = new PersistentStoreConfiguration()
+ };
+
+ // Default config, inactive by default (IsActiveOnStart is ignored when persistence is enabled).
+ using (var ignite = Ignition.Start(cfg))
+ {
+ CheckIsActive(ignite, false);
+
+ ignite.SetActive(true);
+ CheckIsActive(ignite, true);
+
+ ignite.SetActive(false);
+ CheckIsActive(ignite, false);
+ }
+ }
+
+ /// <summary>
+ /// Tests the grid activation without persistence (active by default).
+ /// </summary>
+ [Test]
+ public void TestGridActivationNoPersistence()
+ {
+ var cfg = TestUtils.GetTestConfiguration();
+ Assert.IsTrue(cfg.IsActiveOnStart);
+
+ using (var ignite = Ignition.Start(cfg))
+ {
+ CheckIsActive(ignite, true);
+
+ ignite.SetActive(false);
+ CheckIsActive(ignite, false);
+
+ ignite.SetActive(true);
+ CheckIsActive(ignite, true);
+ }
+
+ cfg.IsActiveOnStart = false;
+
+ using (var ignite = Ignition.Start(cfg))
+ {
+ CheckIsActive(ignite, false);
+
+ ignite.SetActive(true);
+ CheckIsActive(ignite, true);
+
+ ignite.SetActive(false);
+ CheckIsActive(ignite, false);
+ }
+ }
+
+ /// <summary>
+ /// Checks active state.
+ /// </summary>
+ private static void CheckIsActive(IIgnite ignite, bool isActive)
+ {
+ Assert.AreEqual(isActive, ignite.IsActive());
+
+ if (isActive)
+ {
+ var cache = ignite.GetOrCreateCache<int, int>("default");
+ cache[1] = 1;
+ Assert.AreEqual(1, cache[1]);
+ }
+ else
+ {
+ var ex = Assert.Throws<IgniteException>(() => ignite.GetOrCreateCache<int, int>("default"));
+ Assert.AreEqual("Can not perform the operation because the cluster is inactive.",
+ ex.Message.Substring(0, 62));
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/full-config.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/full-config.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/full-config.xml
index 229d42e..1e17752 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/full-config.xml
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/full-config.xml
@@ -131,4 +131,22 @@
<listener type='Apache.Ignite.Core.Tests.IgniteConfigurationSerializerTest+MyEventListener' />
</localEventListener>
</localEventListeners>
+ <dataStorageConfiguration alwaysWriteFullPages="false" checkpointFrequency="00:00:01" checkpointPageBufferSize="2"
+ checkpointThreads="3" concurrencyLevel="4" lockWaitTime="00:00:05" metricsEnabled="true"
+ pageSize="6" storagePath="cde" metricsRateTimeInterval="00:00:07"
+ metricsSubIntervalCount="8" systemRegionInitialSize="9" systemRegionMaxSize="10"
+ walThreadLocalBufferSize="11"
+ walArchivePath="abc" walFlushFrequency="00:00:12" walFsyncDelayNanos="13" walHistorySize="14"
+ walMode="Background" walRecordIteratorBufferSize="15" walSegments="16" walSegmentSize="17"
+ walPath="wal-store" writeThrottlingEnabled="true">
+ <dataRegionConfigurations>
+ <dataRegionConfiguration emptyPagesPoolSize="1" evictionThreshold="2" initialSize="3" metricsEnabled="true"
+ maxSize="4" name="reg2" pageEvictionMode="RandomLru" metricsRateTimeInterval="00:00:01"
+ metricsSubIntervalCount="5" swapPath="swap" />
+ </dataRegionConfigurations>
+ <defaultDataRegionConfiguration emptyPagesPoolSize="2" evictionThreshold="3" initialSize="4"
+ maxSize="5" metricsEnabled="false" name="reg1" pageEvictionMode="Disabled"
+ metricsRateTimeInterval="00:00:03" metricsSubIntervalCount="6"
+ swapPath="swap2" />
+ </dataStorageConfiguration>
</igniteConfiguration>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/spring-test.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/spring-test.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/spring-test.xml
index 31fa3b3..145fb01 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/spring-test.xml
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/spring-test.xml
@@ -43,22 +43,8 @@
</bean>
</property>
- <property name="memoryConfiguration">
- <bean class="org.apache.ignite.configuration.MemoryConfiguration">
- <property name="defaultMemoryPolicyName" value="dfltPlc"/>
-
- <property name="memoryPolicies">
- <list>
- <bean class="org.apache.ignite.configuration.MemoryPolicyConfiguration">
- <property name="name" value="dfltPlc"/>
- </bean>
- </list>
- </property>
- </bean>
- </property>
-
- <property name="persistentStoreConfiguration">
- <bean class="org.apache.ignite.configuration.PersistentStoreConfiguration"/>
+ <property name="dataStorageConfiguration">
+ <bean class="org.apache.ignite.configuration.DataStorageConfiguration"/>
</property>
</bean>
</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/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 edecccc..72c73e4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
@@ -17,6 +17,7 @@
// ReSharper disable UnusedAutoPropertyAccessor.Global
// ReSharper disable MemberCanBePrivate.Global
+#pragma warning disable 618
namespace Apache.Ignite.Core.Tests
{
using System;
@@ -55,6 +56,9 @@ namespace Apache.Ignite.Core.Tests
using Apache.Ignite.Core.Transactions;
using Apache.Ignite.NLog;
using NUnit.Framework;
+ using CheckpointWriteOrder = Apache.Ignite.Core.PersistentStore.CheckpointWriteOrder;
+ using DataPageEvictionMode = Apache.Ignite.Core.Cache.Configuration.DataPageEvictionMode;
+ using WalMode = Apache.Ignite.Core.PersistentStore.WalMode;
/// <summary>
/// Tests <see cref="IgniteConfiguration"/> serialization.
@@ -213,7 +217,6 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(PeerAssemblyLoadingMode.CurrentAppDomain, cfg.PeerAssemblyLoadingMode);
-#pragma warning disable 618 // Obsolete
var sql = cfg.SqlConnectorConfiguration;
Assert.IsNotNull(sql);
Assert.AreEqual("bar", sql.Host);
@@ -224,7 +227,6 @@ namespace Apache.Ignite.Core.Tests
Assert.IsTrue(sql.TcpNoDelay);
Assert.AreEqual(14, sql.MaxOpenCursorsPerConnection);
Assert.AreEqual(15, sql.ThreadPoolSize);
-#pragma warning restore 618
var client = cfg.ClientConnectorConfiguration;
Assert.IsNotNull(client);
@@ -269,6 +271,56 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual("Apache.Ignite.Core.Tests.EventsTestLocalListeners+Listener`1" +
"[Apache.Ignite.Core.Events.CacheRebalancingEvent]",
rebalListener.Listener.GetType().ToString());
+
+ var ds = cfg.DataStorageConfiguration;
+ Assert.IsFalse(ds.AlwaysWriteFullPages);
+ Assert.AreEqual(TimeSpan.FromSeconds(1), ds.CheckpointFrequency);
+ Assert.AreEqual(2, ds.CheckpointPageBufferSize);
+ Assert.AreEqual(3, ds.CheckpointThreads);
+ Assert.AreEqual(4, ds.ConcurrencyLevel);
+ Assert.AreEqual(TimeSpan.FromSeconds(5), ds.LockWaitTime);
+ Assert.IsTrue(ds.MetricsEnabled);
+ Assert.AreEqual(6, ds.PageSize);
+ Assert.AreEqual("cde", ds.StoragePath);
+ Assert.AreEqual(TimeSpan.FromSeconds(7), ds.MetricsRateTimeInterval);
+ Assert.AreEqual(8, ds.MetricsSubIntervalCount);
+ Assert.AreEqual(9, ds.SystemRegionInitialSize);
+ Assert.AreEqual(10, ds.SystemRegionMaxSize);
+ Assert.AreEqual(11, ds.WalThreadLocalBufferSize);
+ Assert.AreEqual("abc", ds.WalArchivePath);
+ Assert.AreEqual(TimeSpan.FromSeconds(12), ds.WalFlushFrequency);
+ Assert.AreEqual(13, ds.WalFsyncDelayNanos);
+ Assert.AreEqual(14, ds.WalHistorySize);
+ Assert.AreEqual(Core.Configuration.WalMode.Background, ds.WalMode);
+ Assert.AreEqual(15, ds.WalRecordIteratorBufferSize);
+ Assert.AreEqual(16, ds.WalSegments);
+ Assert.AreEqual(17, ds.WalSegmentSize);
+ Assert.AreEqual("wal-store", ds.WalPath);
+ Assert.IsTrue(ds.WriteThrottlingEnabled);
+
+ var dr = ds.DataRegionConfigurations.Single();
+ Assert.AreEqual(1, dr.EmptyPagesPoolSize);
+ Assert.AreEqual(2, dr.EvictionThreshold);
+ Assert.AreEqual(3, dr.InitialSize);
+ Assert.AreEqual(4, dr.MaxSize);
+ Assert.AreEqual("reg2", dr.Name);
+ Assert.AreEqual(Core.Configuration.DataPageEvictionMode.RandomLru, dr.PageEvictionMode);
+ Assert.AreEqual(TimeSpan.FromSeconds(1), dr.MetricsRateTimeInterval);
+ Assert.AreEqual(5, dr.MetricsSubIntervalCount);
+ Assert.AreEqual("swap", dr.SwapPath);
+ Assert.IsTrue(dr.MetricsEnabled);
+
+ dr = ds.DefaultDataRegionConfiguration;
+ Assert.AreEqual(2, dr.EmptyPagesPoolSize);
+ Assert.AreEqual(3, dr.EvictionThreshold);
+ Assert.AreEqual(4, dr.InitialSize);
+ Assert.AreEqual(5, dr.MaxSize);
+ Assert.AreEqual("reg1", dr.Name);
+ Assert.AreEqual(Core.Configuration.DataPageEvictionMode.Disabled, dr.PageEvictionMode);
+ Assert.AreEqual(TimeSpan.FromSeconds(3), dr.MetricsRateTimeInterval);
+ Assert.AreEqual(6, dr.MetricsSubIntervalCount);
+ Assert.AreEqual("swap2", dr.SwapPath);
+ Assert.IsFalse(dr.MetricsEnabled);
}
/// <summary>
@@ -574,7 +626,7 @@ namespace Apache.Ignite.Core.Tests
Serializer = new BinaryReflectiveSerializer()
}
},
- Types = new[] {typeof (string).FullName},
+ Types = new[] {typeof(string).FullName},
IdMapper = new IdMapper(),
KeepDeserialized = true,
NameMapper = new NameMapper(),
@@ -601,7 +653,7 @@ namespace Apache.Ignite.Core.Tests
{
Fields = new[]
{
- new QueryField("field", typeof (int))
+ new QueryField("field", typeof(int))
{
IsKeyField = true,
NotNull = true
@@ -619,8 +671,8 @@ namespace Apache.Ignite.Core.Tests
{
new QueryAlias("field.field", "fld")
},
- KeyType = typeof (string),
- ValueType = typeof (long),
+ KeyType = typeof(string),
+ ValueType = typeof(long),
TableName = "table-1",
KeyFieldName = "k",
ValueFieldName = "v"
@@ -645,12 +697,16 @@ namespace Apache.Ignite.Core.Tests
NearStartSize = 5,
EvictionPolicy = new FifoEvictionPolicy
{
- BatchSize = 19, MaxMemorySize = 1024, MaxSize = 555
+ BatchSize = 19,
+ MaxMemorySize = 1024,
+ MaxSize = 555
}
},
EvictionPolicy = new LruEvictionPolicy
{
- BatchSize = 18, MaxMemorySize = 1023, MaxSize = 554
+ BatchSize = 18,
+ MaxMemorySize = 1023,
+ MaxSize = 554
},
AffinityFunction = new RendezvousAffinityFunction
{
@@ -715,7 +771,7 @@ namespace Apache.Ignite.Core.Tests
WorkDirectory = @"c:\work",
IsDaemon = true,
UserAttributes = Enumerable.Range(1, 10).ToDictionary(x => x.ToString(),
- x => x%2 == 0 ? (object) x : new FooClass {Bar = x.ToString()}),
+ x => x % 2 == 0 ? (object) x : new FooClass {Bar = x.ToString()}),
AtomicConfiguration = new AtomicConfiguration
{
CacheMode = CacheMode.Replicated,
@@ -755,7 +811,7 @@ namespace Apache.Ignite.Core.Tests
FailureDetectionTimeout = TimeSpan.FromMinutes(2),
ClientFailureDetectionTimeout = TimeSpan.FromMinutes(3),
LongQueryWarningTimeout = TimeSpan.FromDays(4),
- PluginConfigurations = new[] {new TestIgnitePluginConfiguration() },
+ PluginConfigurations = new[] {new TestIgnitePluginConfiguration()},
EventStorageSpi = new MemoryEventStorageSpi
{
ExpirationTimeout = TimeSpan.FromMilliseconds(12345),
@@ -838,6 +894,65 @@ namespace Apache.Ignite.Core.Tests
EventTypes = new[] {1, 2},
Listener = new MyEventListener()
}
+ },
+ DataStorageConfiguration = new DataStorageConfiguration
+ {
+ AlwaysWriteFullPages = true,
+ CheckpointFrequency = TimeSpan.FromSeconds(25),
+ CheckpointPageBufferSize = 28 * 1024 * 1024,
+ CheckpointThreads = 2,
+ LockWaitTime = TimeSpan.FromSeconds(5),
+ StoragePath = Path.GetTempPath(),
+ WalThreadLocalBufferSize = 64 * 1024,
+ WalArchivePath = Path.GetTempPath(),
+ WalFlushFrequency = TimeSpan.FromSeconds(3),
+ WalFsyncDelayNanos = 3,
+ WalHistorySize = 10,
+ WalMode = Core.Configuration.WalMode.None,
+ WalRecordIteratorBufferSize = 32 * 1024 * 1024,
+ WalSegments = 6,
+ WalSegmentSize = 5 * 1024 * 1024,
+ WalPath = Path.GetTempPath(),
+ MetricsEnabled = true,
+ MetricsSubIntervalCount = 7,
+ MetricsRateTimeInterval = TimeSpan.FromSeconds(9),
+ CheckpointWriteOrder = Core.Configuration.CheckpointWriteOrder.Sequential,
+ WriteThrottlingEnabled = true,
+ SystemRegionInitialSize = 64 * 1024 * 1024,
+ SystemRegionMaxSize = 128 * 1024 * 1024,
+ ConcurrencyLevel = 1,
+ PageSize = 5 * 1024,
+ DefaultDataRegionConfiguration = new DataRegionConfiguration
+ {
+ Name = "reg1",
+ EmptyPagesPoolSize = 50,
+ EvictionThreshold = 0.8,
+ InitialSize = 100 * 1024 * 1024,
+ MaxSize = 150 * 1024 * 1024,
+ MetricsEnabled = true,
+ PageEvictionMode = Core.Configuration.DataPageEvictionMode.RandomLru,
+ PersistenceEnabled = false,
+ MetricsRateTimeInterval = TimeSpan.FromMinutes(2),
+ MetricsSubIntervalCount = 6,
+ SwapPath = Path.GetTempPath()
+ },
+ DataRegionConfigurations = new[]
+ {
+ new DataRegionConfiguration
+ {
+ Name = "reg2",
+ EmptyPagesPoolSize = 51,
+ EvictionThreshold = 0.7,
+ InitialSize = 101 * 1024 * 1024,
+ MaxSize = 151 * 1024 * 1024,
+ MetricsEnabled = false,
+ PageEvictionMode = Core.Configuration.DataPageEvictionMode.RandomLru,
+ PersistenceEnabled = false,
+ MetricsRateTimeInterval = TimeSpan.FromMinutes(3),
+ MetricsSubIntervalCount = 7,
+ SwapPath = Path.GetTempPath()
+ }
+ }
}
};
}
[11/50] [abbrv] ignite git commit: IGNITE-6529: JDBC: fixed not-null
column metadata. This closes #2884.
Posted by sb...@apache.org.
IGNITE-6529: JDBC: fixed not-null column metadata. This closes #2884.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5c8c4920
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5c8c4920
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5c8c4920
Branch: refs/heads/ignite-3478-tree
Commit: 5c8c492005868e6ee2bad1fb8daac5b202da52dd
Parents: 8f23bca
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Thu Oct 19 22:20:18 2017 +0300
Committer: devozerov <pp...@gmail.com>
Committed: Thu Oct 19 22:20:18 2017 +0300
----------------------------------------------------------------------
.../internal/jdbc2/JdbcMetadataSelfTest.java | 12 +++
.../jdbc/thin/JdbcThinMetadataSelfTest.java | 14 +++
.../jdbc/thin/JdbcThinDatabaseMetadata.java | 89 +++++++++-------
.../internal/jdbc2/JdbcDatabaseMetadata.java | 104 +++++++++++++------
4 files changed, 149 insertions(+), 70 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c8c4920/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
index bdc6644..1e5db0a 100755
--- a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
@@ -220,6 +220,8 @@ public class JdbcMetadataSelfTest extends GridCommonAbstractTest {
assertNotNull(rs);
+ assertEquals(24, rs.getMetaData().getColumnCount());
+
Collection<String> names = new ArrayList<>(2);
names.add("NAME");
@@ -237,14 +239,20 @@ public class JdbcMetadataSelfTest extends GridCommonAbstractTest {
assertEquals(VARCHAR, rs.getInt("DATA_TYPE"));
assertEquals("VARCHAR", rs.getString("TYPE_NAME"));
assertEquals(0, rs.getInt("NULLABLE"));
+ assertEquals(0, rs.getInt(11)); // nullable column by index
+ assertEquals("NO", rs.getString("IS_NULLABLE"));
} else if ("AGE".equals(name)) {
assertEquals(INTEGER, rs.getInt("DATA_TYPE"));
assertEquals("INTEGER", rs.getString("TYPE_NAME"));
assertEquals(0, rs.getInt("NULLABLE"));
+ assertEquals(0, rs.getInt(11)); // nullable column by index
+ assertEquals("NO", rs.getString("IS_NULLABLE"));
} else if ("ORGID".equals(name)) {
assertEquals(INTEGER, rs.getInt("DATA_TYPE"));
assertEquals("INTEGER", rs.getString("TYPE_NAME"));
assertEquals(1, rs.getInt("NULLABLE"));
+ assertEquals(1, rs.getInt(11)); // nullable column by index
+ assertEquals("YES", rs.getString("IS_NULLABLE"));
}
cnt++;
@@ -271,10 +279,14 @@ public class JdbcMetadataSelfTest extends GridCommonAbstractTest {
assertEquals(INTEGER, rs.getInt("DATA_TYPE"));
assertEquals("INTEGER", rs.getString("TYPE_NAME"));
assertEquals(0, rs.getInt("NULLABLE"));
+ assertEquals(0, rs.getInt(11)); // nullable column by index
+ assertEquals("NO", rs.getString("IS_NULLABLE"));
} else if ("name".equals(name)) {
assertEquals(VARCHAR, rs.getInt("DATA_TYPE"));
assertEquals("VARCHAR", rs.getString("TYPE_NAME"));
assertEquals(1, rs.getInt("NULLABLE"));
+ assertEquals(1, rs.getInt(11)); // nullable column by index
+ assertEquals("YES", rs.getString("IS_NULLABLE"));
}
cnt++;
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c8c4920/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMetadataSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMetadataSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMetadataSelfTest.java
index 4e1ae4d..2fd40d1 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMetadataSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMetadataSelfTest.java
@@ -260,6 +260,10 @@ public class JdbcThinMetadataSelfTest extends JdbcThinAbstractSelfTest {
ResultSet rs = meta.getColumns("", "pers", "PERSON", "%");
+ ResultSetMetaData rsMeta = rs.getMetaData();
+
+ assert rsMeta.getColumnCount() == 24 : "Invalid columns count: " + rsMeta.getColumnCount();
+
assert rs != null;
Collection<String> names = new ArrayList<>(2);
@@ -279,24 +283,34 @@ public class JdbcThinMetadataSelfTest extends JdbcThinAbstractSelfTest {
assert rs.getInt("DATA_TYPE") == VARCHAR;
assert "VARCHAR".equals(rs.getString("TYPE_NAME"));
assert rs.getInt("NULLABLE") == 0;
+ assert rs.getInt(11) == 0; // nullable column by index
+ assert rs.getString("IS_NULLABLE").equals("NO");
} else if ("ORGID".equals(name)) {
assert rs.getInt("DATA_TYPE") == INTEGER;
assert "INTEGER".equals(rs.getString("TYPE_NAME"));
assert rs.getInt("NULLABLE") == 1;
+ assert rs.getInt(11) == 1; // nullable column by index
+ assert rs.getString("IS_NULLABLE").equals("YES");
} else if ("AGE".equals(name)) {
assert rs.getInt("DATA_TYPE") == INTEGER;
assert "INTEGER".equals(rs.getString("TYPE_NAME"));
assert rs.getInt("NULLABLE") == 0;
+ assert rs.getInt(11) == 0; // nullable column by index
+ assert rs.getString("IS_NULLABLE").equals("NO");
}
else if ("_KEY".equals(name)) {
assert rs.getInt("DATA_TYPE") == OTHER;
assert "OTHER".equals(rs.getString("TYPE_NAME"));
assert rs.getInt("NULLABLE") == 0;
+ assert rs.getInt(11) == 0; // nullable column by index
+ assert rs.getString("IS_NULLABLE").equals("NO");
}
else if ("_VAL".equals(name)) {
assert rs.getInt("DATA_TYPE") == OTHER;
assert "OTHER".equals(rs.getString("TYPE_NAME"));
assert rs.getInt("NULLABLE") == 0;
+ assert rs.getInt(11) == 0; // nullable column by index
+ assert rs.getString("IS_NULLABLE").equals("NO");
}
cnt++;
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c8c4920/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinDatabaseMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinDatabaseMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinDatabaseMetadata.java
index 8b26900..cfc3b68 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinDatabaseMetadata.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinDatabaseMetadata.java
@@ -793,26 +793,31 @@ public class JdbcThinDatabaseMetadata implements DatabaseMetaData {
conn.ensureNotClosed();
final List<JdbcColumnMeta> meta = Arrays.asList(
- new JdbcColumnMeta(null, null, "TABLE_CAT", String.class),
- new JdbcColumnMeta(null, null, "TABLE_SCHEM", String.class),
- new JdbcColumnMeta(null, null, "TABLE_NAME", String.class),
- new JdbcColumnMeta(null, null, "COLUMN_NAME", String.class),
- new JdbcColumnMeta(null, null, "DATA_TYPE", Short.class),
- new JdbcColumnMeta(null, null, "TYPE_NAME", String.class),
- new JdbcColumnMeta(null, null, "COLUMN_SIZE", Integer.class),
- new JdbcColumnMeta(null, null, "DECIMAL_DIGITS", Integer.class),
- new JdbcColumnMeta(null, null, "NUM_PREC_RADIX", Short.class),
- new JdbcColumnMeta(null, null, "NULLABLE", Short.class),
- new JdbcColumnMeta(null, null, "REMARKS", String.class),
- new JdbcColumnMeta(null, null, "COLUMN_DEF", String.class),
- new JdbcColumnMeta(null, null, "CHAR_OCTET_LENGTH", Integer.class),
- new JdbcColumnMeta(null, null, "ORDINAL_POSITION", Integer.class),
- new JdbcColumnMeta(null, null, "IS_NULLABLE", String.class),
- new JdbcColumnMeta(null, null, "SCOPE_CATLOG", String.class),
- new JdbcColumnMeta(null, null, "SCOPE_SCHEMA", String.class),
- new JdbcColumnMeta(null, null, "SCOPE_TABLE", String.class),
- new JdbcColumnMeta(null, null, "SOURCE_DATA_TYPE", Short.class),
- new JdbcColumnMeta(null, null, "IS_AUTOINCREMENT", String.class));
+ new JdbcColumnMeta(null, null, "TABLE_CAT", String.class), // 1
+ new JdbcColumnMeta(null, null, "TABLE_SCHEM", String.class), // 2
+ new JdbcColumnMeta(null, null, "TABLE_NAME", String.class), // 3
+ new JdbcColumnMeta(null, null, "COLUMN_NAME", String.class), // 4
+ new JdbcColumnMeta(null, null, "DATA_TYPE", Short.class), // 5
+ new JdbcColumnMeta(null, null, "TYPE_NAME", String.class), // 6
+ new JdbcColumnMeta(null, null, "COLUMN_SIZE", Integer.class), // 7
+ new JdbcColumnMeta(null, null, "BUFFER_LENGTH ", Integer.class), // 8
+ new JdbcColumnMeta(null, null, "DECIMAL_DIGITS", Integer.class), // 9
+ new JdbcColumnMeta(null, null, "NUM_PREC_RADIX", Short.class), // 10
+ new JdbcColumnMeta(null, null, "NULLABLE", Short.class), // 11
+ new JdbcColumnMeta(null, null, "REMARKS", String.class), // 12
+ new JdbcColumnMeta(null, null, "COLUMN_DEF", String.class), // 13
+ new JdbcColumnMeta(null, null, "SQL_DATA_TYPE", Integer.class), // 14
+ new JdbcColumnMeta(null, null, "SQL_DATETIME_SUB", Integer.class), // 15
+ new JdbcColumnMeta(null, null, "CHAR_OCTET_LENGTH", Integer.class), // 16
+ new JdbcColumnMeta(null, null, "ORDINAL_POSITION", Integer.class), // 17
+ new JdbcColumnMeta(null, null, "IS_NULLABLE", String.class), // 18
+ new JdbcColumnMeta(null, null, "SCOPE_CATLOG", String.class), // 19
+ new JdbcColumnMeta(null, null, "SCOPE_SCHEMA", String.class), // 20
+ new JdbcColumnMeta(null, null, "SCOPE_TABLE", String.class), // 21
+ new JdbcColumnMeta(null, null, "SOURCE_DATA_TYPE", Short.class), // 22
+ new JdbcColumnMeta(null, null, "IS_AUTOINCREMENT", String.class), // 23
+ new JdbcColumnMeta(null, null, "IS_GENERATEDCOLUMN ", String.class) // 24
+ );
if (!validCatalogPattern(catalog))
return new JdbcThinResultSet(Collections.<List<Object>>emptyList(), meta);
@@ -835,26 +840,30 @@ public class JdbcThinDatabaseMetadata implements DatabaseMetaData {
private List<Object> columnRow(JdbcColumnMeta colMeta, int pos) {
List<Object> row = new ArrayList<>(20);
- row.add((String)null);
- row.add(colMeta.schemaName());
- row.add(colMeta.tableName());
- row.add(colMeta.columnName());
- row.add(colMeta.dataType());
- row.add(colMeta.dataTypeName());
- row.add((Integer)null);
- row.add((Integer)null);
- row.add(10);
- row.add(colMeta.isNullable() ? 1 : 0);
- row.add((String)null);
- row.add((String)null);
- row.add(Integer.MAX_VALUE);
- row.add(pos);
- row.add("YES");
- row.add((String)null);
- row.add((String)null);
- row.add((String)null);
- row.add((Short)null);
- row.add("NO");
+ row.add((String)null); // 1. TABLE_CAT
+ row.add(colMeta.schemaName()); // 2. TABLE_SCHEM
+ row.add(colMeta.tableName()); // 3. TABLE_NAME
+ row.add(colMeta.columnName()); // 4. COLUMN_NAME
+ row.add(colMeta.dataType()); // 5. DATA_TYPE
+ row.add(colMeta.dataTypeName()); // 6. TYPE_NAME
+ row.add((Integer)null); // 7. COLUMN_SIZE
+ row.add((Integer)null); // 8. BUFFER_LENGTH
+ row.add((Integer)null); // 9. DECIMAL_DIGITS
+ row.add(10); // 10. NUM_PREC_RADIX
+ row.add(colMeta.isNullable() ? columnNullable : columnNoNulls); // 11. NULLABLE
+ row.add((String)null); // 12. REMARKS
+ row.add((String)null); // 13. COLUMN_DEF
+ row.add(colMeta.dataType()); // 14. SQL_DATA_TYPE
+ row.add((Integer)null); // 15. SQL_DATETIME_SUB
+ row.add(Integer.MAX_VALUE); // 16. CHAR_OCTET_LENGTH
+ row.add(pos); // 17. ORDINAL_POSITION
+ row.add(colMeta.isNullable() ? "YES" : "NO"); // 18. IS_NULLABLE
+ row.add((String)null); // 19. SCOPE_CATALOG
+ row.add((String)null); // 20. SCOPE_SCHEMA
+ row.add((String)null); // 21. SCOPE_TABLE
+ row.add((Short)null); // 22. SOURCE_DATA_TYPE
+ row.add("NO"); // 23. IS_AUTOINCREMENT
+ row.add("NO"); // 23. IS_GENERATEDCOLUMN
return row;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c8c4920/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcDatabaseMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcDatabaseMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcDatabaseMetadata.java
index 2fe24bb..eb55e4f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcDatabaseMetadata.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcDatabaseMetadata.java
@@ -815,16 +815,56 @@ public class JdbcDatabaseMetadata implements DatabaseMetaData {
return new JdbcResultSet(true, null,
conn.createStatement0(),
Collections.<String>emptyList(),
- Arrays.asList("TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME", "DATA_TYPE",
- "TYPE_NAME", "COLUMN_SIZE", "DECIMAL_DIGITS", "NUM_PREC_RADIX", "NULLABLE",
- "REMARKS", "COLUMN_DEF", "CHAR_OCTET_LENGTH", "ORDINAL_POSITION", "IS_NULLABLE",
- "SCOPE_CATLOG", "SCOPE_SCHEMA", "SCOPE_TABLE", "SOURCE_DATA_TYPE", "IS_AUTOINCREMENT"),
- Arrays.asList(String.class.getName(), String.class.getName(), String.class.getName(),
- String.class.getName(), Integer.class.getName(), String.class.getName(), Integer.class.getName(),
- Integer.class.getName(), Integer.class.getName(), Integer.class.getName(), String.class.getName(),
- String.class.getName(), Integer.class.getName(), Integer.class.getName(), String.class.getName(),
- String.class.getName(), String.class.getName(), String.class.getName(), Short.class.getName(),
- String.class.getName()),
+ Arrays.asList(
+ "TABLE_CAT", // 1
+ "TABLE_SCHEM", // 2
+ "TABLE_NAME", // 3
+ "COLUMN_NAME", // 4
+ "DATA_TYPE", // 5
+ "TYPE_NAME", // 6
+ "COLUMN_SIZE", // 7
+ "BUFFER_LENGTH", // 8
+ "DECIMAL_DIGITS", // 9
+ "NUM_PREC_RADIX", // 10
+ "NULLABLE", // 11
+ "REMARKS", // 12
+ "COLUMN_DEF", // 13
+ "SQL_DATA_TYPE", // 14
+ "SQL_DATETIME_SUB", // 15
+ "CHAR_OCTET_LENGTH", // 16
+ "ORDINAL_POSITION", // 17
+ "IS_NULLABLE", // 18
+ "SCOPE_CATLOG", // 19
+ "SCOPE_SCHEMA", // 20
+ "SCOPE_TABLE", // 21
+ "SOURCE_DATA_TYPE", // 22
+ "IS_AUTOINCREMENT", // 23
+ "IS_GENERATEDCOLUMN"), // 23
+ Arrays.asList(
+ String.class.getName(), // 1
+ String.class.getName(), // 2
+ String.class.getName(), // 3
+ String.class.getName(), // 4
+ Integer.class.getName(), // 5
+ String.class.getName(), // 6
+ Integer.class.getName(), // 7
+ Integer.class.getName(), // 8
+ Integer.class.getName(), // 9
+ Integer.class.getName(), // 10
+ Integer.class.getName(), // 11
+ String.class.getName(), // 12
+ String.class.getName(), // 13
+ Integer.class.getName(), // 14
+ Integer.class.getName(), // 15
+ Integer.class.getName(), // 16
+ Integer.class.getName(), // 17
+ String.class.getName(), // 18
+ String.class.getName(), // 19
+ String.class.getName(), // 20
+ String.class.getName(), // 21
+ Short.class.getName(), // 22
+ String.class.getName(), // 23
+ String.class.getName()), // 24
rows, true
);
}
@@ -843,26 +883,30 @@ public class JdbcDatabaseMetadata implements DatabaseMetaData {
boolean nullable, int pos) {
List<Object> row = new ArrayList<>(20);
- row.add(null);
- row.add(schema);
- row.add(tbl);
- row.add(col);
- row.add(type);
- row.add(typeName);
- row.add(null);
- row.add(null);
- row.add(10);
- row.add(nullable ? columnNullable : columnNoNulls);
- row.add(null);
- row.add(null);
- row.add(Integer.MAX_VALUE);
- row.add(pos);
- row.add("YES");
- row.add(null);
- row.add(null);
- row.add(null);
- row.add(null);
- row.add("NO");
+ row.add(null); // 1. TABLE_CAT
+ row.add(schema); // 2. TABLE_SCHEM
+ row.add(tbl); // 3. TABLE_NAME
+ row.add(col); // 4. COLUMN_NAME
+ row.add(type); // 5. DATA_TYPE
+ row.add(typeName); // 6. TYPE_NAME
+ row.add(null); // 7. COLUMN_SIZE
+ row.add(null); // 8. BUFFER_LENGTH
+ row.add(null); // 9. DECIMAL_DIGITS
+ row.add(10); // 10. NUM_PREC_RADIX
+ row.add(nullable ? columnNullable : columnNoNulls); // 11. NULLABLE
+ row.add(null); // 12. REMARKS
+ row.add(null); // 13. COLUMN_DEF
+ row.add(type); // 14. SQL_DATA_TYPE
+ row.add(null); // 15. SQL_DATETIME_SUB
+ row.add(Integer.MAX_VALUE); // 16. CHAR_OCTET_LENGTH
+ row.add(pos); // 17. ORDINAL_POSITION
+ row.add(nullable ? "YES" : "NO"); // 18. IS_NULLABLE
+ row.add(null); // 19. SCOPE_CATALOG
+ row.add(null); // 20. SCOPE_SCHEMA
+ row.add(null); // 21. SCOPE_TABLE
+ row.add(null); // 22. SOURCE_DATA_TYPE
+ row.add("NO"); // 23. IS_AUTOINCREMENT
+ row.add("NO"); // 24. IS_GENERATEDCOLUMN
return row;
}
[50/50] [abbrv] ignite git commit: Merge remote-tracking branch
'remotes/origin/master' into ignite-3478-tree
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-3478-tree
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f7a1b8b4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f7a1b8b4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f7a1b8b4
Branch: refs/heads/ignite-3478-tree
Commit: f7a1b8b4f67c8ce471fc29c6aa23f19531d428f6
Parents: 27ed6157 2bc75a3
Author: sboikov <sb...@gridgain.com>
Authored: Tue Oct 24 11:46:23 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Oct 24 11:46:23 2017 +0300
----------------------------------------------------------------------
RELEASE_NOTES.txt | 98 ++
assembly/dependencies-fabric-lgpl.xml | 4 +
assembly/dependencies-fabric.xml | 4 +
assembly/dependencies-sqlline.xml | 53 +
assembly/release-fabric-base.xml | 1 -
examples/config/example-data-regions.xml | 106 ++
examples/config/example-memory-policies.xml | 108 --
.../example-persistent-store.xml | 14 +-
.../examples/datagrid/DataRegionsExample.java | 113 ++
.../datagrid/MemoryPoliciesExample.java | 114 --
.../ignite/examples/CacheExamplesSelfTest.java | 6 +-
.../benchmarks/jmh/tree/BPlusTreeBenchmark.java | 8 +-
.../internal/jdbc2/JdbcConnectionSelfTest.java | 13 +-
.../internal/jdbc2/JdbcMetadataSelfTest.java | 40 +-
.../internal/jdbc2/JdbcStatementSelfTest.java | 130 +-
.../JettyRestProcessorAbstractSelfTest.java | 4 +-
.../jdbc/suite/IgniteJdbcDriverTestSuite.java | 11 +
.../JdbcThinAbstractDmlStatementSelfTest.java | 16 +-
.../thin/JdbcThinAutoCloseServerCursorTest.java | 8 +-
.../thin/JdbcThinComplexDmlDdlSelfTest.java | 10 +-
...omplexDmlDdlSkipReducerOnUpdateSelfTest.java | 33 +
.../jdbc/thin/JdbcThinComplexQuerySelfTest.java | 2 +-
.../jdbc/thin/JdbcThinConnectionSelfTest.java | 22 +-
.../JdbcThinDynamicIndexAbstractSelfTest.java | 2 +-
.../jdbc/thin/JdbcThinEmptyCacheSelfTest.java | 2 +-
.../thin/JdbcThinInsertStatementSelfTest.java | 1 -
...ertStatementSkipReducerOnUpdateSelfTest.java | 33 +
...rgeStatementSkipReducerOnUpdateSelfTest.java | 33 +
.../jdbc/thin/JdbcThinMetadataSelfTest.java | 53 +-
.../JdbcThinMissingLongArrayResultsTest.java | 2 +-
.../jdbc/thin/JdbcThinNoDefaultSchemaTest.java | 5 +-
.../thin/JdbcThinPreparedStatementSelfTest.java | 2 +-
.../jdbc/thin/JdbcThinResultSetSelfTest.java | 2 +-
.../jdbc/thin/JdbcThinStatementSelfTest.java | 46 +-
...ateStatementSkipReducerOnUpdateSelfTest.java | 33 +
.../ignite/codegen/MessageCodeGenerator.java | 2 +
modules/compatibility/pom.xml | 13 +
.../DummyPersistenceCompatibilityTest.java | 8 +-
.../junits/IgniteCompatibilityAbstractTest.java | 6 +-
.../junits/IgniteCompatibilityNodeRunner.java | 2 +-
.../org/apache/ignite/DataRegionMetrics.java | 130 ++
.../apache/ignite/DataRegionMetricsAdapter.java | 106 ++
.../org/apache/ignite/DataStorageMetrics.java | 114 ++
.../ignite/DataStorageMetricsAdapter.java | 101 ++
.../src/main/java/org/apache/ignite/Ignite.java | 48 +-
.../org/apache/ignite/IgniteJdbcDriver.java | 16 +-
.../org/apache/ignite/IgniteJdbcThinDriver.java | 3 +-
.../apache/ignite/IgniteSystemProperties.java | 4 +-
.../java/org/apache/ignite/MemoryMetrics.java | 11 +-
.../org/apache/ignite/PersistenceMetrics.java | 4 +-
.../org/apache/ignite/cache/CacheMetrics.java | 20 +
.../ignite/cache/query/SqlFieldsQuery.java | 7 +
.../configuration/CacheConfiguration.java | 36 +-
.../configuration/DataPageEvictionMode.java | 8 +-
.../configuration/DataRegionConfiguration.java | 406 ++++++
.../configuration/DataStorageConfiguration.java | 882 +++++++++++++
.../configuration/IgniteConfiguration.java | 46 +-
.../configuration/MemoryConfiguration.java | 9 +-
.../MemoryPolicyConfiguration.java | 32 +-
.../PersistentStoreConfiguration.java | 4 +-
.../apache/ignite/configuration/WALMode.java | 9 +-
.../org/apache/ignite/igfs/IgfsMetrics.java | 4 +-
.../apache/ignite/internal/IgniteKernal.java | 79 +-
.../ignite/internal/IgniteNodeAttributes.java | 4 +
.../ignite/internal/IgniteServicesImpl.java | 4 +-
.../org/apache/ignite/internal/IgnitionEx.java | 132 +-
.../ignite/internal/MarshallerContextImpl.java | 3 +-
.../internal/MarshallerMappingFileStore.java | 15 +-
.../ignite/internal/binary/BinaryMetadata.java | 8 +-
.../connection/GridClientNioTcpConnection.java | 2 +
.../internal/jdbc/thin/JdbcThinConnection.java | 10 +-
.../jdbc/thin/JdbcThinDatabaseMetadata.java | 90 +-
.../jdbc/thin/JdbcThinPreparedStatement.java | 5 +-
.../internal/jdbc/thin/JdbcThinStatement.java | 9 +-
.../internal/jdbc/thin/JdbcThinTcpIo.java | 39 +-
.../internal/jdbc/thin/JdbcThinUtils.java | 6 +
.../internal/jdbc2/JdbcBatchUpdateTask.java | 3 +-
.../ignite/internal/jdbc2/JdbcConnection.java | 27 +-
.../internal/jdbc2/JdbcDatabaseMetadata.java | 228 +++-
.../jdbc2/JdbcQueryMultipleStatementsTask.java | 168 +++
.../ignite/internal/jdbc2/JdbcQueryTask.java | 164 +--
.../internal/jdbc2/JdbcQueryTaskResult.java | 120 ++
.../ignite/internal/jdbc2/JdbcQueryTaskV3.java | 105 ++
.../ignite/internal/jdbc2/JdbcResultSet.java | 175 ++-
.../internal/jdbc2/JdbcSqlFieldsQuery.java | 105 --
.../ignite/internal/jdbc2/JdbcStatement.java | 274 ++--
.../internal/jdbc2/JdbcStatementResultInfo.java | 73 +
.../jdbc2/JdbcStreamedPreparedStatement.java | 19 +-
.../discovery/GridDiscoveryManager.java | 31 +-
.../pagemem/impl/PageMemoryNoStoreImpl.java | 32 +-
.../ignite/internal/pagemem/wal/WALPointer.java | 4 +-
.../internal/pagemem/wal/record/DataEntry.java | 13 +-
.../internal/pagemem/wal/record/DataRecord.java | 20 +-
.../pagemem/wal/record/SnapshotRecord.java | 58 +
.../pagemem/wal/record/TimeStampRecord.java | 57 +
.../internal/pagemem/wal/record/TxRecord.java | 52 +-
.../pagemem/wal/record/UnwrapDataEntry.java | 22 +-
.../internal/pagemem/wal/record/WALRecord.java | 6 +-
.../cache/CacheAffinitySharedManager.java | 25 +-
.../cache/CacheClusterMetricsMXBeanImpl.java | 10 +
.../processors/cache/CacheGroupContext.java | 29 +-
.../processors/cache/CacheGroupData.java | 17 +-
.../processors/cache/CacheGroupDescriptor.java | 19 +-
.../cache/CacheLocalMetricsMXBeanImpl.java | 10 +
.../processors/cache/CacheMetricsImpl.java | 14 +-
.../processors/cache/CacheMetricsSnapshot.java | 10 +
.../processors/cache/ClusterCachesInfo.java | 14 +-
.../cache/DynamicCacheChangeRequest.java | 18 +
.../processors/cache/GridCacheAdapter.java | 36 +-
.../cache/GridCacheAffinityManager.java | 2 +-
.../processors/cache/GridCacheContext.java | 8 +-
.../processors/cache/GridCacheEntryEx.java | 3 +-
.../processors/cache/GridCacheMapEntry.java | 18 +-
.../processors/cache/GridCacheProcessor.java | 153 ++-
.../processors/cache/GridCacheUtils.java | 55 +
.../cache/IgniteCacheOffheapManagerImpl.java | 48 +-
.../cache/binary/BinaryMetadataFileStore.java | 7 +-
.../binary/CacheObjectBinaryProcessorImpl.java | 10 +-
.../GridDistributedTxRemoteAdapter.java | 5 +-
.../distributed/dht/GridDhtLocalPartition.java | 61 +-
.../dht/atomic/GridDhtAtomicCache.java | 3 +-
.../dht/preloader/GridDhtPartitionDemander.java | 9 -
.../distributed/near/GridNearGetRequest.java | 2 +-
.../distributed/near/GridNearLockRequest.java | 2 +-
.../cache/distributed/near/GridNearTxLocal.java | 2 +-
.../near/GridNearTxPrepareRequest.java | 2 +-
.../local/atomic/GridLocalAtomicCache.java | 2 +-
.../cache/persistence/CacheDataRowAdapter.java | 2 +-
.../cache/persistence/DataRegion.java | 84 ++
.../persistence/DataRegionMetricsImpl.java | 304 +++++
.../DataRegionMetricsMXBeanImpl.java | 136 ++
.../persistence/DataRegionMetricsSnapshot.java | 121 ++
.../persistence/DataStorageMetricsImpl.java | 297 +++++
.../persistence/DataStorageMetricsSnapshot.java | 144 ++
.../GridCacheDatabaseSharedManager.java | 171 ++-
.../persistence/GridCacheOffheapManager.java | 22 +-
.../IgniteCacheDatabaseSharedManager.java | 538 ++++----
.../cache/persistence/MemoryMetricsImpl.java | 286 ----
.../persistence/MemoryMetricsMXBeanImpl.java | 131 --
.../persistence/MemoryMetricsSnapshot.java | 112 --
.../cache/persistence/MemoryPolicy.java | 84 --
.../persistence/PersistenceMetricsImpl.java | 297 -----
.../persistence/PersistenceMetricsSnapshot.java | 144 --
.../processors/cache/persistence/RowStore.java | 38 +-
.../evict/FairFifoPageEvictionTracker.java | 6 +-
.../evict/PageAbstractEvictionTracker.java | 6 +-
.../evict/Random2LruPageEvictionTracker.java | 8 +-
.../evict/RandomLruPageEvictionTracker.java | 8 +-
.../persistence/file/AsyncFileIOFactory.java | 28 +-
.../cache/persistence/file/FilePageStore.java | 6 +-
.../persistence/file/FilePageStoreManager.java | 74 +-
.../cache/persistence/file/FilePageStoreV2.java | 4 +-
.../file/FileVersionCheckingFactory.java | 6 +-
.../filename/PdsConsistentIdProcessor.java | 11 +-
.../persistence/freelist/FreeListImpl.java | 12 +-
.../cache/persistence/freelist/PagesList.java | 7 +-
.../persistence/pagemem/PageMemoryImpl.java | 48 +-
.../snapshot/IgniteCacheSnapshotManager.java | 3 +
.../cache/persistence/wal/FileWALPointer.java | 3 +
.../wal/FileWriteAheadLogManager.java | 84 +-
.../wal/reader/IgniteWalIteratorFactory.java | 12 +-
.../wal/reader/StandaloneGridKernalContext.java | 11 +-
.../reader/StandaloneWalRecordsIterator.java | 37 +-
.../wal/serializer/RecordDataV1Serializer.java | 6 +-
.../wal/serializer/RecordDataV2Serializer.java | 49 +-
.../wal/serializer/RecordV2Serializer.java | 3 +-
.../wal/serializer/TxRecordSerializer.java | 3 +-
.../cache/query/GridCacheQueryManager.java | 158 ++-
.../query/GridCacheQuerySqlMetadataJobV2.java | 154 +++
.../query/GridCacheQuerySqlMetadataV2.java | 101 ++
.../cache/query/GridCacheSqlMetadata.java | 8 +
.../cache/query/GridCacheSqlQuery.java | 24 +
.../cache/query/IgniteQueryErrorCode.java | 2 +-
.../cache/query/SqlFieldsQueryEx.java | 158 +++
.../cache/ratemetrics/HitRateMetrics.java | 2 +-
.../cache/transactions/IgniteTxAdapter.java | 3 +-
.../transactions/IgniteTxLocalAdapter.java | 2 +-
.../processors/cache/tree/CacheDataTree.java | 4 +-
.../cache/tree/PendingEntriesTree.java | 2 +-
.../processors/cluster/ClusterProcessor.java | 39 +-
.../cluster/GridClusterStateProcessor.java | 3 +-
.../processors/cluster/GridUpdateNotifier.java | 224 ++--
.../cluster/HttpIgniteUpdatesChecker.java | 29 +-
.../processors/igfs/IgfsDataManager.java | 4 +-
.../processors/odbc/jdbc/JdbcColumnMeta.java | 10 +
.../processors/odbc/jdbc/JdbcColumnMetaV2.java | 74 ++
.../odbc/jdbc/JdbcConnectionContext.java | 11 +-
.../odbc/jdbc/JdbcMetaColumnsResult.java | 28 +-
.../odbc/jdbc/JdbcMetaColumnsResultV2.java | 50 +
.../odbc/jdbc/JdbcRequestHandler.java | 51 +-
.../processors/odbc/jdbc/JdbcResult.java | 8 +
.../odbc/odbc/OdbcConnectionContext.java | 13 +-
.../odbc/odbc/OdbcRequestHandler.java | 14 +-
.../platform/client/ClientIntResponse.java | 46 +
.../platform/client/ClientLongResponse.java | 46 +
.../platform/client/ClientMessageParser.java | 133 ++
.../cache/ClientCacheClearKeyRequest.java | 44 +
.../cache/ClientCacheClearKeysRequest.java | 44 +
.../client/cache/ClientCacheClearRequest.java | 44 +
.../cache/ClientCacheContainsKeyRequest.java | 45 +
.../cache/ClientCacheContainsKeysRequest.java | 45 +
.../client/cache/ClientCacheGetAllRequest.java | 46 +
.../client/cache/ClientCacheGetAllResponse.java | 57 +
.../ClientCacheGetAndPutIfAbsentRequest.java | 45 +
.../cache/ClientCacheGetAndPutRequest.java | 45 +
.../cache/ClientCacheGetAndRemoveRequest.java | 45 +
.../cache/ClientCacheGetAndReplaceRequest.java | 45 +
.../client/cache/ClientCacheGetRequest.java | 9 +-
.../client/cache/ClientCacheGetSizeRequest.java | 57 +
.../client/cache/ClientCacheKeyRequest.java | 48 +
.../cache/ClientCacheKeyValueRequest.java | 48 +
.../client/cache/ClientCacheKeysRequest.java | 68 +
.../client/cache/ClientCachePutAllRequest.java | 57 +
.../cache/ClientCachePutIfAbsentRequest.java | 45 +
.../client/cache/ClientCachePutRequest.java | 13 +-
.../cache/ClientCacheRemoveAllRequest.java | 44 +
.../cache/ClientCacheRemoveIfEqualsRequest.java | 45 +
.../cache/ClientCacheRemoveKeyRequest.java | 45 +
.../cache/ClientCacheRemoveKeysRequest.java | 44 +
.../ClientCacheReplaceIfEqualsRequest.java | 50 +
.../client/cache/ClientCacheReplaceRequest.java | 45 +
.../client/cache/ClientCacheRequest.java | 10 +-
.../platform/cluster/PlatformClusterGroup.java | 90 ++
.../utils/PlatformConfigurationUtils.java | 177 ++-
.../processors/query/GridQueryIndexing.java | 47 +-
.../processors/query/GridQueryProcessor.java | 111 +-
.../query/QueryTypeDescriptorImpl.java | 42 +-
.../query/property/QueryBinaryProperty.java | 1 -
.../schema/SchemaIndexCacheVisitorClosure.java | 14 +-
.../schema/SchemaIndexCacheVisitorImpl.java | 29 +-
.../handlers/cache/GridCacheCommandHandler.java | 12 +-
.../service/GridServiceProcessor.java | 70 +-
.../ignite/internal/util/IgniteUtils.java | 62 +-
.../nio/GridAbstractCommunicationClient.java | 2 +-
.../visor/cache/VisorCacheConfiguration.java | 8 +-
.../visor/cache/VisorMemoryMetrics.java | 6 +-
.../node/VisorDataRegionConfiguration.java | 225 ++++
.../node/VisorDataStorageConfiguration.java | 453 +++++++
.../visor/node/VisorGridConfiguration.java | 29 +-
.../visor/node/VisorMemoryConfiguration.java | 26 +-
.../node/VisorMemoryPolicyConfiguration.java | 10 +-
.../visor/node/VisorNodeDataCollectorJob.java | 6 +-
.../node/VisorNodeDataCollectorJobResult.java | 4 +-
.../node/VisorNodeDataCollectorTaskResult.java | 4 +-
.../visor/node/VisorPersistenceMetrics.java | 8 +-
.../node/VisorPersistentStoreConfiguration.java | 22 +-
.../internal/visor/query/VisorQueryTask.java | 23 +-
.../ignite/mxbean/DataRegionMetricsMXBean.java | 143 ++
.../ignite/mxbean/DataStorageMetricsMXBean.java | 121 ++
.../ignite/mxbean/MemoryMetricsMXBean.java | 2 +
.../ignite/mxbean/PersistenceMetricsMXBean.java | 2 +
.../communication/tcp/TcpCommunicationSpi.java | 378 +++---
.../spi/discovery/IgniteDiscoveryThread.java | 23 +
.../ignite/spi/discovery/tcp/ServerImpl.java | 48 +-
.../spi/discovery/tcp/TcpDiscoverySpi.java | 18 +
.../spi/indexing/IndexingQueryCacheFilter.java | 72 +
.../spi/indexing/IndexingQueryFilter.java | 12 +-
.../spi/indexing/IndexingQueryFilterImpl.java | 79 ++
.../resources/META-INF/classnames.properties | 10 +-
.../core/src/test/config/examples.properties | 2 +-
.../ignite/cache/LargeEntryUpdateTest.java | 6 +-
.../internal/ClusterNodeMetricsSelfTest.java | 8 +-
.../IgniteSlowClientDetectionSelfTest.java | 6 +-
.../internal/TestRecordingCommunicationSpi.java | 12 +
.../pagemem/impl/PageMemoryNoLoadSelfTest.java | 8 +-
.../cache/CacheClientStoreSelfTest.java | 4 +-
.../cache/CacheConfigurationLeakTest.java | 15 +-
.../cache/CacheDataRegionConfigurationTest.java | 172 +++
.../cache/CacheGroupsMetricsRebalanceTest.java | 6 +-
.../CacheMemoryPolicyConfigurationTest.java | 172 ---
.../CacheMetricsForClusterGroupSelfTest.java | 119 +-
.../cache/CacheRebalancingSelfTest.java | 41 +-
.../cache/CacheStopAndDestroySelfTest.java | 10 +-
.../cache/GridCacheAbstractFullApiSelfTest.java | 45 +-
.../processors/cache/GridCacheTestEntryEx.java | 2 +-
...StorageConfigurationConsistencySelfTest.java | 79 ++
...dMemoryConfigurationConsistencySelfTest.java | 79 --
...IgniteClientCacheInitializationFailTest.java | 30 +-
.../IgniteClusterActivateDeactivateTest.java | 32 +-
...erActivateDeactivateTestWithPersistence.java | 30 +-
.../IgniteMarshallerCacheFSRestoreTest.java | 71 +-
...niteTopologyValidatorGridSplitCacheTest.java | 358 ++++-
.../cache/MemoryPolicyConfigValidationTest.java | 24 +-
...AffinityCoordinatorDynamicStartStopTest.java | 15 +-
...heapCacheMetricsForClusterGroupSelfTest.java | 19 +-
.../distributed/Cache64kPartitionsTest.java | 14 +-
.../CacheLateAffinityAssignmentTest.java | 9 +-
.../cache/distributed/CacheStartOnJoinTest.java | 9 +-
.../IgniteCacheTopologySplitAbstractTest.java | 266 ++++
.../paged/PageEvictionAbstractTest.java | 25 +-
.../expiry/IgniteCacheLargeValueExpireTest.java | 6 +-
.../IgniteDataStorageMetricsSelfTest.java | 237 ++++
...tePdsBinaryMetadataOnClusterRestartTest.java | 10 +-
.../IgnitePdsCacheRebalancingAbstractTest.java | 25 +-
.../IgnitePdsClientNearCachePutGetTest.java | 6 +-
.../IgnitePdsContinuousRestartTest.java | 28 +-
.../persistence/IgnitePdsDynamicCacheTest.java | 28 +-
.../IgnitePdsExchangeDuringCheckpointTest.java | 41 +-
...MarshallerMappingRestoreOnNodeStartTest.java | 6 +-
.../IgnitePdsMultiNodePutGetRestartTest.java | 24 +-
.../persistence/IgnitePdsPageSizesTest.java | 29 +-
...gnitePdsRecoveryAfterFileCorruptionTest.java | 39 +-
.../IgnitePdsRemoveDuringRebalancingTest.java | 35 +-
...gnitePdsSingleNodePutGetPersistenceTest.java | 6 +-
.../IgnitePersistenceMetricsSelfTest.java | 225 ----
...nitePersistenceSequentialCheckpointTest.java | 6 +-
.../IgnitePersistentStoreCacheGroupsTest.java | 16 +-
...IgnitePersistentStoreDataStructuresTest.java | 23 +-
.../MemoryPolicyInitializationTest.java | 22 +-
.../db/IgnitePdsCacheRestoreTest.java | 45 +-
.../db/IgnitePdsMultiNodePutGetRestartTest.java | 23 +-
...PdsPageEvictionDuringPartitionClearTest.java | 29 +-
.../db/IgnitePdsPageEvictionTest.java | 30 +-
...tePdsRebalancingOnNotStableTopologyTest.java | 28 +-
.../db/IgnitePdsTransactionsHangTest.java | 26 +-
.../db/IgnitePdsWholeClusterRestartTest.java | 28 +-
...faultPageSizeBackwardsCompatibilityTest.java | 21 +-
.../db/file/IgnitePdsCacheIntegrationTest.java | 29 +-
...ckpointSimulationWithRealCpDisabledTest.java | 25 +-
.../db/file/IgnitePdsEvictionTest.java | 25 +-
.../file/IgnitePdsNoActualWalHistoryTest.java | 22 +-
.../file/IgnitePdsThreadInterruptionTest.java | 51 +-
.../IgniteUidAsConsistentIdMigrationTest.java | 28 +-
.../persistence/db/wal/IgnitePdsWalTlbTest.java | 30 +-
.../db/wal/IgniteWalFlushFailoverTest.java | 29 +-
.../wal/IgniteWalHistoryReservationsTest.java | 26 +-
.../db/wal/IgniteWalRecoveryPPCTest.java | 321 +++++
.../IgniteWalRecoverySeveralRestartsTest.java | 29 +-
.../db/wal/IgniteWalRecoveryTest.java | 33 +-
.../db/wal/IgniteWalSerializerVersionTest.java | 213 ++-
.../db/wal/WalRecoveryTxLogicalRecordsTest.java | 18 +-
.../db/wal/reader/IgniteWalReaderTest.java | 153 ++-
.../db/wal/reader/MockWalIteratorFactory.java | 14 +-
.../pagemem/BPlusTreePageMemoryImplTest.java | 6 +-
.../BPlusTreeReuseListPageMemoryImplTest.java | 6 +-
.../MetadataStoragePageMemoryImplTest.java | 6 +-
.../pagemem/PageMemoryImplNoLoadTest.java | 6 +-
.../persistence/pagemem/PageMemoryImplTest.java | 6 +-
.../pagemem/PagesWriteThrottleSandboxTest.java | 40 +-
.../pagemem/PagesWriteThrottleSmokeTest.java | 42 +-
.../AbstractNodeJoinTemplate.java | 8 +-
.../IgniteChangeGlobalStateAbstractTest.java | 31 +-
.../IgniteChangeGlobalStateServiceTest.java | 2 +
.../IgniteStandByClusterTest.java | 12 +-
.../extended/GridActivateExtensionTest.java | 34 +-
...gniteAbstractStandByClientReconnectTest.java | 9 +-
...niteCacheContinuousQueryBackupQueueTest.java | 6 +-
.../cache/transactions/TxDeadlockCauseTest.java | 15 +-
.../TxPessimisticDeadlockDetectionTest.java | 21 +-
.../cluster/GridUpdateNotifierSelfTest.java | 50 +-
.../processors/database/BPlusTreeSelfTest.java | 8 +-
.../database/DataRegionMetricsSelfTest.java | 348 +++++
.../database/FreeListImplSelfTest.java | 16 +-
.../database/IgniteDbAbstractTest.java | 10 +-
.../database/IgniteDbDynamicCacheSelfTest.java | 18 +-
.../IgniteDbMemoryLeakAbstractTest.java | 14 +-
.../database/MemoryMetricsSelfTest.java | 348 -----
.../database/MetadataStorageSelfTest.java | 8 +-
.../database/SwapPathConstructionSelfTest.java | 28 +-
.../processors/igfs/IgfsIgniteMock.java | 25 +-
.../processors/igfs/IgfsSizeSelfTest.java | 12 +-
.../GridServiceProcessorMultiNodeSelfTest.java | 71 +-
.../platform/PlatformCacheWriteMetricsTask.java | 10 +
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 110 ++
.../ignite/testframework/junits/IgniteMock.java | 25 +-
.../junits/multijvm/IgniteProcessProxy.java | 25 +-
.../ignite/testsuites/IgniteBasicTestSuite.java | 4 +-
.../ignite/testsuites/IgniteCacheTestSuite.java | 4 +-
.../testsuites/IgniteCacheTestSuite2.java | 4 +-
.../ignite/testsuites/IgnitePdsTestSuite2.java | 4 +-
.../query/h2/DmlStatementsProcessor.java | 188 ++-
.../internal/processors/query/h2/H2Cursor.java | 25 +-
.../processors/query/h2/H2DmlPlanKey.java | 21 +-
.../processors/query/h2/H2RowDescriptor.java | 431 ------
.../internal/processors/query/h2/H2Schema.java | 17 +-
.../processors/query/h2/H2TableDescriptor.java | 2 +-
.../processors/query/h2/H2TableEngine.java | 5 +-
.../internal/processors/query/h2/H2TypeKey.java | 64 +
.../internal/processors/query/h2/H2Utils.java | 3 +-
.../processors/query/h2/IgniteH2Indexing.java | 292 ++--
.../processors/query/h2/UpdateResult.java | 63 +
.../query/h2/database/H2PkHashIndex.java | 26 +-
.../query/h2/database/H2RowFactory.java | 8 +-
.../processors/query/h2/database/H2Tree.java | 17 +-
.../query/h2/database/H2TreeIndex.java | 6 +-
.../query/h2/database/io/H2ExtrasInnerIO.java | 4 +-
.../query/h2/database/io/H2ExtrasLeafIO.java | 4 +-
.../query/h2/database/io/H2InnerIO.java | 4 +-
.../query/h2/database/io/H2LeafIO.java | 4 +-
.../query/h2/ddl/DdlStatementsProcessor.java | 38 +-
.../processors/query/h2/dml/UpdatePlan.java | 64 +-
.../query/h2/dml/UpdatePlanBuilder.java | 117 +-
.../query/h2/opt/GridH2IndexBase.java | 83 +-
.../query/h2/opt/GridH2KeyRowOnheap.java | 63 +
.../query/h2/opt/GridH2KeyValueRowOnheap.java | 197 +--
.../query/h2/opt/GridH2MetaTable.java | 13 +-
.../query/h2/opt/GridH2PlainRowFactory.java | 181 +++
.../processors/query/h2/opt/GridH2Row.java | 121 +-
.../query/h2/opt/GridH2RowDescriptor.java | 410 +++++-
.../query/h2/opt/GridH2RowFactory.java | 194 ---
.../query/h2/opt/GridH2SearchRowAdapter.java | 103 ++
.../processors/query/h2/opt/GridH2Table.java | 108 +-
.../query/h2/opt/GridLuceneIndex.java | 25 +-
.../query/h2/sql/GridSqlCreateTable.java | 51 +
.../query/h2/sql/GridSqlQueryParser.java | 70 +-
.../query/h2/sql/GridSqlQuerySplitter.java | 33 +
.../query/h2/twostep/DistributedUpdateRun.java | 133 ++
.../query/h2/twostep/GridMapQueryExecutor.java | 136 ++
.../query/h2/twostep/GridMergeIndexSorted.java | 4 +-
.../h2/twostep/GridMergeIndexUnsorted.java | 4 +-
.../h2/twostep/GridReduceQueryExecutor.java | 294 ++++-
.../query/h2/twostep/MapNodeResults.java | 33 +
.../query/h2/twostep/msg/GridH2DmlRequest.java | 516 ++++++++
.../query/h2/twostep/msg/GridH2DmlResponse.java | 250 ++++
.../twostep/msg/GridH2ValueMessageFactory.java | 6 +
.../cache/IgniteCacheAbstractQuerySelfTest.java | 13 +-
...ributedJoinPartitionedAndReplicatedTest.java | 2 +
...leNodeWithIndexingPutGetPersistenceTest.java | 6 +-
...stributedPartitionQueryAbstractSelfTest.java | 8 +-
.../IgniteCacheQueryNodeRestartSelfTest2.java | 8 +-
...ynamicColumnsAbstractConcurrentSelfTest.java | 57 +-
.../cache/index/DynamicColumnsAbstractTest.java | 16 +-
...umnsConcurrentAtomicPartitionedSelfTest.java | 2 +-
...lumnsConcurrentAtomicReplicatedSelfTest.java | 2 +-
...currentTransactionalPartitionedSelfTest.java | 2 +-
...ncurrentTransactionalReplicatedSelfTest.java | 5 +-
.../index/DynamicIndexAbstractSelfTest.java | 16 +-
.../H2DynamicColumnsAbstractBasicSelfTest.java | 43 +
.../cache/index/H2DynamicTableSelfTest.java | 407 +++++-
.../cache/index/LongIndexNameTest.java | 4 +-
...eDbSingleNodeWithIndexingWalRestoreTest.java | 11 +-
...oreQueryWithMultipleClassesPerCacheTest.java | 8 +-
.../IgnitePersistentStoreSchemaLoadTest.java | 15 +-
.../query/IgniteSqlNotNullConstraintTest.java | 6 +-
...teSqlSkipReducerOnUpdateDmlFlagSelfTest.java | 800 +++++++++++
...IgniteSqlSkipReducerOnUpdateDmlSelfTest.java | 755 +++++++++++
.../h2/GridIndexingSpiAbstractSelfTest.java | 47 +-
.../h2/database/InlineIndexHelperTest.java | 20 +-
.../query/h2/opt/GridH2TableSelfTest.java | 369 ------
.../IgniteCacheQuerySelfTestSuite.java | 21 +
.../IgniteCacheQuerySelfTestSuite2.java | 6 +
.../IgniteCacheQuerySelfTestSuite3.java | 3 -
.../IgniteDistributedJoinTestSuite.java | 55 -
.../IgnitePdsWithIndexingCoreTestSuite.java | 3 +
.../ignite/logger/log4j2/Log4J2Logger.java | 130 +-
.../log4j2/GridLog4j2CorrectFileNameTest.java | 94 --
.../log4j2/GridLog4j2InitializedTest.java | 77 --
.../log4j2/GridLog4j2LoggingFileTest.java | 68 -
.../logger/log4j2/Log4j2LoggerSelfTest.java | 7 +
.../log4j2/Log4j2LoggerVerboseModeSelfTest.java | 71 +-
.../testsuites/IgniteLog4j2TestSuite.java | 2 +
.../cpp/odbc-test/src/configuration_test.cpp | 25 +-
.../cpp/odbc-test/src/queries_test.cpp | 8 +
.../include/ignite/odbc/config/configuration.h | 26 +
.../cpp/odbc/include/ignite/odbc/message.h | 6 +-
.../odbc/include/ignite/odbc/protocol_version.h | 1 +
.../odbc/system/ui/dsn_configuration_window.h | 4 +
.../src/system/ui/dsn_configuration_window.cpp | 20 +
.../cpp/odbc/src/config/configuration.cpp | 50 +-
modules/platforms/cpp/odbc/src/connection.cpp | 5 +-
modules/platforms/cpp/odbc/src/dsn_config.cpp | 4 +
modules/platforms/cpp/odbc/src/message.cpp | 12 +-
.../platforms/cpp/odbc/src/protocol_version.cpp | 6 +-
.../Apache.Ignite.Core.Tests.csproj | 14 +-
.../ApiParity/CacheConfigurationParityTest.cs | 88 ++
.../ClientConnectorConfigurationParityTest.cs | 39 +
.../DataRegionConfigurationParityTest.cs | 39 +
.../DataStorageConfigurationParityTest.cs | 53 +
.../ApiParity/IgniteConfigurationParityTest.cs | 98 ++
.../ApiParity/ParityTest.cs | 135 ++
.../QueryEntityConfigurationParityTest.cs | 49 +
.../BasicSerializableObjectsTest.cs | 3 +-
.../Serializable/GenericCollectionsTest.cs | 112 ++
.../Cache/CacheConfigurationTest.cs | 6 +
.../Cache/DataRegionMetricsTest.cs | 153 +++
.../Cache/DataStorageMetricsTest.cs | 107 ++
.../Cache/MemoryMetricsTest.cs | 1 +
.../Cache/PersistenceTest.cs | 235 ++++
.../Cache/PersistentStoreTest.cs | 189 ---
.../Cache/PersistentStoreTestObsolete.cs | 190 +++
.../Cache/Query/CacheDmlQueriesTest.cs | 4 +-
.../Cache/Query/Linq/CacheLinqTest.Strings.cs | 23 +
.../Client/Cache/CacheTest.cs | 687 +++++++++-
.../Client/Cache/CacheTestNoMeta.cs | 4 +-
.../Client/Cache/EmptyObject.cs | 54 +
.../Client/ClientTestBase.cs | 9 +
.../Config/full-config.xml | 18 +
.../Config/spring-test.xml | 18 +-
.../Apache.Ignite.Core.Tests/DeploymentTest.cs | 33 +-
.../Examples/Example.cs | 6 +-
.../Examples/ExamplesTest.cs | 42 +-
.../IgniteConfigurationSerializerTest.cs | 135 +-
.../IgniteConfigurationTest.cs | 232 ++--
.../IgniteManagerTest.cs | 10 +-
.../Apache.Ignite.Core.csproj | 11 +-
.../Cache/Configuration/CacheConfiguration.cs | 21 +-
.../Cache/Configuration/DataPageEvictionMode.cs | 3 +
.../Cache/Configuration/MemoryConfiguration.cs | 5 +
.../Configuration/MemoryPolicyConfiguration.cs | 3 +
.../Apache.Ignite.Core/Cache/IMemoryMetrics.cs | 4 +
.../Client/Cache/ICacheClient.cs | 155 +++
.../Client/IgniteClientException.cs | 8 +
.../Configuration/CheckpointWriteOrder.cs | 37 +
.../Configuration/DataPageEvictionMode.cs | 59 +
.../Configuration/DataRegionConfiguration.cs | 213 +++
.../Configuration/DataStorageConfiguration.cs | 466 +++++++
.../Apache.Ignite.Core/Configuration/WalMode.cs | 45 +
.../Apache.Ignite.Core/IDataRegionMetrics.cs | 55 +
.../Apache.Ignite.Core/IDataStorageMetrics.cs | 87 ++
.../dotnet/Apache.Ignite.Core/IIgnite.cs | 33 +
.../Apache.Ignite.Core/IgniteConfiguration.cs | 41 +-
.../IgniteConfigurationSection.xsd | 273 +++-
.../Impl/Binary/BinaryFullTypeDescriptor.cs | 19 +-
.../Binary/BinarySurrogateTypeDescriptor.cs | 8 +-
.../Impl/Binary/BinarySystemHandlers.cs | 16 +-
.../Impl/Binary/BinaryWriter.cs | 7 +
.../Impl/Binary/IBinaryTypeDescriptor.cs | 6 +-
.../Impl/Binary/Io/BinaryHeapStream.cs | 1018 +++++++++++++-
.../Impl/Binary/Io/BinaryStreamBase.cs | 1249 ------------------
.../Impl/Binary/SerializableSerializer.cs | 11 +-
.../Impl/Binary/Structure/BinaryStructure.cs | 147 +--
.../Binary/Structure/BinaryStructureTracker.cs | 16 +-
.../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs | 24 +-
.../Impl/Cache/MemoryMetrics.cs | 2 +
.../Impl/Client/Cache/CacheClient.cs | 260 +++-
.../Apache.Ignite.Core/Impl/Client/ClientOp.cs | 21 +-
.../Impl/Cluster/ClusterGroupImpl.cs | 53 +
.../Common/IgniteConfigurationXmlSerializer.cs | 11 +-
.../Impl/DataRegionMetrics.cs | 61 +
.../Impl/DataStorageMetrics.cs | 87 ++
.../dotnet/Apache.Ignite.Core/Impl/Ignite.cs | 22 +
.../Apache.Ignite.Core/Impl/IgniteUtils.cs | 21 +
.../PersistentStore/PersistentStoreMetrics.cs | 2 +
.../PersistentStore/CheckpointWriteOrder.cs | 3 +
.../PersistentStore/IPersistentStoreMetrics.cs | 2 +
.../PersistentStoreConfiguration.cs | 4 +
.../PersistentStore/WalMode.cs | 3 +
.../Impl/CacheQueryExpressionVisitor.cs | 5 +
.../Apache.Ignite.Linq/Impl/MethodVisitor.cs | 59 +-
.../Apache.Ignite.Examples.csproj | 2 +
.../examples/Apache.Ignite.Examples/App.config | 4 +
.../ThinClient/ThinClientPutGetExample.cs | 93 ++
.../ThinClient/ThinClientQueryExample.cs | 147 +++
.../http/jetty/GridJettyObjectMapper.java | 3 +
.../org/apache/ignite/IgniteSpringBean.java | 27 +-
modules/sqlline/bin/sqlline.bat | 112 ++
modules/sqlline/bin/sqlline.sh | 54 +
modules/sqlline/pom.xml | 83 ++
.../top/VisorActivationCommandSpec.scala | 13 +-
modules/web-console/DEVNOTES.txt | 6 +
modules/web-console/backend/app/agentSocket.js | 21 +-
.../web-console/backend/app/browsersHandler.js | 9 +-
modules/web-console/backend/app/mongo.js | 56 +
.../ignite_modules/migrations/README.txt | 4 +
modules/web-console/backend/index.js | 53 +-
.../web-console/backend/migrations/README.txt | 4 +
modules/web-console/backend/package.json | 5 +-
modules/web-console/frontend/.eslintrc | 2 +-
modules/web-console/frontend/app/app.js | 3 +
.../app/components/list-editable/component.js | 36 +
.../list-editable-cols/cols.directive.js | 79 ++
.../list-editable-cols/cols.style.scss | 51 +
.../list-editable-cols/cols.template.pug | 29 +
.../components/list-editable-cols/index.js | 28 +
.../list-editable-cols/row.directive.js | 40 +
.../app/components/list-editable/controller.js | 79 ++
.../app/components/list-editable/index.js | 27 +
.../app/components/list-editable/style.scss | 132 ++
.../app/components/list-editable/template.pug | 49 +
.../page-configure-basic/controller.js | 10 +-
.../helpers/jade/form/form-field-dropdown.pug | 2 +-
.../frontend/app/helpers/jade/mixins.pug | 9 +-
.../app/modules/agent/AgentManager.service.js | 25 +-
.../app/modules/agent/decompress.worker.js | 34 +
.../generator/AbstractTransformer.js | 5 +
.../generator/ConfigurationGenerator.js | 114 +-
.../generator/defaults/Cluster.service.js | 40 +
.../frontend/app/modules/sql/sql.controller.js | 50 +-
.../states/configuration/caches/store.pug | 4 +-
.../configuration/clusters/attributes.pug | 4 +-
.../clusters/collision/job-stealing.pug | 4 +-
.../configuration/clusters/data-storage.pug | 255 ++++
.../states/configuration/clusters/memory.pug | 4 +-
.../configuration/clusters/persistence.pug | 4 +-
.../states/configuration/domains/general.pug | 2 +-
.../states/configuration/domains/query.pug | 8 +-
.../app/primitives/form-field/index.scss | 15 +
.../frontend/app/primitives/ui-grid/index.scss | 4 +
.../frontend/app/services/Clusters.js | 6 +
.../frontend/app/services/JavaTypes.service.js | 15 +
.../app/services/LegacyUtils.service.js | 16 +-
.../frontend/app/services/Version.service.js | 6 +-
.../frontend/app/utils/SimpleWorkerPool.js | 119 ++
.../frontend/controllers/clusters-controller.js | 69 +-
.../frontend/controllers/domains-controller.js | 7 +-
modules/web-console/frontend/package.json | 10 +-
.../frontend/public/images/icons/index.js | 2 +
.../frontend/public/images/icons/info.svg | 3 +
.../frontend/public/images/icons/sort.svg | 1 +
.../frontend/public/stylesheets/style.scss | 8 +
modules/web-console/frontend/tsconfig.json | 12 +
.../views/configuration/clusters.tpl.pug | 8 +-
.../web-console/frontend/views/sql/sql.tpl.pug | 24 +-
.../agent/handlers/AbstractListener.java | 6 +-
.../yardstick/IgniteBenchmarkArguments.java | 8 +-
.../org/apache/ignite/yardstick/IgniteNode.java | 15 +-
parent/pom.xml | 4 +
pom.xml | 17 +
608 files changed, 26994 insertions(+), 9761 deletions(-)
----------------------------------------------------------------------
[22/50] [abbrv] ignite git commit: IGNITE-6030 Allow enabling
persistence per data region
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/pagemem/impl/PageMemoryNoStoreImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/impl/PageMemoryNoStoreImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/impl/PageMemoryNoStoreImpl.java
index 8f146dc..6ba68c2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/impl/PageMemoryNoStoreImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/impl/PageMemoryNoStoreImpl.java
@@ -27,14 +27,14 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.IgniteSystemProperties;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.mem.DirectMemoryProvider;
import org.apache.ignite.internal.mem.DirectMemoryRegion;
import org.apache.ignite.internal.mem.IgniteOutOfMemoryException;
import org.apache.ignite.internal.pagemem.PageIdUtils;
import org.apache.ignite.internal.pagemem.PageMemory;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryMetricsImpl;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO;
import org.apache.ignite.internal.util.GridUnsafe;
import org.apache.ignite.internal.util.IgniteUtils;
@@ -125,11 +125,11 @@ public class PageMemoryNoStoreImpl implements PageMemory {
/** Direct memory allocator. */
private final DirectMemoryProvider directMemoryProvider;
- /** Name of MemoryPolicy this PageMemory is associated with. */
- private final MemoryPolicyConfiguration memoryPolicyCfg;
+ /** Name of DataRegion this PageMemory is associated with. */
+ private final DataRegionConfiguration dataRegionCfg;
/** Object to collect memory usage metrics. */
- private final MemoryMetricsImpl memMetrics;
+ private final DataRegionMetricsImpl memMetrics;
/** */
private AtomicLong freePageListHead = new AtomicLong(INVALID_REL_PTR);
@@ -163,7 +163,7 @@ public class PageMemoryNoStoreImpl implements PageMemory {
* @param directMemoryProvider Memory allocator to use.
* @param sharedCtx Cache shared context.
* @param pageSize Page size.
- * @param memPlcCfg Memory Policy configuration.
+ * @param dataRegionCfg Data region configuration.
* @param memMetrics Memory Metrics.
* @param trackAcquiredPages If {@code true} tracks number of allocated pages (for tests purpose only).
*/
@@ -172,8 +172,8 @@ public class PageMemoryNoStoreImpl implements PageMemory {
DirectMemoryProvider directMemoryProvider,
GridCacheSharedContext<?, ?> sharedCtx,
int pageSize,
- MemoryPolicyConfiguration memPlcCfg,
- MemoryMetricsImpl memMetrics,
+ DataRegionConfiguration dataRegionCfg,
+ DataRegionMetricsImpl memMetrics,
boolean trackAcquiredPages
) {
assert log != null || sharedCtx != null;
@@ -183,21 +183,21 @@ public class PageMemoryNoStoreImpl implements PageMemory {
this.directMemoryProvider = directMemoryProvider;
this.trackAcquiredPages = trackAcquiredPages;
this.memMetrics = memMetrics;
- memoryPolicyCfg = memPlcCfg;
+ this.dataRegionCfg = dataRegionCfg;
sysPageSize = pageSize + PAGE_OVERHEAD;
assert sysPageSize % 8 == 0 : sysPageSize;
- totalPages = (int)(memPlcCfg.getMaxSize() / sysPageSize);
+ totalPages = (int)(dataRegionCfg.getMaxSize() / sysPageSize);
rwLock = new OffheapReadWriteLock(lockConcLvl);
}
/** {@inheritDoc} */
@Override public void start() throws IgniteException {
- long startSize = memoryPolicyCfg.getInitialSize();
- long maxSize = memoryPolicyCfg.getMaxSize();
+ long startSize = dataRegionCfg.getInitialSize();
+ long maxSize = dataRegionCfg.getMaxSize();
long[] chunks = new long[SEG_CNT];
@@ -290,9 +290,9 @@ public class PageMemoryNoStoreImpl implements PageMemory {
if (relPtr == INVALID_REL_PTR)
throw new IgniteOutOfMemoryException("Not enough memory allocated " +
- "(consider increasing memory policy size or enabling evictions) " +
- "[policyName=" + memoryPolicyCfg.getName() +
- ", size=" + U.readableSize(memoryPolicyCfg.getMaxSize(), true) + "]"
+ "(consider increasing data region size or enabling evictions) " +
+ "[policyName=" + dataRegionCfg.getName() +
+ ", size=" + U.readableSize(dataRegionCfg.getMaxSize(), true) + "]"
);
assert (relPtr & ~PageIdUtils.PAGE_IDX_MASK) == 0 : U.hexLong(relPtr & ~PageIdUtils.PAGE_IDX_MASK);
@@ -615,7 +615,7 @@ public class PageMemoryNoStoreImpl implements PageMemory {
if (oldRef != null) {
if (log.isInfoEnabled())
- log.info("Allocated next memory segment [plcName=" + memoryPolicyCfg.getName() +
+ log.info("Allocated next memory segment [plcName=" + dataRegionCfg.getName() +
", chunkSize=" + U.readableSize(region.size(), true) + ']');
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
index a413ade..eaaa24d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
@@ -2592,7 +2592,9 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
* @param sql SQL flag.
*/
private void saveCacheConfiguration(CacheConfiguration<?, ?> cfg, boolean sql) {
- if (cctx.pageStore() != null && cctx.database().persistenceEnabled() && !cctx.kernalContext().clientNode()) {
+ if (cctx.pageStore() != null && cctx.database().persistenceEnabled() &&
+ CU.isPersistentCache(cfg, cctx.gridConfig().getDataStorageConfiguration()) &&
+ !cctx.kernalContext().clientNode()) {
try {
StoredCacheData data = new StoredCacheData(cfg);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
index 5e5e02e..18acacf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
@@ -42,8 +42,8 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAffini
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopologyImpl;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegion;
import org.apache.ignite.internal.processors.cache.persistence.GridCacheOffheapManager;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryPolicy;
import org.apache.ignite.internal.processors.cache.persistence.freelist.FreeList;
import org.apache.ignite.internal.processors.cache.persistence.tree.reuse.ReuseList;
import org.apache.ignite.internal.processors.cache.query.continuous.CounterSkipContext;
@@ -126,7 +126,7 @@ public class CacheGroupContext {
private GridCachePreloader preldr;
/** */
- private final MemoryPolicy memPlc;
+ private final DataRegion dataRegion;
/** */
private final CacheObjectContext cacheObjCtx;
@@ -150,7 +150,7 @@ public class CacheGroupContext {
* @param cacheType Cache type.
* @param ccfg Cache configuration.
* @param affNode Affinity node flag.
- * @param memPlc Memory policy.
+ * @param dataRegion data region.
* @param cacheObjCtx Cache object context.
* @param freeList Free list.
* @param reuseList Reuse list.
@@ -163,13 +163,13 @@ public class CacheGroupContext {
CacheType cacheType,
CacheConfiguration ccfg,
boolean affNode,
- MemoryPolicy memPlc,
+ DataRegion dataRegion,
CacheObjectContext cacheObjCtx,
FreeList freeList,
ReuseList reuseList,
AffinityTopologyVersion locStartVer) {
assert ccfg != null;
- assert memPlc != null || !affNode;
+ assert dataRegion != null || !affNode;
assert grpId != 0 : "Invalid group ID [cache=" + ccfg.getName() + ", grpName=" + ccfg.getGroupName() + ']';
this.grpId = grpId;
@@ -177,7 +177,7 @@ public class CacheGroupContext {
this.ctx = ctx;
this.ccfg = ccfg;
this.affNode = affNode;
- this.memPlc = memPlc;
+ this.dataRegion = dataRegion;
this.cacheObjCtx = cacheObjCtx;
this.freeList = freeList;
this.reuseList = reuseList;
@@ -188,7 +188,7 @@ public class CacheGroupContext {
depEnabled = ctx.kernalContext().deploy().enabled() && !ctx.kernalContext().cacheObjects().isBinaryEnabled(ccfg);
- storeCacheId = affNode && memPlc.config().getPageEvictionMode() != DataPageEvictionMode.DISABLED;
+ storeCacheId = affNode && dataRegion.config().getPageEvictionMode() != DataPageEvictionMode.DISABLED;
log = ctx.kernalContext().log(getClass());
@@ -523,10 +523,10 @@ public class CacheGroupContext {
}
/**
- * @return Memory policy.
+ * @return data region.
*/
- public MemoryPolicy memoryPolicy() {
- return memPlc;
+ public DataRegion dataRegion() {
+ return dataRegion;
}
/**
@@ -862,7 +862,7 @@ public class CacheGroupContext {
else
preldr = new GridCachePreloaderAdapter(this);
- if (ctx.kernalContext().config().getPersistentStoreConfiguration() != null) {
+ if (persistenceEnabled()) {
try {
offheapMgr = new GridCacheOffheapManager();
}
@@ -879,6 +879,13 @@ public class CacheGroupContext {
}
/**
+ * @return Persistence enabled flag.
+ */
+ public boolean persistenceEnabled() {
+ return dataRegion != null && dataRegion.config().isPersistenceEnabled();
+ }
+
+ /**
* @param nodeId Node ID.
* @param req Request.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupData.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupData.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupData.java
index 99b7b1e..617db56 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupData.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupData.java
@@ -59,14 +59,18 @@ public class CacheGroupData implements Serializable {
/** */
private long flags;
+ /** Persistence enabled flag. */
+ private final boolean persistenceEnabled;
+
/**
* @param cacheCfg Cache configuration.
* @param grpName Group name.
- * @param grpId Group ID.
+ * @param grpId Group ID.
* @param rcvdFrom Node ID cache group received from.
* @param startTopVer Start version for dynamically started group.
* @param deploymentId Deployment ID.
* @param caches Cache group caches.
+ * @param persistenceEnabled Persistence enabled flag.
*/
CacheGroupData(
CacheConfiguration cacheCfg,
@@ -76,7 +80,8 @@ public class CacheGroupData implements Serializable {
@Nullable AffinityTopologyVersion startTopVer,
IgniteUuid deploymentId,
Map<String, Integer> caches,
- long flags) {
+ long flags,
+ boolean persistenceEnabled) {
assert cacheCfg != null;
assert grpId != 0 : cacheCfg.getName();
assert deploymentId != null : cacheCfg.getName();
@@ -89,6 +94,7 @@ public class CacheGroupData implements Serializable {
this.deploymentId = deploymentId;
this.caches = caches;
this.flags = flags;
+ this.persistenceEnabled = persistenceEnabled;
}
/**
@@ -140,6 +146,13 @@ public class CacheGroupData implements Serializable {
return caches;
}
+ /**
+ * @return Persistence enabled flag.
+ */
+ public boolean persistenceEnabled() {
+ return persistenceEnabled;
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(CacheGroupData.class, this);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupDescriptor.java
index 20301a6..86e330e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupDescriptor.java
@@ -58,14 +58,18 @@ public class CacheGroupDescriptor {
/** */
private AffinityTopologyVersion rcvdFromVer;
+ /** Persistence enabled flag. */
+ private final boolean persistenceEnabled;
+
/**
* @param cacheCfg Cache configuration.
* @param grpName Group name.
- * @param grpId Group ID.
+ * @param grpId Group ID.
* @param rcvdFrom Node ID cache group received from.
* @param startTopVer Start version for dynamically started group.
* @param deploymentId Deployment ID.
* @param caches Cache group caches.
+ * @param persistenceEnabled Persistence enabled flag.
*/
CacheGroupDescriptor(
CacheConfiguration cacheCfg,
@@ -74,7 +78,8 @@ public class CacheGroupDescriptor {
UUID rcvdFrom,
@Nullable AffinityTopologyVersion startTopVer,
IgniteUuid deploymentId,
- Map<String, Integer> caches) {
+ Map<String, Integer> caches,
+ boolean persistenceEnabled) {
assert cacheCfg != null;
assert grpId != 0;
@@ -85,6 +90,7 @@ public class CacheGroupDescriptor {
this.deploymentId = deploymentId;
this.cacheCfg = new CacheConfiguration<>(cacheCfg);
this.caches = caches;
+ this.persistenceEnabled = persistenceEnabled;
}
/**
@@ -202,7 +208,7 @@ public class CacheGroupDescriptor {
* @param otherDesc CacheGroup descriptor that must be merged with this one.
*/
void mergeWith(CacheGroupDescriptor otherDesc) {
- assert otherDesc != null && otherDesc.config() != null: otherDesc;
+ assert otherDesc != null && otherDesc.config() != null : otherDesc;
CacheConfiguration otherCfg = otherDesc.config();
@@ -221,6 +227,13 @@ public class CacheGroupDescriptor {
return startTopVer;
}
+ /**
+ * @return Persistence enabled flag.
+ */
+ public boolean persistenceEnabled() {
+ return persistenceEnabled;
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(CacheGroupDescriptor.class, this, "cacheName", cacheCfg.getName());
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
index b4cc9c5..8382821 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
@@ -912,7 +912,8 @@ class ClusterCachesInfo {
grpDesc.startTopologyVersion(),
grpDesc.deploymentId(),
grpDesc.caches(),
- 0);
+ 0,
+ grpDesc.persistenceEnabled());
cacheGrps.put(grpDesc.groupId(), grpData);
}
@@ -990,7 +991,8 @@ class ClusterCachesInfo {
grpData.receivedFrom(),
grpData.startTopologyVersion(),
grpData.deploymentId(),
- grpData.caches());
+ grpData.caches(),
+ grpData.persistenceEnabled());
if (locCacheGrps.containsKey(grpDesc.groupId())) {
CacheGroupDescriptor locGrpCfg = locCacheGrps.get(grpDesc.groupId());
@@ -1508,7 +1510,8 @@ class ClusterCachesInfo {
rcvdFrom,
curTopVer != null ? curTopVer.nextMinorVersion() : null,
deploymentId,
- caches);
+ caches,
+ CU.isPersistentCache(startedCacheCfg, ctx.config().getDataStorageConfiguration()));
CacheGroupDescriptor old = registeredCacheGrps.put(grpId, grpDesc);
@@ -1560,8 +1563,8 @@ class ClusterCachesInfo {
CU.validateCacheGroupsAttributesMismatch(log, cfg, startCfg, "nodeFilter", "Node filter",
attr1.nodeFilterClassName(), attr2.nodeFilterClassName(), true);
- CU.validateCacheGroupsAttributesMismatch(log, cfg, startCfg, "memoryPolicyName", "Memory policy",
- cfg.getMemoryPolicyName(), startCfg.getMemoryPolicyName(), true);
+ CU.validateCacheGroupsAttributesMismatch(log, cfg, startCfg, "dataRegionName", "Data region",
+ cfg.getDataRegionName(), startCfg.getDataRegionName(), true);
CU.validateCacheGroupsAttributesMismatch(log, cfg, startCfg, "topologyValidator", "Topology validator",
attr1.topologyValidatorClassName(), attr2.topologyValidatorClassName(), true);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 8c5d6f2..9bdce35 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -58,7 +58,6 @@ import org.apache.ignite.cache.CacheMetrics;
import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.cache.affinity.Affinity;
import org.apache.ignite.cluster.ClusterGroup;
-import org.apache.ignite.cluster.ClusterGroupEmptyException;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.cluster.ClusterTopologyException;
import org.apache.ignite.compute.ComputeJob;
@@ -2035,7 +2034,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
GridCacheEntryEx entry = null;
try {
- ctx.shared().database().ensureFreeSpace(ctx.memoryPolicy());
+ ctx.shared().database().ensureFreeSpace(ctx.dataRegion());
entry = entryEx(key);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
index 120007f..34d3c97 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
@@ -71,7 +71,7 @@ import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTran
import org.apache.ignite.internal.processors.cache.dr.GridCacheDrManager;
import org.apache.ignite.internal.processors.cache.jta.CacheJtaManagerAdapter;
import org.apache.ignite.internal.processors.cache.local.GridLocalCache;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryPolicy;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegion;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager;
import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryManager;
import org.apache.ignite.internal.processors.cache.store.CacheStoreManager;
@@ -736,10 +736,10 @@ public class GridCacheContext<K, V> implements Externalizable {
}
/**
- * @return Memory policy.
+ * @return Data region.
*/
- public MemoryPolicy memoryPolicy() {
- return grp.memoryPolicy();
+ public DataRegion dataRegion() {
+ return grp.dataRegion();
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index 5c3fe1f..e46e4d2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -48,7 +48,7 @@ import org.apache.ignite.internal.processors.cache.extras.GridCacheObsoleteEntry
import org.apache.ignite.internal.processors.cache.extras.GridCacheTtlEntryExtras;
import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
import org.apache.ignite.internal.processors.cache.persistence.CacheDataRowAdapter;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryPolicy;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegion;
import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryListener;
import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry;
@@ -2543,7 +2543,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
boolean update;
- boolean walEnabled = !cctx.isNear() && cctx.shared().wal() != null;
+ boolean walEnabled = !cctx.isNear() && cctx.group().persistenceEnabled();
if (cctx.shared().database().persistenceEnabled()) {
unswap(false);
@@ -3204,7 +3204,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
assert cctx.atomic();
try {
- if (cctx.shared().wal() != null)
+ if (cctx.group().persistenceEnabled())
cctx.shared().wal().log(new DataRecord(new DataEntry(
cctx.cacheId(),
key,
@@ -3326,13 +3326,13 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
}
/**
- * Evicts necessary number of data pages if per-page eviction is configured in current {@link MemoryPolicy}.
+ * Evicts necessary number of data pages if per-page eviction is configured in current {@link DataRegion}.
*/
private void ensureFreeSpace() throws IgniteCheckedException {
// Deadlock alert: evicting data page causes removing (and locking) all entries on the page one by one.
assert !Thread.holdsLock(this);
- cctx.shared().database().ensureFreeSpace(cctx.memoryPolicy());
+ cctx.shared().database().ensureFreeSpace(cctx.dataRegion());
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index f3759e0..ad8f74a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -49,6 +49,7 @@ import org.apache.ignite.cache.store.CacheStore;
import org.apache.ignite.cache.store.CacheStoreSessionListener;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.DeploymentMode;
import org.apache.ignite.configuration.FileSystemConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
@@ -88,7 +89,7 @@ import org.apache.ignite.internal.processors.cache.local.GridLocalCache;
import org.apache.ignite.internal.processors.cache.local.atomic.GridLocalAtomicCache;
import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager;
import org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryPolicy;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegion;
import org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager;
import org.apache.ignite.internal.processors.cache.persistence.freelist.FreeList;
import org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteCacheSnapshotManager;
@@ -139,6 +140,7 @@ import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.lifecycle.LifecycleAware;
import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.marshaller.MarshallerUtils;
+import org.apache.ignite.marshaller.jdk.JdkMarshaller;
import org.apache.ignite.mxbean.IgniteMBeanAware;
import org.apache.ignite.spi.IgniteNodeValidationResult;
import org.apache.ignite.spi.discovery.DiscoveryDataBag;
@@ -350,7 +352,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
* @return {@code true} if cache is starting on client node and this node is affinity node for the cache.
*/
private boolean storesLocallyOnClient(IgniteConfiguration c, CacheConfiguration cc) {
- if (c.isClientMode() && c.getMemoryConfiguration() == null) {
+ if (c.isClientMode() && c.getDataStorageConfiguration() == null) {
if (cc.getCacheMode() == LOCAL)
return true;
@@ -385,8 +387,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
if (storesLocallyOnClient(c, cc))
- throw new IgniteCheckedException("MemoryPolicy for client caches must be explicitly configured " +
- "on client node startup. Use MemoryConfiguration to configure MemoryPolicy.");
+ throw new IgniteCheckedException("DataRegion for client caches must be explicitly configured " +
+ "on client node startup. Use DataStorageConfiguration to configure DataRegion.");
if (cc.getCacheMode() == LOCAL && !cc.getAffinity().getClass().equals(LocalAffinityFunction.class))
U.warn(log, "AffinityFunction configuration parameter will be ignored for local cache [cacheName=" +
@@ -679,8 +681,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
CacheType cacheType = cacheType(cacheName);
- if (cacheType != CacheType.USER && cfg.getMemoryPolicyName() == null)
- cfg.setMemoryPolicyName(sharedCtx.database().systemMemoryPolicyName());
+ if (cacheType != CacheType.USER && cfg.getDataRegionName() == null)
+ cfg.setDataRegionName(sharedCtx.database().systemDateRegionName());
if (!cacheType.userCache())
stopSeq.addLast(cacheName);
@@ -1112,12 +1114,10 @@ public class GridCacheProcessor extends GridProcessorAdapter {
cacheCtx.onStarted();
- String memPlcName = cfg.getMemoryPolicyName();
-
- if (memPlcName == null
- && ctx.config().getMemoryConfiguration() != null)
- memPlcName = ctx.config().getMemoryConfiguration().getDefaultMemoryPolicyName();
+ String memPlcName = cfg.getDataRegionName();
+ if (memPlcName == null && ctx.config().getDataStorageConfiguration() != null)
+ memPlcName = ctx.config().getDataStorageConfiguration().getDefaultDataRegionConfiguration().getName();
if (log.isInfoEnabled()) {
log.info("Started cache [name=" + cfg.getName() +
@@ -1841,9 +1841,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
throws IgniteCheckedException {
CacheConfiguration cfg = new CacheConfiguration(desc.config());
- String memPlcName = cfg.getMemoryPolicyName();
+ String memPlcName = cfg.getDataRegionName();
- MemoryPolicy memPlc = sharedCtx.database().memoryPolicy(memPlcName);
+ DataRegion memPlc = sharedCtx.database().dataRegion(memPlcName);
FreeList freeList = sharedCtx.database().freeList(memPlcName);
ReuseList reuseList = sharedCtx.database().reuseList(memPlcName);
@@ -2188,7 +2188,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
IgnitePageStoreManager pageStoreMgr = null;
IgniteWriteAheadLogManager walMgr = null;
- if (ctx.config().isPersistentStoreEnabled() && !ctx.clientNode()) {
+ if (CU.isPersistenceEnabled(ctx.config()) && !ctx.clientNode()) {
if (ctx.clientNode()) {
U.warn(log, "Persistent Store is not supported on client nodes (Persistent Store's" +
" configuration will be ignored).");
@@ -3062,15 +3062,32 @@ public class GridCacheProcessor extends GridProcessorAdapter {
if (ctx.config().isClientMode() || locNode.isDaemon() || rmt.isClient() || rmt.isDaemon())
return;
- MemoryConfiguration memCfg = rmt.attribute(IgniteNodeAttributes.ATTR_MEMORY_CONFIG);
+ DataStorageConfiguration dsCfg = null;
+
+ Object dsCfgBytes = rmt.attribute(IgniteNodeAttributes.ATTR_DATA_STORAGE_CONFIG);
+
+ if (dsCfgBytes instanceof byte[])
+ dsCfg = new JdkMarshaller().unmarshal((byte[])dsCfgBytes, U.resolveClassLoader(ctx.config()));
+
+ if (dsCfg == null) {
+ // Try to use legacy memory configuration.
+ MemoryConfiguration memCfg = rmt.attribute(IgniteNodeAttributes.ATTR_MEMORY_CONFIG);
+
+ if (memCfg != null) {
+ dsCfg = new DataStorageConfiguration();
+
+ // All properties that are used in validation should be converted here.
+ dsCfg.setPageSize(memCfg.getPageSize());
+ }
+ }
- if (memCfg != null) {
- MemoryConfiguration locMemCfg = ctx.config().getMemoryConfiguration();
+ if (dsCfg != null) {
+ DataStorageConfiguration locDsCfg = ctx.config().getDataStorageConfiguration();
- if (memCfg.getPageSize() != locMemCfg.getPageSize()) {
+ if (dsCfg.getPageSize() != locDsCfg.getPageSize()) {
throw new IgniteCheckedException("Memory configuration mismatch (fix configuration or set -D" +
IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK + "=true system property) [rmtNodeId=" + rmt.id() +
- ", locPageSize = " + locMemCfg.getPageSize() + ", rmtPageSize = " + memCfg.getPageSize() + "]");
+ ", locPageSize = " + locDsCfg.getPageSize() + ", rmtPageSize = " + dsCfg.getPageSize() + "]");
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index 4f76875..26e2254 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -53,6 +53,8 @@ import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.cache.store.CacheStoreSessionListener;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.TransactionConfiguration;
import org.apache.ignite.internal.GridKernalContext;
@@ -1673,4 +1675,57 @@ public class GridCacheUtils {
cfg.clearQueryEntities().setQueryEntities(normalEntities);
}
}
+
+ /**
+ * Checks if cache configuration belongs to persistent cache.
+ *
+ * @param ccfg Cache configuration.
+ * @param dsCfg Data storage config.
+ */
+ public static boolean isPersistentCache(CacheConfiguration ccfg, DataStorageConfiguration dsCfg) {
+ if (dsCfg == null)
+ return false;
+
+ String regName = ccfg.getDataRegionName();
+
+ if (regName == null || regName.equals(dsCfg.getDefaultDataRegionConfiguration().getName()))
+ return dsCfg.getDefaultDataRegionConfiguration().isPersistenceEnabled();
+
+ if (dsCfg.getDataRegionConfigurations() != null) {
+ for (DataRegionConfiguration drConf : dsCfg.getDataRegionConfigurations()) {
+ if (regName.equals(drConf.getName()))
+ return drConf.isPersistenceEnabled();
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * @return {@code true} if persistence is enabled for at least one data region, {@code false} if not.
+ */
+ public static boolean isPersistenceEnabled(IgniteConfiguration cfg) {
+ if (cfg.getDataStorageConfiguration() == null)
+ return false;
+
+ DataRegionConfiguration dfltReg = cfg.getDataStorageConfiguration().getDefaultDataRegionConfiguration();
+
+ if (dfltReg == null)
+ return false;
+
+ if (dfltReg.isPersistenceEnabled())
+ return true;
+
+ DataRegionConfiguration[] regCfgs = cfg.getDataStorageConfiguration().getDataRegionConfigurations();
+
+ if (regCfgs == null)
+ return false;
+
+ for (DataRegionConfiguration regCfg : regCfgs) {
+ if (regCfg.isPersistenceEnabled())
+ return true;
+ }
+
+ return false;
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
index 4844686..7944c50 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
@@ -148,7 +148,7 @@ public class IgniteCacheOffheapManagerImpl implements IgniteCacheOffheapManager
pendingEntries = new PendingEntriesTree(
grp,
name,
- grp.memoryPolicy().pageMemory(),
+ grp.dataRegion().pageMemory(),
rootPage,
grp.reuseList(),
true);
@@ -794,7 +794,7 @@ public class IgniteCacheOffheapManagerImpl implements IgniteCacheOffheapManager
long pageId;
if (reuseList == null || (pageId = reuseList.takeRecycledPage()) == 0L)
- pageId = grp.memoryPolicy().pageMemory().allocatePage(grp.groupId(), INDEX_PARTITION, FLAG_IDX);
+ pageId = grp.dataRegion().pageMemory().allocatePage(grp.groupId(), INDEX_PARTITION, FLAG_IDX);
return pageId;
}
@@ -1435,7 +1435,7 @@ public class IgniteCacheOffheapManagerImpl implements IgniteCacheOffheapManager
if (row != null) {
row.key(key);
- grp.memoryPolicy().evictionTracker().touchPage(row.link());
+ grp.dataRegion().evictionTracker().touchPage(row.link());
}
return row;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataFileStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataFileStore.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataFileStore.java
index 420cde5..19514c0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataFileStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataFileStore.java
@@ -24,6 +24,7 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.binary.BinaryMetadata;
+import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.jetbrains.annotations.Nullable;
@@ -62,7 +63,7 @@ class BinaryMetadataFileStore {
this.ctx = ctx;
this.log = log;
- if (!ctx.config().isPersistentStoreEnabled())
+ if (!CU.isPersistenceEnabled(ctx.config()))
return;
if (binaryMetadataFileStoreDir != null)
@@ -85,7 +86,7 @@ class BinaryMetadataFileStore {
* @param binMeta Binary metadata to be written to disk.
*/
void saveMetadata(BinaryMetadata binMeta) {
- if (!ctx.config().isPersistentStoreEnabled())
+ if (!CU.isPersistenceEnabled(ctx.config()))
return;
try {
@@ -107,7 +108,7 @@ class BinaryMetadataFileStore {
* Restores metadata on startup of {@link CacheObjectBinaryProcessorImpl} but before starting discovery.
*/
void restoreMetadata() {
- if (!ctx.config().isPersistentStoreEnabled())
+ if (!CU.isPersistenceEnabled(ctx.config()))
return;
for (File file : workDir.listFiles()) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
index e5bcc46..7a10c10 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
@@ -556,7 +556,8 @@ public abstract class GridDistributedTxRemoteAdapter extends IgniteTxAdapter
GridCacheVersion dhtVer = cached.isNear() ? writeVersion() : null;
- if (!near() && cctx.wal() != null && op != NOOP && op != RELOAD && op != READ) {
+ if (!near() && cacheCtx.group().persistenceEnabled() &&
+ op != NOOP && op != RELOAD && op != READ) {
if (dataEntries == null)
dataEntries = new ArrayList<>(entries.size());
@@ -741,7 +742,7 @@ public abstract class GridDistributedTxRemoteAdapter extends IgniteTxAdapter
}
}
- if (!near() && cctx.wal() != null)
+ if (!near() && !F.isEmpty(dataEntries) && cctx.wal() != null)
cctx.wal().log(new DataRecord(dataEntries));
if (ptr != null)
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
index c363729..cedd466 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
@@ -500,7 +500,7 @@ public class GridDhtLocalPartition extends GridCacheConcurrentMapImpl implements
* @return {@code true} if cas succeeds.
*/
private boolean casState(long state, GridDhtPartitionState toState) {
- if (ctx.database().persistenceEnabled()) {
+ if (ctx.database().persistenceEnabled() && grp.dataRegion().config().isPersistenceEnabled()) {
synchronized (this) {
boolean update = this.state.compareAndSet(state, setPartState(state, toState));
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 30614a3..5095f45 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -61,7 +61,6 @@ import org.apache.ignite.internal.processors.cache.GridCacheReturn;
import org.apache.ignite.internal.processors.cache.GridCacheUpdateAtomicResult;
import org.apache.ignite.internal.processors.cache.IgniteCacheExpiryPolicy;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFuture;
import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry;
@@ -1699,7 +1698,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
ctx.shared().database().checkpointReadLock();
try {
- ctx.shared().database().ensureFreeSpace(ctx.memoryPolicy());
+ ctx.shared().database().ensureFreeSpace(ctx.dataRegion());
// If batch store update is enabled, we need to lock all entries.
// First, need to acquire locks on cache entries, then check filter.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
index 1bffac4..dcb167d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
@@ -47,7 +47,7 @@ import org.apache.ignite.plugin.extensions.communication.MessageWriter;
import org.jetbrains.annotations.NotNull;
/**
- * Get request. Responsible for obtaining entry from primary node. 'Near' means 'Primary' here, not 'Near Cache'.
+ * Get request. Responsible for obtaining entry from primary node. 'Near' means 'Initiating node' here, not 'Near Cache'.
*/
public class GridNearGetRequest extends GridCacheIdMessage implements GridCacheDeployable,
GridCacheVersionable {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
index b48693d..f736cae 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
@@ -40,7 +40,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
- * Near cache lock request.
+ * Near cache lock request to primary node. 'Near' means 'Initiating node' here, not 'Near Cache'.
*/
public class GridNearLockRequest extends GridDistributedLockRequest {
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
index e73f34b..085f0b7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
@@ -2682,7 +2682,7 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter implements GridTimeou
GridCacheEntryEx entry = cacheCtx.cache().entryEx(key, topVer);
try {
- cacheCtx.shared().database().ensureFreeSpace(cacheCtx.memoryPolicy());
+ cacheCtx.shared().database().ensureFreeSpace(cacheCtx.dataRegion());
EntryGetResult verVal = entry.versionedValue(cacheVal,
ver,
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
index e352c87..063eb27 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
@@ -36,7 +36,7 @@ import org.apache.ignite.plugin.extensions.communication.MessageWriter;
import org.jetbrains.annotations.Nullable;
/**
- * Near transaction prepare request.
+ * Near transaction prepare request to primary node. 'Near' means 'Initiating node' here, not 'Near Cache'.
*/
public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequest {
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
index 40d1fac..599a58c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
@@ -830,7 +830,7 @@ public class GridLocalAtomicCache<K, V> extends GridLocalCache<K, V> {
CacheEntryPredicate[] filters = CU.filterArray(filter);
- ctx.shared().database().ensureFreeSpace(ctx.memoryPolicy());
+ ctx.shared().database().ensureFreeSpace(ctx.dataRegion());
if (writeThrough && keys.size() > 1) {
return updateWithBatch(op,
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CacheDataRowAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CacheDataRowAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CacheDataRowAdapter.java
index 4d75475..0fd8323 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CacheDataRowAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CacheDataRowAdapter.java
@@ -98,7 +98,7 @@ public class CacheDataRowAdapter implements CacheDataRow {
* @throws IgniteCheckedException If failed.
*/
public final void initFromLink(CacheGroupContext grp, RowData rowData) throws IgniteCheckedException {
- initFromLink(grp, grp.shared(), grp.memoryPolicy().pageMemory(), rowData);
+ initFromLink(grp, grp.shared(), grp.dataRegion().pageMemory(), rowData);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegion.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegion.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegion.java
new file mode 100644
index 0000000..0b0bf2b
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegion.java
@@ -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.
+ */
+package org.apache.ignite.internal.processors.cache.persistence;
+
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.internal.pagemem.PageMemory;
+import org.apache.ignite.internal.processors.cache.persistence.evict.PageEvictionTracker;
+
+/**
+ * Data region provides access to objects configured with {@link DataRegionConfiguration} configuration.
+ */
+public class DataRegion {
+ /** */
+ private final PageMemory pageMem;
+
+ /** */
+ private final DataRegionMetricsImpl memMetrics;
+
+ /** */
+ private final DataRegionConfiguration cfg;
+
+ /** */
+ private final PageEvictionTracker evictionTracker;
+
+ /**
+ * @param pageMem PageMemory instance.
+ * @param memMetrics DataRegionMetrics instance.
+ * @param cfg Configuration of given DataRegion.
+ * @param evictionTracker Eviction tracker.
+ */
+ public DataRegion(
+ PageMemory pageMem,
+ DataRegionConfiguration cfg,
+ DataRegionMetricsImpl memMetrics,
+ PageEvictionTracker evictionTracker
+ ) {
+ this.pageMem = pageMem;
+ this.memMetrics = memMetrics;
+ this.cfg = cfg;
+ this.evictionTracker = evictionTracker;
+ }
+
+ /**
+ *
+ */
+ public PageMemory pageMemory() {
+ return pageMem;
+ }
+
+ /**
+ * @return Config.
+ */
+ public DataRegionConfiguration config() {
+ return cfg;
+ }
+
+ /**
+ * @return Memory Metrics.
+ */
+ public DataRegionMetricsImpl memoryMetrics() {
+ return memMetrics;
+ }
+
+ /**
+ *
+ */
+ public PageEvictionTracker evictionTracker() {
+ return evictionTracker;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsImpl.java
new file mode 100644
index 0000000..1d570f9
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsImpl.java
@@ -0,0 +1,286 @@
+/*
+ * 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.internal.processors.cache.persistence;
+
+import org.apache.ignite.DataRegionMetrics;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.internal.pagemem.PageMemory;
+import org.apache.ignite.internal.processors.cache.ratemetrics.HitRateMetrics;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteOutClosure;
+import org.jetbrains.annotations.Nullable;
+import org.jsr166.LongAdder8;
+
+/**
+ *
+ */
+public class DataRegionMetricsImpl implements DataRegionMetrics {
+ /** */
+ private final IgniteOutClosure<Float> fillFactorProvider;
+
+ /** */
+ private final LongAdder8 totalAllocatedPages = new LongAdder8();
+
+ /**
+ * Counter for number of pages occupied by large entries (one entry is larger than one page).
+ */
+ private final LongAdder8 largeEntriesPages = new LongAdder8();
+
+ /** Counter for number of dirty pages. */
+ private LongAdder8 dirtyPages = new LongAdder8();
+
+ /** */
+ private volatile boolean metricsEnabled;
+
+ /** */
+ private boolean persistenceEnabled;
+
+ /** */
+ private volatile int subInts;
+
+ /** Allocation rate calculator. */
+ private volatile HitRateMetrics allocRate = new HitRateMetrics(60_000, 5);
+
+ /** */
+ private volatile HitRateMetrics pageReplaceRate = new HitRateMetrics(60_000, 5);
+
+ /** */
+ private final DataRegionConfiguration memPlcCfg;
+
+ /** */
+ private PageMemory pageMem;
+
+ /** Time interval (in milliseconds) when allocations/evictions are counted to calculate rate. */
+ private volatile long rateTimeInterval;
+
+ /**
+ * @param memPlcCfg DataRegionConfiguration.
+ */
+ public DataRegionMetricsImpl(DataRegionConfiguration memPlcCfg) {
+ this(memPlcCfg, null);
+ }
+
+ /**
+ * @param memPlcCfg DataRegionConfiguration.
+ */
+ public DataRegionMetricsImpl(DataRegionConfiguration memPlcCfg, @Nullable IgniteOutClosure<Float> fillFactorProvider) {
+ this.memPlcCfg = memPlcCfg;
+ this.fillFactorProvider = fillFactorProvider;
+
+ metricsEnabled = memPlcCfg.isMetricsEnabled();
+
+ rateTimeInterval = memPlcCfg.getMetricsRateTimeInterval();
+
+ subInts = memPlcCfg.getMetricsSubIntervalCount();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getName() {
+ return U.maskName(memPlcCfg.getName());
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getTotalAllocatedPages() {
+ return metricsEnabled ? totalAllocatedPages.longValue() : 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getAllocationRate() {
+ if (!metricsEnabled)
+ return 0;
+
+ return ((float) allocRate.getRate()) / rateTimeInterval;
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getEvictionRate() {
+ return 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getLargeEntriesPagesPercentage() {
+ if (!metricsEnabled)
+ return 0;
+
+ return totalAllocatedPages.longValue() != 0 ?
+ (float) largeEntriesPages.doubleValue() / totalAllocatedPages.longValue()
+ : 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getPagesFillFactor() {
+ if (!metricsEnabled || fillFactorProvider == null)
+ return 0;
+
+ return fillFactorProvider.apply();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getDirtyPages() {
+ if (!metricsEnabled || !persistenceEnabled)
+ return 0;
+
+ return dirtyPages.longValue();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getPagesReplaceRate() {
+ if (!metricsEnabled || !persistenceEnabled)
+ return 0;
+
+ return ((float) pageReplaceRate.getRate()) / rateTimeInterval;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getPhysicalMemoryPages() {
+ if (!metricsEnabled || !persistenceEnabled)
+ return 0;
+
+ assert pageMem != null;
+
+ return pageMem.loadedPages();
+ }
+
+ /**
+ * Updates pageReplaceRate metric.
+ */
+ public void updatePageReplaceRate() {
+ if (metricsEnabled)
+ pageReplaceRate.onHit();
+ }
+
+ /**
+ * Increments dirtyPages counter.
+ */
+ public void incrementDirtyPages() {
+ if (metricsEnabled)
+ dirtyPages.increment();
+ }
+
+ /**
+ * Decrements dirtyPages counter.
+ */
+ public void decrementDirtyPages() {
+ if (metricsEnabled)
+ dirtyPages.decrement();
+ }
+
+ /**
+ * Resets dirtyPages counter to zero.
+ */
+ public void resetDirtyPages() {
+ if (metricsEnabled)
+ dirtyPages.reset();
+ }
+
+ /**
+ * Increments totalAllocatedPages counter.
+ */
+ public void incrementTotalAllocatedPages() {
+ if (metricsEnabled) {
+ totalAllocatedPages.increment();
+
+ updateAllocationRateMetrics();
+ }
+ }
+
+ /**
+ *
+ */
+ private void updateAllocationRateMetrics() {
+ allocRate.onHit();
+ }
+
+ /**
+ * @param intervalNum Interval number.
+ */
+ private long subInt(int intervalNum) {
+ return (rateTimeInterval * intervalNum) / subInts;
+ }
+
+ /**
+ *
+ */
+ public void incrementLargeEntriesPages() {
+ if (metricsEnabled)
+ largeEntriesPages.increment();
+ }
+
+ /**
+ *
+ */
+ public void decrementLargeEntriesPages() {
+ if (metricsEnabled)
+ largeEntriesPages.decrement();
+ }
+
+ /**
+ * Enable metrics.
+ */
+ public void enableMetrics() {
+ metricsEnabled = true;
+ }
+
+ /**
+ * Disable metrics.
+ */
+ public void disableMetrics() {
+ metricsEnabled = false;
+ }
+
+ /**
+ * @param persistenceEnabled Persistence enabled.
+ */
+ public void persistenceEnabled(boolean persistenceEnabled) {
+ this.persistenceEnabled = persistenceEnabled;
+ }
+
+ /**
+ * @param pageMem Page mem.
+ */
+ public void pageMemory(PageMemory pageMem) {
+ this.pageMem = pageMem;
+ }
+
+ /**
+ * @param rateTimeInterval Time interval (in milliseconds) used to calculate allocation/eviction rate.
+ */
+ public void rateTimeInterval(long rateTimeInterval) {
+ this.rateTimeInterval = rateTimeInterval;
+
+ allocRate = new HitRateMetrics((int) rateTimeInterval, subInts);
+ pageReplaceRate = new HitRateMetrics((int) rateTimeInterval, subInts);
+ }
+
+ /**
+ * Sets number of subintervals the whole rateTimeInterval will be split into to calculate allocation rate.
+ *
+ * @param subInts Number of subintervals.
+ */
+ public void subIntervals(int subInts) {
+ assert subInts > 0;
+
+ if (this.subInts == subInts)
+ return;
+
+ if (rateTimeInterval / subInts < 10)
+ subInts = (int) rateTimeInterval / 10;
+
+ allocRate = new HitRateMetrics((int) rateTimeInterval, subInts);
+ pageReplaceRate = new HitRateMetrics((int) rateTimeInterval, subInts);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsMXBeanImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsMXBeanImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsMXBeanImpl.java
new file mode 100644
index 0000000..141d0dc
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsMXBeanImpl.java
@@ -0,0 +1,131 @@
+/*
+ * 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.internal.processors.cache.persistence;
+
+import org.apache.ignite.DataRegionMetrics;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.mxbean.DataRegionMetricsMXBean;
+
+/**
+ * MBean to expose {@link DataRegionMetrics} through JMX interface.
+ */
+class DataRegionMetricsMXBeanImpl implements DataRegionMetricsMXBean {
+ /** */
+ private final DataRegionMetricsImpl memMetrics;
+
+ /** */
+ private final DataRegionConfiguration dataRegCfg;
+
+ /**
+ * @param memMetrics DataRegionMetrics instance to expose through JMX interface.
+ * @param dataRegCfg Configuration of data region this MX Bean is created for.
+ */
+ DataRegionMetricsMXBeanImpl(DataRegionMetricsImpl memMetrics,
+ DataRegionConfiguration dataRegCfg
+ ) {
+ this.memMetrics = memMetrics;
+ this.dataRegCfg = dataRegCfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getAllocationRate() {
+ return memMetrics.getAllocationRate();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getEvictionRate() {
+ return memMetrics.getEvictionRate();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getLargeEntriesPagesPercentage() {
+ return memMetrics.getLargeEntriesPagesPercentage();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getPagesFillFactor() {
+ return memMetrics.getPagesFillFactor();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getTotalAllocatedPages() {
+ return memMetrics.getTotalAllocatedPages();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getDirtyPages() {
+ return memMetrics.getDirtyPages();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getPagesReplaceRate() {
+ return memMetrics.getPagesReplaceRate();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getPhysicalMemoryPages() {
+ return memMetrics.getPhysicalMemoryPages();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void rateTimeInterval(long rateTimeInterval) {
+ if (rateTimeInterval < 1000)
+ throw new IllegalArgumentException("rateTimeInterval property must be positive " +
+ "and greater than 1_000 milliseconds (one second)");
+
+ memMetrics.rateTimeInterval(rateTimeInterval);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void subIntervals(int subInts) {
+ if (subInts <= 1)
+ throw new IllegalArgumentException("subIntervals property must be positive " +
+ "and greater than one");
+
+ memMetrics.subIntervals(subInts);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void enableMetrics() {
+ memMetrics.enableMetrics();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void disableMetrics() {
+ memMetrics.disableMetrics();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getName() {
+ return memMetrics.getName();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getInitialSize() {
+ return (int) (dataRegCfg.getInitialSize() / (1024 * 1024));
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getMaxSize() {
+ return (int) (dataRegCfg.getMaxSize() / (1024 * 1024));
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getSwapPath() {
+ return dataRegCfg.getSwapPath();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsSnapshot.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsSnapshot.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsSnapshot.java
new file mode 100644
index 0000000..c39fdb0d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsSnapshot.java
@@ -0,0 +1,112 @@
+/*
+ * 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.internal.processors.cache.persistence;
+
+import org.apache.ignite.DataRegionMetrics;
+
+/**
+ *
+ */
+public class DataRegionMetricsSnapshot implements DataRegionMetrics {
+ /** */
+ private String name;
+
+ /** */
+ private long totalAllocatedPages;
+
+ /** */
+ private float allocationRate;
+
+ /** */
+ private float evictionRate;
+
+ /** */
+ private float largeEntriesPagesPercentage;
+
+ /** */
+ private float pagesFillFactor;
+
+ /** */
+ private long dirtyPages;
+
+ /** */
+ private float pageReplaceRate;
+
+ /** */
+ private long physicalMemoryPages;
+
+ /**
+ * @param metrics Metrics instance to take a copy.
+ */
+ public DataRegionMetricsSnapshot(DataRegionMetrics metrics) {
+ name = metrics.getName();
+ totalAllocatedPages = metrics.getTotalAllocatedPages();
+ allocationRate = metrics.getAllocationRate();
+ evictionRate = metrics.getEvictionRate();
+ largeEntriesPagesPercentage = metrics.getLargeEntriesPagesPercentage();
+ pagesFillFactor = metrics.getPagesFillFactor();
+ dirtyPages = metrics.getDirtyPages();
+ pageReplaceRate = metrics.getPagesReplaceRate();
+ physicalMemoryPages = metrics.getPhysicalMemoryPages();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getName() {
+ return name;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getTotalAllocatedPages() {
+ return totalAllocatedPages;
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getAllocationRate() {
+ return allocationRate;
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getEvictionRate() {
+ return evictionRate;
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getLargeEntriesPagesPercentage() {
+ return largeEntriesPagesPercentage;
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getPagesFillFactor() {
+ return pagesFillFactor;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getDirtyPages() {
+ return dirtyPages;
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getPagesReplaceRate() {
+ return pageReplaceRate;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getPhysicalMemoryPages() {
+ return physicalMemoryPages;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsImpl.java
new file mode 100644
index 0000000..16707aa
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsImpl.java
@@ -0,0 +1,297 @@
+/*
+ * 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.internal.processors.cache.persistence;
+
+import org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager;
+import org.apache.ignite.internal.processors.cache.ratemetrics.HitRateMetrics;
+import org.apache.ignite.mxbean.DataStorageMetricsMXBean;
+
+/**
+ *
+ */
+public class DataStorageMetricsImpl implements DataStorageMetricsMXBean {
+ /** */
+ private volatile HitRateMetrics walLoggingRate;
+
+ /** */
+ private volatile HitRateMetrics walWritingRate;
+
+ /** */
+ private volatile HitRateMetrics walFsyncTimeDuration;
+
+ /** */
+ private volatile HitRateMetrics walFsyncTimeNumber;
+
+ /** */
+ private volatile long lastCpLockWaitDuration;
+
+ /** */
+ private volatile long lastCpMarkDuration;
+
+ /** */
+ private volatile long lastCpPagesWriteDuration;
+
+ /** */
+ private volatile long lastCpDuration;
+
+ /** */
+ private volatile long lastCpFsyncDuration;
+
+ /** */
+ private volatile long lastCpTotalPages;
+
+ /** */
+ private volatile long lastCpDataPages;
+
+ /** */
+ private volatile long lastCpCowPages;
+
+ /** */
+ private volatile long rateTimeInterval;
+
+ /** */
+ private volatile int subInts;
+
+ /** */
+ private volatile boolean metricsEnabled;
+
+ /** */
+ private IgniteWriteAheadLogManager wal;
+
+ /**
+ * @param metricsEnabled Metrics enabled flag.
+ * @param rateTimeInterval Rate time interval.
+ * @param subInts Number of sub-intervals.
+ */
+ public DataStorageMetricsImpl(
+ boolean metricsEnabled,
+ long rateTimeInterval,
+ int subInts
+ ) {
+ this.metricsEnabled = metricsEnabled;
+ this.rateTimeInterval = rateTimeInterval;
+ this.subInts = subInts;
+
+ resetRates();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getWalLoggingRate() {
+ if (!metricsEnabled)
+ return 0;
+
+ return ((float)walLoggingRate.getRate()) / rateTimeInterval;
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getWalWritingRate() {
+ if (!metricsEnabled)
+ return 0;
+
+ return ((float)walWritingRate.getRate()) / rateTimeInterval;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getWalArchiveSegments() {
+ if (!metricsEnabled)
+ return 0;
+
+ return wal.walArchiveSegments();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getWalFsyncTimeAverage() {
+ if (!metricsEnabled)
+ return 0;
+
+ long numRate = walFsyncTimeNumber.getRate();
+
+ if (numRate == 0)
+ return 0;
+
+ return (float)walFsyncTimeDuration.getRate() / numRate;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointingDuration() {
+ if (!metricsEnabled)
+ return 0;
+
+ return lastCpDuration;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointLockWaitDuration() {
+ if (!metricsEnabled)
+ return 0;
+
+ return lastCpLockWaitDuration;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointMarkDuration() {
+ if (!metricsEnabled)
+ return 0;
+
+ return lastCpMarkDuration;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointPagesWriteDuration() {
+ if (!metricsEnabled)
+ return 0;
+
+ return lastCpPagesWriteDuration;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointFsyncDuration() {
+ if (!metricsEnabled)
+ return 0;
+
+ return lastCpFsyncDuration;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointTotalPagesNumber() {
+ if (!metricsEnabled)
+ return 0;
+
+ return lastCpTotalPages;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointDataPagesNumber() {
+ if (!metricsEnabled)
+ return 0;
+
+ return lastCpDataPages;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointCopiedOnWritePagesNumber() {
+ if (!metricsEnabled)
+ return 0;
+
+ return lastCpCowPages;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void enableMetrics() {
+ metricsEnabled = true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void disableMetrics() {
+ metricsEnabled = false;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void rateTimeInterval(long rateTimeInterval) {
+ this.rateTimeInterval = rateTimeInterval;
+
+ resetRates();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void subIntervals(int subInts) {
+ this.subInts = subInts;
+
+ resetRates();
+ }
+
+ /**
+ * @param wal Write-ahead log manager.
+ */
+ public void wal(IgniteWriteAheadLogManager wal) {
+ this.wal = wal;
+ }
+
+ /**
+ * @return Metrics enabled flag.
+ */
+ public boolean metricsEnabled() {
+ return metricsEnabled;
+ }
+
+ /**
+ * @param lockWaitDuration Lock wait duration.
+ * @param markDuration Mark duration.
+ * @param pagesWriteDuration Pages write duration.
+ * @param fsyncDuration Total checkpoint fsync duration.
+ * @param duration Total checkpoint duration.
+ * @param totalPages Total number of all pages in checkpoint.
+ * @param dataPages Total number of data pages in checkpoint.
+ * @param cowPages Total number of COW-ed pages in checkpoint.
+ */
+ public void onCheckpoint(
+ long lockWaitDuration,
+ long markDuration,
+ long pagesWriteDuration,
+ long fsyncDuration,
+ long duration,
+ long totalPages,
+ long dataPages,
+ long cowPages
+ ) {
+ if (metricsEnabled) {
+ lastCpLockWaitDuration = lockWaitDuration;
+ lastCpMarkDuration = markDuration;
+ lastCpPagesWriteDuration = pagesWriteDuration;
+ lastCpFsyncDuration = fsyncDuration;
+ lastCpDuration = duration;
+ lastCpTotalPages = totalPages;
+ lastCpDataPages = dataPages;
+ lastCpCowPages = cowPages;
+ }
+ }
+
+ /**
+ *
+ */
+ public void onWalRecordLogged() {
+ walLoggingRate.onHit();
+ }
+
+ /**
+ * @param size Size written.
+ */
+ public void onWalBytesWritten(int size) {
+ walWritingRate.onHits(size);
+ }
+
+ /**
+ * @param nanoTime Fsync nano time.
+ */
+ public void onFsync(long nanoTime) {
+ long microseconds = nanoTime / 1_000;
+
+ walFsyncTimeDuration.onHits(microseconds);
+ walFsyncTimeNumber.onHit();
+ }
+
+ /**
+ *
+ */
+ private void resetRates() {
+ walLoggingRate = new HitRateMetrics((int)rateTimeInterval, subInts);
+ walWritingRate = new HitRateMetrics((int)rateTimeInterval, subInts);
+
+ walFsyncTimeDuration = new HitRateMetrics((int)rateTimeInterval, subInts);
+ walFsyncTimeNumber = new HitRateMetrics((int)rateTimeInterval, subInts);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsSnapshot.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsSnapshot.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsSnapshot.java
new file mode 100644
index 0000000..4841387
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsSnapshot.java
@@ -0,0 +1,144 @@
+/*
+ * 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.internal.processors.cache.persistence;
+
+import org.apache.ignite.DataStorageMetrics;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+/**
+ *
+ */
+public class DataStorageMetricsSnapshot implements DataStorageMetrics {
+ /** */
+ private float walLoggingRate;
+
+ /** */
+ private float walWritingRate;
+
+ /** */
+ private int walArchiveSegments;
+
+ /** */
+ private float walFsyncTimeAvg;
+
+ /** */
+ private long lastCpDuration;
+
+ /** */
+ private long lastCpLockWaitDuration;
+
+ /** */
+ private long lastCpMmarkDuration;
+
+ /** */
+ private long lastCpPagesWriteDuration;
+
+ /** */
+ private long lastCpFsyncDuration;
+
+ /** */
+ private long lastCpTotalPages;
+
+ /** */
+ private long lastCpDataPages;
+
+ /** */
+ private long lastCpCowPages;
+
+ /**
+ * @param metrics Metrics.
+ */
+ public DataStorageMetricsSnapshot(DataStorageMetrics metrics) {
+ walLoggingRate = metrics.getWalLoggingRate();
+ walWritingRate = metrics.getWalWritingRate();
+ walArchiveSegments = metrics.getWalArchiveSegments();
+ walFsyncTimeAvg = metrics.getWalFsyncTimeAverage();
+ lastCpDuration = metrics.getLastCheckpointingDuration();
+ lastCpLockWaitDuration = metrics.getLastCheckpointLockWaitDuration();
+ lastCpMmarkDuration = metrics.getLastCheckpointMarkDuration();
+ lastCpPagesWriteDuration = metrics.getLastCheckpointPagesWriteDuration();
+ lastCpFsyncDuration = metrics.getLastCheckpointFsyncDuration();
+ lastCpTotalPages = metrics.getLastCheckpointTotalPagesNumber();
+ lastCpDataPages = metrics.getLastCheckpointDataPagesNumber();
+ lastCpCowPages = metrics.getLastCheckpointCopiedOnWritePagesNumber();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getWalLoggingRate() {
+ return walLoggingRate;
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getWalWritingRate() {
+ return walWritingRate;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getWalArchiveSegments() {
+ return walArchiveSegments;
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getWalFsyncTimeAverage() {
+ return walFsyncTimeAvg;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointingDuration() {
+ return lastCpDuration;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointLockWaitDuration() {
+ return lastCpLockWaitDuration;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointMarkDuration() {
+ return lastCpMmarkDuration;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointPagesWriteDuration() {
+ return lastCpPagesWriteDuration;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointFsyncDuration() {
+ return lastCpFsyncDuration;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointTotalPagesNumber() {
+ return lastCpTotalPages;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointDataPagesNumber() {
+ return lastCpDataPages;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointCopiedOnWritePagesNumber() {
+ return lastCpCowPages;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(DataStorageMetricsSnapshot.class, this);
+ }
+}
[05/50] [abbrv] ignite git commit: IGNITE-5608: Added sqlline utility
to the build. This closes #2861.
Posted by sb...@apache.org.
IGNITE-5608: Added sqlline utility to the build. This closes #2861.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5128c257
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5128c257
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5128c257
Branch: refs/heads/ignite-3478-tree
Commit: 5128c257b979e391ed04baf3607103b6597067a9
Parents: 12bc756
Author: Oleg Ostanin <oo...@gridgain.com>
Authored: Wed Oct 18 14:14:41 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Oct 18 14:14:41 2017 +0300
----------------------------------------------------------------------
assembly/dependencies-sqlline.xml | 65 +++++++++++++++++++
modules/sqlline/bin/ignitesql.bat | 112 +++++++++++++++++++++++++++++++++
modules/sqlline/bin/ignitesql.sh | 54 ++++++++++++++++
modules/sqlline/pom.xml | 74 ++++++++++++++++++++++
pom.xml | 17 +++++
5 files changed, 322 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5128c257/assembly/dependencies-sqlline.xml
----------------------------------------------------------------------
diff --git a/assembly/dependencies-sqlline.xml b/assembly/dependencies-sqlline.xml
new file mode 100644
index 0000000..f8953a1
--- /dev/null
+++ b/assembly/dependencies-sqlline.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
+ http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+ <id>dependencies-sqlline</id>
+
+ <formats>
+ <format>dir</format>
+ </formats>
+
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <moduleSets>
+ <moduleSet>
+ <includes>
+ <include>org.apache.ignite:ignite-sqlline</include>
+ </includes>
+ <sources>
+ <includeModuleDirectory>false</includeModuleDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>target</directory>
+ <outputDirectory>include/sqlline</outputDirectory>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ <excludes>
+ <exclude>*-tests.jar</exclude>
+ <exclude>*-javadoc.jar</exclude>
+ <exclude>*-sources.jar</exclude>
+ </excludes>
+ </fileSet>
+ <fileSet>
+ <directory>target/libs</directory>
+ <outputDirectory>include/sqlline</outputDirectory>
+ </fileSet>
+
+ <fileSet>
+ <directory>bin</directory>
+ <outputDirectory>/</outputDirectory>
+ </fileSet>
+ </fileSets>
+ </sources>
+ </moduleSet>
+ </moduleSets>
+</assembly>
http://git-wip-us.apache.org/repos/asf/ignite/blob/5128c257/modules/sqlline/bin/ignitesql.bat
----------------------------------------------------------------------
diff --git a/modules/sqlline/bin/ignitesql.bat b/modules/sqlline/bin/ignitesql.bat
new file mode 100644
index 0000000..828e93a
--- /dev/null
+++ b/modules/sqlline/bin/ignitesql.bat
@@ -0,0 +1,112 @@
+::
+:: 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.
+::
+
+::
+:: Ignite database connector.
+::
+
+@echo off
+Setlocal EnableDelayedExpansion
+
+if "%OS%" == "Windows_NT" setlocal
+
+:: Check JAVA_HOME.
+if defined JAVA_HOME goto checkJdk
+ echo %0, ERROR:
+ echo JAVA_HOME environment variable is not found.
+ echo Please point JAVA_HOME variable to location of JDK 1.7 or JDK 1.8.
+ echo You can also download latest JDK at http://java.com/download.
+goto error_finish
+
+:checkJdk
+:: Check that JDK is where it should be.
+if exist "%JAVA_HOME%\bin\java.exe" goto checkJdkVersion
+ echo %0, ERROR:
+ echo JAVA is not found in JAVA_HOME=%JAVA_HOME%.
+ echo Please point JAVA_HOME variable to installation of JDK 1.7 or JDK 1.8.
+ echo You can also download latest JDK at http://java.com/download.
+goto error_finish
+
+:checkJdkVersion
+"%JAVA_HOME%\bin\java.exe" -version 2>&1 | findstr "1\.[78]\." > nul
+if %ERRORLEVEL% equ 0 goto checkIgniteHome1
+ echo %0, ERROR:
+ echo The version of JAVA installed in %JAVA_HOME% is incorrect.
+ echo Please point JAVA_HOME variable to installation of JDK 1.7 or JDK 1.8.
+ echo You can also download latest JDK at http://java.com/download.
+goto error_finish
+
+:: Check IGNITE_HOME.
+:checkIgniteHome1
+if defined IGNITE_HOME goto checkIgniteHome2
+ pushd "%~dp0"/..
+ set IGNITE_HOME=%CD%
+ popd
+
+:checkIgniteHome2
+:: Strip double quotes from IGNITE_HOME
+set IGNITE_HOME=%IGNITE_HOME:"=%
+
+:: remove all trailing slashes from IGNITE_HOME.
+if %IGNITE_HOME:~-1,1% == \ goto removeTrailingSlash
+if %IGNITE_HOME:~-1,1% == / goto removeTrailingSlash
+goto checkIgniteHome3
+
+:removeTrailingSlash
+set IGNITE_HOME=%IGNITE_HOME:~0,-1%
+goto checkIgniteHome2
+
+:checkIgniteHome3
+if exist "%IGNITE_HOME%\config" goto checkIgniteHome4
+ echo %0, ERROR: Ignite installation folder is not found or IGNITE_HOME environment variable is not valid.
+ echo Please create IGNITE_HOME environment variable pointing to location of
+ echo Ignite installation folder.
+ goto error_finish
+
+:checkIgniteHome4
+
+::
+:: Set SCRIPTS_HOME - base path to scripts.
+::
+set SCRIPTS_HOME=%IGNITE_HOME%\bin
+
+:: Remove trailing spaces
+for /l %%a in (1,1,31) do if /i "%SCRIPTS_HOME:~-1%" == " " set SCRIPTS_HOME=%SCRIPTS_HOME:~0,-1%
+
+if /i "%SCRIPTS_HOME%\" == "%~dp0" goto setProgName
+ echo %0, WARN: IGNITE_HOME environment variable may be pointing to wrong folder: %IGNITE_HOME%
+
+:setProgName
+::
+:: Set program name.
+::
+set PROG_NAME=ignitesql.bat
+if "%OS%" == "Windows_NT" set PROG_NAME=%~nx0%
+
+:run
+
+::
+:: Set IGNITE_LIBS
+::
+call "%SCRIPTS_HOME%\include\setenv.bat"
+
+set CP=%IGNITE_LIBS%
+set CP=%CP%;%IGNITE_HOME%\bin\include\sqlline\*
+
+"%JAVA_HOME%\bin\java.exe" -cp "%CP%" sqlline.SqlLine -d org.apache.ignite.IgniteJdbcThinDriver %*
+
+:error_finish
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5128c257/modules/sqlline/bin/ignitesql.sh
----------------------------------------------------------------------
diff --git a/modules/sqlline/bin/ignitesql.sh b/modules/sqlline/bin/ignitesql.sh
new file mode 100644
index 0000000..5745aea
--- /dev/null
+++ b/modules/sqlline/bin/ignitesql.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+#
+# 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.
+#
+
+#
+# Ignite database connector.
+#
+
+#
+# Import common functions.
+#
+if [ "${IGNITE_HOME}" = "" ];
+ then IGNITE_HOME_TMP="$(dirname "$(cd "$(dirname "$0")"; "pwd")")";
+ else IGNITE_HOME_TMP=${IGNITE_HOME};
+fi
+
+#
+# Set SCRIPTS_HOME - base path to scripts.
+#
+SCRIPTS_HOME="${IGNITE_HOME_TMP}/bin"
+
+source "${SCRIPTS_HOME}"/include/functions.sh
+
+#
+# Discover IGNITE_HOME environment variable.
+#
+setIgniteHome
+
+#
+# Set IGNITE_LIBS.
+#
+. "${SCRIPTS_HOME}"/include/setenv.sh
+
+JDBCLINK="jdbc:ignite:thin://${HOST_AND_PORT}${SCHEMA_DELIMITER}${SCHEMA}${PARAMS}"
+
+CP="${IGNITE_LIBS}"
+
+CP="${CP}${SEP}${IGNITE_HOME_TMP}/bin/include/sqlline/*"
+
+java -cp ${CP} sqlline.SqlLine -d org.apache.ignite.IgniteJdbcThinDriver $@
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5128c257/modules/sqlline/pom.xml
----------------------------------------------------------------------
diff --git a/modules/sqlline/pom.xml b/modules/sqlline/pom.xml
new file mode 100644
index 0000000..bcb71ec
--- /dev/null
+++ b/modules/sqlline/pom.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<!--
+ POM file.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>apache-ignite</artifactId>
+ <groupId>org.apache.ignite</groupId>
+ <version>2.3.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>ignite-sqlline</artifactId>
+ <packaging>jar</packaging>
+
+ <name>sqlline</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>sqlline</groupId>
+ <artifactId>sqlline</artifactId>
+ <version>1.3.0</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-libs</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <excludeGroupIds>org.apache.ignite</excludeGroupIds>
+ <outputDirectory>target/libs</outputDirectory>
+ <includeScope>runtime</includeScope>
+ <excludeTransitive>false</excludeTransitive>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/ignite/blob/5128c257/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index d60863f..befbf4c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -95,6 +95,7 @@
<module>modules/kubernetes</module>
<module>modules/zeromq</module>
<module>modules/rocketmq</module>
+ <module>modules/sqlline</module>
</modules>
<profiles>
@@ -470,6 +471,22 @@
</execution>
<execution>
+ <id>dependencies-sqlline</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>assembly/dependencies-sqlline.xml</descriptor>
+ </descriptors>
+ <outputDirectory>target/release-package-${ignite.edition}</outputDirectory>
+ <finalName>bin</finalName>
+ <appendAssemblyId>false</appendAssemblyId>
+ </configuration>
+ </execution>
+
+ <execution>
<id>scala-scripts</id>
<phase>validate</phase>
<goals>
[45/50] [abbrv] ignite git commit: IGNITE-6718: Skipped upload of
sqlline and compatibility modules into maven central during build. This
closes #2911.
Posted by sb...@apache.org.
IGNITE-6718: Skipped upload of sqlline and compatibility modules into maven central during build. This closes #2911.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8afeb67f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8afeb67f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8afeb67f
Branch: refs/heads/ignite-3478-tree
Commit: 8afeb67ffa71a2b3e97cfdfd7fc09b618a562a2e
Parents: 05e0762
Author: oleg-ostanin <oo...@gridgain.com>
Authored: Tue Oct 24 10:32:32 2017 +0300
Committer: devozerov <pp...@gmail.com>
Committed: Tue Oct 24 10:34:02 2017 +0300
----------------------------------------------------------------------
modules/compatibility/pom.xml | 13 +++++++++++++
modules/sqlline/pom.xml | 9 +++++++++
2 files changed, 22 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/8afeb67f/modules/compatibility/pom.xml
----------------------------------------------------------------------
diff --git a/modules/compatibility/pom.xml b/modules/compatibility/pom.xml
index 166848d..845d0cd 100644
--- a/modules/compatibility/pom.xml
+++ b/modules/compatibility/pom.xml
@@ -91,4 +91,17 @@
<scope>test</scope>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <version>2.8.2</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
http://git-wip-us.apache.org/repos/asf/ignite/blob/8afeb67f/modules/sqlline/pom.xml
----------------------------------------------------------------------
diff --git a/modules/sqlline/pom.xml b/modules/sqlline/pom.xml
index bcb71ec..1c16a19 100644
--- a/modules/sqlline/pom.xml
+++ b/modules/sqlline/pom.xml
@@ -69,6 +69,15 @@
</execution>
</executions>
</plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <version>2.8.2</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
</plugins>
</build>
</project>
[04/50] [abbrv] ignite git commit: IGNITE-6595 Cleanup entries after
index rebuild
Posted by sb...@apache.org.
IGNITE-6595 Cleanup entries after index rebuild
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/12bc7566
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/12bc7566
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/12bc7566
Branch: refs/heads/ignite-3478-tree
Commit: 12bc756624b196e68e049987265399d2fd9b782b
Parents: 879bf58
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Wed Oct 18 10:59:53 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Wed Oct 18 10:59:53 2017 +0300
----------------------------------------------------------------------
.../ignite/internal/processors/query/h2/IgniteH2Indexing.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/12bc7566/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index ff6ff4d..eed1f19 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -1934,8 +1934,10 @@ public class IgniteH2Indexing implements GridQueryIndexing {
KeyCacheObject key = keyIter.next();
while (true) {
+ GridCacheEntryEx entry = null;
+
try {
- GridCacheEntryEx entry = cctx.isNear() ?
+ entry = cctx.isNear() ?
cctx.near().dht().entryEx(key) : cctx.cache().entryEx(key);
entry.ensureIndexed();
@@ -1948,6 +1950,9 @@ public class IgniteH2Indexing implements GridQueryIndexing {
catch (GridDhtInvalidPartitionException ignore) {
break;
}
+ finally {
+ entry.context().evicts().touch(entry, AffinityTopologyVersion.NONE);
+ }
}
}
finally {
[48/50] [abbrv] ignite git commit: ignite-6700 Tcp discovery: ignore
message's failedNodes list received from failed nodes.
Posted by sb...@apache.org.
ignite-6700 Tcp discovery: ignore message's failedNodes list received from failed nodes.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5f69d262
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5f69d262
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5f69d262
Branch: refs/heads/ignite-3478-tree
Commit: 5f69d262331f60ed62822c3cbad5c643b8f9a025
Parents: 62cb4fb
Author: sboikov <sb...@gridgain.com>
Authored: Tue Oct 24 11:24:06 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Oct 24 11:24:06 2017 +0300
----------------------------------------------------------------------
.../ignite/spi/discovery/tcp/ServerImpl.java | 45 ++++++--
.../spi/discovery/tcp/TcpDiscoverySpi.java | 18 +++
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 110 +++++++++++++++++++
3 files changed, 163 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5f69d262/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index 58e1ba4..4c2a0ad 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -1959,8 +1959,36 @@ class ServerImpl extends TcpDiscoveryImpl {
* @param msg Message.
*/
private void processMessageFailedNodes(TcpDiscoveryAbstractMessage msg) {
- if (msg.failedNodes() != null) {
- for (UUID nodeId : msg.failedNodes()) {
+ Collection<UUID> msgFailedNodes = msg.failedNodes();
+
+ if (msgFailedNodes != null) {
+ UUID sndId = msg.senderNodeId();
+
+ if (sndId != null) {
+ if (ring.node(sndId) == null) {
+ if (log.isDebugEnabled()) {
+ log.debug("Ignore message failed nodes, sender node is not alive [nodeId=" + sndId +
+ ", failedNodes=" + msgFailedNodes + ']');
+ }
+
+ return;
+ }
+
+ synchronized (mux) {
+ for (TcpDiscoveryNode failedNode : failedNodes.keySet()) {
+ if (failedNode.id().equals(sndId)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Ignore message failed nodes, sender node is in fail list [nodeId=" + sndId +
+ ", failedNodes=" + msgFailedNodes + ']');
+ }
+
+ return;
+ }
+ }
+ }
+ }
+
+ for (UUID nodeId : msgFailedNodes) {
TcpDiscoveryNode failedNode = ring.node(nodeId);
if (failedNode != null) {
@@ -2817,9 +2845,6 @@ class ServerImpl extends TcpDiscoveryImpl {
log.trace("Next node remains the same [nextId=" + next.id() +
", nextOrder=" + next.internalOrder() + ']');
- // Flag that shows whether next node exists and accepts incoming connections.
- boolean nextNodeExists = sock != null;
-
final boolean sameHost = U.sameMacs(locNode, next);
List<InetSocketAddress> locNodeAddrs = U.arrayList(locNode.socketAddresses());
@@ -2844,8 +2869,6 @@ class ServerImpl extends TcpDiscoveryImpl {
if (timeoutHelper == null)
timeoutHelper = new IgniteSpiOperationTimeoutHelper(spi, true);
- nextNodeExists = false;
-
boolean success = false;
boolean openSock = false;
@@ -2974,8 +2997,6 @@ class ServerImpl extends TcpDiscoveryImpl {
sock = null;
}
else {
- // Next node exists and accepts incoming messages.
- nextNodeExists = true;
// Resetting timeout control object to let the code below to use a new one
// for the next bunch of operations.
timeoutHelper = null;
@@ -3067,7 +3088,11 @@ class ServerImpl extends TcpDiscoveryImpl {
if (latencyCheck && log.isInfoEnabled())
log.info("Latency check message has been written to socket: " + msg.id());
- spi.writeToSocket(sock, out, msg, timeoutHelper.nextTimeoutChunk(spi.getSocketTimeout()));
+ spi.writeToSocket(newNextNode ? newNext : next,
+ sock,
+ out,
+ msg,
+ timeoutHelper.nextTimeoutChunk(spi.getSocketTimeout()));
long tstamp0 = U.currentTimeMillis();
http://git-wip-us.apache.org/repos/asf/ignite/blob/5f69d262/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index eb8ee30..922e787 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -1478,6 +1478,24 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi {
}
/**
+ * @param node Target node.
+ * @param sock Socket.
+ * @param out Stream to write to.
+ * @param msg Message.
+ * @param timeout Timeout.
+ * @throws IOException If IO failed or write timed out.
+ * @throws IgniteCheckedException If marshalling failed.
+ */
+ protected void writeToSocket(
+ ClusterNode node,
+ Socket sock,
+ OutputStream out,
+ TcpDiscoveryAbstractMessage msg,
+ long timeout) throws IOException, IgniteCheckedException {
+ writeToSocket(sock, out, msg, timeout);
+ }
+
+ /**
* Writes message to the socket.
*
* @param sock Socket.
http://git-wip-us.apache.org/repos/asf/ignite/blob/5f69d262/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
index bf48fcc..d6d484c 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
@@ -44,6 +44,7 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteIllegalStateException;
import org.apache.ignite.Ignition;
+import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
@@ -52,6 +53,7 @@ import org.apache.ignite.events.EventType;
import org.apache.ignite.internal.GridComponent;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
import org.apache.ignite.internal.processors.continuous.StartRoutineAckDiscoveryMessage;
@@ -77,6 +79,7 @@ import org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryStatistics;
import org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage;
+import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryConnectionCheckMessage;
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryCustomEventMessage;
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryMetricsUpdateMessage;
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeAddFinishedMessage;
@@ -2069,6 +2072,42 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
}
/**
+ * @throws Exception If failed.
+ */
+ public void testFailedNodeRestoreConnection() throws Exception {
+ try {
+ TestRestoreConnectedSpi.startTest = false;
+
+ for (int i = 1; i < 5; i++) {
+ nodeSpi.set(new TestRestoreConnectedSpi(3));
+
+ startGrid(i);
+ }
+
+ awaitPartitionMapExchange();
+
+ info("Start fail test");
+
+ TestRestoreConnectedSpi.startTest = true;
+
+ waitNodeStop(getTestIgniteInstanceName(3));
+
+ U.sleep(5000);
+
+ for (int i = 1; i < 5; i++) {
+ if (i != 3) {
+ Ignite node = ignite(i);
+
+ assertEquals(3, node.cluster().nodes().size());
+ }
+ }
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
* @param nodeName Node name.
* @throws Exception If failed.
*/
@@ -2171,6 +2210,77 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
/**
*
*/
+ private static class TestRestoreConnectedSpi extends TcpDiscoverySpi {
+ /** */
+ static volatile boolean startTest;
+
+ /** */
+ private long sleepEndTime;
+
+ /** */
+ private long errNodeOrder;
+
+ /** */
+ private ClusterNode errNext;
+
+ /**
+ * @param errNodeOrder
+ */
+ TestRestoreConnectedSpi(long errNodeOrder) {
+ this.errNodeOrder = errNodeOrder;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeToSocket(ClusterNode node,
+ Socket sock,
+ OutputStream out,
+ TcpDiscoveryAbstractMessage msg,
+ long timeout) throws IOException, IgniteCheckedException {
+ if (startTest && !(msg instanceof TcpDiscoveryConnectionCheckMessage)) {
+ if (node.order() == errNodeOrder) {
+ log.info("Fail write on message send [node=" + node.id() + ", msg=" + msg + ']');
+
+ throw new SocketTimeoutException();
+ }
+ else if (locNode.order() == errNodeOrder) {
+ if (sleepEndTime == 0) {
+ errNext = node;
+
+ sleepEndTime = System.currentTimeMillis() + 3000;
+ }
+
+ long sleepTime = sleepEndTime - System.currentTimeMillis();
+
+ if (sleepTime > 0) {
+ log.info("Start sleep on message send: " + msg);
+
+ try {
+ U.sleep(sleepTime);
+ }
+ catch (IgniteInterruptedCheckedException e) {
+ log.error("Interrupted on socket write: " + e, e);
+
+ throw new IOException(e);
+ }
+
+ log.info("Stop sleep on message send: " + msg);
+
+ if (node.equals(errNext)) {
+ log.info("Fail write after sleep [node=" + node.id() + ", msg=" + msg + ']');
+
+ throw new SocketTimeoutException();
+ }
+ }
+ }
+ }
+
+ super.writeToSocket(node, sock, out, msg, timeout);
+ }
+ }
+
+ /**
+ *
+ */
private static class TestDiscoveryDataDuplicateSpi extends TcpDiscoverySpi {
/** */
static volatile boolean fail;
[39/50] [abbrv] ignite git commit: IGNITE-6713 Ignite Cache 5 flaky
test CacheRebalancingSelfTest.testDisableRebalancing fixed - Fixes #2907.
Posted by sb...@apache.org.
IGNITE-6713 Ignite Cache 5 flaky test CacheRebalancingSelfTest.testDisableRebalancing fixed - Fixes #2907.
Signed-off-by: Alexey Goncharuk <al...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0e77ea12
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0e77ea12
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0e77ea12
Branch: refs/heads/ignite-3478-tree
Commit: 0e77ea1226c8550efdeaf031de8c47ef3153ab31
Parents: 1294bef
Author: dpavlov <dp...@gridgain.com>
Authored: Mon Oct 23 17:16:31 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Oct 23 17:16:31 2017 +0300
----------------------------------------------------------------------
.../cache/CacheRebalancingSelfTest.java | 41 ++++++++++----------
1 file changed, 21 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0e77ea12/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRebalancingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRebalancingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRebalancingSelfTest.java
index 421ff08..e5a836a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRebalancingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRebalancingSelfTest.java
@@ -18,7 +18,8 @@
package org.apache.ignite.internal.processors.cache;
-import com.sun.org.apache.regexp.internal.RE;
+import java.util.HashSet;
+import java.util.Set;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.CachePeekMode;
@@ -31,11 +32,8 @@ import org.apache.ignite.internal.util.future.IgniteFutureImpl;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.testframework.GridTestUtils;
-import static org.apache.ignite.testframework.GridTestUtils.waitForCondition;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import java.util.HashMap;
-import java.util.Map;
import java.util.Random;
/**
@@ -113,39 +111,42 @@ public class CacheRebalancingSelfTest extends GridCommonAbstractTest {
Random r = new Random();
- int totalKeysCount = 10240;
+ int totalKeysCnt = 10240;
- IgniteCache<Integer, Integer> cache = ig0.getOrCreateCache(REBALANCE_TEST_CACHE_NAME);
+ final Set<Integer> keys = new HashSet<>();
+ while (keys.size() < totalKeysCnt)
+ keys.add(r.nextInt());
- for (int i = 0;i < totalKeysCount;i++)
- cache.put(r.nextInt(), 1);
+ IgniteCache<Integer, Integer> cache = ig0.getOrCreateCache(REBALANCE_TEST_CACHE_NAME);
+ for (Integer next : keys)
+ cache.put(next, 1);
- testLocalCacheSize(ig0, 0, totalKeysCount);
- int before_ig1 = testLocalCacheSize(ig1, 0, totalKeysCount);
+ testLocalCacheSize(ig0, 0, totalKeysCnt);
+ int before_ig1 = testLocalCacheSize(ig1, 0, totalKeysCnt);
stopGrid(2);
- testLocalCacheSize(ig0, totalKeysCount, null);
+ testLocalCacheSize(ig0, totalKeysCnt, null);
testLocalCacheSize(ig1, before_ig1, null);
ig1.rebalanceEnabled(true);
- testLocalCacheSize(ig0, totalKeysCount, null);
- testLocalCacheSize(ig1, totalKeysCount, null);
+ testLocalCacheSize(ig0, totalKeysCnt, null);
+ testLocalCacheSize(ig1, totalKeysCnt, null);
}
/**
- * Test if test cache in specified node have correct local size.
+ * Test if test cache in specified node have correct local size. Waits size to became correct for some time.
*
- * @param ignite node to test
- * @param expFrom left bound
- * @param expTo right bound (or {@code null})
- * @return actual local cache size
- * @throws IgniteInterruptedCheckedException
+ * @param ignite node to test.
+ * @param expFrom left bound, or exact value if {@code expTo} is {@code null}.
+ * @param expTo right bound (or {@code null}).
+ * @return actual local cache size.
+ * @throws IgniteInterruptedCheckedException if interrupted.
*/
- private int testLocalCacheSize(IgniteEx ignite, final Integer expFrom, final Integer expTo) throws IgniteInterruptedCheckedException {
+ private int testLocalCacheSize(Ignite ignite, final Integer expFrom, final Integer expTo) throws IgniteInterruptedCheckedException {
final IgniteCache cache = ignite.cache(REBALANCE_TEST_CACHE_NAME);
boolean isOk = GridTestUtils.waitForCondition(new GridAbsPredicate() {
[36/50] [abbrv] ignite git commit: IGNITE-6577 Check temporary file
existence outside lock file during cache start - Fixes #2817.
Posted by sb...@apache.org.
IGNITE-6577 Check temporary file existence outside lock file during cache start - Fixes #2817.
Signed-off-by: Alexey Goncharuk <al...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7a61c15c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7a61c15c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7a61c15c
Branch: refs/heads/ignite-3478-tree
Commit: 7a61c15c746bd77f4bbce05c0db509c467fec68a
Parents: bb31a8a
Author: dpavlov <dp...@gridgain.com>
Authored: Mon Oct 23 17:08:07 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Oct 23 17:08:07 2017 +0300
----------------------------------------------------------------------
.../persistence/file/FilePageStoreManager.java | 62 ++++++++++++--------
.../snapshot/IgniteCacheSnapshotManager.java | 3 +
.../wal/serializer/RecordV2Serializer.java | 3 +-
.../ignite/internal/util/IgniteUtils.java | 62 +++++++++++---------
4 files changed, 76 insertions(+), 54 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7a61c15c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java
index aadcee6..1fe22ca 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java
@@ -28,6 +28,7 @@ import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.file.Files;
import java.nio.file.Path;
+import java.nio.file.StandardCopyOption;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -389,43 +390,52 @@ public class FilePageStoreManager extends GridCacheSharedManagerAdapter implemen
File lockF = new File(cacheWorkDir, IgniteCacheSnapshotManager.SNAPSHOT_RESTORE_STARTED_LOCK_FILENAME);
- if (lockF.exists()) {
- Path tmp = cacheWorkDir.toPath().getParent().resolve(cacheWorkDir.getName() + ".tmp");
+ Path cacheWorkDirPath = cacheWorkDir.toPath();
- boolean deleted = U.delete(cacheWorkDir);
+ Path tmp = cacheWorkDirPath.getParent().resolve(cacheWorkDir.getName() + ".tmp");
- if (Files.exists(tmp) && Files.isDirectory(tmp)) {
- U.warn(log, "Ignite node crashed during the snapshot restore process " +
- "(there is a snapshot restore lock file left for cache). But old version of cache was saved. " +
- "Trying to restore it. Cache - [" + cacheWorkDir.getAbsolutePath() + ']');
+ if (Files.exists(tmp) && Files.isDirectory(tmp) &&
+ Files.exists(tmp.resolve(IgniteCacheSnapshotManager.TEMP_FILES_COMPLETENESS_MARKER))) {
- try {
- Files.move(tmp, cacheWorkDir.toPath());
- }
- catch (IOException e) {
- throw new IgniteCheckedException(e);
- }
- }
- else {
- U.warn(log, "Ignite node crashed during the snapshot restore process " +
- "(there is a snapshot restore lock file left for cache). Will remove both the lock file and " +
- "incomplete cache directory [cacheDir=" + cacheWorkDir.getAbsolutePath() + ']');
+ U.warn(log, "Ignite node crashed during the snapshot restore process " +
+ "(there is a snapshot restore lock file left for cache). But old version of cache was saved. " +
+ "Trying to restore it. Cache - [" + cacheWorkDir.getAbsolutePath() + ']');
- if (!deleted)
- throw new IgniteCheckedException("Failed to remove obsolete cache working directory " +
- "(remove the directory manually and make sure the work folder has correct permissions): " +
- cacheWorkDir.getAbsolutePath());
+ U.delete(cacheWorkDir);
- cacheWorkDir.mkdirs();
+ try {
+ Files.move(tmp, cacheWorkDirPath, StandardCopyOption.ATOMIC_MOVE);
+
+ cacheWorkDirPath.resolve(IgniteCacheSnapshotManager.TEMP_FILES_COMPLETENESS_MARKER).toFile().delete();
+ }
+ catch (IOException e) {
+ throw new IgniteCheckedException(e);
}
+ }
+ else if (lockF.exists()) {
+ U.warn(log, "Ignite node crashed during the snapshot restore process " +
+ "(there is a snapshot restore lock file left for cache). Will remove both the lock file and " +
+ "incomplete cache directory [cacheDir=" + cacheWorkDir.getAbsolutePath() + ']');
- if (!cacheWorkDir.exists())
- throw new IgniteCheckedException("Failed to initialize cache working directory " +
- "(failed to create, make sure the work folder has correct permissions): " +
+ boolean deleted = U.delete(cacheWorkDir);
+
+ if (!deleted)
+ throw new IgniteCheckedException("Failed to remove obsolete cache working directory " +
+ "(remove the directory manually and make sure the work folder has correct permissions): " +
cacheWorkDir.getAbsolutePath());
+
+ cacheWorkDir.mkdirs();
}
else
dirExisted = true;
+
+ if (!cacheWorkDir.exists())
+ throw new IgniteCheckedException("Failed to initialize cache working directory " +
+ "(failed to create, make sure the work folder has correct permissions): " +
+ cacheWorkDir.getAbsolutePath());
+
+ if (Files.exists(tmp))
+ U.delete(tmp);
}
return dirExisted;
http://git-wip-us.apache.org/repos/asf/ignite/blob/7a61c15c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteCacheSnapshotManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteCacheSnapshotManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteCacheSnapshotManager.java
index 50e6515..5746c17 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteCacheSnapshotManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteCacheSnapshotManager.java
@@ -39,6 +39,9 @@ public class IgniteCacheSnapshotManager<T extends SnapshotOperation> extends Gri
/** Snapshot started lock filename. */
public static final String SNAPSHOT_RESTORE_STARTED_LOCK_FILENAME = "snapshot-started.loc";
+ /** Temp files completeness marker. */
+ public static final String TEMP_FILES_COMPLETENESS_MARKER = "finished.tmp";
+
/**
* Try to start local snapshot operation if it's required by discovery event.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/7a61c15c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/serializer/RecordV2Serializer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/serializer/RecordV2Serializer.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/serializer/RecordV2Serializer.java
index 98804d9..5eb45ac 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/serializer/RecordV2Serializer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/serializer/RecordV2Serializer.java
@@ -32,6 +32,7 @@ import org.apache.ignite.internal.processors.cache.persistence.wal.WalSegmentTai
import org.apache.ignite.internal.processors.cache.persistence.wal.serializer.io.RecordIO;
import org.apache.ignite.internal.util.typedef.F;
+import static org.apache.ignite.internal.pagemem.wal.record.WALRecord.*;
import static org.apache.ignite.internal.processors.cache.persistence.wal.serializer.RecordV1Serializer.CRC_SIZE;
import static org.apache.ignite.internal.processors.cache.persistence.wal.serializer.RecordV1Serializer.REC_TYPE_SIZE;
@@ -39,7 +40,7 @@ import static org.apache.ignite.internal.processors.cache.persistence.wal.serial
* Record V2 serializer.
* Stores records in following format:
* <ul>
- * <li>Record type from {@code WALRecord.RecordType} incremented by 1</li>
+ * <li>Record type from {@link RecordType#ordinal()} incremented by 1</li>
* <li>WAL pointer to double check consistency</li>
* <li>Record length</li>
* <li>Data</li>
http://git-wip-us.apache.org/repos/asf/ignite/blob/7a61c15c/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index bdcf87e..d426468 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -3434,7 +3434,6 @@ public abstract class IgniteUtils {
return e;
}
-
/**
* Deletes file or directory with all sub-directories and files.
*
@@ -3443,40 +3442,49 @@ public abstract class IgniteUtils {
* {@code false} otherwise
*/
public static boolean delete(@Nullable File file) {
- if (file == null)
- return false;
-
- boolean res = true;
-
- if (file.isDirectory()) {
- File[] files = file.listFiles();
+ return file != null && delete(file.toPath());
+ }
- if (files != null && files.length > 0) {
- for (File file1 : files) {
- if (file1.isDirectory())
- res &= delete(file1);
- else if (file1.getName().endsWith("jar")) {
- try {
- // Why do we do this?
- new JarFile(file1, false).close();
- }
- catch (IOException ignore) {
- // Ignore it here...
- }
+ /**
+ * Deletes file or directory with all sub-directories and files.
+ *
+ * @param path File or directory to delete.
+ * @return {@code true} if and only if the file or directory is successfully deleted,
+ * {@code false} otherwise
+ */
+ public static boolean delete(Path path) {
+ if (Files.isDirectory(path)) {
+ try {
+ try (DirectoryStream<Path> stream = Files.newDirectoryStream(path)) {
+ for (Path innerPath : stream) {
+ boolean res = delete(innerPath);
- res &= file1.delete();
+ if (!res)
+ return false;
}
- else
- res &= file1.delete();
}
+ } catch (IOException e) {
+ return false;
}
+ }
- res &= file.delete();
+ if (path.endsWith("jar")) {
+ try {
+ // Why do we do this?
+ new JarFile(path.toString(), false).close();
+ }
+ catch (IOException ignore) {
+ // Ignore it here...
+ }
}
- else
- res = file.delete();
- return res;
+ try {
+ Files.delete(path);
+
+ return true;
+ } catch (IOException e) {
+ return false;
+ }
}
/**
[06/50] [abbrv] ignite git commit: IGNITE-6662: SQL: fixed affinity
key field name resolution during both parsig and table creation. This closes
#2875.
Posted by sb...@apache.org.
IGNITE-6662: SQL: fixed affinity key field name resolution during both parsig and table creation. This closes #2875.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bab8acb4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bab8acb4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bab8acb4
Branch: refs/heads/ignite-3478-tree
Commit: bab8acb4cb559dee75e54d86b371b852dbdb22bb
Parents: 5128c25
Author: devozerov <vo...@gridgain.com>
Authored: Wed Oct 18 15:03:28 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Oct 18 15:03:28 2017 +0300
----------------------------------------------------------------------
.../ignite/internal/processors/query/h2/opt/GridH2Table.java | 6 +++++-
.../internal/processors/query/h2/sql/GridSqlQueryParser.java | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bab8acb4/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
index 93da34e..6c353e9 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
@@ -137,8 +137,12 @@ public class GridH2Table extends TableBase {
int affKeyColId = -1;
if (affKey != null) {
- if (doesColumnExist(affKey))
+ if (doesColumnExist(affKey)) {
affKeyColId = getColumn(affKey).getColumnId();
+
+ if (desc.isKeyColumn(affKeyColId))
+ affKeyColId = KEY_COL;
+ }
else
affinityColExists = false;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bab8acb4/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
index bf72200..280fb2d 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
@@ -1104,7 +1104,7 @@ public class GridSqlQueryParser {
if (res.affinityKey() == null) {
LinkedHashSet<String> pkCols0 = res.primaryKeyColumns();
- if (!F.isEmpty(pkCols0) && pkCols0.size() == 1)
+ if (!F.isEmpty(pkCols0) && pkCols0.size() == 1 && wrapKey0)
res.affinityKey(pkCols0.iterator().next());
}
[02/50] [abbrv] ignite git commit: IGNITE-6648 ML javadoc is missing
in 2.2 binary release
Posted by sb...@apache.org.
IGNITE-6648 ML javadoc is missing in 2.2 binary release
(cherry picked from commit ae793a5)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/cc048f08
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/cc048f08
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/cc048f08
Branch: refs/heads/ignite-3478-tree
Commit: cc048f082789fdfba8a8f516282194259067def7
Parents: 93bf555
Author: oleg-ostanin <oo...@gridgain.com>
Authored: Tue Oct 17 15:18:39 2017 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Tue Oct 17 15:20:10 2017 +0300
----------------------------------------------------------------------
parent/pom.xml | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc048f08/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index b133b1e..cb335d12 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -460,6 +460,10 @@
<title>Ignite Development Utils</title>
<packages>org.apache.ignite.development.utils*</packages>
</group>
+ <group>
+ <title>Ignite ML</title>
+ <packages>org.apache.ignite.ml*</packages>
+ </group>
</groups>
<header>
<![CDATA[
[07/50] [abbrv] ignite git commit: IGNITE-6647 Web Console:
Implemented support of schema migration scripts.
Posted by sb...@apache.org.
IGNITE-6647 Web Console: Implemented support of schema migration scripts.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c65399c7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c65399c7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c65399c7
Branch: refs/heads/ignite-3478-tree
Commit: c65399c70136ce08d26de3a63204d931d4f96e9e
Parents: bab8acb
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Thu Oct 19 09:43:20 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Thu Oct 19 09:43:20 2017 +0700
----------------------------------------------------------------------
modules/web-console/DEVNOTES.txt | 6 +++
modules/web-console/backend/index.js | 53 +++++++++++++++-----
.../web-console/backend/migrations/README.txt | 4 ++
modules/web-console/backend/package.json | 1 +
4 files changed, 52 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c65399c7/modules/web-console/DEVNOTES.txt
----------------------------------------------------------------------
diff --git a/modules/web-console/DEVNOTES.txt b/modules/web-console/DEVNOTES.txt
index 85ec958..aa8702e 100644
--- a/modules/web-console/DEVNOTES.txt
+++ b/modules/web-console/DEVNOTES.txt
@@ -27,3 +27,9 @@ How to run console in development mode:
If needed run "npm install --no-optional" (if dependencies changed) and start webpack in development mode "npm run dev".
4. In browser open: http://localhost:9000
+
+How to migrate model:
+
+1. Model will be upgraded on first start.
+2. To downgrade model execute in terminal following command: "./node_modules/.bin/migrate down <migration-name> -d <dbConnectionUri>".
+ Example: "./node_modules/.bin/migrate down add_index -d mongodb://localhost/console".
http://git-wip-us.apache.org/repos/asf/ignite/blob/c65399c7/modules/web-console/backend/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/index.js b/modules/web-console/backend/index.js
index f6ba439..06a38f8 100644
--- a/modules/web-console/backend/index.js
+++ b/modules/web-console/backend/index.js
@@ -17,13 +17,15 @@
'use strict';
+const _ = require('lodash');
const fs = require('fs');
const path = require('path');
const http = require('http');
const https = require('https');
+const MigrateMongoose = require('migrate-mongoose');
const igniteModules = process.env.IGNITE_MODULES ?
- path.join(path.normalize(process.env.IGNITE_MODULES), 'backend') : './ignite_modules';
+ path.join(path.normalize(process.env.IGNITE_MODULES), 'backend') : path.join(__dirname, 'ignite_modules');
let injector;
@@ -35,7 +37,7 @@ try {
injector = require(igniteModulesInjector);
}
catch (ignore) {
- injector = require(path.join(__dirname, './injector'));
+ injector = require(path.join(__dirname, 'injector'));
}
/**
@@ -63,15 +65,6 @@ const _onError = (addr, error) => {
};
/**
- * Event listener for HTTP server "listening" event.
- */
-const _onListening = (addr) => {
- const bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port;
-
- console.log('Start listening on ' + bind);
-};
-
-/**
* @param settings
* @param {ApiServer} apiSrv
* @param {AgentsHandler} agentsHnd
@@ -98,7 +91,43 @@ const init = ([settings, apiSrv, agentsHnd, browsersHnd]) => {
process.send('running');
};
-Promise.all([injector('settings'), injector('api-server'), injector('agents-handler'), injector('browsers-handler')])
+/**
+ * Run mongo model migration.
+ *
+ * @param dbConnectionUri Mongo connection url.
+ * @param group Migrations group.
+ * @param migrationsPath Migrations path.
+ */
+const migrate = (dbConnectionUri, group, migrationsPath) => {
+ const migrator = new MigrateMongoose({
+ migrationsPath,
+ dbConnectionUri,
+ autosync: true
+ });
+
+ console.log(`Running ${group} migrations...`);
+
+ return migrator.run('up')
+ .then(() => console.log(`All ${group} migrations finished successfully.`))
+ .catch((err) => {
+ const msg = _.get(err, 'message');
+
+ if (_.startsWith(msg, 'There are no migrations to run') || _.startsWith(msg, 'There are no pending migrations.')) {
+ console.log(`There are no ${group} migrations to run.`);
+
+ return;
+ }
+
+ throw err;
+ });
+};
+
+injector('settings')
+ .then(({mongoUrl}) => {
+ return migrate(mongoUrl, 'Ignite', path.join(__dirname, 'migrations'))
+ .then(() => migrate(mongoUrl, 'Ignite Modules', path.join(igniteModules, 'migrations')));
+ })
+ .then(() => Promise.all([injector('settings'), injector('api-server'), injector('agents-handler'), injector('browsers-handler')]))
.then(init)
.catch((err) => {
console.error(err);
http://git-wip-us.apache.org/repos/asf/ignite/blob/c65399c7/modules/web-console/backend/migrations/README.txt
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/migrations/README.txt b/modules/web-console/backend/migrations/README.txt
new file mode 100644
index 0000000..e907fad
--- /dev/null
+++ b/modules/web-console/backend/migrations/README.txt
@@ -0,0 +1,4 @@
+Ignite Web Console
+======================================
+
+This folder contains scripts for model migration.
http://git-wip-us.apache.org/repos/asf/ignite/blob/c65399c7/modules/web-console/backend/package.json
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/package.json b/modules/web-console/backend/package.json
index 07af45f..29aa734 100644
--- a/modules/web-console/backend/package.json
+++ b/modules/web-console/backend/package.json
@@ -40,6 +40,7 @@
"glob": "7.1.2",
"jszip": "3.1.3",
"lodash": "4.17.4",
+ "migrate-mongoose": "3.2.2",
"mongoose": "4.11.4",
"morgan": "1.8.2",
"nconf": "0.8.4",
[41/50] [abbrv] ignite git commit: IGNITE-6263 .NET: Verify Java
config parity with a unit test
Posted by sb...@apache.org.
IGNITE-6263 .NET: Verify Java config parity with a unit test
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3be007f3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3be007f3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3be007f3
Branch: refs/heads/ignite-3478-tree
Commit: 3be007f3091adbf0d230ac999684b1cbb5e8ed1a
Parents: 7810970
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Oct 23 17:43:46 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Oct 23 17:43:46 2017 +0300
----------------------------------------------------------------------
.../Apache.Ignite.Core.Tests.csproj | 7 +
.../ApiParity/CacheConfigurationParityTest.cs | 88 ++++++++++++
.../ClientConnectorConfigurationParityTest.cs | 39 ++++++
.../DataRegionConfigurationParityTest.cs | 39 ++++++
.../DataStorageConfigurationParityTest.cs | 53 ++++++++
.../ApiParity/IgniteConfigurationParityTest.cs | 98 ++++++++++++++
.../ApiParity/ParityTest.cs | 135 +++++++++++++++++++
.../QueryEntityConfigurationParityTest.cs | 49 +++++++
8 files changed, 508 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3be007f3/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
index 1d17757..7e1753c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
@@ -69,6 +69,13 @@
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="ApiParity\ClientConnectorConfigurationParityTest.cs" />
+ <Compile Include="ApiParity\DataRegionConfigurationParityTest.cs" />
+ <Compile Include="ApiParity\DataStorageConfigurationParityTest.cs" />
+ <Compile Include="ApiParity\IgniteConfigurationParityTest.cs" />
+ <Compile Include="ApiParity\ParityTest.cs" />
+ <Compile Include="ApiParity\CacheConfigurationParityTest.cs" />
+ <Compile Include="ApiParity\QueryEntityConfigurationParityTest.cs" />
<Compile Include="Binary\BinaryBuilderSelfTestSimpleName.cs" />
<Compile Include="Binary\BinaryDateTimeTest.cs" />
<Compile Include="Binary\BinaryEqualityComparerTest.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/3be007f3/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/CacheConfigurationParityTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/CacheConfigurationParityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/CacheConfigurationParityTest.cs
new file mode 100644
index 0000000..617eb83
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/CacheConfigurationParityTest.cs
@@ -0,0 +1,88 @@
+/*
+ * 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.Tests.ApiParity
+{
+ using System.Collections.Generic;
+ using Apache.Ignite.Core.Cache.Configuration;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Tests that .NET <see cref="CacheConfiguration"/> has all properties from Java configuration APIs.
+ /// </summary>
+ public class CacheConfigurationParityTest
+ {
+ /** Known property name mappings. */
+ private static readonly Dictionary<string, string> KnownMappings = new Dictionary<string, string>
+ {
+ {"isStoreKeepBinary", "KeepBinaryInStore"},
+ {"Affinity", "AffinityFunction"},
+ {"DefaultLockTimeout", "LockTimeout"}
+ };
+
+ /** Properties that are not needed on .NET side. */
+ private static readonly string[] UnneededProperties =
+ {
+ // False matches.
+ "clearQueryEntities",
+
+ // Java-specific.
+ "CacheStoreSessionListenerFactories",
+ "CacheEntryListenerConfigurations",
+ "TopologyValidator",
+ "SqlFunctionClasses",
+ "Interceptor",
+ "EvictionFilter",
+ "IndexedTypes",
+
+ // Deprecated, but not marked so.
+ "AffinityMapper"
+ };
+
+ /** Properties that are missing on .NET side. */
+ private static readonly string[] MissingProperties =
+ {
+ "NodeFilter", // IGNITE-2890
+
+ "KeyConfiguration", // IGNITE-6704
+
+ // IGNITE-6705
+ "IsOnheapCacheEnabled",
+ "StoreConcurrentLoadAllThreshold",
+ "RebalanceOrder",
+ "RebalanceBatchesPrefetchCount",
+ "MaxQueryIteratorsCount",
+ "QueryDetailMetricsSize",
+ "SqlSchema",
+ "QueryParallelism"
+ };
+
+ /// <summary>
+ /// Tests the cache configuration parity.
+ /// </summary>
+ [Test]
+ public void TestCacheConfiguration()
+ {
+ ParityTest.CheckConfigurationParity(
+ @"modules\core\src\main\java\org\apache\ignite\configuration\CacheConfiguration.java",
+ typeof(CacheConfiguration),
+ UnneededProperties,
+ MissingProperties,
+ KnownMappings);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3be007f3/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/ClientConnectorConfigurationParityTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/ClientConnectorConfigurationParityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/ClientConnectorConfigurationParityTest.cs
new file mode 100644
index 0000000..f735557
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/ClientConnectorConfigurationParityTest.cs
@@ -0,0 +1,39 @@
+/*
+ * 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.Tests.ApiParity
+{
+ using Apache.Ignite.Core.Configuration;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Tests that .NET <see cref="ClientConnectorConfiguration"/> has all properties from Java configuration APIs.
+ /// </summary>
+ public class ClientConnectorConfigurationParityTest
+ {
+ /// <summary>
+ /// Tests the ignite configuration parity.
+ /// </summary>
+ [Test]
+ public void TestConnectorConfiguration()
+ {
+ ParityTest.CheckConfigurationParity(
+ @"modules\core\src\main\java\org\apache\ignite\configuration\ClientConnectorConfiguration.java",
+ typeof(ClientConnectorConfiguration));
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/3be007f3/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/DataRegionConfigurationParityTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/DataRegionConfigurationParityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/DataRegionConfigurationParityTest.cs
new file mode 100644
index 0000000..dbc4686
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/DataRegionConfigurationParityTest.cs
@@ -0,0 +1,39 @@
+/*
+ * 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.Tests.ApiParity
+{
+ using Apache.Ignite.Core.Configuration;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Tests that .NET <see cref="DataRegionConfiguration"/> has all properties from Java configuration APIs.
+ /// </summary>
+ public class DataRegionConfigurationParityTest
+ {
+ /// <summary>
+ /// Tests the ignite configuration parity.
+ /// </summary>
+ [Test]
+ public void TestRegionConfiguration()
+ {
+ ParityTest.CheckConfigurationParity(
+ @"modules\core\src\main\java\org\apache\ignite\configuration\DataRegionConfiguration.java",
+ typeof(DataRegionConfiguration));
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/3be007f3/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/DataStorageConfigurationParityTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/DataStorageConfigurationParityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/DataStorageConfigurationParityTest.cs
new file mode 100644
index 0000000..db53e2e
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/DataStorageConfigurationParityTest.cs
@@ -0,0 +1,53 @@
+/*
+ * 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.Tests.ApiParity
+{
+ using Apache.Ignite.Core.Configuration;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Tests that .NET <see cref="DataStorageConfiguration"/> has all properties from Java configuration APIs.
+ /// </summary>
+ public class DataStorageConfigurationParityTest
+ {
+ /** Properties that are not needed on .NET side. */
+ private static readonly string[] UnneededProperties =
+ {
+ "FileIOFactory"
+ };
+
+ /** Properties that are missing on .NET side. */
+ private static readonly string[] MissingProperties =
+ {
+ "WalAutoArchiveAfterInactivity"
+ };
+
+ /// <summary>
+ /// Tests the ignite configuration parity.
+ /// </summary>
+ [Test]
+ public void TestStorageConfiguration()
+ {
+ ParityTest.CheckConfigurationParity(
+ @"modules\core\src\main\java\org\apache\ignite\configuration\DataStorageConfiguration.java",
+ typeof(DataStorageConfiguration),
+ UnneededProperties,
+ MissingProperties);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/3be007f3/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/IgniteConfigurationParityTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/IgniteConfigurationParityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/IgniteConfigurationParityTest.cs
new file mode 100644
index 0000000..235b177
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/IgniteConfigurationParityTest.cs
@@ -0,0 +1,98 @@
+/*
+ * 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.Tests.ApiParity
+{
+ using System.Collections.Generic;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Tests that .NET <see cref="IgniteConfiguration"/> has all properties from Java configuration APIs.
+ /// </summary>
+ public class IgniteConfigurationParityTest
+ {
+ /** Known property name mappings Java -> .NET. */
+ private static readonly Dictionary<string, string> KnownMappings = new Dictionary<string, string>
+ {
+ {"GridLogger", "Logger"},
+ {"IncludeEventTypes", "IncludedEventTypes"},
+ };
+
+ /** Properties that are not needed on .NET side. */
+ private static readonly string[] UnneededProperties =
+ {
+ "PeerClassLoadingThreadPoolSize",
+ "IgfsThreadPoolSize",
+ "UtilityCacheKeepAliveTime",
+ "MBeanServer",
+ "isPeerClassLoadingEnabled",
+ "isMarshalLocalJobs",
+ "PeerClassLoadingLocalClassPathExclude",
+ "LifecycleBeans",
+ "SslContextFactory",
+ "SegmentationResolvers",
+ "CollisionSpi",
+ "DeploymentSpi",
+ "CheckpointSpi",
+ "FailoverSpi",
+ "LoadBalancingSpi",
+ "IndexingSpi",
+ "AddressResolver",
+ "DeploymentMode",
+ "PeerClassLoadingMissedResourcesCacheSize",
+ "CacheKeyConfiguration",
+ "FileSystemConfiguration",
+ "HadoopConfiguration",
+ "ConnectorConfiguration",
+ "ServiceConfiguration",
+ "WarmupClosure",
+ "ClassLoader",
+ "CacheStoreSessionListenerFactories",
+ "PlatformConfiguration",
+ "ExecutorConfiguration"
+ };
+
+ /** Properties that are missing on .NET side. */
+ private static readonly string[] MissingProperties =
+ {
+ "RebalanceThreadPoolSize",
+ "SegmentationPolicy",
+ "isWaitForSegmentOnStart",
+ "isAllSegmentationResolversPassRequired",
+ "SegmentationResolveAttempts",
+ "SegmentCheckFrequency",
+ "isCacheSanityCheckEnabled",
+ "TimeServerPortBase",
+ "TimeServerPortRange",
+ "IncludeProperties"
+ };
+
+ /// <summary>
+ /// Tests the ignite configuration parity.
+ /// </summary>
+ [Test]
+ public void TestIgniteConfiguration()
+ {
+ ParityTest.CheckConfigurationParity(
+ @"modules\core\src\main\java\org\apache\ignite\configuration\IgniteConfiguration.java",
+ typeof(IgniteConfiguration),
+ UnneededProperties,
+ MissingProperties,
+ KnownMappings);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/3be007f3/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/ParityTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/ParityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/ParityTest.cs
new file mode 100644
index 0000000..068d22e
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/ParityTest.cs
@@ -0,0 +1,135 @@
+/*
+ * 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.Tests.ApiParity
+{
+ using System;
+ using System.Collections.Generic;
+ using System.IO;
+ using System.Linq;
+ using System.Text;
+ using System.Text.RegularExpressions;
+ using Apache.Ignite.Core.Impl.Common;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Base class for API parity tests.
+ /// </summary>
+ public static class ParityTest
+ {
+ /** Property regex. */
+ private static readonly Regex JavaPropertyRegex =
+ new Regex("(@Deprecated)?\\s+public [^=^\r^\n]+ (\\w+)\\(\\) {", RegexOptions.Compiled);
+
+ /** Properties that are not needed on .NET side. */
+ private static readonly string[] UnneededProperties =
+ {
+ "toString",
+ "hashCode",
+ "writeReplace"
+ };
+
+ /// <summary>
+ /// Tests the configuration parity.
+ /// </summary>
+ public static void CheckConfigurationParity(string javaFilePath,
+ Type type,
+ IEnumerable<string> excludedProperties = null,
+ IEnumerable<string> knownMissingProperties = null,
+ Dictionary<string, string> knownMappings = null)
+ {
+ var path = Path.Combine(IgniteHome.Resolve(null), javaFilePath);
+
+ Assert.IsTrue(File.Exists(path));
+
+ var dotNetProperties = type.GetProperties()
+ .ToDictionary(x => x.Name, x => x, StringComparer.OrdinalIgnoreCase);
+
+ var javaProperties = GetJavaProperties(path)
+ .Except(excludedProperties ?? Enumerable.Empty<string>());
+
+ var missingProperties = javaProperties
+ .Where(jp => !GetNameVariants(jp, knownMappings).Any(dotNetProperties.ContainsKey))
+ .ToDictionary(x => x, x => x, StringComparer.OrdinalIgnoreCase);
+
+ var knownMissing = (knownMissingProperties ?? Enumerable.Empty<string>())
+ .ToDictionary(x => x, x => x, StringComparer.OrdinalIgnoreCase);
+
+ var sb = new StringBuilder();
+
+ foreach (var javaMissingProp in missingProperties)
+ {
+ if (!knownMissing.ContainsKey(javaMissingProp.Key))
+ {
+ sb.AppendFormat("{0}.{1} property is missing in .NET.\n", type.Name, javaMissingProp.Key);
+ }
+ }
+
+ foreach (var dotnetMissingProp in knownMissing)
+ {
+ if (!missingProperties.ContainsKey(dotnetMissingProp.Key))
+ {
+ sb.AppendFormat("{0}.{1} property is missing in Java, but is specified as known in .NET.\n",
+ type.Name, dotnetMissingProp.Key);
+ }
+ }
+
+ if (sb.Length > 0)
+ {
+ Assert.Fail(sb.ToString());
+ }
+ }
+
+ /// <summary>
+ /// Gets the java properties from file.
+ /// </summary>
+ private static IEnumerable<string> GetJavaProperties(string path)
+ {
+ var text = File.ReadAllText(path);
+
+ return JavaPropertyRegex.Matches(text)
+ .OfType<Match>()
+ .Where(m => m.Groups[1].Value == string.Empty)
+ .Select(m => m.Groups[2].Value.Replace("get", ""))
+ .Where(x => !x.Contains(" void "))
+ .Except(UnneededProperties);
+ }
+
+ /// <summary>
+ /// Gets the name variants for a property.
+ /// </summary>
+ private static IEnumerable<string> GetNameVariants(string javaPropertyName,
+ IDictionary<string, string> knownMappings)
+ {
+ yield return javaPropertyName;
+
+ yield return javaPropertyName.Replace("PoolSize", "ThreadPoolSize");
+
+ if (javaPropertyName.StartsWith("is"))
+ {
+ yield return javaPropertyName.Substring(2);
+ }
+
+ string map;
+
+ if (knownMappings != null && knownMappings.TryGetValue(javaPropertyName, out map))
+ {
+ yield return map;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3be007f3/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/QueryEntityConfigurationParityTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/QueryEntityConfigurationParityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/QueryEntityConfigurationParityTest.cs
new file mode 100644
index 0000000..e186612
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/QueryEntityConfigurationParityTest.cs
@@ -0,0 +1,49 @@
+/*
+ * 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.Tests.ApiParity
+{
+ using Apache.Ignite.Core.Cache.Configuration;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Tests that .NET <see cref="QueryEntity"/> has all properties from Java configuration APIs.
+ /// </summary>
+ public class QueryEntityConfigurationParityTest
+ {
+ /** Properties that are not needed on .NET side. */
+ private static readonly string[] UnneededProperties =
+ {
+ "findKeyType",
+ "findValueType",
+ "KeyFields",
+ "NotNullFields"
+ };
+
+ /// <summary>
+ /// Tests the ignite configuration parity.
+ /// </summary>
+ [Test]
+ public void TestQueryEntityConfiguration()
+ {
+ ParityTest.CheckConfigurationParity(
+ @"modules\core\src\main\java\org\apache\ignite\cache\QueryEntity.java",
+ typeof(QueryEntity),
+ UnneededProperties);
+ }
+ }
+}
\ No newline at end of file
[24/50] [abbrv] ignite git commit: IGNITE-6030 Allow enabling
persistence per data region
Posted by sb...@apache.org.
IGNITE-6030 Allow enabling persistence per data region
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ec41370c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ec41370c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ec41370c
Branch: refs/heads/ignite-3478-tree
Commit: ec41370c4da65c01e9b7c584e0706c40e4171b35
Parents: 173ecef
Author: Ivan Rakov <iv...@gmail.com>
Authored: Fri Oct 20 10:29:57 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Oct 20 10:29:57 2017 +0300
----------------------------------------------------------------------
examples/config/example-data-regions.xml | 106 +++
examples/config/example-memory-policies.xml | 108 ---
.../example-persistent-store.xml | 14 +-
.../examples/datagrid/DataRegionsExample.java | 113 +++
.../datagrid/MemoryPoliciesExample.java | 114 ---
.../ignite/examples/CacheExamplesSelfTest.java | 6 +-
.../benchmarks/jmh/tree/BPlusTreeBenchmark.java | 8 +-
.../DummyPersistenceCompatibilityTest.java | 8 +-
.../org/apache/ignite/DataRegionMetrics.java | 119 +++
.../apache/ignite/DataRegionMetricsAdapter.java | 106 +++
.../org/apache/ignite/DataStorageMetrics.java | 114 +++
.../ignite/DataStorageMetricsAdapter.java | 101 +++
.../src/main/java/org/apache/ignite/Ignite.java | 48 +-
.../apache/ignite/IgniteSystemProperties.java | 4 +-
.../java/org/apache/ignite/MemoryMetrics.java | 11 +-
.../org/apache/ignite/PersistenceMetrics.java | 4 +-
.../configuration/CacheConfiguration.java | 36 +-
.../configuration/DataPageEvictionMode.java | 8 +-
.../configuration/DataRegionConfiguration.java | 406 +++++++++
.../configuration/DataStorageConfiguration.java | 882 +++++++++++++++++++
.../configuration/IgniteConfiguration.java | 46 +-
.../configuration/MemoryConfiguration.java | 9 +-
.../MemoryPolicyConfiguration.java | 32 +-
.../PersistentStoreConfiguration.java | 4 +-
.../org/apache/ignite/igfs/IgfsMetrics.java | 4 +-
.../apache/ignite/internal/IgniteKernal.java | 77 +-
.../ignite/internal/IgniteNodeAttributes.java | 4 +
.../org/apache/ignite/internal/IgnitionEx.java | 132 ++-
.../ignite/internal/MarshallerContextImpl.java | 3 +-
.../discovery/GridDiscoveryManager.java | 31 +-
.../pagemem/impl/PageMemoryNoStoreImpl.java | 32 +-
.../cache/CacheAffinitySharedManager.java | 4 +-
.../processors/cache/CacheGroupContext.java | 29 +-
.../processors/cache/CacheGroupData.java | 17 +-
.../processors/cache/CacheGroupDescriptor.java | 19 +-
.../processors/cache/ClusterCachesInfo.java | 13 +-
.../processors/cache/GridCacheAdapter.java | 3 +-
.../processors/cache/GridCacheContext.java | 8 +-
.../processors/cache/GridCacheMapEntry.java | 10 +-
.../processors/cache/GridCacheProcessor.java | 55 +-
.../processors/cache/GridCacheUtils.java | 55 ++
.../cache/IgniteCacheOffheapManagerImpl.java | 6 +-
.../cache/binary/BinaryMetadataFileStore.java | 7 +-
.../GridDistributedTxRemoteAdapter.java | 5 +-
.../distributed/dht/GridDhtLocalPartition.java | 2 +-
.../dht/atomic/GridDhtAtomicCache.java | 3 +-
.../distributed/near/GridNearGetRequest.java | 2 +-
.../distributed/near/GridNearLockRequest.java | 2 +-
.../cache/distributed/near/GridNearTxLocal.java | 2 +-
.../near/GridNearTxPrepareRequest.java | 2 +-
.../local/atomic/GridLocalAtomicCache.java | 2 +-
.../cache/persistence/CacheDataRowAdapter.java | 2 +-
.../cache/persistence/DataRegion.java | 84 ++
.../persistence/DataRegionMetricsImpl.java | 286 ++++++
.../DataRegionMetricsMXBeanImpl.java | 131 +++
.../persistence/DataRegionMetricsSnapshot.java | 112 +++
.../persistence/DataStorageMetricsImpl.java | 297 +++++++
.../persistence/DataStorageMetricsSnapshot.java | 144 +++
.../GridCacheDatabaseSharedManager.java | 166 ++--
.../persistence/GridCacheOffheapManager.java | 22 +-
.../IgniteCacheDatabaseSharedManager.java | 538 +++++------
.../cache/persistence/MemoryMetricsImpl.java | 286 ------
.../persistence/MemoryMetricsMXBeanImpl.java | 131 ---
.../persistence/MemoryMetricsSnapshot.java | 112 ---
.../cache/persistence/MemoryPolicy.java | 84 --
.../persistence/PersistenceMetricsImpl.java | 297 -------
.../persistence/PersistenceMetricsSnapshot.java | 144 ---
.../processors/cache/persistence/RowStore.java | 38 +-
.../evict/FairFifoPageEvictionTracker.java | 6 +-
.../evict/PageAbstractEvictionTracker.java | 6 +-
.../evict/Random2LruPageEvictionTracker.java | 8 +-
.../evict/RandomLruPageEvictionTracker.java | 8 +-
.../persistence/file/AsyncFileIOFactory.java | 28 +-
.../cache/persistence/file/FilePageStore.java | 6 +-
.../persistence/file/FilePageStoreManager.java | 12 +-
.../cache/persistence/file/FilePageStoreV2.java | 4 +-
.../file/FileVersionCheckingFactory.java | 6 +-
.../filename/PdsConsistentIdProcessor.java | 11 +-
.../persistence/freelist/FreeListImpl.java | 12 +-
.../cache/persistence/freelist/PagesList.java | 7 +-
.../persistence/pagemem/PageMemoryImpl.java | 8 +-
.../wal/FileWriteAheadLogManager.java | 77 +-
.../wal/reader/IgniteWalIteratorFactory.java | 12 +-
.../wal/reader/StandaloneGridKernalContext.java | 11 +-
.../cache/ratemetrics/HitRateMetrics.java | 2 +-
.../transactions/IgniteTxLocalAdapter.java | 2 +-
.../processors/cache/tree/CacheDataTree.java | 4 +-
.../cache/tree/PendingEntriesTree.java | 2 +-
.../cluster/GridClusterStateProcessor.java | 3 +-
.../processors/igfs/IgfsDataManager.java | 4 +-
.../processors/query/GridQueryProcessor.java | 3 +-
.../visor/cache/VisorCacheConfiguration.java | 8 +-
.../visor/cache/VisorMemoryMetrics.java | 6 +-
.../node/VisorDataRegionConfiguration.java | 225 +++++
.../node/VisorDataStorageConfiguration.java | 453 ++++++++++
.../visor/node/VisorGridConfiguration.java | 29 +-
.../visor/node/VisorMemoryConfiguration.java | 26 +-
.../node/VisorMemoryPolicyConfiguration.java | 10 +-
.../visor/node/VisorNodeDataCollectorJob.java | 6 +-
.../node/VisorNodeDataCollectorJobResult.java | 4 +-
.../node/VisorNodeDataCollectorTaskResult.java | 4 +-
.../visor/node/VisorPersistenceMetrics.java | 6 +-
.../node/VisorPersistentStoreConfiguration.java | 22 +-
.../ignite/mxbean/DataRegionMetricsMXBean.java | 139 +++
.../ignite/mxbean/DataStorageMetricsMXBean.java | 121 +++
.../ignite/mxbean/MemoryMetricsMXBean.java | 2 +
.../ignite/mxbean/PersistenceMetricsMXBean.java | 2 +
.../resources/META-INF/classnames.properties | 6 +-
.../core/src/test/config/examples.properties | 2 +-
.../ignite/cache/LargeEntryUpdateTest.java | 6 +-
.../internal/ClusterNodeMetricsSelfTest.java | 8 +-
.../IgniteSlowClientDetectionSelfTest.java | 6 +-
.../pagemem/impl/PageMemoryNoLoadSelfTest.java | 8 +-
.../cache/CacheClientStoreSelfTest.java | 4 +-
.../cache/CacheConfigurationLeakTest.java | 15 +-
.../cache/CacheDataRegionConfigurationTest.java | 172 ++++
.../CacheMemoryPolicyConfigurationTest.java | 172 ----
.../cache/CacheStopAndDestroySelfTest.java | 10 +-
...StorageConfigurationConsistencySelfTest.java | 79 ++
...dMemoryConfigurationConsistencySelfTest.java | 79 --
.../IgniteClusterActivateDeactivateTest.java | 32 +-
...erActivateDeactivateTestWithPersistence.java | 30 +-
.../cache/MemoryPolicyConfigValidationTest.java | 24 +-
...AffinityCoordinatorDynamicStartStopTest.java | 15 +-
.../distributed/Cache64kPartitionsTest.java | 14 +-
.../CacheLateAffinityAssignmentTest.java | 9 +-
.../cache/distributed/CacheStartOnJoinTest.java | 9 +-
.../paged/PageEvictionAbstractTest.java | 25 +-
.../expiry/IgniteCacheLargeValueExpireTest.java | 6 +-
.../IgniteDataStorageMetricsSelfTest.java | 237 +++++
...tePdsBinaryMetadataOnClusterRestartTest.java | 10 +-
.../IgnitePdsCacheRebalancingAbstractTest.java | 25 +-
.../IgnitePdsClientNearCachePutGetTest.java | 6 +-
.../IgnitePdsContinuousRestartTest.java | 28 +-
.../persistence/IgnitePdsDynamicCacheTest.java | 28 +-
.../IgnitePdsExchangeDuringCheckpointTest.java | 41 +-
...MarshallerMappingRestoreOnNodeStartTest.java | 6 +-
.../IgnitePdsMultiNodePutGetRestartTest.java | 24 +-
.../persistence/IgnitePdsPageSizesTest.java | 29 +-
...gnitePdsRecoveryAfterFileCorruptionTest.java | 39 +-
.../IgnitePdsRemoveDuringRebalancingTest.java | 35 +-
...gnitePdsSingleNodePutGetPersistenceTest.java | 6 +-
.../IgnitePersistenceMetricsSelfTest.java | 225 -----
...nitePersistenceSequentialCheckpointTest.java | 6 +-
.../IgnitePersistentStoreCacheGroupsTest.java | 16 +-
...IgnitePersistentStoreDataStructuresTest.java | 23 +-
.../MemoryPolicyInitializationTest.java | 22 +-
.../db/IgnitePdsCacheRestoreTest.java | 45 +-
.../db/IgnitePdsMultiNodePutGetRestartTest.java | 23 +-
...PdsPageEvictionDuringPartitionClearTest.java | 29 +-
.../db/IgnitePdsPageEvictionTest.java | 30 +-
...tePdsRebalancingOnNotStableTopologyTest.java | 28 +-
.../db/IgnitePdsTransactionsHangTest.java | 26 +-
.../db/IgnitePdsWholeClusterRestartTest.java | 26 +-
...faultPageSizeBackwardsCompatibilityTest.java | 21 +-
.../db/file/IgnitePdsCacheIntegrationTest.java | 29 +-
...ckpointSimulationWithRealCpDisabledTest.java | 25 +-
.../db/file/IgnitePdsEvictionTest.java | 25 +-
.../file/IgnitePdsNoActualWalHistoryTest.java | 22 +-
.../file/IgnitePdsThreadInterruptionTest.java | 51 +-
.../IgniteUidAsConsistentIdMigrationTest.java | 28 +-
.../persistence/db/wal/IgnitePdsWalTlbTest.java | 30 +-
.../db/wal/IgniteWalFlushFailoverTest.java | 29 +-
.../wal/IgniteWalHistoryReservationsTest.java | 26 +-
.../db/wal/IgniteWalRecoveryPPCTest.java | 321 +++++++
.../IgniteWalRecoverySeveralRestartsTest.java | 29 +-
.../db/wal/IgniteWalRecoveryTest.java | 33 +-
.../db/wal/IgniteWalSerializerVersionTest.java | 8 +-
.../db/wal/WalRecoveryTxLogicalRecordsTest.java | 18 +-
.../db/wal/reader/IgniteWalReaderTest.java | 50 +-
.../db/wal/reader/MockWalIteratorFactory.java | 14 +-
.../pagemem/BPlusTreePageMemoryImplTest.java | 6 +-
.../BPlusTreeReuseListPageMemoryImplTest.java | 6 +-
.../MetadataStoragePageMemoryImplTest.java | 6 +-
.../pagemem/PageMemoryImplNoLoadTest.java | 6 +-
.../persistence/pagemem/PageMemoryImplTest.java | 6 +-
.../pagemem/PagesWriteThrottleSandboxTest.java | 40 +-
.../pagemem/PagesWriteThrottleSmokeTest.java | 42 +-
.../AbstractNodeJoinTemplate.java | 8 +-
.../IgniteChangeGlobalStateAbstractTest.java | 31 +-
.../IgniteChangeGlobalStateServiceTest.java | 2 +
.../IgniteStandByClusterTest.java | 12 +-
.../extended/GridActivateExtensionTest.java | 34 +-
...gniteAbstractStandByClientReconnectTest.java | 9 +-
...niteCacheContinuousQueryBackupQueueTest.java | 6 +-
.../cache/transactions/TxDeadlockCauseTest.java | 15 +-
.../TxPessimisticDeadlockDetectionTest.java | 21 +-
.../processors/database/BPlusTreeSelfTest.java | 8 +-
.../database/DataRegionMetricsSelfTest.java | 348 ++++++++
.../database/FreeListImplSelfTest.java | 16 +-
.../database/IgniteDbAbstractTest.java | 10 +-
.../database/IgniteDbDynamicCacheSelfTest.java | 18 +-
.../IgniteDbMemoryLeakAbstractTest.java | 14 +-
.../database/MemoryMetricsSelfTest.java | 348 --------
.../database/MetadataStorageSelfTest.java | 8 +-
.../database/SwapPathConstructionSelfTest.java | 28 +-
.../processors/igfs/IgfsIgniteMock.java | 25 +-
.../processors/igfs/IgfsSizeSelfTest.java | 12 +-
.../ignite/testframework/junits/IgniteMock.java | 25 +-
.../junits/multijvm/IgniteProcessProxy.java | 25 +-
.../ignite/testsuites/IgniteBasicTestSuite.java | 4 +-
.../ignite/testsuites/IgniteCacheTestSuite.java | 4 +-
.../testsuites/IgniteCacheTestSuite2.java | 4 +-
.../ignite/testsuites/IgnitePdsTestSuite2.java | 4 +-
.../query/h2/database/H2TreeIndex.java | 2 +-
...leNodeWithIndexingPutGetPersistenceTest.java | 6 +-
...stributedPartitionQueryAbstractSelfTest.java | 8 +-
.../IgniteCacheQueryNodeRestartSelfTest2.java | 8 +-
.../cache/index/DynamicColumnsAbstractTest.java | 16 +-
.../index/DynamicIndexAbstractSelfTest.java | 16 +-
.../cache/index/LongIndexNameTest.java | 4 +-
...eDbSingleNodeWithIndexingWalRestoreTest.java | 11 +-
...oreQueryWithMultipleClassesPerCacheTest.java | 8 +-
.../IgnitePersistentStoreSchemaLoadTest.java | 13 +-
.../query/IgniteSqlNotNullConstraintTest.java | 4 +-
.../h2/database/InlineIndexHelperTest.java | 20 +-
.../IgnitePdsWithIndexingCoreTestSuite.java | 3 +
.../IgniteConfigurationTest.cs | 2 -
.../http/jetty/GridJettyObjectMapper.java | 3 +
.../org/apache/ignite/IgniteSpringBean.java | 27 +-
.../top/VisorActivationCommandSpec.scala | 13 +-
modules/web-console/backend/app/mongo.js | 55 ++
.../page-configure-basic/controller.js | 10 +-
.../generator/AbstractTransformer.js | 5 +
.../generator/ConfigurationGenerator.js | 108 ++-
.../generator/defaults/Cluster.service.js | 40 +
.../configuration/clusters/data-storage.pug | 255 ++++++
.../states/configuration/clusters/memory.pug | 4 +-
.../configuration/clusters/persistence.pug | 4 +-
.../frontend/app/services/Clusters.js | 6 +
.../frontend/app/services/Version.service.js | 6 +-
.../frontend/controllers/clusters-controller.js | 69 +-
.../views/configuration/clusters.tpl.pug | 8 +-
.../yardstick/IgniteBenchmarkArguments.java | 8 +-
.../org/apache/ignite/yardstick/IgniteNode.java | 15 +-
235 files changed, 7661 insertions(+), 3865 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/examples/config/example-data-regions.xml
----------------------------------------------------------------------
diff --git a/examples/config/example-data-regions.xml b/examples/config/example-data-regions.xml
new file mode 100644
index 0000000..4ce71ef
--- /dev/null
+++ b/examples/config/example-data-regions.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<!--
+ Ignite configuration with all defaults, enabled p2p deployment and special data regions.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:util="http://www.springframework.org/schema/util"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/util
+ http://www.springframework.org/schema/util/spring-util.xsd">
+ <bean class="org.apache.ignite.configuration.IgniteConfiguration">
+ <!-- Set to true to enable distributed class loading for examples, default is false. -->
+ <property name="peerClassLoadingEnabled" value="true"/>
+
+ <property name="dataStorageConfiguration">
+ <bean class="org.apache.ignite.configuration.DataStorageConfiguration">
+ <!--
+ Default memory region that grows endlessly. A cache is bound to this memory region
+ unless it sets another one in its CacheConfiguration.
+ -->
+ <property name="defaultDataRegionConfiguration">
+ <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
+ <property name="name" value="Default_Region"/>
+ <!-- 100 MB memory region with disabled eviction -->
+ <property name="initialSize" value="#{100 * 1024 * 1024}"/>
+ </bean>
+ </property>
+
+ <!-- Defining several data regions for different memory regions -->
+ <property name="dataRegionConfigurations">
+ <list>
+ <!--
+ Memory region of 40 MBs in size with an eviction enabled.
+ -->
+ <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
+ <property name="name" value="40MB_Region_Eviction"/>
+ <!-- Memory region of 20 MB initial size. -->
+ <property name="initialSize" value="#{20 * 1024 * 1024}"/>
+ <!-- Maximum size is 40 MB. -->
+ <property name="maxSize" value="#{40 * 1024 * 1024}"/>
+ <!-- Enabling eviction for this memory region -->
+ <property name="pageEvictionMode" value="RANDOM_2_LRU"/>
+ </bean>
+
+ <!--
+ This memory region is backed by a memory-mapped file which names is passed via
+ 'swapFilePath' parameter.
+ -->
+ <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
+ <property name="name" value="30MB_Region_Swapping"/>
+ <!-- Memory region of 15 MB initial size. -->
+ <property name="initialSize" value="#{15 * 1024 * 1024}"/>
+ <!-- Maximum size is 30 MB. -->
+ <property name="maxSize" value="#{30 * 1024 * 1024}"/>
+ <!-- Setting a name of the swapping file. -->
+ <property name="swapPath" value="dataRegionExampleSwap"/>
+ </bean>
+ </list>
+ </property>
+ </bean>
+ </property>
+
+ <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
+ <property name="discoverySpi">
+ <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+ <property name="ipFinder">
+ <!--
+ Ignite provides several options for automatic discovery that can be used
+ instead os static IP based discovery. For information on all options refer
+ to our documentation: http://apacheignite.readme.io/docs/cluster-config
+ -->
+ <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
+ <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
+ <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
+ <property name="addresses">
+ <list>
+ <!-- In distributed environment, replace with actual host IP address. -->
+ <value>127.0.0.1:47500..47509</value>
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+ </property>
+ </bean>
+</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/examples/config/example-memory-policies.xml
----------------------------------------------------------------------
diff --git a/examples/config/example-memory-policies.xml b/examples/config/example-memory-policies.xml
deleted file mode 100644
index 122300f..0000000
--- a/examples/config/example-memory-policies.xml
+++ /dev/null
@@ -1,108 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<!--
- Ignite configuration with all defaults, enabled p2p deployment and special memory policies.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd">
- <bean class="org.apache.ignite.configuration.IgniteConfiguration">
- <!-- Set to true to enable distributed class loading for examples, default is false. -->
- <property name="peerClassLoadingEnabled" value="true"/>
-
- <property name="memoryConfiguration">
- <bean class="org.apache.ignite.configuration.MemoryConfiguration">
- <!-- Setting a name of the default memory policy. Required to set only if the default policy's
- parameters are overridden like it's done below. -->
- <property name="defaultMemoryPolicyName" value="Default_Region"/>
-
- <!-- Defining several memory policies for different memory regions -->
- <property name="memoryPolicies">
- <list>
- <!--
- Default memory region that grows endlessly. A cache is bound to this memory region
- unless it sets another one in its CacheConfiguration.
- -->
- <bean class="org.apache.ignite.configuration.MemoryPolicyConfiguration">
- <property name="name" value="Default_Region"/>
- <!-- 100 MB memory region with disabled eviction -->
- <property name="initialSize" value="#{100 * 1024 * 1024}"/>
- </bean>
-
- <!--
- Memory region of 40 MBs in size with an eviction enabled.
- -->
- <bean class="org.apache.ignite.configuration.MemoryPolicyConfiguration">
- <property name="name" value="40MB_Region_Eviction"/>
- <!-- Memory region of 20 MB initial size. -->
- <property name="initialSize" value="#{20 * 1024 * 1024}"/>
- <!-- Maximum size is 40 MB. -->
- <property name="maxSize" value="#{40 * 1024 * 1024}"/>
- <!-- Enabling eviction for this memory region -->
- <property name="pageEvictionMode" value="RANDOM_2_LRU"/>
- </bean>
-
- <!--
- This memory region is backed by a memory-mapped file which names is passed via
- 'swapFilePath' parameter.
- -->
- <bean class="org.apache.ignite.configuration.MemoryPolicyConfiguration">
- <property name="name" value="30MB_Region_Swapping"/>
- <!-- Memory region of 15 MB initial size. -->
- <property name="initialSize" value="#{15 * 1024 * 1024}"/>
- <!-- Maximum size is 30 MB. -->
- <property name="maxSize" value="#{30 * 1024 * 1024}"/>
- <!-- Setting a name of the swapping file. -->
- <property name="swapFilePath" value="memoryPolicyExampleSwap"/>
- </bean>
- </list>
- </property>
- </bean>
- </property>
-
- <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <!--
- Ignite provides several options for automatic discovery that can be used
- instead os static IP based discovery. For information on all options refer
- to our documentation: http://apacheignite.readme.io/docs/cluster-config
- -->
- <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
- <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47509</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/examples/config/persistentstore/example-persistent-store.xml
----------------------------------------------------------------------
diff --git a/examples/config/persistentstore/example-persistent-store.xml b/examples/config/persistentstore/example-persistent-store.xml
index 79138b0..85580e4 100644
--- a/examples/config/persistentstore/example-persistent-store.xml
+++ b/examples/config/persistentstore/example-persistent-store.xml
@@ -23,13 +23,13 @@
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<!-- Enabling Apache Ignite Persistent Store. -->
- <property name="persistentStoreConfiguration">
- <bean class="org.apache.ignite.configuration.PersistentStoreConfiguration"/>
- </property>
-
- <property name="binaryConfiguration">
- <bean class="org.apache.ignite.configuration.BinaryConfiguration">
- <property name="compactFooter" value="false"/>
+ <property name="dataStorageConfiguration">
+ <bean class="org.apache.ignite.configuration.DataStorageConfiguration">
+ <property name="defaultDataRegionConfiguration">
+ <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
+ <property name="persistenceEnabled" value="true"/>
+ </bean>
+ </property>
</bean>
</property>
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/examples/src/main/java/org/apache/ignite/examples/datagrid/DataRegionsExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/DataRegionsExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/DataRegionsExample.java
new file mode 100644
index 0000000..5675602
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/DataRegionsExample.java
@@ -0,0 +1,113 @@
+/*
+ * 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.examples.datagrid;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.examples.ExampleNodeStartup;
+
+/**
+ * This example demonstrates how to tweak particular settings of Apache Ignite page memory using
+ * {@link DataStorageConfiguration} and set up several data regions for different caches with
+ * {@link DataRegionConfiguration}.
+ * <p>
+ * Additional remote nodes can be started with special configuration file which
+ * enables P2P class loading: {@code 'ignite.{sh|bat} example-data-regions.xml'}.
+ * <p>
+ * Alternatively you can run {@link ExampleNodeStartup} in another JVM which passing
+ * {@code examples/config/example-data-regions.xml} configuration to it.
+ */
+public class DataRegionsExample {
+ /** Name of the default data region defined in 'example-data-regions.xml'. */
+ public static final String REGION_DEFAULT = "Default_Region";
+
+ /** Name of the data region that creates a memory region limited by 40 MB with eviction enabled */
+ public static final String REGION_40MB_EVICTION = "40MB_Region_Eviction";
+
+ /** Name of the data region that creates a memory region mapped to a memory-mapped file. */
+ public static final String REGION_30MB_MEMORY_MAPPED_FILE = "30MB_Region_Swapping";
+
+ /**
+ * Executes example.
+ *
+ * @param args Command line arguments, none required.
+ * @throws IgniteException If example execution failed.
+ */
+ public static void main(String[] args) throws IgniteException {
+ try (Ignite ignite = Ignition.start("examples/config/example-data-regions.xml")) {
+ System.out.println();
+ System.out.println(">>> Data regions example started.");
+
+ /*
+ * Preparing configurations for 2 caches that will be bound to the memory region defined by
+ * '10MB_Region_Eviction' data region from 'example-data-regions.xml' configuration.
+ */
+ CacheConfiguration<Integer, Integer> firstCacheCfg = new CacheConfiguration<>("firstCache");
+
+ firstCacheCfg.setDataRegionName(REGION_40MB_EVICTION);
+ firstCacheCfg.setCacheMode(CacheMode.PARTITIONED);
+ firstCacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+
+ CacheConfiguration<Integer, Integer> secondCacheCfg = new CacheConfiguration<>("secondCache");
+ secondCacheCfg.setDataRegionName(REGION_40MB_EVICTION);
+ secondCacheCfg.setCacheMode(CacheMode.REPLICATED);
+ secondCacheCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
+
+ IgniteCache<Integer, Integer> firstCache = ignite.createCache(firstCacheCfg);
+ IgniteCache<Integer, Integer> secondCache = ignite.createCache(secondCacheCfg);
+
+ System.out.println(">>> Started two caches bound to '" + REGION_40MB_EVICTION + "' memory region.");
+
+ /*
+ * Preparing a configuration for a cache that will be bound to the memory region defined by
+ * '5MB_Region_Swapping' data region from 'example-data-regions.xml' configuration.
+ */
+ CacheConfiguration<Integer, Integer> thirdCacheCfg = new CacheConfiguration<>("thirdCache");
+
+ thirdCacheCfg.setDataRegionName(REGION_30MB_MEMORY_MAPPED_FILE);
+
+ IgniteCache<Integer, Integer> thirdCache = ignite.createCache(thirdCacheCfg);
+
+ System.out.println(">>> Started a cache bound to '" + REGION_30MB_MEMORY_MAPPED_FILE + "' memory region.");
+
+ /*
+ * Preparing a configuration for a cache that will be bound to the default memory region defined by
+ * default 'Default_Region' data region from 'example-data-regions.xml' configuration.
+ */
+ CacheConfiguration<Integer, Integer> fourthCacheCfg = new CacheConfiguration<>("fourthCache");
+
+ IgniteCache<Integer, Integer> fourthCache = ignite.createCache(fourthCacheCfg);
+
+ System.out.println(">>> Started a cache bound to '" + REGION_DEFAULT + "' memory region.");
+
+ System.out.println(">>> Destroying caches...");
+
+ firstCache.destroy();
+ secondCache.destroy();
+ thirdCache.destroy();
+ fourthCache.destroy();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/examples/src/main/java/org/apache/ignite/examples/datagrid/MemoryPoliciesExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/MemoryPoliciesExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/MemoryPoliciesExample.java
deleted file mode 100644
index 045f88b..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/MemoryPoliciesExample.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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.examples.datagrid;
-
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.examples.ExampleNodeStartup;
-
-/**
- * This example demonstrates how to tweak particular settings of Apache Ignite page memory using
- * {@link MemoryConfiguration} and set up several memory policies for different caches with
- * {@link MemoryPolicyConfiguration}.
- * <p>
- * Additional remote nodes can be started with special configuration file which
- * enables P2P class loading: {@code 'ignite.{sh|bat} example-memory-policies.xml'}.
- * <p>
- * Alternatively you can run {@link ExampleNodeStartup} in another JVM which passing
- * {@code examples/config/example-memory-policies.xml} configuration to it.
- */
-public class MemoryPoliciesExample {
- /** Name of the default memory policy defined in 'example-memory-policies.xml'. */
- public static final String POLICY_DEFAULT = "Default_Region";
-
- /** Name of the memory policy that creates a memory region limited by 40 MB with eviction enabled */
- public static final String POLICY_40MB_EVICTION = "40MB_Region_Eviction";
-
- /** Name of the memory policy that creates a memory region mapped to a memory-mapped file. */
- public static final String POLICY_30MB_MEMORY_MAPPED_FILE = "30MB_Region_Swapping";
-
- /**
- * Executes example.
- *
- * @param args Command line arguments, none required.
- * @throws IgniteException If example execution failed.
- */
- public static void main(String[] args) throws IgniteException {
- try (Ignite ignite = Ignition.start("examples/config/example-memory-policies.xml")) {
- System.out.println();
- System.out.println(">>> Memory policies example started.");
-
- /**
- * Preparing configurations for 2 caches that will be bound to the memory region defined by
- * '10MB_Region_Eviction' memory policy from 'example-memory-policies.xml' configuration.
- */
- CacheConfiguration<Integer, Integer> firstCacheCfg = new CacheConfiguration<>("firstCache");
-
- firstCacheCfg.setMemoryPolicyName(POLICY_40MB_EVICTION);
- firstCacheCfg.setCacheMode(CacheMode.PARTITIONED);
- firstCacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
-
- CacheConfiguration<Integer, Integer> secondCacheCfg = new CacheConfiguration<>("secondCache");
- secondCacheCfg.setMemoryPolicyName(POLICY_40MB_EVICTION);
- secondCacheCfg.setCacheMode(CacheMode.REPLICATED);
- secondCacheCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
-
- IgniteCache<Integer, Integer> firstCache = ignite.createCache(firstCacheCfg);
- IgniteCache<Integer, Integer> secondCache = ignite.createCache(secondCacheCfg);
-
- System.out.println(">>> Started two caches bound to '" + POLICY_40MB_EVICTION + "' memory region.");
-
- /**
- * Preparing a configuration for a cache that will be bound to the memory region defined by
- * '5MB_Region_Swapping' memory policy from 'example-memory-policies.xml' configuration.
- */
- CacheConfiguration<Integer, Integer> thirdCacheCfg = new CacheConfiguration<>("thirdCache");
-
- thirdCacheCfg.setMemoryPolicyName(POLICY_30MB_MEMORY_MAPPED_FILE);
-
- IgniteCache<Integer, Integer> thirdCache = ignite.createCache(thirdCacheCfg);
-
- System.out.println(">>> Started a cache bound to '" + POLICY_30MB_MEMORY_MAPPED_FILE + "' memory region.");
-
-
- /**
- * Preparing a configuration for a cache that will be bound to the default memory region defined by
- * default 'Default_Region' memory policy from 'example-memory-policies.xml' configuration.
- */
- CacheConfiguration<Integer, Integer> fourthCacheCfg = new CacheConfiguration<>("fourthCache");
-
- IgniteCache<Integer, Integer> fourthCache = ignite.createCache(fourthCacheCfg);
-
- System.out.println(">>> Started a cache bound to '" + POLICY_DEFAULT + "' memory region.");
-
- System.out.println(">>> Destroying caches...");
-
- firstCache.destroy();
- secondCache.destroy();
- thirdCache.destroy();
- fourthCache.destroy();
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java
----------------------------------------------------------------------
diff --git a/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java
index 30f0763..c42c91a 100644
--- a/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java
+++ b/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java
@@ -27,7 +27,7 @@ import org.apache.ignite.examples.datagrid.CacheQueryDdlExample;
import org.apache.ignite.examples.datagrid.CacheQueryDmlExample;
import org.apache.ignite.examples.datagrid.CacheQueryExample;
import org.apache.ignite.examples.datagrid.CacheTransactionExample;
-import org.apache.ignite.examples.datagrid.MemoryPoliciesExample;
+import org.apache.ignite.examples.datagrid.DataRegionsExample;
import org.apache.ignite.examples.datagrid.starschema.CacheStarSchemaExample;
import org.apache.ignite.examples.datagrid.store.CacheLoadOnlyStoreExample;
import org.apache.ignite.examples.datastructures.IgniteAtomicLongExample;
@@ -195,7 +195,7 @@ public class CacheExamplesSelfTest extends GridAbstractExamplesTest {
/**
* @throws Exception If failed.
*/
- public void testMemoryPolicyExample() throws Exception {
- MemoryPoliciesExample.main(EMPTY_ARGS);
+ public void testDataRegionExample() throws Exception {
+ DataRegionsExample.main(EMPTY_ARGS);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/tree/BPlusTreeBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/tree/BPlusTreeBenchmark.java b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/tree/BPlusTreeBenchmark.java
index 94abc86..cef00ee 100644
--- a/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/tree/BPlusTreeBenchmark.java
+++ b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/tree/BPlusTreeBenchmark.java
@@ -21,7 +21,7 @@ import java.util.concurrent.ConcurrentLinkedDeque;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicLong;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.benchmarks.jmh.JmhAbstractBenchmark;
import org.apache.ignite.internal.benchmarks.jmh.runner.JmhIdeBenchmarkRunner;
import org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider;
@@ -30,7 +30,7 @@ import org.apache.ignite.internal.pagemem.PageIdAllocator;
import org.apache.ignite.internal.pagemem.PageMemory;
import org.apache.ignite.internal.pagemem.PageUtils;
import org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryMetricsImpl;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl;
import org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.BPlusIO;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.BPlusInnerIO;
@@ -210,14 +210,14 @@ public class BPlusTreeBenchmark extends JmhAbstractBenchmark {
for (int i = 0; i < sizes.length; i++)
sizes[i] = 1024 * MB / CPUS;
- MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration().setMaxSize(1024 * MB);
+ DataRegionConfiguration plcCfg = new DataRegionConfiguration().setMaxSize(1024 * MB);
PageMemory pageMem = new PageMemoryNoStoreImpl(new JavaLogger(),
new UnsafeMemoryProvider(new JavaLogger()),
null,
PAGE_SIZE,
plcCfg,
- new MemoryMetricsImpl(plcCfg),
+ new DataRegionMetricsImpl(plcCfg),
false);
pageMem.start();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/DummyPersistenceCompatibilityTest.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/DummyPersistenceCompatibilityTest.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/DummyPersistenceCompatibilityTest.java
index f548939..655da52 100644
--- a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/DummyPersistenceCompatibilityTest.java
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/DummyPersistenceCompatibilityTest.java
@@ -22,6 +22,8 @@ import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.internal.IgniteEx;
@@ -40,7 +42,11 @@ public class DummyPersistenceCompatibilityTest extends IgnitePersistenceCompatib
cfg.setPeerClassLoadingEnabled(false);
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setPersistenceEnabled(true));
+
+ cfg.setDataStorageConfiguration(memCfg);
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/DataRegionMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/DataRegionMetrics.java b/modules/core/src/main/java/org/apache/ignite/DataRegionMetrics.java
new file mode 100644
index 0000000..86b91f4
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/DataRegionMetrics.java
@@ -0,0 +1,119 @@
+/*
+ * 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;
+
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.mxbean.DataRegionMetricsMXBean;
+
+/**
+ * This interface provides page memory related metrics of a specific Apache Ignite node. The overall page memory
+ * architecture is covered in {@link DataStorageConfiguration}.
+ * <p>
+ * Since there are can be several memory regions configured with {@link DataRegionConfiguration} on an individual
+ * Apache Ignite node, the metrics for every region will be collected and obtained separately.
+ * <p>
+ * There are two ways to get the metrics of an Apache Ignite node.
+ * <ol>
+ * <li>
+ * First, a collection of the metrics can be obtained through {@link Ignite#dataRegionMetrics()} method. Note that
+ * the method returns data region metrics snapshots rather than just in time memory state.
+ * </li>
+ * <li>
+ * Second, all {@link DataRegionMetrics} of a local Apache Ignite node are visible through JMX interface. Refer to
+ * {@link DataRegionMetricsMXBean} for more details.
+ * </li>
+ * </ol>
+ * </p>
+ * <p>
+ * Data region metrics collection is not a free operation and might affect performance of an application. This is the reason
+ * why the metrics are turned off by default. To enable the collection you can use both
+ * {@link DataRegionConfiguration#setMetricsEnabled(boolean)} configuration property or
+ * {@link DataRegionMetricsMXBean#enableMetrics()} method of a respective JMX bean.
+ */
+public interface DataRegionMetrics {
+ /**
+ * A name of a memory region the metrics are collected for.
+ *
+ * @return Name of the memory region.
+ */
+ public String getName();
+
+ /**
+ * Gets a total number of allocated pages related to the data region. When persistence is disabled, this
+ * metric shows the total number of pages in memory. When persistence is enabled, this metric shows the
+ * total number of pages in memory and on disk.
+ *
+ * @return Total number of allocated pages.
+ */
+ public long getTotalAllocatedPages();
+
+ /**
+ * Gets pages allocation rate of a memory region.
+ *
+ * @return Number of allocated pages per second.
+ */
+ public float getAllocationRate();
+
+ /**
+ * Gets eviction rate of a given memory region.
+ *
+ * @return Number of evicted pages per second.
+ */
+ public float getEvictionRate();
+
+ /**
+ * Gets percentage of pages that are fully occupied by large entries that go beyond page size. The large entities
+ * are split into fragments in a way so that each fragment can fit into a single page.
+ *
+ * @return Percentage of pages fully occupied by large entities.
+ */
+ public float getLargeEntriesPagesPercentage();
+
+ /**
+ * Gets the percentage of space that is still free and can be filled in.
+ *
+ * @return The percentage of space that is still free and can be filled in.
+ */
+ public float getPagesFillFactor();
+
+ /**
+ * Gets the number of dirty pages (pages which contents is different from the current persistent storage state).
+ * This metric is enabled only for Ignite nodes with enabled persistence.
+ *
+ * @return Current number of dirty pages.
+ */
+ public long getDirtyPages();
+
+ /**
+ * Gets rate (pages per second) at which pages get replaced with other pages from persistent storage.
+ * The rate effectively represents the rate at which pages get 'evicted' in favor of newly needed pages.
+ * This metric is enabled only for Ignite nodes with enabled persistence.
+ *
+ * @return Pages per second replace rate.
+ */
+ public float getPagesReplaceRate();
+
+ /**
+ * Gets total number of pages currently loaded to the RAM. When persistence is disabled, this metric is equal
+ * to {@link #getTotalAllocatedPages()}.
+ *
+ * @return Total number of pages loaded to RAM.
+ */
+ public long getPhysicalMemoryPages();
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/DataRegionMetricsAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/DataRegionMetricsAdapter.java b/modules/core/src/main/java/org/apache/ignite/DataRegionMetricsAdapter.java
new file mode 100644
index 0000000..dcf2049
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/DataRegionMetricsAdapter.java
@@ -0,0 +1,106 @@
+/*
+* 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;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * Converter class from {@link DataRegionMetrics} to legacy {@link MemoryMetrics}.
+ */
+public class DataRegionMetricsAdapter implements MemoryMetrics {
+ /** Delegate. */
+ private final DataRegionMetrics delegate;
+
+ /**
+ * @param delegate Delegate.
+ */
+ private DataRegionMetricsAdapter(DataRegionMetrics delegate) {
+ this.delegate = delegate;
+ }
+
+ /**
+ * Converts collection of {@link DataRegionMetrics} into collection of legacy {@link MemoryMetrics}.
+ *
+ * @param dataRegionMetrics Data region metrics collection.
+ */
+ public static Collection<MemoryMetrics> collectionOf(Collection<DataRegionMetrics> dataRegionMetrics) {
+ if (dataRegionMetrics == null)
+ return null;
+
+ Collection<MemoryMetrics> res = new ArrayList<>();
+
+ for (DataRegionMetrics d : dataRegionMetrics)
+ res.add(new DataRegionMetricsAdapter(d));
+
+ return res;
+ }
+
+ /**
+ * @param delegate DataRegionMetrics.
+ * @return Wrapped {@link DataRegionMetrics} that implements {@link MemoryMetrics}.
+ * Null value is not wrapped and returned as is.
+ */
+ public static DataRegionMetricsAdapter valueOf(DataRegionMetrics delegate) {
+ return delegate == null ? null : new DataRegionMetricsAdapter(delegate);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getName() {
+ return delegate.getName();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getTotalAllocatedPages() {
+ return delegate.getTotalAllocatedPages();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getAllocationRate() {
+ return delegate.getAllocationRate();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getEvictionRate() {
+ return delegate.getEvictionRate();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getLargeEntriesPagesPercentage() {
+ return delegate.getLargeEntriesPagesPercentage();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getPagesFillFactor() {
+ return delegate.getPagesFillFactor();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getDirtyPages() {
+ return delegate.getDirtyPages();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getPagesReplaceRate() {
+ return delegate.getPagesReplaceRate();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getPhysicalMemoryPages() {
+ return delegate.getPhysicalMemoryPages();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/DataStorageMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/DataStorageMetrics.java b/modules/core/src/main/java/org/apache/ignite/DataStorageMetrics.java
new file mode 100644
index 0000000..87095f6
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/DataStorageMetrics.java
@@ -0,0 +1,114 @@
+/*
+ * 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;
+
+import org.apache.ignite.configuration.DataStorageConfiguration;
+
+/**
+ * Data storage metrics are used to obtain statistics on persistent store and whole data storage.
+ */
+public interface DataStorageMetrics {
+ /**
+ * Gets the average number of WAL records per second written during the last time interval.
+ * <p>
+ * The length of time interval is configured via {@link DataStorageConfiguration#setMetricsRateTimeInterval(long)}
+ * configurartion property.
+ * The number of subintervals is configured via {@link DataStorageConfiguration#setMetricsSubIntervalCount(int)}
+ * configuration property.
+ */
+ public float getWalLoggingRate();
+
+ /**
+ * Gets the average number of bytes per second written during the last time interval.
+ * The length of time interval is configured via {@link DataStorageConfiguration#setMetricsRateTimeInterval(long)}
+ * configurartion property.
+ * The number of subintervals is configured via {@link DataStorageConfiguration#setMetricsSubIntervalCount(int)}
+ * configuration property.
+ */
+ public float getWalWritingRate();
+
+ /**
+ * Gets the current number of WAL segments in the WAL archive.
+ */
+ public int getWalArchiveSegments();
+
+ /**
+ * Gets the average WAL fsync duration in microseconds over the last time interval.
+ * <p>
+ * The length of time interval is configured via {@link DataStorageConfiguration#setMetricsRateTimeInterval(long)}
+ * configurartion property.
+ * The number of subintervals is configured via {@link DataStorageConfiguration#setMetricsSubIntervalCount(int)}
+ * configuration property.
+ */
+ public float getWalFsyncTimeAverage();
+
+ /**
+ * Gets the duration of the last checkpoint in milliseconds.
+ *
+ * @return Total checkpoint duration in milliseconds.
+ */
+ public long getLastCheckpointingDuration();
+
+ /**
+ * Gets the duration of last checkpoint lock wait in milliseconds.
+ *
+ * @return Checkpoint lock wait time in milliseconds.
+ */
+ public long getLastCheckpointLockWaitDuration();
+
+ /**
+ * Gets the duration of last checkpoint mark phase in milliseconds.
+ *
+ * @return Checkpoint mark duration in milliseconds.
+ */
+ public long getLastCheckpointMarkDuration();
+
+ /**
+ * Gets the duration of last checkpoint pages write phase in milliseconds.
+ *
+ * @return Checkpoint pages write phase in milliseconds.
+ */
+ public long getLastCheckpointPagesWriteDuration();
+
+ /**
+ * Gets the duration of the sync phase of the last checkpoint in milliseconds.
+ *
+ * @return Checkpoint fsync time in milliseconds.
+ */
+ public long getLastCheckpointFsyncDuration();
+
+ /**
+ * Gets the total number of pages written during the last checkpoint.
+ *
+ * @return Total number of pages written during the last checkpoint.
+ */
+ public long getLastCheckpointTotalPagesNumber();
+
+ /**
+ * Gets the number of data pages written during the last checkpoint.
+ *
+ * @return Total number of data pages written during the last checkpoint.
+ */
+ public long getLastCheckpointDataPagesNumber();
+
+ /**
+ * Gets the number of pages copied to a temporary checkpoint buffer during the last checkpoint.
+ *
+ * @return Total number of pages copied to a temporary checkpoint buffer during the last checkpoint.
+ */
+ public long getLastCheckpointCopiedOnWritePagesNumber();
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/DataStorageMetricsAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/DataStorageMetricsAdapter.java b/modules/core/src/main/java/org/apache/ignite/DataStorageMetricsAdapter.java
new file mode 100644
index 0000000..6bb4b7e
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/DataStorageMetricsAdapter.java
@@ -0,0 +1,101 @@
+/*
+* 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;
+
+/**
+ * Converter class from {@link DataStorageMetrics} to legacy {@link PersistenceMetrics}.
+ */
+public class DataStorageMetricsAdapter implements PersistenceMetrics {
+ /** Delegate. */
+ private final DataStorageMetrics delegate;
+
+ /**
+ * @param delegate Delegate.
+ */
+ private DataStorageMetricsAdapter(DataStorageMetrics delegate) {
+ this.delegate = delegate;
+ }
+
+ /**
+ * @param delegate DataStorageMetrics.
+ * @return Wrapped {@link DataStorageMetrics} that implements {@link PersistenceMetrics}.
+ * Null value is not wrapped and returned as is.
+ */
+ public static DataStorageMetricsAdapter valueOf(DataStorageMetrics delegate) {
+ return delegate == null ? null : new DataStorageMetricsAdapter(delegate);
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getWalLoggingRate() {
+ return delegate.getWalLoggingRate();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getWalWritingRate() {
+ return delegate.getWalWritingRate();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getWalArchiveSegments() {
+ return delegate.getWalArchiveSegments();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getWalFsyncTimeAverage() {
+ return delegate.getWalFsyncTimeAverage();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointingDuration() {
+ return delegate.getLastCheckpointingDuration();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointLockWaitDuration() {
+ return delegate.getLastCheckpointLockWaitDuration();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointMarkDuration() {
+ return delegate.getLastCheckpointMarkDuration();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointPagesWriteDuration() {
+ return delegate.getLastCheckpointPagesWriteDuration();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointFsyncDuration() {
+ return delegate.getLastCheckpointFsyncDuration();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointTotalPagesNumber() {
+ return delegate.getLastCheckpointTotalPagesNumber();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointDataPagesNumber() {
+ return delegate.getLastCheckpointDataPagesNumber();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastCheckpointCopiedOnWritePagesNumber() {
+ return delegate.getLastCheckpointCopiedOnWritePagesNumber();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/Ignite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/Ignite.java b/modules/core/src/main/java/org/apache/ignite/Ignite.java
index 866c313..c8de43b 100644
--- a/modules/core/src/main/java/org/apache/ignite/Ignite.java
+++ b/modules/core/src/main/java/org/apache/ignite/Ignite.java
@@ -27,9 +27,9 @@ import org.apache.ignite.cluster.ClusterGroup;
import org.apache.ignite.configuration.AtomicConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.CollectionConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.lang.IgniteProductVersion;
@@ -676,30 +676,50 @@ public interface Ignite extends AutoCloseable {
public void resetLostPartitions(Collection<String> cacheNames);
/**
- * Returns a collection of {@link MemoryMetrics} that reflects page memory usage on this Apache Ignite node
+ * @return Collection of {@link MemoryMetrics} snapshots.
+ * @deprecated Use {@link #dataRegionMetrics()} instead.
+ */
+ @Deprecated
+ public Collection<MemoryMetrics> memoryMetrics();
+
+ /**
+ * @return {@link MemoryMetrics} snapshot or {@code null} if no memory region is configured under specified name.
+ * @deprecated Use {@link #dataRegionMetrics(String)} instead.
+ */
+ @Deprecated
+ @Nullable public MemoryMetrics memoryMetrics(String memPlcName);
+
+ /**
+ * @return {@link PersistenceMetrics} snapshot.
+ * @deprecated Use {@link #dataStorageMetrics()} instead.
+ */
+ @Deprecated
+ public PersistenceMetrics persistentStoreMetrics();
+
+ /**
+ * Returns a collection of {@link DataRegionMetrics} that reflects page memory usage on this Apache Ignite node
* instance.
* Returns the collection that contains the latest snapshots for each memory region
- * configured with {@link MemoryPolicyConfiguration configuration} on this Ignite node instance.
+ * configured with {@link DataRegionConfiguration configuration} on this Ignite node instance.
*
- * @return Collection of {@link MemoryMetrics} snapshots.
+ * @return Collection of {@link DataRegionMetrics} snapshots.
*/
- public Collection<MemoryMetrics> memoryMetrics();
+ public Collection<DataRegionMetrics> dataRegionMetrics();
/**
- * Returns the latest {@link MemoryMetrics} snapshot for the memory region of the given name.
+ * Returns the latest {@link DataRegionMetrics} snapshot for the memory region of the given name.
*
* To get the metrics for the default memory region use
- * {@link MemoryConfiguration#DFLT_MEM_PLC_DEFAULT_NAME} as the name
+ * {@link DataStorageConfiguration#DFLT_DATA_REG_DEFAULT_NAME} as the name
* or a custom name if the default memory region has been renamed.
*
- * @param memPlcName Name of memory region configured with {@link MemoryPolicyConfiguration config}.
- * @return {@link MemoryMetrics} snapshot or {@code null} if no memory region is configured under specified name.
+ * @param memPlcName Name of memory region configured with {@link DataRegionConfiguration config}.
+ * @return {@link DataRegionMetrics} snapshot or {@code null} if no memory region is configured under specified name.
*/
- @Nullable public MemoryMetrics memoryMetrics(String memPlcName);
+ @Nullable public DataRegionMetrics dataRegionMetrics(String memPlcName);
/**
- *
- * @return {@link PersistenceMetrics} snapshot.
+ * @return {@link DataStorageMetrics} snapshot.
*/
- public PersistenceMetrics persistentStoreMetrics();
+ public DataStorageMetrics dataStorageMetrics();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index d7b4de9..d7d4443 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -24,7 +24,7 @@ import java.util.Map;
import java.util.Properties;
import javax.net.ssl.HostnameVerifier;
import org.apache.ignite.cluster.ClusterGroup;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller;
import org.apache.ignite.lang.IgnitePredicate;
import org.jetbrains.annotations.Nullable;
@@ -727,7 +727,7 @@ public final class IgniteSystemProperties {
*/
public static final String IGNITE_WAL_LOG_TX_RECORDS = "IGNITE_WAL_LOG_TX_RECORDS";
- /** If this property is set, {@link PersistentStoreConfiguration#writeThrottlingEnabled} will be overridden to true
+ /** If this property is set, {@link DataStorageConfiguration#writeThrottlingEnabled} will be overridden to true
* independent of initial value in configuration. */
public static final String IGNITE_OVERRIDE_WRITE_THROTTLING_ENABLED = "IGNITE_OVERRIDE_WRITE_THROTTLING_ENABLED";
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/MemoryMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/MemoryMetrics.java b/modules/core/src/main/java/org/apache/ignite/MemoryMetrics.java
index c709777..e0c22ed 100644
--- a/modules/core/src/main/java/org/apache/ignite/MemoryMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/MemoryMetrics.java
@@ -19,7 +19,7 @@ package org.apache.ignite;
import org.apache.ignite.configuration.MemoryConfiguration;
import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.mxbean.MemoryMetricsMXBean;
+import org.apache.ignite.mxbean.DataRegionMetricsMXBean;
/**
* This interface provides page memory related metrics of a specific Apache Ignite node. The overall page memory
@@ -31,12 +31,12 @@ import org.apache.ignite.mxbean.MemoryMetricsMXBean;
* There are two ways to get the metrics of an Apache Ignite node.
* <ol>
* <li>
- * First, a collection of the metrics can be obtained through {@link Ignite#memoryMetrics()} method. Note that
+ * First, a collection of the metrics can be obtained through {@link Ignite#dataRegionMetrics()} ()} method. Note that
* the method returns memory metrics snapshots rather than just in time memory state.
* </li>
* <li>
* Second, all {@link MemoryMetrics} of a local Apache Ignite node are visible through JMX interface. Refer to
- * {@link MemoryMetricsMXBean} for more details.
+ * {@link DataRegionMetricsMXBean} for more details.
* </li>
* </ol>
* </p>
@@ -44,8 +44,11 @@ import org.apache.ignite.mxbean.MemoryMetricsMXBean;
* Memory metrics collection is not a free operation and might affect performance of an application. This is the reason
* why the metrics are turned off by default. To enable the collection you can use both
* {@link MemoryPolicyConfiguration#setMetricsEnabled(boolean)} configuration property or
- * {@link MemoryMetricsMXBean#enableMetrics()} method of a respective JMX bean.
+ * {@link DataRegionMetricsMXBean#enableMetrics()} method of a respective JMX bean.
+ *
+ * @deprecated Use {@link DataRegionMetrics} instead.
*/
+@Deprecated
public interface MemoryMetrics {
/**
* A name of a memory region the metrics are collected for.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/PersistenceMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/PersistenceMetrics.java b/modules/core/src/main/java/org/apache/ignite/PersistenceMetrics.java
index f3f763c..3b96b11 100644
--- a/modules/core/src/main/java/org/apache/ignite/PersistenceMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/PersistenceMetrics.java
@@ -17,13 +17,13 @@
package org.apache.ignite;
import org.apache.ignite.configuration.PersistentStoreConfiguration;
-import org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager;
/**
* Persistence metrics used to obtain statistics on persistence.
*
- * Use {@link IgniteCacheDatabaseSharedManager#persistentStoreMetrics()} to obtain persistent metrics.
+ * @deprecated Use {@link DataStorageMetrics} instead.
*/
+@Deprecated
public interface PersistenceMetrics {
/**
* Gets the average number of WAL records per second written during the last time interval.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
index 6c43d13..37a0677 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
@@ -187,7 +187,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
/** Cache group name. */
private String grpName;
- /** Name of {@link MemoryPolicyConfiguration} for this cache */
+ /** Name of {@link DataRegionConfiguration} for this cache */
private String memPlcName;
/** Threshold for concurrent loading of keys from {@link CacheStore}. */
@@ -407,7 +407,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
loadPrevVal = cc.isLoadPreviousValue();
longQryWarnTimeout = cc.getLongQueryWarningTimeout();
maxConcurrentAsyncOps = cc.getMaxConcurrentAsyncOperations();
- memPlcName = cc.getMemoryPolicyName();
+ memPlcName = cc.getDataRegionName();
name = cc.getName();
nearCfg = cc.getNearConfiguration();
nodeFilter = cc.getNodeFilter();
@@ -453,7 +453,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* Since underlying cache is shared, the following configuration properties should be the same within group:
* {@link #setAffinity(AffinityFunction)}, {@link #setNodeFilter(IgnitePredicate)}, {@link #cacheMode},
* {@link #setTopologyValidator(TopologyValidator)}, {@link #setPartitionLossPolicy(PartitionLossPolicy)},
- * {@link #setMemoryPolicyName(String)}.
+ * {@link #setDataRegionName(String)}.
*
* Grouping caches reduces overall overhead, since internal data structures are shared.
*
@@ -472,7 +472,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* Since underlying cache is shared, the following configuration properties should be the same within group:
* {@link #setAffinity(AffinityFunction)}, {@link #setNodeFilter(IgnitePredicate)}, {@link #cacheMode},
* {@link #setTopologyValidator(TopologyValidator)}, {@link #setPartitionLossPolicy(PartitionLossPolicy)},
- * {@link #setMemoryPolicyName(String)}.
+ * {@link #setDataRegionName(String)}.
*
* Grouping caches reduces overall overhead, since internal data structures are shared.
*
@@ -509,28 +509,44 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
}
/**
- * @return {@link MemoryPolicyConfiguration} name.
+ * @return {@link DataRegionConfiguration} name.
*/
+ @Nullable public String getDataRegionName() {
+ return memPlcName;
+ }
+
+ /**
+ * @deprecated Use {@link #getDataRegionName()} (String)} instead.
+ */
+ @Deprecated
public String getMemoryPolicyName() {
return memPlcName;
}
/**
- * Sets a name of {@link MemoryPolicyConfiguration} for this cache.
+ * Sets a name of {@link DataRegionConfiguration} for this cache.
*
- * @param memPlcName MemoryPolicyConfiguration name. Can be null (default MemoryPolicyConfiguration will be used)
+ * @param dataRegionName DataRegionConfiguration name. Can be null (default DataRegionConfiguration will be used)
* but should not be empty.
* @return {@code this} for chaining.
*/
- public CacheConfiguration<K, V> setMemoryPolicyName(String memPlcName) {
- A.ensure(memPlcName == null || !memPlcName.isEmpty(), "Name cannot be empty.");
+ public CacheConfiguration<K, V> setDataRegionName(@Nullable String dataRegionName) {
+ A.ensure(dataRegionName == null || !dataRegionName.isEmpty(), "Name cannot be empty.");
- this.memPlcName = memPlcName;
+ this.memPlcName = dataRegionName;
return this;
}
/**
+ * @deprecated Use {@link #setDataRegionName(String)} instead.
+ */
+ @Deprecated
+ public CacheConfiguration<K, V> setMemoryPolicyName(String memPlcName) {
+ return setDataRegionName(memPlcName);
+ }
+
+ /**
* Gets cache eviction policy. By default, returns {@code null}
* which means that evictions are disabled for cache.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/configuration/DataPageEvictionMode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/DataPageEvictionMode.java b/modules/core/src/main/java/org/apache/ignite/configuration/DataPageEvictionMode.java
index f61e870..2b4ee78 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/DataPageEvictionMode.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/DataPageEvictionMode.java
@@ -21,7 +21,7 @@ import org.jetbrains.annotations.Nullable;
/**
* Defines memory page eviction algorithm. A mode is set for a specific
- * {@link MemoryPolicyConfiguration}. Only data pages, that store key-value entries, are eligible for eviction. The
+ * {@link DataRegionConfiguration}. Only data pages, that store key-value entries, are eligible for eviction. The
* other types of pages, like index or meta pages, are not evictable.
*/
public enum DataPageEvictionMode {
@@ -31,11 +31,11 @@ public enum DataPageEvictionMode {
/**
* Random-LRU algorithm.
* <ul>
- * <li>Once a memory region defined by a memory policy is configured, an off-heap array is allocated to track
+ * <li>Once a memory region defined by a data region is configured, an off-heap array is allocated to track
* last usage timestamp for every individual data page. The size of the array is calculated this way - size =
- * ({@link MemoryPolicyConfiguration#getMaxSize()} / {@link MemoryConfiguration#pageSize})</li>
+ * ({@link DataRegionConfiguration#getMaxSize()} / {@link DataStorageConfiguration#pageSize})</li>
* <li>When a data page is accessed, its timestamp gets updated in the tracking array. The page index in the
- * tracking array is calculated this way - index = (pageAddress / {@link MemoryPolicyConfiguration#getMaxSize()}</li>
+ * tracking array is calculated this way - index = (pageAddress / {@link DataRegionConfiguration#getMaxSize()}</li>
* <li>When it's required to evict some pages, 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 (index or system pages)
* then the algorithm picks other pages.</li>
[14/50] [abbrv] ignite git commit: IGNITE-6030 Allow enabling
persistence per data region
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/web-console/frontend/app/modules/states/configuration/clusters/data-storage.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/data-storage.pug b/modules/web-console/frontend/app/modules/states/configuration/clusters/data-storage.pug
new file mode 100644
index 0000000..9c2dca1
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/data-storage.pug
@@ -0,0 +1,255 @@
+//-
+ 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.
+
+include /app/helpers/jade/mixins
+
+-var form = 'dataStorageConfiguration'
+-var model = 'backupItem.dataStorageConfiguration'
+-var dfltRegionModel = model + '.defaultDataRegionConfiguration'
+-var dataRegionConfigurations = model + '.dataRegionConfigurations'
+
+.panel.panel-default(ng-show='$ctrl.available("2.3.0")' ng-form=form novalidate)
+ .panel-heading(bs-collapse-toggle ng-click=`ui.loadPanel('${form}')`)
+ ignite-form-panel-chevron
+ label Data storage configuration
+ ignite-form-field-tooltip.tipLabel
+ | Page memory is a manageable off-heap based memory architecture that is split into pages of fixed size#[br]
+ | #[a(href="https://apacheignite.readme.io/docs/distributed-persistent-store" target="_blank") More info]
+ ignite-form-revert
+ .panel-collapse(role='tabpanel' bs-collapse-target id=`${form}`)
+ .panel-body(ng-if=`$ctrl.available("2.3.0") && ui.isPanelLoaded('${form}')`)
+ .col-sm-6
+ .settings-row
+ +number-min-max('Page size:', model + '.pageSize', '"DataStorageConfigurationPageSize"',
+ 'true', '2048', '1024', '16384', 'Every memory region is split on pages of fixed size')
+ .settings-row
+ +number('Concurrency level:', model + '.concurrencyLevel', '"DataStorageConfigurationConcurrencyLevel"',
+ 'true', 'availableProcessors', '2', 'The number of concurrent segments in Ignite internal page mapping tables')
+ .settings-row
+ +ignite-form-group
+ ignite-form-field-label
+ | System region
+ ignite-form-group-tooltip
+ | System region properties
+ .group-content
+ .details-row
+ +number('Initial size:', model + '.systemRegionInitialSize', '"DataStorageSystemRegionInitialSize"',
+ 'true', '41943040', '10485760', 'Initial size of a data region reserved for system cache')
+ .details-row
+ +number('Maximum size:', model + '.systemRegionMaxSize', '"DataStorageSystemRegionMaxSize"',
+ 'true', '104857600', '10485760', 'Maximum data region size reserved for system cache')
+ .settings-row
+ +ignite-form-group
+ ignite-form-field-label
+ | Data regions
+ ignite-form-group-tooltip
+ | Data region configurations
+ .group-content
+ .details-row
+ +ignite-form-group
+ ignite-form-field-label
+ | Default data region
+ ignite-form-group-tooltip
+ | Default data region properties
+ .group-content
+ .details-row
+ +text('Name:', dfltRegionModel + '.name', '"DfltRegionName" + $index', 'false', 'default', 'Default data region name')
+ .details-row
+ +number('Initial size:', dfltRegionModel + '.initialSize', '"DfltRegionInitialSize" + $index',
+ 'true', '268435456', '10485760', 'Default data region initial size')
+ .details-row
+ +number('Maximum size:', dfltRegionModel + '.maxSize', '"DfltRegionMaxSize" + $index',
+ 'true', '0.2 * totalMemoryAvailable', '10485760', 'Default data region maximum size')
+ .details-row
+ +text('Swap file path:', dfltRegionModel + '.swapPath', '"DfltRegionSwapFilePath" + $index', 'false',
+ 'Input swap file path', 'An optional path to a memory mapped file for default data region')
+ .details-row
+ +dropdown('Eviction mode:', dfltRegionModel + '.pageEvictionMode', '"DfltRegionPageEvictionMode"', 'true', 'DISABLED',
+ '[\
+ {value: "DISABLED", label: "DISABLED"},\
+ {value: "RANDOM_LRU", label: "RANDOM_LRU"},\
+ {value: "RANDOM_2_LRU", label: "RANDOM_2_LRU"}\
+ ]',
+ 'An algorithm for memory pages eviction\
+ <ul>\
+ <li>DISABLED - Eviction is disabled</li>\
+ <li>RANDOM_LRU - 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</li>\
+ <li>RANDOM_2_LRU - Differs from Random - LRU only in a way that two latest access timestamps are stored for every data page</li>\
+ </ul>')
+ .details-row
+ +number-min-max-step('Eviction threshold:', dfltRegionModel + '.evictionThreshold', '"DfltRegionEvictionThreshold" + $index',
+ 'true', '0.9', '0.5', '0.999', '0.05', 'A threshold for memory pages eviction initiation')
+ .details-row
+ +number('Empty pages pool size:', dfltRegionModel + '.emptyPagesPoolSize', '"DfltRegionEmptyPagesPoolSize" + $index',
+ 'true', '100', '11', 'The minimal number of empty pages to be present in reuse lists for default data region')
+ .details-row
+ +number('Metrics sub interval count:', dfltRegionModel + '.metricsSubIntervalCount', '"DfltRegionSubIntervals" + $index',
+ 'true', '5', '1', 'A number of sub-intervals the whole rate time interval will be split into to calculate allocation and eviction rates')
+ .details-row
+ +number('Metrics rate time interval:', dfltRegionModel + '.metricsRateTimeInterval', '"DfltRegionRateTimeInterval" + $index',
+ 'true', '60000', '1000', 'Time interval for allocation rate and eviction rate monitoring purposes')
+ .details-row
+ +checkbox('Metrics enabled', dfltRegionModel + '.metricsEnabled', '"DfltRegionMetricsEnabled" + $index',
+ 'Whether memory metrics are enabled by default on node startup')
+ .details-row
+ +checkbox('Persistence enabled', dfltRegionModel + '.persistenceEnabled', '"DfltRegionPersistenceEnabled" + $index',
+ 'Enable Ignite Native Persistence')
+ .details-row(ng-init='dataRegionTbl={type: "dataRegions", model: "dataRegionConfigurations", focusId: "name", ui: "data-region-table"}')
+ +ignite-form-group()
+ ignite-form-field-label
+ | Configured data regions
+ ignite-form-group-tooltip
+ | List of configured data regions
+ ignite-form-group-add(ng-click='tableNewItem(dataRegionTbl)')
+ | Add data region configuration
+ .group-content-empty(ng-if=`!(${dataRegionConfigurations} && ${dataRegionConfigurations}.length > 0)`)
+ | Not defined
+ .group-content(ng-show=`${dataRegionConfigurations} && ${dataRegionConfigurations}.length > 0` ng-repeat=`model in ${dataRegionConfigurations} track by $index`)
+ hr(ng-if='$index != 0')
+ .settings-row
+ +text-enabled-autofocus('Name:', 'model.name', '"DataRegionName" + $index', 'true', 'false', 'default', 'Data region name')
+ +table-remove-button(dataRegionConfigurations, 'Remove memory configuration')
+ .settings-row
+ +number('Initial size:', 'model.initialSize', '"DataRegionInitialSize" + $index',
+ 'true', '268435456', '10485760', 'Initial memory region size defined by this data region')
+ .settings-row
+ +number('Maximum size:', 'model.maxSize', '"DataRegionMaxSize" + $index',
+ 'true', '0.2 * totalMemoryAvailable', '10485760', 'Maximum memory region size defined by this data region')
+ .settings-row
+ +text('Swap file path:', 'model.swapPath', '"DataRegionSwapPath" + $index', 'false',
+ 'Input swap file path', 'An optional path to a memory mapped file for this data region')
+ .settings-row
+ +dropdown('Eviction mode:', 'model.pageEvictionMode', '"DataRegionPageEvictionMode"', 'true', 'DISABLED',
+ '[\
+ {value: "DISABLED", label: "DISABLED"},\
+ {value: "RANDOM_LRU", label: "RANDOM_LRU"},\
+ {value: "RANDOM_2_LRU", label: "RANDOM_2_LRU"}\
+ ]',
+ 'An algorithm for memory pages eviction\
+ <ul>\
+ <li>DISABLED - Eviction is disabled</li>\
+ <li>RANDOM_LRU - 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</li>\
+ <li>RANDOM_2_LRU - Differs from Random - LRU only in a way that two latest access timestamps are stored for every data page</li>\
+ </ul>')
+ .settings-row
+ +number-min-max-step('Eviction threshold:', 'model.evictionThreshold', '"DataRegionEvictionThreshold" + $index',
+ 'true', '0.9', '0.5', '0.999', '0.05', 'A threshold for memory pages eviction initiation')
+ .settings-row
+ +number('Empty pages pool size:', 'model.emptyPagesPoolSize', '"DataRegionEmptyPagesPoolSize" + $index',
+ 'true', '100', '11', 'The minimal number of empty pages to be present in reuse lists for this data region')
+ .settings-row
+ +number('Metrics sub interval count:', 'model.metricsSubIntervalCount', '"DataRegionSubIntervals" + $index',
+ 'true', '5', '1', 'A number of sub-intervals the whole rate time interval will be split into to calculate allocation and eviction rates')
+ .settings-row
+ +number('Metrics rate time interval:', 'model.metricsRateTimeInterval', '"DataRegionRateTimeInterval" + $index',
+ 'true', '60000', '1000', 'Time interval for allocation rate and eviction rate monitoring purposes')
+ .settings-row
+ +checkbox('Metrics enabled', 'model.metricsEnabled', '"DataRegionMetricsEnabled" + $index',
+ 'Whether memory metrics are enabled by default on node startup')
+ .settings-row
+ +checkbox('Persistence enabled', 'model.persistenceEnabled', '"DataRegionPersistenceEnabled" + $index',
+ 'Enable Ignite Native Persistence')
+ .settings-row
+ +text-enabled('Storage path:', `${model}.storagePath`, '"DataStoragePath"', 'true', 'false', 'db',
+ 'Directory where index and partition files are stored')
+ .settings-row
+ +number('Checkpoint frequency:', `${model}.checkpointFrequency`, '"DataStorageCheckpointFrequency"', 'true', '180000', '1',
+ 'Frequency which is a minimal interval when the dirty pages will be written to the Persistent Store')
+ .settings-row
+ +number('Checkpoint page buffer size:', `${model}.checkpointPageBufferSize`, '"DataStorageCheckpointPageBufferSize"', 'true', '268435456', '0',
+ 'Amount of memory allocated for a checkpointing temporary buffer')
+ .settings-row
+ +number('Checkpoint threads:', `${model}.checkpointThreads`, '"DataStorageCheckpointThreads"', 'true', '4', '1', 'A number of threads to use for the checkpoint purposes')
+ .settings-row
+ +dropdown('Checkpoint write order:', `${model}.checkpointWriteOrder`, '"DataStorageCheckpointWriteOrder"', 'true', 'SEQUENTIAL',
+ '[\
+ {value: "RANDOM", label: "RANDOM"},\
+ {value: "SEQUENTIAL", label: "SEQUENTIAL"}\
+ ]',
+ 'Order of writing pages to disk storage during checkpoint.\
+ <ul>\
+ <li>RANDOM - Pages are written in order provided by checkpoint pages collection iterator</li>\
+ <li>SEQUENTIAL - All checkpoint pages are collected into single list and sorted by page index</li>\
+ </ul>')
+ .settings-row
+ +dropdown('WAL mode:', `${model}.walMode`, '"DataStorageWalMode"', 'true', 'DEFAULT',
+ '[\
+ {value: "DEFAULT", label: "DEFAULT"},\
+ {value: "LOG_ONLY", label: "LOG_ONLY"},\
+ {value: "BACKGROUND", label: "BACKGROUND"},\
+ {value: "NONE", label: "NONE"}\
+ ]',
+ 'Type define behavior wal fsync.\
+ <ul>\
+ <li>DEFAULT - full-sync disk writes</li>\
+ <li>LOG_ONLY - flushes application buffers</li>\
+ <li>BACKGROUND - does not force application's buffer flush</li>\
+ <li>NONE - WAL is disabled</li>\
+ </ul>')
+ .settings-row
+ +text-enabled('WAL path:', `${model}.walPath`, '"DataStorageWalPath"', 'true', 'false', 'db/wal', 'A path to the directory where WAL is stored')
+ .settings-row
+ +text-enabled('WAL archive path:', `${model}.walArchivePath`, '"DataStorageWalArchivePath"', 'true', 'false', 'db/wal/archive', 'A path to the WAL archive directory')
+ .settings-row
+ +number('WAL segments:', `${model}.walSegments`, '"DataStorageWalSegments"', 'true', '10', '1', 'A number of WAL segments to work with')
+ .settings-row
+ +number('WAL segment size:', `${model}.walSegmentSize`, '"DataStorageWalSegmentSize"', 'true', '67108864', '0', 'Size of a WAL segment')
+ .settings-row
+ +number('WAL history size:', `${model}.walHistorySize`, '"DataStorageWalHistorySize"', 'true', '20', '1', 'A total number of checkpoints to keep in the WAL history')
+ .settings-row
+ +number('WAL flush frequency:', `${model}.walFlushFrequency`, '"DataStorageWalFlushFrequency"', 'true', '2000', '1',
+ 'How often will be fsync, in milliseconds. In background mode, exist thread which do fsync by timeout')
+ .settings-row
+ +number('WAL fsync delay:', `${model}.walFsyncDelayNanos`, '"DataStorageWalFsyncDelay"', 'true', '1000', '1', 'WAL fsync delay, in nanoseconds')
+ .settings-row
+ +number('WAL record iterator buffer size:', `${model}.walRecordIteratorBufferSize`, '"DataStorageWalRecordIteratorBufferSize"', 'true', '67108864', '1',
+ 'How many bytes iterator read from disk(for one reading), during go ahead WAL')
+ .settings-row
+ +number('Lock wait time:', `${model}.lockWaitTime`, '"DataStorageLockWaitTime"', 'true', '10000', '1',
+ 'Time out in milliseconds, while wait and try get file lock for start persist manager')
+ .settings-row
+ +number('WAL thread local buffer size:', `${model}.walThreadLocalBufferSize`, '"DataStorageWalThreadLocalBufferSize"', 'true', '131072', '1',
+ 'Define size thread local buffer. Each thread which write to WAL have thread local buffer for serialize recode before write in WAL')
+ .settings-row
+ +number('Metrics sub interval count:', `${model}.metricsSubIntervalCount`, '"DataStorageMetricsSubIntervalCount"', 'true', '5', '1',
+ 'Number of sub - intervals the whole rate time interval will be split into to calculate rate - based metrics')
+ .settings-row
+ +number('Metrics rate time interval:', `${model}.metricsRateTimeInterval`, '"DataStorageMetricsRateTimeInterval"', 'true', '60000', '1000',
+ 'The length of the time interval for rate - based metrics. This interval defines a window over which hits will be tracked')
+ .settings-row
+ +dropdown('File IO factory:', `${model}.fileIOFactory`, '"DataStorageFileIOFactory"', 'true', 'Default',
+ '[\
+ {value: "RANDOM", label: "RANDOM"},\
+ {value: "ASYNC", label: "ASYNC"},\
+ {value: null, label: "Default"},\
+ ]',
+ 'Order of writing pages to disk storage during checkpoint.\
+ <ul>\
+ <li>RANDOM - Pages are written in order provided by checkpoint pages collection iterator</li>\
+ <li>SEQUENTIAL - All checkpoint pages are collected into single list and sorted by page index</li>\
+ </ul>')
+ .settings-row
+ +number('WAL auto archive after inactivity:', `${model}.walAutoArchiveAfterInactivity`, '"DataStorageWalAutoArchiveAfterInactivity"', 'true', '-1', '-1',
+ 'Time in millis to run auto archiving segment after last record logging')
+ .settings-row
+ +checkbox-enabled('Metrics enabled', `${model}.metricsEnabled`, '"DataStorageMetricsEnabled"', 'true', 'Flag indicating whether persistence metrics collection is enabled')
+ .settings-row
+ +checkbox-enabled('Always write full pages', `${model}.alwaysWriteFullPages`, '"DataStorageAlwaysWriteFullPages"', 'true', 'Flag indicating whether always write full pages')
+ .settings-row
+ +checkbox('Write throttling enabled', `${model}.writeThrottlingEnabled`, '"DataStorageWriteThrottlingEnabled"',
+ 'Throttle threads that generate dirty pages too fast during ongoing checkpoint')
+ .col-sm-6
+ +preview-xml-java(model, 'clusterDataStorageConfiguration')
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/web-console/frontend/app/modules/states/configuration/clusters/memory.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/memory.pug b/modules/web-console/frontend/app/modules/states/configuration/clusters/memory.pug
index e22afe2..705ba91 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/memory.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/memory.pug
@@ -20,7 +20,7 @@ include /app/helpers/jade/mixins
-var model = 'backupItem.memoryConfiguration'
-var memoryPolicies = model + '.memoryPolicies'
-.panel.panel-default(ng-show='$ctrl.available("2.0.0")' ng-form=form novalidate)
+.panel.panel-default(ng-show='$ctrl.available(["2.0.0", "2.3.0"])' ng-form=form novalidate)
.panel-heading(bs-collapse-toggle ng-click=`ui.loadPanel('${form}')`)
ignite-form-panel-chevron
label Memory configuration
@@ -29,7 +29,7 @@ include /app/helpers/jade/mixins
| #[a(href="https://apacheignite.readme.io/docs/durable-memory" target="_blank") More info]
ignite-form-revert
.panel-collapse(role='tabpanel' bs-collapse-target id=`${form}`)
- .panel-body(ng-if=`$ctrl.available("2.0.0") && ui.isPanelLoaded('${form}')`)
+ .panel-body(ng-if=`$ctrl.available(["2.0.0", "2.3.0"]) && ui.isPanelLoaded('${form}')`)
.col-sm-6
.settings-row
+number-min-max('Page size:', model + '.pageSize', '"MemoryConfigurationPageSize"',
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/web-console/frontend/app/modules/states/configuration/clusters/persistence.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/persistence.pug b/modules/web-console/frontend/app/modules/states/configuration/clusters/persistence.pug
index 50a569b..fcc170e 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/persistence.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/persistence.pug
@@ -20,7 +20,7 @@ include /app/helpers/jade/mixins
-var model = 'backupItem.persistenceStoreConfiguration'
-var enabled = model + '.enabled'
-.panel.panel-default(ng-show='$ctrl.available("2.1.0")' ng-form=form novalidate)
+.panel.panel-default(ng-show='$ctrl.available(["2.1.0", "2.3.0"])' ng-form=form novalidate)
.panel-heading(bs-collapse-toggle ng-click=`ui.loadPanel('${form}')`)
ignite-form-panel-chevron
label Persistence store
@@ -29,7 +29,7 @@ include /app/helpers/jade/mixins
//- TODO IGNITE-5415 Add link to documentation.
ignite-form-revert
.panel-collapse(role='tabpanel' bs-collapse-target id=`${form}`)
- .panel-body(ng-if=`$ctrl.available("2.1.0") && ui.isPanelLoaded('${form}')`)
+ .panel-body(ng-if=`$ctrl.available(["2.1.0", "2.3.0"]) && ui.isPanelLoaded('${form}')`)
.col-sm-6
.settings-row
+checkbox('Enabled', enabled, '"PersistenceEnabled"', 'Flag indicating whether to configure persistent configuration')
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/web-console/frontend/app/services/Clusters.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/services/Clusters.js b/modules/web-console/frontend/app/services/Clusters.js
index 4e38a58..dd2f598 100644
--- a/modules/web-console/frontend/app/services/Clusters.js
+++ b/modules/web-console/frontend/app/services/Clusters.js
@@ -60,6 +60,12 @@ export default class Clusters {
},
swapSpaceSpi: {},
transactionConfiguration: {},
+ dataStorageConfiguration: {
+ defaultDataRegionConfiguration: {
+ name: 'default'
+ },
+ dataRegionConfigurations: []
+ },
memoryConfiguration: {
memoryPolicies: [{
name: 'default',
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/web-console/frontend/app/services/Version.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/services/Version.service.js b/modules/web-console/frontend/app/services/Version.service.js
index beb27fa..8b67eb7 100644
--- a/modules/web-console/frontend/app/services/Version.service.js
+++ b/modules/web-console/frontend/app/services/Version.service.js
@@ -77,7 +77,11 @@ export default class IgniteVersion {
this.supportedVersions = [
{
- label: 'Ignite 2.x',
+ label: 'Ignite 2.3',
+ ignite: '2.3.0'
+ },
+ {
+ label: 'Ignite 2.1',
ignite: '2.2.0'
},
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/web-console/frontend/controllers/clusters-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/controllers/clusters-controller.js b/modules/web-console/frontend/controllers/clusters-controller.js
index 8340b4d..2485fa6 100644
--- a/modules/web-console/frontend/controllers/clusters-controller.js
+++ b/modules/web-console/frontend/controllers/clusters-controller.js
@@ -176,6 +176,8 @@ export default ['$rootScope', '$scope', '$http', '$state', '$timeout', 'IgniteLe
}
else if (field.type === 'memoryPolicies')
$scope.backupItem.memoryConfiguration.memoryPolicies.push({});
+ else if (field.type === 'dataRegions')
+ $scope.backupItem.dataStorageConfiguration.dataRegionConfigurations.push({});
else if (field.type === 'serviceConfigurations')
$scope.backupItem.serviceConfigurations.push({});
else if (field.type === 'executorConfigurations')
@@ -329,6 +331,9 @@ export default ['$rootScope', '$scope', '$http', '$state', '$timeout', 'IgniteLe
if (!cluster.memoryConfiguration)
cluster.memoryConfiguration = { memoryPolicies: [] };
+ if (!cluster.dataStorageConfiguration)
+ cluster.dataStorageConfiguration = { dataRegionConfigurations: [] };
+
if (!cluster.hadoopConfiguration)
cluster.hadoopConfiguration = { nativeLibraryNames: [] };
@@ -712,6 +717,53 @@ export default ['$rootScope', '$scope', '$http', '$state', '$timeout', 'IgniteLe
}));
}
+ function checkDataStorageConfiguration(item) {
+ const dataStorage = item.dataStorageConfiguration;
+
+ if ((dataStorage.systemRegionMaxSize || 104857600) < (dataStorage.systemRegionInitialSize || 41943040))
+ return ErrorPopover.show('DataStorageSystemRegionMaxSize', 'System data region maximum size should be greater than initial size', $scope.ui, 'dataStorageConfiguration');
+
+ const pageSize = dataStorage.pageSize;
+
+ if (pageSize > 0 && (pageSize & (pageSize - 1) !== 0)) {
+ ErrorPopover.show('DataStorageConfigurationPageSize', 'Page size must be power of 2', $scope.ui, 'dataStorageConfiguration');
+
+ return false;
+ }
+
+ return _.isNil(_.find(dataStorage.dataRegionConfigurations, (curPlc, curIx) => {
+ if (curPlc.name === 'sysMemPlc') {
+ ErrorPopover.show('DfltRegionPolicyName' + curIx, '"sysMemPlc" policy name is reserved for internal use', $scope.ui, 'dataStorageConfiguration');
+
+ return true;
+ }
+
+ if (_.find(dataStorage.dataRegionConfigurations, (plc, ix) => curIx > ix && (curPlc.name || 'default') === (plc.name || 'default'))) {
+ ErrorPopover.show('DfltRegionPolicyName' + curIx, 'Data region with that name is already configured', $scope.ui, 'dataStorageConfiguration');
+
+ return true;
+ }
+
+ if (curPlc.maxSize && curPlc.maxSize < (curPlc.initialSize || 268435456)) {
+ ErrorPopover.show('DfltRegionPolicyMaxSize' + curIx, 'Maximum size should be greater than initial size', $scope.ui, 'dataStorageConfiguration');
+
+ return true;
+ }
+
+ if (curPlc.maxSize) {
+ const maxPoolSize = Math.floor(curPlc.maxSize / (dataStorage.pageSize || 2048) / 10);
+
+ if (maxPoolSize < (curPlc.emptyPagesPoolSize || 100)) {
+ ErrorPopover.show('DfltRegionPolicyEmptyPagesPoolSize' + curIx, 'Evicted pages pool size should be lesser than ' + maxPoolSize, $scope.ui, 'dataStorageConfiguration');
+
+ return true;
+ }
+ }
+
+ return false;
+ }));
+ }
+
function checkODBC(item) {
if (_.get(item, 'odbc.odbcEnabled') && _.get(item, 'marshaller.kind'))
return ErrorPopover.show('odbcEnabledInput', 'ODBC can only be used with BinaryMarshaller', $scope.ui, 'odbcConfiguration');
@@ -786,7 +838,7 @@ export default ['$rootScope', '$scope', '$http', '$state', '$timeout', 'IgniteLe
}
// Check cluster logical consistency.
- function validate(item) {
+ this.validate = (item) => {
ErrorPopover.hide();
if (LegacyUtils.isEmptyString(item.name))
@@ -813,13 +865,16 @@ export default ['$rootScope', '$scope', '$http', '$state', '$timeout', 'IgniteLe
if (!checkCommunicationConfiguration(item))
return false;
+ if (!this.available('2.3.0') && !checkDataStorageConfiguration(item))
+ return false;
+
if (!checkDiscoveryConfiguration(item))
return false;
if (!checkLoadBalancingConfiguration(item))
return false;
- if (!checkMemoryConfiguration(item))
+ if (this.available(['2.0.0', '2.3.0']) && !checkMemoryConfiguration(item))
return false;
if (!checkODBC(item))
@@ -838,7 +893,7 @@ export default ['$rootScope', '$scope', '$http', '$state', '$timeout', 'IgniteLe
return false;
return true;
- }
+ };
// Save cluster in database.
function save(item) {
@@ -882,7 +937,7 @@ export default ['$rootScope', '$scope', '$http', '$state', '$timeout', 'IgniteLe
}
// Save cluster.
- $scope.saveItem = function() {
+ $scope.saveItem = () => {
const item = $scope.backupItem;
const swapConfigured = item.swapSpaceSpi && item.swapSpaceSpi.kind;
@@ -890,7 +945,7 @@ export default ['$rootScope', '$scope', '$http', '$state', '$timeout', 'IgniteLe
if (!swapConfigured && _.find(clusterCaches(item), (cache) => cache.swapEnabled))
_.merge(item, {swapSpaceSpi: {kind: 'FileSwapSpaceSpi'}});
- if (validate(item))
+ if (this.validate(item))
save(item);
};
@@ -899,8 +954,8 @@ export default ['$rootScope', '$scope', '$http', '$state', '$timeout', 'IgniteLe
}
// Clone cluster with new name.
- $scope.cloneItem = function() {
- if (validate($scope.backupItem)) {
+ $scope.cloneItem = () => {
+ if (this.validate($scope.backupItem)) {
Input.clone($scope.backupItem.name, _clusterNames()).then((newName) => {
const item = angular.copy($scope.backupItem);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/web-console/frontend/views/configuration/clusters.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/configuration/clusters.tpl.pug b/modules/web-console/frontend/views/configuration/clusters.tpl.pug
index f0d88b7..26a1da1 100644
--- a/modules/web-console/frontend/views/configuration/clusters.tpl.pug
+++ b/modules/web-console/frontend/views/configuration/clusters.tpl.pug
@@ -49,6 +49,10 @@ include /app/helpers/jade/mixins
include /app/modules/states/configuration/clusters/communication
include /app/modules/states/configuration/clusters/connector
include /app/modules/states/configuration/clusters/deployment
+
+ //- Since ignite 2.3
+ include /app/modules/states/configuration/clusters/data-storage
+
include /app/modules/states/configuration/clusters/discovery
include /app/modules/states/configuration/clusters/events
include /app/modules/states/configuration/clusters/failover
@@ -58,7 +62,7 @@ include /app/helpers/jade/mixins
include /app/modules/states/configuration/clusters/logger
include /app/modules/states/configuration/clusters/marshaller
- //- Since ignite 2.0
+ //- Since ignite 2.0, deprecated in ignite 2.3
include /app/modules/states/configuration/clusters/memory
include /app/modules/states/configuration/clusters/misc
@@ -67,7 +71,7 @@ include /app/helpers/jade/mixins
//- Deprecated in ignite 2.1
include /app/modules/states/configuration/clusters/odbc
- //- Since ignite 2.1
+ //- Since ignite 2.1, deprecated in ignite 2.3
include /app/modules/states/configuration/clusters/persistence
include /app/modules/states/configuration/clusters/sql-connector
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
index 594fa1f..ba96b6c 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
@@ -20,8 +20,8 @@ package org.apache.ignite.yardstick;
import com.beust.jcommander.Parameter;
import org.apache.ignite.IgniteDataStreamer;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.internal.util.tostring.GridToStringBuilder;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.transactions.TransactionConcurrency;
@@ -206,7 +206,7 @@ public class IgniteBenchmarkArguments {
/** */
@Parameter(names = {"-ps", "--pageSize"}, description = "Page size")
- private int pageSize = MemoryConfiguration.DFLT_PAGE_SIZE;
+ private int pageSize = DataStorageConfiguration.DFLT_PAGE_SIZE;
/** */
@Parameter(names = {"-sl", "--stringLength"}, description = "Test string length")
@@ -253,7 +253,7 @@ public class IgniteBenchmarkArguments {
private int streamerBufSize = IgniteDataStreamer.DFLT_PER_NODE_BUFFER_SIZE;
/**
- * @return {@code True} if need set {@link PersistentStoreConfiguration}.
+ * @return {@code True} if need set {@link DataStorageConfiguration}.
*/
public boolean persistentStoreEnabled() {
return persistentStoreEnabled;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
index 35fa949..9770fa3 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
@@ -28,10 +28,9 @@ import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy;
import org.apache.ignite.configuration.BinaryConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.ConnectorConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.TransactionConfiguration;
import org.apache.ignite.internal.util.IgniteUtils;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -156,24 +155,24 @@ public class IgniteNode implements BenchmarkServer {
c.setCommunicationSpi(commSpi);
- if (args.getPageSize() != MemoryConfiguration.DFLT_PAGE_SIZE) {
- MemoryConfiguration memCfg = c.getMemoryConfiguration();
+ if (args.getPageSize() != DataStorageConfiguration.DFLT_PAGE_SIZE) {
+ DataStorageConfiguration memCfg = c.getDataStorageConfiguration();
if (memCfg == null) {
- memCfg = new MemoryConfiguration();
+ memCfg = new DataStorageConfiguration();
- c.setMemoryConfiguration(memCfg);
+ c.setDataStorageConfiguration(memCfg);
}
memCfg.setPageSize(args.getPageSize());
}
if (args.persistentStoreEnabled()) {
- PersistentStoreConfiguration pcCfg = new PersistentStoreConfiguration();
+ DataStorageConfiguration pcCfg = new DataStorageConfiguration();
c.setBinaryConfiguration(new BinaryConfiguration().setCompactFooter(false));
- c.setPersistentStoreConfiguration(pcCfg);
+ c.setDataStorageConfiguration(pcCfg);
}
ignite = IgniteSpring.start(c, appCtx);
[21/50] [abbrv] ignite git commit: IGNITE-6030 Allow enabling
persistence per data region
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
index 9a2e028..de3b60a 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
@@ -57,18 +57,17 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.management.ObjectName;
+import org.apache.ignite.DataStorageMetrics;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.IgniteSystemProperties;
-import org.apache.ignite.PersistenceMetrics;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CheckpointWriteOrder;
import org.apache.ignite.configuration.DataPageEvictionMode;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.EventType;
import org.apache.ignite.internal.GridKernalContext;
@@ -139,7 +138,7 @@ import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.util.worker.GridWorker;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteOutClosure;
-import org.apache.ignite.mxbean.PersistenceMetricsMXBean;
+import org.apache.ignite.mxbean.DataStorageMetricsMXBean;
import org.apache.ignite.thread.IgniteThread;
import org.apache.ignite.thread.IgniteThreadPoolExecutor;
import org.jetbrains.annotations.NotNull;
@@ -229,7 +228,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
};
/** */
- private static final String MBEAN_NAME = "PersistenceMetrics";
+ private static final String MBEAN_NAME = "DataStorageMetrics";
/** */
private static final String MBEAN_GROUP = "Persistent Store";
@@ -262,7 +261,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
private volatile boolean printCheckpointStats = true;
/** Database configuration. */
- private final PersistentStoreConfiguration persistenceCfg;
+ private final DataStorageConfiguration persistenceCfg;
/** */
private final Collection<DbCheckpointListener> lsnrs = new CopyOnWriteArrayList<>();
@@ -301,7 +300,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
private IgniteCacheSnapshotManager snapshotMgr;
/** */
- private PersistenceMetricsImpl persStoreMetrics;
+ private DataStorageMetricsImpl persStoreMetrics;
/** */
private ObjectName persistenceMetricsMbeanName;
@@ -318,18 +317,18 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
public GridCacheDatabaseSharedManager(GridKernalContext ctx) {
IgniteConfiguration cfg = ctx.config();
- persistenceCfg = cfg.getPersistentStoreConfiguration();
+ persistenceCfg = cfg.getDataStorageConfiguration();
- assert persistenceCfg != null : "PageStore should not be created if persistence is disabled.";
+ assert persistenceCfg != null;
- checkpointFreq = persistenceCfg.getCheckpointingFrequency();
+ checkpointFreq = persistenceCfg.getCheckpointFrequency();
lockWaitTime = persistenceCfg.getLockWaitTime();
- persStoreMetrics = new PersistenceMetricsImpl(
+ persStoreMetrics = new DataStorageMetricsImpl(
persistenceCfg.isMetricsEnabled(),
- persistenceCfg.getRateTimeInterval(),
- persistenceCfg.getSubIntervals()
+ persistenceCfg.getMetricsRateTimeInterval(),
+ persistenceCfg.getMetricsSubIntervalCount()
);
}
@@ -400,12 +399,12 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
*
*/
private void initDataBase() {
- if (persistenceCfg.getCheckpointingThreads() > 1)
+ if (persistenceCfg.getCheckpointThreads() > 1)
asyncRunner = new IgniteThreadPoolExecutor(
"checkpoint-runner",
cctx.igniteInstanceName(),
- persistenceCfg.getCheckpointingThreads(),
- persistenceCfg.getCheckpointingThreads(),
+ persistenceCfg.getCheckpointThreads(),
+ persistenceCfg.getCheckpointThreads(),
30_000,
new LinkedBlockingQueue<Runnable>()
);
@@ -420,26 +419,26 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
* @return Checkpoint buffer size.
*/
public static long checkpointBufferSize(IgniteConfiguration cfg) {
- PersistentStoreConfiguration persistenceCfg = cfg.getPersistentStoreConfiguration();
+ DataStorageConfiguration persistenceCfg = cfg.getDataStorageConfiguration();
if (persistenceCfg == null)
return 0L;
- long res = persistenceCfg.getCheckpointingPageBufferSize();
+ long res = persistenceCfg.getCheckpointPageBufferSize();
if (res == 0L) {
res = DFLT_CHECKPOINTING_PAGE_BUFFER_SIZE;
- MemoryConfiguration memCfg = cfg.getMemoryConfiguration();
+ DataStorageConfiguration memCfg = cfg.getDataStorageConfiguration();
assert memCfg != null;
- long totalSize = memCfg.getSystemCacheMaxSize();
+ long totalSize = memCfg.getSystemRegionMaxSize();
- if (memCfg.getMemoryPolicies() == null)
- totalSize += MemoryConfiguration.DFLT_MEMORY_POLICY_MAX_SIZE;
+ if (memCfg.getDataRegionConfigurations() == null)
+ totalSize += DataStorageConfiguration.DFLT_DATA_REGION_MAX_SIZE;
else {
- for (MemoryPolicyConfiguration memPlc : memCfg.getMemoryPolicies()) {
+ for (DataRegionConfiguration memPlc : memCfg.getDataRegionConfigurations()) {
if (Long.MAX_VALUE - memPlc.getMaxSize() > totalSize)
totalSize += memPlc.getMaxSize();
else {
@@ -465,11 +464,6 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
}
/** {@inheritDoc} */
- @Override protected void initPageMemoryDataStructures(MemoryConfiguration dbCfg) throws IgniteCheckedException {
- // No-op.
- }
-
- /** {@inheritDoc} */
@Override public void onActivate(GridKernalContext ctx) throws IgniteCheckedException {
if (log.isDebugEnabled())
log.debug("Activate database manager [id=" + cctx.localNodeId() +
@@ -522,7 +516,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
MBEAN_GROUP,
MBEAN_NAME,
persStoreMetrics,
- PersistenceMetricsMXBean.class);
+ DataStorageMetricsMXBean.class);
}
catch (Throwable e) {
throw new IgniteCheckedException("Failed to register " + MBEAN_NAME + " MBean.", e);
@@ -549,14 +543,19 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
}
/** {@inheritDoc} */
- @Override protected IgniteOutClosure<Float> fillFactorProvider(final String memPlcName) {
+ @Override protected IgniteOutClosure<Float> fillFactorProvider(final DataRegionConfiguration dataRegCfg) {
+ if (!dataRegCfg.isPersistenceEnabled())
+ return super.fillFactorProvider(dataRegCfg);
+
+ final String dataRegName = dataRegCfg.getName();
+
return new IgniteOutClosure<Float>() {
@Override public Float apply() {
long loadSize = 0L;
long totalSize = 0L;
for (CacheGroupContext grpCtx : cctx.cache().cacheGroups()) {
- if (!grpCtx.memoryPolicy().config().getName().equals(memPlcName))
+ if (!grpCtx.dataRegion().config().getName().equals(dataRegName))
continue;
assert grpCtx.offheap() instanceof GridCacheOffheapManager;
@@ -678,10 +677,13 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
/** {@inheritDoc} */
@Override protected PageMemory createPageMemory(
DirectMemoryProvider memProvider,
- MemoryConfiguration memCfg,
- MemoryPolicyConfiguration plcCfg,
- MemoryMetricsImpl memMetrics
+ DataStorageConfiguration memCfg,
+ DataRegionConfiguration plcCfg,
+ DataRegionMetricsImpl memMetrics
) {
+ if (!plcCfg.isPersistenceEnabled())
+ return super.createPageMemory(memProvider, memCfg, plcCfg, memMetrics);
+
memMetrics.persistenceEnabled(true);
long cacheSize = plcCfg.getMaxSize();
@@ -741,15 +743,18 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
}
/** {@inheritDoc} */
- @Override protected void checkPolicyEvictionProperties(MemoryPolicyConfiguration plcCfg, MemoryConfiguration dbCfg)
+ @Override protected void checkRegionEvictionProperties(DataRegionConfiguration regCfg, DataStorageConfiguration dbCfg)
throws IgniteCheckedException {
- if (plcCfg.getPageEvictionMode() != DataPageEvictionMode.DISABLED)
- U.warn(log, "Page eviction mode for [" + plcCfg.getName() + "] memory region is ignored " +
+ if (!regCfg.isPersistenceEnabled())
+ super.checkRegionEvictionProperties(regCfg, dbCfg);
+
+ if (regCfg.getPageEvictionMode() != DataPageEvictionMode.DISABLED)
+ U.warn(log, "Page eviction mode for [" + regCfg.getName() + "] memory region is ignored " +
"because Ignite Native Persistence is enabled");
}
/** {@inheritDoc} */
- @Override protected void checkPageSize(MemoryConfiguration memCfg) {
+ @Override protected void checkPageSize(DataStorageConfiguration memCfg) {
if (memCfg.getPageSize() == 0) {
try {
assert cctx.pageStore() instanceof FilePageStoreManager :
@@ -767,10 +772,10 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
catch (IgniteCheckedException | IOException | IllegalArgumentException e) {
U.quietAndWarn(log, "Attempt to resolve pageSize from store files failed: " + e.getMessage());
- U.quietAndWarn(log, "Default page size will be used: " + MemoryConfiguration.DFLT_PAGE_SIZE + " bytes");
+ U.quietAndWarn(log, "Default page size will be used: " + DataStorageConfiguration.DFLT_PAGE_SIZE + " bytes");
}
- memCfg.setPageSize(MemoryConfiguration.DFLT_PAGE_SIZE);
+ memCfg.setPageSize(DataStorageConfiguration.DFLT_PAGE_SIZE);
}
}
@@ -800,7 +805,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
int pageSize = hdr.getInt();
if (pageSize == 2048) {
- U.quietAndWarn(log, "You are currently using persistent store with 2K pages (MemoryConfiguration#" +
+ U.quietAndWarn(log, "You are currently using persistent store with 2K pages (DataStorageConfiguration#" +
"pageSize). If you use SSD disk, consider migrating to 4K pages for better IO performance.");
}
@@ -923,9 +928,12 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
for (IgniteBiTuple<CacheGroupContext, Boolean> tup : stoppedGrps) {
CacheGroupContext gctx = tup.get1();
+ if (!gctx.persistenceEnabled())
+ continue;
+
snapshotMgr.onCacheGroupStop(gctx);
- PageMemoryEx pageMem = (PageMemoryEx)gctx.memoryPolicy().pageMemory();
+ PageMemoryEx pageMem = (PageMemoryEx)gctx.dataRegion().pageMemory();
Collection<Integer> grpIds = destroyed.get(pageMem);
@@ -1024,12 +1032,15 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
* @return {@code true} if all PageMemory instances are safe to update.
*/
private boolean safeToUpdatePageMemories() {
- Collection<MemoryPolicy> memPlcs = context().database().memoryPolicies();
+ Collection<DataRegion> memPlcs = context().database().dataRegions();
if (memPlcs == null)
return true;
- for (MemoryPolicy memPlc : memPlcs) {
+ for (DataRegion memPlc : memPlcs) {
+ if (!memPlc.config().isPersistenceEnabled())
+ continue;
+
PageMemoryEx pageMemEx = (PageMemoryEx)memPlc.pageMemory();
if (!pageMemEx.safeToUpdate())
@@ -1049,11 +1060,14 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
checkpointLock.readLock().unlock();
if (checkpointer != null) {
- Collection<MemoryPolicy> memPlcs = context().database().memoryPolicies();
+ Collection<DataRegion> dataRegs = context().database().dataRegions();
+
+ if (dataRegs != null) {
+ for (DataRegion dataReg : dataRegs) {
+ if (!dataReg.config().isPersistenceEnabled())
+ continue;
- if (memPlcs != null) {
- for (MemoryPolicy memPlc : memPlcs) {
- PageMemoryEx mem = (PageMemoryEx)memPlc.pageMemory();
+ PageMemoryEx mem = (PageMemoryEx)dataReg.pageMemory();
if (mem != null && !mem.safeToUpdate()) {
checkpointer.wakeupForCheckpoint(0, "too many dirty pages");
@@ -1595,7 +1609,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
*
* @param grpId Cache group id.
* @return PageMemoryEx instance.
- * @throws IgniteCheckedException if no MemoryPolicy is configured for a name obtained from cache descriptor.
+ * @throws IgniteCheckedException if no DataRegion is configured for a name obtained from cache descriptor.
*/
private PageMemoryEx getPageMemoryForCacheGroup(int grpId) throws IgniteCheckedException {
// TODO IGNITE-5075: cache descriptor can be removed.
@@ -1606,9 +1620,9 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
if (desc == null)
throw new IgniteCheckedException("Failed to find cache group descriptor [grpId=" + grpId + ']');
- String memPlcName = desc.config().getMemoryPolicyName();
+ String memPlcName = desc.config().getDataRegionName();
- return (PageMemoryEx)sharedCtx.database().memoryPolicy(memPlcName).pageMemory();
+ return (PageMemoryEx)sharedCtx.database().dataRegion(memPlcName).pageMemory();
}
/**
@@ -1687,9 +1701,12 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
continue;
}
+ if (!grp.dataRegion().config().isPersistenceEnabled())
+ continue;
+
int grpId = grp.groupId();
- PageMemoryEx pageMem = (PageMemoryEx)grp.memoryPolicy().pageMemory();
+ PageMemoryEx pageMem = (PageMemoryEx)grp.dataRegion().pageMemory();
for (int i = 0; i < grp.affinity().partitions(); i++) {
if (storeMgr.exists(grpId, i)) {
@@ -1822,14 +1839,17 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
long start = System.currentTimeMillis();
- Collection<MemoryPolicy> memPolicies = context().database().memoryPolicies();
+ Collection<DataRegion> memPolicies = context().database().dataRegions();
List<IgniteBiTuple<PageMemory, Collection<FullPageId>>> cpEntities = new ArrayList<>(memPolicies.size());
- for (MemoryPolicy memPlc : memPolicies) {
- PageMemoryEx pageMem = (PageMemoryEx)memPlc.pageMemory();
- cpEntities.add(new IgniteBiTuple<PageMemory, Collection<FullPageId>>(pageMem,
- (pageMem).beginCheckpoint()));
+ for (DataRegion memPlc : memPolicies) {
+ if (memPlc.config().isPersistenceEnabled()) {
+ PageMemoryEx pageMem = (PageMemoryEx)memPlc.pageMemory();
+
+ cpEntities.add(new IgniteBiTuple<PageMemory, Collection<FullPageId>>(
+ pageMem, (pageMem).beginCheckpoint()));
+ }
}
tmpWriteBuf.order(ByteOrder.nativeOrder());
@@ -2426,11 +2446,14 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
* pages.
*/
private IgniteBiTuple<Collection<GridMultiCollectionWrapper<FullPageId>>, Integer> beginAllCheckpoints() {
- Collection<GridMultiCollectionWrapper<FullPageId>> res = new ArrayList(memoryPolicies().size());
+ Collection<GridMultiCollectionWrapper<FullPageId>> res = new ArrayList(dataRegions().size());
int pagesNum = 0;
- for (MemoryPolicy memPlc : memoryPolicies()) {
+ for (DataRegion memPlc : dataRegions()) {
+ if (!memPlc.config().isPersistenceEnabled())
+ continue;
+
GridMultiCollectionWrapper<FullPageId> nextCpPagesCol = ((PageMemoryEx)memPlc.pageMemory()).beginCheckpoint();
pagesNum += nextCpPagesCol.size();
@@ -2446,8 +2469,12 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
*/
private void markCheckpointEnd(Checkpoint chp) throws IgniteCheckedException {
synchronized (this) {
- for (MemoryPolicy memPlc : memoryPolicies())
+ for (DataRegion memPlc : dataRegions()) {
+ if (!memPlc.config().isPersistenceEnabled())
+ continue;
+
((PageMemoryEx)memPlc.pageMemory()).finishCheckpoint();
+ }
if (chp.hasDelta())
writeCheckpointEntry(
@@ -2495,8 +2522,8 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
/**
* Reorders list of checkpoint pages and splits them into needed number of sublists according to
- * {@link PersistentStoreConfiguration#getCheckpointingThreads()} and
- * {@link PersistentStoreConfiguration#getCheckpointWriteOrder()}.
+ * {@link DataStorageConfiguration#getCheckpointThreads()} and
+ * {@link DataStorageConfiguration#getCheckpointWriteOrder()}.
*
* @param cpPagesTuple Checkpoint pages tuple.
*/
@@ -2523,7 +2550,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
});
}
- int cpThreads = persistenceCfg.getCheckpointingThreads();
+ int cpThreads = persistenceCfg.getCheckpointThreads();
int pagesSubLists = cpThreads == 1 ? 1 : cpThreads * 4;
// Splitting pages to (threads * 4) subtasks. If any thread will be faster, it will help slower threads.
@@ -2606,7 +2633,10 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
if (grp == null)
continue;
- PageMemoryEx pageMem = (PageMemoryEx)grp.memoryPolicy().pageMemory();
+ if (!grp.dataRegion().config().isPersistenceEnabled())
+ continue;
+
+ PageMemoryEx pageMem = (PageMemoryEx)grp.dataRegion().pageMemory();
Integer tag = pageMem.getForCheckpoint(
fullId, tmpWriteBuf, persStoreMetrics.metricsEnabled() ? tracker : null);
@@ -3313,14 +3343,14 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
}
/** {@inheritDoc} */
- @Override public PersistenceMetrics persistentStoreMetrics() {
- return new PersistenceMetricsSnapshot(persStoreMetrics);
+ @Override public DataStorageMetrics persistentStoreMetrics() {
+ return new DataStorageMetricsSnapshot(persStoreMetrics);
}
/**
*
*/
- public PersistenceMetricsImpl persistentStoreMetricsImpl() {
+ public DataStorageMetricsImpl persistentStoreMetricsImpl() {
return persStoreMetrics;
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java
index 5c91a4f..6ed62f8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java
@@ -93,14 +93,14 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
reuseList = new ReuseListImpl(grp.groupId(),
grp.cacheOrGroupName(),
- grp.memoryPolicy().pageMemory(),
+ grp.dataRegion().pageMemory(),
ctx.wal(),
reuseListRoot.pageId().pageId(),
reuseListRoot.isAllocated());
RootPage metastoreRoot = metas.treeRoot;
- metaStore = new MetadataStorage(grp.memoryPolicy().pageMemory(),
+ metaStore = new MetadataStorage(grp.dataRegion().pageMemory(),
ctx.wal(),
globalRemoveId(),
grp.groupId(),
@@ -126,7 +126,7 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
pendingEntries = new PendingEntriesTree(
grp,
name,
- grp.memoryPolicy().pageMemory(),
+ grp.dataRegion().pageMemory(),
pendingRootPage.pageId().pageId(),
reuseList,
pendingRootPage.isAllocated()
@@ -148,7 +148,7 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
/** {@inheritDoc} */
@Override public void onCheckpointBegin(Context ctx) throws IgniteCheckedException {
- assert grp.memoryPolicy().pageMemory() instanceof PageMemoryEx;
+ assert grp.dataRegion().pageMemory() instanceof PageMemoryEx;
reuseList.saveMetadata();
@@ -185,7 +185,7 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
int size = store.fullSize();
long rmvId = globalRemoveId().get();
- PageMemoryEx pageMem = (PageMemoryEx)grp.memoryPolicy().pageMemory();
+ PageMemoryEx pageMem = (PageMemoryEx)grp.dataRegion().pageMemory();
IgniteWriteAheadLogManager wal = this.ctx.wal();
if (size > 0 || updCntr > 0) {
@@ -437,7 +437,7 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
saveStoreMetadata(store, null, false, true);
- PageMemoryEx pageMemory = (PageMemoryEx)grp.memoryPolicy().pageMemory();
+ PageMemoryEx pageMemory = (PageMemoryEx)grp.dataRegion().pageMemory();
int tag = pageMemory.invalidate(grp.groupId(), p);
@@ -511,7 +511,7 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
* @throws IgniteCheckedException If failed.
*/
private Metas getOrAllocateCacheMetas() throws IgniteCheckedException {
- PageMemoryEx pageMem = (PageMemoryEx)grp.memoryPolicy().pageMemory();
+ PageMemoryEx pageMem = (PageMemoryEx)grp.dataRegion().pageMemory();
IgniteWriteAheadLogManager wal = ctx.wal();
int grpId = grp.groupId();
@@ -915,8 +915,8 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
freeList = new FreeListImpl(
grp.groupId(),
grp.cacheOrGroupName() + "-" + partId,
- grp.memoryPolicy().memoryMetrics(),
- grp.memoryPolicy(),
+ grp.dataRegion().memoryMetrics(),
+ grp.dataRegion(),
null,
ctx.wal(),
reuseRoot.pageId().pageId(),
@@ -942,7 +942,7 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
}
};
- PageMemoryEx pageMem = (PageMemoryEx)grp.memoryPolicy().pageMemory();
+ PageMemoryEx pageMem = (PageMemoryEx)grp.dataRegion().pageMemory();
delegate0 = new CacheDataStoreImpl(partId, name, rowStore, dataTree);
@@ -1036,7 +1036,7 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
* @return Partition metas.
*/
private Metas getOrAllocatePartitionMetas() throws IgniteCheckedException {
- PageMemoryEx pageMem = (PageMemoryEx)grp.memoryPolicy().pageMemory();
+ PageMemoryEx pageMem = (PageMemoryEx)grp.dataRegion().pageMemory();
IgniteWriteAheadLogManager wal = ctx.wal();
int grpId = grp.groupId();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
index d7682f0..da598d1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
@@ -25,14 +25,14 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.apache.ignite.DataRegionMetrics;
+import org.apache.ignite.DataStorageMetrics;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.MemoryMetrics;
-import org.apache.ignite.PersistenceMetrics;
import org.apache.ignite.configuration.DataPageEvictionMode;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.mem.DirectMemoryProvider;
@@ -57,24 +57,24 @@ import org.apache.ignite.internal.processors.cache.persistence.tree.reuse.ReuseL
import org.apache.ignite.internal.processors.cluster.IgniteChangeGlobalStateSupport;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.T2;
+import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.LT;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteOutClosure;
-import org.apache.ignite.mxbean.MemoryMetricsMXBean;
+import org.apache.ignite.mxbean.DataRegionMetricsMXBean;
import org.jetbrains.annotations.Nullable;
-import static org.apache.ignite.configuration.MemoryConfiguration.DFLT_MEMORY_POLICY_INITIAL_SIZE;
-import static org.apache.ignite.configuration.MemoryConfiguration.DFLT_MEM_PLC_DEFAULT_NAME;
-import static org.apache.ignite.configuration.MemoryConfiguration.DFLT_PAGE_SIZE;
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_DATA_REG_DEFAULT_NAME;
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_PAGE_SIZE;
/**
*
*/
public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdapter
implements IgniteChangeGlobalStateSupport, CheckpointLockStateChecker {
- /** MemoryPolicyConfiguration name reserved for internal caches. */
- static final String SYSTEM_MEMORY_POLICY_NAME = "sysMemPlc";
+ /** DataRegionConfiguration name reserved for internal caches. */
+ static final String SYSTEM_DATA_REGION_NAME = "sysMemPlc";
/** Minimum size of memory chunk */
private static final long MIN_PAGE_MEMORY_SIZE = 10 * 1024 * 1024;
@@ -83,16 +83,16 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
private static final long MAX_PAGE_MEMORY_INIT_SIZE_32_BIT = 2L * 1024 * 1024 * 1024;
/** */
- protected Map<String, MemoryPolicy> memPlcMap;
+ protected Map<String, DataRegion> dataRegionMap;
/** */
- protected Map<String, MemoryMetrics> memMetricsMap;
+ protected Map<String, DataRegionMetrics> memMetricsMap;
/** */
- protected MemoryPolicy dfltMemPlc;
+ protected DataRegion dfltDataRegion;
/** */
- private Map<String, FreeListImpl> freeListMap;
+ protected Map<String, FreeListImpl> freeListMap;
/** */
private FreeListImpl dfltFreeList;
@@ -102,10 +102,10 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
/** {@inheritDoc} */
@Override protected void start0() throws IgniteCheckedException {
- if (cctx.kernalContext().clientNode() && cctx.kernalContext().config().getMemoryConfiguration() == null)
+ if (cctx.kernalContext().clientNode() && cctx.kernalContext().config().getDataStorageConfiguration() == null)
return;
- MemoryConfiguration memCfg = cctx.kernalContext().config().getMemoryConfiguration();
+ DataStorageConfiguration memCfg = cctx.kernalContext().config().getDataStorageConfiguration();
assert memCfg != null;
@@ -115,7 +115,7 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
}
/**
- * Registers MBeans for all MemoryMetrics configured in this instance.
+ * Registers MBeans for all DataRegionMetrics configured in this instance.
*/
private void registerMetricsMBeans() {
if(U.IGNITE_MBEANS_DISABLED)
@@ -123,21 +123,21 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
IgniteConfiguration cfg = cctx.gridConfig();
- for (MemoryMetrics memMetrics : memMetricsMap.values()) {
- MemoryPolicyConfiguration memPlcCfg = memPlcMap.get(memMetrics.getName()).config();
+ for (DataRegionMetrics memMetrics : memMetricsMap.values()) {
+ DataRegionConfiguration memPlcCfg = dataRegionMap.get(memMetrics.getName()).config();
- registerMetricsMBean((MemoryMetricsImpl)memMetrics, memPlcCfg, cfg);
+ registerMetricsMBean((DataRegionMetricsImpl)memMetrics, memPlcCfg, cfg);
}
}
/**
* @param memMetrics Memory metrics.
- * @param memPlcCfg Memory policy configuration.
+ * @param dataRegionCfg Data region configuration.
* @param cfg Ignite configuration.
*/
private void registerMetricsMBean(
- MemoryMetricsImpl memMetrics,
- MemoryPolicyConfiguration memPlcCfg,
+ DataRegionMetricsImpl memMetrics,
+ DataRegionConfiguration dataRegionCfg,
IgniteConfiguration cfg
) {
assert !U.IGNITE_MBEANS_DISABLED;
@@ -146,13 +146,13 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
U.registerMBean(
cfg.getMBeanServer(),
cfg.getIgniteInstanceName(),
- "MemoryMetrics",
- memPlcCfg.getName(),
- new MemoryMetricsMXBeanImpl(memMetrics, memPlcCfg),
- MemoryMetricsMXBean.class);
+ "DataRegionMetrics",
+ dataRegionCfg.getName(),
+ new DataRegionMetricsMXBeanImpl(memMetrics, dataRegionCfg),
+ DataRegionMetricsMXBean.class);
}
catch (Throwable e) {
- U.error(log, "Failed to register MBean for MemoryMetrics with name: '" + memMetrics.getName() + "'", e);
+ U.error(log, "Failed to register MBean for DataRegionMetrics with name: '" + memMetrics.getName() + "'", e);
}
}
@@ -160,22 +160,24 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
* @param dbCfg Database config.
* @throws IgniteCheckedException If failed.
*/
- protected void initPageMemoryDataStructures(MemoryConfiguration dbCfg) throws IgniteCheckedException {
- freeListMap = U.newHashMap(memPlcMap.size());
+ protected void initPageMemoryDataStructures(DataStorageConfiguration dbCfg) throws IgniteCheckedException {
+ freeListMap = U.newHashMap(dataRegionMap.size());
- String dfltMemPlcName = dbCfg.getDefaultMemoryPolicyName();
+ String dfltMemPlcName = dbCfg.getDefaultDataRegionConfiguration().getName();
- for (MemoryPolicy memPlc : memPlcMap.values()) {
- MemoryPolicyConfiguration memPlcCfg = memPlc.config();
+ for (DataRegion memPlc : dataRegionMap.values()) {
+ DataRegionConfiguration memPlcCfg = memPlc.config();
- MemoryMetricsImpl memMetrics = (MemoryMetricsImpl) memMetricsMap.get(memPlcCfg.getName());
+ DataRegionMetricsImpl memMetrics = (DataRegionMetricsImpl) memMetricsMap.get(memPlcCfg.getName());
+
+ boolean persistenceEnabled = memPlcCfg.isPersistenceEnabled();
FreeListImpl freeList = new FreeListImpl(0,
cctx.igniteInstanceName(),
memMetrics,
memPlc,
null,
- cctx.wal(),
+ persistenceEnabled ? cctx.wal() : null,
0L,
true);
@@ -196,7 +198,7 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
*
*/
private void startMemoryPolicies() {
- for (MemoryPolicy memPlc : memPlcMap.values()) {
+ for (DataRegion memPlc : dataRegionMap.values()) {
memPlc.pageMemory().start();
memPlc.evictionTracker().start();
@@ -207,102 +209,81 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
* @param memCfg Database config.
* @throws IgniteCheckedException If failed to initialize swap path.
*/
- protected void initPageMemoryPolicies(MemoryConfiguration memCfg) throws IgniteCheckedException {
- MemoryPolicyConfiguration[] memPlcsCfgs = memCfg.getMemoryPolicies();
-
- if (memPlcsCfgs == null) {
- //reserve place for default and system memory policies
- memPlcMap = U.newHashMap(2);
- memMetricsMap = U.newHashMap(2);
-
- addMemoryPolicy(
- memCfg,
- memCfg.createDefaultPolicyConfig(),
- DFLT_MEM_PLC_DEFAULT_NAME
- );
-
- U.warn(log, "No user-defined default MemoryPolicy found; system default of 1GB size will be used.");
- }
- else {
- String dfltMemPlcName = memCfg.getDefaultMemoryPolicyName();
-
- if (DFLT_MEM_PLC_DEFAULT_NAME.equals(dfltMemPlcName) && !hasCustomDefaultMemoryPolicy(memPlcsCfgs)) {
- //reserve additional place for default and system memory policies
- memPlcMap = U.newHashMap(memPlcsCfgs.length + 2);
- memMetricsMap = U.newHashMap(memPlcsCfgs.length + 2);
+ protected void initDataRegions(DataStorageConfiguration memCfg) throws IgniteCheckedException {
+ DataRegionConfiguration[] dataRegionCfgs = memCfg.getDataRegionConfigurations();
- addMemoryPolicy(
- memCfg,
- memCfg.createDefaultPolicyConfig(),
- DFLT_MEM_PLC_DEFAULT_NAME
- );
+ int dataRegions = dataRegionCfgs == null ? 0 : dataRegionCfgs.length;
- U.warn(log, "No user-defined default MemoryPolicy found; system default of 1GB size will be used.");
- }
- else {
- //reserve additional space for system memory policy only
- memPlcMap = U.newHashMap(memPlcsCfgs.length + 1);
- memMetricsMap = U.newHashMap(memPlcsCfgs.length + 1);
- }
+ dataRegionMap = U.newHashMap(2 + dataRegions);
+ memMetricsMap = U.newHashMap(2 + dataRegions);
- for (MemoryPolicyConfiguration memPlcCfg : memPlcsCfgs)
- addMemoryPolicy(memCfg, memPlcCfg, memPlcCfg.getName());
+ if (dataRegionCfgs != null) {
+ for (DataRegionConfiguration dataRegionCfg : dataRegionCfgs)
+ addDataRegion(memCfg, dataRegionCfg, dataRegionCfg.getName());
}
- addMemoryPolicy(
+ addDataRegion(
+ memCfg,
+ memCfg.getDefaultDataRegionConfiguration(),
+ memCfg.getDefaultDataRegionConfiguration().getName()
+ );
+
+ addDataRegion(
memCfg,
- createSystemMemoryPolicy(
- memCfg.getSystemCacheInitialSize(),
- memCfg.getSystemCacheMaxSize()
+ createSystemDataRegion(
+ memCfg.getSystemRegionInitialSize(),
+ memCfg.getSystemRegionMaxSize()
),
- SYSTEM_MEMORY_POLICY_NAME
+ SYSTEM_DATA_REGION_NAME
);
}
/**
- * @param memCfg Database config.
- * @param memPlcCfg Memory policy config.
- * @param memPlcName Memory policy name.
+ * @param dataStorageCfg Database config.
+ * @param dataRegionCfg Data region config.
+ * @param dataRegionName Data region name.
* @throws IgniteCheckedException If failed to initialize swap path.
*/
- private void addMemoryPolicy(
- MemoryConfiguration memCfg,
- MemoryPolicyConfiguration memPlcCfg,
- String memPlcName
+ private void addDataRegion(
+ DataStorageConfiguration dataStorageCfg,
+ DataRegionConfiguration dataRegionCfg,
+ String dataRegionName
) throws IgniteCheckedException {
- String dfltMemPlcName = memCfg.getDefaultMemoryPolicyName();
+ String dfltMemPlcName = dataStorageCfg.getDefaultDataRegionConfiguration().getName();
if (dfltMemPlcName == null)
- dfltMemPlcName = DFLT_MEM_PLC_DEFAULT_NAME;
+ dfltMemPlcName = DFLT_DATA_REG_DEFAULT_NAME;
- MemoryMetricsImpl memMetrics = new MemoryMetricsImpl(memPlcCfg, fillFactorProvider(memPlcName));
+ DataRegionMetricsImpl memMetrics = new DataRegionMetricsImpl(dataRegionCfg, fillFactorProvider(dataRegionCfg));
- MemoryPolicy memPlc = initMemory(memCfg, memPlcCfg, memMetrics);
+ DataRegion memPlc = initMemory(dataStorageCfg, dataRegionCfg, memMetrics);
- memPlcMap.put(memPlcName, memPlc);
+ dataRegionMap.put(dataRegionName, memPlc);
- memMetricsMap.put(memPlcName, memMetrics);
+ memMetricsMap.put(dataRegionName, memMetrics);
- if (memPlcName.equals(dfltMemPlcName))
- dfltMemPlc = memPlc;
- else if (memPlcName.equals(DFLT_MEM_PLC_DEFAULT_NAME))
- U.warn(log, "Memory Policy with name 'default' isn't used as a default. " +
+ if (dataRegionName.equals(dfltMemPlcName))
+ dfltDataRegion = memPlc;
+ else if (dataRegionName.equals(DFLT_DATA_REG_DEFAULT_NAME))
+ U.warn(log, "Data Region with name 'default' isn't used as a default. " +
"Please check Memory Policies configuration.");
}
/**
- * Closure that can be used to compute fill factor for provided memory policy.
+ * Closure that can be used to compute fill factor for provided data region.
*
- * @param memPlcName Memory policy name.
+ * @param dataRegCfg Data region configuration.
* @return Closure.
*/
- protected IgniteOutClosure<Float> fillFactorProvider(final String memPlcName) {
+ protected IgniteOutClosure<Float> fillFactorProvider(final DataRegionConfiguration dataRegCfg) {
+ final String dataRegName = dataRegCfg.getName();
+
return new IgniteOutClosure<Float>() {
private FreeListImpl freeList;
@Override public Float apply() {
if (freeList == null) {
- FreeListImpl freeList0 = freeListMap.get(memPlcName);
+ FreeListImpl freeList0 = freeListMap.get(dataRegName);
if (freeList0 == null)
return (float) 0;
@@ -321,11 +302,11 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
}
/**
- * @param memPlcsCfgs User-defined memory policy configurations.
+ * @param memPlcsCfgs User-defined data region configurations.
*/
- private boolean hasCustomDefaultMemoryPolicy(MemoryPolicyConfiguration[] memPlcsCfgs) {
- for (MemoryPolicyConfiguration memPlcsCfg : memPlcsCfgs) {
- if (DFLT_MEM_PLC_DEFAULT_NAME.equals(memPlcsCfg.getName()))
+ private boolean hasCustomDefaultDataRegion(DataRegionConfiguration[] memPlcsCfgs) {
+ for (DataRegionConfiguration memPlcsCfg : memPlcsCfgs) {
+ if (DFLT_DATA_REG_DEFAULT_NAME.equals(memPlcsCfg.getName()))
return true;
}
@@ -336,12 +317,12 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
* @param sysCacheInitSize Initial size of PageMemory to be created for system cache.
* @param sysCacheMaxSize Maximum size of PageMemory to be created for system cache.
*
- * @return {@link MemoryPolicyConfiguration configuration} of MemoryPolicy for system cache.
+ * @return {@link DataRegionConfiguration configuration} of DataRegion for system cache.
*/
- private MemoryPolicyConfiguration createSystemMemoryPolicy(long sysCacheInitSize, long sysCacheMaxSize) {
- MemoryPolicyConfiguration res = new MemoryPolicyConfiguration();
+ private DataRegionConfiguration createSystemDataRegion(long sysCacheInitSize, long sysCacheMaxSize) {
+ DataRegionConfiguration res = new DataRegionConfiguration();
- res.setName(SYSTEM_MEMORY_POLICY_NAME);
+ res.setName(SYSTEM_DATA_REGION_NAME);
res.setInitialSize(sysCacheInitSize);
res.setMaxSize(sysCacheMaxSize);
@@ -351,71 +332,76 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
/**
* @param memCfg configuration to validate.
*/
- private void validateConfiguration(MemoryConfiguration memCfg) throws IgniteCheckedException {
+ private void validateConfiguration(DataStorageConfiguration memCfg) throws IgniteCheckedException {
checkPageSize(memCfg);
- MemoryPolicyConfiguration[] plcCfgs = memCfg.getMemoryPolicies();
+ DataRegionConfiguration[] regCfgs = memCfg.getDataRegionConfigurations();
- Set<String> plcNames = (plcCfgs != null) ? U.<String>newHashSet(plcCfgs.length) : new HashSet<String>(0);
+ Set<String> regNames = (regCfgs != null) ? U.<String>newHashSet(regCfgs.length) : new HashSet<String>(0);
- checkSystemMemoryPolicySizeConfiguration(
- memCfg.getSystemCacheInitialSize(),
- memCfg.getSystemCacheMaxSize()
+ checkSystemDataRegionSizeConfiguration(
+ memCfg.getSystemRegionInitialSize(),
+ memCfg.getSystemRegionMaxSize()
);
- if (plcCfgs != null) {
- for (MemoryPolicyConfiguration plcCfg : plcCfgs) {
- assert plcCfg != null;
+ if (regCfgs != null) {
+ for (DataRegionConfiguration regCfg : regCfgs)
+ checkDataRegionConfiguration(memCfg, regNames, regCfg);
+ }
+
+ checkDataRegionConfiguration(memCfg, regNames, memCfg.getDefaultDataRegionConfiguration());
+ }
- checkPolicyName(plcCfg.getName(), plcNames);
+ /**
+ * @param memCfg Mem config.
+ * @param regNames Region names.
+ * @param regCfg Reg config.
+ */
+ private void checkDataRegionConfiguration(DataStorageConfiguration memCfg, Set<String> regNames,
+ DataRegionConfiguration regCfg) throws IgniteCheckedException {
+ assert regCfg != null;
- checkPolicySize(plcCfg);
+ checkDataRegionName(regCfg.getName(), regNames);
- checkMetricsProperties(plcCfg);
+ checkDataRegionSize(regCfg);
- checkPolicyEvictionProperties(plcCfg, memCfg);
- }
- }
+ checkMetricsProperties(regCfg);
- checkDefaultPolicyConfiguration(
- memCfg.getDefaultMemoryPolicyName(),
- memCfg.getDefaultMemoryPolicySize(),
- plcNames
- );
+ checkRegionEvictionProperties(regCfg, memCfg);
}
/**
* @param memCfg Memory config.
*/
- protected void checkPageSize(MemoryConfiguration memCfg) {
+ protected void checkPageSize(DataStorageConfiguration memCfg) {
if (memCfg.getPageSize() == 0)
memCfg.setPageSize(DFLT_PAGE_SIZE);
}
/**
- * @param plcCfg Memory policy config.
+ * @param regCfg data region config.
*
* @throws IgniteCheckedException if validation of memory metrics properties fails.
*/
- private static void checkMetricsProperties(MemoryPolicyConfiguration plcCfg) throws IgniteCheckedException {
- if (plcCfg.getRateTimeInterval() <= 0)
+ private static void checkMetricsProperties(DataRegionConfiguration regCfg) throws IgniteCheckedException {
+ if (regCfg.getMetricsRateTimeInterval() <= 0)
throw new IgniteCheckedException("Rate time interval must be greater than zero " +
- "(use MemoryPolicyConfiguration.rateTimeInterval property to adjust the interval) " +
- "[name=" + plcCfg.getName() +
- ", rateTimeInterval=" + plcCfg.getRateTimeInterval() + "]"
+ "(use DataRegionConfiguration.rateTimeInterval property to adjust the interval) " +
+ "[name=" + regCfg.getName() +
+ ", rateTimeInterval=" + regCfg.getMetricsRateTimeInterval() + "]"
);
- if (plcCfg.getSubIntervals() <= 0)
+ if (regCfg.getMetricsSubIntervalCount() <= 0)
throw new IgniteCheckedException("Sub intervals must be greater than zero " +
- "(use MemoryPolicyConfiguration.subIntervals property to adjust the sub intervals) " +
- "[name=" + plcCfg.getName() +
- ", subIntervals=" + plcCfg.getSubIntervals() + "]"
+ "(use DataRegionConfiguration.subIntervals property to adjust the sub intervals) " +
+ "[name=" + regCfg.getName() +
+ ", subIntervals=" + regCfg.getMetricsSubIntervalCount() + "]"
);
- if (plcCfg.getRateTimeInterval() < 1_000)
+ if (regCfg.getMetricsRateTimeInterval() < 1_000)
throw new IgniteCheckedException("Rate time interval must be longer that 1 second (1_000 milliseconds) " +
- "(use MemoryPolicyConfiguration.rateTimeInterval property to adjust the interval) " +
- "[name=" + plcCfg.getName() +
- ", rateTimeInterval=" + plcCfg.getRateTimeInterval() + "]");
+ "(use DataRegionConfiguration.rateTimeInterval property to adjust the interval) " +
+ "[name=" + regCfg.getName() +
+ ", rateTimeInterval=" + regCfg.getMetricsRateTimeInterval() + "]");
}
/**
@@ -424,19 +410,19 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
*
* @throws IgniteCheckedException In case of validation violation.
*/
- private static void checkSystemMemoryPolicySizeConfiguration(
+ private static void checkSystemDataRegionSizeConfiguration(
long sysCacheInitSize,
long sysCacheMaxSize
) throws IgniteCheckedException {
if (sysCacheInitSize < MIN_PAGE_MEMORY_SIZE)
throw new IgniteCheckedException("Initial size for system cache must have size more than 10MB (use " +
- "MemoryConfiguration.systemCacheInitialSize property to set correct size in bytes) " +
+ "DataStorageConfiguration.systemCacheInitialSize property to set correct size in bytes) " +
"[size=" + U.readableSize(sysCacheInitSize, true) + ']'
);
if (U.jvm32Bit() && sysCacheInitSize > MAX_PAGE_MEMORY_INIT_SIZE_32_BIT)
throw new IgniteCheckedException("Initial size for system cache exceeds 2GB on 32-bit JVM (use " +
- "MemoryPolicyConfiguration.systemCacheInitialSize property to set correct size in bytes " +
+ "DataRegionConfiguration.systemCacheInitialSize property to set correct size in bytes " +
"or use 64-bit JVM) [size=" + U.readableSize(sysCacheInitSize, true) + ']'
);
@@ -444,138 +430,90 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
throw new IgniteCheckedException("MaxSize of system cache must not be smaller than " +
"initialSize [initSize=" + U.readableSize(sysCacheInitSize, true) +
", maxSize=" + U.readableSize(sysCacheMaxSize, true) + "]. " +
- "Use MemoryConfiguration.systemCacheInitialSize/MemoryConfiguration.systemCacheMaxSize " +
+ "Use DataStorageConfiguration.systemCacheInitialSize/DataStorageConfiguration.systemCacheMaxSize " +
"properties to set correct sizes in bytes."
);
}
/**
- * @param dfltPlcName Default MemoryPolicy name.
- * @param dfltPlcSize Default size of MemoryPolicy overridden by user (equals to -1 if wasn't specified by user).
- * @param plcNames All MemoryPolicy names.
- * @throws IgniteCheckedException In case of validation violation.
- */
- private static void checkDefaultPolicyConfiguration(
- String dfltPlcName,
- long dfltPlcSize,
- Collection<String> plcNames
- ) throws IgniteCheckedException {
- if (dfltPlcSize != MemoryConfiguration.DFLT_MEMORY_POLICY_MAX_SIZE) {
- if (!F.eq(dfltPlcName, MemoryConfiguration.DFLT_MEM_PLC_DEFAULT_NAME))
- throw new IgniteCheckedException("User-defined MemoryPolicy configuration " +
- "and defaultMemoryPolicySize properties are set at the same time. " +
- "Delete either MemoryConfiguration.defaultMemoryPolicySize property " +
- "or user-defined default MemoryPolicy configuration");
-
- if (dfltPlcSize < MIN_PAGE_MEMORY_SIZE)
- throw new IgniteCheckedException("User-defined default MemoryPolicy size is less than 1MB. " +
- "Use MemoryConfiguration.defaultMemoryPolicySize property to set correct size.");
-
- if (U.jvm32Bit() && dfltPlcSize > MAX_PAGE_MEMORY_INIT_SIZE_32_BIT)
- throw new IgniteCheckedException("User-defined default MemoryPolicy size exceeds 2GB on 32-bit JVM " +
- "(use MemoryConfiguration.defaultMemoryPolicySize property to set correct size in bytes " +
- "or use 64-bit JVM) [size=" + U.readableSize(dfltPlcSize, true) + ']'
- );
- }
-
- if (!DFLT_MEM_PLC_DEFAULT_NAME.equals(dfltPlcName)) {
- if (dfltPlcName.isEmpty())
- throw new IgniteCheckedException("User-defined default MemoryPolicy name must be non-empty");
-
- if (!plcNames.contains(dfltPlcName))
- throw new IgniteCheckedException("User-defined default MemoryPolicy name " +
- "must be presented among configured MemoryPolices: " + dfltPlcName);
- }
- }
-
- /**
- * @param plcCfg MemoryPolicyConfiguration to validate.
+ * @param regCfg DataRegionConfiguration to validate.
* @throws IgniteCheckedException If config is invalid.
*/
- private void checkPolicySize(MemoryPolicyConfiguration plcCfg) throws IgniteCheckedException {
- boolean dfltInitSize = false;
-
- if (plcCfg.getInitialSize() == 0) {
- plcCfg.setInitialSize(DFLT_MEMORY_POLICY_INITIAL_SIZE);
-
- dfltInitSize = true;
- }
-
- if (plcCfg.getInitialSize() < MIN_PAGE_MEMORY_SIZE)
- throw new IgniteCheckedException("MemoryPolicy must have size more than 10MB (use " +
- "MemoryPolicyConfiguration.initialSize property to set correct size in bytes) " +
- "[name=" + plcCfg.getName() + ", size=" + U.readableSize(plcCfg.getInitialSize(), true) + "]"
+ private void checkDataRegionSize(DataRegionConfiguration regCfg) throws IgniteCheckedException {
+ if (regCfg.getInitialSize() < MIN_PAGE_MEMORY_SIZE || regCfg.getMaxSize() < MIN_PAGE_MEMORY_SIZE)
+ throw new IgniteCheckedException("DataRegion must have size more than 10MB (use " +
+ "DataRegionConfiguration.initialSize and .maxSize properties to set correct size in bytes) " +
+ "[name=" + regCfg.getName() + ", initialSize=" + U.readableSize(regCfg.getInitialSize(), true) +
+ ", maxSize=" + U.readableSize(regCfg.getMaxSize(), true) + "]"
);
- if (plcCfg.getMaxSize() < plcCfg.getInitialSize()) {
- // If initial size was not set, use the max size.
- if (dfltInitSize) {
- plcCfg.setInitialSize(plcCfg.getMaxSize());
-
- LT.warn(log, "MemoryPolicy maxSize=" + U.readableSize(plcCfg.getMaxSize(), true) +
- " is smaller than defaultInitialSize=" +
- U.readableSize(MemoryConfiguration.DFLT_MEMORY_POLICY_INITIAL_SIZE, true) +
- ", setting initialSize to " + U.readableSize(plcCfg.getMaxSize(), true));
- }
- else {
- throw new IgniteCheckedException("MemoryPolicy maxSize must not be smaller than " +
- "initialSize [name=" + plcCfg.getName() +
- ", initSize=" + U.readableSize(plcCfg.getInitialSize(), true) +
- ", maxSize=" + U.readableSize(plcCfg.getMaxSize(), true) + ']');
+ if (regCfg.getMaxSize() < regCfg.getInitialSize()) {
+ if (regCfg.getInitialSize() != Math.min(DataStorageConfiguration.DFLT_DATA_REGION_MAX_SIZE,
+ DataStorageConfiguration.DFLT_DATA_REGION_INITIAL_SIZE)) {
+ throw new IgniteCheckedException("DataRegion maxSize must not be smaller than initialSize" +
+ "[name=" + regCfg.getName() + ", initialSize=" + U.readableSize(regCfg.getInitialSize(), true) +
+ ", maxSize=" + U.readableSize(regCfg.getMaxSize(), true) + "]");
}
+
+ regCfg.setInitialSize(regCfg.getMaxSize());
+
+ LT.warn(log, "DataRegion maxSize=" + U.readableSize(regCfg.getMaxSize(), true) +
+ " is smaller than defaultInitialSize=" +
+ U.readableSize(DataStorageConfiguration.DFLT_DATA_REGION_INITIAL_SIZE, true) +
+ ", setting initialSize to " + U.readableSize(regCfg.getMaxSize(), true));
}
- if (U.jvm32Bit() && plcCfg.getInitialSize() > MAX_PAGE_MEMORY_INIT_SIZE_32_BIT)
- throw new IgniteCheckedException("MemoryPolicy initialSize exceeds 2GB on 32-bit JVM (use " +
- "MemoryPolicyConfiguration.initialSize property to set correct size in bytes or use 64-bit JVM) " +
- "[name=" + plcCfg.getName() +
- ", size=" + U.readableSize(plcCfg.getInitialSize(), true) + "]");
+ if (U.jvm32Bit() && regCfg.getInitialSize() > MAX_PAGE_MEMORY_INIT_SIZE_32_BIT)
+ throw new IgniteCheckedException("DataRegion initialSize exceeds 2GB on 32-bit JVM (use " +
+ "DataRegionConfiguration.initialSize property to set correct size in bytes or use 64-bit JVM) " +
+ "[name=" + regCfg.getName() +
+ ", size=" + U.readableSize(regCfg.getInitialSize(), true) + "]");
}
/**
- * @param plcCfg MemoryPolicyConfiguration to validate.
+ * @param regCfg DataRegionConfiguration to validate.
* @param dbCfg Memory configuration.
* @throws IgniteCheckedException If config is invalid.
*/
- protected void checkPolicyEvictionProperties(MemoryPolicyConfiguration plcCfg, MemoryConfiguration dbCfg)
+ protected void checkRegionEvictionProperties(DataRegionConfiguration regCfg, DataStorageConfiguration dbCfg)
throws IgniteCheckedException {
- if (plcCfg.getPageEvictionMode() == DataPageEvictionMode.DISABLED)
+ if (regCfg.getPageEvictionMode() == DataPageEvictionMode.DISABLED)
return;
- if (plcCfg.getEvictionThreshold() < 0.5 || plcCfg.getEvictionThreshold() > 0.999) {
+ if (regCfg.getEvictionThreshold() < 0.5 || regCfg.getEvictionThreshold() > 0.999) {
throw new IgniteCheckedException("Page eviction threshold must be between 0.5 and 0.999: " +
- plcCfg.getName());
+ regCfg.getName());
}
- if (plcCfg.getEmptyPagesPoolSize() <= 10)
- throw new IgniteCheckedException("Evicted pages pool size should be greater than 10: " + plcCfg.getName());
+ if (regCfg.getEmptyPagesPoolSize() <= 10)
+ throw new IgniteCheckedException("Evicted pages pool size should be greater than 10: " + regCfg.getName());
- long maxPoolSize = plcCfg.getMaxSize() / dbCfg.getPageSize() / 10;
+ long maxPoolSize = regCfg.getMaxSize() / dbCfg.getPageSize() / 10;
- if (plcCfg.getEmptyPagesPoolSize() >= maxPoolSize) {
+ if (regCfg.getEmptyPagesPoolSize() >= maxPoolSize) {
throw new IgniteCheckedException("Evicted pages pool size should be lesser than " + maxPoolSize +
- ": " + plcCfg.getName());
+ ": " + regCfg.getName());
}
}
/**
- * @param plcName MemoryPolicy name to validate.
+ * @param regName DataRegion name to validate.
* @param observedNames Names of MemoryPolicies observed before.
* @throws IgniteCheckedException If config is invalid.
*/
- private static void checkPolicyName(String plcName, Collection<String> observedNames)
+ private static void checkDataRegionName(String regName, Collection<String> observedNames)
throws IgniteCheckedException {
- if (plcName == null || plcName.isEmpty())
- throw new IgniteCheckedException("User-defined MemoryPolicyConfiguration must have non-null and " +
+ if (regName == null || regName.isEmpty())
+ throw new IgniteCheckedException("User-defined DataRegionConfiguration must have non-null and " +
"non-empty name.");
- if (observedNames.contains(plcName))
- throw new IgniteCheckedException("Two MemoryPolicies have the same name: " + plcName);
+ if (observedNames.contains(regName))
+ throw new IgniteCheckedException("Two MemoryPolicies have the same name: " + regName);
- if (SYSTEM_MEMORY_POLICY_NAME.equals(plcName))
- throw new IgniteCheckedException("'sysMemPlc' policy name is reserved for internal use.");
+ if (SYSTEM_DATA_REGION_NAME.equals(regName))
+ throw new IgniteCheckedException("'" + SYSTEM_DATA_REGION_NAME + "' policy name is reserved for internal use.");
- observedNames.add(plcName);
+ observedNames.add(regName);
}
/**
@@ -589,22 +527,22 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
}
/**
- * @return collection of all configured {@link MemoryPolicy policies}.
+ * @return collection of all configured {@link DataRegion policies}.
*/
- public Collection<MemoryPolicy> memoryPolicies() {
- return memPlcMap != null ? memPlcMap.values() : null;
+ public Collection<DataRegion> dataRegions() {
+ return dataRegionMap != null ? dataRegionMap.values() : null;
}
/**
- * @return MemoryMetrics for all MemoryPolicies configured in Ignite instance.
+ * @return DataRegionMetrics for all MemoryPolicies configured in Ignite instance.
*/
- public Collection<MemoryMetrics> memoryMetrics() {
+ public Collection<DataRegionMetrics> memoryMetrics() {
if (!F.isEmpty(memMetricsMap)) {
// Intentionally return a collection copy to make it explicitly serializable.
- Collection<MemoryMetrics> res = new ArrayList<>(memMetricsMap.size());
+ Collection<DataRegionMetrics> res = new ArrayList<>(memMetricsMap.size());
- for (MemoryMetrics metrics : memMetricsMap.values())
- res.add(new MemoryMetricsSnapshot(metrics));
+ for (DataRegionMetrics metrics : memMetricsMap.values())
+ res.add(new DataRegionMetricsSnapshot(metrics));
return res;
}
@@ -613,9 +551,9 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
}
/**
- * @return PersistenceMetrics if persistence is enabled or {@code null} otherwise.
+ * @return DataStorageMetrics if persistence is enabled or {@code null} otherwise.
*/
- public PersistenceMetrics persistentStoreMetrics() {
+ public DataStorageMetrics persistentStoreMetrics() {
return null;
}
@@ -628,46 +566,46 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
}
/**
- * @param memPlcName Name of {@link MemoryPolicy} to obtain {@link MemoryMetrics} for.
- * @return {@link MemoryMetrics} snapshot for specified {@link MemoryPolicy} or {@code null} if
- * no {@link MemoryPolicy} is configured for specified name.
+ * @param memPlcName Name of {@link DataRegion} to obtain {@link DataRegionMetrics} for.
+ * @return {@link DataRegionMetrics} snapshot for specified {@link DataRegion} or {@code null} if
+ * no {@link DataRegion} is configured for specified name.
*/
- @Nullable public MemoryMetrics memoryMetrics(String memPlcName) {
+ @Nullable public DataRegionMetrics memoryMetrics(String memPlcName) {
if (!F.isEmpty(memMetricsMap)) {
- MemoryMetrics memMetrics = memMetricsMap.get(memPlcName);
+ DataRegionMetrics memMetrics = memMetricsMap.get(memPlcName);
if (memMetrics == null)
return null;
else
- return new MemoryMetricsSnapshot(memMetrics);
+ return new DataRegionMetricsSnapshot(memMetrics);
}
else
return null;
}
/**
- * @param memPlcName Memory policy name.
- * @return {@link MemoryPolicy} instance associated with a given {@link MemoryPolicyConfiguration}.
- * @throws IgniteCheckedException in case of request for unknown MemoryPolicy.
+ * @param memPlcName data region name.
+ * @return {@link DataRegion} instance associated with a given {@link DataRegionConfiguration}.
+ * @throws IgniteCheckedException in case of request for unknown DataRegion.
*/
- public MemoryPolicy memoryPolicy(String memPlcName) throws IgniteCheckedException {
+ public DataRegion dataRegion(String memPlcName) throws IgniteCheckedException {
if (memPlcName == null)
- return dfltMemPlc;
+ return dfltDataRegion;
- if (memPlcMap == null)
+ if (dataRegionMap == null)
return null;
- MemoryPolicy plc;
+ DataRegion plc;
- if ((plc = memPlcMap.get(memPlcName)) == null)
- throw new IgniteCheckedException("Requested MemoryPolicy is not configured: " + memPlcName);
+ if ((plc = dataRegionMap.get(memPlcName)) == null)
+ throw new IgniteCheckedException("Requested DataRegion is not configured: " + memPlcName);
return plc;
}
/**
- * @param memPlcName MemoryPolicyConfiguration name.
- * @return {@link FreeList} instance associated with a given {@link MemoryPolicyConfiguration}.
+ * @param memPlcName DataRegionConfiguration name.
+ * @return {@link FreeList} instance associated with a given {@link DataRegionConfiguration}.
*/
public FreeList freeList(String memPlcName) {
if (memPlcName == null)
@@ -677,8 +615,8 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
}
/**
- * @param memPlcName MemoryPolicyConfiguration name.
- * @return {@link ReuseList} instance associated with a given {@link MemoryPolicyConfiguration}.
+ * @param memPlcName DataRegionConfiguration name.
+ * @return {@link ReuseList} instance associated with a given {@link DataRegionConfiguration}.
*/
public ReuseList reuseList(String memPlcName) {
if (memPlcName == null)
@@ -689,8 +627,8 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
/** {@inheritDoc} */
@Override protected void stop0(boolean cancel) {
- if (memPlcMap != null) {
- for (MemoryPolicy memPlc : memPlcMap.values()) {
+ if (dataRegionMap != null) {
+ for (DataRegion memPlc : dataRegionMap.values()) {
memPlc.pageMemory().stop();
memPlc.evictionTracker().stop();
@@ -698,9 +636,9 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
unregisterMBean(memPlc.memoryMetrics().getName());
}
- memPlcMap.clear();
+ dataRegionMap.clear();
- memPlcMap = null;
+ dataRegionMap = null;
}
}
@@ -718,7 +656,7 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
cfg.getMBeanServer().unregisterMBean(
U.makeMBeanName(
cfg.getIgniteInstanceName(),
- "MemoryMetrics", name
+ "DataRegionMetrics", name
));
}
catch (Throwable e) {
@@ -848,13 +786,13 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
/**
* See {@link GridCacheMapEntry#ensureFreeSpace()}
*
- * @param memPlc Memory policy.
+ * @param memPlc data region.
*/
- public void ensureFreeSpace(MemoryPolicy memPlc) throws IgniteCheckedException {
+ public void ensureFreeSpace(DataRegion memPlc) throws IgniteCheckedException {
if (memPlc == null)
return;
- MemoryPolicyConfiguration plcCfg = memPlc.config();
+ DataRegionConfiguration plcCfg = memPlc.config();
if (plcCfg.getPageEvictionMode() == DataPageEvictionMode.DISABLED)
return;
@@ -884,16 +822,16 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
/**
* @param memCfg memory configuration with common parameters.
- * @param plcCfg memory policy with PageMemory specific parameters.
- * @param memMetrics {@link MemoryMetrics} object to collect memory usage metrics.
- * @return Memory policy instance.
+ * @param plcCfg data region with PageMemory specific parameters.
+ * @param memMetrics {@link DataRegionMetrics} object to collect memory usage metrics.
+ * @return data region instance.
*
* @throws IgniteCheckedException If failed to initialize swap path.
*/
- private MemoryPolicy initMemory(
- MemoryConfiguration memCfg,
- MemoryPolicyConfiguration plcCfg,
- MemoryMetricsImpl memMetrics
+ private DataRegion initMemory(
+ DataStorageConfiguration memCfg,
+ DataRegionConfiguration plcCfg,
+ DataRegionMetricsImpl memMetrics
) throws IgniteCheckedException {
File allocPath = buildAllocPath(plcCfg);
@@ -905,15 +843,15 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
PageMemory pageMem = createPageMemory(memProvider, memCfg, plcCfg, memMetrics);
- return new MemoryPolicy(pageMem, plcCfg, memMetrics, createPageEvictionTracker(plcCfg, pageMem));
+ return new DataRegion(pageMem, plcCfg, memMetrics, createPageEvictionTracker(plcCfg, pageMem));
}
/**
- * @param plc Memory Policy Configuration.
+ * @param plc data region Configuration.
* @param pageMem Page memory.
*/
- private PageEvictionTracker createPageEvictionTracker(MemoryPolicyConfiguration plc, PageMemory pageMem) {
- if (plc.getPageEvictionMode() == DataPageEvictionMode.DISABLED || cctx.gridConfig().isPersistentStoreEnabled())
+ private PageEvictionTracker createPageEvictionTracker(DataRegionConfiguration plc, PageMemory pageMem) {
+ if (plc.getPageEvictionMode() == DataPageEvictionMode.DISABLED || CU.isPersistenceEnabled(cctx.gridConfig()))
return new NoOpPageEvictionTracker();
assert pageMem instanceof PageMemoryNoStoreImpl : pageMem.getClass();
@@ -936,12 +874,12 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
/**
* Builds allocation path for memory mapped file to be used with PageMemory.
*
- * @param plc MemoryPolicyConfiguration.
+ * @param plc DataRegionConfiguration.
*
* @throws IgniteCheckedException If resolving swap directory fails.
*/
- @Nullable private File buildAllocPath(MemoryPolicyConfiguration plc) throws IgniteCheckedException {
- String path = plc.getSwapFilePath();
+ @Nullable private File buildAllocPath(DataRegionConfiguration plc) throws IgniteCheckedException {
+ String path = plc.getSwapPath();
if (path == null)
return null;
@@ -962,15 +900,15 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
*
* @param memProvider Memory provider.
* @param memCfg Memory configuartion.
- * @param memPlcCfg Memory policy configuration.
- * @param memMetrics MemoryMetrics to collect memory usage metrics.
+ * @param memPlcCfg data region configuration.
+ * @param memMetrics DataRegionMetrics to collect memory usage metrics.
* @return PageMemory instance.
*/
protected PageMemory createPageMemory(
DirectMemoryProvider memProvider,
- MemoryConfiguration memCfg,
- MemoryPolicyConfiguration memPlcCfg,
- MemoryMetricsImpl memMetrics
+ DataStorageConfiguration memCfg,
+ DataRegionConfiguration memPlcCfg,
+ DataRegionMetricsImpl memMetrics
) {
memMetrics.persistenceEnabled(false);
@@ -1003,14 +941,14 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
/** {@inheritDoc} */
@Override public void onActivate(GridKernalContext kctx) throws IgniteCheckedException {
- if (cctx.kernalContext().clientNode() && cctx.kernalContext().config().getMemoryConfiguration() == null)
+ if (cctx.kernalContext().clientNode() && cctx.kernalContext().config().getDataStorageConfiguration() == null)
return;
- MemoryConfiguration memCfg = cctx.kernalContext().config().getMemoryConfiguration();
+ DataStorageConfiguration memCfg = cctx.kernalContext().config().getDataStorageConfiguration();
assert memCfg != null;
- initPageMemoryPolicies(memCfg);
+ initDataRegions(memCfg);
registerMetricsMBeans();
@@ -1025,10 +963,10 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
}
/**
- * @return Name of MemoryPolicyConfiguration for internal caches.
+ * @return Name of DataRegionConfiguration for internal caches.
*/
- public String systemMemoryPolicyName() {
- return SYSTEM_MEMORY_POLICY_NAME;
+ public String systemDateRegionName() {
+ return SYSTEM_DATA_REGION_NAME;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryMetricsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryMetricsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryMetricsImpl.java
deleted file mode 100644
index 3261874..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryMetricsImpl.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * 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.internal.processors.cache.persistence;
-
-import org.apache.ignite.MemoryMetrics;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.internal.pagemem.PageMemory;
-import org.apache.ignite.internal.processors.cache.ratemetrics.HitRateMetrics;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteOutClosure;
-import org.jetbrains.annotations.Nullable;
-import org.jsr166.LongAdder8;
-
-/**
- *
- */
-public class MemoryMetricsImpl implements MemoryMetrics {
- /** */
- private final IgniteOutClosure<Float> fillFactorProvider;
-
- /** */
- private final LongAdder8 totalAllocatedPages = new LongAdder8();
-
- /**
- * Counter for number of pages occupied by large entries (one entry is larger than one page).
- */
- private final LongAdder8 largeEntriesPages = new LongAdder8();
-
- /** Counter for number of dirty pages. */
- private LongAdder8 dirtyPages = new LongAdder8();
-
- /** */
- private volatile boolean metricsEnabled;
-
- /** */
- private boolean persistenceEnabled;
-
- /** */
- private volatile int subInts;
-
- /** Allocation rate calculator. */
- private volatile HitRateMetrics allocRate = new HitRateMetrics(60_000, 5);
-
- /** */
- private volatile HitRateMetrics pageReplaceRate = new HitRateMetrics(60_000, 5);
-
- /** */
- private final MemoryPolicyConfiguration memPlcCfg;
-
- /** */
- private PageMemory pageMem;
-
- /** Time interval (in milliseconds) when allocations/evictions are counted to calculate rate. */
- private volatile long rateTimeInterval;
-
- /**
- * @param memPlcCfg MemoryPolicyConfiguration.
- */
- public MemoryMetricsImpl(MemoryPolicyConfiguration memPlcCfg) {
- this(memPlcCfg, null);
- }
-
- /**
- * @param memPlcCfg MemoryPolicyConfiguration.
- */
- public MemoryMetricsImpl(MemoryPolicyConfiguration memPlcCfg, @Nullable IgniteOutClosure<Float> fillFactorProvider) {
- this.memPlcCfg = memPlcCfg;
- this.fillFactorProvider = fillFactorProvider;
-
- metricsEnabled = memPlcCfg.isMetricsEnabled();
-
- rateTimeInterval = memPlcCfg.getRateTimeInterval();
-
- subInts = memPlcCfg.getSubIntervals();
- }
-
- /** {@inheritDoc} */
- @Override public String getName() {
- return U.maskName(memPlcCfg.getName());
- }
-
- /** {@inheritDoc} */
- @Override public long getTotalAllocatedPages() {
- return metricsEnabled ? totalAllocatedPages.longValue() : 0;
- }
-
- /** {@inheritDoc} */
- @Override public float getAllocationRate() {
- if (!metricsEnabled)
- return 0;
-
- return ((float) allocRate.getRate()) / rateTimeInterval;
- }
-
- /** {@inheritDoc} */
- @Override public float getEvictionRate() {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public float getLargeEntriesPagesPercentage() {
- if (!metricsEnabled)
- return 0;
-
- return totalAllocatedPages.longValue() != 0 ?
- (float) largeEntriesPages.doubleValue() / totalAllocatedPages.longValue()
- : 0;
- }
-
- /** {@inheritDoc} */
- @Override public float getPagesFillFactor() {
- if (!metricsEnabled || fillFactorProvider == null)
- return 0;
-
- return fillFactorProvider.apply();
- }
-
- /** {@inheritDoc} */
- @Override public long getDirtyPages() {
- if (!metricsEnabled || !persistenceEnabled)
- return 0;
-
- return dirtyPages.longValue();
- }
-
- /** {@inheritDoc} */
- @Override public float getPagesReplaceRate() {
- if (!metricsEnabled || !persistenceEnabled)
- return 0;
-
- return ((float) pageReplaceRate.getRate()) / rateTimeInterval;
- }
-
- /** {@inheritDoc} */
- @Override public long getPhysicalMemoryPages() {
- if (!metricsEnabled || !persistenceEnabled)
- return 0;
-
- assert pageMem != null;
-
- return pageMem.loadedPages();
- }
-
- /**
- * Updates pageReplaceRate metric.
- */
- public void updatePageReplaceRate() {
- if (metricsEnabled)
- pageReplaceRate.onHit();
- }
-
- /**
- * Increments dirtyPages counter.
- */
- public void incrementDirtyPages() {
- if (metricsEnabled)
- dirtyPages.increment();
- }
-
- /**
- * Decrements dirtyPages counter.
- */
- public void decrementDirtyPages() {
- if (metricsEnabled)
- dirtyPages.decrement();
- }
-
- /**
- * Resets dirtyPages counter to zero.
- */
- public void resetDirtyPages() {
- if (metricsEnabled)
- dirtyPages.reset();
- }
-
- /**
- * Increments totalAllocatedPages counter.
- */
- public void incrementTotalAllocatedPages() {
- if (metricsEnabled) {
- totalAllocatedPages.increment();
-
- updateAllocationRateMetrics();
- }
- }
-
- /**
- *
- */
- private void updateAllocationRateMetrics() {
- allocRate.onHit();
- }
-
- /**
- * @param intervalNum Interval number.
- */
- private long subInt(int intervalNum) {
- return (rateTimeInterval * intervalNum) / subInts;
- }
-
- /**
- *
- */
- public void incrementLargeEntriesPages() {
- if (metricsEnabled)
- largeEntriesPages.increment();
- }
-
- /**
- *
- */
- public void decrementLargeEntriesPages() {
- if (metricsEnabled)
- largeEntriesPages.decrement();
- }
-
- /**
- * Enable metrics.
- */
- public void enableMetrics() {
- metricsEnabled = true;
- }
-
- /**
- * Disable metrics.
- */
- public void disableMetrics() {
- metricsEnabled = false;
- }
-
- /**
- * @param persistenceEnabled Persistence enabled.
- */
- public void persistenceEnabled(boolean persistenceEnabled) {
- this.persistenceEnabled = persistenceEnabled;
- }
-
- /**
- * @param pageMem Page mem.
- */
- public void pageMemory(PageMemory pageMem) {
- this.pageMem = pageMem;
- }
-
- /**
- * @param rateTimeInterval Time interval (in milliseconds) used to calculate allocation/eviction rate.
- */
- public void rateTimeInterval(long rateTimeInterval) {
- this.rateTimeInterval = rateTimeInterval;
-
- allocRate = new HitRateMetrics((int) rateTimeInterval, subInts);
- pageReplaceRate = new HitRateMetrics((int) rateTimeInterval, subInts);
- }
-
- /**
- * Sets number of subintervals the whole rateTimeInterval will be split into to calculate allocation rate.
- *
- * @param subInts Number of subintervals.
- */
- public void subIntervals(int subInts) {
- assert subInts > 0;
-
- if (this.subInts == subInts)
- return;
-
- if (rateTimeInterval / subInts < 10)
- subInts = (int) rateTimeInterval / 10;
-
- allocRate = new HitRateMetrics((int) rateTimeInterval, subInts);
- pageReplaceRate = new HitRateMetrics((int) rateTimeInterval, subInts);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryMetricsMXBeanImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryMetricsMXBeanImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryMetricsMXBeanImpl.java
deleted file mode 100644
index 392f83f..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryMetricsMXBeanImpl.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * 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.internal.processors.cache.persistence;
-
-import org.apache.ignite.MemoryMetrics;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.mxbean.MemoryMetricsMXBean;
-
-/**
- * MBean to expose {@link MemoryMetrics} through JMX interface.
- */
-class MemoryMetricsMXBeanImpl implements MemoryMetricsMXBean {
- /** */
- private final MemoryMetricsImpl memMetrics;
-
- /** */
- private final MemoryPolicyConfiguration memPlcCfg;
-
- /**
- * @param memMetrics MemoryMetrics instance to expose through JMX interface.
- * @param memPlcCfg configuration of memory policy this MX Bean is created for.
- */
- MemoryMetricsMXBeanImpl(MemoryMetricsImpl memMetrics,
- MemoryPolicyConfiguration memPlcCfg
- ) {
- this.memMetrics = memMetrics;
- this.memPlcCfg = memPlcCfg;
- }
-
- /** {@inheritDoc} */
- @Override public float getAllocationRate() {
- return memMetrics.getAllocationRate();
- }
-
- /** {@inheritDoc} */
- @Override public float getEvictionRate() {
- return memMetrics.getEvictionRate();
- }
-
- /** {@inheritDoc} */
- @Override public float getLargeEntriesPagesPercentage() {
- return memMetrics.getLargeEntriesPagesPercentage();
- }
-
- /** {@inheritDoc} */
- @Override public float getPagesFillFactor() {
- return memMetrics.getPagesFillFactor();
- }
-
- /** {@inheritDoc} */
- @Override public long getTotalAllocatedPages() {
- return memMetrics.getTotalAllocatedPages();
- }
-
- /** {@inheritDoc} */
- @Override public long getDirtyPages() {
- return memMetrics.getDirtyPages();
- }
-
- /** {@inheritDoc} */
- @Override public float getPagesReplaceRate() {
- return memMetrics.getPagesReplaceRate();
- }
-
- /** {@inheritDoc} */
- @Override public long getPhysicalMemoryPages() {
- return memMetrics.getPhysicalMemoryPages();
- }
-
- /** {@inheritDoc} */
- @Override public void rateTimeInterval(long rateTimeInterval) {
- if (rateTimeInterval < 1000)
- throw new IllegalArgumentException("rateTimeInterval property must be positive " +
- "and greater than 1_000 milliseconds (one second)");
-
- memMetrics.rateTimeInterval(rateTimeInterval);
- }
-
- /** {@inheritDoc} */
- @Override public void subIntervals(int subInts) {
- if (subInts <= 1)
- throw new IllegalArgumentException("subIntervals property must be positive " +
- "and greater than one");
-
- memMetrics.subIntervals(subInts);
- }
-
- /** {@inheritDoc} */
- @Override public void enableMetrics() {
- memMetrics.enableMetrics();
- }
-
- /** {@inheritDoc} */
- @Override public void disableMetrics() {
- memMetrics.disableMetrics();
- }
-
- /** {@inheritDoc} */
- @Override public String getName() {
- return memMetrics.getName();
- }
-
- /** {@inheritDoc} */
- @Override public int getInitialSize() {
- return (int) (memPlcCfg.getInitialSize() / (1024 * 1024));
- }
-
- /** {@inheritDoc} */
- @Override public int getMaxSize() {
- return (int) (memPlcCfg.getMaxSize() / (1024 * 1024));
- }
-
- /** {@inheritDoc} */
- @Override public String getSwapFilePath() {
- return memPlcCfg.getSwapFilePath();
- }
-}
[20/50] [abbrv] ignite git commit: IGNITE-6030 Allow enabling
persistence per data region
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryMetricsSnapshot.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryMetricsSnapshot.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryMetricsSnapshot.java
deleted file mode 100644
index 4e7f90a..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryMetricsSnapshot.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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.internal.processors.cache.persistence;
-
-import org.apache.ignite.MemoryMetrics;
-
-/**
- *
- */
-public class MemoryMetricsSnapshot implements MemoryMetrics {
- /** */
- private String name;
-
- /** */
- private long totalAllocatedPages;
-
- /** */
- private float allocationRate;
-
- /** */
- private float evictionRate;
-
- /** */
- private float largeEntriesPagesPercentage;
-
- /** */
- private float pagesFillFactor;
-
- /** */
- private long dirtyPages;
-
- /** */
- private float pageReplaceRate;
-
- /** */
- private long physicalMemoryPages;
-
- /**
- * @param metrics Metrics instance to take a copy.
- */
- public MemoryMetricsSnapshot(MemoryMetrics metrics) {
- name = metrics.getName();
- totalAllocatedPages = metrics.getTotalAllocatedPages();
- allocationRate = metrics.getAllocationRate();
- evictionRate = metrics.getEvictionRate();
- largeEntriesPagesPercentage = metrics.getLargeEntriesPagesPercentage();
- pagesFillFactor = metrics.getPagesFillFactor();
- dirtyPages = metrics.getDirtyPages();
- pageReplaceRate = metrics.getPagesReplaceRate();
- physicalMemoryPages = metrics.getPhysicalMemoryPages();
- }
-
- /** {@inheritDoc} */
- @Override public String getName() {
- return name;
- }
-
- /** {@inheritDoc} */
- @Override public long getTotalAllocatedPages() {
- return totalAllocatedPages;
- }
-
- /** {@inheritDoc} */
- @Override public float getAllocationRate() {
- return allocationRate;
- }
-
- /** {@inheritDoc} */
- @Override public float getEvictionRate() {
- return evictionRate;
- }
-
- /** {@inheritDoc} */
- @Override public float getLargeEntriesPagesPercentage() {
- return largeEntriesPagesPercentage;
- }
-
- /** {@inheritDoc} */
- @Override public float getPagesFillFactor() {
- return pagesFillFactor;
- }
-
- /** {@inheritDoc} */
- @Override public long getDirtyPages() {
- return dirtyPages;
- }
-
- /** {@inheritDoc} */
- @Override public float getPagesReplaceRate() {
- return pageReplaceRate;
- }
-
- /** {@inheritDoc} */
- @Override public long getPhysicalMemoryPages() {
- return physicalMemoryPages;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicy.java
deleted file mode 100644
index 4059c12..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicy.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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.internal.processors.cache.persistence;
-
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.internal.pagemem.PageMemory;
-import org.apache.ignite.internal.processors.cache.persistence.evict.PageEvictionTracker;
-
-/**
- * Memory policy provides access to objects configured with {@link MemoryPolicyConfiguration} configuration.
- */
-public class MemoryPolicy {
- /** */
- private final PageMemory pageMem;
-
- /** */
- private final MemoryMetricsImpl memMetrics;
-
- /** */
- private final MemoryPolicyConfiguration cfg;
-
- /** */
- private final PageEvictionTracker evictionTracker;
-
- /**
- * @param pageMem PageMemory instance.
- * @param memMetrics MemoryMetrics instance.
- * @param cfg Configuration of given MemoryPolicy.
- * @param evictionTracker Eviction tracker.
- */
- public MemoryPolicy(
- PageMemory pageMem,
- MemoryPolicyConfiguration cfg,
- MemoryMetricsImpl memMetrics,
- PageEvictionTracker evictionTracker
- ) {
- this.pageMem = pageMem;
- this.memMetrics = memMetrics;
- this.cfg = cfg;
- this.evictionTracker = evictionTracker;
- }
-
- /**
- *
- */
- public PageMemory pageMemory() {
- return pageMem;
- }
-
- /**
- * @return Config.
- */
- public MemoryPolicyConfiguration config() {
- return cfg;
- }
-
- /**
- * @return Memory Metrics.
- */
- public MemoryMetricsImpl memoryMetrics() {
- return memMetrics;
- }
-
- /**
- *
- */
- public PageEvictionTracker evictionTracker() {
- return evictionTracker;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/PersistenceMetricsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/PersistenceMetricsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/PersistenceMetricsImpl.java
deleted file mode 100644
index 7952937..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/PersistenceMetricsImpl.java
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * 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.internal.processors.cache.persistence;
-
-import org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager;
-import org.apache.ignite.internal.processors.cache.ratemetrics.HitRateMetrics;
-import org.apache.ignite.mxbean.PersistenceMetricsMXBean;
-
-/**
- *
- */
-public class PersistenceMetricsImpl implements PersistenceMetricsMXBean {
- /** */
- private volatile HitRateMetrics walLoggingRate;
-
- /** */
- private volatile HitRateMetrics walWritingRate;
-
- /** */
- private volatile HitRateMetrics walFsyncTimeDuration;
-
- /** */
- private volatile HitRateMetrics walFsyncTimeNumber;
-
- /** */
- private volatile long lastCpLockWaitDuration;
-
- /** */
- private volatile long lastCpMarkDuration;
-
- /** */
- private volatile long lastCpPagesWriteDuration;
-
- /** */
- private volatile long lastCpDuration;
-
- /** */
- private volatile long lastCpFsyncDuration;
-
- /** */
- private volatile long lastCpTotalPages;
-
- /** */
- private volatile long lastCpDataPages;
-
- /** */
- private volatile long lastCpCowPages;
-
- /** */
- private volatile long rateTimeInterval;
-
- /** */
- private volatile int subInts;
-
- /** */
- private volatile boolean metricsEnabled;
-
- /** */
- private IgniteWriteAheadLogManager wal;
-
- /**
- * @param metricsEnabled Metrics enabled flag.
- * @param rateTimeInterval Rate time interval.
- * @param subInts Number of sub-intervals.
- */
- public PersistenceMetricsImpl(
- boolean metricsEnabled,
- long rateTimeInterval,
- int subInts
- ) {
- this.metricsEnabled = metricsEnabled;
- this.rateTimeInterval = rateTimeInterval;
- this.subInts = subInts;
-
- resetRates();
- }
-
- /** {@inheritDoc} */
- @Override public float getWalLoggingRate() {
- if (!metricsEnabled)
- return 0;
-
- return ((float)walLoggingRate.getRate()) / rateTimeInterval;
- }
-
- /** {@inheritDoc} */
- @Override public float getWalWritingRate() {
- if (!metricsEnabled)
- return 0;
-
- return ((float)walWritingRate.getRate()) / rateTimeInterval;
- }
-
- /** {@inheritDoc} */
- @Override public int getWalArchiveSegments() {
- if (!metricsEnabled)
- return 0;
-
- return wal.walArchiveSegments();
- }
-
- /** {@inheritDoc} */
- @Override public float getWalFsyncTimeAverage() {
- if (!metricsEnabled)
- return 0;
-
- long numRate = walFsyncTimeNumber.getRate();
-
- if (numRate == 0)
- return 0;
-
- return (float)walFsyncTimeDuration.getRate() / numRate;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointingDuration() {
- if (!metricsEnabled)
- return 0;
-
- return lastCpDuration;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointLockWaitDuration() {
- if (!metricsEnabled)
- return 0;
-
- return lastCpLockWaitDuration;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointMarkDuration() {
- if (!metricsEnabled)
- return 0;
-
- return lastCpMarkDuration;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointPagesWriteDuration() {
- if (!metricsEnabled)
- return 0;
-
- return lastCpPagesWriteDuration;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointFsyncDuration() {
- if (!metricsEnabled)
- return 0;
-
- return lastCpFsyncDuration;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointTotalPagesNumber() {
- if (!metricsEnabled)
- return 0;
-
- return lastCpTotalPages;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointDataPagesNumber() {
- if (!metricsEnabled)
- return 0;
-
- return lastCpDataPages;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointCopiedOnWritePagesNumber() {
- if (!metricsEnabled)
- return 0;
-
- return lastCpCowPages;
- }
-
- /** {@inheritDoc} */
- @Override public void enableMetrics() {
- metricsEnabled = true;
- }
-
- /** {@inheritDoc} */
- @Override public void disableMetrics() {
- metricsEnabled = false;
- }
-
- /** {@inheritDoc} */
- @Override public void rateTimeInterval(long rateTimeInterval) {
- this.rateTimeInterval = rateTimeInterval;
-
- resetRates();
- }
-
- /** {@inheritDoc} */
- @Override public void subIntervals(int subInts) {
- this.subInts = subInts;
-
- resetRates();
- }
-
- /**
- * @param wal Write-ahead log manager.
- */
- public void wal(IgniteWriteAheadLogManager wal) {
- this.wal = wal;
- }
-
- /**
- * @return Metrics enabled flag.
- */
- public boolean metricsEnabled() {
- return metricsEnabled;
- }
-
- /**
- * @param lockWaitDuration Lock wait duration.
- * @param markDuration Mark duration.
- * @param pagesWriteDuration Pages write duration.
- * @param fsyncDuration Total checkpoint fsync duration.
- * @param duration Total checkpoint duration.
- * @param totalPages Total number of all pages in checkpoint.
- * @param dataPages Total number of data pages in checkpoint.
- * @param cowPages Total number of COW-ed pages in checkpoint.
- */
- public void onCheckpoint(
- long lockWaitDuration,
- long markDuration,
- long pagesWriteDuration,
- long fsyncDuration,
- long duration,
- long totalPages,
- long dataPages,
- long cowPages
- ) {
- if (metricsEnabled) {
- lastCpLockWaitDuration = lockWaitDuration;
- lastCpMarkDuration = markDuration;
- lastCpPagesWriteDuration = pagesWriteDuration;
- lastCpFsyncDuration = fsyncDuration;
- lastCpDuration = duration;
- lastCpTotalPages = totalPages;
- lastCpDataPages = dataPages;
- lastCpCowPages = cowPages;
- }
- }
-
- /**
- *
- */
- public void onWalRecordLogged() {
- walLoggingRate.onHit();
- }
-
- /**
- * @param size Size written.
- */
- public void onWalBytesWritten(int size) {
- walWritingRate.onHits(size);
- }
-
- /**
- * @param nanoTime Fsync nano time.
- */
- public void onFsync(long nanoTime) {
- long microseconds = nanoTime / 1_000;
-
- walFsyncTimeDuration.onHits(microseconds);
- walFsyncTimeNumber.onHit();
- }
-
- /**
- *
- */
- private void resetRates() {
- walLoggingRate = new HitRateMetrics((int)rateTimeInterval, subInts);
- walWritingRate = new HitRateMetrics((int)rateTimeInterval, subInts);
-
- walFsyncTimeDuration = new HitRateMetrics((int)rateTimeInterval, subInts);
- walFsyncTimeNumber = new HitRateMetrics((int)rateTimeInterval, subInts);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/PersistenceMetricsSnapshot.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/PersistenceMetricsSnapshot.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/PersistenceMetricsSnapshot.java
deleted file mode 100644
index 0de9950..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/PersistenceMetricsSnapshot.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * 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.internal.processors.cache.persistence;
-
-import org.apache.ignite.PersistenceMetrics;
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- *
- */
-public class PersistenceMetricsSnapshot implements PersistenceMetrics {
- /** */
- private float walLoggingRate;
-
- /** */
- private float walWritingRate;
-
- /** */
- private int walArchiveSegments;
-
- /** */
- private float walFsyncTimeAvg;
-
- /** */
- private long lastCpDuration;
-
- /** */
- private long lastCpLockWaitDuration;
-
- /** */
- private long lastCpMmarkDuration;
-
- /** */
- private long lastCpPagesWriteDuration;
-
- /** */
- private long lastCpFsyncDuration;
-
- /** */
- private long lastCpTotalPages;
-
- /** */
- private long lastCpDataPages;
-
- /** */
- private long lastCpCowPages;
-
- /**
- * @param metrics Metrics.
- */
- public PersistenceMetricsSnapshot(PersistenceMetrics metrics) {
- walLoggingRate = metrics.getWalLoggingRate();
- walWritingRate = metrics.getWalWritingRate();
- walArchiveSegments = metrics.getWalArchiveSegments();
- walFsyncTimeAvg = metrics.getWalFsyncTimeAverage();
- lastCpDuration = metrics.getLastCheckpointingDuration();
- lastCpLockWaitDuration = metrics.getLastCheckpointLockWaitDuration();
- lastCpMmarkDuration = metrics.getLastCheckpointMarkDuration();
- lastCpPagesWriteDuration = metrics.getLastCheckpointPagesWriteDuration();
- lastCpFsyncDuration = metrics.getLastCheckpointFsyncDuration();
- lastCpTotalPages = metrics.getLastCheckpointTotalPagesNumber();
- lastCpDataPages = metrics.getLastCheckpointDataPagesNumber();
- lastCpCowPages = metrics.getLastCheckpointCopiedOnWritePagesNumber();
- }
-
- /** {@inheritDoc} */
- @Override public float getWalLoggingRate() {
- return walLoggingRate;
- }
-
- /** {@inheritDoc} */
- @Override public float getWalWritingRate() {
- return walWritingRate;
- }
-
- /** {@inheritDoc} */
- @Override public int getWalArchiveSegments() {
- return walArchiveSegments;
- }
-
- /** {@inheritDoc} */
- @Override public float getWalFsyncTimeAverage() {
- return walFsyncTimeAvg;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointingDuration() {
- return lastCpDuration;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointLockWaitDuration() {
- return lastCpLockWaitDuration;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointMarkDuration() {
- return lastCpMmarkDuration;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointPagesWriteDuration() {
- return lastCpPagesWriteDuration;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointFsyncDuration() {
- return lastCpFsyncDuration;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointTotalPagesNumber() {
- return lastCpTotalPages;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointDataPagesNumber() {
- return lastCpDataPages;
- }
-
- /** {@inheritDoc} */
- @Override public long getLastCheckpointCopiedOnWritePagesNumber() {
- return lastCpCowPages;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(PersistenceMetricsSnapshot.class, this);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/RowStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/RowStore.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/RowStore.java
index 9cc5c62..2051021 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/RowStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/RowStore.java
@@ -40,7 +40,8 @@ public class RowStore {
/** */
protected final CacheObjectContext coctx;
-
+ /** */
+ private final boolean persistenceEnabled;
/**
* @param grp Cache group.
@@ -54,7 +55,9 @@ public class RowStore {
ctx = grp.shared();
coctx = grp.cacheObjectContext();
- pageMem = grp.memoryPolicy().pageMemory();
+ pageMem = grp.dataRegion().pageMemory();
+
+ persistenceEnabled = grp.dataRegion().config().isPersistenceEnabled();
}
/**
@@ -63,13 +66,18 @@ public class RowStore {
*/
public void removeRow(long link) throws IgniteCheckedException {
assert link != 0;
- ctx.database().checkpointReadLock();
- try {
+ if (!persistenceEnabled)
freeList.removeDataRowByLink(link);
- }
- finally {
- ctx.database().checkpointReadUnlock();
+ else {
+ ctx.database().checkpointReadLock();
+
+ try {
+ freeList.removeDataRowByLink(link);
+ }
+ finally {
+ ctx.database().checkpointReadUnlock();
+ }
}
}
@@ -78,13 +86,17 @@ public class RowStore {
* @throws IgniteCheckedException If failed.
*/
public void addRow(CacheDataRow row) throws IgniteCheckedException {
- ctx.database().checkpointReadLock();
-
- try {
+ if (!persistenceEnabled)
freeList.insertDataRow(row);
- }
- finally {
- ctx.database().checkpointReadUnlock();
+ else {
+ ctx.database().checkpointReadLock();
+
+ try {
+ freeList.insertDataRow(row);
+ }
+ finally {
+ ctx.database().checkpointReadUnlock();
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/FairFifoPageEvictionTracker.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/FairFifoPageEvictionTracker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/FairFifoPageEvictionTracker.java
index f5c7c8a..8a3d5b0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/FairFifoPageEvictionTracker.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/FairFifoPageEvictionTracker.java
@@ -20,7 +20,7 @@ package org.apache.ignite.internal.processors.cache.persistence.evict;
import java.util.LinkedList;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.pagemem.PageIdUtils;
import org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
@@ -34,12 +34,12 @@ public class FairFifoPageEvictionTracker extends PageAbstractEvictionTracker {
/**
* @param pageMem Page memory.
- * @param plcCfg Memory policy configuration.
+ * @param plcCfg Data region configuration.
* @param sharedCtx Shared context.
*/
public FairFifoPageEvictionTracker(
PageMemoryNoStoreImpl pageMem,
- MemoryPolicyConfiguration plcCfg,
+ DataRegionConfiguration plcCfg,
GridCacheSharedContext sharedCtx) {
super(pageMem, plcCfg, sharedCtx);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/PageAbstractEvictionTracker.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/PageAbstractEvictionTracker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/PageAbstractEvictionTracker.java
index a524d5e..5142c59 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/PageAbstractEvictionTracker.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/PageAbstractEvictionTracker.java
@@ -18,7 +18,7 @@ package org.apache.ignite.internal.processors.cache.persistence.evict;
import java.util.List;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.pagemem.PageIdUtils;
import org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
@@ -54,12 +54,12 @@ public abstract class PageAbstractEvictionTracker implements PageEvictionTracker
/**
* @param pageMem Page memory.
- * @param plcCfg Memory policy configuration.
+ * @param plcCfg Data region configuration.
* @param sharedCtx Shared context.
*/
PageAbstractEvictionTracker(
PageMemoryNoStoreImpl pageMem,
- MemoryPolicyConfiguration plcCfg,
+ DataRegionConfiguration plcCfg,
GridCacheSharedContext sharedCtx
) {
this.pageMem = pageMem;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/Random2LruPageEvictionTracker.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/Random2LruPageEvictionTracker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/Random2LruPageEvictionTracker.java
index 00f1b16..4d42191 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/Random2LruPageEvictionTracker.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/Random2LruPageEvictionTracker.java
@@ -20,8 +20,8 @@ import java.util.concurrent.ThreadLocalRandom;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.pagemem.PageIdUtils;
import org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
@@ -55,12 +55,12 @@ public class Random2LruPageEvictionTracker extends PageAbstractEvictionTracker {
*/
public Random2LruPageEvictionTracker(
PageMemoryNoStoreImpl pageMem,
- MemoryPolicyConfiguration plcCfg,
+ DataRegionConfiguration plcCfg,
GridCacheSharedContext<?, ?> sharedCtx
) {
super(pageMem, plcCfg, sharedCtx);
- MemoryConfiguration memCfg = sharedCtx.kernalContext().config().getMemoryConfiguration();
+ DataStorageConfiguration memCfg = sharedCtx.kernalContext().config().getDataStorageConfiguration();
assert plcCfg.getMaxSize() / memCfg.getPageSize() < Integer.MAX_VALUE;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/RandomLruPageEvictionTracker.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/RandomLruPageEvictionTracker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/RandomLruPageEvictionTracker.java
index 035a91a..ed6d2d4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/RandomLruPageEvictionTracker.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/evict/RandomLruPageEvictionTracker.java
@@ -21,8 +21,8 @@ import java.util.concurrent.ThreadLocalRandom;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.internal.pagemem.PageIdUtils;
import org.apache.ignite.internal.pagemem.PageMemory;
import org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl;
@@ -57,12 +57,12 @@ public class RandomLruPageEvictionTracker extends PageAbstractEvictionTracker {
*/
public RandomLruPageEvictionTracker(
PageMemory pageMem,
- MemoryPolicyConfiguration plcCfg,
+ DataRegionConfiguration plcCfg,
GridCacheSharedContext<?, ?> sharedCtx
) {
super((PageMemoryNoStoreImpl)pageMem, plcCfg, sharedCtx);
- MemoryConfiguration memCfg = sharedCtx.kernalContext().config().getMemoryConfiguration();
+ DataStorageConfiguration memCfg = sharedCtx.kernalContext().config().getDataStorageConfiguration();
assert plcCfg.getMaxSize() / memCfg.getPageSize() < Integer.MAX_VALUE;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AsyncFileIOFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AsyncFileIOFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AsyncFileIOFactory.java
index 0fb3052..104697e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AsyncFileIOFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AsyncFileIOFactory.java
@@ -33,20 +33,34 @@ public class AsyncFileIOFactory implements FileIOFactory {
/** */
private static final long serialVersionUID = 0L;
+ /** Thread local channel future holder. */
+ private transient volatile ThreadLocal<AsyncFileIO.ChannelOpFuture> holder = initHolder();
+
/** {@inheritDoc} */
@Override public FileIO create(File file) throws IOException {
return create(file, CREATE, READ, WRITE);
}
- /** */
- private ThreadLocal<AsyncFileIO.ChannelOpFuture> holder = new ThreadLocal<AsyncFileIO.ChannelOpFuture>() {
- @Override protected AsyncFileIO.ChannelOpFuture initialValue() {
- return new AsyncFileIO.ChannelOpFuture();
- }
- };
-
/** {@inheritDoc} */
@Override public FileIO create(File file, OpenOption... modes) throws IOException {
+ if (holder == null) {
+ synchronized (this) {
+ if (holder == null)
+ holder = initHolder();
+ }
+ }
+
return new AsyncFileIO(file, holder, modes);
}
+
+ /**
+ * Initializes thread local channel future holder.
+ */
+ private ThreadLocal<AsyncFileIO.ChannelOpFuture> initHolder() {
+ return new ThreadLocal<AsyncFileIO.ChannelOpFuture>() {
+ @Override protected AsyncFileIO.ChannelOpFuture initialValue() {
+ return new AsyncFileIO.ChannelOpFuture();
+ }
+ };
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStore.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStore.java
index 0547dbc..408240c 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStore.java
@@ -27,7 +27,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteSystemProperties;
-import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.internal.pagemem.PageIdUtils;
import org.apache.ignite.internal.pagemem.store.PageStore;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO;
@@ -60,7 +60,7 @@ public class FilePageStore implements PageStore {
private final byte type;
/** Database configuration. */
- protected final MemoryConfiguration dbCfg;
+ protected final DataStorageConfiguration dbCfg;
/** Factory to provide I/O interfaces for read/write operations with files */
private final FileIOFactory ioFactory;
@@ -92,7 +92,7 @@ public class FilePageStore implements PageStore {
/**
* @param file File.
*/
- public FilePageStore(byte type, File file, FileIOFactory factory, MemoryConfiguration cfg) {
+ public FilePageStore(byte type, File file, FileIOFactory factory, DataStorageConfiguration cfg) {
this.type = type;
cfgFile = file;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java
index ed82127..aadcee6 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java
@@ -36,7 +36,7 @@ import java.util.concurrent.ConcurrentHashMap;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.pagemem.PageIdAllocator;
import org.apache.ignite.internal.pagemem.PageIdUtils;
@@ -92,7 +92,7 @@ public class FilePageStoreManager extends GridCacheSharedManagerAdapter implemen
private final IgniteConfiguration igniteCfg;
/** */
- private PersistentStoreConfiguration pstCfg;
+ private DataStorageConfiguration dsCfg;
/** Absolute directory for file page store. Includes consistent id based folder. */
private File storeWorkDir;
@@ -109,11 +109,11 @@ public class FilePageStoreManager extends GridCacheSharedManagerAdapter implemen
public FilePageStoreManager(GridKernalContext ctx) {
igniteCfg = ctx.config();
- PersistentStoreConfiguration pstCfg = igniteCfg.getPersistentStoreConfiguration();
+ DataStorageConfiguration dsCfg = igniteCfg.getDataStorageConfiguration();
- assert pstCfg != null : "WAL should not be created if persistence is disabled.";
+ assert dsCfg != null;
- this.pstCfg = pstCfg;
+ this.dsCfg = dsCfg;
}
/** {@inheritDoc} */
@@ -352,7 +352,7 @@ public class FilePageStoreManager extends GridCacheSharedManagerAdapter implemen
grpsWithoutIdx.add(grpDesc.groupId());
FileVersionCheckingFactory pageStoreFactory = new FileVersionCheckingFactory(
- pstCfg.getFileIOFactory(), igniteCfg.getMemoryConfiguration());
+ dsCfg.getFileIOFactory(), igniteCfg.getDataStorageConfiguration());
FilePageStore idxStore = pageStoreFactory.createPageStore(PageMemory.FLAG_IDX, idxFile);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreV2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreV2.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreV2.java
index 5d044ec..c2e2d36 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreV2.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreV2.java
@@ -17,7 +17,7 @@
package org.apache.ignite.internal.processors.cache.persistence.file;
import java.io.File;
-import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
/**
*
@@ -35,7 +35,7 @@ public class FilePageStoreV2 extends FilePageStore {
* @param factory Factory.
* @param cfg Config.
*/
- public FilePageStoreV2(byte type, File file, FileIOFactory factory, MemoryConfiguration cfg) {
+ public FilePageStoreV2(byte type, File file, FileIOFactory factory, DataStorageConfiguration cfg) {
super(type, file, factory, cfg);
hdrSize = cfg.getPageSize();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FileVersionCheckingFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FileVersionCheckingFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FileVersionCheckingFactory.java
index 40870dc..bab2cf0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FileVersionCheckingFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FileVersionCheckingFactory.java
@@ -22,7 +22,7 @@ import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
/**
* Checks version in files if it's present on the disk, creates store with latest version otherwise.
@@ -38,14 +38,14 @@ public class FileVersionCheckingFactory implements FilePageStoreFactory {
private final FileIOFactory fileIOFactory;
/** Memory configuration. */
- private final MemoryConfiguration memCfg;
+ private final DataStorageConfiguration memCfg;
/**
* @param fileIOFactory File io factory.
* @param memCfg Memory configuration.
*/
public FileVersionCheckingFactory(
- FileIOFactory fileIOFactory, MemoryConfiguration memCfg) {
+ FileIOFactory fileIOFactory, DataStorageConfiguration memCfg) {
this.fileIOFactory = fileIOFactory;
this.memCfg = memCfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/filename/PdsConsistentIdProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/filename/PdsConsistentIdProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/filename/PdsConsistentIdProcessor.java
index c73a952..e7a7e63 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/filename/PdsConsistentIdProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/filename/PdsConsistentIdProcessor.java
@@ -31,12 +31,13 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.processors.GridProcessorAdapter;
import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager;
import org.apache.ignite.internal.util.typedef.internal.A;
+import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.SB;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.jetbrains.annotations.NotNull;
@@ -157,7 +158,7 @@ public class PdsConsistentIdProcessor extends GridProcessorAdapter implements Pd
//here deprecated method is used to get compatible version of consistentId
final Serializable consistentId = ctx.discovery().consistentId();
- if (!cfg.isPersistentStoreEnabled())
+ if (!CU.isPersistenceEnabled(cfg))
return compatibleResolve(pstStoreBasePath, consistentId);
if (getBoolean(IGNITE_DATA_STORAGE_FOLDER_BY_CONSISTENT_ID, false))
@@ -442,12 +443,12 @@ public class PdsConsistentIdProcessor extends GridProcessorAdapter implements Pd
* @throws IgniteCheckedException if I/O failed.
*/
@Nullable private File resolvePersistentStoreBasePath() throws IgniteCheckedException {
- final PersistentStoreConfiguration pstCfg = cfg.getPersistentStoreConfiguration();
+ final DataStorageConfiguration dsCfg = cfg.getDataStorageConfiguration();
- if (pstCfg == null)
+ if (dsCfg == null)
return null;
- final String pstPath = pstCfg.getPersistentStorePath();
+ final String pstPath = dsCfg.getStoragePath();
return U.resolveWorkDirectory(
cfg.getWorkDirectory(),
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/FreeListImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/FreeListImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/FreeListImpl.java
index 3eb62ae..6a87d3e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/FreeListImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/FreeListImpl.java
@@ -31,8 +31,8 @@ import org.apache.ignite.internal.pagemem.wal.record.delta.DataPageUpdateRecord;
import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryMetricsImpl;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryPolicy;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegion;
import org.apache.ignite.internal.processors.cache.persistence.evict.PageEvictionTracker;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.CacheVersionIO;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.DataPageIO;
@@ -81,7 +81,7 @@ public class FreeListImpl extends PagesList implements FreeList, ReuseList {
private final PageHandler<CacheDataRow, Boolean> updateRow = new UpdateRowHandler();
/** */
- private final MemoryMetricsImpl memMetrics;
+ private final DataRegionMetricsImpl memMetrics;
/** */
private final PageEvictionTracker evictionTracker;
@@ -313,7 +313,7 @@ public class FreeListImpl extends PagesList implements FreeList, ReuseList {
* @param cacheId Cache ID.
* @param name Name (for debug purpose).
* @param memMetrics Memory metrics.
- * @param memPlc Memory policy.
+ * @param memPlc Data region.
* @param reuseList Reuse list or {@code null} if this free list will be a reuse list for itself.
* @param wal Write ahead log manager.
* @param metaPageId Metadata page ID.
@@ -323,8 +323,8 @@ public class FreeListImpl extends PagesList implements FreeList, ReuseList {
public FreeListImpl(
int cacheId,
String name,
- MemoryMetricsImpl memMetrics,
- MemoryPolicy memPlc,
+ DataRegionMetricsImpl memMetrics,
+ DataRegion memPlc,
ReuseList reuseList,
IgniteWriteAheadLogManager wal,
long metaPageId,
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/PagesList.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/PagesList.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/PagesList.java
index 8a540a0..b113c62 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/PagesList.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/PagesList.java
@@ -180,8 +180,6 @@ public abstract class PagesList extends DataStructure {
assert nextId != pageId :
"Loop detected [next=" + U.hexLong(nextId) + ", cur=" + U.hexLong(pageId) + ']';
-
-
}
finally {
readUnlock(pageId, page, pageAddr);
@@ -354,9 +352,8 @@ public abstract class PagesList extends DataStructure {
* @param pageId Page ID.
* @param page Page absolute pointer.
* @param pageAddr Page address.
- * @throws IgniteCheckedException If failed.
*/
- private void releaseAndClose(long pageId, long page, long pageAddr) throws IgniteCheckedException {
+ private void releaseAndClose(long pageId, long page, long pageAddr) {
if (page != 0L) {
try {
// No special WAL record because we most likely changed the whole page.
@@ -924,7 +921,7 @@ public abstract class PagesList extends DataStructure {
* @param bucket Bucket index.
* @return Page for take.
*/
- private Stripe getPageForTake(int bucket) throws IgniteCheckedException {
+ private Stripe getPageForTake(int bucket) {
Stripe[] tails = getBucket(bucket);
if (tails == null || bucketsSize[bucket].get() == 0)
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
index 95b81ad..8c64e0e 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
@@ -58,7 +58,7 @@ import org.apache.ignite.internal.pagemem.wal.record.delta.PageDeltaRecord;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.persistence.CheckpointLockStateChecker;
import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryMetricsImpl;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.TrackingPageIO;
import org.apache.ignite.internal.processors.cache.persistence.wal.crc.IgniteDataIntegrityViolationException;
@@ -235,7 +235,7 @@ public class PageMemoryImpl implements PageMemoryEx {
private long[] sizes;
/** */
- private MemoryMetricsImpl memMetrics;
+ private DataRegionMetricsImpl memMetrics;
/** */
private volatile boolean closed;
@@ -256,7 +256,7 @@ public class PageMemoryImpl implements PageMemoryEx {
GridInClosure3X<FullPageId, ByteBuffer, Integer> flushDirtyPage,
GridInClosure3X<Long, FullPageId, PageMemoryEx> changeTracker,
CheckpointLockStateChecker stateChecker,
- MemoryMetricsImpl memMetrics,
+ DataRegionMetricsImpl memMetrics,
boolean throttleEnabled
) {
assert sharedCtx != null;
@@ -1817,7 +1817,7 @@ public class PageMemoryImpl implements PageMemoryEx {
pageEvictWarned = true;
U.warn(log, "Page evictions started, this will affect storage performance (consider increasing " +
- "MemoryConfiguration#setPageCacheSize).");
+ "DataStorageConfiguration#setPageCacheSize).");
}
final ThreadLocalRandom rnd = ThreadLocalRandom.current();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
index 383c605..b4fc192 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
@@ -43,8 +43,8 @@ import java.util.regex.Pattern;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.IgniteSystemProperties;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.events.EventType;
import org.apache.ignite.events.WalSegmentArchivedEvent;
@@ -61,7 +61,7 @@ import org.apache.ignite.internal.pagemem.wal.record.WALRecord;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.GridCacheSharedManagerAdapter;
import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager;
-import org.apache.ignite.internal.processors.cache.persistence.PersistenceMetricsImpl;
+import org.apache.ignite.internal.processors.cache.persistence.DataStorageMetricsImpl;
import org.apache.ignite.internal.processors.cache.persistence.file.FileIO;
import org.apache.ignite.internal.processors.cache.persistence.file.FileIOFactory;
import org.apache.ignite.internal.processors.cache.persistence.filename.PdsFolderSettings;
@@ -76,7 +76,6 @@ import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
import org.apache.ignite.internal.util.GridUnsafe;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.G;
-import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.SB;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -146,7 +145,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
private final long fsyncDelay;
/** */
- private final PersistentStoreConfiguration psCfg;
+ private final DataStorageConfiguration dsCfg;
/** Events service */
private final GridEventStorageManager evt;
@@ -155,7 +154,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
private IgniteConfiguration igCfg;
/** Persistence metrics tracker. */
- private PersistenceMetricsImpl metrics;
+ private DataStorageMetricsImpl metrics;
/** */
private File walWorkDir;
@@ -209,7 +208,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
/**
* Positive (non-0) value indicates WAL can be archived even if not complete<br>
- * See {@link PersistentStoreConfiguration#setWalAutoArchiveAfterInactivity(long)}<br>
+ * See {@link DataStorageConfiguration#setWalAutoArchiveAfterInactivity(long)}<br>
*/
private final long walAutoArchiveAfterInactivity;
@@ -239,20 +238,20 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
public FileWriteAheadLogManager(@NotNull final GridKernalContext ctx) {
igCfg = ctx.config();
- PersistentStoreConfiguration psCfg = igCfg.getPersistentStoreConfiguration();
+ DataStorageConfiguration dsCfg = igCfg.getDataStorageConfiguration();
- assert psCfg != null : "WAL should not be created if persistence is disabled.";
+ assert dsCfg != null;
- this.psCfg = psCfg;
+ this.dsCfg = dsCfg;
- maxWalSegmentSize = psCfg.getWalSegmentSize();
- mode = psCfg.getWalMode();
- tlbSize = psCfg.getTlbSize();
- flushFreq = psCfg.getWalFlushFrequency();
- fsyncDelay = psCfg.getWalFsyncDelayNanos();
- alwaysWriteFullPages = psCfg.isAlwaysWriteFullPages();
- ioFactory = psCfg.getFileIOFactory();
- walAutoArchiveAfterInactivity = psCfg.getWalAutoArchiveAfterInactivity();
+ maxWalSegmentSize = dsCfg.getWalSegmentSize();
+ mode = dsCfg.getWalMode();
+ tlbSize = dsCfg.getWalThreadLocalBufferSize();
+ flushFreq = dsCfg.getWalFlushFrequency();
+ fsyncDelay = dsCfg.getWalFsyncDelayNanos();
+ alwaysWriteFullPages = dsCfg.isAlwaysWriteFullPages();
+ ioFactory = dsCfg.getFileIOFactory();
+ walAutoArchiveAfterInactivity = dsCfg.getWalAutoArchiveAfterInactivity();
evt = ctx.event();
}
@@ -264,15 +263,15 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
checkWalConfiguration();
walWorkDir = initDirectory(
- psCfg.getWalStorePath(),
- PersistentStoreConfiguration.DFLT_WAL_STORE_PATH,
+ dsCfg.getWalPath(),
+ DataStorageConfiguration.DFLT_WAL_PATH,
resolveFolders.folderName(),
"write ahead log work directory"
);
walArchiveDir = initDirectory(
- psCfg.getWalArchivePath(),
- PersistentStoreConfiguration.DFLT_WAL_ARCHIVE_PATH,
+ dsCfg.getWalArchivePath(),
+ DataStorageConfiguration.DFLT_WAL_ARCHIVE_PATH,
resolveFolders.folderName(),
"write ahead log archive directory"
);
@@ -305,11 +304,11 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
* @throws IgniteCheckedException if WAL store path is configured and archive path isn't (or vice versa)
*/
private void checkWalConfiguration() throws IgniteCheckedException {
- if (psCfg.getWalStorePath() == null ^ psCfg.getWalArchivePath() == null) {
+ if (dsCfg.getWalPath() == null ^ dsCfg.getWalArchivePath() == null) {
throw new IgniteCheckedException(
"Properties should be either both specified or both null " +
- "[walStorePath = " + psCfg.getWalStorePath() +
- ", walArchivePath = " + psCfg.getWalArchivePath() + "]"
+ "[walStorePath = " + dsCfg.getWalPath() +
+ ", walArchivePath = " + dsCfg.getWalArchivePath() + "]"
);
}
}
@@ -575,7 +574,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
walArchiveDir,
(FileWALPointer)start,
end,
- psCfg,
+ dsCfg,
serializer,
ioFactory,
archiver,
@@ -821,7 +820,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
private FileWriteHandle restoreWriteHandle(FileWALPointer lastReadPtr) throws IgniteCheckedException {
long absIdx = lastReadPtr == null ? 0 : lastReadPtr.index();
- long segNo = absIdx % psCfg.getWalSegments();
+ long segNo = absIdx % dsCfg.getWalSegments();
File curFile = new File(walWorkDir, FileDescriptor.fileName(segNo));
@@ -934,9 +933,9 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
File[] allFiles = walWorkDir.listFiles(WAL_SEGMENT_FILE_FILTER);
- if (allFiles.length != 0 && allFiles.length > psCfg.getWalSegments())
+ if (allFiles.length != 0 && allFiles.length > dsCfg.getWalSegments())
throw new IgniteCheckedException("Failed to initialize wal (work directory contains " +
- "incorrect number of segments) [cur=" + allFiles.length + ", expected=" + psCfg.getWalSegments() + ']');
+ "incorrect number of segments) [cur=" + allFiles.length + ", expected=" + dsCfg.getWalSegments() + ']');
// Allocate the first segment synchronously. All other segments will be allocated by archiver in background.
if (allFiles.length == 0) {
@@ -958,7 +957,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
log.debug("Formatting file [exists=" + file.exists() + ", file=" + file.getAbsolutePath() + ']');
try (FileIO fileIO = ioFactory.create(file, CREATE, READ, WRITE)) {
- int left = psCfg.getWalSegmentSize();
+ int left = dsCfg.getWalSegmentSize();
if (mode == WALMode.DEFAULT) {
while (left > 0) {
@@ -1017,7 +1016,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
// Signal to archiver that we are done with the segment and it can be archived.
long absNextIdx = archiver.nextAbsoluteSegmentIndex(curIdx);
- long segmentIdx = absNextIdx % psCfg.getWalSegments();
+ long segmentIdx = absNextIdx % dsCfg.getWalSegments();
return new File(walWorkDir, FileDescriptor.fileName(segmentIdx));
}
@@ -1085,7 +1084,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
/**
* File archiver operates on absolute segment indexes. For any given absolute segment index N we can calculate
- * the work WAL segment: S(N) = N % psCfg.walSegments.
+ * the work WAL segment: S(N) = N % dsCfg.walSegments.
* When a work segment is finished, it is given to the archiver. If the absolute index of last archived segment
* is denoted by A and the absolute index of next segment we want to write is denoted by W, then we can allow
* write to S(W) if W - A <= walSegments. <br>
@@ -1296,7 +1295,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
// Notify archiver thread.
notifyAll();
- while (curAbsWalIdx - lastAbsArchivedIdx > psCfg.getWalSegments() && cleanException == null)
+ while (curAbsWalIdx - lastAbsArchivedIdx > dsCfg.getWalSegments() && cleanException == null)
wait();
return curAbsWalIdx;
@@ -1366,7 +1365,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
* @param absIdx Absolute index to archive.
*/
private SegmentArchiveResult archiveSegment(long absIdx) throws IgniteCheckedException {
- long segIdx = absIdx % psCfg.getWalSegments();
+ long segIdx = absIdx % dsCfg.getWalSegments();
File origFile = new File(walWorkDir, FileDescriptor.fileName(segIdx));
@@ -1427,7 +1426,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
}
/**
- * Validate files depending on {@link PersistentStoreConfiguration#getWalSegments()} and create if need.
+ * Validate files depending on {@link DataStorageConfiguration#getWalSegments()} and create if need.
* Check end when exit condition return false or all files are passed.
*
* @param startWith Start with.
@@ -1436,14 +1435,14 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
* @throws IgniteCheckedException if validation or create file fail.
*/
private void checkFiles(int startWith, boolean create, IgnitePredicate<Integer> p) throws IgniteCheckedException {
- for (int i = startWith; i < psCfg.getWalSegments() && (p == null || (p != null && p.apply(i))); i++) {
+ for (int i = startWith; i < dsCfg.getWalSegments() && (p == null || (p != null && p.apply(i))); i++) {
File checkFile = new File(walWorkDir, FileDescriptor.fileName(i));
if (checkFile.exists()) {
if (checkFile.isDirectory())
throw new IgniteCheckedException("Failed to initialize WAL log segment (a directory with " +
"the same name already exists): " + checkFile.getAbsolutePath());
- else if (checkFile.length() != psCfg.getWalSegmentSize() && mode == WALMode.DEFAULT)
+ else if (checkFile.length() != dsCfg.getWalSegmentSize() && mode == WALMode.DEFAULT)
throw new IgniteCheckedException("Failed to initialize WAL log segment " +
"(WAL segment size change is not supported):" + checkFile.getAbsolutePath());
}
@@ -1768,7 +1767,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
/** Condition activated each time writeBuffer() completes. Used to wait previously flushed write to complete */
private final Condition writeComplete = lock.newCondition();
- /** Condition for timed wait of several threads, see {@link PersistentStoreConfiguration#getWalFsyncDelayNanos()} */
+ /** Condition for timed wait of several threads, see {@link DataStorageConfiguration#getWalFsyncDelayNanos()} */
private final Condition fsync = lock.newCondition();
/**
@@ -2488,7 +2487,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
private final FileArchiver archiver;
/** */
- private final PersistentStoreConfiguration psCfg;
+ private final DataStorageConfiguration psCfg;
/** Optional start pointer. */
@Nullable
@@ -2516,7 +2515,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
File walArchiveDir,
@Nullable FileWALPointer start,
@Nullable FileWALPointer end,
- PersistentStoreConfiguration psCfg,
+ DataStorageConfiguration psCfg,
@NotNull RecordSerializer serializer,
FileIOFactory ioFactory,
FileArchiver archiver,
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/IgniteWalIteratorFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/IgniteWalIteratorFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/IgniteWalIteratorFactory.java
index 0fb8adf..962c4ca 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/IgniteWalIteratorFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/IgniteWalIteratorFactory.java
@@ -20,8 +20,8 @@ package org.apache.ignite.internal.processors.cache.persistence.wal.reader;
import java.io.File;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.pagemem.wal.WALIterator;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
@@ -84,8 +84,8 @@ public class IgniteWalIteratorFactory {
this.binaryMetadataFileStoreDir = binaryMetadataFileStoreDir;
this.marshallerMappingFileStoreDir = marshallerMappingFileStoreDir;
this.keepBinary = keepBinary;
- this.ioFactory = new PersistentStoreConfiguration().getFileIOFactory();
- new MemoryConfiguration().setPageSize(pageSize); // just for validate
+ this.ioFactory = new DataStorageConfiguration().getFileIOFactory();
+ new DataStorageConfiguration().setPageSize(pageSize); // just for validate
}
/**
@@ -122,7 +122,7 @@ public class IgniteWalIteratorFactory {
this.log = log;
this.pageSize = pageSize;
this.ioFactory = ioFactory;
- new MemoryConfiguration().setPageSize(pageSize); // just for validate
+ new DataStorageConfiguration().setPageSize(pageSize); // just for validate
}
/**
@@ -134,7 +134,7 @@ public class IgniteWalIteratorFactory {
* according its boundaries.
*/
public IgniteWalIteratorFactory(@NotNull final IgniteLogger log, int pageSize) {
- this(log, new PersistentStoreConfiguration().getFileIOFactory(), pageSize);
+ this(log, new DataStorageConfiguration().getFileIOFactory(), pageSize);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneGridKernalContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneGridKernalContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneGridKernalContext.java
index e234766..c0c3650 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneGridKernalContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneGridKernalContext.java
@@ -27,8 +27,9 @@ import java.util.UUID;
import java.util.concurrent.ExecutorService;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.internal.GridComponent;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.GridKernalGateway;
@@ -177,8 +178,12 @@ public class StandaloneGridKernalContext implements GridKernalContext {
final Marshaller marshaller = new BinaryMarshaller();
cfg.setMarshaller(marshaller);
- PersistentStoreConfiguration pstCfg = new PersistentStoreConfiguration();
- cfg.setPersistentStoreConfiguration(pstCfg);
+ final DataStorageConfiguration pstCfg = new DataStorageConfiguration();
+ final DataRegionConfiguration regCfg = new DataRegionConfiguration();
+ regCfg.setPersistenceEnabled(true);
+ pstCfg.setDefaultDataRegionConfiguration(regCfg);
+
+ cfg.setDataStorageConfiguration(pstCfg);
marshaller.setContext(marshallerCtx);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ratemetrics/HitRateMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ratemetrics/HitRateMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ratemetrics/HitRateMetrics.java
index 824bc7a..9c096a6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ratemetrics/HitRateMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ratemetrics/HitRateMetrics.java
@@ -28,7 +28,7 @@ import org.apache.ignite.internal.util.typedef.internal.U;
*
* <p>Implementation is nonblocking and protected from hits loss.
* Maximum relative error is 1/{@link #size}.
- * 2^56 - 1 hits per interval can be accumulated without numeric overflow.
+ * 2^55 - 1 hits per interval can be accumulated without numeric overflow.
*/
public class HitRateMetrics {
/** Bits that store actual hit count. */
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index 143e5cb..7da4898 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -648,7 +648,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements Ig
if (dhtVer == null)
dhtVer = explicitVer != null ? explicitVer : writeVersion();
- if (cctx.wal() != null && !writeEntries().isEmpty()
+ if (cacheCtx.group().persistenceEnabled() && !writeEntries().isEmpty()
&& op != NOOP && op != RELOAD && op != READ)
ptr = cctx.wal().log(new DataRecord(new DataEntry(
cacheCtx.cacheId(),
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
index 36306cb..afa3fd7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
@@ -64,8 +64,8 @@ public class CacheDataTree extends BPlusTree<CacheSearchRow, CacheDataRow> {
) throws IgniteCheckedException {
super(name,
grp.groupId(),
- grp.memoryPolicy().pageMemory(),
- grp.shared().wal(),
+ grp.dataRegion().pageMemory(),
+ grp.dataRegion().config().isPersistenceEnabled() ? grp.shared().wal() : null,
grp.offheap().globalRemoveId(),
metaPageId,
reuseList,
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/PendingEntriesTree.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/PendingEntriesTree.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/PendingEntriesTree.java
index fad3a50..a6ec6e7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/PendingEntriesTree.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/PendingEntriesTree.java
@@ -55,7 +55,7 @@ public class PendingEntriesTree extends BPlusTree<PendingRow, PendingRow> {
super(name,
grp.groupId(),
pageMem,
- grp.shared().wal(),
+ grp.dataRegion().config().isPersistenceEnabled() ? grp.shared().wal() : null,
grp.offheap().globalRemoveId(),
metaPageId,
reuseList,
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
index ff42ff6..3cd0451 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
@@ -53,6 +53,7 @@ import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.CI1;
import org.apache.ignite.internal.util.typedef.CI2;
import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteCallable;
@@ -142,7 +143,7 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
/** {@inheritDoc} */
@Override public void start() throws IgniteCheckedException {
// Start first node as inactive if persistence is enabled.
- boolean activeOnStart = !ctx.config().isPersistentStoreEnabled() && ctx.config().isActiveOnStart();
+ boolean activeOnStart = !CU.isPersistenceEnabled(ctx.config()) && ctx.config().isActiveOnStart();
globalState = DiscoveryDataClusterState.createState(activeOnStart);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
index e73fa6c..12765df 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
@@ -65,7 +65,7 @@ import org.apache.ignite.internal.managers.communication.GridIoPolicy;
import org.apache.ignite.internal.managers.communication.GridMessageListener;
import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryPolicy;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegion;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal;
import org.apache.ignite.internal.processors.datastreamer.DataStreamerCacheUpdaters;
import org.apache.ignite.internal.processors.igfs.data.IgfsDataPutProcessor;
@@ -243,7 +243,7 @@ public class IgfsDataManager extends IgfsManager {
* @return Maximum number of bytes for IGFS data cache.
*/
public long maxSpaceSize() {
- MemoryPolicy plc = dataCachePrj.context().memoryPolicy();
+ DataRegion plc = dataCachePrj.context().dataRegion();
long size = plc != null ? plc.config().getMaxSize() : 0;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index e88a234..98428b6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -2554,7 +2554,8 @@ public class GridQueryProcessor extends GridProcessorAdapter {
private void saveCacheConfiguration(DynamicCacheDescriptor desc) {
GridCacheSharedContext cctx = ctx.cache().context();
- if (cctx.pageStore() != null && cctx.database().persistenceEnabled() && !cctx.kernalContext().clientNode()) {
+ if (cctx.pageStore() != null && cctx.database().persistenceEnabled() && !cctx.kernalContext().clientNode() &&
+ CU.isPersistentCache(desc.cacheConfiguration(), cctx.gridConfig().getDataStorageConfiguration())) {
CacheConfiguration cfg = desc.cacheConfiguration();
try {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
index 6fe056c..f2fd195 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
@@ -26,7 +26,7 @@ import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.PartitionLossPolicy;
import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -142,7 +142,7 @@ public class VisorCacheConfiguration extends VisorDataTransferObject {
/** */
private boolean loadPrevVal;
- /** Name of {@link MemoryPolicyConfiguration} for this cache */
+ /** Name of {@link DataRegionConfiguration} for this cache */
private String memPlcName;
/** Maximum inline size for sql indexes. */
@@ -219,7 +219,7 @@ public class VisorCacheConfiguration extends VisorDataTransferObject {
evictFilter = compactClass(ccfg.getEvictionFilter());
lsnrConfigurations = compactIterable(ccfg.getCacheEntryListenerConfigurations());
loadPrevVal = ccfg.isLoadPreviousValue();
- memPlcName = ccfg.getMemoryPolicyName();
+ memPlcName = ccfg.getDataRegionName();
sqlIdxMaxInlineSize = ccfg.getSqlIndexMaxInlineSize();
nodeFilter = compactClass(ccfg.getNodeFilter());
qryDetailMetricsSz = ccfg.getQueryDetailMetricsSize();
@@ -460,7 +460,7 @@ public class VisorCacheConfiguration extends VisorDataTransferObject {
}
/**
- * @return {@link MemoryPolicyConfiguration} name.
+ * @return {@link DataRegionConfiguration} name.
*/
public String getMemoryPolicyName() {
return memPlcName;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorMemoryMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorMemoryMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorMemoryMetrics.java
index c6cdd5c..37fed5a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorMemoryMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorMemoryMetrics.java
@@ -20,13 +20,13 @@ package org.apache.ignite.internal.visor.cache;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
-import org.apache.ignite.MemoryMetrics;
+import org.apache.ignite.DataRegionMetrics;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.visor.VisorDataTransferObject;
/**
- * Data transfer object for {@link MemoryMetrics}
+ * Data transfer object for {@link DataRegionMetrics}
*/
public class VisorMemoryMetrics extends VisorDataTransferObject {
/** */
@@ -69,7 +69,7 @@ public class VisorMemoryMetrics extends VisorDataTransferObject {
/**
* @param m Metrics instance to create DTO.
*/
- public VisorMemoryMetrics(MemoryMetrics m) {
+ public VisorMemoryMetrics(DataRegionMetrics m) {
name = m.getName();
totalAllocatedPages = m.getTotalAllocatedPages();
allocationRate = m.getAllocationRate();
[40/50] [abbrv] ignite git commit: IGNITE-6668 Do not block metadata
read when calling from discovery thread - Fixes #2880.
Posted by sb...@apache.org.
IGNITE-6668 Do not block metadata read when calling from discovery thread - Fixes #2880.
Signed-off-by: Alexey Goncharuk <al...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/78109702
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/78109702
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/78109702
Branch: refs/heads/ignite-3478-tree
Commit: 78109702ca47dbf960ccf23c551bca2941891242
Parents: 0e77ea1
Author: Sergey Chugunov <se...@gmail.com>
Authored: Mon Oct 23 17:18:33 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Oct 23 17:18:33 2017 +0300
----------------------------------------------------------------------
.../binary/CacheObjectBinaryProcessorImpl.java | 10 ++++++++-
.../spi/discovery/IgniteDiscoveryThread.java | 23 ++++++++++++++++++++
.../ignite/spi/discovery/tcp/ServerImpl.java | 3 ++-
3 files changed, 34 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/78109702/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
index 0b85d2b..6a70936 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
@@ -82,6 +82,8 @@ import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.spi.IgniteNodeValidationResult;
import org.apache.ignite.spi.discovery.DiscoveryDataBag;
import org.apache.ignite.spi.discovery.DiscoveryDataBag.GridDiscoveryData;
+import org.apache.ignite.spi.discovery.IgniteDiscoveryThread;
+import org.apache.ignite.thread.IgniteThread;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
@@ -495,6 +497,9 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
}
if (holder != null) {
+ if (IgniteThread.current() instanceof IgniteDiscoveryThread)
+ return holder.metadata();
+
if (holder.pendingVersion() - holder.acceptedVersion() > 0) {
GridFutureAdapter<MetadataUpdateResult> fut = transport.awaitMetadataUpdate(typeId, holder.pendingVersion());
@@ -534,7 +539,10 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
}
}
}
- else {
+ else if (holder != null) {
+ if (IgniteThread.current() instanceof IgniteDiscoveryThread)
+ return holder.metadata().wrap(binaryCtx);
+
if (holder.pendingVersion() - holder.acceptedVersion() > 0) {
GridFutureAdapter<MetadataUpdateResult> fut = transport.awaitMetadataUpdate(
typeId,
http://git-wip-us.apache.org/repos/asf/ignite/blob/78109702/modules/core/src/main/java/org/apache/ignite/spi/discovery/IgniteDiscoveryThread.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/IgniteDiscoveryThread.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/IgniteDiscoveryThread.java
new file mode 100644
index 0000000..a3e376c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/IgniteDiscoveryThread.java
@@ -0,0 +1,23 @@
+/*
+ * 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.spi.discovery;
+
+/**
+ * Marker interface for discovery thread on cluster server node.
+ */
+public interface IgniteDiscoveryThread {
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/78109702/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index 60f9d4e..58e1ba4 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -101,6 +101,7 @@ import org.apache.ignite.spi.IgniteSpiOperationTimeoutHelper;
import org.apache.ignite.spi.IgniteSpiThread;
import org.apache.ignite.spi.discovery.DiscoverySpiCustomMessage;
import org.apache.ignite.spi.discovery.DiscoverySpiListener;
+import org.apache.ignite.spi.discovery.IgniteDiscoveryThread;
import org.apache.ignite.spi.discovery.tcp.internal.DiscoveryDataPacket;
import org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode;
import org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNodesRing;
@@ -2444,7 +2445,7 @@ class ServerImpl extends TcpDiscoveryImpl {
/**
* Message worker thread for messages processing.
*/
- private class RingMessageWorker extends MessageWorkerAdapter<TcpDiscoveryAbstractMessage> {
+ private class RingMessageWorker extends MessageWorkerAdapter<TcpDiscoveryAbstractMessage> implements IgniteDiscoveryThread {
/** Next node. */
@SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized"})
private TcpDiscoveryNode next;
[32/50] [abbrv] ignite git commit: IGNITE-6689: SQL: Added
DATA_REGION option for CREATE TABLE.
Posted by sb...@apache.org.
IGNITE-6689: SQL: Added DATA_REGION option for CREATE TABLE.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/026254c5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/026254c5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/026254c5
Branch: refs/heads/ignite-3478-tree
Commit: 026254c5173b681de9f1605d1697d80d614fe482
Parents: 3b18170
Author: devozerov <pp...@gmail.com>
Authored: Sat Oct 21 18:47:04 2017 +0300
Committer: devozerov <pp...@gmail.com>
Committed: Sat Oct 21 18:47:04 2017 +0300
----------------------------------------------------------------------
RELEASE_NOTES.txt | 1 +
.../processors/query/GridQueryProcessor.java | 6 ++-
.../query/h2/ddl/DdlStatementsProcessor.java | 2 +-
.../query/h2/sql/GridSqlCreateTable.java | 17 +++++++++
.../query/h2/sql/GridSqlQueryParser.java | 10 +++++
.../cache/index/H2DynamicTableSelfTest.java | 40 +++++++++++++++++++-
6 files changed, 73 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/026254c5/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 25007c7..27c5767 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -39,6 +39,7 @@ SQL:
* CREATE TABLE: Added NOT NULL support.
* CREATE TABLE: Ability to specify cache, key type and value type names.
* CREATE TABLE: Added "WRAP_KEY" and "WRAP_VALUE" options to CREATE TABLE command.
+* CREATE TABLE: Added DATA_REGION option.
* CREATE TABLE: Added WRITE_SYNCHRONIZATION_MODE option.
* ALTER TABLE: ADD COLUMN support.
* Added lazy query execution mode (SqlFieldsQuery.setLazy).
http://git-wip-us.apache.org/repos/asf/ignite/blob/026254c5/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 98428b6..4886b1b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -1360,6 +1360,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
* @param templateName Template name.
* @param cacheName Cache name.
* @param cacheGroup Cache group name.
+ * @param dataRegion Data region name.
* @param affinityKey Affinity key column name.
* @param atomicityMode Atomicity mode.
* @param writeSyncMode Write synchronization mode.
@@ -1369,7 +1370,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
*/
@SuppressWarnings("unchecked")
public void dynamicTableCreate(String schemaName, QueryEntity entity, String templateName, String cacheName,
- String cacheGroup, String affinityKey, @Nullable CacheAtomicityMode atomicityMode,
+ String cacheGroup, @Nullable String dataRegion, String affinityKey, @Nullable CacheAtomicityMode atomicityMode,
@Nullable CacheWriteSynchronizationMode writeSyncMode, int backups, boolean ifNotExists)
throws IgniteCheckedException {
assert !F.isEmpty(templateName);
@@ -1403,6 +1404,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
if (!F.isEmpty(cacheGroup))
ccfg.setGroupName(cacheGroup);
+ if (!F.isEmpty(dataRegion))
+ ccfg.setDataRegionName(dataRegion);
+
if (atomicityMode != null)
ccfg.setAtomicityMode(atomicityMode);
http://git-wip-us.apache.org/repos/asf/ignite/blob/026254c5/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
index f39e587..d29a063 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
@@ -184,7 +184,7 @@ public class DdlStatementsProcessor {
throw err;
ctx.query().dynamicTableCreate(cmd.schemaName(), e, cmd.templateName(), cmd.cacheName(),
- cmd.cacheGroup(),cmd.affinityKey(), cmd.atomicityMode(),
+ cmd.cacheGroup(), cmd.dataRegionName(), cmd.affinityKey(), cmd.atomicityMode(),
cmd.writeSynchronizationMode(), cmd.backups(), cmd.ifNotExists());
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/026254c5/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlCreateTable.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlCreateTable.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlCreateTable.java
index de10826..3608aed 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlCreateTable.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlCreateTable.java
@@ -77,6 +77,9 @@ public class GridSqlCreateTable extends GridSqlStatement {
/** Forcefully turn single column value into an Object. */
private Boolean wrapVal;
+ /** Data region. */
+ private String dataRegionName;
+
/** Extra WITH-params. */
private List<String> params;
@@ -305,6 +308,20 @@ public class GridSqlCreateTable extends GridSqlStatement {
}
/**
+ * @return Data region name.
+ */
+ public String dataRegionName() {
+ return dataRegionName;
+ }
+
+ /**
+ * @param dataRegionName Data region name.
+ */
+ public void dataRegionName(String dataRegionName) {
+ this.dataRegionName = dataRegionName;
+ }
+
+ /**
* @return Extra WITH-params.
*/
public List<String> params() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/026254c5/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
index 280fb2d..46b2aee 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
@@ -480,6 +480,9 @@ public class GridSqlQueryParser {
/** */
public static final String PARAM_WRAP_VALUE = "WRAP_VALUE";
+ /** Data region name. */
+ public static final String PARAM_DATA_REGION = "DATA_REGION";
+
/** */
private final IdentityHashMap<Object, Object> h2ObjToGridObj = new IdentityHashMap<>();
@@ -1392,6 +1395,13 @@ public class GridSqlQueryParser {
break;
+ case PARAM_DATA_REGION:
+ ensureNotEmpty(name, val);
+
+ res.dataRegionName(val);
+
+ break;
+
default:
throw new IgniteSQLException("Unsupported parameter: " + name, IgniteQueryErrorCode.PARSING);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/026254c5/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
index c56db84..ef59a62 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
@@ -44,6 +44,8 @@ import org.apache.ignite.cache.QueryEntity;
import org.apache.ignite.cache.QueryIndex;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.binary.BinaryMarshaller;
@@ -80,6 +82,12 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
/** */
private final static String INDEXED_CACHE_NAME_2 = INDEXED_CACHE_NAME + "_2";
+ /** Data region name. */
+ public static final String DATA_REGION_NAME = "my_data_region";
+
+ /** Bad data region name. */
+ public static final String DATA_REGION_NAME_BAD = "my_data_region_bad";
+
/** {@inheritDoc} */
@Override protected void beforeTestsStarted() throws Exception {
super.beforeTestsStarted();
@@ -779,7 +787,7 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
e.setKeyType("CityKey");
e.setValueType("City");
- queryProcessor(client()).dynamicTableCreate("PUBLIC", e, CacheMode.PARTITIONED.name(), null, null,
+ queryProcessor(client()).dynamicTableCreate("PUBLIC", e, CacheMode.PARTITIONED.name(), null, null, null,
null, CacheAtomicityMode.ATOMIC, null, 10, false);
return null;
@@ -863,6 +871,33 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
}
/**
+ * Test data region.
+ *
+ * @throws Exception If failed.
+ */
+ @SuppressWarnings({"ThrowableNotThrown", "unchecked"})
+ public void testDataRegion() throws Exception {
+ // Empty region name.
+ GridTestUtils.assertThrows(log, new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ execute("CREATE TABLE TEST_DATA_REGION (name varchar primary key, code int) WITH \"data_region=\"");
+
+ return null;
+ }
+ }, IgniteSQLException.class, "Parameter value cannot be empty: DATA_REGION");
+
+ // Valid region name.
+ execute("CREATE TABLE TEST_DATA_REGION (name varchar primary key, code int) WITH \"data_region=" +
+ DATA_REGION_NAME + "\"");
+
+ CacheConfiguration ccfg =
+ client().cache("SQL_PUBLIC_TEST_DATA_REGION").getConfiguration(CacheConfiguration.class);
+
+ assertEquals(DATA_REGION_NAME, ccfg.getDataRegionName());
+ }
+
+
+ /**
* Test various cases of affinity key column specification.
*/
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
@@ -1461,7 +1496,10 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
private IgniteConfiguration commonConfiguration(int idx) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(getTestIgniteInstanceName(idx));
+ DataRegionConfiguration dataRegionCfg = new DataRegionConfiguration().setName(DATA_REGION_NAME);
+
cfg.setMarshaller(new BinaryMarshaller());
+ cfg.setDataStorageConfiguration(new DataStorageConfiguration().setDataRegionConfigurations(dataRegionCfg));
return optimize(cfg);
}
[03/50] [abbrv] ignite git commit: Changed internal indexing
signatures for store/remove,
fixed error in SchemaIndexCacheVisitorImpl (link can not be used without entry
lock).
Posted by sb...@apache.org.
Changed internal indexing signatures for store/remove, fixed error in SchemaIndexCacheVisitorImpl (link can not be used without entry lock).
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/879bf581
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/879bf581
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/879bf581
Branch: refs/heads/ignite-3478-tree
Commit: 879bf581b323d961a88a3a6a3f26a4ab26638739
Parents: cc048f0
Author: sboikov <sb...@gridgain.com>
Authored: Tue Oct 17 17:06:56 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Oct 17 17:06:56 2017 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheEntryEx.java | 3 +-
.../processors/cache/GridCacheMapEntry.java | 8 +-
.../cache/IgniteCacheOffheapManagerImpl.java | 42 +---------
.../cache/query/GridCacheQueryManager.java | 53 ++++--------
.../processors/query/GridQueryIndexing.java | 25 +++---
.../processors/query/GridQueryProcessor.java | 75 +++++++++--------
.../schema/SchemaIndexCacheVisitorClosure.java | 14 +---
.../schema/SchemaIndexCacheVisitorImpl.java | 29 ++++---
.../processors/cache/GridCacheTestEntryEx.java | 2 +-
...IgniteClientCacheInitializationFailTest.java | 12 ++-
.../query/h2/DmlStatementsProcessor.java | 2 +-
.../processors/query/h2/IgniteH2Indexing.java | 62 +++++++--------
.../query/h2/database/H2PkHashIndex.java | 5 +-
.../query/h2/database/H2RowFactory.java | 6 +-
.../processors/query/h2/database/H2Tree.java | 17 +++-
.../query/h2/opt/GridH2KeyRowOnheap.java | 6 +-
.../query/h2/opt/GridH2KeyValueRowOnheap.java | 35 +++-----
.../processors/query/h2/opt/GridH2Row.java | 59 +++++---------
.../query/h2/opt/GridH2RowDescriptor.java | 24 ++----
.../processors/query/h2/opt/GridH2Table.java | 84 ++++++++------------
.../cache/IgniteCacheAbstractQuerySelfTest.java | 13 +--
21 files changed, 221 insertions(+), 355 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/879bf581/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
index b2cabac..6da7bc7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
@@ -870,11 +870,10 @@ public interface GridCacheEntryEx {
* Update index from within entry lock, passing key, value, and expiration time to provided closure.
*
* @param clo Closure to apply to key, value, and expiration time.
- * @param link Link.
* @throws IgniteCheckedException If failed.
* @throws GridCacheEntryRemovedException If entry was removed.
*/
- public void updateIndex(SchemaIndexCacheVisitorClosure clo, long link) throws IgniteCheckedException,
+ public void updateIndex(SchemaIndexCacheVisitorClosure clo) throws IgniteCheckedException,
GridCacheEntryRemovedException;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/879bf581/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index 54b8dc3..5c3fe1f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -3300,7 +3300,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
}
/** {@inheritDoc} */
- @Override public void updateIndex(SchemaIndexCacheVisitorClosure clo, long link) throws IgniteCheckedException,
+ @Override public void updateIndex(SchemaIndexCacheVisitorClosure clo) throws IgniteCheckedException,
GridCacheEntryRemovedException {
synchronized (this) {
if (isInternal())
@@ -3308,10 +3308,10 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
checkObsolete();
- unswap(false);
+ CacheDataRow row = cctx.offheap().read(this);
- if (val != null)
- clo.apply(key, partition(), val, ver, expireTimeUnlocked(), link);
+ if (row != null)
+ clo.apply(row);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/879bf581/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
index ba6f7d0..4844686 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
@@ -1339,27 +1339,8 @@ public class IgniteCacheOffheapManagerImpl implements IgniteCacheOffheapManager
int cacheId = grp.sharedGroup() ? cctx.cacheId() : CU.UNDEFINED_CACHE_ID;
- if (qryMgr.enabled()) {
- if (oldRow != null) {
- qryMgr.store(key,
- partId,
- oldRow.value(),
- oldRow.version(),
- newRow.value(),
- newRow.version(),
- expireTime,
- newRow.link());
- }
- else {
- qryMgr.store(key,
- partId,
- null, null,
- newRow.value(),
- newRow.version(),
- expireTime,
- newRow.link());
- }
- }
+ if (qryMgr.enabled())
+ qryMgr.store(newRow, oldRow);
if (oldRow != null) {
assert oldRow.link() != 0 : oldRow;
@@ -1391,15 +1372,7 @@ public class IgniteCacheOffheapManagerImpl implements IgniteCacheOffheapManager
GridCacheQueryManager qryMgr = cctx.queries();
- qryMgr.store(
- key,
- partId,
- null,
- null,
- row.value(),
- row.version(),
- row.expireTime(),
- row.link());
+ qryMgr.store(row, null);
}
}
@@ -1427,9 +1400,6 @@ public class IgniteCacheOffheapManagerImpl implements IgniteCacheOffheapManager
* @throws IgniteCheckedException If failed.
*/
private void finishRemove(GridCacheContext cctx, KeyCacheObject key, @Nullable CacheDataRow oldRow) throws IgniteCheckedException {
- CacheObject val = null;
- GridCacheVersion ver = null;
-
if (oldRow != null) {
int cacheId = grp.sharedGroup() ? cctx.cacheId() : CU.UNDEFINED_CACHE_ID;
@@ -1441,16 +1411,12 @@ public class IgniteCacheOffheapManagerImpl implements IgniteCacheOffheapManager
pendingEntries.removex(new PendingRow(cacheId, oldRow.expireTime(), oldRow.link()));
decrementSize(cctx.cacheId());
-
- val = oldRow.value();
-
- ver = oldRow.version();
}
GridCacheQueryManager qryMgr = cctx.queries();
if (qryMgr.enabled())
- qryMgr.remove(key, partId, val, ver);
+ qryMgr.remove(key, oldRow);
if (oldRow != null)
rowStore.removeRow(oldRow.link());
http://git-wip-us.apache.org/repos/asf/ignite/blob/879bf581/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
index 392b19f..dc4d7e0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
@@ -379,33 +379,14 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
}
/**
- * Writes key-value pair to index.
- *
- * @param key Key.
- * @param partId Partition.
- * @param prevVal Previous value.
- * @param prevVer Previous version.
- * @param val Value.
- * @param ver Cache entry version.
- * @param expirationTime Expiration time or 0 if never expires.
- * @param link Link.
+ * @param newRow New row.
+ * @param prevRow Previous row.
* @throws IgniteCheckedException In case of error.
*/
- public void store(KeyCacheObject key,
- int partId,
- @Nullable CacheObject prevVal,
- @Nullable GridCacheVersion prevVer,
- CacheObject val,
- GridCacheVersion ver,
- long expirationTime,
- long link)
+ public void store(CacheDataRow newRow, @Nullable CacheDataRow prevRow)
throws IgniteCheckedException {
- assert key != null;
- assert val != null;
assert enabled();
-
- if (key instanceof GridCacheInternal)
- return; // No-op.
+ assert newRow != null && newRow.value() != null && newRow.link() != 0 : newRow;
if (!enterBusy())
throw new NodeStoppingException("Operation has been cancelled (node is stopping).");
@@ -414,15 +395,15 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
if (isIndexingSpiEnabled()) {
CacheObjectContext coctx = cctx.cacheObjectContext();
- Object key0 = unwrapIfNeeded(key, coctx);
+ Object key0 = unwrapIfNeeded(newRow.key(), coctx);
- Object val0 = unwrapIfNeeded(val, coctx);
+ Object val0 = unwrapIfNeeded(newRow.value(), coctx);
- cctx.kernalContext().indexing().store(cacheName, key0, val0, expirationTime);
+ cctx.kernalContext().indexing().store(cacheName, key0, val0, newRow.expireTime());
}
if (qryProcEnabled)
- qryProc.store(cacheName, key, partId, prevVal, prevVer, val, ver, expirationTime, link);
+ qryProc.store(cctx, newRow, prevRow);
}
finally {
invalidateResultCache();
@@ -433,17 +414,11 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
/**
* @param key Key.
- * @param partId Partition.
- * @param val Value.
- * @param ver Version.
+ * @param prevRow Previous row.
* @throws IgniteCheckedException Thrown in case of any errors.
*/
- @SuppressWarnings("SimplifiableIfStatement")
- public void remove(KeyCacheObject key, int partId, CacheObject val,
- GridCacheVersion ver) throws IgniteCheckedException {
- assert key != null;
-
- if (!QueryUtils.isEnabled(cctx.config()) && !(key instanceof GridCacheInternal))
+ public void remove(KeyCacheObject key, @Nullable CacheDataRow prevRow) throws IgniteCheckedException {
+ if (!QueryUtils.isEnabled(cctx.config()))
return; // No-op.
if (!enterBusy())
@@ -457,8 +432,8 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
}
// val may be null if we have no previous value. We should not call processor in this case.
- if (qryProcEnabled && val != null)
- qryProc.remove(cacheName, key, partId, val, ver);
+ if (qryProcEnabled && prevRow != null)
+ qryProc.remove(cctx, prevRow);
}
finally {
invalidateResultCache();
@@ -474,7 +449,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
* @return Query future.
*/
@SuppressWarnings("unchecked")
- public CacheQueryFuture<?> queryLocal(GridCacheQueryBean qry) {
+ CacheQueryFuture<?> queryLocal(GridCacheQueryBean qry) {
assert qry.query().type() != GridCacheQueryType.SCAN : qry;
if (log.isDebugEnabled())
http://git-wip-us.apache.org/repos/asf/ignite/blob/879bf581/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
index 93d541d..b0a3831 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
@@ -30,10 +30,8 @@ import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.SqlQuery;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitor;
import org.apache.ignite.internal.util.GridSpinBusyLock;
import org.apache.ignite.internal.util.lang.GridCloseableIterator;
@@ -216,27 +214,24 @@ public interface GridQueryIndexing {
* Updates index. Note that key is unique for cache, so if cache contains multiple indexes
* the key should be removed from indexes other than one being updated.
*
- * @param cacheName Cache name.
+ * @param cctx Cache context.
* @param type Type descriptor.
- * @param key Key.
- * @param val Value.
- * @param ver Version.
- * @param expirationTime Expiration time or 0 if never expires.
+ * @param row New row.
* @throws IgniteCheckedException If failed.
*/
- public void store(String cacheName, GridQueryTypeDescriptor type, KeyCacheObject key, int partId, CacheObject val,
- GridCacheVersion ver, long expirationTime, long link) throws IgniteCheckedException;
+ public void store(GridCacheContext cctx, GridQueryTypeDescriptor type, CacheDataRow row)
+ throws IgniteCheckedException;
/**
* Removes index entry by key.
*
- * @param cacheName Cache name.
- * @param key Key.
- * @param val Value.
+ * @param cctx Cache context.
+ * @param type Type descriptor.
+ * @param row Row.
* @throws IgniteCheckedException If failed.
*/
- public void remove(String cacheName, GridQueryTypeDescriptor type, KeyCacheObject key, int partId, CacheObject val,
- GridCacheVersion ver) throws IgniteCheckedException;
+ public void remove(GridCacheContext cctx, GridQueryTypeDescriptor type, CacheDataRow row)
+ throws IgniteCheckedException;
/**
* Rebuilds all indexes of given type from hash index.
http://git-wip-us.apache.org/repos/asf/ignite/blob/879bf581/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 3a1cdb7..e88a234 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -67,11 +67,11 @@ import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.StoredCacheData;
+import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
import org.apache.ignite.internal.processors.cache.query.CacheQueryFuture;
import org.apache.ignite.internal.processors.cache.query.CacheQueryType;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryType;
import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.processors.query.property.QueryBinaryProperty;
import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitor;
import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitorImpl;
@@ -1694,30 +1694,21 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}
/**
- * Writes key-value pair to index.
- *
- * @param cacheName Cache name.
- * @param key Key.
- * @param val Value.
- * @param ver Cache entry version.
- * @param expirationTime Expiration time or 0 if never expires.
+ * @param cctx Cache context.
+ * @param newRow New row.
+ * @param prevRow Previous row.
* @throws IgniteCheckedException In case of error.
*/
@SuppressWarnings({"unchecked", "ConstantConditions"})
- public void store(final String cacheName,
- final KeyCacheObject key,
- int partId,
- @Nullable CacheObject prevVal,
- @Nullable GridCacheVersion prevVer,
- final CacheObject val,
- GridCacheVersion ver,
- long expirationTime,
- long link) throws IgniteCheckedException {
- assert key != null;
- assert val != null;
+ public void store(GridCacheContext cctx, CacheDataRow newRow, @Nullable CacheDataRow prevRow)
+ throws IgniteCheckedException {
+ assert cctx != null;
+ assert newRow != null;
+
+ KeyCacheObject key = newRow.key();
if (log.isDebugEnabled())
- log.debug("Store [cache=" + cacheName + ", key=" + key + ", val=" + val + "]");
+ log.debug("Store [cache=" + cctx.name() + ", key=" + key + ", val=" + newRow.value() + "]");
if (idx == null)
return;
@@ -1726,21 +1717,27 @@ public class GridQueryProcessor extends GridProcessorAdapter {
throw new NodeStoppingException("Operation has been cancelled (node is stopping).");
try {
- CacheObjectContext coctx = cacheObjectContext(cacheName);
+ String cacheName = cctx.name();
+
+ CacheObjectContext coctx = cctx.cacheObjectContext();
- QueryTypeDescriptorImpl desc = typeByValue(cacheName, coctx, key, val, true);
+ QueryTypeDescriptorImpl desc = typeByValue(cacheName, coctx, key, newRow.value(), true);
- if (prevVal != null) {
- QueryTypeDescriptorImpl prevValDesc = typeByValue(cacheName, coctx, key, prevVal, false);
+ if (prevRow != null) {
+ QueryTypeDescriptorImpl prevValDesc = typeByValue(cacheName,
+ coctx,
+ key,
+ prevRow.value(),
+ false);
if (prevValDesc != null && prevValDesc != desc)
- idx.remove(cacheName, prevValDesc, key, partId, prevVal, prevVer);
+ idx.remove(cctx, prevValDesc, prevRow);
}
if (desc == null)
return;
- idx.store(cacheName, desc, key, partId, val, ver, expirationTime, link);
+ idx.store(cctx, desc, newRow);
}
finally {
busyLock.leaveBusy();
@@ -1870,7 +1867,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
try {
final String schemaName = qry.getSchema() != null ? qry.getSchema() : idx.schema(cctx.name());
- final int mainCacheId = CU.cacheId(cctx.name());
+ final int mainCacheId = cctx.cacheId();
IgniteOutClosureX<FieldsQueryCursor<List<?>>> clo;
@@ -2056,7 +2053,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
try {
final String schemaName = idx.schema(cctx.name());
- final int mainCacheId = CU.cacheId(cctx.name());
+ final int mainCacheId = cctx.cacheId();
return executeQuery(GridCacheQueryType.SQL, qry.getSql(), cctx,
new IgniteOutClosureX<QueryCursor<Cache.Entry<K, V>>>() {
@@ -2085,7 +2082,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
throw new IllegalStateException("Failed to execute query (grid is stopping).");
final String schemaName = idx.schema(cctx.name());
- final int mainCacheId = CU.cacheId(cctx.name());
+ final int mainCacheId = cctx.cacheId();
try {
return executeQuery(GridCacheQueryType.SQL, qry.getSql(), cctx,
@@ -2302,16 +2299,16 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}
/**
- * @param cacheName Cache name.
- * @param key Key.
+ * @param cctx Cache context.
+ * @param val Row.
* @throws IgniteCheckedException Thrown in case of any errors.
*/
- public void remove(String cacheName, KeyCacheObject key, int partId, CacheObject val, GridCacheVersion ver)
+ public void remove(GridCacheContext cctx, CacheDataRow val)
throws IgniteCheckedException {
- assert key != null;
+ assert val != null;
if (log.isDebugEnabled())
- log.debug("Remove [cacheName=" + cacheName + ", key=" + key + ", val=" + val + "]");
+ log.debug("Remove [cacheName=" + cctx.name() + ", key=" + val.key()+ ", val=" + val.value() + "]");
if (idx == null)
return;
@@ -2320,14 +2317,16 @@ public class GridQueryProcessor extends GridProcessorAdapter {
throw new IllegalStateException("Failed to remove from index (grid is stopping).");
try {
- CacheObjectContext coctx = cacheObjectContext(cacheName);
-
- QueryTypeDescriptorImpl desc = typeByValue(cacheName, coctx, key, val, false);
+ QueryTypeDescriptorImpl desc = typeByValue(cctx.name(),
+ cctx.cacheObjectContext(),
+ val.key(),
+ val.value(),
+ false);
if (desc == null)
return;
- idx.remove(cacheName, desc, key, partId, val, ver);
+ idx.remove(cctx, desc, val);
}
finally {
busyLock.leaveBusy();
http://git-wip-us.apache.org/repos/asf/ignite/blob/879bf581/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorClosure.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorClosure.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorClosure.java
index 7f50089..a934d69 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorClosure.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorClosure.java
@@ -18,9 +18,7 @@
package org.apache.ignite.internal.processors.query.schema;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.processors.cache.CacheObject;
-import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
/**
* Index closure accepting current entry state.
@@ -29,14 +27,8 @@ public interface SchemaIndexCacheVisitorClosure {
/**
* Apply closure.
*
- * @param key Key.
- * @param part Partition.
- * @param val Value.
- * @param ver Version.
- * @param expiration Expiration.
- * @param link Link.
+ * @param row Row.
* @throws IgniteCheckedException If failed.
*/
- public void apply(KeyCacheObject key, int part, CacheObject val, GridCacheVersion ver, long expiration, long link)
- throws IgniteCheckedException;
+ public void apply(CacheDataRow row) throws IgniteCheckedException;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/879bf581/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java
index 4e50f64..fda7d1d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java
@@ -17,24 +17,22 @@
package org.apache.ignite.internal.processors.query.schema;
+import java.util.Collection;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvalidPartitionException;
-import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
+import org.apache.ignite.internal.processors.cache.persistence.CacheDataRowAdapter;
import org.apache.ignite.internal.processors.query.GridQueryProcessor;
import org.apache.ignite.internal.util.lang.GridCursor;
import org.apache.ignite.internal.util.typedef.internal.S;
-import java.util.Collection;
-
import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState.EVICTED;
import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState.OWNING;
import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState.RENTING;
@@ -111,14 +109,17 @@ public class SchemaIndexCacheVisitorImpl implements SchemaIndexCacheVisitor {
return;
try {
- GridCursor<? extends CacheDataRow> cursor = part.dataStore().cursor();
+ GridCursor<? extends CacheDataRow> cursor = part.dataStore().cursor(cctx.cacheId(),
+ null,
+ null,
+ CacheDataRowAdapter.RowData.KEY_ONLY);
while (cursor.next()) {
CacheDataRow row = cursor.get();
KeyCacheObject key = row.key();
- processKey(key, row.link(), clo);
+ processKey(key, clo);
if (part.state() == RENTING)
break;
@@ -133,11 +134,10 @@ public class SchemaIndexCacheVisitorImpl implements SchemaIndexCacheVisitor {
* Process single key.
*
* @param key Key.
- * @param link Link.
* @param clo Closure.
* @throws IgniteCheckedException If failed.
*/
- private void processKey(KeyCacheObject key, long link, FilteringVisitorClosure clo) throws IgniteCheckedException {
+ private void processKey(KeyCacheObject key, FilteringVisitorClosure clo) throws IgniteCheckedException {
while (true) {
try {
checkCancelled();
@@ -145,7 +145,7 @@ public class SchemaIndexCacheVisitorImpl implements SchemaIndexCacheVisitor {
GridCacheEntryEx entry = cctx.cache().entryEx(key);
try {
- entry.updateIndex(clo, link);
+ entry.updateIndex(clo);
}
finally {
cctx.evicts().touch(entry, AffinityTopologyVersion.NONE);
@@ -190,15 +190,14 @@ public class SchemaIndexCacheVisitorImpl implements SchemaIndexCacheVisitor {
*
* @param target Target.
*/
- public FilteringVisitorClosure(SchemaIndexCacheVisitorClosure target) {
+ FilteringVisitorClosure(SchemaIndexCacheVisitorClosure target) {
this.target = target;
}
/** {@inheritDoc} */
- @Override public void apply(KeyCacheObject key, int part, CacheObject val, GridCacheVersion ver,
- long expiration, long link) throws IgniteCheckedException {
- if (qryProc.belongsToTable(cctx, cacheName, tblName, key, val))
- target.apply(key, part, val, ver, expiration, link);
+ @Override public void apply(CacheDataRow row) throws IgniteCheckedException {
+ if (qryProc.belongsToTable(cctx, cacheName, tblName, row.key(), row.value()))
+ target.apply(row);
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/879bf581/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
index 6712b5b..2ba8fd8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
@@ -842,7 +842,7 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
}
/** {@inheritDoc} */
- @Override public void updateIndex(SchemaIndexCacheVisitorClosure clo, long link) throws IgniteCheckedException,
+ @Override public void updateIndex(SchemaIndexCacheVisitorClosure clo) throws IgniteCheckedException,
GridCacheEntryRemovedException {
// No-op.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/879bf581/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java
index 83dd9c9..b0b758a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java
@@ -43,7 +43,7 @@ import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
import org.apache.ignite.internal.processors.query.GridQueryCancel;
import org.apache.ignite.internal.processors.query.GridQueryIndexing;
import org.apache.ignite.internal.processors.query.GridQueryProcessor;
@@ -310,15 +310,13 @@ public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractT
}
/** {@inheritDoc} */
- @Override public void store(String cacheName, GridQueryTypeDescriptor type, KeyCacheObject key, int partId,
- CacheObject val, GridCacheVersion ver, long expirationTime, long link) throws IgniteCheckedException {
- // No-op
+ @Override public void store(GridCacheContext cctx, GridQueryTypeDescriptor type, CacheDataRow val) {
+ // No-op.
}
/** {@inheritDoc} */
- @Override public void remove(String spaceName, GridQueryTypeDescriptor type, KeyCacheObject key, int partId,
- CacheObject val, GridCacheVersion ver) throws IgniteCheckedException {
- // No-op
+ @Override public void remove(GridCacheContext cctx, GridQueryTypeDescriptor type, CacheDataRow val) {
+ // No-op.
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/879bf581/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
index 9e55442..c3d48dd 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
@@ -361,7 +361,7 @@ public class DmlStatementsProcessor {
private UpdateResult executeUpdateStatement(String schemaName, final GridCacheContext cctx, Connection c,
Prepared prepared, SqlFieldsQuery fieldsQry, boolean loc, IndexingQueryFilter filters,
GridQueryCancel cancel, Object[] failedKeys) throws IgniteCheckedException {
- int mainCacheId = CU.cacheId(cctx.name());
+ int mainCacheId = cctx.cacheId();
Integer errKeysPos = null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/879bf581/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index 541b80f..ff6ff4d 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -61,7 +61,6 @@ import org.apache.ignite.internal.GridTopic;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheEntryImpl;
-import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.CacheObjectUtils;
import org.apache.ignite.internal.processors.cache.CacheObjectValueContext;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
@@ -72,6 +71,7 @@ import org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManager;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.QueryCursorImpl;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvalidPartitionException;
+import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO;
import org.apache.ignite.internal.processors.cache.query.CacheQueryPartitionInfo;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryMarshallable;
@@ -79,7 +79,6 @@ import org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery;
import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
import org.apache.ignite.internal.processors.cache.query.QueryTable;
import org.apache.ignite.internal.processors.cache.query.SqlFieldsQueryEx;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.processors.query.CacheQueryObjectValueContext;
import org.apache.ignite.internal.processors.query.GridQueryCacheObjectsIterator;
import org.apache.ignite.internal.processors.query.GridQueryCancel;
@@ -538,46 +537,47 @@ public class IgniteH2Indexing implements GridQueryIndexing {
}
/** {@inheritDoc} */
- @Override public void store(String cacheName,
- GridQueryTypeDescriptor type,
- KeyCacheObject k,
- int partId,
- CacheObject v,
- GridCacheVersion ver,
- long expirationTime,
- long link) throws IgniteCheckedException {
+ @Override public void store(GridCacheContext cctx, GridQueryTypeDescriptor type, CacheDataRow row)
+ throws IgniteCheckedException {
+ String cacheName = cctx.name();
+
H2TableDescriptor tbl = tableDescriptor(schema(cacheName), cacheName, type.name());
if (tbl == null)
return; // Type was rejected.
- if (expirationTime == 0)
- expirationTime = Long.MAX_VALUE;
+ tbl.table().update(row, false);
- tbl.table().update(k, partId, v, ver, expirationTime, false, link);
+ if (tbl.luceneIndex() != null) {
+ long expireTime = row.expireTime();
- if (tbl.luceneIndex() != null)
- tbl.luceneIndex().store(k, v, ver, expirationTime);
+ if (expireTime == 0L)
+ expireTime = Long.MAX_VALUE;
+
+ tbl.luceneIndex().store(row.key(), row.value(), row.version(), expireTime);
+ }
}
/** {@inheritDoc} */
- @Override public void remove(String cacheName,
- GridQueryTypeDescriptor type,
- KeyCacheObject key,
- int partId,
- CacheObject val,
- GridCacheVersion ver) throws IgniteCheckedException {
- if (log.isDebugEnabled())
- log.debug("Removing key from cache query index [locId=" + nodeId + ", key=" + key + ", val=" + val + ']');
+ @Override public void remove(GridCacheContext cctx, GridQueryTypeDescriptor type, CacheDataRow row)
+ throws IgniteCheckedException
+ {
+ if (log.isDebugEnabled()) {
+ log.debug("Removing key from cache query index [locId=" + nodeId +
+ ", key=" + row.key() +
+ ", val=" + row.value() + ']');
+ }
+
+ String cacheName = cctx.name();
H2TableDescriptor tbl = tableDescriptor(schema(cacheName), cacheName, type.name());
if (tbl == null)
return;
- if (tbl.table().update(key, partId, val, ver, 0, true, 0)) {
+ if (tbl.table().update(row, true)) {
if (tbl.luceneIndex() != null)
- tbl.luceneIndex().remove(key);
+ tbl.luceneIndex().remove(row.key());
}
}
@@ -670,14 +670,10 @@ public class IgniteH2Indexing implements GridQueryIndexing {
final GridH2RowDescriptor rowDesc = h2Tbl.rowDescriptor();
SchemaIndexCacheVisitorClosure clo = new SchemaIndexCacheVisitorClosure() {
- @Override public void apply(KeyCacheObject key, int part, CacheObject val, GridCacheVersion ver,
- long expTime, long link) throws IgniteCheckedException {
- if (expTime == 0L)
- expTime = Long.MAX_VALUE;
-
- GridH2Row row = rowDesc.createRow(key, part, val, ver, expTime, link);
+ @Override public void apply(CacheDataRow row) throws IgniteCheckedException {
+ GridH2Row h2Row = rowDesc.createRow(row);
- h2Idx.put(row);
+ h2Idx.put(h2Row);
}
};
@@ -2509,7 +2505,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
for (QueryTable tblKey : twoStepQry.tables()) {
GridH2Table tbl = dataTable(tblKey);
- int cacheId = CU.cacheId(tbl.cacheName());
+ int cacheId = tbl.cacheId();
caches0.add(cacheId);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/879bf581/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2PkHashIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2PkHashIndex.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2PkHashIndex.java
index 891e59f..59bf153 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2PkHashIndex.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2PkHashIndex.java
@@ -31,8 +31,8 @@ import org.apache.ignite.internal.processors.query.h2.opt.GridH2IndexBase;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2Row;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2Table;
import org.apache.ignite.internal.util.lang.GridCursor;
-import org.apache.ignite.spi.indexing.IndexingQueryFilter;
import org.apache.ignite.spi.indexing.IndexingQueryCacheFilter;
+import org.apache.ignite.spi.indexing.IndexingQueryFilter;
import org.h2.engine.Session;
import org.h2.index.Cursor;
import org.h2.index.IndexType;
@@ -197,8 +197,7 @@ public class H2PkHashIndex extends GridH2IndexBase {
try {
CacheDataRow dataRow = cursor.get();
- return tbl.rowDescriptor().createRow(dataRow.key(), dataRow.partition(), dataRow.value(),
- dataRow.version(), 0, dataRow.link());
+ return tbl.rowDescriptor().createRow(dataRow);
}
catch (IgniteCheckedException e) {
throw DbException.convert(e);
http://git-wip-us.apache.org/repos/asf/ignite/blob/879bf581/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2RowFactory.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2RowFactory.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2RowFactory.java
index 7116fe7..40b9b0a 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2RowFactory.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2RowFactory.java
@@ -19,11 +19,10 @@ package org.apache.ignite.internal.processors.query.h2.database;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.internal.pagemem.PageIdUtils;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.persistence.CacheDataRowAdapter;
-import org.apache.ignite.internal.processors.query.h2.opt.GridH2RowDescriptor;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2Row;
+import org.apache.ignite.internal.processors.query.h2.opt.GridH2RowDescriptor;
/**
* Data store for H2 rows.
@@ -64,8 +63,7 @@ public class H2RowFactory {
GridH2Row row;
try {
- row = rowDesc.createRow(rowBuilder.key(),
- PageIdUtils.partId(link), rowBuilder.value(), rowBuilder.version(), rowBuilder.expireTime(), link);
+ row = rowDesc.createRow(rowBuilder);
}
catch (IgniteCheckedException e) {
throw new IgniteException(e);
http://git-wip-us.apache.org/repos/asf/ignite/blob/879bf581/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2Tree.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2Tree.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2Tree.java
index 6214be4..fcfeb16 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2Tree.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2Tree.java
@@ -126,7 +126,7 @@ public abstract class H2Tree extends BPlusTree<SearchRow, GridH2Row> {
/**
* @return Inline size.
*/
- public int inlineSize() {
+ private int inlineSize() {
return inlineSize;
}
@@ -204,6 +204,7 @@ public abstract class H2Tree extends BPlusTree<SearchRow, GridH2Row> {
int idx0 = col.column.getColumnId();
Value v2 = row.getValue(idx0);
+
if (v2 == null) {
// Can't compare further.
return 0;
@@ -212,6 +213,7 @@ public abstract class H2Tree extends BPlusTree<SearchRow, GridH2Row> {
Value v1 = rowData.getValue(idx0);
int c = compareValues(v1, v2);
+
if (c != 0)
return InlineIndexHelper.fixSort(c, col.sortType);
}
@@ -233,19 +235,28 @@ public abstract class H2Tree extends BPlusTree<SearchRow, GridH2Row> {
for (int i = 0, len = cols.length; i < len; i++) {
int idx = columnIds[i];
+
Value v1 = r1.getValue(idx);
Value v2 = r2.getValue(idx);
+
if (v1 == null || v2 == null) {
- // can't compare further
+ // Can't compare further.
return 0;
}
+
int c = compareValues(v1, v2);
+
if (c != 0)
return InlineIndexHelper.fixSort(c, cols[i].sortType);
}
+
return 0;
}
- /** Compares two Values. */
+ /**
+ * @param v1 First value.
+ * @param v2 Second value.
+ * @return Comparison result.
+ */
public abstract int compareValues(Value v1, Value v2);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/879bf581/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyRowOnheap.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyRowOnheap.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyRowOnheap.java
index a0716c9..291f8c8 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyRowOnheap.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyRowOnheap.java
@@ -17,6 +17,7 @@
package org.apache.ignite.internal.processors.query.h2.opt;
+import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
import org.h2.value.Value;
/**
@@ -27,9 +28,12 @@ public class GridH2KeyRowOnheap extends GridH2Row {
private Value key;
/**
+ * @param row Row.
* @param key Key.
*/
- public GridH2KeyRowOnheap(Value key) {
+ public GridH2KeyRowOnheap(CacheDataRow row, Value key) {
+ super(row);
+
this.key = key;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/879bf581/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOnheap.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOnheap.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOnheap.java
index ad93fec..e855536 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOnheap.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOnheap.java
@@ -18,15 +18,12 @@
package org.apache.ignite.internal.processors.query.h2.opt;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
import org.apache.ignite.internal.util.typedef.internal.SB;
import org.h2.message.DbException;
-import org.h2.result.Row;
-import org.h2.result.SearchRow;
import org.h2.value.Value;
import org.h2.value.ValueNull;
-import org.jetbrains.annotations.Nullable;
/**
* Table row implementation based on {@link GridQueryTypeDescriptor}.
@@ -48,10 +45,6 @@ public class GridH2KeyValueRowOnheap extends GridH2Row {
protected final GridH2RowDescriptor desc;
/** */
- @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
- protected long expirationTime;
-
- /** */
private Value key;
/** */
@@ -67,30 +60,24 @@ public class GridH2KeyValueRowOnheap extends GridH2Row {
* Constructor.
*
* @param desc Row descriptor.
- * @param key Key.
+ * @param row Row.
* @param keyType Key type.
- * @param val Value.
* @param valType Value type.
- * @param expirationTime Expiration time.
* @throws IgniteCheckedException If failed.
*/
- public GridH2KeyValueRowOnheap(GridH2RowDescriptor desc, Object key, int keyType, @Nullable Object val,
- int valType, GridCacheVersion ver, long expirationTime) throws IgniteCheckedException {
- this.desc = desc;
- this.expirationTime = expirationTime;
+ public GridH2KeyValueRowOnheap(GridH2RowDescriptor desc, CacheDataRow row, int keyType, int valType)
+ throws IgniteCheckedException {
+ super(row);
- this.key = desc.wrap(key, keyType);
+ this.desc = desc;
- if (val != null)
- this.val = desc.wrap(val, valType);
+ this.key = desc.wrap(row.key(), keyType);
- if (ver != null)
- this.ver = desc.wrap(ver, Value.JAVA_OBJECT);
- }
+ if (row.value() != null)
+ this.val = desc.wrap(row.value(), valType);
- /** {@inheritDoc} */
- @Override public long expireTime() {
- return expirationTime;
+ if (row.version() != null)
+ this.ver = desc.wrap(row.version(), Value.JAVA_OBJECT);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/879bf581/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Row.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Row.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Row.java
index 4cb603b..8b1b711 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Row.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Row.java
@@ -26,75 +26,54 @@ import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
* Row with locking support needed for unique key conflicts resolution.
*/
public abstract class GridH2Row extends GridH2SearchRowAdapter implements CacheDataRow {
- /** Link. */
- private long link;
+ /** Row. */
+ private CacheDataRow row;
- /** Key. */
- private KeyCacheObject key;
-
- /** Value. */
- private CacheObject val;
-
- /** Version. */
- private GridCacheVersion ver;
-
- /** Partition. */
- private int partId;
+ /**
+ * @param row Row.
+ */
+ GridH2Row(CacheDataRow row) {
+ this.row = row;
+ }
/** {@inheritDoc} */
@Override public KeyCacheObject key() {
- return key;
+ return row.key();
}
/** {@inheritDoc} */
@Override public void key(KeyCacheObject key) {
- this.key = key;
+ row.key(key);
}
/** {@inheritDoc} */
@Override public CacheObject value() {
- return val;
- }
-
- /**
- * @param val Value.
- */
- public void value(CacheObject val) {
- this.val = val;
+ return row.value();
}
/** {@inheritDoc} */
@Override public GridCacheVersion version() {
- return ver;
- }
-
- /**
- * @param ver Version.
- */
- public void version(GridCacheVersion ver) {
- this.ver = ver;
+ return row.version();
}
/** {@inheritDoc} */
@Override public int partition() {
- return partId;
+ return row.partition();
}
- /**
- * @param partId Partition.
- */
- public void partition(int partId) {
- this.partId = partId;
+ /** {@inheritDoc} */
+ @Override public long expireTime() {
+ return row.expireTime();
}
/** {@inheritDoc} */
@Override public long link() {
- return link;
+ return row.link();
}
/** {@inheritDoc} */
@Override public void link(long link) {
- this.link = link;
+ row.link(link);
}
/** {@inheritDoc} */
@@ -104,6 +83,6 @@ public abstract class GridH2Row extends GridH2SearchRowAdapter implements CacheD
/** {@inheritDoc} */
@Override public int cacheId() {
- return 0;
+ return row.cacheId();
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/879bf581/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java
index 503e487..1d915e5 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java
@@ -29,8 +29,7 @@ import java.util.UUID;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
import org.apache.ignite.internal.processors.query.GridQueryProperty;
import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
import org.apache.ignite.internal.processors.query.h2.H2TableDescriptor;
@@ -59,7 +58,6 @@ import org.h2.value.ValueString;
import org.h2.value.ValueTime;
import org.h2.value.ValueTimestamp;
import org.h2.value.ValueUuid;
-import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.internal.processors.query.h2.opt.GridH2KeyValueRowOnheap.DEFAULT_COLUMNS_COUNT;
import static org.apache.ignite.internal.processors.query.h2.opt.GridH2KeyValueRowOnheap.KEY_COL;
@@ -274,22 +272,18 @@ public class GridH2RowDescriptor {
/**
* Creates new row.
*
- * @param key Key.
- * @param val Value.
- * @param ver Version.
- * @param expirationTime Expiration time in millis.
+ * @param dataRow Data row.
* @return Row.
* @throws IgniteCheckedException If failed.
*/
- public GridH2Row createRow(KeyCacheObject key, int partId, @Nullable CacheObject val, GridCacheVersion ver,
- long expirationTime, long link) throws IgniteCheckedException {
+ public GridH2Row createRow(CacheDataRow dataRow) throws IgniteCheckedException {
GridH2Row row;
try {
- if (val == null) // Only can happen for remove operation, can create simple search row.
- row = new GridH2KeyRowOnheap(wrap(key, keyType));
+ if (dataRow.value() == null) // Only can happen for remove operation, can create simple search row.
+ row = new GridH2KeyRowOnheap(dataRow, wrap(dataRow.key(), keyType));
else
- row = new GridH2KeyValueRowOnheap(this, key, keyType, val, valType, ver, expirationTime);
+ row = new GridH2KeyValueRowOnheap(this, dataRow, keyType, valType);
}
catch (ClassCastException e) {
throw new IgniteCheckedException("Failed to convert key to SQL type. " +
@@ -297,12 +291,6 @@ public class GridH2RowDescriptor {
"or configure key type as common super class for all actual keys for this value type.", e);
}
- row.version(ver);
- row.key(key);
- row.value(val);
- row.partition(partId);
- row.link(link);
-
return row;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/879bf581/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
index add2488..93da34e 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
@@ -27,11 +27,9 @@ import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteInterruptedException;
-import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
import org.apache.ignite.internal.processors.cache.query.QueryTable;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.processors.query.IgniteSQLException;
import org.apache.ignite.internal.processors.query.QueryField;
import org.apache.ignite.internal.processors.query.h2.database.H2RowFactory;
@@ -222,6 +220,13 @@ public class GridH2Table extends TableBase {
}
/**
+ * @return Cache ID.
+ */
+ public int cacheId() {
+ return cctx.cacheId();
+ }
+
+ /**
* @return Cache context.
*/
public GridCacheContext cache() {
@@ -389,37 +394,29 @@ public class GridH2Table extends TableBase {
* Updates table for given key. If value is null then row with given key will be removed from table,
* otherwise value and expiration time will be updated or new row will be added.
*
- * @param key Key.
- * @param val Value.
- * @param expirationTime Expiration time.
+ * @param row Row.
* @param rmv If {@code true} then remove, else update row.
* @return {@code true} If operation succeeded.
* @throws IgniteCheckedException If failed.
*/
- public boolean update(KeyCacheObject key,
- int partId,
- CacheObject val,
- GridCacheVersion ver,
- long expirationTime,
- boolean rmv,
- long link)
+ public boolean update(CacheDataRow row, boolean rmv)
throws IgniteCheckedException {
assert desc != null;
- GridH2Row row = desc.createRow(key, partId, val, ver, expirationTime, link);
+ GridH2Row h2Row = desc.createRow(row);
if (rmv)
- return doUpdate(row, true);
+ return doUpdate(h2Row, true);
else {
- GridH2KeyValueRowOnheap row0 = (GridH2KeyValueRowOnheap)row;
+ GridH2KeyValueRowOnheap h2Row0 = (GridH2KeyValueRowOnheap)h2Row;
- row0.prepareValuesCache();
+ h2Row0.prepareValuesCache();
try {
- return doUpdate(row, false);
+ return doUpdate(h2Row0, false);
}
finally {
- row0.clearValuesCache();
+ h2Row0.clearValuesCache();
}
}
}
@@ -452,7 +449,7 @@ public class GridH2Table extends TableBase {
* @throws IgniteCheckedException If failed.
*/
@SuppressWarnings("LockAcquiredButNotSafelyReleased")
- boolean doUpdate(final GridH2Row row, boolean del) throws IgniteCheckedException {
+ private boolean doUpdate(final GridH2Row row, boolean del) throws IgniteCheckedException {
// Here we assume that each key can't be updated concurrently and case when different indexes
// getting updated from different threads with different rows with the same key is impossible.
lock(false);
@@ -477,15 +474,16 @@ public class GridH2Table extends TableBase {
// Put row if absent to all indexes sequentially.
// Start from 3 because 0 - Scan (don't need to update), 1 - PK hash (already updated), 2 - PK (already updated).
while (++i < len) {
- if (!(idxs.get(i) instanceof GridH2IndexBase))
- continue;
- GridH2IndexBase idx = index(i);
+ Index idx = idxs.get(i);
- addToIndex(idx, pk, row, old, false);
+ if (idx instanceof GridH2IndexBase)
+ addToIndex((GridH2IndexBase)idx, pk, row, old, false);
}
- for (GridH2IndexBase idx : tmpIdxs.values())
- addToIndex(idx, pk, row, old, true);
+ if (!tmpIdxs.isEmpty()) {
+ for (GridH2IndexBase idx : tmpIdxs.values())
+ addToIndex(idx, pk, row, old, true);
+ }
}
else {
// index(1) is PK, get full row from there (search row here contains only key but no other columns).
@@ -495,15 +493,19 @@ public class GridH2Table extends TableBase {
// Remove row from all indexes.
// Start from 3 because 0 - Scan (don't need to update), 1 - PK hash (already updated), 2 - PK (already updated).
for (int i = pkIndexPos + 1, len = idxs.size(); i < len; i++) {
- if (!(idxs.get(i) instanceof GridH2IndexBase))
- continue;
- Row res = index(i).remove(old);
+ Index idx = idxs.get(i);
+
+ if (idx instanceof GridH2IndexBase) {
+ Row res = ((GridH2IndexBase)idx).remove(old);
- assert eq(pk, res, old) : "\n" + old + "\n" + res + "\n" + i + " -> " + index(i).getName();
+ assert eq(pk, res, old) : "\n" + old + "\n" + res + "\n" + i + " -> " + index(i).getName();
+ }
}
- for (GridH2IndexBase idx : tmpIdxs.values())
- idx.remove(old);
+ if (!tmpIdxs.isEmpty()) {
+ for (GridH2IndexBase idx : tmpIdxs.values())
+ idx.remove(old);
+ }
size.decrement();
}
@@ -556,22 +558,6 @@ public class GridH2Table extends TableBase {
}
/**
- * For testing only.
- *
- * @return Indexes.
- */
- ArrayList<GridH2IndexBase> indexes() {
- ArrayList<GridH2IndexBase> res = new ArrayList<>(idxs.size() - 2);
-
- for (int i = pkIndexPos, len = idxs.size(); i < len; i++) {
- if (idxs.get(i) instanceof GridH2IndexBase)
- res.add(index(i));
- }
-
- return res;
- }
-
- /**
*
*/
public void markRebuildFromHashInProgress(boolean value) {
@@ -875,7 +861,7 @@ public class GridH2Table extends TableBase {
* @param target Index to clone.
* @return Proxy index.
*/
- public Index createDuplicateIndexIfNeeded(Index target) {
+ private Index createDuplicateIndexIfNeeded(Index target) {
if (!(target instanceof H2TreeIndex) && !(target instanceof SpatialIndex))
return null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/879bf581/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
index e58f983..97ef8e5 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
@@ -69,13 +69,9 @@ import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.events.CacheQueryExecutedEvent;
import org.apache.ignite.events.CacheQueryReadEvent;
import org.apache.ignite.events.Event;
-import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.IgnitionEx;
import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.processors.cache.query.QueryCursorEx;
import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata;
-import org.apache.ignite.internal.processors.query.GridQueryProcessor;
import org.apache.ignite.internal.util.lang.GridPlainCallable;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.typedef.F;
@@ -1069,16 +1065,15 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac
Collection<Cache.Entry<Integer, ObjectValue>> res = qry.getAll();
- assert res != null;
-
- assert res.size() == 2;
+ assertNotNull(res);
+ assertEquals(2, res.size());
qry = cache.query(new TextQuery<Integer, ObjectValue>(ObjectValue.class, "full"));
res = qry.getAll();
- assert res != null;
- assert res.size() == 2;
+ assertNotNull(res);
+ assertEquals(2, res.size());
}
/**
[23/50] [abbrv] ignite git commit: IGNITE-6030 Allow enabling
persistence per data region
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/configuration/DataRegionConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/DataRegionConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/DataRegionConfiguration.java
new file mode 100644
index 0000000..50edf5c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/DataRegionConfiguration.java
@@ -0,0 +1,406 @@
+/*
+ * 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.DataRegionMetrics;
+import org.apache.ignite.internal.mem.IgniteOutOfMemoryException;
+import org.apache.ignite.mxbean.DataRegionMetricsMXBean;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_DATA_REG_DEFAULT_NAME;
+
+/**
+ * This class allows defining custom data regions' configurations with various parameters for Apache Ignite
+ * page memory (see {@link DataStorageConfiguration}. For each configured data region Apache Ignite instantiates
+ * respective memory regions with different parameters like maximum size, eviction policy, swapping options,
+ * persistent mode flag, etc.
+ * An Apache Ignite cache can be mapped to a particular region using
+ * {@link CacheConfiguration#setDataRegionName(String)} method.
+ * <p>Sample configuration below shows how to configure several data regions:</p>
+ * <pre>
+ * {@code
+ * <property name="memoryConfiguration">
+ * <bean class="org.apache.ignite.configuration.DataStorageConfiguration">
+ * <property name="defaultRegionConfiguration">
+ * <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
+ * <property name="name" value="Default_Region"/>
+ * <property name="initialSize" value="#{100 * 1024 * 1024}"/>
+ * <property name="maxSize" value="#{5 * 1024 * 102 * 1024}"/>
+ * </bean>
+ * </property>
+ *
+ * <property name="pageSize" value="4096"/>
+ *
+ * <property name="dataRegions">
+ * <list>
+ * <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
+ * <property name="name" value="20MB_Region_Eviction"/>
+ * <property name="initialSize" value="#{20 * 1024 * 1024}"/>
+ * <property name="pageEvictionMode" value="RANDOM_2_LRU"/>
+ * </bean>
+ *
+ * <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
+ * <property name="name" value="25MB_Region_Swapping"/>
+ * <property name="initialSize" value="#{25 * 1024 * 1024}"/>
+ * <property name="initialSize" value="#{100 * 1024 * 1024}"/>
+ * <property name="swapPath" value="db/swap"/>
+ * </bean>
+ * </list>
+ * </property>
+ * }
+ * </pre>
+ */
+public final class DataRegionConfiguration implements Serializable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Default metrics enabled flag. */
+ public static final boolean DFLT_METRICS_ENABLED = false;
+
+ /** Default amount of sub intervals to calculate {@link DataRegionMetrics#getAllocationRate()} metric. */
+ public static final int DFLT_SUB_INTERVALS = 5;
+
+ /** Default length of interval over which {@link DataRegionMetrics#getAllocationRate()} metric is calculated. */
+ public static final int DFLT_RATE_TIME_INTERVAL_MILLIS = 60_000;
+
+ /** Data region name. */
+ private String name = DFLT_DATA_REG_DEFAULT_NAME;
+
+ /** Data region maximum size in memory. */
+ private long maxSize = DataStorageConfiguration.DFLT_DATA_REGION_MAX_SIZE;
+
+ /** Data region start size. */
+ private long initSize = Math.min(
+ DataStorageConfiguration.DFLT_DATA_REGION_MAX_SIZE, DataStorageConfiguration.DFLT_DATA_REGION_INITIAL_SIZE);
+
+ /** An optional path to a memory mapped files directory for this data region. */
+ private String swapPath;
+
+ /** An algorithm for memory pages eviction. */
+ private DataPageEvictionMode pageEvictionMode = DataPageEvictionMode.DISABLED;
+
+ /**
+ * A threshold for memory pages eviction initiation. For instance, if the threshold is 0.9 it means that the page
+ * memory will start the eviction only after 90% data region is occupied.
+ */
+ private double evictionThreshold = 0.9;
+
+ /** Minimum number of empty pages in reuse lists. */
+ private int emptyPagesPoolSize = 100;
+
+ /**
+ * Flag to enable the memory metrics collection for this data region.
+ */
+ private boolean metricsEnabled = DFLT_METRICS_ENABLED;
+
+ /** Number of sub-intervals the whole {@link #setMetricsRateTimeInterval(long)} will be split into to calculate
+ * {@link DataRegionMetrics#getAllocationRate()} and {@link DataRegionMetrics#getEvictionRate()} rates (5 by default).
+ * <p>
+ * Setting it to a bigger value will result in more precise calculation and smaller drops of
+ * {@link DataRegionMetrics#getAllocationRate()} metric when next sub-interval has to be recycled but introduces bigger
+ * calculation overhead. */
+ private int metricsSubIntervalCount = DFLT_SUB_INTERVALS;
+
+ /**
+ * Time interval (in milliseconds) for {@link DataRegionMetrics#getAllocationRate()}
+ * and {@link DataRegionMetrics#getEvictionRate()} monitoring purposes.
+ * <p>
+ * For instance, after setting the interval to 60_000 milliseconds, subsequent calls to {@link DataRegionMetrics#getAllocationRate()}
+ * will return average allocation rate (pages per second) for the last minute.
+ */
+ private long metricsRateTimeInterval = DFLT_RATE_TIME_INTERVAL_MILLIS;
+
+ /**
+ * Flag to enable Ignite Native Persistence.
+ */
+ private boolean persistenceEnabled = false;
+
+ /**
+ * Gets data region name.
+ *
+ * @return Data region name.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets data region name. The name must be non empty and must not be equal to the reserved 'sysMemPlc' one.
+ *
+ * If not specified, {@link DataStorageConfiguration#DFLT_DATA_REG_DEFAULT_NAME} value is used.
+ *
+ * @param name Data region name.
+ * @return {@code this} for chaining.
+ */
+ public DataRegionConfiguration setName(String name) {
+ this.name = name;
+
+ return this;
+ }
+
+ /**
+ * Maximum memory region size defined by this data region. If the whole data can not fit into the memory region
+ * an out of memory exception will be thrown.
+ *
+ * @return Size in bytes.
+ */
+ public long getMaxSize() {
+ return maxSize;
+ }
+
+ /**
+ * Sets maximum memory region size defined by this data region. The total size should not be less than 10 MB
+ * due to the internal data structures overhead.
+ *
+ * @param maxSize Maximum data region size in bytes.
+ * @return {@code this} for chaining.
+ */
+ public DataRegionConfiguration setMaxSize(long maxSize) {
+ this.maxSize = maxSize;
+
+ return this;
+ }
+
+ /**
+ * Gets initial memory region size defined by this data region. When the used memory size exceeds this value,
+ * new chunks of memory will be allocated.
+ *
+ * @return Data region start size.
+ */
+ public long getInitialSize() {
+ return initSize;
+ }
+
+ /**
+ * Sets initial memory region size defined by this data region. When the used memory size exceeds this value,
+ * new chunks of memory will be allocated.
+ *
+ * @param initSize Data region initial size.
+ * @return {@code this} for chaining.
+ */
+ public DataRegionConfiguration setInitialSize(long initSize) {
+ this.initSize = initSize;
+
+ return this;
+ }
+
+ /**
+ * A path to the memory-mapped files the memory region defined by this data region will be mapped to. Having
+ * the path set, allows relying on swapping capabilities of an underlying operating system for the memory region.
+ *
+ * @return A path to the memory-mapped files or {@code null} if this feature is not used for the memory region
+ * defined by this data region.
+ */
+ public String getSwapPath() {
+ return swapPath;
+ }
+
+ /**
+ * Sets a path to the memory-mapped files.
+ *
+ * @param swapFilePath A Path to the memory mapped file.
+ * @return {@code this} for chaining.
+ */
+ public DataRegionConfiguration setSwapPath(String swapFilePath) {
+ this.swapPath = swapFilePath;
+
+ return this;
+ }
+
+ /**
+ * Gets memory pages eviction mode. If {@link DataPageEvictionMode#DISABLED} is used (default) then an out of
+ * memory exception will be thrown if the memory region usage, defined by this data region, goes beyond its
+ * capacity which is {@link #getMaxSize()}.
+ *
+ * @return Memory pages eviction algorithm. {@link DataPageEvictionMode#DISABLED} used by default.
+ */
+ public DataPageEvictionMode getPageEvictionMode() {
+ return pageEvictionMode;
+ }
+
+ /**
+ * Sets memory pages eviction mode.
+ *
+ * @param evictionMode Eviction mode.
+ * @return {@code this} for chaining.
+ */
+ public DataRegionConfiguration setPageEvictionMode(DataPageEvictionMode evictionMode) {
+ pageEvictionMode = evictionMode;
+
+ return this;
+ }
+
+ /**
+ * Gets a threshold for memory pages eviction initiation. For instance, if the threshold is 0.9 it means that the
+ * page memory will start the eviction only after 90% of the data region is occupied.
+ *
+ * @return Memory pages eviction threshold.
+ */
+ public double getEvictionThreshold() {
+ return evictionThreshold;
+ }
+
+ /**
+ * Sets memory pages eviction threshold.
+ *
+ * @param evictionThreshold Eviction threshold.
+ * @return {@code this} for chaining.
+ */
+ public DataRegionConfiguration setEvictionThreshold(double evictionThreshold) {
+ this.evictionThreshold = evictionThreshold;
+
+ return this;
+ }
+
+ /**
+ * Specifies the minimal number of empty pages to be present in reuse lists for this data region.
+ * This parameter ensures that Ignite will be able to successfully evict old data entries when the size of
+ * (key, value) pair is slightly larger than page size / 2.
+ * Increase this parameter if cache can contain very big entries (total size of pages in this pool should be enough
+ * to contain largest cache entry).
+ * Increase this parameter if {@link IgniteOutOfMemoryException} occurred with enabled page eviction.
+ *
+ * @return Minimum number of empty pages in reuse list.
+ */
+ public int getEmptyPagesPoolSize() {
+ return emptyPagesPoolSize;
+ }
+
+ /**
+ * Specifies the minimal number of empty pages to be present in reuse lists for this data region.
+ * This parameter ensures that Ignite will be able to successfully evict old data entries when the size of
+ * (key, value) pair is slightly larger than page size / 2.
+ * Increase this parameter if cache can contain very big entries (total size of pages in this pool should be enough
+ * to contain largest cache entry).
+ * Increase this parameter if {@link IgniteOutOfMemoryException} occurred with enabled page eviction.
+ *
+ * @param emptyPagesPoolSize Empty pages pool size.
+ * @return {@code this} for chaining.
+ */
+ public DataRegionConfiguration setEmptyPagesPoolSize(int emptyPagesPoolSize) {
+ this.emptyPagesPoolSize = emptyPagesPoolSize;
+
+ return this;
+ }
+
+ /**
+ * Gets whether memory metrics are enabled by default on node startup. Memory metrics can be enabled and disabled
+ * at runtime via memory metrics {@link DataRegionMetricsMXBean MX bean}.
+ *
+ * @return Metrics enabled flag.
+ */
+ public boolean isMetricsEnabled() {
+ return metricsEnabled;
+ }
+
+ /**
+ * Sets memory metrics enabled flag. If this flag is {@code true}, metrics will be enabled on node startup.
+ * Memory metrics can be enabled and disabled at runtime via memory metrics {@link DataRegionMetricsMXBean MX bean}.
+ *
+ * @param metricsEnabled Metrics enabled flag.
+ * @return {@code this} for chaining.
+ */
+ public DataRegionConfiguration setMetricsEnabled(boolean metricsEnabled) {
+ this.metricsEnabled = metricsEnabled;
+
+ return this;
+ }
+
+ /**
+ * Gets whether persistence is enabled for this data region. All caches residing in this region will be persistent.
+ *
+ * @return Persistence enabled flag.
+ */
+ public boolean isPersistenceEnabled() {
+ return persistenceEnabled;
+ }
+
+ /**
+ * Sets persistence enabled flag.
+ *
+ * @param persistenceEnabled Persistence enabled flag.
+ * @return {@code this} for chaining.
+ */
+ public DataRegionConfiguration setPersistenceEnabled(boolean persistenceEnabled) {
+ this.persistenceEnabled = persistenceEnabled;
+
+ return this;
+ }
+
+ /**
+ * Gets time interval for {@link DataRegionMetrics#getAllocationRate()}
+ * and {@link DataRegionMetrics#getEvictionRate()} monitoring purposes.
+ * <p>
+ * For instance, after setting the interval to 60_000 milliseconds,
+ * subsequent calls to {@link DataRegionMetrics#getAllocationRate()}
+ * will return average allocation rate (pages per second) for the last minute.
+ *
+ * @return Time interval over which allocation rate is calculated.
+ */
+ public long getMetricsRateTimeInterval() {
+ return metricsRateTimeInterval;
+ }
+
+ /**
+ * Sets time interval for {@link DataRegionMetrics#getAllocationRate()}
+ * and {@link DataRegionMetrics#getEvictionRate()} monitoring purposes.
+ * <p>
+ * For instance, after setting the interval to 60 seconds,
+ * subsequent calls to {@link DataRegionMetrics#getAllocationRate()}
+ * will return average allocation rate (pages per second) for the last minute.
+ *
+ * @param metricsRateTimeInterval Time interval used for allocation and eviction rates calculations.
+ * @return {@code this} for chaining.
+ */
+ public DataRegionConfiguration setMetricsRateTimeInterval(long metricsRateTimeInterval) {
+ this.metricsRateTimeInterval = metricsRateTimeInterval;
+
+ return this;
+ }
+
+ /**
+ * Gets a number of sub-intervals the whole {@link #setMetricsRateTimeInterval(long)}
+ * will be split into to calculate {@link DataRegionMetrics#getAllocationRate()}
+ * and {@link DataRegionMetrics#getEvictionRate()} rates (5 by default).
+ * <p>
+ * Setting it to a bigger value will result in more precise calculation and smaller drops of
+ * {@link DataRegionMetrics#getAllocationRate()} metric when next sub-interval has to be recycled but introduces bigger
+ * calculation overhead.
+ *
+ * @return number of sub intervals.
+ */
+ public int getMetricsSubIntervalCount() {
+ return metricsSubIntervalCount;
+ }
+
+ /**
+ * Sets a number of sub-intervals the whole {@link #setMetricsRateTimeInterval(long)} will be split into to calculate
+ * {@link DataRegionMetrics#getAllocationRate()} and {@link DataRegionMetrics#getEvictionRate()} rates (5 by default).
+ * <p>
+ * Setting it to a bigger value will result in more precise calculation and smaller drops of
+ * {@link DataRegionMetrics#getAllocationRate()} metric when next sub-interval has to be recycled but introduces bigger
+ * calculation overhead.
+ *
+ * @param metricsSubIntervalCnt A number of sub-intervals.
+ * @return {@code this} for chaining.
+ */
+ public DataRegionConfiguration setMetricsSubIntervalCount(int metricsSubIntervalCnt) {
+ this.metricsSubIntervalCount = metricsSubIntervalCnt;
+
+ return this;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/configuration/DataStorageConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/DataStorageConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/DataStorageConfiguration.java
new file mode 100644
index 0000000..bd314ab
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/DataStorageConfiguration.java
@@ -0,0 +1,882 @@
+/*
+ * 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.IgniteSystemProperties;
+import org.apache.ignite.internal.processors.cache.persistence.file.AsyncFileIOFactory;
+import org.apache.ignite.internal.processors.cache.persistence.file.FileIOFactory;
+import org.apache.ignite.internal.processors.cache.persistence.file.RandomAccessFileIOFactory;
+import org.apache.ignite.internal.util.typedef.internal.A;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+/**
+ * A durable memory configuration for an Apache Ignite node. The durable memory is a manageable off-heap based memory
+ * architecture that divides all expandable data regions into pages of fixed size
+ * (see {@link DataStorageConfiguration#getPageSize()}). An individual page can store one or many cache key-value entries
+ * that allows reusing the memory in the most efficient way and avoid memory fragmentation issues.
+ * <p>
+ * By default, the durable memory allocates a single expandable data region with default settings. All the caches that
+ * will be configured in an application will be mapped to this data region by default, thus, all the cache data will
+ * reside in that data region. Parameters of default data region can be changed by setting
+ * {@link DataStorageConfiguration#setDefaultDataRegionConfiguration(DataRegionConfiguration)}.
+ * Other data regions (except default) can be configured with
+ * {@link DataStorageConfiguration#setDataRegionConfigurations(DataRegionConfiguration...)}.
+ * <p>
+ * Data region can be used in memory-only mode, or in persistent mode, when memory is used as a caching layer for disk.
+ * Persistence for data region can be turned on with {@link DataRegionConfiguration#setPersistenceEnabled(boolean)}
+ * flag. To learn more about data regions refer to {@link DataRegionConfiguration} documentation.
+ * <p>Sample configuration below shows how to make 5 GB data regions the default one for Apache Ignite:</p>
+ * <pre>
+ * {@code
+ *
+ * <property name="dataStorageConfiguration">
+ * <bean class="org.apache.ignite.configuration.DataStorageConfiguration">
+ * <property name="systemCacheInitialSize" value="#{100 * 1024 * 1024}"/>
+ *
+ * <property name="defaultDataRegionConfiguration">
+ * <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
+ * <property name="name" value="default_data_region"/>
+ * <property name="initialSize" value="#{5 * 1024 * 1024 * 1024}"/>
+ * </bean>
+ * </property>
+ * </bean>
+ * </property>
+ * }
+ * </pre>
+ */
+public class DataStorageConfiguration implements Serializable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Default data region start size (256 MB). */
+ @SuppressWarnings("UnnecessaryBoxing")
+ public static final long DFLT_DATA_REGION_INITIAL_SIZE = 256L * 1024 * 1024;
+
+ /** Fraction of available memory to allocate for default DataRegion. */
+ private static final double DFLT_DATA_REGION_FRACTION = 0.2;
+
+ /** Default data region's size is 20% of physical memory available on current machine. */
+ public static final long DFLT_DATA_REGION_MAX_SIZE = Math.max(
+ (long)(DFLT_DATA_REGION_FRACTION * U.getTotalMemoryAvailable()),
+ DFLT_DATA_REGION_INITIAL_SIZE);
+
+ /** Default initial size of a memory chunk for the system cache (40 MB). */
+ private static final long DFLT_SYS_CACHE_INIT_SIZE = 40 * 1024 * 1024;
+
+ /** Default max size of a memory chunk for the system cache (100 MB). */
+ private static final long DFLT_SYS_CACHE_MAX_SIZE = 100 * 1024 * 1024;
+
+ /** Default memory page size. */
+ public static final int DFLT_PAGE_SIZE = 4 * 1024;
+
+ /** This name is assigned to default Dataregion if no user-defined default MemPlc is specified */
+ public static final String DFLT_DATA_REG_DEFAULT_NAME = "default";
+
+ /** */
+ public static final int DFLT_CHECKPOINT_FREQ = 180000;
+
+ /** Lock default wait time, 10 sec. */
+ public static final int DFLT_LOCK_WAIT_TIME = 10 * 1000;
+
+ /** */
+ public static final boolean DFLT_METRICS_ENABLED = false;
+
+ /** Default amount of sub intervals to calculate rate-based metric. */
+ public static final int DFLT_SUB_INTERVALS = 5;
+
+ /** Default length of interval over which rate-based metric is calculated. */
+ public static final int DFLT_RATE_TIME_INTERVAL_MILLIS = 60_000;
+
+ /** Default number of checkpoint threads. */
+ public static final int DFLT_CHECKPOINT_THREADS = 4;
+
+ /** Default checkpoint write order. */
+ public static final CheckpointWriteOrder DFLT_CHECKPOINT_WRITE_ORDER = CheckpointWriteOrder.SEQUENTIAL;
+
+ /** Default number of checkpoints to be kept in WAL after checkpoint is finished */
+ public static final int DFLT_WAL_HISTORY_SIZE = 20;
+
+ /** */
+ public static final int DFLT_WAL_SEGMENTS = 10;
+
+ /** Default WAL file segment size, 64MBytes */
+ public static final int DFLT_WAL_SEGMENT_SIZE = 64 * 1024 * 1024;
+
+ /** Default wal mode. */
+ public static final WALMode DFLT_WAL_MODE = WALMode.DEFAULT;
+
+ /** Default thread local buffer size. */
+ public static final int DFLT_TLB_SIZE = 128 * 1024;
+
+ /** Default Wal flush frequency. */
+ public static final int DFLT_WAL_FLUSH_FREQ = 2000;
+
+ /** Default wal fsync delay. */
+ public static final int DFLT_WAL_FSYNC_DELAY = 1000;
+
+ /** Default wal record iterator buffer size. */
+ public static final int DFLT_WAL_RECORD_ITERATOR_BUFFER_SIZE = 64 * 1024 * 1024;
+
+ /** Default wal always write full pages. */
+ public static final boolean DFLT_WAL_ALWAYS_WRITE_FULL_PAGES = false;
+
+ /** Default wal directory. */
+ public static final String DFLT_WAL_PATH = "db/wal";
+
+ /** Default wal archive directory. */
+ public static final String DFLT_WAL_ARCHIVE_PATH = "db/wal/archive";
+
+ /** Default write throttling enabled. */
+ public static final boolean DFLT_WRITE_THROTTLING_ENABLED = false;
+
+ /** Size of a memory chunk reserved for system cache initially. */
+ private long sysRegionInitSize = DFLT_SYS_CACHE_INIT_SIZE;
+
+ /** Maximum size of system cache. */
+ private long sysCacheMaxSize = DFLT_SYS_CACHE_MAX_SIZE;
+
+ /** Memory page size. */
+ private int pageSize;
+
+ /** Concurrency level. */
+ private int concLvl;
+
+ /** Configuration of default data region. */
+ private DataRegionConfiguration dfltDataRegConf = new DataRegionConfiguration();
+
+ /** Data regions. */
+ private DataRegionConfiguration[] dataRegions;
+
+ /** Directory where index and partition files are stored. */
+ private String storagePath;
+
+ /** Checkpoint frequency. */
+ private long checkpointFreq = DFLT_CHECKPOINT_FREQ;
+
+ /** Lock wait time, in milliseconds. */
+ private long lockWaitTime = DFLT_LOCK_WAIT_TIME;
+
+ /** */
+ private long checkpointPageBufSize;
+
+ /** */
+ private int checkpointThreads = DFLT_CHECKPOINT_THREADS;
+
+ /** Checkpoint write order. */
+ private CheckpointWriteOrder checkpointWriteOrder = DFLT_CHECKPOINT_WRITE_ORDER;
+
+ /** Number of checkpoints to keep */
+ private int walHistSize = DFLT_WAL_HISTORY_SIZE;
+
+ /** Number of work WAL segments. */
+ private int walSegments = DFLT_WAL_SEGMENTS;
+
+ /** Size of one WAL segment in bytes. 64 Mb is used by default. Maximum value is 2Gb */
+ private int walSegmentSize = DFLT_WAL_SEGMENT_SIZE;
+
+ /** Directory where WAL is stored (work directory) */
+ private String walPath = DFLT_WAL_PATH;
+
+ /** WAL archive path. */
+ private String walArchivePath = DFLT_WAL_ARCHIVE_PATH;
+
+ /** Metrics enabled flag. */
+ private boolean metricsEnabled = DFLT_METRICS_ENABLED;
+
+ /** Wal mode. */
+ private WALMode walMode = DFLT_WAL_MODE;
+
+ /** WAl thread local buffer size. */
+ private int walTlbSize = DFLT_TLB_SIZE;
+
+ /** Wal flush frequency in milliseconds. */
+ private long walFlushFreq = DFLT_WAL_FLUSH_FREQ;
+
+ /** Wal fsync delay. */
+ private long walFsyncDelay = DFLT_WAL_FSYNC_DELAY;
+
+ /** Wal record iterator buffer size. */
+ private int walRecordIterBuffSize = DFLT_WAL_RECORD_ITERATOR_BUFFER_SIZE;
+
+ /** Always write full pages. */
+ private boolean alwaysWriteFullPages = DFLT_WAL_ALWAYS_WRITE_FULL_PAGES;
+
+ /** Factory to provide I/O interface for files */
+ private FileIOFactory fileIOFactory =
+ IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_USE_ASYNC_FILE_IO_FACTORY, false) ?
+ new AsyncFileIOFactory() : new RandomAccessFileIOFactory();
+
+ /**
+ * Number of sub-intervals the whole {@link #setMetricsRateTimeInterval(long)} will be split into to calculate
+ * rate-based metrics.
+ * <p>
+ * Setting it to a bigger value will result in more precise calculation and smaller drops of
+ * rate-based metrics when next sub-interval has to be recycled but introduces bigger
+ * calculation overhead.
+ */
+ private int metricsSubIntervalCount = DFLT_SUB_INTERVALS;
+
+ /** Time interval (in milliseconds) for rate-based metrics. */
+ private long metricsRateTimeInterval = DFLT_RATE_TIME_INTERVAL_MILLIS;
+
+ /**
+ * Time interval (in milliseconds) for running auto archiving for incompletely WAL segment
+ */
+ private long walAutoArchiveAfterInactivity = -1;
+
+ /**
+ * If true, threads that generate dirty pages too fast during ongoing checkpoint will be throttled.
+ */
+ private boolean writeThrottlingEnabled = DFLT_WRITE_THROTTLING_ENABLED;
+
+ /**
+ * Initial size of a data region reserved for system cache.
+ *
+ * @return Size in bytes.
+ */
+ public long getSystemRegionInitialSize() {
+ return sysRegionInitSize;
+ }
+
+ /**
+ * Sets initial size of a data region reserved for system cache.
+ *
+ * Default value is {@link #DFLT_SYS_CACHE_INIT_SIZE}
+ *
+ * @param sysRegionInitSize Size in bytes.
+ *
+ * @return {@code this} for chaining.
+ */
+ public DataStorageConfiguration setSystemRegionInitialSize(long sysRegionInitSize) {
+ A.ensure(sysCacheMaxSize > 0, "System region initial size can not be less zero.");
+
+ this.sysRegionInitSize = sysRegionInitSize;
+
+ return this;
+ }
+
+ /**
+ * Maximum data region size reserved for system cache.
+ *
+ * @return Size in bytes.
+ */
+ public long getSystemRegionMaxSize() {
+ return sysCacheMaxSize;
+ }
+
+ /**
+ * 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.
+ *
+ * @param sysCacheMaxSize Maximum size in bytes for system cache data region.
+ *
+ * @return {@code this} for chaining.
+ */
+ public DataStorageConfiguration setSystemRegionMaxSize(long sysCacheMaxSize) {
+ A.ensure(sysCacheMaxSize > 0, "System cache max size can not be less zero.");
+
+ this.sysCacheMaxSize = sysCacheMaxSize;
+
+ return this;
+ }
+
+ /**
+ * The page memory consists of one or more expandable data regions defined by {@link DataRegionConfiguration}.
+ * Every data region is split on pages of fixed size that store actual cache entries.
+ *
+ * @return Page size in bytes.
+ */
+ public int getPageSize() {
+ return pageSize;
+ }
+
+ /**
+ * Changes the page size.
+ *
+ * @param pageSize Page size in bytes. If value is not set (or zero), {@link #DFLT_PAGE_SIZE} will be used.
+ */
+ public DataStorageConfiguration setPageSize(int pageSize) {
+ if (pageSize != 0) {
+ A.ensure(pageSize >= 1024 && pageSize <= 16 * 1024, "Page size must be between 1kB and 16kB.");
+ A.ensure(U.isPow2(pageSize), "Page size must be a power of 2.");
+ }
+
+ this.pageSize = pageSize;
+
+ return this;
+ }
+
+ /**
+ * Gets an array of all data regions configured. Apache Ignite will instantiate a dedicated data region per
+ * region. An Apache Ignite cache can be mapped to a specific region with
+ * {@link CacheConfiguration#setDataRegionName(String)} method.
+ *
+ * @return Array of configured data regions.
+ */
+ public DataRegionConfiguration[] getDataRegionConfigurations() {
+ return dataRegions;
+ }
+
+ /**
+ * Sets data regions configurations.
+ *
+ * @param dataRegionConfigurations Data regions configurations.
+ */
+ public DataStorageConfiguration setDataRegionConfigurations(DataRegionConfiguration... dataRegionConfigurations) {
+ this.dataRegions = dataRegionConfigurations;
+
+ return this;
+ }
+
+ /**
+ * Returns the number of concurrent segments in Ignite internal page mapping tables. By default equals
+ * to the number of available CPUs.
+ *
+ * @return Mapping table concurrency level.
+ */
+ public int getConcurrencyLevel() {
+ return concLvl;
+ }
+
+ /**
+ * Sets the number of concurrent segments in Ignite internal page mapping tables.
+ *
+ * @param concLvl Mapping table concurrency level.
+ */
+ public DataStorageConfiguration setConcurrencyLevel(int concLvl) {
+ this.concLvl = concLvl;
+
+ return this;
+ }
+
+ /**
+ * @return Configuration of default data region. All cache groups will reside in this data region by default.
+ * For assigning a custom data region to cache group, use {@link CacheConfiguration#setDataRegionName(String)}.
+ */
+ public DataRegionConfiguration getDefaultDataRegionConfiguration() {
+ return dfltDataRegConf;
+ }
+
+ /**
+ * Overrides configuration of default data region which is created automatically.
+ * @param dfltDataRegConf Default data region configuration.
+ */
+ public DataStorageConfiguration setDefaultDataRegionConfiguration(DataRegionConfiguration dfltDataRegConf) {
+ this.dfltDataRegConf = dfltDataRegConf;
+
+ return this;
+ }
+
+ /**
+ * Returns a path the root directory where the Persistent Store will persist data and indexes.
+ */
+ public String getStoragePath() {
+ return storagePath;
+ }
+
+ /**
+ * Sets a path to the root directory where the Persistent Store will persist data and indexes.
+ * By default the Persistent Store's files are located under Ignite work directory.
+ *
+ * @param persistenceStorePath Persistence store path.
+ */
+ public DataStorageConfiguration setStoragePath(String persistenceStorePath) {
+ this.storagePath = persistenceStorePath;
+
+ return this;
+ }
+
+ /**
+ * Gets checkpoint frequency.
+ *
+ * @return checkpoint frequency in milliseconds.
+ */
+ public long getCheckpointFrequency() {
+ return checkpointFreq <= 0 ? DFLT_CHECKPOINT_FREQ : checkpointFreq;
+ }
+
+ /**
+ * Sets the checkpoint frequency which is a minimal interval when the dirty pages will be written
+ * to the Persistent Store. If the rate is high, checkpoint will be triggered more frequently.
+ *
+ * @param checkpointFreq checkpoint frequency in milliseconds.
+ * @return {@code this} for chaining.
+ */
+ public DataStorageConfiguration setCheckpointFrequency(long checkpointFreq) {
+ this.checkpointFreq = checkpointFreq;
+
+ return this;
+ }
+
+ /**
+ * Gets amount of memory allocated for a checkpoint temporary buffer.
+ *
+ * @return Checkpoint page buffer size in bytes or {@code 0} for Ignite
+ * to choose the buffer size automatically.
+ */
+ public long getCheckpointPageBufferSize() {
+ return checkpointPageBufSize;
+ }
+
+ /**
+ * Sets amount of memory allocated for the checkpoint temporary buffer. The buffer is used to create temporary
+ * copies of pages that are being written to disk and being update in parallel while the checkpoint is in
+ * progress.
+ *
+ * @param checkpointPageBufSize Checkpoint page buffer size in bytes or {@code 0} for Ignite to
+ * choose the buffer size automatically.
+ * @return {@code this} for chaining.
+ */
+ public DataStorageConfiguration setCheckpointPageBufferSize(long checkpointPageBufSize) {
+ this.checkpointPageBufSize = checkpointPageBufSize;
+
+ return this;
+ }
+
+
+ /**
+ * Gets a number of threads to use for the checkpoint purposes.
+ *
+ * @return Number of checkpoint threads.
+ */
+ public int getCheckpointThreads() {
+ return checkpointThreads;
+ }
+
+ /**
+ * Sets a number of threads to use for the checkpoint purposes.
+ *
+ * @param checkpointThreads Number of checkpoint threads. Four threads are used by default.
+ * @return {@code this} for chaining.
+ */
+ public DataStorageConfiguration setCheckpointThreads(int checkpointThreads) {
+ this.checkpointThreads = checkpointThreads;
+
+ return this;
+ }
+
+ /**
+ * Timeout in milliseconds to wait when acquiring persistence store lock file before failing the local node.
+ *
+ * @return Lock wait time in milliseconds.
+ */
+ public long getLockWaitTime() {
+ return lockWaitTime;
+ }
+
+ /**
+ * Timeout in milliseconds to wait when acquiring persistence store lock file before failing the local node.
+ *
+ * @param lockWaitTime Lock wait time in milliseconds.
+ * @return {@code this} for chaining.
+ */
+ public DataStorageConfiguration setLockWaitTime(long lockWaitTime) {
+ this.lockWaitTime = lockWaitTime;
+
+ return this;
+ }
+
+ /**
+ * Gets a total number of checkpoints to keep in the WAL history.
+ *
+ * @return Number of checkpoints to keep in WAL after a checkpoint is finished.
+ */
+ public int getWalHistorySize() {
+ return walHistSize <= 0 ? DFLT_WAL_HISTORY_SIZE : walHistSize;
+ }
+
+ /**
+ * Sets a total number of checkpoints to keep in the WAL history.
+ *
+ * @param walHistSize Number of checkpoints to keep after a checkpoint is finished.
+ * @return {@code this} for chaining.
+ */
+ public DataStorageConfiguration setWalHistorySize(int walHistSize) {
+ this.walHistSize = walHistSize;
+
+ return this;
+ }
+
+ /**
+ * Gets a number of WAL segments to work with.
+ *
+ * @return Number of work WAL segments.
+ */
+ public int getWalSegments() {
+ return walSegments <= 0 ? DFLT_WAL_SEGMENTS : walSegments;
+ }
+
+ /**
+ * Sets a number of WAL segments to work with. For performance reasons,
+ * the whole WAL is split into files of fixed length called segments.
+ *
+ * @param walSegments Number of WAL segments.
+ * @return {@code this} for chaining.
+ */
+ public DataStorageConfiguration setWalSegments(int walSegments) {
+ this.walSegments = walSegments;
+
+ return this;
+ }
+
+ /**
+ * Gets size of a WAL segment in bytes.
+ *
+ * @return WAL segment size.
+ */
+ public int getWalSegmentSize() {
+ return walSegmentSize <= 0 ? DFLT_WAL_SEGMENT_SIZE : walSegmentSize;
+ }
+
+ /**
+ * Sets size of a WAL segment.
+ *
+ * @param walSegmentSize WAL segment size. 64 MB is used by default. Maximum value is 2Gb
+ * @return {@code this} for chaining.
+ */
+ public DataStorageConfiguration setWalSegmentSize(int walSegmentSize) {
+ this.walSegmentSize = walSegmentSize;
+
+ return this;
+ }
+
+ /**
+ * Gets a path to the directory where WAL is stored.
+ *
+ * @return WAL persistence path, absolute or relative to Ignite work directory.
+ */
+ public String getWalPath() {
+ return walPath;
+ }
+
+ /**
+ * Sets a path to the directory where WAL is stored. If this path is relative, it will be resolved
+ * relatively to Ignite work directory.
+ *
+ * @param walStorePath WAL persistence path, absolute or relative to Ignite work directory.
+ * @return {@code this} for chaining.
+ */
+ public DataStorageConfiguration setWalPath(String walStorePath) {
+ this.walPath = walStorePath;
+
+ return this;
+ }
+
+ /**
+ * Gets a path to the WAL archive directory.
+ *
+ * @return WAL archive directory.
+ */
+ public String getWalArchivePath() {
+ return walArchivePath;
+ }
+
+ /**
+ * Sets a path for the WAL archive directory. Every WAL segment will be fully copied to this directory before
+ * it can be reused for WAL purposes.
+ *
+ * @param walArchivePath WAL archive directory.
+ * @return {@code this} for chaining.
+ */
+ public DataStorageConfiguration setWalArchivePath(String walArchivePath) {
+ this.walArchivePath = walArchivePath;
+
+ return this;
+ }
+
+ /**
+ * Gets flag indicating whether persistence metrics collection is enabled.
+ * Default value is {@link #DFLT_METRICS_ENABLED}.
+ *
+ * @return Metrics enabled flag.
+ */
+ public boolean isMetricsEnabled() {
+ return metricsEnabled;
+ }
+
+ /**
+ * Sets flag indicating whether persistence metrics collection is enabled.
+ *
+ * @param metricsEnabled Metrics enabled flag.
+ */
+ public DataStorageConfiguration setMetricsEnabled(boolean metricsEnabled) {
+ this.metricsEnabled = metricsEnabled;
+
+ return this;
+ }
+
+ /**
+ * Gets flag indicating whether write throttling is enabled.
+ */
+ public boolean isWriteThrottlingEnabled() {
+ return writeThrottlingEnabled;
+ }
+
+ /**
+ * Sets flag indicating whether write throttling is enabled.
+ *
+ * @param writeThrottlingEnabled Write throttling enabled flag.
+ */
+ public DataStorageConfiguration setWriteThrottlingEnabled(boolean writeThrottlingEnabled) {
+ this.writeThrottlingEnabled = writeThrottlingEnabled;
+
+ return this;
+ }
+
+ /**
+ * Gets the length of the time interval for rate-based metrics. This interval defines a window over which
+ * hits will be tracked. Default value is {@link #DFLT_RATE_TIME_INTERVAL_MILLIS}.
+ *
+ * @return Time interval in milliseconds.
+ */
+ public long getMetricsRateTimeInterval() {
+ return metricsRateTimeInterval;
+ }
+
+ /**
+ * Sets the length of the time interval for rate-based metrics. This interval defines a window over which
+ * hits will be tracked.
+ *
+ * @param metricsRateTimeInterval Time interval in milliseconds.
+ */
+ public DataStorageConfiguration setMetricsRateTimeInterval(long metricsRateTimeInterval) {
+ this.metricsRateTimeInterval = metricsRateTimeInterval;
+
+ return this;
+ }
+
+ /**
+ * Gets the number of sub-intervals to split the {@link #getMetricsRateTimeInterval()} into to track the update history.
+ * Default value is {@link #DFLT_SUB_INTERVALS}.
+ *
+ * @return The number of sub-intervals for history tracking.
+ */
+ public int getMetricsSubIntervalCount() {
+ return metricsSubIntervalCount;
+ }
+
+ /**
+ * Sets the number of sub-intervals to split the {@link #getMetricsRateTimeInterval()} into to track the update history.
+ *
+ * @param metricsSubIntervalCnt The number of sub-intervals for history tracking.
+ */
+ public DataStorageConfiguration setMetricsSubIntervalCount(int metricsSubIntervalCnt) {
+ this.metricsSubIntervalCount = metricsSubIntervalCnt;
+
+ return this;
+ }
+
+ /**
+ * Property that defines behavior of wal fsync.
+ * Different type provides different guarantees for consistency. See {@link WALMode} for details.
+ *
+ * @return WAL mode.
+ */
+ public WALMode getWalMode() {
+ return walMode == null ? DFLT_WAL_MODE : walMode;
+ }
+
+ /**
+ * Sets property that defines behavior of wal fsync.
+ * Different type provides different guarantees for consistency. See {@link WALMode} for details.
+ *
+ * @param walMode Wal mode.
+ */
+ public DataStorageConfiguration setWalMode(WALMode walMode) {
+ this.walMode = walMode;
+
+ return this;
+ }
+
+ /**
+ * Property for size of thread local buffer.
+ * Each thread which write to wal have thread local buffer for serialize recode before write in wal.
+ *
+ * @return Thread local buffer size (in bytes).
+ */
+ public int getWalThreadLocalBufferSize() {
+ return walTlbSize <= 0 ? DFLT_TLB_SIZE : walTlbSize;
+ }
+
+ /**
+ * Sets size of thread local buffer.
+ * Each thread which write to wal have thread local buffer for serialize recode before write in wal.
+ *
+ * @param walTlbSize Thread local buffer size (in bytes).
+ */
+ public DataStorageConfiguration setWalThreadLocalBufferSize(int walTlbSize) {
+ this.walTlbSize = walTlbSize;
+
+ return this;
+ }
+
+ /**
+ * This property define how often WAL will be fsync-ed in {@code BACKGROUND} mode. Ignored for
+ * all other WAL modes.
+ *
+ * @return WAL flush frequency, in milliseconds.
+ */
+ public long getWalFlushFrequency() {
+ return walFlushFreq;
+ }
+
+ /**
+ * This property define how often WAL will be fsync-ed in {@code BACKGROUND} mode. Ignored for
+ * all other WAL modes.
+ *
+ * @param walFlushFreq WAL flush frequency, in milliseconds.
+ */
+ public DataStorageConfiguration setWalFlushFrequency(long walFlushFreq) {
+ this.walFlushFreq = walFlushFreq;
+
+ return this;
+ }
+
+ /**
+ * Property that allows to trade latency for throughput in {@link WALMode#DEFAULT} mode.
+ * It limits minimum time interval between WAL fsyncs. First thread that initiates WAL fsync will wait for
+ * this number of nanoseconds, another threads will just wait fsync of first thread (similar to CyclicBarrier).
+ * Total throughput should increase under load as total WAL fsync rate will be limited.
+ */
+ public long getWalFsyncDelayNanos() {
+ return walFsyncDelay <= 0 ? DFLT_WAL_FSYNC_DELAY : walFsyncDelay;
+ }
+
+ /**
+ * Sets property that allows to trade latency for throughput in {@link WALMode#DEFAULT} mode.
+ * It limits minimum time interval between WAL fsyncs. First thread that initiates WAL fsync will wait for
+ * this number of nanoseconds, another threads will just wait fsync of first thread (similar to CyclicBarrier).
+ * Total throughput should increase under load as total WAL fsync rate will be limited.
+ *
+ * @param walFsyncDelayNanos Wal fsync delay, in nanoseconds.
+ */
+ public DataStorageConfiguration setWalFsyncDelayNanos(long walFsyncDelayNanos) {
+ walFsyncDelay = walFsyncDelayNanos;
+
+ return this;
+ }
+
+ /**
+ * Property define how many bytes iterator read from
+ * disk (for one reading), during go ahead wal.
+ *
+ * @return Record iterator buffer size.
+ */
+ public int getWalRecordIteratorBufferSize() {
+ return walRecordIterBuffSize <= 0 ? DFLT_WAL_RECORD_ITERATOR_BUFFER_SIZE : walRecordIterBuffSize;
+ }
+
+ /**
+ * Sets property defining how many bytes iterator read from
+ * disk (for one reading), during go ahead wal.
+ *
+ * @param walRecordIterBuffSize Wal record iterator buffer size.
+ */
+ public DataStorageConfiguration setWalRecordIteratorBufferSize(int walRecordIterBuffSize) {
+ this.walRecordIterBuffSize = walRecordIterBuffSize;
+
+ return this;
+ }
+
+ /**
+ * Gets flag that enforces writing full page to WAL on every change (instead of delta record).
+ * Can be used for debugging purposes: every version of page will be present in WAL.
+ * Note that WAL will take several times more space in this mode.
+ */
+ public boolean isAlwaysWriteFullPages() {
+ return alwaysWriteFullPages;
+ }
+
+ /**
+ * Sets flag that enforces writing full page to WAL on every change (instead of delta record).
+ * Can be used for debugging purposes: every version of page will be present in WAL.
+ * Note that WAL will take several times more space in this mode.
+ *
+ * @param alwaysWriteFullPages Always write full pages flag.
+ */
+ public DataStorageConfiguration setAlwaysWriteFullPages(boolean alwaysWriteFullPages) {
+ this.alwaysWriteFullPages = alwaysWriteFullPages;
+
+ return this;
+ }
+
+ /**
+ * Factory to provide implementation of FileIO interface
+ * which is used for any file read/write operations
+ *
+ * @return File I/O factory
+ */
+ public FileIOFactory getFileIOFactory() {
+ return fileIOFactory;
+ }
+
+ /**
+ * Sets factory to provide implementation of FileIO interface
+ * which is used for any file read/write operations
+ *
+ * @param fileIOFactory File I/O factory
+ */
+ public DataStorageConfiguration setFileIOFactory(FileIOFactory fileIOFactory) {
+ this.fileIOFactory = fileIOFactory;
+
+ return this;
+ }
+
+ /**
+ * <b>Note:</b> setting this value with {@link WALMode#DEFAULT} may generate file size overhead for WAL segments in case
+ * grid is used rarely.
+ *
+ * @param walAutoArchiveAfterInactivity time in millis to run auto archiving segment (even if incomplete) after last
+ * record logging. <br> Positive value enables incomplete segment archiving after timeout (inactivity). <br> Zero or
+ * negative value disables auto archiving.
+ * @return current configuration instance for chaining
+ */
+ public DataStorageConfiguration setWalAutoArchiveAfterInactivity(long walAutoArchiveAfterInactivity) {
+ this.walAutoArchiveAfterInactivity = walAutoArchiveAfterInactivity;
+
+ return this;
+ }
+
+ /**
+ * @return time in millis to run auto archiving WAL segment (even if incomplete) after last record log
+ */
+ public long getWalAutoArchiveAfterInactivity() {
+ return walAutoArchiveAfterInactivity;
+ }
+
+ /**
+ * This property defines order of writing pages to disk storage during checkpoint.
+ *
+ * @return Checkpoint write order.
+ */
+ public CheckpointWriteOrder getCheckpointWriteOrder() {
+ return checkpointWriteOrder;
+ }
+
+ /**
+ * This property defines order of writing pages to disk storage during checkpoint.
+ *
+ * @param checkpointWriteOrder Checkpoint write order.
+ */
+ public DataStorageConfiguration setCheckpointWriteOrder(CheckpointWriteOrder checkpointWriteOrder) {
+ this.checkpointWriteOrder = checkpointWriteOrder;
+
+ return this;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
index a79d436..fc1fb6b 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
@@ -457,11 +457,16 @@ public class IgniteConfiguration {
private ExecutorConfiguration[] execCfgs;
/** Page memory configuration. */
+ @Deprecated
private MemoryConfiguration memCfg;
/** Persistence store configuration. */
+ @Deprecated
private PersistentStoreConfiguration pstCfg;
+ /** Page memory configuration. */
+ private DataStorageConfiguration dsCfg;
+
/** Active on start flag. */
private boolean activeOnStart = DFLT_ACTIVE_ON_START;
@@ -510,6 +515,7 @@ public class IgniteConfiguration {
allResolversPassReq = cfg.isAllSegmentationResolversPassRequired();
atomicCfg = cfg.getAtomicConfiguration();
binaryCfg = cfg.getBinaryConfiguration();
+ dsCfg = cfg.getDataStorageConfiguration();
memCfg = cfg.getMemoryConfiguration();
pstCfg = cfg.getPersistentStoreConfiguration();
cacheCfg = cfg.getCacheConfiguration();
@@ -2157,6 +2163,29 @@ public class IgniteConfiguration {
*
* @return Memory configuration.
*/
+ public DataStorageConfiguration getDataStorageConfiguration() {
+ return dsCfg;
+ }
+
+ /**
+ * Sets durable memory configuration.
+ *
+ * @param dsCfg Data storage configuration.
+ * @return {@code this} for chaining.
+ */
+ public IgniteConfiguration setDataStorageConfiguration(DataStorageConfiguration dsCfg) {
+ this.dsCfg = dsCfg;
+
+ return this;
+ }
+
+ /**
+ * Gets page memory configuration.
+ *
+ * @return Memory configuration.
+ * @deprecated Use {@link DataStorageConfiguration} instead.
+ */
+ @Deprecated
public MemoryConfiguration getMemoryConfiguration() {
return memCfg;
}
@@ -2166,7 +2195,9 @@ public class IgniteConfiguration {
*
* @param memCfg Memory configuration.
* @return {@code this} for chaining.
+ * @deprecated Use {@link DataStorageConfiguration} instead.
*/
+ @Deprecated
public IgniteConfiguration setMemoryConfiguration(MemoryConfiguration memCfg) {
this.memCfg = memCfg;
@@ -2177,14 +2208,20 @@ public class IgniteConfiguration {
* Gets persistence configuration used by Apache Ignite Persistent Store.
*
* @return Persistence configuration.
+ *
+ * @deprecated Part of old API. Use {@link DataStorageConfiguration} for configuring persistence instead.
*/
+ @Deprecated
public PersistentStoreConfiguration getPersistentStoreConfiguration() {
return pstCfg;
}
/**
- * @return Flag {@code true} if persistent enable, {@code false} if disable.
+ * @return Flag {@code true} if persistence is enabled, {@code false} if disabled.
+ *
+ * @deprecated Part of legacy configuration API. Doesn't work if new configuration API is used.
*/
+ @Deprecated
public boolean isPersistentStoreEnabled() {
return pstCfg != null;
}
@@ -2194,7 +2231,10 @@ public class IgniteConfiguration {
*
* @param pstCfg Persistence configuration.
* @return {@code this} for chaining.
+ *
+ * @deprecated Part of old API. Use {@link DataStorageConfiguration} for configuring persistence instead.
*/
+ @Deprecated
public IgniteConfiguration setPersistentStoreConfiguration(PersistentStoreConfiguration pstCfg) {
this.pstCfg = pstCfg;
@@ -2208,7 +2248,7 @@ public class IgniteConfiguration {
* <p>
* Default value is {@link #DFLT_ACTIVE_ON_START}.
* <p>
- * This flag is ignored when {@link PersistentStoreConfiguration} is present:
+ * This flag is ignored when {@link DataStorageConfiguration} is present:
* cluster is always inactive on start when Ignite Persistence is enabled.
*
* @return Active on start flag value.
@@ -2221,7 +2261,7 @@ public class IgniteConfiguration {
* Sets flag indicating whether the cluster will be active on start. This value should be the same on all
* nodes in the cluster.
* <p>
- * This flag is ignored when {@link PersistentStoreConfiguration} is present:
+ * This flag is ignored when {@link DataStorageConfiguration} is present:
* cluster is always inactive on start when Ignite Persistence is enabled.
*
* @param activeOnStart Active on start flag value.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java
index 9ba26c8..c3d4e74 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java
@@ -57,7 +57,10 @@ import org.apache.ignite.internal.util.typedef.internal.U;
* </property>
* }
* </pre>
+ *
+ * @deprecated Use {@link DataStorageConfiguration} instead.
*/
+@Deprecated
public class MemoryConfiguration implements Serializable {
/** */
private static final long serialVersionUID = 0L;
@@ -66,7 +69,7 @@ public class MemoryConfiguration implements Serializable {
@SuppressWarnings("UnnecessaryBoxing")
public static final long DFLT_MEMORY_POLICY_INITIAL_SIZE = 256L * 1024 * 1024;
- /** Fraction of available memory to allocate for default MemoryPolicy. */
+ /** Fraction of available memory to allocate for default DataRegion. */
private static final double DFLT_MEMORY_POLICY_FRACTION = 0.2;
/** Default memory policy's size is 20% of physical memory available on current machine. */
@@ -83,7 +86,7 @@ public class MemoryConfiguration implements Serializable {
/** Default memory page size. */
public static final int DFLT_PAGE_SIZE = 4 * 1024;
- /** This name is assigned to default MemoryPolicy if no user-defined default MemPlc is specified */
+ /** This name is assigned to default DataRegion if no user-defined default MemPlc is specified */
public static final String DFLT_MEM_PLC_DEFAULT_NAME = "default";
/** Size of a memory chunk reserved for system cache initially. */
@@ -101,7 +104,7 @@ public class MemoryConfiguration implements Serializable {
/** A name of the memory policy that defines the default memory region. */
private String dfltMemPlcName = DFLT_MEM_PLC_DEFAULT_NAME;
- /** Size of memory (in bytes) to use for default MemoryPolicy. */
+ /** Size of memory (in bytes) to use for default DataRegion. */
private long dfltMemPlcSize = DFLT_MEMORY_POLICY_MAX_SIZE;
/** Memory policies. */
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/configuration/MemoryPolicyConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/MemoryPolicyConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/MemoryPolicyConfiguration.java
index dff8b2b..efe7ae2 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/MemoryPolicyConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/MemoryPolicyConfiguration.java
@@ -19,7 +19,7 @@ package org.apache.ignite.configuration;
import java.io.Serializable;
import org.apache.ignite.MemoryMetrics;
import org.apache.ignite.internal.mem.IgniteOutOfMemoryException;
-import org.apache.ignite.mxbean.MemoryMetricsMXBean;
+import org.apache.ignite.mxbean.DataRegionMetricsMXBean;
import static org.apache.ignite.configuration.MemoryConfiguration.DFLT_MEM_PLC_DEFAULT_NAME;
@@ -60,7 +60,10 @@ import static org.apache.ignite.configuration.MemoryConfiguration.DFLT_MEM_PLC_D
* </property>
* }
* </pre>
+ *
+ * @deprecated Use {@link DataRegionConfiguration} instead.
*/
+@Deprecated
public final class MemoryPolicyConfiguration implements Serializable {
/** */
private static final long serialVersionUID = 0L;
@@ -121,6 +124,11 @@ public final class MemoryPolicyConfiguration implements Serializable {
private long rateTimeInterval = DFLT_RATE_TIME_INTERVAL_MILLIS;
/**
+ * Flag to enable Ignite Native Persistence.
+ */
+ private boolean persistenceEnabled = true;
+
+ /**
* Gets memory policy name.
*
* @return Memory policy name.
@@ -290,7 +298,7 @@ public final class MemoryPolicyConfiguration implements Serializable {
/**
* Gets whether memory metrics are enabled by default on node startup. Memory metrics can be enabled and disabled
- * at runtime via memory metrics {@link MemoryMetricsMXBean MX bean}.
+ * at runtime via memory metrics {@link DataRegionMetricsMXBean MX bean}.
*
* @return Metrics enabled flag.
*/
@@ -300,7 +308,7 @@ public final class MemoryPolicyConfiguration implements Serializable {
/**
* Sets memory metrics enabled flag. If this flag is {@code true}, metrics will be enabled on node startup.
- * Memory metrics can be enabled and disabled at runtime via memory metrics {@link MemoryMetricsMXBean MX bean}.
+ * Memory metrics can be enabled and disabled at runtime via memory metrics {@link DataRegionMetricsMXBean MX bean}.
*
* @param metricsEnabled Metrics enabled flag.
* @return {@code this} for chaining.
@@ -312,6 +320,24 @@ public final class MemoryPolicyConfiguration implements Serializable {
}
/**
+ * Gets whether Ignite Native Persistence is enabled for this memory policy.
+ *
+ * @return Persistence enabled flag.
+ */
+ public boolean isPersistenceEnabled() {
+ return persistenceEnabled;
+ }
+
+ /**
+ * Sets persistence enabled flag.
+ *
+ * @param persistenceEnabled Persistence enabled flag.
+ */
+ public void setPersistenceEnabled(boolean persistenceEnabled) {
+ this.persistenceEnabled = persistenceEnabled;
+ }
+
+ /**
* Gets time interval for {@link MemoryMetrics#getAllocationRate()}
* and {@link MemoryMetrics#getEvictionRate()} monitoring purposes.
* <p>
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/configuration/PersistentStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/PersistentStoreConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/PersistentStoreConfiguration.java
index c44e92d..c41721a 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/PersistentStoreConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/PersistentStoreConfiguration.java
@@ -25,7 +25,9 @@ import org.apache.ignite.internal.util.typedef.internal.S;
/**
* Configures Apache Ignite Persistent store.
+ * @deprecated Use {@link DataStorageConfiguration} instead.
*/
+@Deprecated
public class PersistentStoreConfiguration implements Serializable {
/** */
private static final long serialVersionUID = 0L;
@@ -144,7 +146,7 @@ public class PersistentStoreConfiguration implements Serializable {
/** Factory to provide I/O interface for files */
private FileIOFactory fileIOFactory =
IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_USE_ASYNC_FILE_IO_FACTORY, false) ?
- new AsyncFileIOFactory() : new RandomAccessFileIOFactory();
+ new AsyncFileIOFactory() : new RandomAccessFileIOFactory();
/**
* Number of sub-intervals the whole {@link #setRateTimeInterval(long)} will be split into to calculate
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/igfs/IgfsMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsMetrics.java b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsMetrics.java
index 7bd27fe..794a262 100644
--- a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsMetrics.java
@@ -17,6 +17,8 @@
package org.apache.ignite.igfs;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+
/**
* {@code IGFS} metrics snapshot for the file system. Note, that some metrics are global and
* some are local (i.e. per each node).
@@ -33,7 +35,7 @@ public interface IgfsMetrics {
/**
* Gets maximum amount of data that can be stored on local node. This metrics is related to
- * to the {@link org.apache.ignite.configuration.MemoryPolicyConfiguration#getMaxSize()} of the IGFS data cache.
+ * to the {@link DataRegionConfiguration#getMaxSize()} of the IGFS data cache.
*
* @return Maximum IGFS local space size.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 759bf64..8a71e1a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -49,6 +49,10 @@ import java.util.concurrent.atomic.AtomicReference;
import javax.cache.CacheException;
import javax.management.JMException;
import javax.management.ObjectName;
+import org.apache.ignite.DataRegionMetrics;
+import org.apache.ignite.DataRegionMetricsAdapter;
+import org.apache.ignite.DataStorageMetrics;
+import org.apache.ignite.DataStorageMetricsAdapter;
import org.apache.ignite.IgniteAtomicLong;
import org.apache.ignite.IgniteAtomicReference;
import org.apache.ignite.IgniteAtomicSequence;
@@ -85,6 +89,7 @@ import org.apache.ignite.configuration.BinaryConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.CollectionConfiguration;
import org.apache.ignite.configuration.ConnectorConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.MemoryConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
@@ -114,7 +119,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheUtilityKey;
import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryPolicy;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegion;
import org.apache.ignite.internal.processors.cache.persistence.filename.PdsConsistentIdProcessor;
import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
import org.apache.ignite.internal.processors.closure.GridClosureProcessor;
@@ -176,6 +181,7 @@ import org.apache.ignite.lifecycle.LifecycleAware;
import org.apache.ignite.lifecycle.LifecycleBean;
import org.apache.ignite.lifecycle.LifecycleEventType;
import org.apache.ignite.marshaller.MarshallerExclusions;
+import org.apache.ignite.marshaller.jdk.JdkMarshaller;
import org.apache.ignite.mxbean.ClusterLocalNodeMetricsMXBean;
import org.apache.ignite.mxbean.IgniteMXBean;
import org.apache.ignite.mxbean.StripedExecutorMXBean;
@@ -214,6 +220,7 @@ import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_BUILD_VER;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_CLIENT_MODE;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_CONSISTENCY_CHECK_SKIPPED;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_DAEMON;
+import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_DATA_STORAGE_CONFIG;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_DATA_STREAMER_POOL_SIZE;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_DEPLOYMENT_MODE;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_IGNITE_INSTANCE_NAME;
@@ -231,10 +238,10 @@ import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER_US
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER_USE_DFLT_SUID;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MEMORY_CONFIG;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_NODE_CONSISTENT_ID;
+import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_OFFHEAP_SIZE;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PEER_CLASSLOADING;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PHY_RAM;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PREFIX;
-import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_OFFHEAP_SIZE;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_RESTART_ENABLED;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_REST_PORT_RANGE;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_SPI_CLASS;
@@ -1245,10 +1252,10 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
int loadedPages = 0;
- Collection<MemoryPolicy> policies = ctx.cache().context().database().memoryPolicies();
+ Collection<DataRegion> policies = ctx.cache().context().database().dataRegions();
if (!F.isEmpty(policies)) {
- for (MemoryPolicy memPlc : policies)
+ for (DataRegion memPlc : policies)
loadedPages += memPlc.pageMemory().loadedPages();
}
@@ -1424,7 +1431,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
if (total > safeToUse) {
U.quietAndWarn(log, "Nodes started on local machine require more than 80% of physical RAM what can " +
- "lead to significant slowdown due to swapping (please decrease JVM heap size, memory policy " +
+ "lead to significant slowdown due to swapping (please decrease JVM heap size, data region " +
"size or checkpoint buffer size) [required=" + (total >> 20) + "MB, available=" +
(ram >> 20) + "MB]");
}
@@ -1604,8 +1611,8 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
if (cfg.getConnectorConfiguration() != null)
add(ATTR_REST_PORT_RANGE, cfg.getConnectorConfiguration().getPortRange());
- // Save database configuration.
- add(ATTR_MEMORY_CONFIG, cfg.getMemoryConfiguration());
+ // Save data storage configuration.
+ addDataStorageConfigurationAttributes();
// Save transactions configuration.
add(ATTR_TX_CONFIG, cfg.getTransactionConfiguration());
@@ -1633,6 +1640,25 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
}
/**
+ *
+ */
+ private void addDataStorageConfigurationAttributes() throws IgniteCheckedException {
+ MemoryConfiguration memCfg = cfg.getMemoryConfiguration();
+
+ // Save legacy memory configuration if it's present.
+ if (memCfg != null) {
+ // Page size initialization is suspended, see IgniteCacheDatabaseSharedManager#checkPageSize.
+ // We should copy initialized value from new configuration.
+ memCfg.setPageSize(cfg.getDataStorageConfiguration().getPageSize());
+
+ add(ATTR_MEMORY_CONFIG, memCfg);
+ }
+
+ // Save data storage configuration.
+ add(ATTR_DATA_STORAGE_CONFIG, new JdkMarshaller().marshal(cfg.getDataStorageConfiguration()));
+ }
+
+ /**
* Add SPI version and class attributes into node attributes.
*
* @param spiList Collection of SPIs to get attributes from.
@@ -2509,14 +2535,14 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
*
*/
private void ackMemoryConfiguration() {
- MemoryConfiguration memCfg = cfg.getMemoryConfiguration();
+ DataStorageConfiguration memCfg = cfg.getDataStorageConfiguration();
if (memCfg == null)
return;
- U.log(log, "System cache's MemoryPolicy size is configured to " +
- (memCfg.getSystemCacheInitialSize() / (1024 * 1024)) + " MB. " +
- "Use MemoryConfiguration.systemCacheMemorySize property to change the setting.");
+ U.log(log, "System cache's DataRegion size is configured to " +
+ (memCfg.getSystemRegionInitialSize() / (1024 * 1024)) + " MB. " +
+ "Use DataStorageConfiguration.systemCacheMemorySize property to change the setting.");
}
/**
@@ -2535,12 +2561,12 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
for (CacheConfiguration c : cacheCfgs) {
String cacheName = U.maskName(c.getName());
- String memPlcName = c.getMemoryPolicyName();
+ String memPlcName = c.getDataRegionName();
if (CU.isSystemCache(cacheName))
memPlcName = "sysMemPlc";
- else if (memPlcName == null && cfg.getMemoryConfiguration() != null)
- memPlcName = cfg.getMemoryConfiguration().getDefaultMemoryPolicyName();
+ else if (memPlcName == null && cfg.getDataStorageConfiguration() != null)
+ memPlcName = cfg.getDataStorageConfiguration().getDefaultDataRegionConfiguration().getName();
if (!memPlcNamesMapping.containsKey(memPlcName))
memPlcNamesMapping.put(memPlcName, new ArrayList<String>());
@@ -2551,7 +2577,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
}
for (Map.Entry<String, ArrayList<String>> e : memPlcNamesMapping.entrySet()) {
- sb.a("in '").a(e.getKey()).a("' memoryPolicy: [");
+ sb.a("in '").a(e.getKey()).a("' dataRegion: [");
for (String s : e.getValue())
sb.a("'").a(s).a("', ");
@@ -3509,7 +3535,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
}
/** {@inheritDoc} */
- @Override public Collection<MemoryMetrics> memoryMetrics() {
+ @Override public Collection<DataRegionMetrics> dataRegionMetrics() {
guard();
try {
@@ -3521,7 +3547,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
}
/** {@inheritDoc} */
- @Nullable @Override public MemoryMetrics memoryMetrics(String memPlcName) {
+ @Nullable @Override public DataRegionMetrics dataRegionMetrics(String memPlcName) {
guard();
try {
@@ -3533,7 +3559,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
}
/** {@inheritDoc} */
- @Override public PersistenceMetrics persistentStoreMetrics() {
+ @Override public DataStorageMetrics dataStorageMetrics() {
guard();
try {
@@ -3545,6 +3571,21 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
}
/** {@inheritDoc} */
+ @Override public Collection<MemoryMetrics> memoryMetrics() {
+ return DataRegionMetricsAdapter.collectionOf(dataRegionMetrics());
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public MemoryMetrics memoryMetrics(String memPlcName) {
+ return DataRegionMetricsAdapter.valueOf(dataRegionMetrics(memPlcName));
+ }
+
+ /** {@inheritDoc} */
+ @Override public PersistenceMetrics persistentStoreMetrics() {
+ return DataStorageMetricsAdapter.valueOf(dataStorageMetrics());
+ }
+
+ /** {@inheritDoc} */
@Nullable @Override public IgniteAtomicSequence atomicSequence(String name, long initVal, boolean create) {
return atomicSequence(name, null, initVal, create);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
index 024f339..277ed79 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
@@ -184,8 +184,12 @@ public final class IgniteNodeAttributes {
public static final String ATTR_DATA_STREAMER_POOL_SIZE = ATTR_PREFIX + ".data.streamer.pool.size";
/** Memory configuration. */
+ @Deprecated
public static final String ATTR_MEMORY_CONFIG = ATTR_PREFIX + ".memory";
+ /** Data storage configuration. */
+ public static final String ATTR_DATA_STORAGE_CONFIG = ATTR_PREFIX + ".data.storage.config";
+
/**
* Enforces singleton.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
index 07a5c43..36257e2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
@@ -57,11 +57,15 @@ import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.compute.ComputeJob;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.ConnectorConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.DeploymentMode;
import org.apache.ignite.configuration.ExecutorConfiguration;
import org.apache.ignite.configuration.FileSystemConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.TransactionConfiguration;
import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.managers.communication.GridIoPolicy;
@@ -123,6 +127,8 @@ import static org.apache.ignite.cache.CacheMode.REPLICATED;
import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
import static org.apache.ignite.configuration.IgniteConfiguration.DFLT_THREAD_KEEP_ALIVE_TIME;
+import static org.apache.ignite.configuration.MemoryConfiguration.DFLT_MEMORY_POLICY_MAX_SIZE;
+import static org.apache.ignite.configuration.MemoryConfiguration.DFLT_MEM_PLC_DEFAULT_NAME;
import static org.apache.ignite.internal.IgniteComponentType.SPRING;
import static org.apache.ignite.plugin.segmentation.SegmentationPolicy.RESTART_JVM;
@@ -2183,15 +2189,27 @@ public class IgnitionEx {
myCfg.setExecutorConfiguration(clone);
}
- if (!myCfg.isClientMode() && myCfg.getMemoryConfiguration() == null) {
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ initializeDataStorageConfiguration(myCfg);
- memCfg.setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);
+ return myCfg;
+ }
- myCfg.setMemoryConfiguration(memCfg);
+ /**
+ * @param cfg Ignite configuration.
+ */
+ private void initializeDataStorageConfiguration(IgniteConfiguration cfg) throws IgniteCheckedException {
+ if (cfg.getDataStorageConfiguration() != null &&
+ (cfg.getMemoryConfiguration() != null || cfg.getPersistentStoreConfiguration() != null)) {
+ throw new IgniteCheckedException("Data storage can be configured with either legacy " +
+ "(MemoryConfiguration, PersistentStoreConfiguration) or new (DataStorageConfiguration) classes, " +
+ "but not both.");
}
- return myCfg;
+ if (cfg.getMemoryConfiguration() != null || cfg.getPersistentStoreConfiguration() != null)
+ convertLegacyDataStorageConfigurationToNew(cfg);
+
+ if (!cfg.isClientMode() && cfg.getDataStorageConfiguration() == null)
+ cfg.setDataStorageConfiguration(new DataStorageConfiguration());
}
/**
@@ -2755,4 +2773,108 @@ public class IgnitionEx {
}
}
}
+
+ /**
+ * @param cfg Ignite Configuration with legacy data storage configuration.
+ */
+ private static void convertLegacyDataStorageConfigurationToNew(
+ IgniteConfiguration cfg) throws IgniteCheckedException {
+ boolean persistenceEnabled = cfg.getPersistentStoreConfiguration() != null;
+
+ DataStorageConfiguration dsCfg = new DataStorageConfiguration();
+
+ MemoryConfiguration memCfg = cfg.getMemoryConfiguration() != null ?
+ cfg.getMemoryConfiguration() : new MemoryConfiguration();
+
+ dsCfg.setConcurrencyLevel(memCfg.getConcurrencyLevel());
+ dsCfg.setPageSize(memCfg.getPageSize());
+ dsCfg.setSystemRegionInitialSize(memCfg.getSystemCacheInitialSize());
+ dsCfg.setSystemRegionMaxSize(memCfg.getSystemCacheMaxSize());
+
+ List<DataRegionConfiguration> optionalDataRegions = new ArrayList<>();
+
+ boolean customDfltPlc = false;
+
+ if (memCfg.getMemoryPolicies() != null) {
+ for (MemoryPolicyConfiguration mpc : memCfg.getMemoryPolicies()) {
+ DataRegionConfiguration region = new DataRegionConfiguration();
+
+ region.setPersistenceEnabled(persistenceEnabled);
+
+ if (mpc.getInitialSize() != 0L)
+ region.setInitialSize(mpc.getInitialSize());
+
+ region.setEmptyPagesPoolSize(mpc.getEmptyPagesPoolSize());
+ region.setEvictionThreshold(mpc.getEvictionThreshold());
+ region.setMaxSize(mpc.getMaxSize());
+ region.setName(mpc.getName());
+ region.setPageEvictionMode(mpc.getPageEvictionMode());
+ region.setMetricsRateTimeInterval(mpc.getRateTimeInterval());
+ region.setMetricsSubIntervalCount(mpc.getSubIntervals());
+ region.setSwapPath(mpc.getSwapFilePath());
+ region.setMetricsEnabled(mpc.isMetricsEnabled());
+
+ if (mpc.getName() == null) {
+ throw new IgniteCheckedException(new IllegalArgumentException(
+ "User-defined MemoryPolicyConfiguration must have non-null and non-empty name."));
+ }
+
+ if (mpc.getName().equals(memCfg.getDefaultMemoryPolicyName())) {
+ customDfltPlc = true;
+
+ dsCfg.setDefaultDataRegionConfiguration(region);
+ } else
+ optionalDataRegions.add(region);
+ }
+ }
+
+ if (!optionalDataRegions.isEmpty())
+ dsCfg.setDataRegionConfigurations(optionalDataRegions.toArray(new DataRegionConfiguration[optionalDataRegions.size()]));
+
+ if (!customDfltPlc) {
+ if (!DFLT_MEM_PLC_DEFAULT_NAME.equals(memCfg.getDefaultMemoryPolicyName())) {
+ throw new IgniteCheckedException(new IllegalArgumentException("User-defined default MemoryPolicy " +
+ "name must be presented among configured MemoryPolices: " + memCfg.getDefaultMemoryPolicyName()));
+ }
+
+ dsCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setMaxSize(memCfg.getDefaultMemoryPolicySize())
+ .setName(memCfg.getDefaultMemoryPolicyName())
+ .setPersistenceEnabled(persistenceEnabled));
+ } else {
+ if (memCfg.getDefaultMemoryPolicySize() != DFLT_MEMORY_POLICY_MAX_SIZE)
+ throw new IgniteCheckedException(new IllegalArgumentException("User-defined MemoryPolicy " +
+ "configuration and defaultMemoryPolicySize properties are set at the same time."));
+ }
+
+ if (persistenceEnabled) {
+ PersistentStoreConfiguration psCfg = cfg.getPersistentStoreConfiguration();
+
+ dsCfg.setCheckpointFrequency(psCfg.getCheckpointingFrequency());
+ dsCfg.setCheckpointPageBufferSize(psCfg.getCheckpointingPageBufferSize());
+ dsCfg.setCheckpointThreads(psCfg.getCheckpointingThreads());
+ dsCfg.setCheckpointWriteOrder(psCfg.getCheckpointWriteOrder());
+ dsCfg.setFileIOFactory(psCfg.getFileIOFactory());
+ dsCfg.setLockWaitTime(psCfg.getLockWaitTime());
+ dsCfg.setStoragePath(psCfg.getPersistentStorePath());
+ dsCfg.setMetricsRateTimeInterval(psCfg.getRateTimeInterval());
+ dsCfg.setMetricsSubIntervalCount(psCfg.getSubIntervals());
+ dsCfg.setWalThreadLocalBufferSize(psCfg.getTlbSize());
+ dsCfg.setWalArchivePath(psCfg.getWalArchivePath());
+ dsCfg.setWalAutoArchiveAfterInactivity(psCfg.getWalAutoArchiveAfterInactivity());
+ dsCfg.setWalFlushFrequency(psCfg.getWalFlushFrequency());
+ dsCfg.setWalFsyncDelayNanos(psCfg.getWalFsyncDelayNanos());
+ dsCfg.setWalHistorySize(psCfg.getWalHistorySize());
+ dsCfg.setWalMode(psCfg.getWalMode());
+ dsCfg.setWalRecordIteratorBufferSize(psCfg.getWalRecordIteratorBufferSize());
+ dsCfg.setWalSegments(psCfg.getWalSegments());
+ dsCfg.setWalSegmentSize(psCfg.getWalSegmentSize());
+ dsCfg.setWalPath(psCfg.getWalStorePath());
+ dsCfg.setAlwaysWriteFullPages(psCfg.isAlwaysWriteFullPages());
+ dsCfg.setMetricsEnabled(psCfg.isMetricsEnabled());
+ dsCfg.setWriteThrottlingEnabled(psCfg.isWriteThrottlingEnabled());
+ }
+
+ cfg.setDataStorageConfiguration(dsCfg);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
index f57bda7..1e5c370 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
@@ -48,6 +48,7 @@ import org.apache.ignite.internal.processors.marshaller.MarshallerMappingItem;
import org.apache.ignite.internal.processors.marshaller.MarshallerMappingTransport;
import org.apache.ignite.internal.util.IgniteUtils;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
+import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.marshaller.MarshallerContext;
import org.apache.ignite.plugin.PluginProvider;
@@ -506,7 +507,7 @@ public class MarshallerContextImpl implements MarshallerContext {
closProc = ctx.closure();
clientNode = ctx.clientNode();
- if (ctx.config().isPersistentStoreEnabled())
+ if (CU.isPersistenceEnabled(ctx.config()))
fileStore.restoreMappings(this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index 14485d2..a3b157d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -53,8 +53,8 @@ import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cluster.ClusterMetrics;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.Event;
import org.apache.ignite.internal.ClusterMetricsSnapshot;
@@ -1533,32 +1533,21 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
if(ctx.config().isClientMode())
return 0;
- MemoryConfiguration memCfg = ctx.config().getMemoryConfiguration();
+ DataStorageConfiguration memCfg = ctx.config().getDataStorageConfiguration();
assert memCfg != null;
- long res = memCfg.getSystemCacheMaxSize();
+ long res = memCfg.getSystemRegionMaxSize();
// Add memory policies.
- MemoryPolicyConfiguration[] memPlcCfgs = memCfg.getMemoryPolicies();
+ DataRegionConfiguration[] dataRegions = memCfg.getDataRegionConfigurations();
- if (memPlcCfgs != null) {
- String dfltMemPlcName = memCfg.getDefaultMemoryPolicyName();
-
- boolean customDflt = false;
-
- for (MemoryPolicyConfiguration memPlcCfg : memPlcCfgs) {
- if(F.eq(dfltMemPlcName, memPlcCfg.getName()))
- customDflt = true;
-
- res += memPlcCfg.getMaxSize();
- }
-
- if(!customDflt)
- res += memCfg.getDefaultMemoryPolicySize();
+ if (dataRegions != null) {
+ for (DataRegionConfiguration dataReg : dataRegions)
+ res += dataReg.getMaxSize();
}
- else
- res += memCfg.getDefaultMemoryPolicySize();
+
+ res += memCfg.getDefaultDataRegionConfiguration().getMaxSize();
// Add persistence (if any).
res += GridCacheDatabaseSharedManager.checkpointBufferSize(ctx.config());
[29/50] [abbrv] ignite git commit: IGNITE-6647 Web Console: Added
folder for modules migrations.
Posted by sb...@apache.org.
IGNITE-6647 Web Console: Added folder for modules migrations.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/37007173
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/37007173
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/37007173
Branch: refs/heads/ignite-3478-tree
Commit: 370071738baad3f568c17fb6145ad788ed1d03c2
Parents: ab08be8
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Oct 20 21:15:02 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Oct 20 21:15:02 2017 +0700
----------------------------------------------------------------------
modules/web-console/backend/ignite_modules/migrations/README.txt | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/37007173/modules/web-console/backend/ignite_modules/migrations/README.txt
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/ignite_modules/migrations/README.txt b/modules/web-console/backend/ignite_modules/migrations/README.txt
new file mode 100644
index 0000000..daeae36
--- /dev/null
+++ b/modules/web-console/backend/ignite_modules/migrations/README.txt
@@ -0,0 +1,4 @@
+Ignite Web Console
+======================================
+
+This folder contains scripts for modules model migration.
[27/50] [abbrv] ignite git commit: IGNITE-6515 .NET: Enable
persistence on per-cache basis
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/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 73636d1..c8c06b2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
@@ -41,6 +41,7 @@ namespace Apache.Ignite.Core.Tests
using Apache.Ignite.Core.Tests.Plugin;
using Apache.Ignite.Core.Transactions;
using NUnit.Framework;
+ using WalMode = Apache.Ignite.Core.PersistentStore.WalMode;
/// <summary>
/// Tests code-based configuration.
@@ -64,6 +65,8 @@ namespace Apache.Ignite.Core.Tests
{
CheckDefaultProperties(new IgniteConfiguration());
CheckDefaultProperties(new PersistentStoreConfiguration());
+ CheckDefaultProperties(new DataStorageConfiguration());
+ CheckDefaultProperties(new DataRegionConfiguration());
CheckDefaultProperties(new ClientConnectorConfiguration());
CheckDefaultProperties(new SqlConnectorConfiguration());
}
@@ -94,6 +97,8 @@ namespace Apache.Ignite.Core.Tests
CheckDefaultValueAttributes(new PersistentStoreConfiguration());
CheckDefaultValueAttributes(new IgniteClientConfiguration());
CheckDefaultValueAttributes(new QueryIndex());
+ CheckDefaultValueAttributes(new DataStorageConfiguration());
+ CheckDefaultValueAttributes(new DataRegionConfiguration());
}
/// <summary>
@@ -219,33 +224,6 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(eventCfg.ExpirationTimeout, resEventCfg.ExpirationTimeout);
Assert.AreEqual(eventCfg.MaxEventCount, resEventCfg.MaxEventCount);
- var memCfg = cfg.MemoryConfiguration;
- var resMemCfg = resCfg.MemoryConfiguration;
- Assert.IsNotNull(memCfg);
- Assert.IsNotNull(resMemCfg);
- Assert.AreEqual(memCfg.PageSize, resMemCfg.PageSize);
- Assert.AreEqual(memCfg.ConcurrencyLevel, resMemCfg.ConcurrencyLevel);
- Assert.AreEqual(memCfg.DefaultMemoryPolicyName, resMemCfg.DefaultMemoryPolicyName);
- Assert.AreEqual(memCfg.SystemCacheInitialSize, resMemCfg.SystemCacheInitialSize);
- Assert.AreEqual(memCfg.SystemCacheMaxSize, resMemCfg.SystemCacheMaxSize);
- Assert.IsNotNull(memCfg.MemoryPolicies);
- Assert.IsNotNull(resMemCfg.MemoryPolicies);
- Assert.AreEqual(2, memCfg.MemoryPolicies.Count);
- Assert.AreEqual(2, resMemCfg.MemoryPolicies.Count);
-
- for (var i = 0; i < memCfg.MemoryPolicies.Count; i++)
- {
- var plc = memCfg.MemoryPolicies.Skip(i).First();
- var resPlc = resMemCfg.MemoryPolicies.Skip(i).First();
-
- Assert.AreEqual(plc.PageEvictionMode, resPlc.PageEvictionMode);
- Assert.AreEqual(plc.MaxSize, resPlc.MaxSize);
- Assert.AreEqual(plc.EmptyPagesPoolSize, resPlc.EmptyPagesPoolSize);
- Assert.AreEqual(plc.EvictionThreshold, resPlc.EvictionThreshold);
- Assert.AreEqual(plc.Name, resPlc.Name);
- Assert.AreEqual(plc.SwapFilePath, resPlc.SwapFilePath);
- }
-
var sql = cfg.SqlConnectorConfiguration;
var resSql = resCfg.SqlConnectorConfiguration;
@@ -258,30 +236,7 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(sql.TcpNoDelay, resSql.TcpNoDelay);
Assert.AreEqual(sql.ThreadPoolSize, resSql.ThreadPoolSize);
- var pers = cfg.PersistentStoreConfiguration;
- var resPers = resCfg.PersistentStoreConfiguration;
-
- Assert.AreEqual(pers.AlwaysWriteFullPages, resPers.AlwaysWriteFullPages);
- Assert.AreEqual(pers.CheckpointingFrequency, resPers.CheckpointingFrequency);
- Assert.AreEqual(pers.CheckpointingPageBufferSize, resPers.CheckpointingPageBufferSize);
- Assert.AreEqual(pers.CheckpointingThreads, resPers.CheckpointingThreads);
- Assert.AreEqual(pers.LockWaitTime, resPers.LockWaitTime);
- Assert.AreEqual(pers.PersistentStorePath, resPers.PersistentStorePath);
- Assert.AreEqual(pers.TlbSize, resPers.TlbSize);
- Assert.AreEqual(pers.WalArchivePath, resPers.WalArchivePath);
- Assert.AreEqual(pers.WalFlushFrequency, resPers.WalFlushFrequency);
- Assert.AreEqual(pers.WalFsyncDelayNanos, resPers.WalFsyncDelayNanos);
- Assert.AreEqual(pers.WalHistorySize, resPers.WalHistorySize);
- Assert.AreEqual(pers.WalMode, resPers.WalMode);
- Assert.AreEqual(pers.WalRecordIteratorBufferSize, resPers.WalRecordIteratorBufferSize);
- Assert.AreEqual(pers.WalSegments, resPers.WalSegments);
- Assert.AreEqual(pers.WalSegmentSize, resPers.WalSegmentSize);
- Assert.AreEqual(pers.WalStorePath, resPers.WalStorePath);
- 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);
+ TestUtils.AssertReflectionEqual(cfg.DataStorageConfiguration, resCfg.DataStorageConfiguration);
}
}
@@ -311,24 +266,9 @@ namespace Apache.Ignite.Core.Tests
Assert.IsNotNull(disco);
Assert.AreEqual(TimeSpan.FromMilliseconds(300), disco.SocketTimeout);
- // Check memory configuration defaults.
- var mem = resCfg.MemoryConfiguration;
-
- Assert.IsNotNull(mem);
- Assert.AreEqual("dfltPlc", mem.DefaultMemoryPolicyName);
- Assert.AreEqual(MemoryConfiguration.DefaultSystemCacheInitialSize, mem.SystemCacheInitialSize);
- Assert.AreEqual(MemoryConfiguration.DefaultSystemCacheMaxSize, mem.SystemCacheMaxSize);
-
- var plc = mem.MemoryPolicies.Single();
- Assert.AreEqual("dfltPlc", plc.Name);
- Assert.AreEqual(MemoryPolicyConfiguration.DefaultEmptyPagesPoolSize, plc.EmptyPagesPoolSize);
- Assert.AreEqual(MemoryPolicyConfiguration.DefaultEvictionThreshold, plc.EvictionThreshold);
- Assert.AreEqual(MemoryPolicyConfiguration.DefaultMaxSize, plc.MaxSize);
- Assert.AreEqual(MemoryPolicyConfiguration.DefaultSubIntervals, plc.SubIntervals);
- Assert.AreEqual(MemoryPolicyConfiguration.DefaultRateTimeInterval, plc.RateTimeInterval);
-
- // Check PersistentStoreConfiguration defaults.
- CheckDefaultProperties(resCfg.PersistentStoreConfiguration);
+ // DataStorage defaults.
+ CheckDefaultProperties(resCfg.DataStorageConfiguration);
+ CheckDefaultProperties(resCfg.DataStorageConfiguration.DefaultDataRegionConfiguration);
// Connector defaults.
CheckDefaultProperties(resCfg.ClientConnectorConfiguration);
@@ -598,6 +538,54 @@ namespace Apache.Ignite.Core.Tests
/// Checks the default properties.
/// </summary>
/// <param name="cfg">Config.</param>
+ private static void CheckDefaultProperties(DataStorageConfiguration cfg)
+ {
+ Assert.AreEqual(DataStorageConfiguration.DefaultTlbSize, cfg.WalThreadLocalBufferSize);
+ Assert.AreEqual(DataStorageConfiguration.DefaultCheckpointFrequency, cfg.CheckpointFrequency);
+ Assert.AreEqual(DataStorageConfiguration.DefaultCheckpointThreads, cfg.CheckpointThreads);
+ Assert.AreEqual(default(long), cfg.CheckpointPageBufferSize);
+ Assert.AreEqual(DataStorageConfiguration.DefaultLockWaitTime, cfg.LockWaitTime);
+ Assert.AreEqual(DataStorageConfiguration.DefaultWalFlushFrequency, cfg.WalFlushFrequency);
+ Assert.AreEqual(DataStorageConfiguration.DefaultWalFsyncDelayNanos, cfg.WalFsyncDelayNanos);
+ Assert.AreEqual(DataStorageConfiguration.DefaultWalHistorySize, cfg.WalHistorySize);
+ Assert.AreEqual(DataStorageConfiguration.DefaultWalRecordIteratorBufferSize,
+ cfg.WalRecordIteratorBufferSize);
+ Assert.AreEqual(DataStorageConfiguration.DefaultWalSegmentSize, cfg.WalSegmentSize);
+ Assert.AreEqual(DataStorageConfiguration.DefaultWalSegments, cfg.WalSegments);
+ Assert.AreEqual(DataStorageConfiguration.DefaultWalMode, cfg.WalMode);
+ Assert.IsFalse(cfg.MetricsEnabled);
+ Assert.AreEqual(DataStorageConfiguration.DefaultMetricsSubIntervalCount, cfg.MetricsSubIntervalCount);
+ Assert.AreEqual(DataStorageConfiguration.DefaultMetricsRateTimeInterval, cfg.MetricsRateTimeInterval);
+ Assert.AreEqual(DataStorageConfiguration.DefaultWalPath, cfg.WalPath);
+ Assert.AreEqual(DataStorageConfiguration.DefaultWalArchivePath, cfg.WalArchivePath);
+ Assert.AreEqual(DataStorageConfiguration.DefaultCheckpointWriteOrder, cfg.CheckpointWriteOrder);
+ Assert.AreEqual(DataStorageConfiguration.DefaultWriteThrottlingEnabled, cfg.WriteThrottlingEnabled);
+
+ Assert.AreEqual(DataStorageConfiguration.DefaultSystemRegionInitialSize, cfg.SystemRegionInitialSize);
+ Assert.AreEqual(DataStorageConfiguration.DefaultSystemRegionMaxSize, cfg.SystemRegionMaxSize);
+ Assert.AreEqual(DataStorageConfiguration.DefaultPageSize, cfg.PageSize);
+ Assert.AreEqual(DataStorageConfiguration.DefaultConcurrencyLevel, cfg.ConcurrencyLevel);
+ }
+
+ /// <summary>
+ /// Checks the default properties.
+ /// </summary>
+ /// <param name="cfg">Config.</param>
+ private static void CheckDefaultProperties(DataRegionConfiguration cfg)
+ {
+ Assert.AreEqual(DataRegionConfiguration.DefaultEmptyPagesPoolSize, cfg.EmptyPagesPoolSize);
+ Assert.AreEqual(DataRegionConfiguration.DefaultEvictionThreshold, cfg.EvictionThreshold);
+ Assert.AreEqual(DataRegionConfiguration.DefaultInitialSize, cfg.InitialSize);
+ Assert.AreEqual(DataRegionConfiguration.DefaultMaxSize, cfg.MaxSize);
+ Assert.AreEqual(DataRegionConfiguration.DefaultPersistenceEnabled, cfg.PersistenceEnabled);
+ Assert.AreEqual(DataRegionConfiguration.DefaultMetricsRateTimeInterval, cfg.MetricsRateTimeInterval);
+ Assert.AreEqual(DataRegionConfiguration.DefaultMetricsSubIntervalCount, cfg.MetricsSubIntervalCount);
+ }
+
+ /// <summary>
+ /// Checks the default properties.
+ /// </summary>
+ /// <param name="cfg">Config.</param>
private static void CheckDefaultProperties(ClientConnectorConfiguration cfg)
{
Assert.AreEqual(ClientConnectorConfiguration.DefaultPort, cfg.Port);
@@ -636,8 +624,7 @@ namespace Apache.Ignite.Core.Tests
foreach (var prop in props.Where(p => p.Name != "SelectorsCount" && p.Name != "ReadStripesNumber" &&
!p.Name.Contains("ThreadPoolSize") &&
- !(p.Name == "MaxSize" &&
- p.DeclaringType == typeof(MemoryPolicyConfiguration))))
+ p.Name != "MaxSize"))
{
var attr = prop.GetCustomAttributes(true).OfType<DefaultValueAttribute>().FirstOrDefault();
var propValue = prop.GetValue(obj, null);
@@ -645,7 +632,7 @@ namespace Apache.Ignite.Core.Tests
if (attr != null)
Assert.AreEqual(attr.Value, propValue, string.Format("{0}.{1}", obj.GetType(), prop.Name));
else if (prop.PropertyType.IsValueType)
- Assert.AreEqual(Activator.CreateInstance(prop.PropertyType), propValue);
+ Assert.AreEqual(Activator.CreateInstance(prop.PropertyType), propValue, prop.Name);
else
Assert.IsNull(propValue);
}
@@ -757,39 +744,6 @@ namespace Apache.Ignite.Core.Tests
ExpirationTimeout = TimeSpan.FromSeconds(5),
MaxEventCount = 10
},
- MemoryConfiguration = new MemoryConfiguration
- {
- ConcurrencyLevel = 3,
- DefaultMemoryPolicyName = "myDefaultPlc",
- PageSize = 2048,
- SystemCacheInitialSize = 13 * 1024 * 1024,
- SystemCacheMaxSize = 15 * 1024 * 1024,
- MemoryPolicies = new[]
- {
- new MemoryPolicyConfiguration
- {
- Name = "myDefaultPlc",
- PageEvictionMode = DataPageEvictionMode.Disabled,
- InitialSize = 340 * 1024 * 1024,
- MaxSize = 345 * 1024 * 1024,
- EvictionThreshold = 0.88,
- EmptyPagesPoolSize = 77,
- SwapFilePath = "myPath1",
- RateTimeInterval = TimeSpan.FromSeconds(35),
- SubIntervals = 7
- },
- new MemoryPolicyConfiguration
- {
- Name = "customPlc",
- PageEvictionMode = DataPageEvictionMode.Disabled,
- MaxSize = 456 * 1024 * 1024,
- EvictionThreshold = 0.77,
- EmptyPagesPoolSize = 66,
- SwapFilePath = "somePath2",
- MetricsEnabled = true
- }
- }
- },
PublicThreadPoolSize = 3,
StripedThreadPoolSize = 5,
ServiceThreadPoolSize = 6,
@@ -810,31 +764,66 @@ namespace Apache.Ignite.Core.Tests
TcpNoDelay = false,
SocketSendBufferSize = 4096
},
- PersistentStoreConfiguration = new PersistentStoreConfiguration
+ ConsistentId = new MyConsistentId {Data = "abc"},
+ DataStorageConfiguration = new DataStorageConfiguration
{
AlwaysWriteFullPages = true,
- CheckpointingFrequency = TimeSpan.FromSeconds(25),
- CheckpointingPageBufferSize = 28 * 1024 * 1024,
- CheckpointingThreads = 2,
+ CheckpointFrequency = TimeSpan.FromSeconds(25),
+ CheckpointPageBufferSize = 28 * 1024 * 1024,
+ CheckpointThreads = 2,
LockWaitTime = TimeSpan.FromSeconds(5),
- PersistentStorePath = Path.GetTempPath(),
- TlbSize = 64 * 1024,
+ StoragePath = Path.GetTempPath(),
+ WalThreadLocalBufferSize = 64 * 1024,
WalArchivePath = Path.GetTempPath(),
WalFlushFrequency = TimeSpan.FromSeconds(3),
WalFsyncDelayNanos = 3,
WalHistorySize = 10,
- WalMode = WalMode.LogOnly,
+ WalMode = Configuration.WalMode.LogOnly,
WalRecordIteratorBufferSize = 32 * 1024 * 1024,
WalSegments = 6,
WalSegmentSize = 5 * 1024 * 1024,
- WalStorePath = Path.GetTempPath(),
+ WalPath = Path.GetTempPath(),
MetricsEnabled = true,
- SubIntervals = 7,
- RateTimeInterval = TimeSpan.FromSeconds(9),
- CheckpointWriteOrder = CheckpointWriteOrder.Random,
- WriteThrottlingEnabled = true
- },
- ConsistentId = new MyConsistentId {Data = "abc"}
+ MetricsSubIntervalCount = 7,
+ MetricsRateTimeInterval = TimeSpan.FromSeconds(9),
+ CheckpointWriteOrder = Configuration.CheckpointWriteOrder.Random,
+ WriteThrottlingEnabled = true,
+ SystemRegionInitialSize = 64 * 1024 * 1024,
+ SystemRegionMaxSize = 128 * 1024 * 1024,
+ ConcurrencyLevel = 1,
+ PageSize = 8 * 1024,
+ DefaultDataRegionConfiguration = new DataRegionConfiguration
+ {
+ Name = "reg1",
+ EmptyPagesPoolSize = 50,
+ EvictionThreshold = 0.8,
+ InitialSize = 100 * 1024 * 1024,
+ MaxSize = 150 * 1024 * 1024,
+ MetricsEnabled = true,
+ PageEvictionMode = Configuration.DataPageEvictionMode.Random2Lru,
+ PersistenceEnabled = false,
+ MetricsRateTimeInterval = TimeSpan.FromMinutes(2),
+ MetricsSubIntervalCount = 6,
+ SwapPath = IgniteUtils.GetTempDirectoryName()
+ },
+ DataRegionConfigurations = new[]
+ {
+ new DataRegionConfiguration
+ {
+ Name = "reg2",
+ EmptyPagesPoolSize = 51,
+ EvictionThreshold = 0.7,
+ InitialSize = 101 * 1024 * 1024,
+ MaxSize = 151 * 1024 * 1024,
+ MetricsEnabled = false,
+ PageEvictionMode = Configuration.DataPageEvictionMode.RandomLru,
+ PersistenceEnabled = false,
+ MetricsRateTimeInterval = TimeSpan.FromMinutes(3),
+ MetricsSubIntervalCount = 7,
+ SwapPath = IgniteUtils.GetTempDirectoryName()
+ }
+ }
+ }
};
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/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 446208a..20a54d0 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -94,6 +94,10 @@
<Compile Include="Binary\BinaryBasicNameMapper.cs" />
<Compile Include="Binary\TimestampAttribute.cs" />
<Compile Include="Cache\Configuration\DataPageEvictionMode.cs" />
+ <Compile Include="Configuration\CheckpointWriteOrder.cs" />
+ <Compile Include="Configuration\DataPageEvictionMode.cs" />
+ <Compile Include="Configuration\DataRegionConfiguration.cs" />
+ <Compile Include="Configuration\DataStorageConfiguration.cs" />
<Compile Include="Cache\Configuration\MemoryPolicyConfiguration.cs" />
<Compile Include="Cache\Configuration\PartitionLossPolicy.cs" />
<Compile Include="Cache\IMemoryMetrics.cs" />
@@ -105,6 +109,9 @@
<Compile Include="Configuration\Package-Info.cs" />
<Compile Include="Configuration\ClientConnectorConfiguration.cs" />
<Compile Include="Datastream\DataStreamerDefaults.cs" />
+ <Compile Include="IDataRegionMetrics.cs" />
+ <Compile Include="IDataStorageMetrics.cs" />
+ <Compile Include="Configuration\WalMode.cs" />
<Compile Include="Impl\Binary\BinaryTypeId.cs" />
<Compile Include="Impl\Client\Cache\CacheFlags.cs" />
<Compile Include="Impl\Client\Cache\Query\ClientQueryCursor.cs" />
@@ -113,6 +120,7 @@
<Compile Include="Impl\Binary\IBinaryProcessor.cs" />
<Compile Include="Impl\Client\ClientStatus.cs" />
<Compile Include="Events\LocalEventListener.cs" />
+ <Compile Include="Impl\DataStorageMetrics.cs" />
<Compile Include="Impl\IIgniteInternal.cs" />
<Compile Include="Impl\Client\Cache\CacheClient.cs" />
<Compile Include="Impl\Client\ClientOp.cs" />
@@ -120,6 +128,7 @@
<Compile Include="Impl\Client\ClientSocket.cs" />
<Compile Include="Impl\Client\IgniteClient.cs" />
<Compile Include="Impl\IPlatformTargetInternal.cs" />
+ <Compile Include="Impl\DataRegionMetrics.cs" />
<Compile Include="Impl\PersistentStore\PersistentStoreMetrics.cs" />
<Compile Include="Impl\PlatformDisposableTargetAdapter.cs" />
<Compile Include="Impl\PlatformJniTarget.cs" />
@@ -603,6 +612,7 @@
</None>
</ItemGroup>
<ItemGroup>
+ <Folder Include="Data\" />
<Folder Include="Impl\Common\JavaObjects\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
index c6b81f0..e7252b2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
@@ -27,6 +27,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
+ using System.Xml.Serialization;
using Apache.Ignite.Core.Cache;
using Apache.Ignite.Core.Cache.Affinity;
using Apache.Ignite.Core.Cache.Affinity.Rendezvous;
@@ -34,6 +35,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
using Apache.Ignite.Core.Cache.Expiry;
using Apache.Ignite.Core.Cache.Store;
using Apache.Ignite.Core.Common;
+ using Apache.Ignite.Core.Configuration;
using Apache.Ignite.Core.Impl;
using Apache.Ignite.Core.Impl.Binary;
using Apache.Ignite.Core.Impl.Cache.Affinity;
@@ -286,7 +288,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
ReadThrough = reader.ReadBoolean();
WriteThrough = reader.ReadBoolean();
EnableStatistics = reader.ReadBoolean();
- MemoryPolicyName = reader.ReadString();
+ DataRegionName = reader.ReadString();
PartitionLossPolicy = (PartitionLossPolicy) reader.ReadInt();
GroupName = reader.ReadString();
CacheStoreFactory = reader.ReadObject<IFactory<ICacheStore>>();
@@ -366,7 +368,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
writer.WriteBoolean(ReadThrough);
writer.WriteBoolean(WriteThrough);
writer.WriteBoolean(EnableStatistics);
- writer.WriteString(MemoryPolicyName);
+ writer.WriteString(DataRegionName);
writer.WriteInt((int) PartitionLossPolicy);
writer.WriteString(GroupName);
writer.WriteObject(CacheStoreFactory);
@@ -747,7 +749,18 @@ namespace Apache.Ignite.Core.Cache.Configuration
/// Gets or sets the name of the <see cref="MemoryPolicyConfiguration"/> for this cache.
/// See <see cref="IgniteConfiguration.MemoryConfiguration"/>.
/// </summary>
- public string MemoryPolicyName { get; set; }
+ [Obsolete("Use DataRegionName.")]
+ [XmlIgnore]
+ public string MemoryPolicyName
+ {
+ get { return DataRegionName; }
+ set { DataRegionName = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the name of the data region, see <see cref="DataRegionConfiguration"/>.
+ /// </summary>
+ public string DataRegionName { get; set; }
/// <summary>
/// Gets or sets write coalescing flag for write-behind cache store operations.
@@ -770,7 +783,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
/// <para />
/// Since underlying cache is shared, the following configuration properties should be the same within group:
/// <see cref="AffinityFunction"/>, <see cref="CacheMode"/>, <see cref="PartitionLossPolicy"/>,
- /// <see cref="MemoryPolicyName"/>
+ /// <see cref="DataRegionName"/>
/// <para />
/// Grouping caches reduces overall overhead, since internal data structures are shared.
/// </summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/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 a6263d7..57e60d9 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/DataPageEvictionMode.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/DataPageEvictionMode.cs
@@ -17,11 +17,14 @@
namespace Apache.Ignite.Core.Cache.Configuration
{
+ using System;
+
/// <summary>
/// Memory page eviction mode.
/// Only data pages, that store key-value entries, are eligible for eviction.
/// The other types of pages, like index or system pages, are not evictable.
/// </summary>
+ [Obsolete("Use Apache.Ignite.Core.Configuration.DataPageEvictionMode")]
public enum DataPageEvictionMode
{
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryConfiguration.cs
index 3be6012..12d0002 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryConfiguration.cs
@@ -17,6 +17,7 @@
namespace Apache.Ignite.Core.Cache.Configuration
{
+ using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
@@ -24,6 +25,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
using System.Linq;
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Common;
+ using Apache.Ignite.Core.Configuration;
/// <summary>
/// A page memory configuration for an Apache Ignite node. The page memory is a manageable off-heap based
@@ -42,7 +44,10 @@ namespace Apache.Ignite.Core.Cache.Configuration
/// eviction policies, swapping options, etc. Once you define a new memory region you can bind
/// particular Ignite caches to it. <para />
/// To learn more about memory policies refer to <see cref="MemoryPolicyConfiguration" /> documentation.
+ /// <para />
+ /// Obsolete, use <see cref="DataStorageConfiguration"/>.
/// </summary>
+ [Obsolete("Use DataStorageConfiguration.")]
public class MemoryConfiguration
{
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/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 16d8dcc..e204ee7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryPolicyConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryPolicyConfiguration.cs
@@ -21,12 +21,15 @@ namespace Apache.Ignite.Core.Cache.Configuration
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Configuration;
using Apache.Ignite.Core.Impl;
using Apache.Ignite.Core.Impl.Binary;
/// <summary>
/// Defines page memory policy configuration. See <see cref="MemoryConfiguration.MemoryPolicies"/>.
+ /// Obsolete, use <see cref="DataRegionConfiguration"/>.
/// </summary>
+ [Obsolete("Use DataRegionConfiguration.")]
public class MemoryPolicyConfiguration
{
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core/Cache/IMemoryMetrics.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/IMemoryMetrics.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/IMemoryMetrics.cs
index 0298c1f..ff8d64e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/IMemoryMetrics.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/IMemoryMetrics.cs
@@ -17,9 +17,13 @@
namespace Apache.Ignite.Core.Cache
{
+ using System;
+
/// <summary>
/// Memory usage metrics.
+ /// Obsolete, use <see cref="IDataRegionMetrics"/>.
/// </summary>
+ [Obsolete("See IDataRegionMetrics.")]
public interface IMemoryMetrics
{
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/CheckpointWriteOrder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/CheckpointWriteOrder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/CheckpointWriteOrder.cs
new file mode 100644
index 0000000..5243f4a
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/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.Configuration
+{
+ /// <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/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/DataPageEvictionMode.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/DataPageEvictionMode.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/DataPageEvictionMode.cs
new file mode 100644
index 0000000..ec835bb
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/DataPageEvictionMode.cs
@@ -0,0 +1,59 @@
+/*
+ * 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
+{
+ /// <summary>
+ /// Memory page eviction mode.
+ /// Only data pages, that store key-value entries, are eligible for eviction.
+ /// The other types of pages, like index or system pages, are not evictable.
+ /// </summary>
+ public enum DataPageEvictionMode
+ {
+ /// <summary>
+ /// Eviction is disabled.
+ /// </summary>
+ Disabled,
+
+ /// <summary>
+ /// Random-LRU algorithm.
+ /// <para />
+ /// 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
+ /// <see cref="DataRegionConfiguration.MaxSize"/> / <see cref="DataStorageConfiguration.PageSize"/>.
+ /// <para />
+ /// When a data page is accessed, its timestamp gets updated in the tracking array. The page index in the
+ /// tracking array equals to pageAddress / <see cref="DataRegionConfiguration.MaxSize"/>.
+ /// <para />
+ /// 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
+ /// (index or system pages) then the algorithm picks other pages.
+ /// </summary>
+ RandomLru,
+
+ /// <summary>
+ /// Activates Random-2-LRU algorithm which is a scan resistant version of Random-LRU.
+ /// <para />
+ /// This algorithm differs from Random-LRU only in a way that two latest access timestamps are stored for every
+ /// data page. At the eviction time, a minimum between two latest timestamps is taken for further
+ /// comparison with minimums of other pages that might be evicted. LRU-2 outperforms LRU by
+ /// resolving "one-hit wonder" problem - if a data page is accessed rarely, but accidentally accessed once,
+ /// its protected from eviction for a long time.
+ /// </summary>
+ Random2Lru
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/DataRegionConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/DataRegionConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/DataRegionConfiguration.cs
new file mode 100644
index 0000000..5c4240e
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/DataRegionConfiguration.cs
@@ -0,0 +1,213 @@
+/*
+ * 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;
+ using System.ComponentModel;
+ using System.Diagnostics.CodeAnalysis;
+ using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Cache.Configuration;
+ using Apache.Ignite.Core.Impl;
+ using Apache.Ignite.Core.Impl.Binary;
+
+ /// <summary>
+ /// Defines custom data region configuration for Apache Ignite page memory
+ /// (see <see cref="DataStorageConfiguration"/>).
+ /// <para />
+ /// For each configured data region Apache Ignite instantiates respective memory regions with different
+ /// parameters like maximum size, eviction policy, swapping options, etc.
+ /// An Apache Ignite cache can be mapped to a particular region using
+ /// <see cref="CacheConfiguration.DataRegionName"/> method.
+ /// </summary>
+ public class DataRegionConfiguration
+ {
+ /// <summary>
+ /// Default value for <see cref="PersistenceEnabled"/>.
+ /// </summary>
+ public const bool DefaultPersistenceEnabled = false;
+
+ /// <summary>
+ /// The default eviction threshold.
+ /// </summary>
+ public const double DefaultEvictionThreshold = 0.9;
+
+ /// <summary>
+ /// The default empty pages pool size.
+ /// </summary>
+ public const int DefaultEmptyPagesPoolSize = 100;
+
+ /// <summary>
+ /// The default initial size.
+ /// </summary>
+ public const long DefaultInitialSize = 256 * 1024 * 1024;
+
+ /// <summary>
+ /// The default maximum size, equals to 20% of total RAM.
+ /// </summary>
+ public static readonly long DefaultMaxSize = (long)((long)NativeMethods.GetTotalPhysicalMemory() * 0.2);
+
+ /// <summary>
+ /// The default sub intervals.
+ /// </summary>
+ [SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly",
+ Justification = "Consistency with Java config")]
+ public const int DefaultMetricsSubIntervalCount = 5;
+
+ /// <summary>
+ /// The default rate time interval.
+ /// </summary>
+ public static readonly TimeSpan DefaultMetricsRateTimeInterval = TimeSpan.FromSeconds(60);
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="DataRegionConfiguration"/> class.
+ /// </summary>
+ public DataRegionConfiguration()
+ {
+ PersistenceEnabled = DefaultPersistenceEnabled;
+ EvictionThreshold = DefaultEvictionThreshold;
+ EmptyPagesPoolSize = DefaultEmptyPagesPoolSize;
+ InitialSize = DefaultInitialSize;
+ MaxSize = DefaultMaxSize;
+ MetricsSubIntervalCount = DefaultMetricsSubIntervalCount;
+ MetricsRateTimeInterval = DefaultMetricsRateTimeInterval;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="DataRegionConfiguration"/> class.
+ /// </summary>
+ /// <param name="reader">The reader.</param>
+ internal DataRegionConfiguration(IBinaryRawReader reader)
+ {
+ Name = reader.ReadString();
+ PersistenceEnabled = reader.ReadBoolean();
+ InitialSize = reader.ReadLong();
+ MaxSize = reader.ReadLong();
+ SwapPath = reader.ReadString();
+ PageEvictionMode = (DataPageEvictionMode)reader.ReadInt();
+ EvictionThreshold = reader.ReadDouble();
+ EmptyPagesPoolSize = reader.ReadInt();
+ MetricsEnabled = reader.ReadBoolean();
+ MetricsSubIntervalCount = reader.ReadInt();
+ MetricsRateTimeInterval = reader.ReadLongAsTimespan();
+ }
+
+ /// <summary>
+ /// Writes this instance to a writer.
+ /// </summary>
+ internal void Write(IBinaryRawWriter writer)
+ {
+ writer.WriteString(Name);
+ writer.WriteBoolean(PersistenceEnabled);
+ writer.WriteLong(InitialSize);
+ writer.WriteLong(MaxSize);
+ writer.WriteString(SwapPath);
+ writer.WriteInt((int)PageEvictionMode);
+ writer.WriteDouble(EvictionThreshold);
+ writer.WriteInt(EmptyPagesPoolSize);
+ writer.WriteBoolean(MetricsEnabled);
+ writer.WriteInt(MetricsSubIntervalCount);
+ writer.WriteTimeSpanAsLong(MetricsRateTimeInterval);
+ }
+
+ /// <summary>
+ /// Gets or sets the data region name.
+ /// </summary>
+ public string Name { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether disk persistence is enabled for this region.
+ /// Default is <see cref="DefaultPersistenceEnabled"/>.
+ /// </summary>
+ [DefaultValue(DefaultPersistenceEnabled)]
+ public bool PersistenceEnabled { get; set; }
+
+ /// <summary>
+ /// Gets or sets initial memory region size.
+ /// When the used memory size exceeds this value, new chunks of memory will be allocated.
+ /// </summary>
+ [DefaultValue(DefaultInitialSize)]
+ public long InitialSize { get; set; }
+
+ /// <summary>
+ /// Sets maximum memory region size. The total size should not be less
+ /// than 10 MB due to internal data structures overhead.
+ /// </summary>
+ public long MaxSize { get; set; }
+
+ /// <summary>
+ /// Gets or sets the the path to the directory for memory-mapped files.
+ /// <para />
+ /// Null for no swap.
+ /// </summary>
+ public string SwapPath { get; set; }
+
+ /// <summary>
+ /// Gets or sets the page eviction mode. If <see cref="DataPageEvictionMode.Disabled"/> is used (default)
+ /// then an out of memory exception will be thrown if the memory region usage
+ /// goes beyond <see cref="MaxSize"/>.
+ /// </summary>
+ public DataPageEvictionMode PageEvictionMode { get; set; }
+
+ /// <summary>
+ /// Gets or sets the threshold for memory pages eviction initiation. For instance, if the threshold is 0.9
+ /// it means that the page memory will start the eviction only after 90% of the memory region is occupied.
+ /// </summary>
+ [DefaultValue(DefaultEvictionThreshold)]
+ public double EvictionThreshold { get; set; }
+
+ /// <summary>
+ /// Gets or sets the minimal number of empty pages to be present in reuse lists for this data region.
+ /// This parameter ensures that Ignite will be able to successfully evict old data entries when the size of
+ /// (key, value) pair is slightly larger than page size / 2.
+ /// Increase this parameter if cache can contain very big entries (total size of pages in this pool
+ /// should be enough to contain largest cache entry).
+ /// </summary>
+ [DefaultValue(DefaultEmptyPagesPoolSize)]
+ public int EmptyPagesPoolSize { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether memory metrics should be enabled.
+ /// <para />
+ /// Metrics can be retrieved with <see cref="IIgnite.GetDataRegionMetrics()"/> method.
+ /// </summary>
+ public bool MetricsEnabled { get; set; }
+
+ /// <summary>
+ /// Gets or sets the rate time interval for <see cref="IDataRegionMetrics.AllocationRate"/>
+ /// and <see cref="IDataRegionMetrics.EvictionRate"/> monitoring purposes.
+ /// <para />
+ /// For instance, after setting the interval to 60 seconds, subsequent calls
+ /// to <see cref="IDataRegionMetrics.AllocationRate"/> will return average allocation
+ /// rate (pages per second) for the last minute.
+ /// </summary>
+ [DefaultValue(typeof(TimeSpan), "00:01:00")]
+ public TimeSpan MetricsRateTimeInterval { get; set; }
+
+ /// <summary>
+ /// Gets or sets the number of sub intervals to split <see cref="MetricsRateTimeInterval"/> into to calculate
+ /// <see cref="IDataRegionMetrics.AllocationRate"/> and <see cref="IDataRegionMetrics.EvictionRate"/>.
+ /// <para />
+ /// Bigger value results in more accurate metrics.
+ /// </summary>
+ [DefaultValue(DefaultMetricsSubIntervalCount)]
+ [SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly",
+ Justification = "Consistency with Java config")]
+ public int MetricsSubIntervalCount { get; set; }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/DataStorageConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/DataStorageConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/DataStorageConfiguration.cs
new file mode 100644
index 0000000..17b4ada
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/DataStorageConfiguration.cs
@@ -0,0 +1,466 @@
+/*
+ * 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;
+ using System.Collections.Generic;
+ using System.ComponentModel;
+ using System.Diagnostics;
+ using System.Diagnostics.CodeAnalysis;
+ using System.Linq;
+ using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Common;
+ using Apache.Ignite.Core.Impl.Binary;
+
+ /// <summary>
+ /// Data storage configuration for Ignite page memory.
+ /// <para />
+ /// The page memory is a manageable off-heap based memory architecture that divides all expandable data
+ /// regions into pages of fixed size. An individual page can store one or many cache key-value entries
+ /// that allows reusing the memory in the most efficient way and avoid memory fragmentation issues.
+ /// <para />
+ /// By default, the page memory allocates a single expandable data region. All the caches that will be
+ /// configured in an application will be mapped to this data region by default, thus, all the cache data
+ /// will reside in that data region.
+ /// </summary>
+ public class DataStorageConfiguration
+ {
+ /// <summary>
+ /// Default value for <see cref="CheckpointThreads"/>.
+ /// </summary>
+ public const int DefaultCheckpointThreads = 4;
+
+ /// <summary>
+ /// Default name is assigned to default data region if no user-defined
+ /// <see cref="DefaultDataRegionConfiguration"/> is specified.
+ /// </summary>
+ public const string DefaultDataRegionName = "default";
+
+ /// <summary>
+ /// Default value for <see cref="CheckpointFrequency"/>.
+ /// </summary>
+ public static readonly TimeSpan DefaultCheckpointFrequency = TimeSpan.FromSeconds(180);
+
+ /// <summary>
+ /// Default value for <see cref="LockWaitTime"/>.
+ /// </summary>
+ public static readonly TimeSpan DefaultLockWaitTime = TimeSpan.FromSeconds(10);
+
+ /// <summary>
+ /// Default value for <see cref="WalHistorySize"/>.
+ /// </summary>
+ public const int DefaultWalHistorySize = 20;
+
+ /// <summary>
+ /// Default value for <see cref="WalSegments"/>.
+ /// </summary>
+ public const int DefaultWalSegments = 10;
+
+ /// <summary>
+ /// Default value for <see cref="WalSegmentSize"/>.
+ /// </summary>
+ public const int DefaultWalSegmentSize = 64 * 1024 * 1024;
+
+ /// <summary>
+ /// Default value for <see cref="WalThreadLocalBufferSize"/>.
+ /// </summary>
+ public const int DefaultTlbSize = 128 * 1024;
+
+ /// <summary>
+ /// Default value for <see cref="WalFlushFrequency"/>.
+ /// </summary>
+ public static readonly TimeSpan DefaultWalFlushFrequency = TimeSpan.FromSeconds(2);
+
+ /// <summary>
+ /// Default value for <see cref="WalRecordIteratorBufferSize"/>.
+ /// </summary>
+ public const int DefaultWalRecordIteratorBufferSize = 64 * 1024 * 1024;
+
+ /// <summary>
+ /// Default value for <see cref="WalFsyncDelayNanos"/>.
+ /// </summary>
+ public const long DefaultWalFsyncDelayNanos = 1000;
+
+ /// <summary>
+ /// The default sub intervals.
+ /// </summary>
+ [SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly",
+ Justification = "Consistency with Java config")]
+ public const int DefaultMetricsSubIntervalCount = 5;
+
+ /// <summary>
+ /// The default rate time interval.
+ /// </summary>
+ public static readonly TimeSpan DefaultMetricsRateTimeInterval = TimeSpan.FromSeconds(60);
+
+ /// <summary>
+ /// Default value for <see cref="WalPath"/>.
+ /// </summary>
+ public const string DefaultWalPath = "db/wal";
+
+ /// <summary>
+ /// Default value for <see cref="WalArchivePath"/>.
+ /// </summary>
+ public const string DefaultWalArchivePath = "db/wal/archive";
+
+ /// <summary>
+ /// Default value for <see cref="WalMode"/>.
+ /// </summary>
+ public const WalMode DefaultWalMode = WalMode.Default;
+
+ /// <summary>
+ /// Default value for <see cref="CheckpointWriteOrder"/>.
+ /// </summary>
+ public const CheckpointWriteOrder DefaultCheckpointWriteOrder = CheckpointWriteOrder.Sequential;
+
+ /// <summary>
+ /// Default value for <see cref="WriteThrottlingEnabled"/>.
+ /// </summary>
+ public const bool DefaultWriteThrottlingEnabled = false;
+
+ /// <summary>
+ /// Default size of a memory chunk reserved for system cache initially.
+ /// </summary>
+ public const long DefaultSystemRegionInitialSize = 40 * 1024 * 1024;
+
+ /// <summary>
+ /// Default max size of a memory chunk for the system cache.
+ /// </summary>
+ public const long DefaultSystemRegionMaxSize = 100 * 1024 * 1024;
+
+ /// <summary>
+ /// The default page size.
+ /// </summary>
+ public const int DefaultPageSize = 4 * 1024;
+
+ /// <summary>
+ /// The default concurrency level.
+ /// </summary>
+ public const int DefaultConcurrencyLevel = 0;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="DataStorageConfiguration"/> class.
+ /// </summary>
+ public DataStorageConfiguration()
+ {
+ CheckpointThreads = DefaultCheckpointThreads;
+ CheckpointFrequency = DefaultCheckpointFrequency;
+ LockWaitTime = DefaultLockWaitTime;
+ WalHistorySize = DefaultWalHistorySize;
+ WalSegments = DefaultWalSegments;
+ WalSegmentSize = DefaultWalSegmentSize;
+ WalThreadLocalBufferSize = DefaultTlbSize;
+ WalFlushFrequency = DefaultWalFlushFrequency;
+ WalRecordIteratorBufferSize = DefaultWalRecordIteratorBufferSize;
+ WalFsyncDelayNanos = DefaultWalFsyncDelayNanos;
+ MetricsRateTimeInterval = DefaultMetricsRateTimeInterval;
+ MetricsSubIntervalCount = DefaultMetricsSubIntervalCount;
+ WalArchivePath = DefaultWalArchivePath;
+ WalPath = DefaultWalPath;
+ CheckpointWriteOrder = DefaultCheckpointWriteOrder;
+ WriteThrottlingEnabled = DefaultWriteThrottlingEnabled;
+ SystemRegionInitialSize = DefaultSystemRegionInitialSize;
+ SystemRegionMaxSize = DefaultSystemRegionMaxSize;
+ PageSize = DefaultPageSize;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="DataStorageConfiguration"/> class.
+ /// </summary>
+ /// <param name="reader">The reader.</param>
+ internal DataStorageConfiguration(IBinaryRawReader reader)
+ {
+ Debug.Assert(reader != null);
+
+ StoragePath = reader.ReadString();
+ CheckpointFrequency = reader.ReadLongAsTimespan();
+ CheckpointPageBufferSize = reader.ReadLong();
+ CheckpointThreads = reader.ReadInt();
+ LockWaitTime = reader.ReadLongAsTimespan();
+ WalHistorySize = reader.ReadInt();
+ WalSegments = reader.ReadInt();
+ WalSegmentSize = reader.ReadInt();
+ WalPath = reader.ReadString();
+ WalArchivePath = reader.ReadString();
+ WalMode = (WalMode)reader.ReadInt();
+ WalThreadLocalBufferSize = reader.ReadInt();
+ WalFlushFrequency = reader.ReadLongAsTimespan();
+ WalFsyncDelayNanos = reader.ReadLong();
+ WalRecordIteratorBufferSize = reader.ReadInt();
+ AlwaysWriteFullPages = reader.ReadBoolean();
+ MetricsEnabled = reader.ReadBoolean();
+ MetricsSubIntervalCount = reader.ReadInt();
+ MetricsRateTimeInterval = reader.ReadLongAsTimespan();
+ CheckpointWriteOrder = (CheckpointWriteOrder)reader.ReadInt();
+ WriteThrottlingEnabled = reader.ReadBoolean();
+
+ SystemRegionInitialSize = reader.ReadLong();
+ SystemRegionMaxSize = reader.ReadLong();
+ PageSize = reader.ReadInt();
+ ConcurrencyLevel = reader.ReadInt();
+
+ var count = reader.ReadInt();
+
+ if (count > 0)
+ {
+ DataRegionConfigurations = Enumerable.Range(0, count)
+ .Select(x => new DataRegionConfiguration(reader))
+ .ToArray();
+ }
+
+ if (reader.ReadBoolean())
+ {
+ DefaultDataRegionConfiguration = new DataRegionConfiguration(reader);
+ }
+ }
+
+ /// <summary>
+ /// Writes this instance to the specified writer.
+ /// </summary>
+ /// <param name="writer">The writer.</param>
+ internal void Write(IBinaryRawWriter writer)
+ {
+ Debug.Assert(writer != null);
+
+ writer.WriteString(StoragePath);
+ writer.WriteTimeSpanAsLong(CheckpointFrequency);
+ writer.WriteLong(CheckpointPageBufferSize);
+ writer.WriteInt(CheckpointThreads);
+ writer.WriteTimeSpanAsLong(LockWaitTime);
+ writer.WriteInt(WalHistorySize);
+ writer.WriteInt(WalSegments);
+ writer.WriteInt(WalSegmentSize);
+ writer.WriteString(WalPath);
+ writer.WriteString(WalArchivePath);
+ writer.WriteInt((int)WalMode);
+ writer.WriteInt(WalThreadLocalBufferSize);
+ writer.WriteTimeSpanAsLong(WalFlushFrequency);
+ writer.WriteLong(WalFsyncDelayNanos);
+ writer.WriteInt(WalRecordIteratorBufferSize);
+ writer.WriteBoolean(AlwaysWriteFullPages);
+ writer.WriteBoolean(MetricsEnabled);
+ writer.WriteInt(MetricsSubIntervalCount);
+ writer.WriteTimeSpanAsLong(MetricsRateTimeInterval);
+ writer.WriteInt((int)CheckpointWriteOrder);
+ writer.WriteBoolean(WriteThrottlingEnabled);
+
+ writer.WriteLong(SystemRegionInitialSize);
+ writer.WriteLong(SystemRegionMaxSize);
+ writer.WriteInt(PageSize);
+ writer.WriteInt(ConcurrencyLevel);
+
+ if (DataRegionConfigurations != null)
+ {
+ writer.WriteInt(DataRegionConfigurations.Count);
+
+ foreach (var region in DataRegionConfigurations)
+ {
+ if (region == null)
+ {
+ throw new IgniteException(
+ "DataStorageConfiguration.DataRegionConfigurations must not contain null items.");
+ }
+
+ region.Write(writer);
+ }
+ }
+ else
+ {
+ writer.WriteInt(0);
+ }
+
+ if (DefaultDataRegionConfiguration != null)
+ {
+ writer.WriteBoolean(true);
+ DefaultDataRegionConfiguration.Write(writer);
+ }
+ else
+ {
+ writer.WriteBoolean(false);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the path where data and indexes will be persisted.
+ /// </summary>
+ public string StoragePath { get; set; }
+
+ /// <summary>
+ /// Gets or sets the checkpointing frequency which is a minimal interval when the dirty pages will be written
+ /// to the Persistent Store.
+ /// </summary>
+ [DefaultValue(typeof(TimeSpan), "00:03:00")]
+ public TimeSpan CheckpointFrequency { get; set; }
+
+ /// <summary>
+ /// Gets or sets the size of the checkpointing page buffer.
+ /// <para />
+ /// Default is <c>0</c>: Ignite will choose buffer size automatically.
+ /// </summary>
+ public long CheckpointPageBufferSize { get; set; }
+
+ /// <summary>
+ /// Gets or sets the number of threads for checkpointing.
+ /// </summary>
+ [DefaultValue(DefaultCheckpointThreads)]
+ public int CheckpointThreads { get; set; }
+
+ /// <summary>
+ /// Gets or sets the persistent manager file lock wait time.
+ /// </summary>
+ [DefaultValue(typeof(TimeSpan), "00:00:10")]
+ public TimeSpan LockWaitTime { get; set; }
+
+ /// <summary>
+ /// Gets or sets the number of checkpoints to store in WAL (Write Ahead Log) history.
+ /// </summary>
+ [DefaultValue(DefaultWalHistorySize)]
+ public int WalHistorySize { get; set; }
+
+ /// <summary>
+ /// Gets or sets a number of WAL (Write Ahead Log) segments to work with.
+ /// For performance reasons, the whole WAL is split into files of fixed length called segments.
+ /// </summary>
+ [DefaultValue(DefaultWalSegments)]
+ public int WalSegments { get; set; }
+
+ /// <summary>
+ /// Gets or sets the size of the WAL (Write Ahead Log) segment.
+ /// For performance reasons, the whole WAL is split into files of fixed length called segments.
+ /// </summary>
+ [DefaultValue(DefaultWalSegmentSize)]
+ public int WalSegmentSize { get; set; }
+
+ /// <summary>
+ /// Gets or sets the path to the directory where WAL (Write Ahead Log) is stored.
+ /// </summary>
+ [DefaultValue(DefaultWalPath)]
+ public string WalPath { get; set; }
+
+ /// <summary>
+ /// Gets or sets the path to the directory where WAL (Write Ahead Log) archive is stored.
+ /// Every WAL segment will be fully copied to this directory before it can be reused for WAL purposes.
+ /// </summary>
+ [DefaultValue(DefaultWalArchivePath)]
+ public string WalArchivePath { get; set; }
+
+ /// <summary>
+ /// Gets or sets the WAL (Write Ahead Log) mode.
+ /// </summary>
+ [DefaultValue(DefaultWalMode)]
+ public WalMode WalMode { get; set; }
+
+ /// <summary>
+ /// Gets or sets the size of the TLB (Thread-Local Buffer), in bytes.
+ /// </summary>
+ [DefaultValue(DefaultTlbSize)]
+ public int WalThreadLocalBufferSize { get; set; }
+
+ /// <summary>
+ /// Gets or sets the WAL (Write Ahead Log) flush frequency.
+ /// </summary>
+ [DefaultValue(typeof(TimeSpan), "00:00:02")]
+ public TimeSpan WalFlushFrequency { get; set; }
+
+ /// <summary>
+ /// Gets or sets the WAL (Write Ahead Log) fsync (disk sync) delay, in nanoseconds
+ /// </summary>
+ [DefaultValue(DefaultWalFsyncDelayNanos)]
+ public long WalFsyncDelayNanos { get; set; }
+
+ /// <summary>
+ /// Gets or sets the size of the WAL (Write Ahead Log) record iterator buffer, in bytes.
+ /// </summary>
+ [DefaultValue(DefaultWalRecordIteratorBufferSize)]
+ public int WalRecordIteratorBufferSize { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether full pages should always be written.
+ /// </summary>
+ public bool AlwaysWriteFullPages { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether to enable data storage metrics.
+ /// See <see cref="IIgnite.GetDataStorageMetrics"/>.
+ /// </summary>
+ public bool MetricsEnabled { get; set; }
+
+ /// <summary>
+ /// Gets or sets the length of the time interval for rate-based metrics.
+ /// This interval defines a window over which hits will be tracked.
+ /// </summary>
+ [DefaultValue(typeof(TimeSpan), "00:01:00")]
+ public TimeSpan MetricsRateTimeInterval { get; set; }
+
+ /// <summary>
+ /// Number of sub-intervals to split the <see cref="MetricsRateTimeInterval"/> into to track the update history.
+ /// </summary>
+ [DefaultValue(DefaultMetricsSubIntervalCount)]
+ [SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly",
+ Justification = "Consistency with Java config")]
+ public int MetricsSubIntervalCount { get; set; }
+
+ /// <summary>
+ /// Gets or sets the checkpoint page write order on disk.
+ /// </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; }
+
+ /// <summary>
+ /// Gets or sets the size of a memory chunk reserved for system needs.
+ /// </summary>
+ [DefaultValue(DefaultSystemRegionInitialSize)]
+ public long SystemRegionInitialSize { get; set; }
+
+ /// <summary>
+ /// Gets or sets the maximum memory region size reserved for system needs.
+ /// </summary>
+ [DefaultValue(DefaultSystemRegionMaxSize)]
+ public long SystemRegionMaxSize { get; set; }
+
+ /// <summary>
+ /// Gets or sets the size of the memory page.
+ /// </summary>
+ [DefaultValue(DefaultPageSize)]
+ public int PageSize { get; set; }
+
+ /// <summary>
+ /// Gets or sets the number of concurrent segments in Ignite internal page mapping tables.
+ /// </summary>
+ [DefaultValue(DefaultConcurrencyLevel)]
+ public int ConcurrencyLevel { get; set; }
+
+ /// <summary>
+ /// Gets or sets the data region configurations.
+ /// </summary>
+ [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+ public ICollection<DataRegionConfiguration> DataRegionConfigurations { get; set; }
+
+ /// <summary>
+ /// Gets or sets the default region configuration.
+ /// </summary>
+ public DataRegionConfiguration DefaultDataRegionConfiguration { get; set; }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/WalMode.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/WalMode.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/WalMode.cs
new file mode 100644
index 0000000..d6e4532
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/WalMode.cs
@@ -0,0 +1,45 @@
+/*
+ * 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
+{
+ /// <summary>
+ /// Write Ahead Log mode.
+ /// </summary>
+ public enum WalMode
+ {
+ /// <summary>
+ /// Default mode: full-sync disk writes. These writes survive power loss scenarios.
+ /// </summary>
+ Default,
+
+ /// <summary>
+ /// Log only mode: flushes application buffers. These writes survive process crash.
+ /// </summary>
+ LogOnly,
+
+ /// <summary>
+ /// Background mode. Does not force application buffer flush. Data may be lost in case of process crash.
+ /// </summary>
+ Background,
+
+ /// <summary>
+ /// WAL disabled.
+ /// </summary>
+ None
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core/IDataRegionMetrics.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IDataRegionMetrics.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IDataRegionMetrics.cs
new file mode 100644
index 0000000..0cb6192
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IDataRegionMetrics.cs
@@ -0,0 +1,55 @@
+/*
+ * 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
+{
+ /// <summary>
+ /// Memory usage metrics.
+ /// </summary>
+ public interface IDataRegionMetrics
+ {
+ /// <summary>
+ /// Gets the memory policy name.
+ /// </summary>
+ string Name { get; }
+
+ /// <summary>
+ /// Gets the count of allocated pages.
+ /// </summary>
+ long TotalAllocatedPages { get; }
+
+ /// <summary>
+ /// Gets the allocation rate, in pages per second.
+ /// </summary>
+ float AllocationRate { get; }
+
+ /// <summary>
+ /// Gets the eviction rate, in pages per second.
+ /// </summary>
+ float EvictionRate { get; }
+
+ /// <summary>
+ /// Gets the percentage of pages fully occupied by entries that are larger than page.
+ /// </summary>
+ float LargeEntriesPagesPercentage { get; }
+
+ /// <summary>
+ /// Gets the page fill factor: free space to overall size ratio across all pages.
+ /// </summary>
+ float PageFillFactor { get; }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core/IDataStorageMetrics.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IDataStorageMetrics.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IDataStorageMetrics.cs
new file mode 100644
index 0000000..6f3562d
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IDataStorageMetrics.cs
@@ -0,0 +1,87 @@
+/*
+ * 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
+{
+ using System;
+
+ /// <summary>
+ /// Persistent store metrics.
+ /// </summary>
+ public interface IDataStorageMetrics
+ {
+ /// <summary>
+ /// Gets the average number of WAL records per second written during the last time interval.
+ /// </summary>
+ float WalLoggingRate { get; }
+
+ /// <summary>
+ /// Gets the average number of bytes per second written during the last time interval.
+ /// </summary>
+ float WalWritingRate { get; }
+
+ /// <summary>
+ /// Gets the current number of WAL segments in the WAL archive.
+ /// </summary>
+ int WalArchiveSegments { get; }
+
+ /// <summary>
+ /// Gets the average WAL fsync duration in microseconds over the last time interval.
+ /// </summary>
+ float WalFsyncTimeAverage { get; }
+
+ /// <summary>
+ /// Gets the duration of the last checkpoint.
+ /// </summary>
+ TimeSpan LastCheckpointDuration { get; }
+
+ /// <summary>
+ /// Gets the duration of last checkpoint lock wait.
+ /// </summary>
+ TimeSpan LastCheckpointLockWaitDuration { get; }
+
+ /// <summary>
+ /// Gets the duration of last checkpoint mark phase.
+ /// </summary>
+ TimeSpan LastCheckpointMarkDuration { get; }
+
+ /// <summary>
+ /// Gets the duration of last checkpoint pages write phase.
+ /// </summary>
+ TimeSpan LastCheckpointPagesWriteDuration { get; }
+
+ /// <summary>
+ /// Gets the duration of the sync phase of the last checkpoint.
+ /// </summary>
+ TimeSpan LastCheckpointFsyncDuration { get; }
+
+ /// <summary>
+ /// Gets the total number of pages written during the last checkpoint.
+ /// </summary>
+ long LastCheckpointTotalPagesNumber { get; }
+
+ /// <summary>
+ /// Gets the number of data pages written during the last checkpoint.
+ /// </summary>
+ long LastCheckpointDataPagesNumber { get; }
+
+ /// <summary>
+ /// Gets the number of pages copied to a temporary checkpoint buffer during the last checkpoint.
+ /// </summary>
+ long LastCheckpointCopiedOnWritePagesNumber { get; }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs
index 9548aca..f61da06 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs
@@ -26,6 +26,7 @@ namespace Apache.Ignite.Core
using Apache.Ignite.Core.Cluster;
using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Compute;
+ using Apache.Ignite.Core.Configuration;
using Apache.Ignite.Core.Datastream;
using Apache.Ignite.Core.DataStructures;
using Apache.Ignite.Core.Events;
@@ -336,7 +337,10 @@ namespace Apache.Ignite.Core
/// Gets a collection of memory metrics, one for each <see cref="MemoryConfiguration.MemoryPolicies"/>.
/// <para />
/// Memory metrics should be enabled with <see cref="MemoryPolicyConfiguration.MetricsEnabled"/>.
+ /// <para />
+ /// Obsolete, use <see cref="GetDataRegionMetrics()"/>.
/// </summary>
+ [Obsolete("Use GetDataRegionMetrics.")]
ICollection<IMemoryMetrics> GetMemoryMetrics();
/// <summary>
@@ -344,8 +348,11 @@ namespace Apache.Ignite.Core
/// <para />
/// To get metrics for the default memory region,
/// use <see cref="MemoryConfiguration.DefaultMemoryPolicyName"/>.
+ /// <para />
+ /// Obsolete, use <see cref="GetDataRegionMetrics(string)"/>.
/// </summary>
/// <param name="memoryPolicyName">Name of the memory policy.</param>
+ [Obsolete("Use GetDataRegionMetrics.")]
IMemoryMetrics GetMemoryMetrics(string memoryPolicyName);
/// <summary>
@@ -367,6 +374,32 @@ namespace Apache.Ignite.Core
/// To enable metrics set <see cref="PersistentStoreConfiguration.MetricsEnabled"/> property
/// in <see cref="IgniteConfiguration.PersistentStoreConfiguration"/>.
/// </summary>
+ [Obsolete("Use GetDataStorageMetrics.")]
IPersistentStoreMetrics GetPersistentStoreMetrics();
+
+ /// <summary>
+ /// Gets a collection of memory metrics, one for each
+ /// <see cref="DataStorageConfiguration.DataRegionConfigurations"/>.
+ /// <para />
+ /// Metrics should be enabled with <see cref="DataStorageConfiguration.MetricsEnabled"/>.
+ /// </summary>
+ ICollection<IDataRegionMetrics> GetDataRegionMetrics();
+
+ /// <summary>
+ /// Gets the memory metrics for the specified data region.
+ /// <para />
+ /// To get metrics for the default memory region,
+ /// use <see cref="DataStorageConfiguration.DefaultDataRegionName"/>.
+ /// </summary>
+ /// <param name="dataRegionName">Name of the data region.</param>
+ IDataRegionMetrics GetDataRegionMetrics(string dataRegionName);
+
+ /// <summary>
+ /// Gets the persistent store metrics.
+ /// <para />
+ /// To enable metrics set <see cref="DataStorageConfiguration.MetricsEnabled"/> property
+ /// in <see cref="IgniteConfiguration.DataStorageConfiguration"/>.
+ /// </summary>
+ IDataStorageMetrics GetDataStorageMetrics();
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
index b0fe0df..a6ff324 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
@@ -26,6 +26,7 @@ namespace Apache.Ignite.Core
using System.Linq;
using System.Text;
using System.Xml;
+ using System.Xml.Serialization;
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Cache;
using Apache.Ignite.Core.Cache.Configuration;
@@ -439,6 +440,7 @@ namespace Apache.Ignite.Core
memEventStorage.Write(writer);
}
+#pragma warning disable 618 // Obsolete
if (MemoryConfiguration != null)
{
writer.WriteBoolean(true);
@@ -448,6 +450,7 @@ namespace Apache.Ignite.Core
{
writer.WriteBoolean(false);
}
+#pragma warning restore 618
// SQL connector.
#pragma warning disable 618 // Obsolete
@@ -476,6 +479,7 @@ namespace Apache.Ignite.Core
writer.WriteBoolean(ClientConnectorConfigurationEnabled);
// Persistence.
+#pragma warning disable 618 // Obsolete
if (PersistentStoreConfiguration != null)
{
writer.WriteBoolean(true);
@@ -485,6 +489,18 @@ namespace Apache.Ignite.Core
{
writer.WriteBoolean(false);
}
+#pragma warning restore 618
+
+ // Data storage.
+ if (DataStorageConfiguration != null)
+ {
+ writer.WriteBoolean(true);
+ DataStorageConfiguration.Write(writer);
+ }
+ else
+ {
+ writer.WriteBoolean(false);
+ }
// Plugins (should be last).
if (PluginConfigurations != null)
@@ -675,7 +691,9 @@ namespace Apache.Ignite.Core
if (r.ReadBoolean())
{
+#pragma warning disable 618 // Obsolete
MemoryConfiguration = new MemoryConfiguration(r);
+#pragma warning restore 618 // Obsolete
}
// SQL.
@@ -697,7 +715,15 @@ namespace Apache.Ignite.Core
// Persistence.
if (r.ReadBoolean())
{
+#pragma warning disable 618 // Obsolete
PersistentStoreConfiguration = new PersistentStoreConfiguration(r);
+#pragma warning restore 618
+ }
+
+ // Data storage.
+ if (r.ReadBoolean())
+ {
+ DataStorageConfiguration = new DataStorageConfiguration(r);
}
}
@@ -793,6 +819,7 @@ namespace Apache.Ignite.Core
/// This property is used to when there are multiple Ignite nodes in one process to distinguish them.
/// </summary>
[Obsolete("Use IgniteInstanceName instead.")]
+ [XmlIgnore]
public string GridName
{
get { return IgniteInstanceName; }
@@ -1243,10 +1270,18 @@ namespace Apache.Ignite.Core
/// <summary>
/// Gets or sets the page memory configuration.
/// <see cref="MemoryConfiguration"/> for more details.
+ /// <para />
+ /// Obsolete, use <see cref="DataStorageConfiguration"/>.
/// </summary>
+ [Obsolete("Use DataStorageConfiguration.")]
public MemoryConfiguration MemoryConfiguration { get; set; }
/// <summary>
+ /// Gets or sets the data storage configuration.
+ /// </summary>
+ public DataStorageConfiguration DataStorageConfiguration { get; set; }
+
+ /// <summary>
/// Gets or sets a value indicating how user assemblies should be loaded on remote nodes.
/// <para />
/// For example, when executing <see cref="ICompute.Call{TRes}(IComputeFunc{TRes})"/>,
@@ -1374,14 +1409,17 @@ namespace Apache.Ignite.Core
/// <summary>
/// Gets or sets the persistent store configuration.
+ /// <para />
+ /// Obsolete, use <see cref="DataStorageConfiguration"/>.
/// </summary>
+ [Obsolete("Use DataStorageConfiguration.")]
public PersistentStoreConfiguration PersistentStoreConfiguration { get; set; }
/// <summary>
/// Gets or sets a value indicating whether grid should be active on start.
/// See also <see cref="IIgnite.IsActive"/> and <see cref="IIgnite.SetActive"/>.
/// <para />
- /// This property is ignored when <see cref="PersistentStoreConfiguration"/> is present:
+ /// This property is ignored when <see cref="DataStorageConfiguration"/> is present:
/// cluster is always inactive on start when Ignite Persistence is enabled.
/// </summary>
[DefaultValue(DefaultIsActiveOnStart)]
[37/50] [abbrv] ignite git commit: IGNITE-6512 Add an option to start
caches in inactive state - Fixes #2772.
Posted by sb...@apache.org.
IGNITE-6512 Add an option to start caches in inactive state - Fixes #2772.
Signed-off-by: Alexey Goncharuk <al...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/fcabfcad
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/fcabfcad
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/fcabfcad
Branch: refs/heads/ignite-3478-tree
Commit: fcabfcade8840375aad6b37e7ee2cd52cf1f6066
Parents: 7a61c15
Author: Ivan Rakov <ir...@gridgain.com>
Authored: Mon Oct 23 17:11:05 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Oct 23 17:11:05 2017 +0300
----------------------------------------------------------------------
.../apache/ignite/internal/IgniteKernal.java | 2 +
.../cache/CacheAffinitySharedManager.java | 6 +-
.../cache/DynamicCacheChangeRequest.java | 17 ++++
.../processors/cache/GridCacheAdapter.java | 17 ++++
.../processors/cache/GridCacheProcessor.java | 98 +++++++++++++++-----
5 files changed, 117 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fcabfcad/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 8a71e1a..ba42a95 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -2863,6 +2863,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
ctx.cache().dynamicStartCaches(cacheCfgs,
true,
+ true,
true).get();
List<IgniteCache> createdCaches = new ArrayList<>(cacheCfgs.size());
@@ -2953,6 +2954,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
ctx.cache().dynamicStartCaches(cacheCfgs,
false,
+ true,
true).get();
List<IgniteCache> createdCaches = new ArrayList<>(cacheCfgs.size());
http://git-wip-us.apache.org/repos/asf/ignite/blob/fcabfcad/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
index eaaa24d..7266f99 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
@@ -428,7 +428,8 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
cctx.cache().prepareCacheStart(desc.cacheConfiguration(),
desc,
startReq.nearCacheConfiguration(),
- topVer);
+ topVer,
+ startReq.activeAfterStart());
startedInfos.put(desc.cacheId(), startReq.nearCacheConfiguration() != null);
@@ -751,7 +752,8 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
cctx.cache().prepareCacheStart(req.startCacheConfiguration(),
cacheDesc,
nearCfg,
- evts.topologyVersion());
+ evts.topologyVersion(),
+ req.activeAfterStart());
if (fut.cacheAddedOnExchange(cacheDesc.cacheId(), cacheDesc.receivedFrom())) {
if (fut.events().discoveryCache().cacheGroupAffinityNodes(cacheDesc.groupId()).isEmpty())
http://git-wip-us.apache.org/repos/asf/ignite/blob/fcabfcad/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
index 2fd8780..cfc2d07 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
@@ -68,6 +68,9 @@ public class DynamicCacheChangeRequest implements Serializable {
/** Restart flag. */
private boolean restart;
+ /** Cache active on start or not*/
+ private boolean activeAfterStart = true;
+
/** Destroy. */
private boolean destroy;
@@ -404,6 +407,20 @@ public class DynamicCacheChangeRequest implements Serializable {
this.locallyConfigured = locallyConfigured;
}
+ /**
+ * @return state of cache after start
+ */
+ public boolean activeAfterStart() {
+ return activeAfterStart;
+ }
+
+ /**
+ * @param activeAfterStart state of cache after start
+ */
+ public void activeAfterStart(boolean activeAfterStart) {
+ this.activeAfterStart = activeAfterStart;
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return "DynamicCacheChangeRequest [cacheName=" + cacheName() +
http://git-wip-us.apache.org/repos/asf/ignite/blob/fcabfcad/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 9bdce35..e9c86b7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -286,6 +286,9 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/** Asynchronous operations limit semaphore. */
private Semaphore asyncOpsSem;
+ /** Active. */
+ private volatile boolean active;
+
/** {@inheritDoc} */
@Override public String name() {
return cacheCfg.getName();
@@ -448,6 +451,20 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
}
/**
+ *
+ */
+ public boolean active() {
+ return active;
+ }
+
+ /**
+ * @param active Active.
+ */
+ public void active(boolean active) {
+ this.active = active;
+ }
+
+ /**
* @return Preloader.
*/
public abstract GridCachePreloader preloader();
http://git-wip-us.apache.org/repos/asf/ignite/blob/fcabfcad/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index ad8f74a..d4d65dc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -1292,6 +1292,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
* @param cacheObjCtx Cache object context.
* @param affNode {@code True} if local node affinity node.
* @param updatesAllowed Updates allowed flag.
+ * @param activeOnStart If true, then we will discard restarting state from proxies. If false then we will change
+ * state of proxies to restarting
* @return Cache context.
* @throws IgniteCheckedException If failed to create cache.
*/
@@ -1302,7 +1304,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
AffinityTopologyVersion locStartTopVer,
CacheObjectContext cacheObjCtx,
boolean affNode,
- boolean updatesAllowed)
+ boolean updatesAllowed,
+ boolean activeOnStart)
throws IgniteCheckedException {
assert cfg != null;
@@ -1461,6 +1464,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
}
+ cache.active(activeOnStart);
+
cacheCtx.cache(cache);
GridCacheContext<?, ?> ret = cacheCtx;
@@ -1682,8 +1687,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
desc.cacheConfiguration(),
desc,
t.get2(),
- exchTopVer
- );
+ exchTopVer,
+ true);
}
}
}
@@ -1716,8 +1721,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
desc.cacheConfiguration(),
desc,
null,
- exchTopVer
- );
+ exchTopVer,
+ true);
}
}
@@ -1729,22 +1734,21 @@ public class GridCacheProcessor extends GridProcessorAdapter {
* @param desc Cache descriptor.
* @param reqNearCfg Near configuration if specified for client cache start request.
* @param exchTopVer Current exchange version.
+ * @param activeOnStart If true, then we will discard restarting state from proxies. If false then we will change
+ * state of proxies to restarting
* @throws IgniteCheckedException If failed.
*/
void prepareCacheStart(
CacheConfiguration startCfg,
DynamicCacheDescriptor desc,
@Nullable NearCacheConfiguration reqNearCfg,
- AffinityTopologyVersion exchTopVer
+ AffinityTopologyVersion exchTopVer,
+ boolean activeOnStart
) throws IgniteCheckedException {
assert !caches.containsKey(startCfg.getName()) : startCfg.getName();
CacheConfiguration ccfg = new CacheConfiguration(startCfg);
- IgniteCacheProxyImpl<?, ?> proxy = jCacheProxies.get(ccfg.getName());
-
- boolean proxyRestart = proxy != null && proxy.isRestarting() && !caches.containsKey(ccfg.getName());
-
CacheObjectContext cacheObjCtx = ctx.cacheObjects().contextForCache(ccfg);
boolean affNode;
@@ -1803,7 +1807,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
exchTopVer,
cacheObjCtx,
affNode,
- true);
+ true,
+ activeOnStart
+ );
cacheCtx.dynamicDeploymentId(desc.deploymentId());
@@ -1819,11 +1825,35 @@ public class GridCacheProcessor extends GridProcessorAdapter {
onKernalStart(cache);
- if (proxyRestart)
+ IgniteCacheProxyImpl<?, ?> proxy = jCacheProxies.get(ccfg.getName());
+
+ if (activeOnStart && proxy != null && proxy.isRestarting())
proxy.onRestarted(cacheCtx, cache);
}
/**
+ * Restarts proxies of caches if they was marked as restarting.
+ * Requires external synchronization - shouldn't be called concurrently with another caches restart.
+ */
+ public void restartProxies() {
+ for (IgniteCacheProxyImpl<?, ?> proxy : jCacheProxies.values()) {
+ if (proxy == null)
+ continue;
+
+ GridCacheContext<?, ?> cacheCtx = sharedCtx.cacheContext(CU.cacheId(proxy.getName()));
+
+ if (cacheCtx == null)
+ continue;
+
+ if (proxy.isRestarting()) {
+ caches.get(proxy.getName()).active(true);
+
+ proxy.onRestarted(cacheCtx, cacheCtx.cache());
+ }
+ }
+ }
+
+ /**
* @param desc Group descriptor.
* @param cacheType Cache type.
* @param affNode Affinity node flag.
@@ -1882,6 +1912,13 @@ public class GridCacheProcessor extends GridProcessorAdapter {
// Break the proxy before exchange future is done.
IgniteCacheProxyImpl<?, ?> proxy = jCacheProxies.get(cacheName);
+ if (restart) {
+ GridCacheAdapter<?, ?> cache = caches.get(cacheName);
+
+ if (cache != null)
+ cache.active(false);
+ }
+
if (proxy != null) {
if (stop) {
if (restart)
@@ -1905,6 +1942,11 @@ public class GridCacheProcessor extends GridProcessorAdapter {
// Break the proxy before exchange future is done.
if (req.restart()) {
+ GridCacheAdapter<?, ?> cache = caches.get(req.cacheName());
+
+ if (cache != null)
+ cache.active(false);
+
proxy = jCacheProxies.get(req.cacheName());
if (proxy != null)
@@ -1949,8 +1991,14 @@ public class GridCacheProcessor extends GridProcessorAdapter {
GridCacheContext<?, ?> cacheCtx = cache.context();
if (cacheCtx.startTopologyVersion().equals(startTopVer) ) {
- if (!jCacheProxies.containsKey(cacheCtx.name()))
- jCacheProxies.putIfAbsent(cacheCtx.name(), new IgniteCacheProxyImpl(cache.context(), cache, false));
+ if (!jCacheProxies.containsKey(cacheCtx.name())) {
+ IgniteCacheProxyImpl newProxy = new IgniteCacheProxyImpl(cache.context(), cache, false);
+
+ if (!cache.active())
+ newProxy.restart();
+
+ jCacheProxies.putIfAbsent(cacheCtx.name(), newProxy);
+ }
if (cacheCtx.preloader() != null)
cacheCtx.preloader().onInitialExchangeComplete(err);
@@ -2497,7 +2545,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
cacheType,
sql,
failIfExists,
- failIfNotStarted);
+ failIfNotStarted,
+ true);
if (req != null) {
if (req.clientStartOnly())
@@ -2544,11 +2593,12 @@ public class GridCacheProcessor extends GridProcessorAdapter {
* @param ccfgList Collection of cache configuration.
* @param failIfExists Fail if exists flag.
* @param checkThreadTx If {@code true} checks that current thread does not have active transactions.
+ * @param activeAfterStart If true, cache proxies will be only activated after {@link #restartProxies()}.
* @return Future that will be completed when all caches are deployed.
*/
public IgniteInternalFuture<?> dynamicStartCaches(Collection<CacheConfiguration> ccfgList, boolean failIfExists,
- boolean checkThreadTx) {
- return dynamicStartCaches(ccfgList, null, failIfExists, checkThreadTx);
+ boolean checkThreadTx, boolean activeAfterStart) {
+ return dynamicStartCaches(ccfgList, null, failIfExists, checkThreadTx, activeAfterStart);
}
/**
@@ -2558,13 +2608,15 @@ public class GridCacheProcessor extends GridProcessorAdapter {
* @param cacheType Cache type.
* @param failIfExists Fail if exists flag.
* @param checkThreadTx If {@code true} checks that current thread does not have active transactions.
+ * @param activeAfterStart If true, cache proxies will be only activated after {@link #restartProxies()}.
* @return Future that will be completed when all caches are deployed.
*/
private IgniteInternalFuture<?> dynamicStartCaches(
Collection<CacheConfiguration> ccfgList,
CacheType cacheType,
boolean failIfExists,
- boolean checkThreadTx
+ boolean checkThreadTx,
+ boolean activeAfterStart
) {
if (checkThreadTx)
checkEmptyTransactions();
@@ -2592,8 +2644,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
ct,
false,
failIfExists,
- true
- );
+ true,
+ activeAfterStart);
if (req != null) {
if (req.clientStartOnly()) {
@@ -3755,6 +3807,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
* @param sql Whether the cache needs to be created as the result of SQL {@code CREATE TABLE} command.
* @param failIfExists Fail if exists flag.
* @param failIfNotStarted If {@code true} fails if cache is not started.
+ * @param activeAfterStart If true, cache proxies will be only activated after {@link #restartProxies()}.
* @return Request or {@code null} if cache already exists.
* @throws IgniteCheckedException if some of pre-checks failed
* @throws CacheExistsException if cache exists and failIfExists flag is {@code true}
@@ -3766,7 +3819,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
CacheType cacheType,
boolean sql,
boolean failIfExists,
- boolean failIfNotStarted
+ boolean failIfNotStarted,
+ boolean activeAfterStart
) throws IgniteCheckedException {
DynamicCacheDescriptor desc = cacheDescriptor(cacheName);
@@ -3776,6 +3830,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
req.failIfExists(failIfExists);
+ req.activeAfterStart(activeAfterStart);
+
if (ccfg != null) {
cloneCheckSerializable(ccfg);
[09/50] [abbrv] ignite git commit: IGNITE-6658 Add a version of
Ignite instance to logger category
Posted by sb...@apache.org.
IGNITE-6658 Add a version of Ignite instance to logger category
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b8128e1f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b8128e1f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b8128e1f
Branch: refs/heads/ignite-3478-tree
Commit: b8128e1f52103a8cf79ca888841903b4f3940656
Parents: 92cbc6b
Author: Vyacheslav Daradur <da...@gmail.com>
Authored: Thu Oct 19 16:25:34 2017 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Thu Oct 19 16:25:34 2017 +0300
----------------------------------------------------------------------
.../testframework/junits/IgniteCompatibilityAbstractTest.java | 6 +++---
.../testframework/junits/IgniteCompatibilityNodeRunner.java | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b8128e1f/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityAbstractTest.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityAbstractTest.java
index 07d63fd..d637d31 100644
--- a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityAbstractTest.java
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityAbstractTest.java
@@ -46,7 +46,7 @@ public abstract class IgniteCompatibilityAbstractTest extends GridCommonAbstract
private static final ClassLoader CLASS_LOADER = IgniteCompatibilityAbstractTest.class.getClassLoader();
/** Using for synchronization of nodes startup in case of starting remote nodes first. */
- public static final String SYNCHRONIZATION_LOG_MESSAGE_PREPARED = "[Compatibility] Node has been started, id=";
+ public static final String SYNCHRONIZATION_LOG_MESSAGE = "[Compatibility] Node has been started, id=";
/** Waiting milliseconds of the join of a node to topology. */
protected static final int NODE_JOIN_TIMEOUT = 30_000;
@@ -139,7 +139,7 @@ public abstract class IgniteCompatibilityAbstractTest extends GridCommonAbstract
IgniteProcessProxy ignite = new IgniteProcessProxy(cfg, log, locJvmInstance, true) {
@Override protected IgniteLogger logger(IgniteLogger log, Object ctgr) {
- return ListenedGridTestLog4jLogger.createLogger(ctgr);
+ return ListenedGridTestLog4jLogger.createLogger(ctgr + "#" + ver.replaceAll("\\.", "_"));
}
@Override protected String igniteNodeRunnerClassName() throws Exception {
@@ -271,7 +271,7 @@ public abstract class IgniteCompatibilityAbstractTest extends GridCommonAbstract
*/
LoggedJoinNodeClosure(CountDownLatch nodeJoinedLatch, UUID nodeId) {
this.nodeJoinedLatch = nodeJoinedLatch;
- this.pattern = SYNCHRONIZATION_LOG_MESSAGE_PREPARED + nodeId;
+ this.pattern = SYNCHRONIZATION_LOG_MESSAGE + nodeId;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/b8128e1f/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityNodeRunner.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityNodeRunner.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityNodeRunner.java
index 3256d06..3b5010b 100644
--- a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityNodeRunner.java
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityNodeRunner.java
@@ -100,7 +100,7 @@ public class IgniteCompatibilityNodeRunner extends IgniteNodeRunner {
clo.apply(ignite);
}
- X.println(IgniteCompatibilityAbstractTest.SYNCHRONIZATION_LOG_MESSAGE_PREPARED + nodeId);
+ X.println(IgniteCompatibilityAbstractTest.SYNCHRONIZATION_LOG_MESSAGE + nodeId);
}
/**
[26/50] [abbrv] ignite git commit: IGNITE-6515 .NET: Enable
persistence on per-cache basis
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/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 988fa1f..6ede267 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
@@ -759,9 +759,9 @@
<xs:documentation>Value indicating whether statistics gathering is enabled on a cache. These statistics can be retrieved via ICache.GetMetrics().</xs:documentation>
</xs:annotation>
</xs:attribute>
- <xs:attribute name="memoryPolicyName" type="xs:string">
+ <xs:attribute name="dataRegionName" type="xs:string">
<xs:annotation>
- <xs:documentation>Name of the MemoryPolicyConfiguration for this cache.</xs:documentation>
+ <xs:documentation>Name of the DataRegionConfiguration for this cache.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="partitionLossPolicy" type="partitionLossPolicy">
@@ -1380,7 +1380,7 @@
</xs:element>
<xs:element name="persistentStoreConfiguration" minOccurs="0">
<xs:annotation>
- <xs:documentation>Persistent store configuration.</xs:documentation>
+ <xs:documentation>Persistent store configuration. Obsolete, use DataStorageConfiguration.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:attribute name="persistentStorePath" type="xs:string">
@@ -1490,6 +1490,273 @@
</xs:attribute>
</xs:complexType>
</xs:element>
+ <xs:element name="dataStorageConfiguration" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>Data storage configuration.</xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:all>
+ <xs:element name="defaultDataRegionConfiguration">
+ <xs:annotation>
+ <xs:documentation>Default data region configuration.</xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:attribute name="emptyPagesPoolSize" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Minimal number of empty pages to be present in reuse lists for this memory policy.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="evictionThreshold" type="xs:double">
+ <xs:annotation>
+ <xs:documentation>Threshold for memory pages eviction initiation. For instance, if the threshold is 0.9 it means that the page memory will start the eviction only after 90% of the memory region (defined by this policy) is occupied.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="name" type="xs:string" use="required">
+ <xs:annotation>
+ <xs:documentation>Data region name.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="pageEvictionMode" type="dataPageEvictionMode">
+ <xs:annotation>
+ <xs:documentation>Page eviction mode.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="initialSize" type="xs:long">
+ <xs:annotation>
+ <xs:documentation>Initial data region size.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="maxSize" type="xs:long">
+ <xs:annotation>
+ <xs:documentation>Maximum data region size.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="swapPath" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Path to the directory for memory-mapped files.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="metricsEnabled" type="xs:boolean">
+ <xs:annotation>
+ <xs:documentation>Enable memory metrics.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="metricsSubIntervalCount" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Number of sub intervals to split RateTimeInterval into.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="metricsRateTimeInterval" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Rate time interval for AllocationRate and EvictionRate monitoring.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="persistenceEnabled" type="xs:boolean">
+ <xs:annotation>
+ <xs:documentation>Enable disk persistence for this region.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="dataRegionConfigurations">
+ <xs:annotation>
+ <xs:documentation>Data region configurations.</xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="unbounded" name="dataRegionConfiguration">
+ <xs:annotation>
+ <xs:documentation>Data region configuration.</xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:attribute name="emptyPagesPoolSize" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Minimal number of empty pages to be present in reuse lists for this memory policy.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="evictionThreshold" type="xs:double">
+ <xs:annotation>
+ <xs:documentation>Threshold for memory pages eviction initiation. For instance, if the threshold is 0.9 it means that the page memory will start the eviction only after 90% of the memory region (defined by this policy) is occupied.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="name" type="xs:string" use="required">
+ <xs:annotation>
+ <xs:documentation>Data region name.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="pageEvictionMode" type="dataPageEvictionMode">
+ <xs:annotation>
+ <xs:documentation>Page eviction mode.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="initialSize" type="xs:long">
+ <xs:annotation>
+ <xs:documentation>Initial data region size.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="maxSize" type="xs:long">
+ <xs:annotation>
+ <xs:documentation>Maximum data region size.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="swapPath" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Path to the directory for memory-mapped files.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="metricsEnabled" type="xs:boolean">
+ <xs:annotation>
+ <xs:documentation>Enable memory metrics.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="metricsSubIntervalCount" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Number of sub intervals to split RateTimeInterval into.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="metricsRateTimeInterval" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Rate time interval for AllocationRate and EvictionRate monitoring.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="persistenceEnabled" type="xs:boolean">
+ <xs:annotation>
+ <xs:documentation>Enable disk persistence for this region.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:all>
+ <xs:attribute name="storagePath" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Path where data and indexes will be persisted.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="checkpointFrequency" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Checkpointing frequency which is a minimal interval when the dirty pages will be written to the Persistent Store.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="checkpointPageBufferSize" type="xs:long">
+ <xs:annotation>
+ <xs:documentation>Size of the checkpointing page buffer.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="checkpointThreads" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Number of threads for checkpointing.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="lockWaitTime" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Persistent manager file lock wait time.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="walHistorySize" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Number of checkpoints to store in WAL (Write Ahead Log) history.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="walSegments" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Number of WAL (Write Ahead Log) segments to work with.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="walSegmentSize" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Size of the WAL (Write Ahead Log) segment.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="walPath" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Path to the directory where WAL (Write Ahead Log) is stored.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="walArchivePath" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Path to the directory where WAL (Write Ahead Log) archive is stored.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="walMode" type="walMode">
+ <xs:annotation>
+ <xs:documentation>WAL (Write Ahead Log) mode.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="walThreadLocalBufferSize" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Size of the TLB (Thread-Local Buffer), in bytes.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="walFlushFrequency" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>WAL (Write Ahead Log) flush frequency.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="walFsyncDelayNanos" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>WAL (Write Ahead Log) fsync (disk sync) delay, in nanoseconds.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="walRecordIteratorBufferSize" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Size of the WAL (Write Ahead Log) record iterator buffer, in bytes.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="alwaysWriteFullPages" type="xs:boolean">
+ <xs:annotation>
+ <xs:documentation>Whether full pages should always be written.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="metricsEnabled" type="xs:boolean">
+ <xs:annotation>
+ <xs:documentation>Enable persistent store metrics.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="metricsSubIntervalCount" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Number of sub intervals to split RateTimeInterval into.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="metricsRateTimeInterval" type="xs:string">
+ <xs:annotation>
+ <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: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:attribute name="pageSize" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Size of the memory page.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="systemRegionInitialSize" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Initial size of a memory region reserved for system needs.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="systemRegionMaxSize" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Maximum size of a memory region reserved for system needs.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="concurrencyLevel" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Number of concurrent segments in Ignite internal page mapping tables.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
<xs:element name="pluginConfigurations" minOccurs="0">
<xs:annotation>
<xs:documentation>Plugin configurations.</xs:documentation>
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/MemoryMetrics.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/MemoryMetrics.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/MemoryMetrics.cs
index ae9f85c..9785909 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/MemoryMetrics.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/MemoryMetrics.cs
@@ -24,7 +24,9 @@ namespace Apache.Ignite.Core.Impl.Cache
/// <summary>
/// Memory metrics.
/// </summary>
+#pragma warning disable 618
internal class MemoryMetrics : IMemoryMetrics
+#pragma warning restore 618
{
/// <summary>
/// Initializes a new instance of the <see cref="MemoryMetrics"/> class.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs
index b32d331..cc25a6e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs
@@ -145,6 +145,15 @@ namespace Apache.Ignite.Core.Impl.Cluster
/** */
private const int OpGetServices = 34;
+ /** */
+ private const int OpDataRegionMetrics = 35;
+
+ /** */
+ private const int OpDataRegionMetricsByName = 36;
+
+ /** */
+ private const int OpDataStorageMetrics = 37;
+
/** Initial Ignite instance. */
private readonly IIgniteInternal _ignite;
@@ -597,6 +606,7 @@ namespace Apache.Ignite.Core.Impl.Cluster
/// <summary>
/// Gets the memory metrics.
/// </summary>
+#pragma warning disable 618
public ICollection<IMemoryMetrics> GetMemoryMetrics()
{
return DoInOp(OpMemoryMetrics, stream =>
@@ -624,6 +634,47 @@ namespace Apache.Ignite.Core.Impl.Cluster
return DoOutInOp(OpMemoryMetricsByName, w => w.WriteString(memoryPolicyName),
stream => stream.ReadBool() ? new MemoryMetrics(Marshaller.StartUnmarshal(stream, false)) : null);
}
+#pragma warning restore 618
+
+ /// <summary>
+ /// Gets the data region metrics.
+ /// </summary>
+ public ICollection<IDataRegionMetrics> GetDataRegionMetrics()
+ {
+ return DoInOp(OpDataRegionMetrics, stream =>
+ {
+ IBinaryRawReader reader = Marshaller.StartUnmarshal(stream, false);
+
+ var cnt = reader.ReadInt();
+
+ var res = new List<IDataRegionMetrics>(cnt);
+
+ for (int i = 0; i < cnt; i++)
+ {
+ res.Add(new DataRegionMetrics(reader));
+ }
+
+ return res;
+ });
+ }
+
+ /// <summary>
+ /// Gets the data region metrics.
+ /// </summary>
+ public IDataRegionMetrics GetDataRegionMetrics(string memoryPolicyName)
+ {
+ return DoOutInOp(OpDataRegionMetricsByName, w => w.WriteString(memoryPolicyName),
+ stream => stream.ReadBool() ? new DataRegionMetrics(Marshaller.StartUnmarshal(stream, false)) : null);
+ }
+
+ /// <summary>
+ /// Gets the data storage metrics.
+ /// </summary>
+ public IDataStorageMetrics GetDataStorageMetrics()
+ {
+ return DoInOp(OpDataStorageMetrics, stream =>
+ new DataStorageMetrics(Marshaller.StartUnmarshal(stream, false)));
+ }
/// <summary>
/// Changes Ignite grid state to active or inactive.
@@ -647,11 +698,13 @@ namespace Apache.Ignite.Core.Impl.Cluster
/// <summary>
/// Gets the persistent store metrics.
/// </summary>
+#pragma warning disable 618
public IPersistentStoreMetrics GetPersistentStoreMetrics()
{
return DoInOp(OpGetPersistentStoreMetrics, stream =>
new PersistentStoreMetrics(Marshaller.StartUnmarshal(stream, false)));
}
+#pragma warning restore 618
/// <summary>
/// Creates new Cluster Group from given native projection.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs
index a2f7143..be1a7f1 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs
@@ -26,6 +26,7 @@ namespace Apache.Ignite.Core.Impl.Common
using System.Linq;
using System.Reflection;
using System.Xml;
+ using System.Xml.Serialization;
using Apache.Ignite.Core.Events;
using Apache.Ignite.Core.Impl.Binary;
using Apache.Ignite.Core.Impl.Events;
@@ -90,7 +91,7 @@ namespace Apache.Ignite.Core.Impl.Common
if (!property.CanWrite && !IsKeyValuePair(property.DeclaringType))
return;
- if (IsObsolete(property))
+ if (IsIgnored(property))
return;
}
@@ -169,7 +170,7 @@ namespace Apache.Ignite.Core.Impl.Common
}
// Write attributes
- foreach (var prop in props.Where(p => IsBasicType(p.PropertyType) && !IsObsolete(p)))
+ foreach (var prop in props.Where(p => IsBasicType(p.PropertyType) && !IsIgnored(p)))
{
var converter = GetConverter(prop, prop.PropertyType);
var stringValue = converter.ConvertToInvariantString(prop.GetValue(obj, null));
@@ -557,13 +558,13 @@ namespace Apache.Ignite.Core.Impl.Common
}
/// <summary>
- /// Determines whether the specified property is obsolete.
+ /// Determines whether the specified property is marked with XmlIgnore.
/// </summary>
- private static bool IsObsolete(PropertyInfo property)
+ private static bool IsIgnored(PropertyInfo property)
{
Debug.Assert(property != null);
- return property.GetCustomAttributes(typeof(ObsoleteAttribute), true).Any();
+ return property.GetCustomAttributes(typeof(XmlIgnoreAttribute), true).Any();
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataRegionMetrics.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataRegionMetrics.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataRegionMetrics.cs
new file mode 100644
index 0000000..7b174a6
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataRegionMetrics.cs
@@ -0,0 +1,61 @@
+/*
+ * 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.Impl
+{
+ using System.Diagnostics;
+ using Apache.Ignite.Core.Binary;
+
+ /// <summary>
+ /// Data region metrics.
+ /// </summary>
+ internal class DataRegionMetrics : IDataRegionMetrics
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="DataRegionMetrics"/> class.
+ /// </summary>
+ public DataRegionMetrics(IBinaryRawReader reader)
+ {
+ Debug.Assert(reader != null);
+
+ Name = reader.ReadString();
+ TotalAllocatedPages = reader.ReadLong();
+ AllocationRate = reader.ReadFloat();
+ EvictionRate = reader.ReadFloat();
+ LargeEntriesPagesPercentage = reader.ReadFloat();
+ PageFillFactor = reader.ReadFloat();
+ }
+
+ /** <inheritdoc /> */
+ public string Name { get; private set; }
+
+ /** <inheritdoc /> */
+ public long TotalAllocatedPages { get; private set; }
+
+ /** <inheritdoc /> */
+ public float AllocationRate { get; private set; }
+
+ /** <inheritdoc /> */
+ public float EvictionRate { get; private set; }
+
+ /** <inheritdoc /> */
+ public float LargeEntriesPagesPercentage { get; private set; }
+
+ /** <inheritdoc /> */
+ public float PageFillFactor { get; private set; }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStorageMetrics.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStorageMetrics.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStorageMetrics.cs
new file mode 100644
index 0000000..58b3b37
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStorageMetrics.cs
@@ -0,0 +1,87 @@
+/*
+ * 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.Impl
+{
+ using System;
+ using System.Diagnostics;
+ using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Impl.Binary;
+
+ /// <summary>
+ /// Data storage metrics.
+ /// </summary>
+ internal class DataStorageMetrics : IDataStorageMetrics
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="DataStorageMetrics"/> class.
+ /// </summary>
+ public DataStorageMetrics(IBinaryRawReader reader)
+ {
+ Debug.Assert(reader != null);
+
+ WalLoggingRate = reader.ReadFloat();
+ WalWritingRate = reader.ReadFloat();
+ WalArchiveSegments = reader.ReadInt();
+ WalFsyncTimeAverage = reader.ReadFloat();
+ LastCheckpointDuration = reader.ReadLongAsTimespan();
+ LastCheckpointLockWaitDuration = reader.ReadLongAsTimespan();
+ LastCheckpointMarkDuration = reader.ReadLongAsTimespan();
+ LastCheckpointPagesWriteDuration = reader.ReadLongAsTimespan();
+ LastCheckpointFsyncDuration = reader.ReadLongAsTimespan();
+ LastCheckpointTotalPagesNumber = reader.ReadLong();
+ LastCheckpointDataPagesNumber = reader.ReadLong();
+ LastCheckpointCopiedOnWritePagesNumber = reader.ReadLong();
+ }
+
+ /** <inheritdoc /> */
+ public float WalLoggingRate { get; private set; }
+
+ /** <inheritdoc /> */
+ public float WalWritingRate { get; private set; }
+
+ /** <inheritdoc /> */
+ public int WalArchiveSegments { get; private set; }
+
+ /** <inheritdoc /> */
+ public float WalFsyncTimeAverage { get; private set; }
+
+ /** <inheritdoc /> */
+ public TimeSpan LastCheckpointDuration { get; private set; }
+
+ /** <inheritdoc /> */
+ public TimeSpan LastCheckpointLockWaitDuration { get; private set; }
+
+ /** <inheritdoc /> */
+ public TimeSpan LastCheckpointMarkDuration { get; private set; }
+
+ /** <inheritdoc /> */
+ public TimeSpan LastCheckpointPagesWriteDuration { get; private set; }
+
+ /** <inheritdoc /> */
+ public TimeSpan LastCheckpointFsyncDuration { get; private set; }
+
+ /** <inheritdoc /> */
+ public long LastCheckpointTotalPagesNumber { get; private set; }
+
+ /** <inheritdoc /> */
+ public long LastCheckpointDataPagesNumber { get; private set; }
+
+ /** <inheritdoc /> */
+ public long LastCheckpointCopiedOnWritePagesNumber { get; private set; }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
index 1b42462..78b7c74 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
@@ -752,6 +752,7 @@ namespace Apache.Ignite.Core.Impl
}
/** <inheritdoc /> */
+#pragma warning disable 618
public ICollection<IMemoryMetrics> GetMemoryMetrics()
{
return _prj.GetMemoryMetrics();
@@ -764,6 +765,7 @@ namespace Apache.Ignite.Core.Impl
return _prj.GetMemoryMetrics(memoryPolicyName);
}
+#pragma warning restore 618
/** <inheritdoc /> */
public void SetActive(bool isActive)
@@ -778,10 +780,30 @@ namespace Apache.Ignite.Core.Impl
}
/** <inheritdoc /> */
+#pragma warning disable 618
public IPersistentStoreMetrics GetPersistentStoreMetrics()
{
return _prj.GetPersistentStoreMetrics();
}
+#pragma warning restore 618
+
+ /** <inheritdoc /> */
+ public ICollection<IDataRegionMetrics> GetDataRegionMetrics()
+ {
+ return _prj.GetDataRegionMetrics();
+ }
+
+ /** <inheritdoc /> */
+ public IDataRegionMetrics GetDataRegionMetrics(string memoryPolicyName)
+ {
+ return _prj.GetDataRegionMetrics(memoryPolicyName);
+ }
+
+ /** <inheritdoc /> */
+ public IDataStorageMetrics GetDataStorageMetrics()
+ {
+ return _prj.GetDataStorageMetrics();
+ }
/// <summary>
/// Gets or creates near cache.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PersistentStore/PersistentStoreMetrics.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PersistentStore/PersistentStoreMetrics.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PersistentStore/PersistentStoreMetrics.cs
index 85a4fdf..7eeabb2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PersistentStore/PersistentStoreMetrics.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PersistentStore/PersistentStoreMetrics.cs
@@ -26,7 +26,9 @@ namespace Apache.Ignite.Core.Impl.PersistentStore
/// <summary>
/// Persistent store metrics.
/// </summary>
+#pragma warning disable 618
internal class PersistentStoreMetrics : IPersistentStoreMetrics
+#pragma warning restore 618
{
/// <summary>
/// Initializes a new instance of the <see cref="PersistentStoreMetrics"/> class.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/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
index ba1153d..7128796 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/CheckpointWriteOrder.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/CheckpointWriteOrder.cs
@@ -17,9 +17,12 @@
namespace Apache.Ignite.Core.PersistentStore
{
+ using System;
+
/// <summary>
/// Defines checkpoint pages order on disk.
/// </summary>
+ [Obsolete("Use Apache.Ignite.Core.Data.CheckpointWriteOrder")]
public enum CheckpointWriteOrder
{
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/IPersistentStoreMetrics.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/IPersistentStoreMetrics.cs b/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/IPersistentStoreMetrics.cs
index e7e8481..989dbd8 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/IPersistentStoreMetrics.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/IPersistentStoreMetrics.cs
@@ -21,7 +21,9 @@ namespace Apache.Ignite.Core.PersistentStore
/// <summary>
/// Persistent store metrics.
+ /// Obsolete, see <see cref="IDataStorageMetrics"/>.
/// </summary>
+ [Obsolete("Use IDataStorageMetrics")]
public interface IPersistentStoreMetrics
{
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/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 7a2248a..e211126 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/PersistentStoreConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/PersistentStoreConfiguration.cs
@@ -22,11 +22,15 @@ namespace Apache.Ignite.Core.PersistentStore
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Configuration;
using Apache.Ignite.Core.Impl.Binary;
/// <summary>
/// Configures Apache Ignite persistent store.
+ /// <para />
+ /// Obsolete, use <see cref="DataStorageConfiguration"/>.
/// </summary>
+ [Obsolete("Use DataStorageConfiguration.")]
public class PersistentStoreConfiguration
{
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/ab08be83/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/WalMode.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/WalMode.cs b/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/WalMode.cs
index 44d13b8..c937b78 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/WalMode.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/PersistentStore/WalMode.cs
@@ -17,9 +17,12 @@
namespace Apache.Ignite.Core.PersistentStore
{
+ using System;
+
/// <summary>
/// Write Ahead Log mode.
/// </summary>
+ [Obsolete("Use Apache.Ignite.Core.Data.WalMode")]
public enum WalMode
{
/// <summary>
[33/50] [abbrv] ignite git commit: IGNITE-5909 Added list editable
component.
Posted by sb...@apache.org.
IGNITE-5909 Added list editable component.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/01daee6b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/01daee6b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/01daee6b
Branch: refs/heads/ignite-3478-tree
Commit: 01daee6b35f4dca63021ba34db1f9934c87e3233
Parents: 026254c
Author: Dmitriy Shabalin <ds...@gridgain.com>
Authored: Mon Oct 23 16:09:47 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Mon Oct 23 16:09:47 2017 +0700
----------------------------------------------------------------------
modules/web-console/frontend/.eslintrc | 2 +-
modules/web-console/frontend/app/app.js | 3 +
.../app/components/list-editable/component.js | 36 +++++
.../list-editable-cols/cols.directive.js | 79 +++++++++++
.../list-editable-cols/cols.style.scss | 51 +++++++
.../list-editable-cols/cols.template.pug | 29 ++++
.../components/list-editable-cols/index.js | 28 ++++
.../list-editable-cols/row.directive.js | 40 ++++++
.../app/components/list-editable/controller.js | 79 +++++++++++
.../app/components/list-editable/index.js | 27 ++++
.../app/components/list-editable/style.scss | 132 +++++++++++++++++++
.../app/components/list-editable/template.pug | 49 +++++++
.../helpers/jade/form/form-field-dropdown.pug | 2 +-
.../app/primitives/form-field/index.scss | 15 +++
.../frontend/app/primitives/ui-grid/index.scss | 4 +
modules/web-console/frontend/package.json | 2 +-
.../frontend/public/images/icons/index.js | 2 +
.../frontend/public/images/icons/info.svg | 3 +
.../frontend/public/images/icons/sort.svg | 1 +
modules/web-console/frontend/tsconfig.json | 12 ++
20 files changed, 593 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/01daee6b/modules/web-console/frontend/.eslintrc
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/.eslintrc b/modules/web-console/frontend/.eslintrc
index 4e24d0b..3c26fa7 100644
--- a/modules/web-console/frontend/.eslintrc
+++ b/modules/web-console/frontend/.eslintrc
@@ -186,7 +186,7 @@ rules:
space-in-parens: 0
space-infix-ops: 2
space-unary-ops: [2, { "words": true, "nonwords": false }]
- spaced-comment: [1, "always"]
+ spaced-comment: [1, "always", {"markers": ["/"]}]
use-isnan: 2
valid-jsdoc: 0
valid-typeof: 2
http://git-wip-us.apache.org/repos/asf/ignite/blob/01daee6b/modules/web-console/frontend/app/app.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/app.js b/modules/web-console/frontend/app/app.js
index f2ee8ef..44454f6 100644
--- a/modules/web-console/frontend/app/app.js
+++ b/modules/web-console/frontend/app/app.js
@@ -128,6 +128,8 @@ import gridItemSelected from './components/grid-item-selected';
import bsSelectMenu from './components/bs-select-menu';
import protectFromBsSelectRender from './components/protect-from-bs-select-render';
import uiGridHovering from './components/ui-grid-hovering';
+import listEditable from './components/list-editable';
+
import igniteServices from './services';
// Inject external modules.
@@ -202,6 +204,7 @@ angular.module('ignite-console', [
protectFromBsSelectRender.name,
AngularStrapTooltip.name,
AngularStrapSelect.name,
+ listEditable.name,
// Ignite modules.
IgniteModules.name
])
http://git-wip-us.apache.org/repos/asf/ignite/blob/01daee6b/modules/web-console/frontend/app/components/list-editable/component.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-editable/component.js b/modules/web-console/frontend/app/components/list-editable/component.js
new file mode 100644
index 0000000..8cdc083
--- /dev/null
+++ b/modules/web-console/frontend/app/components/list-editable/component.js
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+import template from './template.pug';
+import controller from './controller';
+
+import './style.scss';
+
+export default {
+ controller,
+ template,
+ require: {
+ ngModel: '^ngModel'
+ },
+ bindings: {
+ },
+ transclude: {
+ noItems: '?listEditableNoItems',
+ itemView: '?listEditableItemView',
+ itemEdit: '?listEditableItemEdit'
+ }
+};
http://git-wip-us.apache.org/repos/asf/ignite/blob/01daee6b/modules/web-console/frontend/app/components/list-editable/components/list-editable-cols/cols.directive.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-editable/components/list-editable-cols/cols.directive.js b/modules/web-console/frontend/app/components/list-editable/components/list-editable-cols/cols.directive.js
new file mode 100644
index 0000000..55544fb
--- /dev/null
+++ b/modules/web-console/frontend/app/components/list-editable/components/list-editable-cols/cols.directive.js
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ */
+
+// @ts-check
+/// <reference types="angular" />
+
+import template from './cols.template.pug';
+import './cols.style.scss';
+
+/**
+ * A column definition.
+ *
+ * @typedef {Object} IListEditableColDef
+ * @prop {string} [name] - optional name to display at column head
+ * @prop {string} cellClass - CSS class to assign to column cells
+ * @prop {string} [tip] - optional tip to display at column head
+ */
+export class ListEditableColsController {
+ /** @type {Array<IListEditableColDef>} - column definitions */
+ colDefs;
+ /** @type {string} - optional class to assign to rows */
+ rowClass;
+ /** @type {ng.INgModelController} */
+ ngModel;
+
+ static $inject = ['$compile', '$element', '$scope'];
+
+ /**
+ * @param {ng.ICompileService} $compile
+ * @param {JQLite} $element
+ * @param {ng.IScope} $scope
+ */
+ constructor($compile, $element, $scope) {
+ this.$compile = $compile;
+ this.$element = $element;
+ this.$scope = $scope;
+ }
+
+ $postLink() {
+ this.$compile(template)(this.$scope.$new(true), (clone, scope) => {
+ scope.$ctrl = this;
+
+ this.$element[0].parentElement.insertBefore(clone[0], this.$element[0]);
+ });
+ }
+
+ $onDestroy() {
+ this.$element = null;
+ }
+}
+
+/** @returns {ng.IDirective} */
+export default function listEditableCols() {
+ return {
+ controller: ListEditableColsController,
+ controllerAs: '$colsCtrl',
+ require: {
+ ngModel: 'ngModel'
+ },
+ bindToController: {
+ colDefs: '<listEditableCols',
+ rowClass: '@?listEditableColsRowClass'
+ }
+ };
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/01daee6b/modules/web-console/frontend/app/components/list-editable/components/list-editable-cols/cols.style.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-editable/components/list-editable-cols/cols.style.scss b/modules/web-console/frontend/app/components/list-editable/components/list-editable-cols/cols.style.scss
new file mode 100644
index 0000000..30c3235
--- /dev/null
+++ b/modules/web-console/frontend/app/components/list-editable/components/list-editable-cols/cols.style.scss
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+
+.list-editable-cols__header {
+ $index-column-width: 46px;
+ $remove-column-width: 36px;
+
+ margin-top: 10px;
+ margin-right: $remove-column-width;
+ margin-left: $index-column-width;
+
+ .ignite-form-field__label {
+ margin-left: 0;
+ margin-right: 0;
+ }
+
+ [ignite-icon='info'] {
+ @import 'public/stylesheets/variables';
+
+ margin-left: 5px;
+ color: $ignite-brand-success;
+ }
+
+ &+list-editable {
+ .ignite-form-field__label {
+ display: none;
+ }
+
+ .le-row-item-view:nth-last-child(2) {
+ display: none;
+ }
+ }
+
+ .list-editable-cols__header-cell {
+ padding-bottom: 5px;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/01daee6b/modules/web-console/frontend/app/components/list-editable/components/list-editable-cols/cols.template.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-editable/components/list-editable-cols/cols.template.pug b/modules/web-console/frontend/app/components/list-editable/components/list-editable-cols/cols.template.pug
new file mode 100644
index 0000000..2331173
--- /dev/null
+++ b/modules/web-console/frontend/app/components/list-editable/components/list-editable-cols/cols.template.pug
@@ -0,0 +1,29 @@
+//-
+ 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.
+
+.list-editable-cols__header(
+ ng-show='$ctrl.ngModel.$viewValue.length'
+ ng-class='::$ctrl.rowClass'
+)
+ .list-editable-cols__header-cell(ng-repeat='col in ::$ctrl.colDefs' ng-class='::col.cellClass')
+ span.ignite-form-field__label
+ | {{ ::col.name }}
+ svg(
+ ng-if='::col.tip'
+ ignite-icon='info'
+ bs-tooltip=''
+ data-title='{{::col.tip}}'
+ )
http://git-wip-us.apache.org/repos/asf/ignite/blob/01daee6b/modules/web-console/frontend/app/components/list-editable/components/list-editable-cols/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-editable/components/list-editable-cols/index.js b/modules/web-console/frontend/app/components/list-editable/components/list-editable-cols/index.js
new file mode 100644
index 0000000..b7b55f6
--- /dev/null
+++ b/modules/web-console/frontend/app/components/list-editable/components/list-editable-cols/index.js
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+import angular from 'angular';
+
+import cols from './cols.directive.js';
+import row from './row.directive.js';
+
+export default angular
+ .module('list-editable-cols', [
+ ])
+ .directive(cols.name, cols)
+ .directive('listEditableItemView', row)
+ .directive('listEditableItemEdit', row);
http://git-wip-us.apache.org/repos/asf/ignite/blob/01daee6b/modules/web-console/frontend/app/components/list-editable/components/list-editable-cols/row.directive.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-editable/components/list-editable-cols/row.directive.js b/modules/web-console/frontend/app/components/list-editable/components/list-editable-cols/row.directive.js
new file mode 100644
index 0000000..e427ab5
--- /dev/null
+++ b/modules/web-console/frontend/app/components/list-editable/components/list-editable-cols/row.directive.js
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+/** @returns {ng.IDirective} */
+export default function() {
+ return {
+ require: '?^listEditableCols',
+ /** @param {PcListEditableColsController} ctrl */
+ link(scope, el, attr, ctrl) {
+ if (!ctrl || !ctrl.colDefs.length)
+ return;
+
+ const children = el.children();
+
+ if (children.length !== ctrl.colDefs.length)
+ return;
+
+ if (ctrl.rowClass)
+ el.addClass(ctrl.rowClass);
+
+ ctrl.colDefs.forEach(({ cellClass }, index) => {
+ children[index].classList.add(...(Array.isArray(cellClass) ? cellClass : [cellClass]));
+ });
+ }
+ };
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/01daee6b/modules/web-console/frontend/app/components/list-editable/controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-editable/controller.js b/modules/web-console/frontend/app/components/list-editable/controller.js
new file mode 100644
index 0000000..bc864ce
--- /dev/null
+++ b/modules/web-console/frontend/app/components/list-editable/controller.js
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ */
+
+import _ from 'lodash';
+
+export default class {
+ static $inject = ['$animate', '$element', '$transclude'];
+
+ constructor($animate, $element, $transclude) {
+ $animate.enabled(false, $element);
+
+ this.hasItemView = $transclude.isSlotFilled('itemView');
+
+ this._cache = {};
+ }
+
+ $index(item, $index) {
+ if (item._id)
+ return item._id;
+
+ return $index;
+ }
+
+ $onInit() {
+ this.ngModel.$isEmpty = (value) => {
+ return !Array.isArray(value) || !value.length;
+ };
+ }
+
+ save(data, idx) {
+ this.ngModel.$setViewValue(this.ngModel.$viewValue.map((v, i) => i === idx ? data : v));
+ }
+
+ revert(idx) {
+ delete this._cache[idx];
+ }
+
+ remove(idx) {
+ this.ngModel.$setViewValue(this.ngModel.$viewValue.filter((v, i) => i !== idx));
+ }
+
+ isEditView(idx) {
+ return this._cache.hasOwnProperty(idx) || _.isEmpty(this.ngModel.$viewValue[idx]);
+ }
+
+ getEditView(idx) {
+ return this._cache[idx];
+ }
+
+ startEditView(idx) {
+ this._cache[idx] = _.clone(this.ngModel.$viewValue[idx]);
+ }
+
+ stopEditView(data, idx, form) {
+ delete this._cache[idx];
+
+ if (form.$pristine)
+ return;
+
+ if (form.$valid)
+ this.save(data, idx);
+ else
+ this.revert(idx);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/01daee6b/modules/web-console/frontend/app/components/list-editable/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-editable/index.js b/modules/web-console/frontend/app/components/list-editable/index.js
new file mode 100644
index 0000000..59634c4
--- /dev/null
+++ b/modules/web-console/frontend/app/components/list-editable/index.js
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+import angular from 'angular';
+
+import component from './component';
+import listEditableCols from './components/list-editable-cols';
+
+export default angular
+ .module('ignite-console.list-editable', [
+ listEditableCols.name
+ ])
+ .component('listEditable', component);
http://git-wip-us.apache.org/repos/asf/ignite/blob/01daee6b/modules/web-console/frontend/app/components/list-editable/style.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-editable/style.scss b/modules/web-console/frontend/app/components/list-editable/style.scss
new file mode 100644
index 0000000..0f3f8ae
--- /dev/null
+++ b/modules/web-console/frontend/app/components/list-editable/style.scss
@@ -0,0 +1,132 @@
+/*
+ * 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.
+ */
+
+list-editable {
+ $min-height: 47px;
+ $index-column-width: 46px;
+
+ display: block;
+ flex: 1;
+
+ &-item-view,
+ &-item-edit,
+ &-no-items {
+ flex: 1;
+ display: block;
+ }
+
+ &-no-items {
+ display: flex;
+ align-items: center;
+ min-height: $min-height;
+ padding: 5px 10px;
+
+ font-style: italic;
+ }
+
+ .le-body {
+ box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.2);
+ }
+
+ .le-row {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ min-height: $min-height;
+ padding: 5px 0;
+
+ cursor: pointer;
+ border-top: 1px solid #ddd;
+
+ &:nth-child(odd) {
+ background-color: #ffffff;
+ }
+
+ &:nth-child(even) {
+ background-color: #f9f9f9;
+ }
+
+ &-index,
+ &-cross {
+ display: flex;
+ height: 36px;
+ }
+
+ &-index {
+ width: $index-column-width;
+ flex-basis: $index-column-width;
+ padding-left: 10px;
+ flex-shrink: 0;
+ flex-grow: 0;
+ align-items: center;
+ justify-content: center;
+ }
+
+ &-cross {
+ [ignite-icon] {
+ width: 12px;
+ height: 12px;
+ }
+ }
+
+ &-item {
+ width: 100%;
+
+ &-view {
+ display: flex;
+ min-height: 36px;
+ align-items: center;
+ }
+
+ &-edit {
+ margin-left: -11px;
+ }
+ }
+
+ &--editable {
+ position: relative;
+ z-index: 1;
+
+ align-items: flex-start;
+ }
+
+ &:not(.le-row--has-item-view) {
+ & > .le-row-index,
+ & > .le-row-cross {
+ margin-top: 18px;
+ }
+
+ align-items: flex-start;
+ }
+ }
+
+ [divider]:after {
+ content: attr(divider);
+
+ display: inline-flex;
+ justify-content: center;
+ align-self: flex-start;
+
+ width: 20px;
+ height: 36px;
+
+ margin-top: 18px;
+ margin-right: -20px;
+
+ line-height: 36px;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/01daee6b/modules/web-console/frontend/app/components/list-editable/template.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-editable/template.pug b/modules/web-console/frontend/app/components/list-editable/template.pug
new file mode 100644
index 0000000..a713188
--- /dev/null
+++ b/modules/web-console/frontend/app/components/list-editable/template.pug
@@ -0,0 +1,49 @@
+//-
+ 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.
+
+.le-body(ng-if='$ctrl.ngModel.$viewValue.length')
+ .le-row(
+ ng-repeat='item in $ctrl.ngModel.$viewValue track by $ctrl.$index(item, $index)'
+ ng-class=`{
+ 'le-row--editable': $ctrl.isEditView($index),
+ 'le-row--has-item-view': $ctrl.hasItemView
+ }`)
+
+ .le-row-sort
+ button.btn-ignite.btn-ignite--link-dashed-secondary
+ svg(ignite-icon='sort')
+
+ .le-row-index
+ span {{ $index+1 }}
+
+ .le-row-item
+ .le-row-item-view(ng-if='$ctrl.hasItemView && !$ctrl.isEditView($index)' ng-click='$ctrl.startEditView($index);')
+ div(ng-transclude='itemView')
+ div(
+ ng-if='!$ctrl.hasItemView || $ctrl.isEditView($index)'
+ ignite-on-focus-out='$ctrl.stopEditView(item, $index, form);'
+ ignite-on-focus-out-ignored-classes='bssm-click-overlay bssm-item-text bssm-item-button'
+ )
+ .le-row-item-view(ng-show='$ctrl.hasItemView' ng-init='!$ctrl.hasItemView && $ctrl.startEditView($index);item = $ctrl.getEditView($index);')
+ div(ng-transclude='itemView')
+ .le-row-item-edit(ng-form name='form')
+ div(ng-transclude='itemEdit')
+
+ .le-row-cross
+ button.btn-ignite.btn-ignite--link-dashed-secondary(type='button' ng-click='$ctrl.remove($index)')
+ svg(ignite-icon='cross')
+
+div(ng-transclude='noItems' ng-if='!$ctrl.ngModel.$viewValue.length')
http://git-wip-us.apache.org/repos/asf/ignite/blob/01daee6b/modules/web-console/frontend/app/helpers/jade/form/form-field-dropdown.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/helpers/jade/form/form-field-dropdown.pug b/modules/web-console/frontend/app/helpers/jade/form/form-field-dropdown.pug
index 117568d..cf7d50a 100644
--- a/modules/web-console/frontend/app/helpers/jade/form/form-field-dropdown.pug
+++ b/modules/web-console/frontend/app/helpers/jade/form/form-field-dropdown.pug
@@ -23,7 +23,7 @@ mixin ignite-form-field-dropdown(label, model, name, disabled, required, multipl
data-placeholder=placeholderEmpty ? `{{ ${options}.length > 0 ? '${placeholder}' : '${placeholderEmpty}' }}` : placeholder
data-ng-model=model
-
+ data-ng-disabled=disabled && `${disabled}`
data-ng-required=required && `${required}`
bs-select
http://git-wip-us.apache.org/repos/asf/ignite/blob/01daee6b/modules/web-console/frontend/app/primitives/form-field/index.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/form-field/index.scss b/modules/web-console/frontend/app/primitives/form-field/index.scss
index 4bc4252..f6d8496 100644
--- a/modules/web-console/frontend/app/primitives/form-field/index.scss
+++ b/modules/web-console/frontend/app/primitives/form-field/index.scss
@@ -61,6 +61,21 @@
color: $text-color;
line-height: 36px;
+
+ &.ng-invalid:not(.ng-pristine),
+ &.ng-invalid.ng-touched {
+ border-color: $ignite-brand-primary;
+ box-shadow: inset 0 1px 3px 0 rgba($ignite-brand-primary, .5);
+ }
+
+ &:focus {
+ border-color: $ignite-brand-success;
+ box-shadow: inset 0 1px 3px 0 rgba($ignite-brand-success, .5);
+ }
+
+ &:disabled {
+ opacity: .5;
+ }
}
& > input[type='number'] {
http://git-wip-us.apache.org/repos/asf/ignite/blob/01daee6b/modules/web-console/frontend/app/primitives/ui-grid/index.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/ui-grid/index.scss b/modules/web-console/frontend/app/primitives/ui-grid/index.scss
index 88bff69..e86eec7 100644
--- a/modules/web-console/frontend/app/primitives/ui-grid/index.scss
+++ b/modules/web-console/frontend/app/primitives/ui-grid/index.scss
@@ -501,6 +501,10 @@
content: '';
}
}
+
+ .ui-grid-selection-row-header-buttons::before {
+ opacity: 1;
+ }
}
.ui-grid--ignite.ui-grid-disabled-group-selection {
http://git-wip-us.apache.org/repos/asf/ignite/blob/01daee6b/modules/web-console/frontend/package.json
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/package.json b/modules/web-console/frontend/package.json
index 82c3eea..95b4a2b 100644
--- a/modules/web-console/frontend/package.json
+++ b/modules/web-console/frontend/package.json
@@ -32,6 +32,7 @@
"win32"
],
"dependencies": {
+ "@uirouter/angularjs": "1.0.5",
"angular": "1.5.11",
"angular-acl": "0.1.8",
"angular-animate": "1.5.11",
@@ -50,7 +51,6 @@
"angular-translate": "2.15.2",
"angular-tree-control": "0.2.28",
"angular-ui-grid": "4.0.7",
- "@uirouter/angularjs": "1.0.5",
"babel-core": "6.25.0",
"babel-eslint": "7.2.3",
"babel-loader": "7.1.1",
http://git-wip-us.apache.org/repos/asf/ignite/blob/01daee6b/modules/web-console/frontend/public/images/icons/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/images/icons/index.js b/modules/web-console/frontend/public/images/icons/index.js
index 5d8ac53..d802805 100644
--- a/modules/web-console/frontend/public/images/icons/index.js
+++ b/modules/web-console/frontend/public/images/icons/index.js
@@ -24,3 +24,5 @@ export download from './download.svg';
export filter from './filter.svg';
export search from './search.svg';
export refresh from './refresh.svg';
+export sort from './sort.svg';
+export info from './info.svg';
http://git-wip-us.apache.org/repos/asf/ignite/blob/01daee6b/modules/web-console/frontend/public/images/icons/info.svg
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/images/icons/info.svg b/modules/web-console/frontend/public/images/icons/info.svg
new file mode 100644
index 0000000..de92136
--- /dev/null
+++ b/modules/web-console/frontend/public/images/icons/info.svg
@@ -0,0 +1,3 @@
+<svg version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+ <path fill="currentColor" d="m8 0c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 0.80078c4 0 7.1992 3.1992 7.1992 7.1992s-3.1992 7.1992-7.1992 7.1992-7.1992-3.1992-7.1992-7.1992 3.1992-7.1992 7.1992-7.1992zm0 2.7988c-1.3 0-2.4004 1.1004-2.4004 2.4004 0 0.2 0.20039 0.40039 0.40039 0.40039s0.40039-0.20039 0.40039-0.40039c0-0.9 0.69961-1.5996 1.5996-1.5996s1.5996 0.69961 1.5996 1.5996-0.69961 1.5996-1.5996 1.5996c-0.2 0-0.40039 0.20039-0.40039 0.40039v1.6992c0 0.2 0.20039 0.40039 0.40039 0.40039s0.40039-0.098828 0.40039-0.29883v-1.4004c1.1-0.2 2-1.2004 2-2.4004 0-1.3-1.1004-2.4004-2.4004-2.4004zm0 7.5c-0.2 0-0.40039 0.20039-0.40039 0.40039v1.0996c0 0.2 0.20039 0.40039 0.40039 0.40039s0.40039-0.20039 0.40039-0.40039v-1.0996c0-0.2-0.20039-0.40039-0.40039-0.40039z"/>
+</svg>
http://git-wip-us.apache.org/repos/asf/ignite/blob/01daee6b/modules/web-console/frontend/public/images/icons/sort.svg
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/images/icons/sort.svg b/modules/web-console/frontend/public/images/icons/sort.svg
new file mode 100644
index 0000000..7e4bb52
--- /dev/null
+++ b/modules/web-console/frontend/public/images/icons/sort.svg
@@ -0,0 +1 @@
+<svg id="drag-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="currentColor" d="M 4,6.9 H 6.3 V 4.6 H 4 Z m 4.6,0 h 2.3 V 4.6 H 8.6 Z M 4,11.4 H 6.3 V 9.1 H 4 Z m 4.6,0 h 2.3 V 9.1 H 8.6 Z M 4,16 H 6.3 V 13.7 H 4 Z m 4.6,0 h 2.3 V 13.7 H 8.6 Z M 4,2.3 H 6.3 V 0 H 4 Z m 4.6,0 h 2.3 V 0 H 8.6 Z"/></svg>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/01daee6b/modules/web-console/frontend/tsconfig.json
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/tsconfig.json b/modules/web-console/frontend/tsconfig.json
new file mode 100644
index 0000000..a70845d
--- /dev/null
+++ b/modules/web-console/frontend/tsconfig.json
@@ -0,0 +1,12 @@
+{
+ "compilerOptions": {
+ "allowSyntheticDefaultImports": true,
+ "target": "ES2017",
+ "allowJs": true,
+ "checkJs": true,
+ "baseUrl": ".",
+ "paths": {
+ "*": ["*", "node_modules/*"]
+ }
+ }
+}
\ No newline at end of file
[42/50] [abbrv] ignite git commit: IGNITE-6512 Negated flag for
inactive state caches start - Fixes #2910.
Posted by sb...@apache.org.
IGNITE-6512 Negated flag for inactive state caches start - Fixes #2910.
Signed-off-by: Alexey Goncharuk <al...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/be8787a6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/be8787a6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/be8787a6
Branch: refs/heads/ignite-3478-tree
Commit: be8787a642dfffe802cb63b7069ca5a9757ac76f
Parents: 3be007f
Author: EdShangGG <es...@gridgain.com>
Authored: Mon Oct 23 20:31:15 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Oct 23 20:31:15 2017 +0300
----------------------------------------------------------------------
.../cache/CacheAffinitySharedManager.java | 4 +--
.../cache/DynamicCacheChangeRequest.java | 13 +++----
.../processors/cache/GridCacheProcessor.java | 38 ++++++++++----------
3 files changed, 28 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/be8787a6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
index 7266f99..efcb501 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
@@ -429,7 +429,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
desc,
startReq.nearCacheConfiguration(),
topVer,
- startReq.activeAfterStart());
+ startReq.disabledAfterStart());
startedInfos.put(desc.cacheId(), startReq.nearCacheConfiguration() != null);
@@ -753,7 +753,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
cacheDesc,
nearCfg,
evts.topologyVersion(),
- req.activeAfterStart());
+ req.disabledAfterStart());
if (fut.cacheAddedOnExchange(cacheDesc.cacheId(), cacheDesc.receivedFrom())) {
if (fut.events().discoveryCache().cacheGroupAffinityNodes(cacheDesc.groupId()).isEmpty())
http://git-wip-us.apache.org/repos/asf/ignite/blob/be8787a6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
index cfc2d07..3ee5903 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
@@ -69,7 +69,7 @@ public class DynamicCacheChangeRequest implements Serializable {
private boolean restart;
/** Cache active on start or not*/
- private boolean activeAfterStart = true;
+ private boolean disabledAfterStart;
/** Destroy. */
private boolean destroy;
@@ -410,15 +410,15 @@ public class DynamicCacheChangeRequest implements Serializable {
/**
* @return state of cache after start
*/
- public boolean activeAfterStart() {
- return activeAfterStart;
+ public boolean disabledAfterStart() {
+ return disabledAfterStart;
}
/**
- * @param activeAfterStart state of cache after start
+ * @param disabledAfterStart state of cache after start
*/
- public void activeAfterStart(boolean activeAfterStart) {
- this.activeAfterStart = activeAfterStart;
+ public void disabledAfterStart(boolean disabledAfterStart) {
+ this.disabledAfterStart = disabledAfterStart;
}
/** {@inheritDoc} */
@@ -429,6 +429,7 @@ public class DynamicCacheChangeRequest implements Serializable {
", clientStartOnly=" + clientStartOnly +
", stop=" + stop +
", destroy=" + destroy +
+ ", disabledAfterStart" + disabledAfterStart +
']';
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/be8787a6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index d4d65dc..021807a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -1292,7 +1292,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
* @param cacheObjCtx Cache object context.
* @param affNode {@code True} if local node affinity node.
* @param updatesAllowed Updates allowed flag.
- * @param activeOnStart If true, then we will discard restarting state from proxies. If false then we will change
+ * @param disabledAfterStart If true, then we will discard restarting state from proxies. If false then we will change
* state of proxies to restarting
* @return Cache context.
* @throws IgniteCheckedException If failed to create cache.
@@ -1305,7 +1305,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
CacheObjectContext cacheObjCtx,
boolean affNode,
boolean updatesAllowed,
- boolean activeOnStart)
+ boolean disabledAfterStart)
throws IgniteCheckedException {
assert cfg != null;
@@ -1464,7 +1464,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
}
- cache.active(activeOnStart);
+ cache.active(!disabledAfterStart);
cacheCtx.cache(cache);
@@ -1688,7 +1688,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
desc,
t.get2(),
exchTopVer,
- true);
+ false);
}
}
}
@@ -1722,7 +1722,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
desc,
null,
exchTopVer,
- true);
+ false);
}
}
@@ -1734,7 +1734,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
* @param desc Cache descriptor.
* @param reqNearCfg Near configuration if specified for client cache start request.
* @param exchTopVer Current exchange version.
- * @param activeOnStart If true, then we will discard restarting state from proxies. If false then we will change
+ * @param disabledAfterStart If true, then we will discard restarting state from proxies. If false then we will change
* state of proxies to restarting
* @throws IgniteCheckedException If failed.
*/
@@ -1743,7 +1743,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
DynamicCacheDescriptor desc,
@Nullable NearCacheConfiguration reqNearCfg,
AffinityTopologyVersion exchTopVer,
- boolean activeOnStart
+ boolean disabledAfterStart
) throws IgniteCheckedException {
assert !caches.containsKey(startCfg.getName()) : startCfg.getName();
@@ -1808,7 +1808,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
cacheObjCtx,
affNode,
true,
- activeOnStart
+ disabledAfterStart
);
cacheCtx.dynamicDeploymentId(desc.deploymentId());
@@ -1827,7 +1827,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
IgniteCacheProxyImpl<?, ?> proxy = jCacheProxies.get(ccfg.getName());
- if (activeOnStart && proxy != null && proxy.isRestarting())
+ if (!disabledAfterStart && proxy != null && proxy.isRestarting())
proxy.onRestarted(cacheCtx, cache);
}
@@ -2546,7 +2546,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
sql,
failIfExists,
failIfNotStarted,
- true);
+ false);
if (req != null) {
if (req.clientStartOnly())
@@ -2593,12 +2593,12 @@ public class GridCacheProcessor extends GridProcessorAdapter {
* @param ccfgList Collection of cache configuration.
* @param failIfExists Fail if exists flag.
* @param checkThreadTx If {@code true} checks that current thread does not have active transactions.
- * @param activeAfterStart If true, cache proxies will be only activated after {@link #restartProxies()}.
+ * @param disabledAfterStart If true, cache proxies will be only activated after {@link #restartProxies()}.
* @return Future that will be completed when all caches are deployed.
*/
public IgniteInternalFuture<?> dynamicStartCaches(Collection<CacheConfiguration> ccfgList, boolean failIfExists,
- boolean checkThreadTx, boolean activeAfterStart) {
- return dynamicStartCaches(ccfgList, null, failIfExists, checkThreadTx, activeAfterStart);
+ boolean checkThreadTx, boolean disabledAfterStart) {
+ return dynamicStartCaches(ccfgList, null, failIfExists, checkThreadTx, disabledAfterStart);
}
/**
@@ -2608,7 +2608,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
* @param cacheType Cache type.
* @param failIfExists Fail if exists flag.
* @param checkThreadTx If {@code true} checks that current thread does not have active transactions.
- * @param activeAfterStart If true, cache proxies will be only activated after {@link #restartProxies()}.
+ * @param disabledAfterStart If true, cache proxies will be only activated after {@link #restartProxies()}.
* @return Future that will be completed when all caches are deployed.
*/
private IgniteInternalFuture<?> dynamicStartCaches(
@@ -2616,7 +2616,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
CacheType cacheType,
boolean failIfExists,
boolean checkThreadTx,
- boolean activeAfterStart
+ boolean disabledAfterStart
) {
if (checkThreadTx)
checkEmptyTransactions();
@@ -2645,7 +2645,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
false,
failIfExists,
true,
- activeAfterStart);
+ disabledAfterStart);
if (req != null) {
if (req.clientStartOnly()) {
@@ -3807,7 +3807,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
* @param sql Whether the cache needs to be created as the result of SQL {@code CREATE TABLE} command.
* @param failIfExists Fail if exists flag.
* @param failIfNotStarted If {@code true} fails if cache is not started.
- * @param activeAfterStart If true, cache proxies will be only activated after {@link #restartProxies()}.
+ * @param disabledAfterStart If true, cache proxies will be only activated after {@link #restartProxies()}.
* @return Request or {@code null} if cache already exists.
* @throws IgniteCheckedException if some of pre-checks failed
* @throws CacheExistsException if cache exists and failIfExists flag is {@code true}
@@ -3820,7 +3820,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
boolean sql,
boolean failIfExists,
boolean failIfNotStarted,
- boolean activeAfterStart
+ boolean disabledAfterStart
) throws IgniteCheckedException {
DynamicCacheDescriptor desc = cacheDescriptor(cacheName);
@@ -3830,7 +3830,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
req.failIfExists(failIfExists);
- req.activeAfterStart(activeAfterStart);
+ req.disabledAfterStart(disabledAfterStart);
if (ccfg != null) {
cloneCheckSerializable(ccfg);
[12/50] [abbrv] ignite git commit: IGNITE-6684: Renamed
"ignitesql.sh|bat" to "sqlline.sh|bat".
Posted by sb...@apache.org.
IGNITE-6684: Renamed "ignitesql.sh|bat" to "sqlline.sh|bat".
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3a9fcd40
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3a9fcd40
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3a9fcd40
Branch: refs/heads/ignite-3478-tree
Commit: 3a9fcd40da0381ab7419f42eac3e68a71f6f40ae
Parents: 5c8c492
Author: devozerov <pp...@gmail.com>
Authored: Thu Oct 19 22:30:31 2017 +0300
Committer: devozerov <pp...@gmail.com>
Committed: Thu Oct 19 22:30:31 2017 +0300
----------------------------------------------------------------------
modules/sqlline/bin/ignitesql.bat | 112 ---------------------------------
modules/sqlline/bin/ignitesql.sh | 54 ----------------
modules/sqlline/bin/sqlline.bat | 112 +++++++++++++++++++++++++++++++++
modules/sqlline/bin/sqlline.sh | 54 ++++++++++++++++
4 files changed, 166 insertions(+), 166 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3a9fcd40/modules/sqlline/bin/ignitesql.bat
----------------------------------------------------------------------
diff --git a/modules/sqlline/bin/ignitesql.bat b/modules/sqlline/bin/ignitesql.bat
deleted file mode 100644
index 828e93a..0000000
--- a/modules/sqlline/bin/ignitesql.bat
+++ /dev/null
@@ -1,112 +0,0 @@
-::
-:: 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.
-::
-
-::
-:: Ignite database connector.
-::
-
-@echo off
-Setlocal EnableDelayedExpansion
-
-if "%OS%" == "Windows_NT" setlocal
-
-:: Check JAVA_HOME.
-if defined JAVA_HOME goto checkJdk
- echo %0, ERROR:
- echo JAVA_HOME environment variable is not found.
- echo Please point JAVA_HOME variable to location of JDK 1.7 or JDK 1.8.
- echo You can also download latest JDK at http://java.com/download.
-goto error_finish
-
-:checkJdk
-:: Check that JDK is where it should be.
-if exist "%JAVA_HOME%\bin\java.exe" goto checkJdkVersion
- echo %0, ERROR:
- echo JAVA is not found in JAVA_HOME=%JAVA_HOME%.
- echo Please point JAVA_HOME variable to installation of JDK 1.7 or JDK 1.8.
- echo You can also download latest JDK at http://java.com/download.
-goto error_finish
-
-:checkJdkVersion
-"%JAVA_HOME%\bin\java.exe" -version 2>&1 | findstr "1\.[78]\." > nul
-if %ERRORLEVEL% equ 0 goto checkIgniteHome1
- echo %0, ERROR:
- echo The version of JAVA installed in %JAVA_HOME% is incorrect.
- echo Please point JAVA_HOME variable to installation of JDK 1.7 or JDK 1.8.
- echo You can also download latest JDK at http://java.com/download.
-goto error_finish
-
-:: Check IGNITE_HOME.
-:checkIgniteHome1
-if defined IGNITE_HOME goto checkIgniteHome2
- pushd "%~dp0"/..
- set IGNITE_HOME=%CD%
- popd
-
-:checkIgniteHome2
-:: Strip double quotes from IGNITE_HOME
-set IGNITE_HOME=%IGNITE_HOME:"=%
-
-:: remove all trailing slashes from IGNITE_HOME.
-if %IGNITE_HOME:~-1,1% == \ goto removeTrailingSlash
-if %IGNITE_HOME:~-1,1% == / goto removeTrailingSlash
-goto checkIgniteHome3
-
-:removeTrailingSlash
-set IGNITE_HOME=%IGNITE_HOME:~0,-1%
-goto checkIgniteHome2
-
-:checkIgniteHome3
-if exist "%IGNITE_HOME%\config" goto checkIgniteHome4
- echo %0, ERROR: Ignite installation folder is not found or IGNITE_HOME environment variable is not valid.
- echo Please create IGNITE_HOME environment variable pointing to location of
- echo Ignite installation folder.
- goto error_finish
-
-:checkIgniteHome4
-
-::
-:: Set SCRIPTS_HOME - base path to scripts.
-::
-set SCRIPTS_HOME=%IGNITE_HOME%\bin
-
-:: Remove trailing spaces
-for /l %%a in (1,1,31) do if /i "%SCRIPTS_HOME:~-1%" == " " set SCRIPTS_HOME=%SCRIPTS_HOME:~0,-1%
-
-if /i "%SCRIPTS_HOME%\" == "%~dp0" goto setProgName
- echo %0, WARN: IGNITE_HOME environment variable may be pointing to wrong folder: %IGNITE_HOME%
-
-:setProgName
-::
-:: Set program name.
-::
-set PROG_NAME=ignitesql.bat
-if "%OS%" == "Windows_NT" set PROG_NAME=%~nx0%
-
-:run
-
-::
-:: Set IGNITE_LIBS
-::
-call "%SCRIPTS_HOME%\include\setenv.bat"
-
-set CP=%IGNITE_LIBS%
-set CP=%CP%;%IGNITE_HOME%\bin\include\sqlline\*
-
-"%JAVA_HOME%\bin\java.exe" -cp "%CP%" sqlline.SqlLine -d org.apache.ignite.IgniteJdbcThinDriver %*
-
-:error_finish
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/3a9fcd40/modules/sqlline/bin/ignitesql.sh
----------------------------------------------------------------------
diff --git a/modules/sqlline/bin/ignitesql.sh b/modules/sqlline/bin/ignitesql.sh
deleted file mode 100644
index 5745aea..0000000
--- a/modules/sqlline/bin/ignitesql.sh
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-
-#
-# Ignite database connector.
-#
-
-#
-# Import common functions.
-#
-if [ "${IGNITE_HOME}" = "" ];
- then IGNITE_HOME_TMP="$(dirname "$(cd "$(dirname "$0")"; "pwd")")";
- else IGNITE_HOME_TMP=${IGNITE_HOME};
-fi
-
-#
-# Set SCRIPTS_HOME - base path to scripts.
-#
-SCRIPTS_HOME="${IGNITE_HOME_TMP}/bin"
-
-source "${SCRIPTS_HOME}"/include/functions.sh
-
-#
-# Discover IGNITE_HOME environment variable.
-#
-setIgniteHome
-
-#
-# Set IGNITE_LIBS.
-#
-. "${SCRIPTS_HOME}"/include/setenv.sh
-
-JDBCLINK="jdbc:ignite:thin://${HOST_AND_PORT}${SCHEMA_DELIMITER}${SCHEMA}${PARAMS}"
-
-CP="${IGNITE_LIBS}"
-
-CP="${CP}${SEP}${IGNITE_HOME_TMP}/bin/include/sqlline/*"
-
-java -cp ${CP} sqlline.SqlLine -d org.apache.ignite.IgniteJdbcThinDriver $@
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/3a9fcd40/modules/sqlline/bin/sqlline.bat
----------------------------------------------------------------------
diff --git a/modules/sqlline/bin/sqlline.bat b/modules/sqlline/bin/sqlline.bat
new file mode 100644
index 0000000..fc6c149
--- /dev/null
+++ b/modules/sqlline/bin/sqlline.bat
@@ -0,0 +1,112 @@
+::
+:: 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.
+::
+
+::
+:: Ignite database connector.
+::
+
+@echo off
+Setlocal EnableDelayedExpansion
+
+if "%OS%" == "Windows_NT" setlocal
+
+:: Check JAVA_HOME.
+if defined JAVA_HOME goto checkJdk
+ echo %0, ERROR:
+ echo JAVA_HOME environment variable is not found.
+ echo Please point JAVA_HOME variable to location of JDK 1.7 or JDK 1.8.
+ echo You can also download latest JDK at http://java.com/download.
+goto error_finish
+
+:checkJdk
+:: Check that JDK is where it should be.
+if exist "%JAVA_HOME%\bin\java.exe" goto checkJdkVersion
+ echo %0, ERROR:
+ echo JAVA is not found in JAVA_HOME=%JAVA_HOME%.
+ echo Please point JAVA_HOME variable to installation of JDK 1.7 or JDK 1.8.
+ echo You can also download latest JDK at http://java.com/download.
+goto error_finish
+
+:checkJdkVersion
+"%JAVA_HOME%\bin\java.exe" -version 2>&1 | findstr "1\.[78]\." > nul
+if %ERRORLEVEL% equ 0 goto checkIgniteHome1
+ echo %0, ERROR:
+ echo The version of JAVA installed in %JAVA_HOME% is incorrect.
+ echo Please point JAVA_HOME variable to installation of JDK 1.7 or JDK 1.8.
+ echo You can also download latest JDK at http://java.com/download.
+goto error_finish
+
+:: Check IGNITE_HOME.
+:checkIgniteHome1
+if defined IGNITE_HOME goto checkIgniteHome2
+ pushd "%~dp0"/..
+ set IGNITE_HOME=%CD%
+ popd
+
+:checkIgniteHome2
+:: Strip double quotes from IGNITE_HOME
+set IGNITE_HOME=%IGNITE_HOME:"=%
+
+:: remove all trailing slashes from IGNITE_HOME.
+if %IGNITE_HOME:~-1,1% == \ goto removeTrailingSlash
+if %IGNITE_HOME:~-1,1% == / goto removeTrailingSlash
+goto checkIgniteHome3
+
+:removeTrailingSlash
+set IGNITE_HOME=%IGNITE_HOME:~0,-1%
+goto checkIgniteHome2
+
+:checkIgniteHome3
+if exist "%IGNITE_HOME%\config" goto checkIgniteHome4
+ echo %0, ERROR: Ignite installation folder is not found or IGNITE_HOME environment variable is not valid.
+ echo Please create IGNITE_HOME environment variable pointing to location of
+ echo Ignite installation folder.
+ goto error_finish
+
+:checkIgniteHome4
+
+::
+:: Set SCRIPTS_HOME - base path to scripts.
+::
+set SCRIPTS_HOME=%IGNITE_HOME%\bin
+
+:: Remove trailing spaces
+for /l %%a in (1,1,31) do if /i "%SCRIPTS_HOME:~-1%" == " " set SCRIPTS_HOME=%SCRIPTS_HOME:~0,-1%
+
+if /i "%SCRIPTS_HOME%\" == "%~dp0" goto setProgName
+ echo %0, WARN: IGNITE_HOME environment variable may be pointing to wrong folder: %IGNITE_HOME%
+
+:setProgName
+::
+:: Set program name.
+::
+set PROG_NAME=sqlline.bat
+if "%OS%" == "Windows_NT" set PROG_NAME=%~nx0%
+
+:run
+
+::
+:: Set IGNITE_LIBS
+::
+call "%SCRIPTS_HOME%\include\setenv.bat"
+
+set CP=%IGNITE_LIBS%
+set CP=%CP%;%IGNITE_HOME%\bin\include\sqlline\*
+
+"%JAVA_HOME%\bin\java.exe" -cp "%CP%" sqlline.SqlLine -d org.apache.ignite.IgniteJdbcThinDriver %*
+
+:error_finish
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/3a9fcd40/modules/sqlline/bin/sqlline.sh
----------------------------------------------------------------------
diff --git a/modules/sqlline/bin/sqlline.sh b/modules/sqlline/bin/sqlline.sh
new file mode 100644
index 0000000..5745aea
--- /dev/null
+++ b/modules/sqlline/bin/sqlline.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+#
+# 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.
+#
+
+#
+# Ignite database connector.
+#
+
+#
+# Import common functions.
+#
+if [ "${IGNITE_HOME}" = "" ];
+ then IGNITE_HOME_TMP="$(dirname "$(cd "$(dirname "$0")"; "pwd")")";
+ else IGNITE_HOME_TMP=${IGNITE_HOME};
+fi
+
+#
+# Set SCRIPTS_HOME - base path to scripts.
+#
+SCRIPTS_HOME="${IGNITE_HOME_TMP}/bin"
+
+source "${SCRIPTS_HOME}"/include/functions.sh
+
+#
+# Discover IGNITE_HOME environment variable.
+#
+setIgniteHome
+
+#
+# Set IGNITE_LIBS.
+#
+. "${SCRIPTS_HOME}"/include/setenv.sh
+
+JDBCLINK="jdbc:ignite:thin://${HOST_AND_PORT}${SCHEMA_DELIMITER}${SCHEMA}${PARAMS}"
+
+CP="${IGNITE_LIBS}"
+
+CP="${CP}${SEP}${IGNITE_HOME_TMP}/bin/include/sqlline/*"
+
+java -cp ${CP} sqlline.SqlLine -d org.apache.ignite.IgniteJdbcThinDriver $@
\ No newline at end of file
[15/50] [abbrv] ignite git commit: IGNITE-6030 Allow enabling
persistence per data region
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MetadataStorageSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MetadataStorageSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MetadataStorageSelfTest.java
index dcd4ce1..880e37e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MetadataStorageSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MetadataStorageSelfTest.java
@@ -23,12 +23,12 @@ import java.util.Map;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicLong;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.mem.DirectMemoryProvider;
import org.apache.ignite.internal.pagemem.FullPageId;
import org.apache.ignite.internal.pagemem.PageIdAllocator;
import org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryMetricsImpl;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl;
import org.apache.ignite.internal.processors.cache.persistence.MetadataStorage;
import org.apache.ignite.internal.mem.file.MappedFileMemoryProvider;
import org.apache.ignite.internal.pagemem.PageMemory;
@@ -156,7 +156,7 @@ public class MetadataStorageSelfTest extends GridCommonAbstractTest {
protected PageMemory memory(boolean clean) throws Exception {
DirectMemoryProvider provider = new MappedFileMemoryProvider(log(), allocationPath);
- MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration()
+ DataRegionConfiguration plcCfg = new DataRegionConfiguration()
.setMaxSize(30 * 1024 * 1024).setInitialSize(30 * 1024 * 1024);
return new PageMemoryNoStoreImpl(
@@ -165,7 +165,7 @@ public class MetadataStorageSelfTest extends GridCommonAbstractTest {
null,
PAGE_SIZE,
plcCfg,
- new MemoryMetricsImpl(plcCfg),
+ new DataRegionMetricsImpl(plcCfg),
true);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/database/SwapPathConstructionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/SwapPathConstructionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/SwapPathConstructionSelfTest.java
index 53e5daf..f22128c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/SwapPathConstructionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/SwapPathConstructionSelfTest.java
@@ -22,23 +22,23 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Map;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.pagemem.PageMemory;
import org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryPolicy;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegion;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
/**
- * Test verifies correct construction of swap file path {@link MemoryPolicyConfiguration#setSwapFilePath(String)}
+ * Test verifies correct construction of swap file path {@link DataRegionConfiguration#setSwapPath(String)}
* when absolute or relative paths are provided via configuration.
*/
public class SwapPathConstructionSelfTest extends GridCommonAbstractTest {
/** */
- private MemoryConfiguration memCfg;
+ private DataStorageConfiguration memCfg;
/** */
private static final String RELATIVE_SWAP_PATH = "relSwapPath";
@@ -50,7 +50,7 @@ public class SwapPathConstructionSelfTest extends GridCommonAbstractTest {
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
return cfg;
}
@@ -118,7 +118,7 @@ public class SwapPathConstructionSelfTest extends GridCommonAbstractTest {
private String extractDefaultPageMemoryAllocPath(GridKernalContext context) {
IgniteCacheDatabaseSharedManager dbMgr = context.cache().context().database();
- Map<String, MemoryPolicy> memPlcMap = U.field(dbMgr, "memPlcMap");
+ Map<String, DataRegion> memPlcMap = U.field(dbMgr, "dataRegionMap");
PageMemory pageMem = memPlcMap.get("default").pageMemory();
@@ -128,22 +128,22 @@ public class SwapPathConstructionSelfTest extends GridCommonAbstractTest {
}
/**
- * @param isRelativePath flag is set to {@code true} if relative path should be used for memory policy configuration.
+ * @param isRelativePath flag is set to {@code true} if relative path should be used for data region configuration.
*/
- private MemoryConfiguration createMemoryConfiguration(boolean isRelativePath) {
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ private DataStorageConfiguration createMemoryConfiguration(boolean isRelativePath) {
+ DataStorageConfiguration memCfg = new DataStorageConfiguration();
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
+ DataRegionConfiguration memPlcCfg = new DataRegionConfiguration();
memPlcCfg.setName("default");
memPlcCfg.setMaxSize(20 * 1024 * 1024);
if (isRelativePath)
- memPlcCfg.setSwapFilePath(RELATIVE_SWAP_PATH);
+ memPlcCfg.setSwapPath(RELATIVE_SWAP_PATH);
else
- memPlcCfg.setSwapFilePath(Paths.get(getTmpDir(), ABSOLUTE_SWAP_PATH).toString());
+ memPlcCfg.setSwapPath(Paths.get(getTmpDir(), ABSOLUTE_SWAP_PATH).toString());
- memCfg.setMemoryPolicies(memPlcCfg);
+ memCfg.setDefaultDataRegionConfiguration(memPlcCfg);
return memCfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsIgniteMock.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsIgniteMock.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsIgniteMock.java
index 1e5fcd1..a0ce285 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsIgniteMock.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsIgniteMock.java
@@ -17,6 +17,9 @@
package org.apache.ignite.internal.processors.igfs;
+import org.apache.ignite.DataRegionMetrics;
+import org.apache.ignite.DataRegionMetricsAdapter;
+import org.apache.ignite.DataStorageMetricsAdapter;
import org.apache.ignite.IgniteAtomicLong;
import org.apache.ignite.IgniteAtomicReference;
import org.apache.ignite.IgniteAtomicSequence;
@@ -38,6 +41,7 @@ import org.apache.ignite.IgniteSemaphore;
import org.apache.ignite.IgniteServices;
import org.apache.ignite.IgniteSet;
import org.apache.ignite.IgniteTransactions;
+import org.apache.ignite.DataStorageMetrics;
import org.apache.ignite.MemoryMetrics;
import org.apache.ignite.PersistenceMetrics;
import org.apache.ignite.cache.affinity.Affinity;
@@ -584,26 +588,41 @@ public class IgfsIgniteMock implements IgniteEx {
}
/** {@inheritDoc} */
- @Override public Collection<MemoryMetrics> memoryMetrics() {
+ @Override public Collection<DataRegionMetrics> dataRegionMetrics() {
throwUnsupported();
return null;
}
/** {@inheritDoc} */
- @Nullable @Override public MemoryMetrics memoryMetrics(String memPlcName) {
+ @Nullable @Override public DataRegionMetrics dataRegionMetrics(String memPlcName) {
throwUnsupported();
return null;
}
/** {@inheritDoc} */
- @Override public PersistenceMetrics persistentStoreMetrics() {
+ @Override public DataStorageMetrics dataStorageMetrics() {
throwUnsupported();
return null;
}
+ /** {@inheritDoc} */
+ @Override public Collection<MemoryMetrics> memoryMetrics() {
+ return DataRegionMetricsAdapter.collectionOf(dataRegionMetrics());
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public MemoryMetrics memoryMetrics(String memPlcName) {
+ return DataRegionMetricsAdapter.valueOf(dataRegionMetrics(memPlcName));
+ }
+
+ /** {@inheritDoc} */
+ @Override public PersistenceMetrics persistentStoreMetrics() {
+ return DataStorageMetricsAdapter.valueOf(dataStorageMetrics());
+ }
+
/**
* Throw {@link UnsupportedOperationException}.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java
index 597efe1..0acb1d3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java
@@ -24,10 +24,10 @@ import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.FileSystemConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper;
import org.apache.ignite.igfs.IgfsInputStream;
@@ -396,14 +396,14 @@ public class IgfsSizeSelfTest extends IgfsCommonAbstractTest {
@Override public void apply(IgniteConfiguration cfg) {
String memPlcName = "igfsDataMemPlc";
- cfg.setMemoryConfiguration(new MemoryConfiguration().setMemoryPolicies(
- new MemoryPolicyConfiguration().setMaxSize(maxSize).setInitialSize(maxSize).setName(memPlcName)));
+ cfg.setDataStorageConfiguration(new DataStorageConfiguration().setDataRegionConfigurations(
+ new DataRegionConfiguration().setMaxSize(maxSize).setInitialSize(maxSize).setName(memPlcName)));
FileSystemConfiguration igfsCfg = cfg.getFileSystemConfiguration()[0];
- igfsCfg.getDataCacheConfiguration().setMemoryPolicyName(memPlcName);
+ igfsCfg.getDataCacheConfiguration().setDataRegionName(memPlcName);
- cfg.setCacheConfiguration(new CacheConfiguration().setName("QQQ").setMemoryPolicyName(memPlcName));
+ cfg.setCacheConfiguration(new CacheConfiguration().setName("QQQ").setDataRegionName(memPlcName));
}
};
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java
index 779f095..c08e144 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java
@@ -21,6 +21,10 @@ import java.util.Collection;
import java.util.UUID;
import java.util.concurrent.ExecutorService;
import javax.management.MBeanServer;
+import org.apache.ignite.DataRegionMetrics;
+import org.apache.ignite.DataRegionMetricsAdapter;
+import org.apache.ignite.DataStorageMetrics;
+import org.apache.ignite.DataStorageMetricsAdapter;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteAtomicLong;
import org.apache.ignite.IgniteAtomicReference;
@@ -469,20 +473,35 @@ public class IgniteMock implements Ignite {
}
/** {@inheritDoc} */
- @Override public Collection<MemoryMetrics> memoryMetrics() {
+ @Override public Collection<DataRegionMetrics> dataRegionMetrics() {
return null;
}
/** {@inheritDoc} */
- @Nullable @Override public MemoryMetrics memoryMetrics(String memPlcName) {
+ @Nullable @Override public DataRegionMetrics dataRegionMetrics(String memPlcName) {
return null;
}
/** {@inheritDoc} */
- @Override public PersistenceMetrics persistentStoreMetrics() {
+ @Override public DataStorageMetrics dataStorageMetrics() {
return null;
}
+ /** {@inheritDoc} */
+ @Override public Collection<MemoryMetrics> memoryMetrics() {
+ return DataRegionMetricsAdapter.collectionOf(dataRegionMetrics());
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public MemoryMetrics memoryMetrics(String memPlcName) {
+ return DataRegionMetricsAdapter.valueOf(dataRegionMetrics(memPlcName));
+ }
+
+ /** {@inheritDoc} */
+ @Override public PersistenceMetrics persistentStoreMetrics() {
+ return DataStorageMetricsAdapter.valueOf(dataStorageMetrics());
+ }
+
/**
* @param staticCfg Configuration.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
index 2f91e40..86a374a 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
@@ -26,6 +26,9 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import javax.cache.CacheException;
+import org.apache.ignite.DataRegionMetrics;
+import org.apache.ignite.DataRegionMetricsAdapter;
+import org.apache.ignite.DataStorageMetricsAdapter;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteAtomicLong;
import org.apache.ignite.IgniteAtomicReference;
@@ -49,6 +52,7 @@ import org.apache.ignite.IgniteSemaphore;
import org.apache.ignite.IgniteServices;
import org.apache.ignite.IgniteSet;
import org.apache.ignite.IgniteTransactions;
+import org.apache.ignite.DataStorageMetrics;
import org.apache.ignite.MemoryMetrics;
import org.apache.ignite.PersistenceMetrics;
import org.apache.ignite.cache.affinity.Affinity;
@@ -742,21 +746,36 @@ public class IgniteProcessProxy implements IgniteEx {
}
/** {@inheritDoc} */
- @Override public Collection<MemoryMetrics> memoryMetrics() {
+ @Override public Collection<DataRegionMetrics> dataRegionMetrics() {
throw new UnsupportedOperationException("Operation isn't supported yet.");
}
/** {@inheritDoc} */
- @Nullable @Override public MemoryMetrics memoryMetrics(String memPlcName) {
+ @Nullable @Override public DataRegionMetrics dataRegionMetrics(String memPlcName) {
throw new UnsupportedOperationException("Operation isn't supported yet.");
}
/** {@inheritDoc} */
- @Override public PersistenceMetrics persistentStoreMetrics() {
+ @Override public DataStorageMetrics dataStorageMetrics() {
throw new UnsupportedOperationException("Operation isn't supported yet.");
}
/** {@inheritDoc} */
+ @Override public Collection<MemoryMetrics> memoryMetrics() {
+ return DataRegionMetricsAdapter.collectionOf(dataRegionMetrics());
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public MemoryMetrics memoryMetrics(String memPlcName) {
+ return DataRegionMetricsAdapter.valueOf(dataRegionMetrics(memPlcName));
+ }
+
+ /** {@inheritDoc} */
+ @Override public PersistenceMetrics persistentStoreMetrics() {
+ return DataStorageMetricsAdapter.valueOf(dataStorageMetrics());
+ }
+
+ /** {@inheritDoc} */
@Override public void close() throws IgniteException {
if (locJvmGrid != null) {
final CountDownLatch rmtNodeStoppedLatch = new CountDownLatch(1);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
index 5c4d7fd..7ca9467 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
@@ -54,7 +54,7 @@ import org.apache.ignite.internal.processors.database.BPlusTreeFakeReuseSelfTest
import org.apache.ignite.internal.processors.database.BPlusTreeReuseSelfTest;
import org.apache.ignite.internal.processors.database.BPlusTreeSelfTest;
import org.apache.ignite.internal.processors.database.FreeListImplSelfTest;
-import org.apache.ignite.internal.processors.database.MemoryMetricsSelfTest;
+import org.apache.ignite.internal.processors.database.DataRegionMetricsSelfTest;
import org.apache.ignite.internal.processors.database.MetadataStorageSelfTest;
import org.apache.ignite.internal.processors.database.SwapPathConstructionSelfTest;
import org.apache.ignite.internal.processors.odbc.OdbcConfigurationValidationSelfTest;
@@ -175,7 +175,7 @@ public class IgniteBasicTestSuite extends TestSuite {
suite.addTestSuite(BPlusTreeReuseSelfTest.class);
suite.addTestSuite(MetadataStorageSelfTest.class);
suite.addTestSuite(FreeListImplSelfTest.class);
- suite.addTestSuite(MemoryMetricsSelfTest.class);
+ suite.addTestSuite(DataRegionMetricsSelfTest.class);
suite.addTestSuite(SwapPathConstructionSelfTest.class);
suite.addTestSuite(IgniteMarshallerCacheFSRestoreTest.class);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
index e8810bb..047550d 100755
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
@@ -78,7 +78,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheStoreValueBytesSelfT
import org.apache.ignite.internal.processors.cache.GridCacheSwapPreloadSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheTtlManagerSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheTxPartitionedLocalStoreSelfTest;
-import org.apache.ignite.internal.processors.cache.GridMemoryConfigurationConsistencySelfTest;
+import org.apache.ignite.internal.processors.cache.GridDataStorageConfigurationConsistencySelfTest;
import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicInvokeTest;
import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicLocalInvokeTest;
import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicLocalWithStoreInvokeTest;
@@ -225,7 +225,7 @@ public class IgniteCacheTestSuite extends TestSuite {
// suite.addTestSuite(GridCacheP2PUndeploySelfTest.class);
suite.addTestSuite(GridCacheConfigurationValidationSelfTest.class);
suite.addTestSuite(GridCacheConfigurationConsistencySelfTest.class);
- suite.addTestSuite(GridMemoryConfigurationConsistencySelfTest.class);
+ suite.addTestSuite(GridDataStorageConfigurationConsistencySelfTest.class);
suite.addTestSuite(GridCacheJdbcBlobStoreSelfTest.class);
suite.addTestSuite(GridCacheJdbcBlobStoreMultithreadedSelfTest.class);
suite.addTestSuite(JdbcTypesDefaultTransformerTest.class);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
index 31ad015..6f5b710 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
@@ -29,7 +29,7 @@ import org.apache.ignite.internal.processors.cache.CacheEnumOperationsSingleNode
import org.apache.ignite.internal.processors.cache.CacheEnumOperationsTest;
import org.apache.ignite.internal.processors.cache.CacheExchangeMessageDuplicatedStateTest;
import org.apache.ignite.internal.processors.cache.CacheGroupLocalConfigurationSelfTest;
-import org.apache.ignite.internal.processors.cache.CacheMemoryPolicyConfigurationTest;
+import org.apache.ignite.internal.processors.cache.CacheDataRegionConfigurationTest;
import org.apache.ignite.internal.processors.cache.CacheOptimisticTransactionsWithFilterSingleServerTest;
import org.apache.ignite.internal.processors.cache.CacheOptimisticTransactionsWithFilterTest;
import org.apache.ignite.internal.processors.cache.CrossCacheTxNearEnabledRandomOperationsTest;
@@ -262,7 +262,7 @@ public class IgniteCacheTestSuite2 extends TestSuite {
suite.addTest(new TestSuite(CacheConfigurationLeakTest.class));
suite.addTest(new TestSuite(MemoryPolicyConfigValidationTest.class));
suite.addTest(new TestSuite(MemoryPolicyInitializationTest.class));
- suite.addTest(new TestSuite(CacheMemoryPolicyConfigurationTest.class));
+ suite.addTest(new TestSuite(CacheDataRegionConfigurationTest.class));
suite.addTest(new TestSuite(CacheGroupLocalConfigurationSelfTest.class));
suite.addTest(new TestSuite(CacheEnumOperationsSingleNodeTest.class));
suite.addTest(new TestSuite(CacheEnumOperationsTest.class));
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java
index d92d848..b1e80ea 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java
@@ -18,12 +18,12 @@
package org.apache.ignite.testsuites;
import junit.framework.TestSuite;
+import org.apache.ignite.internal.processors.cache.persistence.IgniteDataStorageMetricsSelfTest;
import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsContinuousRestartTest;
import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsContinuousRestartTestWithSharedGroupAndIndexes;
import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsExchangeDuringCheckpointTest;
import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsPageSizesTest;
import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsRecoveryAfterFileCorruptionTest;
-import org.apache.ignite.internal.processors.cache.persistence.IgnitePersistenceMetricsSelfTest;
import org.apache.ignite.internal.processors.cache.persistence.IgnitePersistentStoreDataStructuresTest;
import org.apache.ignite.internal.processors.cache.persistence.db.IgnitePdsPageEvictionDuringPartitionClearTest;
import org.apache.ignite.internal.processors.cache.persistence.db.IgnitePdsRebalancingOnNotStableTopologyTest;
@@ -53,7 +53,7 @@ public class IgnitePdsTestSuite2 extends TestSuite {
suite.addTestSuite(IgnitePdsPageSizesTest.class);
// Metrics test.
- suite.addTestSuite(IgnitePersistenceMetricsSelfTest.class);
+ suite.addTestSuite(IgniteDataStorageMetricsSelfTest.class);
suite.addTestSuite(IgnitePdsTransactionsHangTest.class);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
index 1a3ea4a..3c0ab5e 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
@@ -110,7 +110,7 @@ public class H2TreeIndex extends GridH2IndexBase {
name,
cctx.offheap().reuseListForIndex(name),
cctx.groupId(),
- cctx.memoryPolicy().pageMemory(),
+ cctx.dataRegion().pageMemory(),
cctx.shared().wal(),
cctx.offheap().globalRemoveId(),
tbl.rowFactory(),
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePdsSingleNodeWithIndexingPutGetPersistenceTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePdsSingleNodeWithIndexingPutGetPersistenceTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePdsSingleNodeWithIndexingPutGetPersistenceTest.java
index 998e1e4..4a32dfd 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePdsSingleNodeWithIndexingPutGetPersistenceTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePdsSingleNodeWithIndexingPutGetPersistenceTest.java
@@ -18,7 +18,7 @@
package org.apache.ignite.internal.processors.cache;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.processors.database.IgniteDbSingleNodeWithIndexingPutGetTest;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -33,8 +33,8 @@ public class IgnitePdsSingleNodeWithIndexingPutGetPersistenceTest extends Ignite
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
+ cfg.setDataStorageConfiguration(
+ new DataStorageConfiguration()
.setWalMode(WALMode.LOG_ONLY)
);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedPartitionQueryAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedPartitionQueryAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedPartitionQueryAbstractSelfTest.java
index 0a0afb4..079dcdf 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedPartitionQueryAbstractSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedPartitionQueryAbstractSelfTest.java
@@ -43,8 +43,9 @@ import org.apache.ignite.cache.query.SqlQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.util.GridRandom;
import org.apache.ignite.internal.util.typedef.F;
@@ -136,9 +137,10 @@ public abstract class IgniteCacheDistributedPartitionQueryAbstractSelfTest exten
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- MemoryConfiguration memCfg = new MemoryConfiguration().setDefaultMemoryPolicySize(20 * 1024 * 1024);
+ DataStorageConfiguration memCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(20 * 1024 * 1024));
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
TcpDiscoverySpi spi = (TcpDiscoverySpi)cfg.getDiscoverySpi();
spi.setIpFinder(IP_FINDER);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
index 943a5c8..627b3eb 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
@@ -33,8 +33,9 @@ import org.apache.ignite.cache.query.QueryCancelledException;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
@@ -90,9 +91,10 @@ public class IgniteCacheQueryNodeRestartSelfTest2 extends GridCommonAbstractTest
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
- MemoryConfiguration memCfg = new MemoryConfiguration().setDefaultMemoryPolicySize(50 * 1024 * 1024);
+ DataStorageConfiguration memCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(50 * 1024 * 1024));
- c.setMemoryConfiguration(memCfg);
+ c.setDataStorageConfiguration(memCfg);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicColumnsAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicColumnsAbstractTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicColumnsAbstractTest.java
index b25359a..2beea8b 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicColumnsAbstractTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicColumnsAbstractTest.java
@@ -31,9 +31,9 @@ import org.apache.ignite.Ignition;
import org.apache.ignite.cache.QueryEntity;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
@@ -259,16 +259,10 @@ public abstract class DynamicColumnsAbstractTest extends GridCommonAbstractTest
cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(IP_FINDER));
- MemoryConfiguration memCfg = new MemoryConfiguration()
- .setDefaultMemoryPolicyName("default")
- .setMemoryPolicies(
- new MemoryPolicyConfiguration()
- .setName("default")
- .setMaxSize(128 * 1024 * 1024L)
- .setInitialSize(128 * 1024 * 1024L)
- );
+ DataStorageConfiguration memCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(128 * 1024 * 1024));
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
return optimize(cfg);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractSelfTest.java
index 70197f5..a39283b 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractSelfTest.java
@@ -28,9 +28,9 @@ import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.SqlQuery;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.util.typedef.T2;
@@ -141,16 +141,10 @@ public abstract class DynamicIndexAbstractSelfTest extends AbstractSchemaSelfTes
cfg.setMarshaller(new BinaryMarshaller());
- MemoryConfiguration memCfg = new MemoryConfiguration()
- .setDefaultMemoryPolicyName("default")
- .setMemoryPolicies(
- new MemoryPolicyConfiguration()
- .setName("default")
- .setMaxSize(128 * 1024 * 1024L)
- .setInitialSize(128 * 1024 * 1024L)
- );
+ DataStorageConfiguration memCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(128 * 1024 * 1024));
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
return optimize(cfg);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/LongIndexNameTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/LongIndexNameTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/LongIndexNameTest.java
index 544eb74..ab0d520 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/LongIndexNameTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/LongIndexNameTest.java
@@ -27,7 +27,7 @@ import org.apache.ignite.cache.query.QueryCursor;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.jetbrains.annotations.NotNull;
@@ -44,7 +44,7 @@ public class LongIndexNameTest extends GridCommonAbstractTest {
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
return super.getConfiguration(igniteInstanceName)
- .setPersistentStoreConfiguration(new PersistentStoreConfiguration())
+ .setDataStorageConfiguration(new DataStorageConfiguration())
.setCacheConfiguration(new <String, Person>CacheConfiguration("cache")
.setQueryEntities(getIndexCfg())
.setAffinity(new RendezvousAffinityFunction(false, 16)));
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbSingleNodeWithIndexingWalRestoreTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbSingleNodeWithIndexingWalRestoreTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbSingleNodeWithIndexingWalRestoreTest.java
index 8f6afd8..54667df 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbSingleNodeWithIndexingWalRestoreTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbSingleNodeWithIndexingWalRestoreTest.java
@@ -27,8 +27,10 @@ import org.apache.ignite.cache.QueryEntity;
import org.apache.ignite.cache.QueryIndex;
import org.apache.ignite.configuration.BinaryConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager;
import org.apache.ignite.internal.util.typedef.F;
@@ -111,7 +113,12 @@ public class IgniteDbSingleNodeWithIndexingWalRestoreTest extends GridCommonAbst
cfg.setCacheConfiguration(indexedCacheCfg);
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(100 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY);
+
+ cfg.setDataStorageConfiguration(memCfg);
cfg.setConsistentId(gridName);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgnitePersistentStoreQueryWithMultipleClassesPerCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgnitePersistentStoreQueryWithMultipleClassesPerCacheTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgnitePersistentStoreQueryWithMultipleClassesPerCacheTest.java
index 5bb1eb1..c37dbda 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgnitePersistentStoreQueryWithMultipleClassesPerCacheTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgnitePersistentStoreQueryWithMultipleClassesPerCacheTest.java
@@ -27,7 +27,7 @@ import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -56,11 +56,11 @@ public class IgnitePersistentStoreQueryWithMultipleClassesPerCacheTest extends G
cfg.setCacheConfiguration(cacheCfg(CACHE_NAME));
- PersistentStoreConfiguration pCfg = new PersistentStoreConfiguration();
+ DataStorageConfiguration pCfg = new DataStorageConfiguration();
- pCfg.setCheckpointingFrequency(1000);
+ pCfg.setCheckpointFrequency(1000);
- cfg.setPersistentStoreConfiguration(pCfg);
+ cfg.setDataStorageConfiguration(pCfg);
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgnitePersistentStoreSchemaLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgnitePersistentStoreSchemaLoadTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgnitePersistentStoreSchemaLoadTest.java
index a408596..1474954 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgnitePersistentStoreSchemaLoadTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgnitePersistentStoreSchemaLoadTest.java
@@ -27,8 +27,9 @@ import org.apache.ignite.cache.QueryEntity;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
import org.apache.ignite.internal.processors.cache.persistence.DbCheckpointListener;
@@ -71,13 +72,15 @@ public class IgnitePersistentStoreSchemaLoadTest extends GridCommonAbstractTest
cfg.setCacheConfiguration(cacheCfg(TMPL_NAME));
- PersistentStoreConfiguration pCfg = new PersistentStoreConfiguration();
+ DataStorageConfiguration pCfg = new DataStorageConfiguration();
- pCfg.setCheckpointingFrequency(1000);
+ pCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setPersistenceEnabled(true)
+ .setMaxSize(100 * 1024 * 1024));
- cfg.setPersistentStoreConfiguration(pCfg);
+ pCfg.setCheckpointFrequency(1000);
- cfg.setActiveOnStart(true);
+ cfg.setDataStorageConfiguration(pCfg);
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlNotNullConstraintTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlNotNullConstraintTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlNotNullConstraintTest.java
index 8deb61f..8283003 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlNotNullConstraintTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlNotNullConstraintTest.java
@@ -41,8 +41,8 @@ import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.cache.store.CacheStoreAdapter;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
@@ -141,7 +141,7 @@ public class IgniteSqlNotNullConstraintTest extends GridCommonAbstractTest {
c.setClientMode(true);
// Not allowed to have local cache on client without memory config
- c.setMemoryConfiguration(new MemoryConfiguration());
+ c.setDataStorageConfiguration(new DataStorageConfiguration());
}
return c;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/database/InlineIndexHelperTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/database/InlineIndexHelperTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/database/InlineIndexHelperTest.java
index 4a69887..41dd4f1 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/database/InlineIndexHelperTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/database/InlineIndexHelperTest.java
@@ -25,12 +25,12 @@ import java.util.Comparator;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
import org.apache.commons.io.Charsets;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider;
import org.apache.ignite.internal.pagemem.PageIdAllocator;
import org.apache.ignite.internal.pagemem.PageMemory;
import org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryMetricsImpl;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.h2.result.SortOrder;
import org.h2.value.CompareMode;
@@ -181,7 +181,7 @@ public class InlineIndexHelperTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
private int putAndCompare(String v1, String v2, int maxSize) throws Exception {
- MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration().setInitialSize(1024 * MB)
+ DataRegionConfiguration plcCfg = new DataRegionConfiguration().setInitialSize(1024 * MB)
.setMaxSize(1024 * MB);
PageMemory pageMem = new PageMemoryNoStoreImpl(log,
@@ -189,7 +189,7 @@ public class InlineIndexHelperTest extends GridCommonAbstractTest {
null,
PAGE_SIZE,
plcCfg,
- new MemoryMetricsImpl(plcCfg),
+ new DataRegionMetricsImpl(plcCfg),
false);
pageMem.start();
@@ -279,7 +279,7 @@ public class InlineIndexHelperTest extends GridCommonAbstractTest {
/** */
public void testStringTruncate() throws Exception {
- MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration().setInitialSize(1024 * MB)
+ DataRegionConfiguration plcCfg = new DataRegionConfiguration().setInitialSize(1024 * MB)
.setMaxSize(1024 * MB);
PageMemory pageMem = new PageMemoryNoStoreImpl(log(),
@@ -287,7 +287,7 @@ public class InlineIndexHelperTest extends GridCommonAbstractTest {
null,
PAGE_SIZE,
plcCfg,
- new MemoryMetricsImpl(plcCfg),
+ new DataRegionMetricsImpl(plcCfg),
false);
pageMem.start();
@@ -330,7 +330,7 @@ public class InlineIndexHelperTest extends GridCommonAbstractTest {
/** */
public void testBytes() throws Exception {
- MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration().setInitialSize(1024 * MB)
+ DataRegionConfiguration plcCfg = new DataRegionConfiguration().setInitialSize(1024 * MB)
.setMaxSize(1024 * MB);
PageMemory pageMem = new PageMemoryNoStoreImpl(log(),
@@ -338,7 +338,7 @@ public class InlineIndexHelperTest extends GridCommonAbstractTest {
null,
PAGE_SIZE,
plcCfg,
- new MemoryMetricsImpl(plcCfg),
+ new DataRegionMetricsImpl(plcCfg),
false);
pageMem.start();
@@ -449,7 +449,7 @@ public class InlineIndexHelperTest extends GridCommonAbstractTest {
/** */
private void testPutGet(Value v1, Value v2, Value v3) throws Exception {
- MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration().setInitialSize(1024 * MB)
+ DataRegionConfiguration plcCfg = new DataRegionConfiguration().setInitialSize(1024 * MB)
.setMaxSize(1024 * MB);
PageMemory pageMem = new PageMemoryNoStoreImpl(log(),
@@ -457,7 +457,7 @@ public class InlineIndexHelperTest extends GridCommonAbstractTest {
null,
PAGE_SIZE,
plcCfg,
- new MemoryMetricsImpl(plcCfg),
+ new DataRegionMetricsImpl(plcCfg),
false);
pageMem.start();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePdsWithIndexingCoreTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePdsWithIndexingCoreTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePdsWithIndexingCoreTestSuite.java
index cfbe2e0..114f630 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePdsWithIndexingCoreTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePdsWithIndexingCoreTestSuite.java
@@ -27,6 +27,7 @@ import org.apache.ignite.internal.processors.cache.persistence.db.IgnitePdsPageE
import org.apache.ignite.internal.processors.cache.persistence.db.file.IgnitePdsCacheIntegrationTest;
import org.apache.ignite.internal.processors.cache.persistence.db.file.IgnitePdsNoActualWalHistoryTest;
import org.apache.ignite.internal.processors.cache.persistence.db.file.IgnitePdsThreadInterruptionTest;
+import org.apache.ignite.internal.processors.cache.persistence.db.wal.IgniteWalRecoveryPPCTest;
import org.apache.ignite.internal.processors.cache.persistence.db.wal.IgniteWalRecoveryTest;
import org.apache.ignite.internal.processors.cache.persistence.db.wal.WalRecoveryTxLogicalRecordsTest;
@@ -52,6 +53,8 @@ public class IgnitePdsWithIndexingCoreTestSuite extends TestSuite {
suite.addTestSuite(IgnitePdsAtomicCacheRebalancingTest.class);
suite.addTestSuite(IgnitePdsTxCacheRebalancingTest.class);
+ suite.addTestSuite(IgniteWalRecoveryPPCTest.class);
+
suite.addTestSuite(IgnitePdsBinaryMetadataOnClusterRestartTest.class);
suite.addTestSuite(IgnitePdsMarshallerMappingRestoreOnNodeStartTest.class);
suite.addTestSuite(IgnitePdsThreadInterruptionTest.class);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/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 cde216b..73636d1 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
@@ -316,7 +316,6 @@ namespace Apache.Ignite.Core.Tests
Assert.IsNotNull(mem);
Assert.AreEqual("dfltPlc", mem.DefaultMemoryPolicyName);
- Assert.AreEqual(MemoryConfiguration.DefaultPageSize, mem.PageSize);
Assert.AreEqual(MemoryConfiguration.DefaultSystemCacheInitialSize, mem.SystemCacheInitialSize);
Assert.AreEqual(MemoryConfiguration.DefaultSystemCacheMaxSize, mem.SystemCacheMaxSize);
@@ -324,7 +323,6 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual("dfltPlc", plc.Name);
Assert.AreEqual(MemoryPolicyConfiguration.DefaultEmptyPagesPoolSize, plc.EmptyPagesPoolSize);
Assert.AreEqual(MemoryPolicyConfiguration.DefaultEvictionThreshold, plc.EvictionThreshold);
- Assert.AreEqual(MemoryPolicyConfiguration.DefaultInitialSize, plc.InitialSize);
Assert.AreEqual(MemoryPolicyConfiguration.DefaultMaxSize, plc.MaxSize);
Assert.AreEqual(MemoryPolicyConfiguration.DefaultSubIntervals, plc.SubIntervals);
Assert.AreEqual(MemoryPolicyConfiguration.DefaultRateTimeInterval, plc.RateTimeInterval);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyObjectMapper.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyObjectMapper.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyObjectMapper.java
index b4f89f2..00941d0 100644
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyObjectMapper.java
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyObjectMapper.java
@@ -24,6 +24,7 @@ import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationConfig;
+import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider;
@@ -59,6 +60,8 @@ public class GridJettyObjectMapper extends ObjectMapper {
module.addSerializer(GridCacheSqlMetadata.class, IGNITE_SQL_METADATA_SERIALIZER);
module.addSerializer(GridCacheSqlIndexMetadata.class, IGNITE_SQL_INDEX_METADATA_SERIALIZER);
+ configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
+
registerModule(module);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java b/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java
index 1f80574..4cba76e 100644
--- a/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java
+++ b/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java
@@ -273,24 +273,39 @@ public class IgniteSpringBean implements Ignite, DisposableBean, InitializingBea
}
/** {@inheritDoc} */
- @Override public Collection<MemoryMetrics> memoryMetrics() {
+ @Override public Collection<DataRegionMetrics> dataRegionMetrics() {
checkIgnite();
- return g.memoryMetrics();
+ return g.dataRegionMetrics();
}
/** {@inheritDoc} */
- @Nullable @Override public MemoryMetrics memoryMetrics(String memPlcName) {
+ @Nullable @Override public DataRegionMetrics dataRegionMetrics(String memPlcName) {
checkIgnite();
- return g.memoryMetrics(memPlcName);
+ return g.dataRegionMetrics(memPlcName);
}
/** {@inheritDoc} */
- @Override public PersistenceMetrics persistentStoreMetrics() {
+ @Override public DataStorageMetrics dataStorageMetrics() {
checkIgnite();
- return g.persistentStoreMetrics();
+ return g.dataStorageMetrics();
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<MemoryMetrics> memoryMetrics() {
+ return DataRegionMetricsAdapter.collectionOf(dataRegionMetrics());
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public MemoryMetrics memoryMetrics(String memPlcName) {
+ return DataRegionMetricsAdapter.valueOf(dataRegionMetrics(memPlcName));
+ }
+
+ /** {@inheritDoc} */
+ @Override public PersistenceMetrics persistentStoreMetrics() {
+ return DataStorageMetricsAdapter.valueOf(dataStorageMetrics());
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/top/VisorActivationCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/top/VisorActivationCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/top/VisorActivationCommandSpec.scala
index fb2a7f4..a772492 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/top/VisorActivationCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/top/VisorActivationCommandSpec.scala
@@ -18,7 +18,7 @@
package org.apache.ignite.visor.commands.top
import org.apache.ignite.Ignition
-import org.apache.ignite.configuration.{IgniteConfiguration, MemoryConfiguration, PersistentStoreConfiguration}
+import org.apache.ignite.configuration._
import org.apache.ignite.visor.commands.top.VisorTopologyCommand._
import org.apache.ignite.visor.{VisorRuntimeBaseSpec, visor}
import VisorRuntimeBaseSpec._
@@ -30,11 +30,14 @@ class VisorActivationCommandSpec extends VisorRuntimeBaseSpec(2) {
override protected def config(name: String): IgniteConfiguration = {
val cfg = super.config(name)
- val memCfg = new MemoryConfiguration
- memCfg.setDefaultMemoryPolicySize(10 * 1024 * 1024)
+ val dfltReg = new DataRegionConfiguration
+ val dataRegCfg = new DataStorageConfiguration
- cfg.setMemoryConfiguration(memCfg)
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration)
+ dfltReg.setMaxSize(10 * 1024 * 1024)
+ dfltReg.setPersistenceEnabled(true)
+ dataRegCfg.setDefaultDataRegionConfiguration(dfltReg)
+
+ cfg.setDataStorageConfiguration(dataRegCfg)
cfg
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/web-console/backend/app/mongo.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/mongo.js b/modules/web-console/backend/app/mongo.js
index a07f979..bfe1ae2 100644
--- a/modules/web-console/backend/app/mongo.js
+++ b/modules/web-console/backend/app/mongo.js
@@ -960,6 +960,61 @@ module.exports.factory = function(passportMongo, settings, pluginMongo, mongoose
name: String,
size: Number
}],
+ dataStorageConfiguration: {
+ systemRegionInitialSize: Number,
+ systemRegionMaxSize: Number,
+ pageSize: Number,
+ concurrencyLevel: Number,
+ defaultDataRegionConfiguration: {
+ name: String,
+ initialSize: Number,
+ maxSize: Number,
+ swapPath: String,
+ pageEvictionMode: {type: String, enum: ['DISABLED', 'RANDOM_LRU', 'RANDOM_2_LRU']},
+ evictionThreshold: Number,
+ emptyPagesPoolSize: Number,
+ metricsEnabled: Boolean,
+ metricsSubIntervalCount: Number,
+ metricsRateTimeInterval: Number,
+ persistenceEnabled: Boolean
+ },
+ dataRegionConfigurations: [{
+ name: String,
+ initialSize: Number,
+ maxSize: Number,
+ swapPath: String,
+ pageEvictionMode: {type: String, enum: ['DISABLED', 'RANDOM_LRU', 'RANDOM_2_LRU']},
+ evictionThreshold: Number,
+ emptyPagesPoolSize: Number,
+ metricsEnabled: Boolean,
+ metricsSubIntervalCount: Number,
+ metricsRateTimeInterval: Number,
+ persistenceEnabled: Boolean
+ }],
+ storagePath: String,
+ metricsEnabled: Boolean,
+ alwaysWriteFullPages: Boolean,
+ checkpointFrequency: Number,
+ checkpointPageBufferSize: Number,
+ checkpointThreads: Number,
+ checkpointWriteOrder: {type: String, enum: ['RANDOM', 'SEQUENTIAL']},
+ walPath: String,
+ walArchivePath: String,
+ walMode: {type: String, enum: ['DEFAULT', 'LOG_ONLY', 'BACKGROUND', 'NONE']},
+ walSegments: Number,
+ walSegmentSize: Number,
+ walHistorySize: Number,
+ walFlushFrequency: Number,
+ walFsyncDelayNanos: Number,
+ walRecordIteratorBufferSize: Number,
+ lockWaitTime: Number,
+ walThreadLocalBufferSize: Number,
+ metricsSubIntervalCount: Number,
+ metricsRateTimeInterval: Number,
+ fileIOFactory: {type: String, enum: ['RANDOM', 'ASYNC']},
+ walAutoArchiveAfterInactivity: Number,
+ writeThrottlingEnabled: Boolean
+ },
memoryConfiguration: {
systemCacheInitialSize: Number,
systemCacheMaxSize: Number,
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/web-console/frontend/app/components/page-configure-basic/controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure-basic/controller.js b/modules/web-console/frontend/app/components/page-configure-basic/controller.js
index c0b56ac..cafdb20 100644
--- a/modules/web-console/frontend/app/components/page-configure-basic/controller.js
+++ b/modules/web-console/frontend/app/components/page-configure-basic/controller.js
@@ -57,7 +57,7 @@ export default class PageConfigureBasicController {
allClusterCaches: this.getAllClusterCaches(state.configureBasic),
cachesMenu: this.getCachesMenu(state.list.caches),
clustersMenu: this.getClustersMenu(state.list.clusters),
- defaultMemoryPolicy: this.getDefaultClusterMemoryPolicy(state.configureBasic.cluster),
+ defaultMemoryPolicy: this.getDefaultClusterMemoryPolicy(state.configureBasic.cluster, version),
memorySizeInputVisible: this.getMemorySizeInputVisibility(version)
}))
.do((value) => this.applyValue(value));
@@ -125,8 +125,12 @@ export default class PageConfigureBasicController {
return [...state.oldClusterCaches, ...state.newClusterCaches];
}
- getDefaultClusterMemoryPolicy(cluster) {
- return get(cluster, 'memoryConfiguration.memoryPolicies', []).find((p) => p.name === 'default');
+ getDefaultClusterMemoryPolicy(cluster, version) {
+ if (this.Version.since(version.ignite, ['2.1.0', '2.3.0']))
+ return get(cluster, 'memoryConfiguration.memoryPolicies', []).find((p) => p.name === 'default');
+
+ return get(cluster, 'dataStorageConfiguration.defaultDataRegionConfiguration') ||
+ get(cluster, 'dataStorageConfiguration.dataRegionConfigurations', []).find((p) => p.name === 'default');
}
getMemorySizeInputVisibility(version) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js b/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
index a67f7b9..f6f471c 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
@@ -138,6 +138,11 @@ export default class AbstractTransformer {
return this.toSection(this.generator.clusterMemory(memoryConfiguration, available));
}
+ // Generate memory configuration group.
+ static clusterDataStorageConfiguration(dataStorageCfg, available) {
+ return this.toSection(this.generator.clusterDataStorageConfiguration(dataStorageCfg, available));
+ }
+
// Generate marshaller group.
static clusterMisc(cluster, available) {
return this.toSection(this.generator.clusterMisc(cluster, available));
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
index 75ee47c..cd635db 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
@@ -81,6 +81,11 @@ export default class IgniteConfigurationGenerator {
this.clusterCollision(cluster.collision, cfg);
this.clusterCommunication(cluster, cfg);
this.clusterConnector(cluster.connector, cfg);
+
+ // Since ignite 2.3
+ if (available('2.3.0'))
+ this.clusterDataStorageConfiguration(cluster.dataStorageConfiguration, available, cfg);
+
this.clusterDeployment(cluster, available, cfg);
this.clusterEvents(cluster, available, cfg);
this.clusterFailover(cluster, available, cfg);
@@ -89,19 +94,23 @@ export default class IgniteConfigurationGenerator {
this.clusterLogger(cluster.logger, cfg);
this.clusterMarshaller(cluster, available, cfg);
- // Since ignite 2.0
- if (available('2.0.0'))
+ // Since ignite 2.0 and deprecated in ignite 2.3
+ if (available(['2.0.0', '2.3.0']))
this.clusterMemory(cluster.memoryConfiguration, available, cfg);
this.clusterMisc(cluster, available, cfg);
this.clusterMetrics(cluster, available, cfg);
this.clusterODBC(cluster.odbc, available, cfg);
- this.clusterPersistence(cluster.persistenceStoreConfiguration, available, cfg);
+
+ // Since ignite 2.1 deprecated in ignite 2.3
+ if (available(['2.1.0', '2.3.0']))
+ this.clusterPersistence(cluster.persistenceStoreConfiguration, available, cfg);
+
this.clusterQuery(cluster, available, cfg);
this.clusterServiceConfiguration(cluster.serviceConfigurations, cluster.caches, cfg);
this.clusterSsl(cluster, cfg);
- // Removed in ignite 2.0
+ // Deprecated in ignite 2.0
if (available(['1.0.0', '2.0.0']))
this.clusterSwap(cluster, cfg);
@@ -1333,6 +1342,95 @@ export default class IgniteConfigurationGenerator {
return cfg;
}
+ static dataRegionConfiguration(dataRegionCfg) {
+ const plcBean = new Bean('org.apache.ignite.configuration.DataRegionConfiguration', 'dataRegionCfg', dataRegionCfg, clusterDflts.dataStorageConfiguration.dataRegionConfigurations);
+
+ return plcBean.stringProperty('name')
+ .longProperty('initialSize')
+ .longProperty('maxSize')
+ .stringProperty('swapPath')
+ .enumProperty('pageEvictionMode')
+ .doubleProperty('evictionThreshold')
+ .intProperty('emptyPagesPoolSize')
+ .intProperty('metricsSubIntervalCount')
+ .longProperty('metricsRateTimeInterval')
+ .boolProperty('metricsEnabled')
+ .boolProperty('persistenceEnabled');
+ }
+
+ // Generate data storage configuration.
+ static clusterDataStorageConfiguration(dataStorageCfg, available, cfg = this.igniteConfigurationBean()) {
+ if (!available('2.3.0'))
+ return cfg;
+
+ const storageBean = new Bean('org.apache.ignite.configuration.DataStorageConfiguration', 'dataStorageCfg', dataStorageCfg, clusterDflts.dataStorageConfiguration);
+
+ storageBean.intProperty('pageSize')
+ .intProperty('concurrencyLevel')
+ .intProperty('systemRegionInitialSize')
+ .intProperty('systemRegionMaxSize');
+
+ const dfltDataRegionCfg = this.dataRegionConfiguration(_.get(dataStorageCfg, 'defaultDataRegionConfiguration'));
+
+ if (!dfltDataRegionCfg.isEmpty())
+ storageBean.beanProperty('defaultDataRegionConfiguration', dfltDataRegionCfg);
+
+ const dataRegionCfgs = [];
+
+ _.forEach(_.get(dataStorageCfg, 'dataRegionConfigurations'), (dataRegionCfg) => {
+ const plcBean = this.dataRegionConfiguration(dataRegionCfg);
+
+ if (plcBean.isEmpty())
+ return;
+
+ dataRegionCfgs.push(plcBean);
+ });
+
+ if (!_.isEmpty(dataRegionCfgs))
+ storageBean.varArgProperty('dataRegionConfigurations', 'dataRegionConfigurations', dataRegionCfgs, 'org.apache.ignite.configuration.DataRegionConfiguration');
+
+ storageBean.stringProperty('storagePath')
+ .intProperty('checkpointFrequency')
+ .longProperty('checkpointPageBufferSize')
+ .intProperty('checkpointThreads')
+ .enumProperty('walMode')
+ .stringProperty('walPath')
+ .stringProperty('walArchivePath')
+ .intProperty('walSegments')
+ .intProperty('walSegmentSize')
+ .intProperty('walHistorySize')
+ .longProperty('walFlushFrequency')
+ .longProperty('walFsyncDelayNanos')
+ .intProperty('walRecordIteratorBufferSize')
+ .longProperty('lockWaitTime')
+ .intProperty('walThreadLocalBufferSize')
+ .intProperty('metricsSubIntervalCount')
+ .intProperty('metricsRateTimeInterval')
+ .longProperty('walAutoArchiveAfterInactivity')
+ .boolProperty('metricsEnabled')
+ .boolProperty('alwaysWriteFullPages')
+ .boolProperty('writeThrottlingEnabled');
+
+ const fileIOFactory = _.get(dataStorageCfg, 'fileIOFactory');
+
+ let factoryBean;
+
+ if (fileIOFactory === 'RANDOM')
+ factoryBean = new Bean('org.apache.ignite.internal.processors.cache.persistence.file.RandomAccessFileIOFactory', 'rndFileIoFactory', {});
+ else if (fileIOFactory === 'ASYNC')
+ factoryBean = new Bean('org.apache.ignite.internal.processors.cache.persistence.file.AsyncFileIOFactory', 'asyncFileIoFactory', {});
+
+ if (factoryBean)
+ storageBean.beanProperty('fileIOFactory', factoryBean);
+
+ if (storageBean.isEmpty())
+ return cfg;
+
+ cfg.beanProperty('dataStorageConfiguration', storageBean);
+
+ return cfg;
+ }
+
// Generate miscellaneous configuration.
static clusterMisc(cluster, available, cfg = this.igniteConfigurationBean(cluster)) {
cfg.stringProperty('workDirectory');
@@ -1473,7 +1571,7 @@ export default class IgniteConfigurationGenerator {
// Generate cluster query group.
static clusterPersistence(persistence, available, cfg = this.igniteConfigurationBean()) {
- if (!available('2.1.0') || _.get(persistence, 'enabled') !== true)
+ if (!available(['2.1.0', '2.3.0']) || _.get(persistence, 'enabled') !== true)
return cfg;
const bean = new Bean('org.apache.ignite.configuration.PersistentStoreConfiguration', 'PersistenceCfg',
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js
index 1c7fc44..0e786d9 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js
@@ -311,6 +311,46 @@ const DFLT_CLUSTER = {
rateTimeInterval: 60000
}
},
+ dataStorageConfiguration: {
+ systemCacheInitialSize: 41943040,
+ systemCacheMaxSize: 104857600,
+ pageSize: 2048,
+ storagePath: 'db',
+ dataRegionConfigurations: {
+ name: 'default',
+ initialSize: 268435456,
+ pageEvictionMode: {
+ clsName: 'org.apache.ignite.configuration.DataPageEvictionMode',
+ value: 'DISABLED'
+ },
+ evictionThreshold: 0.9,
+ emptyPagesPoolSize: 100,
+ metricsEnabled: false,
+ metricsSubIntervalCount: 5,
+ metricsRateTimeInterval: 60000
+ },
+ metricsEnabled: false,
+ alwaysWriteFullPages: false,
+ checkpointFrequency: 180000,
+ checkpointPageBufferSize: 268435456,
+ checkpointThreads: 4,
+ walMode: {
+ clsName: 'org.apache.ignite.configuration.WALMode',
+ value: 'DEFAULT'
+ },
+ walPath: 'db/wal',
+ walArchivePath: 'db/wal/archive',
+ walSegments: 10,
+ walSegmentSize: 67108864,
+ walHistorySize: 20,
+ walFlushFrequency: 2000,
+ walFsyncDelayNanos: 1000,
+ walRecordIteratorBufferSize: 67108864,
+ lockWaitTime: 10000,
+ walThreadLocalBufferSize: 131072,
+ metricsSubIntervalCount: 5,
+ metricsRateTimeInterval: 60000
+ },
utilityCacheKeepAliveTime: 60000,
hadoopConfiguration: {
mapReducePlanner: {
[13/50] [abbrv] ignite git commit: IGNITE-6647 Added missing Mongo
injector.
Posted by sb...@apache.org.
IGNITE-6647 Added missing Mongo injector.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/173ecef0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/173ecef0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/173ecef0
Branch: refs/heads/ignite-3478-tree
Commit: 173ecef0fadfeeaf2ffe03e5109962fce01c048e
Parents: 3a9fcd4
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Oct 20 11:23:23 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Oct 20 11:23:23 2017 +0700
----------------------------------------------------------------------
modules/web-console/backend/index.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/173ecef0/modules/web-console/backend/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/index.js b/modules/web-console/backend/index.js
index 06a38f8..8454789 100644
--- a/modules/web-console/backend/index.js
+++ b/modules/web-console/backend/index.js
@@ -122,8 +122,8 @@ const migrate = (dbConnectionUri, group, migrationsPath) => {
});
};
-injector('settings')
- .then(({mongoUrl}) => {
+Promise.all([injector('settings'), injector('mongo')])
+ .then(([{mongoUrl}]) => {
return migrate(mongoUrl, 'Ignite', path.join(__dirname, 'migrations'))
.then(() => migrate(mongoUrl, 'Ignite Modules', path.join(igniteModules, 'migrations')));
})
[38/50] [abbrv] ignite git commit: IGNITE-5741 Enable test after fix
- Fixes #2865.
Posted by sb...@apache.org.
IGNITE-5741 Enable test after fix - Fixes #2865.
Signed-off-by: Alexey Goncharuk <al...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1294bef4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1294bef4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1294bef4
Branch: refs/heads/ignite-3478-tree
Commit: 1294bef48d79f41e4223f64220663e4bd0718f90
Parents: fcabfca
Author: dpavlov <dp...@gridgain.com>
Authored: Mon Oct 23 17:14:03 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Oct 23 17:14:03 2017 +0300
----------------------------------------------------------------------
.../cache/persistence/db/IgnitePdsWholeClusterRestartTest.java | 2 --
1 file changed, 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1294bef4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWholeClusterRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWholeClusterRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWholeClusterRestartTest.java
index 91380f0..f52f446 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWholeClusterRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWholeClusterRestartTest.java
@@ -108,8 +108,6 @@ public class IgnitePdsWholeClusterRestartTest extends GridCommonAbstractTest {
* @throws Exception if failed.
*/
public void testRestarts() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-5741");
-
startGrids(GRID_CNT);
ignite(0).active(true);
[25/50] [abbrv] ignite git commit: IGNITE-6030 Fixed misspelled metric
Posted by sb...@apache.org.
IGNITE-6030 Fixed misspelled metric
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ec9a945a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ec9a945a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ec9a945a
Branch: refs/heads/ignite-3478-tree
Commit: ec9a945a1b9bb14b12359ff183014287faee8f87
Parents: ec41370
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Fri Oct 20 13:43:44 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Oct 20 13:43:44 2017 +0300
----------------------------------------------------------------------
.../core/src/main/java/org/apache/ignite/DataStorageMetrics.java | 2 +-
.../main/java/org/apache/ignite/DataStorageMetricsAdapter.java | 2 +-
.../processors/cache/persistence/DataStorageMetricsImpl.java | 2 +-
.../processors/cache/persistence/DataStorageMetricsSnapshot.java | 4 ++--
.../ignite/internal/visor/node/VisorPersistenceMetrics.java | 2 +-
.../java/org/apache/ignite/mxbean/DataStorageMetricsMXBean.java | 2 +-
6 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec9a945a/modules/core/src/main/java/org/apache/ignite/DataStorageMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/DataStorageMetrics.java b/modules/core/src/main/java/org/apache/ignite/DataStorageMetrics.java
index 87095f6..e26bb1f 100644
--- a/modules/core/src/main/java/org/apache/ignite/DataStorageMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/DataStorageMetrics.java
@@ -61,7 +61,7 @@ public interface DataStorageMetrics {
*
* @return Total checkpoint duration in milliseconds.
*/
- public long getLastCheckpointingDuration();
+ public long getLastCheckpointDuration();
/**
* Gets the duration of last checkpoint lock wait in milliseconds.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec9a945a/modules/core/src/main/java/org/apache/ignite/DataStorageMetricsAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/DataStorageMetricsAdapter.java b/modules/core/src/main/java/org/apache/ignite/DataStorageMetricsAdapter.java
index 6bb4b7e..431e264 100644
--- a/modules/core/src/main/java/org/apache/ignite/DataStorageMetricsAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/DataStorageMetricsAdapter.java
@@ -61,7 +61,7 @@ public class DataStorageMetricsAdapter implements PersistenceMetrics {
/** {@inheritDoc} */
@Override public long getLastCheckpointingDuration() {
- return delegate.getLastCheckpointingDuration();
+ return delegate.getLastCheckpointDuration();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec9a945a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsImpl.java
index 16707aa..6d196dc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsImpl.java
@@ -127,7 +127,7 @@ public class DataStorageMetricsImpl implements DataStorageMetricsMXBean {
}
/** {@inheritDoc} */
- @Override public long getLastCheckpointingDuration() {
+ @Override public long getLastCheckpointDuration() {
if (!metricsEnabled)
return 0;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec9a945a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsSnapshot.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsSnapshot.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsSnapshot.java
index 4841387..5bbb0e1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsSnapshot.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsSnapshot.java
@@ -67,7 +67,7 @@ public class DataStorageMetricsSnapshot implements DataStorageMetrics {
walWritingRate = metrics.getWalWritingRate();
walArchiveSegments = metrics.getWalArchiveSegments();
walFsyncTimeAvg = metrics.getWalFsyncTimeAverage();
- lastCpDuration = metrics.getLastCheckpointingDuration();
+ lastCpDuration = metrics.getLastCheckpointDuration();
lastCpLockWaitDuration = metrics.getLastCheckpointLockWaitDuration();
lastCpMmarkDuration = metrics.getLastCheckpointMarkDuration();
lastCpPagesWriteDuration = metrics.getLastCheckpointPagesWriteDuration();
@@ -98,7 +98,7 @@ public class DataStorageMetricsSnapshot implements DataStorageMetrics {
}
/** {@inheritDoc} */
- @Override public long getLastCheckpointingDuration() {
+ @Override public long getLastCheckpointDuration() {
return lastCpDuration;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec9a945a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistenceMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistenceMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistenceMetrics.java
index 165855c..d7aed5f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistenceMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistenceMetrics.java
@@ -81,7 +81,7 @@ public class VisorPersistenceMetrics extends VisorDataTransferObject {
walWritingRate = metrics.getWalWritingRate();
walArchiveSegments = metrics.getWalArchiveSegments();
walFsyncTimeAvg = metrics.getWalFsyncTimeAverage();
- lastCpDuration = metrics.getLastCheckpointingDuration();
+ lastCpDuration = metrics.getLastCheckpointDuration();
lastCpLockWaitDuration = metrics.getLastCheckpointLockWaitDuration();
lastCpMmarkDuration = metrics.getLastCheckpointMarkDuration();
lastCpPagesWriteDuration = metrics.getLastCheckpointPagesWriteDuration();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec9a945a/modules/core/src/main/java/org/apache/ignite/mxbean/DataStorageMetricsMXBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/mxbean/DataStorageMetricsMXBean.java b/modules/core/src/main/java/org/apache/ignite/mxbean/DataStorageMetricsMXBean.java
index f0fb631..40410cb 100644
--- a/modules/core/src/main/java/org/apache/ignite/mxbean/DataStorageMetricsMXBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/mxbean/DataStorageMetricsMXBean.java
@@ -42,7 +42,7 @@ public interface DataStorageMetricsMXBean extends DataStorageMetrics {
/** {@inheritDoc} */
@MXBeanDescription("Duration of the last checkpoint in milliseconds.")
- @Override long getLastCheckpointingDuration();
+ @Override long getLastCheckpointDuration();
/** {@inheritDoc} */
@MXBeanDescription("Duration of the checkpoint lock wait in milliseconds.")
[43/50] [abbrv] ignite git commit: IGNITE-6706: Removed
ignite-sqlline module from "optional" build directory. This closes #2901.
Posted by sb...@apache.org.
IGNITE-6706: Removed ignite-sqlline module from "optional" build directory. This closes #2901.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/896d4cd5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/896d4cd5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/896d4cd5
Branch: refs/heads/ignite-3478-tree
Commit: 896d4cd58fbed5b8bd20e7db0b5810bb98a8d196
Parents: be8787a
Author: oleg-ostanin <oo...@gridgain.com>
Authored: Tue Oct 24 09:48:04 2017 +0300
Committer: devozerov <pp...@gmail.com>
Committed: Tue Oct 24 09:52:23 2017 +0300
----------------------------------------------------------------------
assembly/dependencies-fabric-lgpl.xml | 1 +
assembly/dependencies-fabric.xml | 1 +
assembly/dependencies-sqlline.xml | 12 ------------
3 files changed, 2 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/896d4cd5/assembly/dependencies-fabric-lgpl.xml
----------------------------------------------------------------------
diff --git a/assembly/dependencies-fabric-lgpl.xml b/assembly/dependencies-fabric-lgpl.xml
index 82b5d5c..1347c05 100644
--- a/assembly/dependencies-fabric-lgpl.xml
+++ b/assembly/dependencies-fabric-lgpl.xml
@@ -135,6 +135,7 @@
<exclude>org.apache.ignite:ignite-web-agent</exclude>
<exclude>org.apache.ignite:ignite-dev-utils</exclude>
<exclude>org.apache.ignite:ignite-extdata-platform</exclude>
+ <exclude>org.apache.ignite:ignite-sqlline</exclude>
</excludes>
<sources>
<includeModuleDirectory>true</includeModuleDirectory>
http://git-wip-us.apache.org/repos/asf/ignite/blob/896d4cd5/assembly/dependencies-fabric.xml
----------------------------------------------------------------------
diff --git a/assembly/dependencies-fabric.xml b/assembly/dependencies-fabric.xml
index 3e9405b..4d9c870 100644
--- a/assembly/dependencies-fabric.xml
+++ b/assembly/dependencies-fabric.xml
@@ -140,6 +140,7 @@
<exclude>org.apache.ignite:ignite-web-agent</exclude>
<exclude>org.apache.ignite:ignite-dev-utils</exclude>
<exclude>org.apache.ignite:ignite-extdata-platform</exclude>
+ <exclude>org.apache.ignite:ignite-sqlline</exclude>
</excludes>
<sources>
<includeModuleDirectory>true</includeModuleDirectory>
http://git-wip-us.apache.org/repos/asf/ignite/blob/896d4cd5/assembly/dependencies-sqlline.xml
----------------------------------------------------------------------
diff --git a/assembly/dependencies-sqlline.xml b/assembly/dependencies-sqlline.xml
index f8953a1..e58a399 100644
--- a/assembly/dependencies-sqlline.xml
+++ b/assembly/dependencies-sqlline.xml
@@ -38,18 +38,6 @@
<includeModuleDirectory>false</includeModuleDirectory>
<fileSets>
<fileSet>
- <directory>target</directory>
- <outputDirectory>include/sqlline</outputDirectory>
- <includes>
- <include>*.jar</include>
- </includes>
- <excludes>
- <exclude>*-tests.jar</exclude>
- <exclude>*-javadoc.jar</exclude>
- <exclude>*-sources.jar</exclude>
- </excludes>
- </fileSet>
- <fileSet>
<directory>target/libs</directory>
<outputDirectory>include/sqlline</outputDirectory>
</fileSet>
[47/50] [abbrv] ignite git commit: IGNITE-6719 Get rid of no-op
segment lock/unlock in PageMemoryImpl
Posted by sb...@apache.org.
IGNITE-6719 Get rid of no-op segment lock/unlock in PageMemoryImpl
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/22ee726e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/22ee726e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/22ee726e
Branch: refs/heads/ignite-3478-tree
Commit: 22ee726e5f2b0023ed9f1d6289cae7253cc74769
Parents: 62cb4fb
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Tue Oct 24 11:22:07 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Tue Oct 24 11:22:28 2017 +0300
----------------------------------------------------------------------
.../persistence/pagemem/PageMemoryImpl.java | 37 +++++++++++---------
1 file changed, 21 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/22ee726e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
index 4a4fe9e..a773b42 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
@@ -119,9 +119,6 @@ public class PageMemoryImpl implements PageMemoryEx {
/** Dirty flag. */
private static final long DIRTY_FLAG = 0x0100000000000000L;
- /** Dirty flag. */
- private static final long TMP_DIRTY_FLAG = 0x0200000000000000L;
-
/** Invalid relative pointer value. */
private static final long INVALID_REL_PTR = RELATIVE_PTR_MASK;
@@ -237,9 +234,6 @@ public class PageMemoryImpl implements PageMemoryEx {
/** */
private DataRegionMetricsImpl memMetrics;
- /** */
- private volatile boolean closed;
-
/**
* @param directMemoryProvider Memory allocator to use.
* @param sharedCtx Cache shared context.
@@ -361,14 +355,8 @@ public class PageMemoryImpl implements PageMemoryEx {
U.shutdownNow(getClass(), asyncRunner, log);
- closed = true;
-
- for (Segment seg : segments) {
- // Make sure all threads have left the lock.
- seg.writeLock().lock();
-
- seg.writeLock().unlock();
- }
+ for (Segment seg : segments)
+ seg.close();
directMemoryProvider.shutdown();
}
@@ -1105,7 +1093,7 @@ public class PageMemoryImpl implements PageMemoryEx {
seg.readLock().lock();
try {
- if (closed)
+ if (seg.closed)
continue;
total += seg.loadedPages.size();
@@ -1129,7 +1117,7 @@ public class PageMemoryImpl implements PageMemoryEx {
seg.readLock().lock();
try {
- if (closed)
+ if (seg.closed)
continue;
total += seg.acquiredPages();
@@ -1670,6 +1658,9 @@ public class PageMemoryImpl implements PageMemoryEx {
/** Maps partition (cacheId, partId) to its tag. Tag is 1-based incrementing partition file counter */
private final Map<T2<Integer, Integer>, Integer> partTagMap = new HashMap<>();
+ /** */
+ private boolean closed;
+
/**
* @param region Memory region.
* @param throttlingEnabled Write throttling enabled flag.
@@ -1695,6 +1686,20 @@ public class PageMemoryImpl implements PageMemoryEx {
}
/**
+ * Closes the segment.
+ */
+ private void close() {
+ writeLock().lock();
+
+ try {
+ closed = true;
+ }
+ finally {
+ writeLock().unlock();
+ }
+ }
+
+ /**
*
*/
private boolean safeToUpdate() {
[46/50] [abbrv] ignite git commit: Fixed affinityReadyFuture
(lastFinishedFuture could be null for compute jobs).
Posted by sb...@apache.org.
Fixed affinityReadyFuture (lastFinishedFuture could be null for compute jobs).
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/62cb4fb5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/62cb4fb5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/62cb4fb5
Branch: refs/heads/ignite-3478-tree
Commit: 62cb4fb55481b53f780d588d865cbbd1f4d5f45f
Parents: 8afeb67
Author: sboikov <sb...@gridgain.com>
Authored: Tue Oct 24 11:19:43 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Oct 24 11:19:43 2017 +0300
----------------------------------------------------------------------
.../ignite/internal/processors/cache/GridCacheAffinityManager.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/62cb4fb5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java
index fbe1a95..14a1344 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java
@@ -99,7 +99,7 @@ public class GridCacheAffinityManager extends GridCacheManagerAdapter {
IgniteInternalFuture<AffinityTopologyVersion> fut = aff.readyFuture(topVer);
- return fut != null ? fut : cctx.shared().exchange().lastFinishedFuture();
+ return fut != null ? fut : new GridFinishedFuture<>(aff.lastVersion());
}
/**
[19/50] [abbrv] ignite git commit: IGNITE-6030 Allow enabling
persistence per data region
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorDataRegionConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorDataRegionConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorDataRegionConfiguration.java
new file mode 100644
index 0000000..394e294
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorDataRegionConfiguration.java
@@ -0,0 +1,225 @@
+/*
+ * 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.internal.visor.node;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.ignite.configuration.DataPageEvictionMode;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Data transfer object for data region configuration.
+ */
+public class VisorDataRegionConfiguration extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Unique name of DataRegion. */
+ private String name;
+
+ /** Initial memory region size defined by this memory policy. */
+ private long initSize;
+
+ /** Maximum memory region size defined by this memory policy. */
+ private long maxSize;
+
+ /** Path for memory mapped file. */
+ private String swapPath;
+
+ /** An algorithm for memory pages eviction. */
+ private DataPageEvictionMode pageEvictionMode;
+
+ /** A threshold for memory pages eviction initiation. */
+ private double evictionThreshold;
+
+ /** Minimum number of empty pages in reuse lists. */
+ private int emptyPagesPoolSize;
+
+ /** Enable memory metrics collection for this data region. */
+ private boolean metricsEnabled;
+
+ /** Number of sub-intervals. */
+ private int metricsSubIntervalCount;
+
+ /** Time interval over which allocation rate is calculated. */
+ private long metricsRateTimeInterval;
+
+ /** Enable Ignite Native Persistence. */
+ private boolean persistenceEnabled;
+
+ /**
+ * Default constructor.
+ */
+ public VisorDataRegionConfiguration() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param plc Data region configuration.
+ */
+ public VisorDataRegionConfiguration(DataRegionConfiguration plc) {
+ assert plc != null;
+
+ name = plc.getName();
+ initSize = plc.getInitialSize();
+ maxSize = plc.getMaxSize();
+ swapPath = plc.getSwapPath();
+ pageEvictionMode = plc.getPageEvictionMode();
+ evictionThreshold = plc.getEvictionThreshold();
+ emptyPagesPoolSize = plc.getEmptyPagesPoolSize();
+ metricsEnabled = plc.isMetricsEnabled();
+ metricsSubIntervalCount = plc.getMetricsSubIntervalCount();
+ metricsRateTimeInterval = plc.getMetricsRateTimeInterval();
+ persistenceEnabled = plc.isPersistenceEnabled();
+ }
+
+ /**
+ * @param regCfgs Array of data region configurations.
+ * @return Collection of DTO objects.
+ */
+ public static List<VisorDataRegionConfiguration> from(DataRegionConfiguration[] regCfgs) {
+ List<VisorDataRegionConfiguration> res = new ArrayList<>();
+
+ if (regCfgs != null) {
+ for (DataRegionConfiguration plc: regCfgs)
+ res.add(new VisorDataRegionConfiguration(plc));
+ }
+
+ return res;
+ }
+
+ /**
+ * @return Unique name of DataRegion.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return Maximum memory region size defined by this memory policy.
+ */
+ public long getMaxSize() {
+ return maxSize;
+ }
+
+ /**
+ * @return Initial memory region size defined by this memory policy.
+ */
+ public long getInitialSize() {
+ return initSize;
+ }
+
+ /**
+ * @return Path for memory mapped file.
+ */
+ public String getSwapPath() {
+ return swapPath;
+ }
+
+ /**
+ * @return Memory pages eviction algorithm. {@link DataPageEvictionMode#DISABLED} used by default.
+ */
+ public DataPageEvictionMode getPageEvictionMode() {
+ return pageEvictionMode;
+ }
+
+ /**
+ * @return Memory pages eviction threshold.
+ */
+ public double getEvictionThreshold() {
+ return evictionThreshold;
+ }
+
+ /**
+ * @return Minimum number of empty pages in reuse list.
+ */
+ public int getEmptyPagesPoolSize() {
+ return emptyPagesPoolSize;
+ }
+
+ /**
+ * @return Metrics enabled flag.
+ */
+ public boolean isMetricsEnabled() {
+ return metricsEnabled;
+ }
+
+ /**
+ * @return Number of sub intervals.
+ */
+ public int getMetricsSubIntervalCount() {
+ return metricsSubIntervalCount;
+ }
+
+ /**
+ * @return Time interval over which allocation rate is calculated.
+ */
+ public long getMetricsRateTimeInterval() {
+ return metricsRateTimeInterval;
+ }
+
+ /**
+ * @return Persistence enabled flag.
+ */
+ public boolean isPersistenceEnabled() {
+ return persistenceEnabled;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, name);
+ out.writeLong(initSize);
+ out.writeLong(maxSize);
+ U.writeString(out, swapPath);
+ U.writeEnum(out, pageEvictionMode);
+ out.writeDouble(evictionThreshold);
+ out.writeInt(emptyPagesPoolSize);
+ out.writeBoolean(metricsEnabled);
+ out.writeInt(metricsSubIntervalCount);
+ out.writeLong(metricsRateTimeInterval);
+ out.writeBoolean(persistenceEnabled);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ name = U.readString(in);
+ initSize = in.readLong();
+ maxSize = in.readLong();
+ swapPath = U.readString(in);
+ pageEvictionMode = DataPageEvictionMode.fromOrdinal(in.readByte());
+ evictionThreshold = in.readDouble();
+ emptyPagesPoolSize = in.readInt();
+ metricsEnabled = in.readBoolean();
+ metricsSubIntervalCount = in.readInt();
+ metricsRateTimeInterval = in.readLong();
+ persistenceEnabled = in.readBoolean();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorDataRegionConfiguration.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorDataStorageConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorDataStorageConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorDataStorageConfiguration.java
new file mode 100644
index 0000000..78bf1c5
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorDataStorageConfiguration.java
@@ -0,0 +1,453 @@
+/*
+ * 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.internal.visor.node;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.List;
+import org.apache.ignite.configuration.CheckpointWriteOrder;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
+
+/**
+ * Data transfer object for data store configuration.
+ */
+public class VisorDataStorageConfiguration extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Size of a memory chunk reserved for system cache initially. */
+ private long sysRegionInitSize;
+
+ /** Size of memory for system cache. */
+ private long sysRegionMaxSize;
+
+ /** Page size. */
+ private int pageSize;
+
+ /** Concurrency level. */
+ private int concLvl;
+
+ /** Configuration of default data region. */
+ private VisorDataRegionConfiguration dfltDataRegCfg;
+
+ /** Memory policies. */
+ private List<VisorDataRegionConfiguration> dataRegCfgs;
+
+ /** */
+ private String storagePath;
+
+ /** Checkpointing frequency. */
+ private long checkpointFreq;
+
+ /** Lock wait time. */
+ private long lockWaitTime;
+
+ /** */
+ private long checkpointPageBufSize;
+
+ /** */
+ private int checkpointThreads;
+
+ /** Checkpoint write order. */
+ private CheckpointWriteOrder checkpointWriteOrder;
+
+ /** */
+ private int walHistSize;
+
+ /** Number of work WAL segments. */
+ private int walSegments;
+
+ /** Number of WAL segments to keep. */
+ private int walSegmentSize;
+
+ /** WAL persistence path. */
+ private String walPath;
+
+ /** WAL archive path. */
+ private String walArchivePath;
+
+ /** Metrics enabled flag. */
+ private boolean metricsEnabled;
+
+ /** Wal mode. */
+ private WALMode walMode;
+
+ /** WAl thread local buffer size. */
+ private int walTlbSize;
+
+ /** Wal flush frequency. */
+ private long walFlushFreq;
+
+ /** Wal fsync delay in nanoseconds. */
+ private long walFsyncDelay;
+
+ /** Wal record iterator buffer size. */
+ private int walRecordIterBuffSize;
+
+ /** Always write full pages. */
+ private boolean alwaysWriteFullPages;
+
+ /** Factory to provide I/O interface for files */
+ private String fileIOFactory;
+
+ /** Number of sub-intervals. */
+ private int metricsSubIntervalCount;
+
+ /** Time interval (in milliseconds) for rate-based metrics. */
+ private long metricsRateTimeInterval;
+
+ /** Time interval (in milliseconds) for running auto archiving for incompletely WAL segment */
+ private long walAutoArchiveAfterInactivity;
+
+ /** If true, threads that generate dirty pages too fast during ongoing checkpoint will be throttled. */
+ private boolean writeThrottlingEnabled;
+
+ /**
+ * Default constructor.
+ */
+ public VisorDataStorageConfiguration() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param cfg Data storage configuration.
+ */
+ public VisorDataStorageConfiguration(DataStorageConfiguration cfg) {
+ assert cfg != null;
+
+ sysRegionInitSize = cfg.getSystemRegionInitialSize();
+ sysRegionMaxSize = cfg.getSystemRegionMaxSize();
+ pageSize = cfg.getPageSize();
+ concLvl = cfg.getConcurrencyLevel();
+
+ DataRegionConfiguration dfltRegion = cfg.getDefaultDataRegionConfiguration();
+
+ if (dfltRegion != null)
+ dfltDataRegCfg = new VisorDataRegionConfiguration(dfltRegion);
+
+ dataRegCfgs = VisorDataRegionConfiguration.from(cfg.getDataRegionConfigurations());
+
+ storagePath = cfg.getStoragePath();
+ checkpointFreq = cfg.getCheckpointFrequency();
+ lockWaitTime = cfg.getLockWaitTime();
+ checkpointPageBufSize = cfg.getCheckpointPageBufferSize();
+ checkpointThreads = cfg.getCheckpointThreads();
+ checkpointWriteOrder = cfg.getCheckpointWriteOrder();
+ walHistSize = cfg.getWalHistorySize();
+ walSegments = cfg.getWalSegments();
+ walSegmentSize = cfg.getWalSegmentSize();
+ walPath = cfg.getWalPath();
+ walArchivePath = cfg.getWalArchivePath();
+ metricsEnabled = cfg.isMetricsEnabled();
+ walMode = cfg.getWalMode();
+ walTlbSize = cfg.getWalThreadLocalBufferSize();
+ walFlushFreq = cfg.getWalFlushFrequency();
+ walFsyncDelay = cfg.getWalFsyncDelayNanos();
+ walRecordIterBuffSize = cfg.getWalRecordIteratorBufferSize();
+ alwaysWriteFullPages = cfg.isAlwaysWriteFullPages();
+ fileIOFactory = compactClass(cfg.getFileIOFactory());
+ metricsSubIntervalCount = cfg.getMetricsSubIntervalCount();
+ metricsRateTimeInterval = cfg.getMetricsRateTimeInterval();
+ walAutoArchiveAfterInactivity = cfg.getWalAutoArchiveAfterInactivity();
+ writeThrottlingEnabled = cfg.isWriteThrottlingEnabled();
+ }
+
+ /**
+ * @return Initial size in bytes.
+ */
+ public long getSystemRegionInitialSize() {
+ return sysRegionInitSize;
+ }
+
+ /**
+ * @return Maximum in bytes.
+ */
+ public long getSystemRegionMaxSize() {
+ return sysRegionMaxSize;
+ }
+
+ /**
+ * @return Page size in bytes.
+ */
+ public int getPageSize() {
+ return pageSize;
+ }
+
+ /**
+ * @return Mapping table concurrency level.
+ */
+ public int getConcurrencyLevel() {
+ return concLvl;
+ }
+
+ /**
+ * @return Configuration of default data region.
+ */
+ public VisorDataRegionConfiguration getDefaultDataRegionConfiguration() {
+ return dfltDataRegCfg;
+ }
+
+ /**
+ * @return Array of configured data regions.
+ */
+ public List<VisorDataRegionConfiguration> getDataRegionConfigurations() {
+ return dataRegCfgs;
+ }
+
+ /**
+ * @return Path the root directory where the Persistent Store will persist data and indexes.
+ */
+ public String getStoragePath() {
+ return storagePath;
+ }
+
+ /**
+ * @return Checkpointing frequency in milliseconds.
+ */
+ public long getCheckpointFrequency() {
+ return checkpointFreq;
+ }
+
+ /**
+ * @return Checkpointing page buffer size in bytes.
+ */
+ public long getCheckpointPageBufferSize() {
+ return checkpointPageBufSize;
+ }
+
+ /**
+ * @return Number of checkpointing threads.
+ */
+ public int getCheckpointThreads() {
+ return checkpointThreads;
+ }
+
+ /**
+ * @return Checkpoint write order.
+ */
+ public CheckpointWriteOrder getCheckpointWriteOrder() {
+ return checkpointWriteOrder;
+ }
+
+ /**
+ * @return Time for wait.
+ */
+ public long getLockWaitTime() {
+ return lockWaitTime;
+ }
+
+ /**
+ * @return Number of WAL segments to keep after a checkpoint is finished.
+ */
+ public int getWalHistorySize() {
+ return walHistSize;
+ }
+
+ /**
+ * @return Number of work WAL segments.
+ */
+ public int getWalSegments() {
+ return walSegments;
+ }
+
+ /**
+ * @return WAL segment size.
+ */
+ public int getWalSegmentSize() {
+ return walSegmentSize;
+ }
+
+ /**
+ * @return WAL persistence path, absolute or relative to Ignite work directory.
+ */
+ public String getWalPath() {
+ return walPath;
+ }
+
+ /**
+ * @return WAL archive directory.
+ */
+ public String getWalArchivePath() {
+ return walArchivePath;
+ }
+
+ /**
+ * @return Metrics enabled flag.
+ */
+ public boolean isMetricsEnabled() {
+ return metricsEnabled;
+ }
+
+ /**
+ * @return Time interval in milliseconds.
+ */
+ public long getMetricsRateTimeInterval() {
+ return metricsRateTimeInterval;
+ }
+
+ /**
+ * @return The number of sub-intervals for history tracking.
+ */
+ public int getMetricsSubIntervalCount() {
+ return metricsSubIntervalCount;
+ }
+
+ /**
+ * @return WAL mode.
+ */
+ public WALMode getWalMode() {
+ return walMode;
+ }
+
+ /**
+ * @return Thread local buffer size.
+ */
+ public int getWalThreadLocalBufferSize() {
+ return walTlbSize;
+ }
+
+ /**
+ * @return Flush frequency.
+ */
+ public long getWalFlushFrequency() {
+ return walFlushFreq;
+ }
+
+ /**
+ * @return Gets the fsync delay, in nanoseconds.
+ */
+ public long getWalFsyncDelayNanos() {
+ return walFsyncDelay;
+ }
+
+ /**
+ * @return Record iterator buffer size.
+ */
+ public int getWalRecordIteratorBufferSize() {
+ return walRecordIterBuffSize;
+ }
+
+ /**
+ * @return Flag indicating whether full pages should be always written.
+ */
+ public boolean isAlwaysWriteFullPages() {
+ return alwaysWriteFullPages;
+ }
+
+ /**
+ * @return File I/O factory class name.
+ */
+ public String getFileIOFactory() {
+ return fileIOFactory;
+ }
+
+ /**
+ * @return Time in millis.
+ */
+ public long getWalAutoArchiveAfterInactivity() {
+ return walAutoArchiveAfterInactivity;
+ }
+
+ /**
+ * @return Flag indicating whether write throttling is enabled.
+ */
+ public boolean isWriteThrottlingEnabled() {
+ return writeThrottlingEnabled;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ out.writeLong(sysRegionInitSize);
+ out.writeLong(sysRegionMaxSize);
+ out.writeInt(pageSize);
+ out.writeInt(concLvl);
+ out.writeObject(dfltDataRegCfg);
+ U.writeCollection(out, dataRegCfgs);
+ U.writeString(out, storagePath);
+ out.writeLong(checkpointFreq);
+ out.writeLong(lockWaitTime);
+ out.writeLong(checkpointPageBufSize);
+ out.writeInt(checkpointThreads);
+ U.writeEnum(out, checkpointWriteOrder);
+ out.writeInt(walHistSize);
+ out.writeInt(walSegments);
+ out.writeInt(walSegmentSize);
+ U.writeString(out, walPath);
+ U.writeString(out, walArchivePath);
+ out.writeBoolean(metricsEnabled);
+ U.writeEnum(out, walMode);
+ out.writeInt(walTlbSize);
+ out.writeLong(walFlushFreq);
+ out.writeLong(walFsyncDelay);
+ out.writeInt(walRecordIterBuffSize);
+ out.writeBoolean(alwaysWriteFullPages);
+ U.writeString(out, fileIOFactory);
+ out.writeInt(metricsSubIntervalCount);
+ out.writeLong(metricsRateTimeInterval);
+ out.writeLong(walAutoArchiveAfterInactivity);
+ out.writeBoolean(writeThrottlingEnabled);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ sysRegionInitSize = in.readLong();
+ sysRegionMaxSize = in.readLong();
+ pageSize = in.readInt();
+ concLvl = in.readInt();
+ dfltDataRegCfg = (VisorDataRegionConfiguration)in.readObject();
+ dataRegCfgs = U.readList(in);
+ storagePath = U.readString(in);
+ checkpointFreq = in.readLong();
+ lockWaitTime = in.readLong();
+ checkpointPageBufSize = in.readLong();
+ checkpointThreads = in.readInt();
+ checkpointWriteOrder = CheckpointWriteOrder.fromOrdinal(in.readByte());
+ walHistSize = in.readInt();
+ walSegments = in.readInt();
+ walSegmentSize = in.readInt();
+ walPath = U.readString(in);
+ walArchivePath = U.readString(in);
+ metricsEnabled = in.readBoolean();
+ walMode = WALMode.fromOrdinal(in.readByte());
+ walTlbSize = in.readInt();
+ walFlushFreq = in.readLong();
+ walFsyncDelay = in.readLong();
+ walRecordIterBuffSize = in.readInt();
+ alwaysWriteFullPages = in.readBoolean();
+ fileIOFactory = U.readString(in);
+ metricsSubIntervalCount = in.readInt();
+ metricsRateTimeInterval = in.readLong();
+ walAutoArchiveAfterInactivity = in.readLong();
+ writeThrottlingEnabled = in.readBoolean();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorDataStorageConfiguration.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
index a716a76..99cce40 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
@@ -119,6 +119,9 @@ public class VisorGridConfiguration extends VisorDataTransferObject {
/** List of service configurations. */
private List<VisorServiceConfiguration> srvcCfgs;
+ /** Configuration of data storage. */
+ private VisorDataStorageConfiguration dataStorage;
+
/**
* Default constructor.
*/
@@ -153,11 +156,11 @@ public class VisorGridConfiguration extends VisorDataTransferObject {
atomic = new VisorAtomicConfiguration(c.getAtomicConfiguration());
txCfg = new VisorTransactionConfiguration(c.getTransactionConfiguration());
- if (c.getMemoryConfiguration() != null)
- memCfg = new VisorMemoryConfiguration(c.getMemoryConfiguration());
+ if (c.getDataStorageConfiguration() != null)
+ memCfg = null;
- if (c.getPersistentStoreConfiguration() != null)
- psCfg = new VisorPersistentStoreConfiguration(c.getPersistentStoreConfiguration());
+ if (c.getDataStorageConfiguration() != null)
+ psCfg = null;
storeSesLsnrs = compactArray(c.getCacheStoreSessionListenerFactories());
warmupClos = compactClass(c.getWarmupClosure());
@@ -180,6 +183,8 @@ public class VisorGridConfiguration extends VisorDataTransferObject {
sqlConnCfg = new VisorSqlConnectorConfiguration(scc);
srvcCfgs = VisorServiceConfiguration.list(c.getServiceConfiguration());
+
+ dataStorage = new VisorDataStorageConfiguration(c.getDataStorageConfiguration());
}
/**
@@ -357,6 +362,18 @@ public class VisorGridConfiguration extends VisorDataTransferObject {
return srvcCfgs;
}
+ /**
+ * @return Configuration of data storage.
+ */
+ public VisorDataStorageConfiguration getDataStorageConfiguration() {
+ return dataStorage;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte getProtocolVersion() {
+ return V2;
+ }
+
/** {@inheritDoc} */
@Override protected void writeExternalData(ObjectOutput out) throws IOException {
out.writeObject(basic);
@@ -384,6 +401,7 @@ public class VisorGridConfiguration extends VisorDataTransferObject {
out.writeObject(hadoopCfg);
out.writeObject(sqlConnCfg);
U.writeCollection(out, srvcCfgs);
+ out.writeObject(dataStorage);
}
/** {@inheritDoc} */
@@ -413,6 +431,9 @@ public class VisorGridConfiguration extends VisorDataTransferObject {
hadoopCfg = (VisorHadoopConfiguration)in.readObject();
sqlConnCfg = (VisorSqlConnectorConfiguration) in.readObject();
srvcCfgs = U.readList(in);
+
+ if (protoVer == V2)
+ dataStorage = (VisorDataStorageConfiguration)in.readObject();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryConfiguration.java
index ccb23ac..6708f9a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryConfiguration.java
@@ -22,8 +22,8 @@ import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.ArrayList;
import java.util.List;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -48,10 +48,10 @@ public class VisorMemoryConfiguration extends VisorDataTransferObject {
/** Concurrency level. */
private int concLvl;
- /** Name of MemoryPolicy to be used as default. */
+ /** Name of DataRegion to be used as default. */
private String dfltMemPlcName;
- /** Size of memory (in bytes) to use for default MemoryPolicy. */
+ /** Size of memory (in bytes) to use for default DataRegion. */
private long dfltMemPlcSize;
/** Memory policies. */
@@ -69,22 +69,22 @@ public class VisorMemoryConfiguration extends VisorDataTransferObject {
*
* @param memCfg Memory configuration.
*/
- public VisorMemoryConfiguration(MemoryConfiguration memCfg) {
+ public VisorMemoryConfiguration(DataStorageConfiguration memCfg) {
assert memCfg != null;
- sysCacheInitSize = memCfg.getSystemCacheInitialSize();
- sysCacheMaxSize = memCfg.getSystemCacheMaxSize();
+ sysCacheInitSize = memCfg.getSystemRegionInitialSize();
+ sysCacheMaxSize = memCfg.getSystemRegionMaxSize();
pageSize = memCfg.getPageSize();
concLvl = memCfg.getConcurrencyLevel();
- dfltMemPlcName = memCfg.getDefaultMemoryPolicyName();
- dfltMemPlcSize = memCfg.getDefaultMemoryPolicySize();
+// dfltMemPlcName = memCfg.getDefaultDataRegionName();
+ //dfltMemPlcSize = memCfg.getDefaultDataRegionSize();
- MemoryPolicyConfiguration[] plcs = memCfg.getMemoryPolicies();
+ DataRegionConfiguration[] plcs = memCfg.getDataRegionConfigurations();
if (!F.isEmpty(plcs)) {
memPlcs = new ArrayList<>(plcs.length);
- for (MemoryPolicyConfiguration plc : plcs)
+ for (DataRegionConfiguration plc : plcs)
memPlcs.add(new VisorMemoryPolicyConfiguration(plc));
}
}
@@ -118,7 +118,7 @@ public class VisorMemoryConfiguration extends VisorDataTransferObject {
}
/**
- * @return Name of MemoryPolicy to be used as default.
+ * @return Name of DataRegion to be used as default.
*/
public String getDefaultMemoryPolicyName() {
return dfltMemPlcName;
@@ -132,7 +132,7 @@ public class VisorMemoryConfiguration extends VisorDataTransferObject {
}
/**
- * @return Collection of MemoryPolicyConfiguration objects.
+ * @return Collection of DataRegionConfiguration objects.
*/
public List<VisorMemoryPolicyConfiguration> getMemoryPolicies() {
return memPlcs;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryPolicyConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryPolicyConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryPolicyConfiguration.java
index bed4c4b..92159a8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryPolicyConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryPolicyConfiguration.java
@@ -21,7 +21,7 @@ import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import org.apache.ignite.configuration.DataPageEvictionMode;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.visor.VisorDataTransferObject;
@@ -33,7 +33,7 @@ public class VisorMemoryPolicyConfiguration extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
- /** Unique name of MemoryPolicy. */
+ /** Unique name of DataRegion. */
private String name;
/** Maximum memory region size defined by this memory policy. */
@@ -69,20 +69,20 @@ public class VisorMemoryPolicyConfiguration extends VisorDataTransferObject {
*
* @param plc Memory policy configuration.
*/
- public VisorMemoryPolicyConfiguration(MemoryPolicyConfiguration plc) {
+ public VisorMemoryPolicyConfiguration(DataRegionConfiguration plc) {
assert plc != null;
name = plc.getName();
maxSize = plc.getMaxSize();
initSize = plc.getInitialSize();
- swapFilePath = plc.getSwapFilePath();
+ swapFilePath = plc.getSwapPath();
pageEvictionMode = plc.getPageEvictionMode();
evictionThreshold = plc.getEvictionThreshold();
emptyPagesPoolSize = plc.getEmptyPagesPoolSize();
}
/**
- * Unique name of MemoryPolicy.
+ * Unique name of DataRegion.
*/
public String getName() {
return name;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
index 3fd7b0d..99d1132 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
@@ -21,7 +21,7 @@ import java.util.Collection;
import java.util.List;
import java.util.concurrent.ConcurrentMap;
import org.apache.ignite.IgniteFileSystem;
-import org.apache.ignite.MemoryMetrics;
+import org.apache.ignite.DataRegionMetrics;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.FileSystemConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
@@ -157,7 +157,7 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
try {
List<VisorMemoryMetrics> memoryMetrics = res.getMemoryMetrics();
- for (MemoryMetrics m : ignite.memoryMetrics())
+ for (DataRegionMetrics m : ignite.dataRegionMetrics())
memoryMetrics.add(new VisorMemoryMetrics(m));
}
catch (Exception e) {
@@ -257,7 +257,7 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
*/
protected void persistenceMetrics(VisorNodeDataCollectorJobResult res) {
try {
- res.setPersistenceMetrics(new VisorPersistenceMetrics(ignite.persistentStoreMetrics()));
+ res.setPersistenceMetrics(new VisorPersistenceMetrics(ignite.dataStorageMetrics()));
}
catch (Exception e) {
res.setPersistenceMetricsEx(new VisorExceptionWrapper(e));
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java
index 90ecf6e..0612c5e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java
@@ -54,7 +54,7 @@ public class VisorNodeDataCollectorJobResult extends VisorDataTransferObject {
/** Exception while collecting node events. */
private VisorExceptionWrapper evtsEx;
- /** Node memory metrics. */
+ /** Node data region metrics. */
private List<VisorMemoryMetrics> memoryMetrics = new ArrayList<>();
/** Exception while collecting memory metrics. */
@@ -161,7 +161,7 @@ public class VisorNodeDataCollectorJobResult extends VisorDataTransferObject {
}
/**
- * @return Collected memory metrics.
+ * @return Collected data region metrics.
*/
public List<VisorMemoryMetrics> getMemoryMetrics() {
return memoryMetrics;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
index 6e10b84..ace964c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
@@ -67,7 +67,7 @@ public class VisorNodeDataCollectorTaskResult extends VisorDataTransferObject {
/** Exceptions caught during collecting events from nodes. */
private Map<UUID, VisorExceptionWrapper> evtsEx = new HashMap<>();
- /** All memory metrics collected from nodes. */
+ /** All data region metrics collected from nodes. */
private Map<UUID, Collection<VisorMemoryMetrics>> memoryMetrics = new HashMap<>();
/** Exceptions caught during collecting memory metrics from nodes. */
@@ -188,7 +188,7 @@ public class VisorNodeDataCollectorTaskResult extends VisorDataTransferObject {
}
/**
- * @return All memory metrics collected from nodes.
+ * @return All data region metrics collected from nodes.
*/
public Map<UUID, Collection<VisorMemoryMetrics>> getMemoryMetrics() {
return memoryMetrics;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistenceMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistenceMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistenceMetrics.java
index c838161..165855c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistenceMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistenceMetrics.java
@@ -19,12 +19,12 @@ package org.apache.ignite.internal.visor.node;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
-import org.apache.ignite.PersistenceMetrics;
+import org.apache.ignite.DataStorageMetrics;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.visor.VisorDataTransferObject;
/**
- * DTO object for {@link PersistenceMetrics}.
+ * DTO object for {@link DataStorageMetrics}.
*/
public class VisorPersistenceMetrics extends VisorDataTransferObject {
/** */
@@ -76,7 +76,7 @@ public class VisorPersistenceMetrics extends VisorDataTransferObject {
/**
* @param metrics Persistence metrics.
*/
- public VisorPersistenceMetrics(PersistenceMetrics metrics) {
+ public VisorPersistenceMetrics(DataStorageMetrics metrics) {
walLoggingRate = metrics.getWalLoggingRate();
walWritingRate = metrics.getWalWritingRate();
walArchiveSegments = metrics.getWalArchiveSegments();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistentStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistentStoreConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistentStoreConfiguration.java
index 128f43a..f9d7a64 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistentStoreConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPersistentStoreConfiguration.java
@@ -19,14 +19,14 @@ package org.apache.ignite.internal.visor.node;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.visor.VisorDataTransferObject;
/**
- * DTO object for {@link PersistentStoreConfiguration}.
+ * DTO object for {@link DataStorageConfiguration}.
*/
public class VisorPersistentStoreConfiguration extends VisorDataTransferObject {
/** */
@@ -99,26 +99,26 @@ public class VisorPersistentStoreConfiguration extends VisorDataTransferObject {
/**
* @param cfg Persistent store configuration.
*/
- public VisorPersistentStoreConfiguration(PersistentStoreConfiguration cfg) {
- persistenceStorePath = cfg.getPersistentStorePath();
- checkpointingFreq = cfg.getCheckpointingFrequency();
+ public VisorPersistentStoreConfiguration(DataStorageConfiguration cfg) {
+ persistenceStorePath = cfg.getStoragePath();
+ checkpointingFreq = cfg.getCheckpointFrequency();
lockWaitTime = cfg.getLockWaitTime();
- checkpointingPageBufSize = cfg.getCheckpointingPageBufferSize();
- checkpointingThreads = cfg.getCheckpointingThreads();
+ checkpointingPageBufSize = cfg.getCheckpointPageBufferSize();
+ checkpointingThreads = cfg.getCheckpointThreads();
walHistSize = cfg.getWalHistorySize();
walSegments = cfg.getWalSegments();
walSegmentSize = cfg.getWalSegmentSize();
- walStorePath = cfg.getWalStorePath();
+ walStorePath = cfg.getWalPath();
walArchivePath = cfg.getWalArchivePath();
metricsEnabled = cfg.isMetricsEnabled();
walMode = cfg.getWalMode();
- tlbSize = cfg.getTlbSize();
+ tlbSize = cfg.getWalThreadLocalBufferSize();
walFlushFreq = cfg.getWalFlushFrequency();
walFsyncDelay = cfg.getWalFsyncDelayNanos();
walRecordIterBuffSize = cfg.getWalRecordIteratorBufferSize();
alwaysWriteFullPages = cfg.isAlwaysWriteFullPages();
- subIntervals = cfg.getSubIntervals();
- rateTimeInterval = cfg.getRateTimeInterval();
+ subIntervals = cfg.getMetricsSubIntervalCount();
+ rateTimeInterval = cfg.getMetricsRateTimeInterval();
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/mxbean/DataRegionMetricsMXBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/mxbean/DataRegionMetricsMXBean.java b/modules/core/src/main/java/org/apache/ignite/mxbean/DataRegionMetricsMXBean.java
new file mode 100644
index 0000000..eeed496
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/mxbean/DataRegionMetricsMXBean.java
@@ -0,0 +1,139 @@
+/*
+ * 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.mxbean;
+
+import org.apache.ignite.DataRegionMetrics;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+
+/**
+ * This interface defines a JMX view on {@link DataRegionMetrics}.
+ */
+@MXBeanDescription("MBean that provides access to DataRegionMetrics of a local Apache Ignite node.")
+public interface DataRegionMetricsMXBean extends DataRegionMetrics {
+ /** {@inheritDoc} */
+ @MXBeanDescription("A name of a memory region the metrics are collected for.")
+ @Override public String getName();
+
+ /**
+ * Gets initial memory region size defined by its {@link DataRegionConfiguration}.
+ *
+ * @return Initial size in MB.
+ */
+ @MXBeanDescription("Initial memory region size defined by its data region.")
+ public int getInitialSize();
+
+ /**
+ * Maximum memory region size defined by its {@link DataRegionConfiguration}.
+ *
+ * @return Maximum size in MB.
+ */
+ @MXBeanDescription("Maximum memory region size defined by its data region.")
+ public int getMaxSize();
+
+ /**
+ * A path to the memory-mapped files the memory region defined by {@link DataRegionConfiguration} will be
+ * mapped to.
+ *
+ * @return Path to the memory-mapped files.
+ */
+ @MXBeanDescription("Path to the memory-mapped files.")
+ public String getSwapPath();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Total number of allocated pages.")
+ @Override public long getTotalAllocatedPages();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Allocation rate (pages per second) averaged across rateTimeInternal.")
+ @Override public float getAllocationRate();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Eviction rate (pages per second).")
+ @Override public float getEvictionRate();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Percentage of pages that are fully occupied by large entries that go beyond page size.")
+ @Override public float getLargeEntriesPagesPercentage();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Percentage of space that is still free and can be filled in.")
+ @Override public float getPagesFillFactor();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Number of pages in memory not yet synchronized with persistent storage.")
+ @Override public long getDirtyPages();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Rate at which pages in memory are replaced with pages from persistent storage (pages per second).")
+ @Override public float getPagesReplaceRate();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Number of pages residing in physical RAM.")
+ @Override public long getPhysicalMemoryPages();
+
+ /**
+ * Enables memory metrics collection on an Apache Ignite node.
+ */
+ @MXBeanDescription("Enables memory metrics collection on an Apache Ignite node.")
+ public void enableMetrics();
+
+ /**
+ * Disables memory metrics collection on an Apache Ignite node.
+ */
+ @MXBeanDescription("Disables memory metrics collection on an Apache Ignite node.")
+ public void disableMetrics();
+
+ /**
+ * Sets time interval for {@link #getAllocationRate()} and {@link #getEvictionRate()} monitoring purposes.
+ * <p>
+ * For instance, after setting the interval to 60 seconds, subsequent calls to {@link #getAllocationRate()}
+ * will return average allocation rate (pages per second) for the last minute.
+ *
+ * @param rateTimeInterval Time interval (in milliseconds) used for allocation and eviction rates calculations.
+ */
+ @MXBeanDescription(
+ "Sets time interval for pages allocation and eviction monitoring purposes."
+ )
+ @MXBeanParametersNames(
+ "rateTimeInterval"
+ )
+ @MXBeanParametersDescriptions(
+ "Time interval (in milliseconds) to set."
+ )
+ public void rateTimeInterval(long rateTimeInterval);
+
+ /**
+ * Sets a number of sub-intervals the whole {@link #rateTimeInterval(long)} will be split into to calculate
+ * {@link #getAllocationRate()} and {@link #getEvictionRate()} rates (5 by default).
+ * <p>
+ * Setting it to a bigger value will result in more precise calculation and smaller drops of
+ * {@link #getAllocationRate()} metric when next sub-interval has to be recycled but introduces bigger
+ * calculation overhead.
+ *
+ * @param subInts A number of sub-intervals.
+ */
+ @MXBeanDescription(
+ "Sets a number of sub-intervals to calculate allocation and eviction rates metrics."
+ )
+ @MXBeanParametersNames(
+ "subInts"
+ )
+ @MXBeanParametersDescriptions(
+ "Number of subintervals to set."
+ )
+ public void subIntervals(int subInts);
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/mxbean/DataStorageMetricsMXBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/mxbean/DataStorageMetricsMXBean.java b/modules/core/src/main/java/org/apache/ignite/mxbean/DataStorageMetricsMXBean.java
new file mode 100644
index 0000000..f0fb631
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/mxbean/DataStorageMetricsMXBean.java
@@ -0,0 +1,121 @@
+/*
+ * 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.mxbean;
+
+import org.apache.ignite.DataStorageMetrics;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+
+/**
+ * An MX bean allowing to monitor and tune persistence metrics.
+ */
+public interface DataStorageMetricsMXBean extends DataStorageMetrics {
+ /** {@inheritDoc} */
+ @MXBeanDescription("Average number of WAL records per second written during the last time interval.")
+ @Override float getWalLoggingRate();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Average number of bytes per second written during the last time interval.")
+ @Override float getWalWritingRate();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Current number of WAL segments in the WAL archive.")
+ @Override int getWalArchiveSegments();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Average WAL fsync duration in microseconds over the last time interval.")
+ @Override float getWalFsyncTimeAverage();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Duration of the last checkpoint in milliseconds.")
+ @Override long getLastCheckpointingDuration();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Duration of the checkpoint lock wait in milliseconds.")
+ @Override long getLastCheckpointLockWaitDuration();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Duration of the checkpoint mark in milliseconds.")
+ @Override long getLastCheckpointMarkDuration();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Duration of the checkpoint pages write in milliseconds.")
+ @Override long getLastCheckpointPagesWriteDuration();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Duration of the sync phase of the last checkpoint in milliseconds.")
+ @Override long getLastCheckpointFsyncDuration();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Total number of pages written during the last checkpoint.")
+ @Override long getLastCheckpointTotalPagesNumber();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Total number of data pages written during the last checkpoint.")
+ @Override long getLastCheckpointDataPagesNumber();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Number of pages copied to a temporary checkpoint buffer during the last checkpoint.")
+ @Override long getLastCheckpointCopiedOnWritePagesNumber();
+
+ /**
+ * Enables persistence metrics collection on an Apache Ignite node.
+ */
+ @MXBeanDescription("Enables persistence metrics collection on an Apache Ignite node.")
+ public void enableMetrics();
+
+ /**
+ * Disables persistence metrics collection on an Apache Ignite node.
+ */
+ @MXBeanDescription("Disables persistence metrics collection on an Apache Ignite node.")
+ public void disableMetrics();
+
+ /**
+ * Sets time interval for rate-based metrics. Identical to setting
+ * {@link DataStorageConfiguration#setMetricsRateTimeInterval(long)} configuration property.
+ *
+ * @param rateTimeInterval Time interval (in milliseconds) used for allocation and eviction rates calculations.
+ */
+ @MXBeanDescription(
+ "Sets time interval for pages allocation and eviction monitoring purposes."
+ )
+ @MXBeanParametersNames(
+ "rateTimeInterval"
+ )
+ @MXBeanParametersDescriptions(
+ "Time interval (in milliseconds) to set."
+ )
+ public void rateTimeInterval(long rateTimeInterval);
+
+ /**
+ * Sets a number of sub-intervals the whole {@link #rateTimeInterval(long)} will be split into to calculate
+ * rate-based metrics. Identical to setting {@link DataStorageConfiguration#setMetricsSubIntervalCount(int)} configuration
+ * property.
+ *
+ * @param subInts A number of sub-intervals.
+ */
+ @MXBeanDescription(
+ "Sets a number of sub-intervals to calculate allocation and eviction rates metrics."
+ )
+ @MXBeanParametersNames(
+ "subInts"
+ )
+ @MXBeanParametersDescriptions(
+ "Number of subintervals to set."
+ )
+ public void subIntervals(int subInts);
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/mxbean/MemoryMetricsMXBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/mxbean/MemoryMetricsMXBean.java b/modules/core/src/main/java/org/apache/ignite/mxbean/MemoryMetricsMXBean.java
index 4d6c96a..e547536 100644
--- a/modules/core/src/main/java/org/apache/ignite/mxbean/MemoryMetricsMXBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/mxbean/MemoryMetricsMXBean.java
@@ -21,8 +21,10 @@ import org.apache.ignite.configuration.MemoryPolicyConfiguration;
/**
* This interface defines a JMX view on {@link MemoryMetrics}.
+ * @deprecated Part of old API. Metrics are accessible through {@link DataRegionMetricsMXBean}.
*/
@MXBeanDescription("MBean that provides access to MemoryMetrics of a local Apache Ignite node.")
+@Deprecated
public interface MemoryMetricsMXBean extends MemoryMetrics {
/** {@inheritDoc} */
@MXBeanDescription("A name of a memory region the metrics are collected for.")
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/mxbean/PersistenceMetricsMXBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/mxbean/PersistenceMetricsMXBean.java b/modules/core/src/main/java/org/apache/ignite/mxbean/PersistenceMetricsMXBean.java
index 40c2235..0c16640 100644
--- a/modules/core/src/main/java/org/apache/ignite/mxbean/PersistenceMetricsMXBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/mxbean/PersistenceMetricsMXBean.java
@@ -22,7 +22,9 @@ import org.apache.ignite.configuration.PersistentStoreConfiguration;
/**
* An MX bean allowing to monitor and tune persistence metrics.
+ * @deprecated Part of old API. Metrics are accessible through {@link DataStorageMetricsMXBean}.
*/
+@Deprecated
public interface PersistenceMetricsMXBean extends PersistenceMetrics {
/** {@inheritDoc} */
@MXBeanDescription("Average number of WAL records per second written during the last time interval.")
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index 2f795df..f3fc074 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -137,10 +137,10 @@ org.apache.ignite.configuration.CollectionConfiguration
org.apache.ignite.configuration.DataPageEvictionMode
org.apache.ignite.configuration.DeploymentMode
org.apache.ignite.configuration.IgniteReflectionFactory
-org.apache.ignite.configuration.MemoryConfiguration
-org.apache.ignite.configuration.MemoryPolicyConfiguration
+org.apache.ignite.configuration.DataStorageConfiguration
+org.apache.ignite.configuration.DataRegionConfiguration
org.apache.ignite.configuration.NearCacheConfiguration
-org.apache.ignite.configuration.PersistentStoreConfiguration
+org.apache.ignite.configuration.DataStorageConfiguration
org.apache.ignite.configuration.TopologyValidator
org.apache.ignite.configuration.TransactionConfiguration
org.apache.ignite.configuration.WALMode
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/config/examples.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/examples.properties b/modules/core/src/test/config/examples.properties
index ea0d8ed..2144533 100644
--- a/modules/core/src/test/config/examples.properties
+++ b/modules/core/src/test/config/examples.properties
@@ -22,4 +22,4 @@ ScalarCacheExample=examples/config/example-ignite.xml
ScalarCacheQueryExample=examples/config/example-ignite.xml
ScalarCountGraphTrianglesExample=examples/config/example-ignite.xml
ScalarPopularNumbersRealTimeExample=examples/config/example-ignite.xml
-MemoryPolicyExample=examples/config/example-memory-policies.xml
\ No newline at end of file
+DataRegionExample=examples/config/example-data-regions.xml
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/cache/LargeEntryUpdateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/LargeEntryUpdateTest.java b/modules/core/src/test/java/org/apache/ignite/cache/LargeEntryUpdateTest.java
index be92761..008da71 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/LargeEntryUpdateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/LargeEntryUpdateTest.java
@@ -25,8 +25,8 @@ import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteException;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteRunnable;
import org.apache.ignite.resources.IgniteInstanceResource;
@@ -71,11 +71,11 @@ public class LargeEntryUpdateTest extends GridCommonAbstractTest {
cfg.setPublicThreadPoolSize(THREAD_COUNT);
- MemoryConfiguration mem = new MemoryConfiguration();
+ DataStorageConfiguration mem = new DataStorageConfiguration();
mem.setPageSize(PAGE_SIZE);
- cfg.setMemoryConfiguration(mem);
+ cfg.setDataStorageConfiguration(mem);
CacheConfiguration[] ccfgs = new CacheConfiguration[CACHE_COUNT];
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/ClusterNodeMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/ClusterNodeMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/ClusterNodeMetricsSelfTest.java
index f842440..1352c37 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/ClusterNodeMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/ClusterNodeMetricsSelfTest.java
@@ -29,7 +29,7 @@ import org.apache.ignite.cluster.ClusterMetrics;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.Event;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryMetricsImpl;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl;
import org.apache.ignite.internal.processors.task.GridInternal;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.lang.IgnitePredicate;
@@ -111,7 +111,7 @@ public class ClusterNodeMetricsSelfTest extends GridCommonAbstractTest {
final IgniteCache cache = ignite.getOrCreateCache(CACHE_NAME);
- MemoryMetricsImpl memMetrics = getDefaultMemoryPolicyMetrics(ignite);
+ DataRegionMetricsImpl memMetrics = getDefaultMemoryPolicyMetrics(ignite);
memMetrics.enableMetrics();
@@ -128,8 +128,8 @@ public class ClusterNodeMetricsSelfTest extends GridCommonAbstractTest {
/**
* @param ignite Ignite instance.
*/
- private MemoryMetricsImpl getDefaultMemoryPolicyMetrics(IgniteEx ignite) throws IgniteCheckedException {
- return ignite.context().cache().context().database().memoryPolicy(null).memoryMetrics();
+ private DataRegionMetricsImpl getDefaultMemoryPolicyMetrics(IgniteEx ignite) throws IgniteCheckedException {
+ return ignite.context().cache().context().database().dataRegion(null).memoryMetrics();
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/IgniteSlowClientDetectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteSlowClientDetectionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteSlowClientDetectionSelfTest.java
index 3d6f116..9a923f3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteSlowClientDetectionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteSlowClientDetectionSelfTest.java
@@ -25,7 +25,7 @@ import org.apache.ignite.IgniteState;
import org.apache.ignite.Ignition;
import org.apache.ignite.cache.query.ContinuousQuery;
import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.Event;
@@ -81,10 +81,10 @@ public class IgniteSlowClientDetectionSelfTest extends GridCommonAbstractTest {
cfg.setCommunicationSpi(commSpi);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration dbCfg = new DataStorageConfiguration();
dbCfg.setPageSize(16 * 1024);
- cfg.setMemoryConfiguration(dbCfg);
+ cfg.setDataStorageConfiguration(dbCfg);
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/pagemem/impl/PageMemoryNoLoadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/pagemem/impl/PageMemoryNoLoadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/pagemem/impl/PageMemoryNoLoadSelfTest.java
index 5bef372..3b9e393 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/pagemem/impl/PageMemoryNoLoadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/pagemem/impl/PageMemoryNoLoadSelfTest.java
@@ -23,7 +23,7 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.mem.DirectMemoryProvider;
import org.apache.ignite.internal.mem.IgniteOutOfMemoryException;
import org.apache.ignite.internal.mem.file.MappedFileMemoryProvider;
@@ -32,7 +32,7 @@ import org.apache.ignite.internal.pagemem.PageIdAllocator;
import org.apache.ignite.internal.pagemem.PageIdUtils;
import org.apache.ignite.internal.pagemem.PageMemory;
import org.apache.ignite.internal.pagemem.PageUtils;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryMetricsImpl;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -309,7 +309,7 @@ public class PageMemoryNoLoadSelfTest extends GridCommonAbstractTest {
protected PageMemory memory() throws Exception {
File memDir = U.resolveWorkDirectory(U.defaultWorkDirectory(), "pagemem", false);
- MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration()
+ DataRegionConfiguration plcCfg = new DataRegionConfiguration()
.setMaxSize(MAX_MEMORY_SIZE).setInitialSize(MAX_MEMORY_SIZE);
DirectMemoryProvider provider = new MappedFileMemoryProvider(log(), memDir);
@@ -320,7 +320,7 @@ public class PageMemoryNoLoadSelfTest extends GridCommonAbstractTest {
null,
PAGE_SIZE,
plcCfg,
- new MemoryMetricsImpl(plcCfg),
+ new DataRegionMetricsImpl(plcCfg),
true);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java
index 3a418f0..8703791 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java
@@ -31,8 +31,8 @@ import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.store.CacheStore;
import org.apache.ignite.cache.store.CacheStoreAdapter;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.lang.IgniteBiInClosure;
@@ -75,7 +75,7 @@ public class CacheClientStoreSelfTest extends GridCommonAbstractTest {
cfg.setClientMode(client);
if (client)
- cfg.setMemoryConfiguration(new MemoryConfiguration());
+ cfg.setDataStorageConfiguration(new DataStorageConfiguration());
CacheConfiguration cc = new CacheConfiguration(DEFAULT_CACHE_NAME);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConfigurationLeakTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConfigurationLeakTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConfigurationLeakTest.java
index bf94d16..6b03867 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConfigurationLeakTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConfigurationLeakTest.java
@@ -21,9 +21,9 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -43,17 +43,16 @@ public class CacheConfigurationLeakTest extends GridCommonAbstractTest {
@Override protected IgniteConfiguration getConfiguration() throws Exception {
IgniteConfiguration cfg = super.getConfiguration();
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration();
- MemoryPolicyConfiguration plc = new MemoryPolicyConfiguration();
+ DataRegionConfiguration plc = new DataRegionConfiguration();
plc.setName("dfltPlc");
- plc.setMaxSize(MemoryConfiguration.DFLT_MEMORY_POLICY_MAX_SIZE * 10);
+ plc.setMaxSize(DataStorageConfiguration.DFLT_DATA_REGION_MAX_SIZE * 10);
- memCfg.setDefaultMemoryPolicyName("dfltPlc");
- memCfg.setMemoryPolicies(plc);
+ memCfg.setDefaultDataRegionConfiguration(plc);
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDataRegionConfigurationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDataRegionConfigurationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDataRegionConfigurationTest.java
new file mode 100644
index 0000000..775aaa8
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDataRegionConfigurationTest.java
@@ -0,0 +1,172 @@
+/*
+ * 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.internal.processors.cache;
+
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.mem.IgniteOutOfMemoryException;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ *
+ */
+public class CacheDataRegionConfigurationTest extends GridCommonAbstractTest {
+ /** */
+ private volatile CacheConfiguration ccfg;
+
+ /** */
+ private volatile DataStorageConfiguration memCfg;
+
+ /** */
+ private static final long DFLT_MEM_PLC_SIZE = 10 * 1024 * 1024;
+
+ /** */
+ private static final long BIG_MEM_PLC_SIZE = 1024 * 1024 * 1024;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ if (memCfg != null)
+ cfg.setDataStorageConfiguration(memCfg);
+
+ if (ccfg != null)
+ cfg.setCacheConfiguration(ccfg);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+ }
+
+ /**
+ * Verifies that proper exception is thrown when DataRegion is misconfigured for cache.
+ */
+ public void testMissingDataRegion() throws Exception {
+ ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
+
+ ccfg.setDataRegionName("nonExistingMemPlc");
+
+ try {
+ startGrid(0);
+ }
+ catch (IgniteCheckedException e) {
+ String msg = e.getMessage();
+
+ assertTrue("Not expected exception was thrown: " + e, msg.contains("Requested DataRegion is not configured"));
+
+ return;
+ }
+
+ fail("Expected exception was not thrown: missing DataRegion");
+ }
+
+ /**
+ * Verifies that {@link IgniteOutOfMemoryException} is thrown when cache is configured with too small DataRegion.
+ */
+ public void testTooSmallDataRegion() throws Exception {
+ memCfg = new DataStorageConfiguration();
+
+ DataRegionConfiguration dfltPlcCfg = new DataRegionConfiguration();
+ dfltPlcCfg.setName("dfltPlc");
+ dfltPlcCfg.setInitialSize(10 * 1024 * 1024);
+ dfltPlcCfg.setMaxSize(10 * 1024 * 1024);
+
+ DataRegionConfiguration bigPlcCfg = new DataRegionConfiguration();
+ bigPlcCfg.setName("bigPlc");
+ bigPlcCfg.setMaxSize(1024 * 1024 * 1024);
+
+ memCfg.setDataRegionConfigurations(bigPlcCfg);
+ memCfg.setDefaultDataRegionConfiguration(dfltPlcCfg);
+
+ ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
+
+ IgniteEx ignite0 = startGrid(0);
+
+ IgniteCache<Object, Object> cache = ignite0.cache(DEFAULT_CACHE_NAME);
+
+ boolean oomeThrown = false;
+
+ try {
+ for (int i = 0; i < 500_000; i++)
+ cache.put(i, "abc");
+ }
+ catch (Exception e) {
+ Throwable cause = e;
+
+ do {
+ if (cause instanceof IgniteOutOfMemoryException) {
+ oomeThrown = true;
+ break;
+ }
+
+ if (cause == null)
+ break;
+
+ if (cause.getSuppressed() == null || cause.getSuppressed().length == 0)
+ cause = cause.getCause();
+ else
+ cause = cause.getSuppressed()[0];
+ }
+ while (true);
+ }
+
+ if (!oomeThrown)
+ fail("OutOfMemoryException hasn't been thrown");
+ }
+
+ /**
+ * Verifies that with enough memory allocated adding values to cache doesn't cause any exceptions.
+ */
+ public void testProperlySizedMemoryPolicy() throws Exception {
+ memCfg = new DataStorageConfiguration();
+
+ DataRegionConfiguration dfltPlcCfg = new DataRegionConfiguration();
+ dfltPlcCfg.setName("dfltPlc");
+ dfltPlcCfg.setInitialSize(DFLT_MEM_PLC_SIZE);
+ dfltPlcCfg.setMaxSize(DFLT_MEM_PLC_SIZE);
+
+ DataRegionConfiguration bigPlcCfg = new DataRegionConfiguration();
+ bigPlcCfg.setName("bigPlc");
+ bigPlcCfg.setMaxSize(BIG_MEM_PLC_SIZE);
+
+ memCfg.setDataRegionConfigurations(bigPlcCfg);
+ memCfg.setDefaultDataRegionConfiguration(dfltPlcCfg);
+
+ ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
+ ccfg.setDataRegionName("bigPlc");
+
+ IgniteEx ignite0 = startGrid(0);
+
+ IgniteCache<Object, Object> cache = ignite0.cache(DEFAULT_CACHE_NAME);
+
+ try {
+ for (int i = 0; i < 500_000; i++)
+ cache.put(i, "abc");
+ }
+ catch (Exception e) {
+ fail("With properly sized DataRegion no exceptions are expected to be thrown.");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMemoryPolicyConfigurationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMemoryPolicyConfigurationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMemoryPolicyConfigurationTest.java
deleted file mode 100644
index 0fb9c08..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMemoryPolicyConfigurationTest.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * 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.internal.processors.cache;
-
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.mem.IgniteOutOfMemoryException;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-/**
- *
- */
-public class CacheMemoryPolicyConfigurationTest extends GridCommonAbstractTest {
- /** */
- private volatile CacheConfiguration ccfg;
-
- /** */
- private volatile MemoryConfiguration memCfg;
-
- /** */
- private static final long DFLT_MEM_PLC_SIZE = 10 * 1024 * 1024;
-
- /** */
- private static final long BIG_MEM_PLC_SIZE = 1024 * 1024 * 1024;
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- if (memCfg != null)
- cfg.setMemoryConfiguration(memCfg);
-
- if (ccfg != null)
- cfg.setCacheConfiguration(ccfg);
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- stopAllGrids();
- }
-
- /**
- * Verifies that proper exception is thrown when MemoryPolicy is misconfigured for cache.
- */
- public void testMissingMemoryPolicy() throws Exception {
- ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
-
- ccfg.setMemoryPolicyName("nonExistingMemPlc");
-
- try {
- startGrid(0);
- }
- catch (IgniteCheckedException e) {
- String msg = e.getMessage();
-
- assertTrue("Not expected exception was thrown: " + e, msg.contains("Requested MemoryPolicy is not configured"));
-
- return;
- }
-
- fail("Expected exception was not thrown: missing MemoryPolicy");
- }
-
- /**
- * Verifies that {@link IgniteOutOfMemoryException} is thrown when cache is configured with too small MemoryPolicy.
- */
- public void testTooSmallMemoryPolicy() throws Exception {
- memCfg = new MemoryConfiguration();
-
- MemoryPolicyConfiguration dfltPlcCfg = new MemoryPolicyConfiguration();
- dfltPlcCfg.setName("dfltPlc");
- dfltPlcCfg.setInitialSize(10 * 1024 * 1024);
- dfltPlcCfg.setMaxSize(10 * 1024 * 1024);
-
- MemoryPolicyConfiguration bigPlcCfg = new MemoryPolicyConfiguration();
- bigPlcCfg.setName("bigPlc");
- bigPlcCfg.setMaxSize(1024 * 1024 * 1024);
-
- memCfg.setMemoryPolicies(dfltPlcCfg, bigPlcCfg);
- memCfg.setDefaultMemoryPolicyName("dfltPlc");
-
- ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
-
- IgniteEx ignite0 = startGrid(0);
-
- IgniteCache<Object, Object> cache = ignite0.cache(DEFAULT_CACHE_NAME);
-
- boolean oomeThrown = false;
-
- try {
- for (int i = 0; i < 500_000; i++)
- cache.put(i, "abc");
- }
- catch (Exception e) {
- Throwable cause = e;
-
- do {
- if (cause instanceof IgniteOutOfMemoryException) {
- oomeThrown = true;
- break;
- }
-
- if (cause == null)
- break;
-
- if (cause.getSuppressed() == null || cause.getSuppressed().length == 0)
- cause = cause.getCause();
- else
- cause = cause.getSuppressed()[0];
- }
- while (true);
- }
-
- if (!oomeThrown)
- fail("OutOfMemoryException hasn't been thrown");
- }
-
- /**
- * Verifies that with enough memory allocated adding values to cache doesn't cause any exceptions.
- */
- public void testProperlySizedMemoryPolicy() throws Exception {
- memCfg = new MemoryConfiguration();
-
- MemoryPolicyConfiguration dfltPlcCfg = new MemoryPolicyConfiguration();
- dfltPlcCfg.setName("dfltPlc");
- dfltPlcCfg.setInitialSize(DFLT_MEM_PLC_SIZE);
- dfltPlcCfg.setMaxSize(DFLT_MEM_PLC_SIZE);
-
- MemoryPolicyConfiguration bigPlcCfg = new MemoryPolicyConfiguration();
- bigPlcCfg.setName("bigPlc");
- bigPlcCfg.setMaxSize(BIG_MEM_PLC_SIZE);
-
- memCfg.setMemoryPolicies(dfltPlcCfg, bigPlcCfg);
- memCfg.setDefaultMemoryPolicyName("dfltPlc");
-
- ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
- ccfg.setMemoryPolicyName("bigPlc");
-
- IgniteEx ignite0 = startGrid(0);
-
- IgniteCache<Object, Object> cache = ignite0.cache(DEFAULT_CACHE_NAME);
-
- try {
- for (int i = 0; i < 500_000; i++)
- cache.put(i, "abc");
- }
- catch (Exception e) {
- fail("With properly sized MemoryPolicy no exceptions are expected to be thrown.");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java
index c53bc4b..5eb8292 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java
@@ -27,8 +27,8 @@ import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteException;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.managers.communication.GridIoMessage;
@@ -72,7 +72,7 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest {
private static String CACHE_NAME_LOC = "cache_local";
/** Memory configuration to be used on client nodes with local caches. */
- private static MemoryConfiguration memCfg;
+ private static DataStorageConfiguration memCfg;
/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
@@ -97,7 +97,7 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest {
if (getTestIgniteInstanceName(2).equals(igniteInstanceName)) {
iCfg.setClientMode(true);
- iCfg.setMemoryConfiguration(memCfg);
+ iCfg.setDataStorageConfiguration(memCfg);
}
((TcpDiscoverySpi)iCfg.getDiscoverySpi()).setIpFinder(ipFinder);
@@ -670,7 +670,7 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testLocalClose() throws Exception {
- memCfg = new MemoryConfiguration();
+ memCfg = new DataStorageConfiguration();
startGridsMultiThreaded(gridCount());
@@ -721,7 +721,7 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testLocalCloseWithTry() throws Exception {
- memCfg = new MemoryConfiguration();
+ memCfg = new DataStorageConfiguration();
startGridsMultiThreaded(gridCount());
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridDataStorageConfigurationConsistencySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridDataStorageConfigurationConsistencySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridDataStorageConfigurationConsistencySelfTest.java
new file mode 100644
index 0000000..3c728f7
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridDataStorageConfigurationConsistencySelfTest.java
@@ -0,0 +1,79 @@
+/*
+* 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.internal.processors.cache;
+
+import java.util.concurrent.Callable;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ * Tests a check of memory configuration consistency.
+ */
+public class GridDataStorageConfigurationConsistencySelfTest extends GridCommonAbstractTest {
+ /** IP finder. */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+ discoSpi.setIpFinder(IP_FINDER);
+
+ cfg.setDiscoverySpi(discoSpi);
+
+ DataStorageConfiguration memCfg = new DataStorageConfiguration();
+
+ // Nodes will have different page size.
+ memCfg.setPageSize(DataStorageConfiguration.DFLT_PAGE_SIZE * (1 + getTestIgniteInstanceIndex(gridName)));
+
+ cfg.setDataStorageConfiguration(memCfg);
+
+ return cfg;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testMemoryConfigurationConsistency() throws Exception {
+ GridTestUtils.assertThrows(log, new Callable<Void>() {
+ /** {@inheritDoc} */
+ @Override public Void call() throws Exception {
+ startGrids(2);
+
+ return null;
+ }
+ }, IgniteCheckedException.class, null);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ stopAllGrids();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+ }
+}
[18/50] [abbrv] ignite git commit: IGNITE-6030 Allow enabling
persistence per data region
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridMemoryConfigurationConsistencySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridMemoryConfigurationConsistencySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridMemoryConfigurationConsistencySelfTest.java
deleted file mode 100644
index bc71e33..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridMemoryConfigurationConsistencySelfTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
-* 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.internal.processors.cache;
-
-import java.util.concurrent.Callable;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-/**
- * Tests a check of memory configuration consistency.
- */
-public class GridMemoryConfigurationConsistencySelfTest extends GridCommonAbstractTest {
- /** IP finder. */
- private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
- discoSpi.setIpFinder(IP_FINDER);
-
- cfg.setDiscoverySpi(discoSpi);
-
- MemoryConfiguration memCfg = new MemoryConfiguration();
-
- // Nodes will have different page size.
- memCfg.setPageSize(MemoryConfiguration.DFLT_PAGE_SIZE * (1 + getTestIgniteInstanceIndex(gridName)));
-
- cfg.setMemoryConfiguration(memCfg);
-
- return cfg;
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testMemoryConfigurationConsistency() throws Exception {
- GridTestUtils.assertThrows(log, new Callable<Void>() {
- /** {@inheritDoc} */
- @Override public Void call() throws Exception {
- startGrids(2);
-
- return null;
- }
- }, IgniteCheckedException.class, null);
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- stopAllGrids();
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- stopAllGrids();
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
index 4c9ad27..1827c65 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
@@ -29,9 +29,9 @@ import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteClientReconnectAbstractTest;
import org.apache.ignite.internal.IgniteInternalFuture;
@@ -67,6 +67,9 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest
/** */
static final String CACHE_NAME_PREFIX = "cache-";
+ /** Non-persistent data region name. */
+ private static final String NO_PERSISTENCE_REGION = "no-persistence-region";
+
/** */
boolean client;
@@ -116,19 +119,21 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest
ccfgs = null;
}
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration();
memCfg.setPageSize(1024);
- memCfg.setDefaultMemoryPolicySize(10 * 1024 * 1024);
+ memCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setMaxSize(10 * 1024 * 1024)
+ .setPersistenceEnabled(persistenceEnabled()));
- cfg.setMemoryConfiguration(memCfg);
+ memCfg.setDataRegionConfigurations(new DataRegionConfiguration()
+ .setMaxSize(10 * 1024 * 1024)
+ .setName(NO_PERSISTENCE_REGION)
+ .setPersistenceEnabled(false));
- if (persistenceEnabled()) {
- PersistentStoreConfiguration pCfg = new PersistentStoreConfiguration();
+ if (persistenceEnabled())
+ memCfg.setWalMode(WALMode.LOG_ONLY);
- pCfg.setWalMode(WALMode.LOG_ONLY);
-
- cfg.setPersistentStoreConfiguration(pCfg);
- }
+ cfg.setDataStorageConfiguration(memCfg);
if (testSpi) {
TestRecordingCommunicationSpi spi = new TestRecordingCommunicationSpi();
@@ -1236,12 +1241,15 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest
* @return Cache configurations.
*/
final CacheConfiguration[] cacheConfigurations2() {
- CacheConfiguration[] ccfgs = new CacheConfiguration[4];
+ CacheConfiguration[] ccfgs = new CacheConfiguration[5];
ccfgs[0] = cacheConfiguration(CACHE_NAME_PREFIX + 0, ATOMIC);
ccfgs[1] = cacheConfiguration(CACHE_NAME_PREFIX + 1, TRANSACTIONAL);
ccfgs[2] = cacheConfiguration(CACHE_NAME_PREFIX + 2, ATOMIC);
ccfgs[3] = cacheConfiguration(CACHE_NAME_PREFIX + 3, TRANSACTIONAL);
+ ccfgs[4] = cacheConfiguration(CACHE_NAME_PREFIX + 4, TRANSACTIONAL);
+
+ ccfgs[4].setDataRegionName(NO_PERSISTENCE_REGION);
return ccfgs;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java
index 4a19aa8..6245952 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java
@@ -23,6 +23,9 @@ import java.util.Map;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteException;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.testframework.GridTestUtils;
/**
@@ -73,7 +76,7 @@ public class IgniteClusterActivateDeactivateTestWithPersistence extends IgniteCl
* @throws Exception If failed.
*/
public void testActivateCachesRestore_5_Servers_WithNewCaches() throws Exception {
- activateCachesRestore(5, false);
+ activateCachesRestore(5, true);
}
/**
@@ -120,8 +123,9 @@ public class IgniteClusterActivateDeactivateTestWithPersistence extends IgniteCl
checkCache(ignite(i), CACHE_NAME_PREFIX + c, true);
}
- for (CacheConfiguration ccfg : cacheConfigurations1())
- checkCacheData(cacheData, ccfg.getName());
+ DataStorageConfiguration dsCfg = srv.configuration().getDataStorageConfiguration();
+
+ checkCachesData(cacheData, dsCfg);
checkCaches(srvs, CACHES);
@@ -152,8 +156,24 @@ public class IgniteClusterActivateDeactivateTestWithPersistence extends IgniteCl
checkCache(ignite(i), CACHE_NAME_PREFIX + c, true);
}
- for (CacheConfiguration ccfg : cacheConfigurations1())
- checkCacheData(cacheData, ccfg.getName());
+ checkCachesData(cacheData, dsCfg);
+ }
+
+ /**
+ * Checks that persistent caches are present with actual data and volatile caches are missing.
+ *
+ * @param cacheData Cache data.
+ * @param dsCfg DataStorageConfiguration.
+ */
+ private void checkCachesData(Map<Integer, Integer> cacheData, DataStorageConfiguration dsCfg) {
+ for (CacheConfiguration ccfg : cacheConfigurations1()) {
+ if (CU.isPersistentCache(ccfg, dsCfg))
+ checkCacheData(cacheData, ccfg.getName());
+ else {
+ for (Ignite node : G.allGrids())
+ assertTrue(node.cache(ccfg.getName()) == null || node.cache(ccfg.getName()).size() == 0);
+ }
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/MemoryPolicyConfigValidationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/MemoryPolicyConfigValidationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/MemoryPolicyConfigValidationTest.java
index 1d8174b..d0130cf 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/MemoryPolicyConfigValidationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/MemoryPolicyConfigValidationTest.java
@@ -187,7 +187,7 @@ public class MemoryPolicyConfigValidationTest extends GridCommonAbstractTest {
private MemoryPolicyConfiguration[] createPlcWithReservedNameMisuseCfg() {
MemoryPolicyConfiguration[] res = new MemoryPolicyConfiguration[1];
- res[0] = createMemoryPolicy("sysMemPlc", 1024 * 1024, 1024 * 1024);
+ res[0] = createMemoryPolicy("sysMemPlc", 10 * 1024 * 1024, 10 * 1024 * 1024);
return res;
}
@@ -354,36 +354,34 @@ public class MemoryPolicyConfigValidationTest extends GridCommonAbstractTest {
*/
private enum ValidationViolationType {
/** */
- NAMES_CONFLICT("Two MemoryPolicies have the same name: "),
+ NAMES_CONFLICT("have the same name"),
/** */
- SYSTEM_MEMORY_POLICY_NAME_MISUSE("'sysMemPlc' policy name is reserved for internal use."),
+ SYSTEM_MEMORY_POLICY_NAME_MISUSE("name is reserved for internal use"),
/** */
- TOO_SMALL_MEMORY_SIZE("MemoryPolicy must have size more than 10MB "),
+ TOO_SMALL_MEMORY_SIZE("must have size more than 10MB"),
/** */
- NULL_NAME_ON_USER_DEFINED_POLICY("User-defined MemoryPolicyConfiguration must have non-null and non-empty name."),
+ NULL_NAME_ON_USER_DEFINED_POLICY("must have non-null and non-empty name"),
/** */
- MISSING_USER_DEFINED_DEFAULT("User-defined default MemoryPolicy name must be presented among configured MemoryPolices: "),
+ MISSING_USER_DEFINED_DEFAULT("name must be presented among configured"),
/** */
- DEFAULT_SIZE_IS_DEFINED_TWICE("User-defined MemoryPolicy configuration and defaultMemoryPolicySize properties are set at the same time."),
+ DEFAULT_SIZE_IS_DEFINED_TWICE("properties are set at the same time."),
/** */
- TOO_SMALL_USER_DEFINED_DFLT_MEM_PLC_SIZE("User-defined default MemoryPolicy size is less than 1MB."),
+ TOO_SMALL_USER_DEFINED_DFLT_MEM_PLC_SIZE("must have size more than 10MB"),
/** */
- MAX_SIZE_IS_SMALLER_THAN_INITIAL_SIZE("MemoryPolicy maxSize must not be smaller than initialSize"),
+ MAX_SIZE_IS_SMALLER_THAN_INITIAL_SIZE("must not be smaller than initialSize"),
/** Case when rateTimeInterval property of MemoryPolicyConfiguration is less than or equals zero. */
- LTE_ZERO_RATE_TIME_INTERVAL("Rate time interval must be greater than zero " +
- "(use MemoryPolicyConfiguration.rateTimeInterval property to adjust the interval)"),
+ LTE_ZERO_RATE_TIME_INTERVAL("Rate time interval must be greater than zero"),
/** Case when subIntervals property of MemoryPolicyConfiguration is less than or equals zero. */
- LTE_ZERO_SUB_INTERVALS("Sub intervals must be greater than zero " +
- "(use MemoryPolicyConfiguration.subIntervals property to adjust the sub intervals)");
+ LTE_ZERO_SUB_INTERVALS("Sub intervals must be greater than zero");
/**
* @param violationMsg Violation message.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/NonAffinityCoordinatorDynamicStartStopTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/NonAffinityCoordinatorDynamicStartStopTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/NonAffinityCoordinatorDynamicStartStopTest.java
index d065941..0f50efc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/NonAffinityCoordinatorDynamicStartStopTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/NonAffinityCoordinatorDynamicStartStopTest.java
@@ -23,8 +23,8 @@ import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -59,15 +59,10 @@ public class NonAffinityCoordinatorDynamicStartStopTest extends GridCommonAbstra
TcpDiscoverySpi discoverySpi = (TcpDiscoverySpi)cfg.getDiscoverySpi();
discoverySpi.setIpFinder(ipFinder);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(200 * 1024 * 1024));
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
- memPlcCfg.setMaxSize(200 * 1000 * 1000);
-
- memPlcCfg.setName("dfltMemPlc");
-
- dbCfg.setMemoryPolicies(memPlcCfg);
- dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
+ cfg.setDataStorageConfiguration(memCfg);
if (gridName.contains(DUMMY_GRID_NAME))
cfg.setUserAttributes(F.asMap(TEST_ATTRIBUTE, false));
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/Cache64kPartitionsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/Cache64kPartitionsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/Cache64kPartitionsTest.java
index fe139ba..7d9df26 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/Cache64kPartitionsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/Cache64kPartitionsTest.java
@@ -19,8 +19,10 @@ package org.apache.ignite.internal.processors.cache.distributed;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -43,8 +45,14 @@ public class Cache64kPartitionsTest extends GridCommonAbstractTest {
cfg.setActiveOnStart(false);
- if (persistenceEnabled)
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
+ if (persistenceEnabled) {
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY);
+
+ cfg.setDataStorageConfiguration(memCfg);
+ }
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
index 7f2a5d0..ab07611 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
@@ -48,8 +48,9 @@ import org.apache.ignite.cache.affinity.AffinityFunctionContext;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.GridNodeOrderComparator;
@@ -182,11 +183,11 @@ public class CacheLateAffinityAssignmentTest extends GridCommonAbstractTest {
discoSpi.setJoinTimeout(30_000);
}
- MemoryConfiguration cfg1 = new MemoryConfiguration();
+ DataStorageConfiguration cfg1 = new DataStorageConfiguration();
- cfg1.setDefaultMemoryPolicySize(150 * 1024 * 1024L);
+ cfg1.setDefaultDataRegionConfiguration(new DataRegionConfiguration().setMaxSize(150 * 1024 * 1024L));
- cfg.setMemoryConfiguration(cfg1);
+ cfg.setDataStorageConfiguration(cfg1);
cfg.setClientMode(client);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheStartOnJoinTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheStartOnJoinTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheStartOnJoinTest.java
index 88df607..44d8b44 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheStartOnJoinTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheStartOnJoinTest.java
@@ -32,8 +32,9 @@ import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -96,11 +97,11 @@ public class CacheStartOnJoinTest extends GridCommonAbstractTest {
cfg.setDiscoverySpi(testSpi);
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration();
memCfg.setPageSize(1024);
- memCfg.setDefaultMemoryPolicySize(50 * 1024 * 1024);
+ memCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration().setMaxSize(50 * 1024 * 1024));
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
cfg.setClientMode(client);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionAbstractTest.java
index bda7940..072ca7f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionAbstractTest.java
@@ -22,9 +22,9 @@ import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.DataPageEvictionMode;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
@@ -63,10 +63,14 @@ public class PageEvictionAbstractTest extends GridCommonAbstractTest {
* @return Configuration with given eviction mode set.
*/
static IgniteConfiguration setEvictionMode(DataPageEvictionMode mode, IgniteConfiguration configuration) {
- MemoryPolicyConfiguration[] policies = configuration.getMemoryConfiguration().getMemoryPolicies();
+ DataRegionConfiguration[] policies = configuration.getDataStorageConfiguration().getDataRegionConfigurations();
- for (MemoryPolicyConfiguration plcCfg : policies)
- plcCfg.setPageEvictionMode(mode);
+ if (policies != null) {
+ for (DataRegionConfiguration plcCfg : policies)
+ plcCfg.setPageEvictionMode(mode);
+ }
+
+ configuration.getDataStorageConfiguration().getDefaultDataRegionConfiguration().setPageEvictionMode(mode);
return configuration;
}
@@ -84,9 +88,9 @@ public class PageEvictionAbstractTest extends GridCommonAbstractTest {
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration dbCfg = new DataStorageConfiguration();
- MemoryPolicyConfiguration plc = new MemoryPolicyConfiguration();
+ DataRegionConfiguration plc = new DataRegionConfiguration();
// This will test additional segment allocation.
plc.setInitialSize(SIZE / 2);
@@ -95,11 +99,10 @@ public class PageEvictionAbstractTest extends GridCommonAbstractTest {
plc.setEvictionThreshold(EVICTION_THRESHOLD);
plc.setName(DEFAULT_POLICY_NAME);
- dbCfg.setMemoryPolicies(plc);
+ dbCfg.setDefaultDataRegionConfiguration(plc);
dbCfg.setPageSize(PAGE_SIZE);
- dbCfg.setDefaultMemoryPolicyName(DEFAULT_POLICY_NAME);
- cfg.setMemoryConfiguration(dbCfg);
+ cfg.setDataStorageConfiguration(dbCfg);
return cfg;
}
@@ -124,7 +127,7 @@ public class PageEvictionAbstractTest extends GridCommonAbstractTest {
.setAffinity(new RendezvousAffinityFunction(false, 32))
.setCacheMode(cacheMode)
.setAtomicityMode(atomicityMode)
- .setMemoryPolicyName(memoryPlcName)
+ .setDataRegionName(memoryPlcName)
.setWriteSynchronizationMode(writeSynchronizationMode);
if (cacheMode == CacheMode.PARTITIONED)
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheLargeValueExpireTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheLargeValueExpireTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheLargeValueExpireTest.java
index 71d809a..7e0b1d7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheLargeValueExpireTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheLargeValueExpireTest.java
@@ -27,7 +27,7 @@ import javax.cache.expiry.TouchedExpiryPolicy;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -51,10 +51,10 @@ public class IgniteCacheLargeValueExpireTest extends GridCommonAbstractTest {
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration dbCfg = new DataStorageConfiguration();
dbCfg.setPageSize(1024);
- cfg.setMemoryConfiguration(dbCfg);
+ cfg.setDataStorageConfiguration(dbCfg);
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgniteDataStorageMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgniteDataStorageMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgniteDataStorageMetricsSelfTest.java
new file mode 100644
index 0000000..93fa24e
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgniteDataStorageMetricsSelfTest.java
@@ -0,0 +1,237 @@
+/*
+ * 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.internal.processors.cache.persistence;
+
+import java.io.Serializable;
+import java.util.Objects;
+import org.apache.ignite.DataRegionMetrics;
+import org.apache.ignite.DataStorageMetrics;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+import org.apache.ignite.configuration.BinaryConfiguration;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.PAX;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ *
+ */
+public class IgniteDataStorageMetricsSelfTest extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private static final String GROUP1 = "grp1";
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ GridTestUtils.deleteDbFiles();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ super.beforeTest();
+
+ GridTestUtils.deleteDbFiles();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ cfg.setConsistentId(gridName);
+
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setMaxSize(10 * 1024 * 1024)
+ .setPersistenceEnabled(true)
+ .setMetricsEnabled(true)
+ .setName("dflt-plc"))
+ .setDataRegionConfigurations(new DataRegionConfiguration()
+ .setMaxSize(10 * 1024 * 1024)
+ .setPersistenceEnabled(false)
+ .setMetricsEnabled(true)
+ .setName("no-persistence"))
+ .setWalMode(WALMode.LOG_ONLY)
+ .setPageSize(1024)
+ .setMetricsEnabled(true);
+
+ cfg.setDataStorageConfiguration(memCfg);
+
+ cfg.setBinaryConfiguration(new BinaryConfiguration().setCompactFooter(false));
+
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
+
+ cfg.setCacheConfiguration(cacheConfiguration(GROUP1, "cache", PARTITIONED, ATOMIC, 1, null),
+ cacheConfiguration(null, "cache-np", PARTITIONED, ATOMIC, 1, "no-persistence"));
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+
+ GridTestUtils.deleteDbFiles();
+
+ super.afterTest();
+ }
+
+ /**
+ * @param grpName Cache group name.
+ * @param name Cache name.
+ * @param cacheMode Cache mode.
+ * @param atomicityMode Atomicity mode.
+ * @param backups Backups number.
+ * @return Cache configuration.
+ */
+ private CacheConfiguration cacheConfiguration(
+ String grpName,
+ String name,
+ CacheMode cacheMode,
+ CacheAtomicityMode atomicityMode,
+ int backups,
+ String dataRegName
+ ) {
+ CacheConfiguration ccfg = new CacheConfiguration();
+
+ ccfg.setName(name);
+ ccfg.setGroupName(grpName);
+ ccfg.setAtomicityMode(atomicityMode);
+ ccfg.setBackups(backups);
+ ccfg.setCacheMode(cacheMode);
+ ccfg.setWriteSynchronizationMode(FULL_SYNC);
+ ccfg.setDataRegionName(dataRegName);
+
+ return ccfg;
+ }
+
+ /**
+ * @throws Exception if failed.
+ */
+ public void testPersistenceMetrics() throws Exception {
+ final IgniteEx ig = startGrid(0);
+
+ ig.active(true);
+
+ try {
+ IgniteCache<Object, Object> cache = ig.cache("cache");
+
+ for (int i = 0; i < 10; i++)
+ cache.put(i, new Person("first-" + i, "last-" + i));
+
+ IgniteCache<Object, Object> cacheNp = ig.cache("cache-np");
+
+ for (int i = 0; i < 10; i++)
+ cacheNp.put(i, new Person("first-" + i, "last-" + i));
+
+ DataRegionMetrics memMetrics = ig.dataRegionMetrics("dflt-plc");
+
+ assertNotNull(memMetrics);
+ assertTrue(memMetrics.getDirtyPages() > 0);
+ assertTrue(memMetrics.getPagesFillFactor() > 0);
+
+ memMetrics = ig.dataRegionMetrics("no-persistence");
+
+ assertNotNull(memMetrics);
+ assertTrue(memMetrics.getTotalAllocatedPages() > 0);
+ assertTrue(memMetrics.getPagesFillFactor() > 0);
+
+ ig.context().cache().context().database().waitForCheckpoint("test");
+
+ assertTrue(GridTestUtils.waitForCondition(new PAX() {
+ @Override public boolean applyx() {
+ DataStorageMetrics pMetrics = ig.dataStorageMetrics();
+
+ assertNotNull(pMetrics);
+
+ return pMetrics.getLastCheckpointTotalPagesNumber() != 0 &&
+ pMetrics.getLastCheckpointDataPagesNumber() != 0;
+ }
+ }, 10_000));
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ *
+ */
+ static class Person implements Serializable {
+ /** */
+ @GridToStringInclude
+ @QuerySqlField(index = true, groups = "full_name")
+ private String fName;
+
+ /** */
+ @GridToStringInclude
+ @QuerySqlField(index = true, groups = "full_name")
+ private String lName;
+
+ /**
+ * @param fName First name.
+ * @param lName Last name.
+ */
+ public Person(String fName, String lName) {
+ this.fName = fName;
+ this.lName = lName;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(Person.class, this);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ Person person = (Person)o;
+
+ return Objects.equals(fName, person.fName) &&
+ Objects.equals(lName, person.lName);
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return Objects.hash(fName, lName);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsBinaryMetadataOnClusterRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsBinaryMetadataOnClusterRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsBinaryMetadataOnClusterRestartTest.java
index cc3820b..50d7e7e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsBinaryMetadataOnClusterRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsBinaryMetadataOnClusterRestartTest.java
@@ -31,8 +31,9 @@ import org.apache.ignite.cache.affinity.AffinityKeyMapped;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.BinaryConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -63,9 +64,12 @@ public class IgnitePdsBinaryMetadataOnClusterRestartTest extends GridCommonAbstr
cfg.setClientMode(clientMode);
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
+ cfg.setDataStorageConfiguration(
+ new DataStorageConfiguration()
.setWalMode(WALMode.LOG_ONLY)
+ .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setPersistenceEnabled(true)
+ .setMaxSize(100 * 1024 * 1024))
);
BinaryConfiguration bCfg = new BinaryConfiguration();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheRebalancingAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheRebalancingAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheRebalancingAbstractTest.java
index 705156f..8e43e93 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheRebalancingAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheRebalancingAbstractTest.java
@@ -37,10 +37,9 @@ import org.apache.ignite.cache.QueryEntity;
import org.apache.ignite.cache.QueryIndex;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
@@ -113,27 +112,23 @@ public abstract class IgnitePdsCacheRebalancingAbstractTest extends GridCommonAb
cfg.setCacheConfiguration(ccfg1, ccfg2, ccfg3);
}
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration();
memCfg.setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);
memCfg.setPageSize(1024);
+ memCfg.setWalMode(WALMode.LOG_ONLY);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
+ DataRegionConfiguration memPlcCfg = new DataRegionConfiguration();
- memPlcCfg.setName("dfltMemPlc");
+ memPlcCfg.setName("dfltDataRegion");
memPlcCfg.setMaxSize(150 * 1024 * 1024);
memPlcCfg.setInitialSize(100 * 1024 * 1024);
- memPlcCfg.setSwapFilePath("work/swap");
+ memPlcCfg.setSwapPath("work/swap");
+ memPlcCfg.setPersistenceEnabled(true);
- memCfg.setMemoryPolicies(memPlcCfg);
- memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
+ memCfg.setDefaultDataRegionConfiguration(memPlcCfg);
- cfg.setMemoryConfiguration(memCfg);
-
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setWalMode(WALMode.LOG_ONLY)
- );
+ cfg.setDataStorageConfiguration(memCfg);
cfg.setDiscoverySpi(
new TcpDiscoverySpi()
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsClientNearCachePutGetTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsClientNearCachePutGetTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsClientNearCachePutGetTest.java
index 2c15416..130a91c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsClientNearCachePutGetTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsClientNearCachePutGetTest.java
@@ -17,8 +17,8 @@
package org.apache.ignite.internal.processors.cache.persistence;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.processors.database.IgniteDbClientNearCachePutGetTest;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -33,8 +33,8 @@ public class IgnitePdsClientNearCachePutGetTest extends IgniteDbClientNearCacheP
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
+ cfg.setDataStorageConfiguration(
+ new DataStorageConfiguration()
.setWalMode(WALMode.LOG_ONLY)
);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsContinuousRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsContinuousRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsContinuousRestartTest.java
index a363e8c..27b1950 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsContinuousRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsContinuousRestartTest.java
@@ -32,10 +32,9 @@ import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -80,18 +79,13 @@ public class IgnitePdsContinuousRestartTest extends GridCommonAbstractTest {
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(400 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY)
+ .setCheckpointFrequency(checkpointDelay);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setMaxSize(400 * 1024 * 1024);
- memPlcCfg.setInitialSize(400 * 1024 * 1024);
-
- memCfg.setMemoryPolicies(memPlcCfg);
- memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
CacheConfiguration ccfg1 = new CacheConfiguration();
@@ -103,12 +97,6 @@ public class IgnitePdsContinuousRestartTest extends GridCommonAbstractTest {
cfg.setCacheConfiguration(ccfg1);
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setWalMode(WALMode.LOG_ONLY)
- .setCheckpointingFrequency(checkpointDelay)
- );
-
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsDynamicCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsDynamicCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsDynamicCacheTest.java
index 0325e12..7e0cf82 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsDynamicCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsDynamicCacheTest.java
@@ -28,10 +28,9 @@ import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.processors.database.IgniteDbDynamicCacheSelfTest;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -46,24 +45,13 @@ public class IgnitePdsDynamicCacheTest extends IgniteDbDynamicCacheSelfTest {
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(200 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY)
+ .setPageSize(1024);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setInitialSize(200 * 1024 * 1024);
- memPlcCfg.setMaxSize(200 * 1024 * 1024);
-
- dbCfg.setPageSize(1024);
- dbCfg.setMemoryPolicies(memPlcCfg);
- dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(dbCfg);
-
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setWalMode(WALMode.LOG_ONLY)
- );
+ cfg.setDataStorageConfiguration(memCfg);
if ("client".equals(gridName))
cfg.setClientMode(true);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsExchangeDuringCheckpointTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsExchangeDuringCheckpointTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsExchangeDuringCheckpointTest.java
index 94b8f53..2586a1f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsExchangeDuringCheckpointTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsExchangeDuringCheckpointTest.java
@@ -19,10 +19,9 @@ package org.apache.ignite.internal.processors.cache.persistence;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -40,6 +39,9 @@ public class IgnitePdsExchangeDuringCheckpointTest extends GridCommonAbstractTes
/** */
private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+ /** Non-persistent data region name. */
+ private static final String NO_PERSISTENCE_REGION = "no-persistence-region";
+
/**
*
*/
@@ -88,31 +90,28 @@ public class IgnitePdsExchangeDuringCheckpointTest extends GridCommonAbstractTes
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- MemoryConfiguration memCfg = new MemoryConfiguration();
-
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setInitialSize(100 * 1024 * 1024);
- memPlcCfg.setMaxSize(1000 * 1024 * 1024);
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(800 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY)
+ .setCheckpointThreads(1)
+ .setCheckpointFrequency(1);
- memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
- memCfg.setMemoryPolicies(memPlcCfg);
+ memCfg.setDataRegionConfigurations(new DataRegionConfiguration()
+ .setMaxSize(200 * 1024 * 1024)
+ .setName(NO_PERSISTENCE_REGION)
+ .setPersistenceEnabled(false));
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
- ccfg.setAffinity(new RendezvousAffinityFunction(false, 4096));
-
- cfg.setCacheConfiguration(ccfg);
+ CacheConfiguration ccfgNp = new CacheConfiguration("nonPersistentCache");
+ ccfgNp.setDataRegionName(NO_PERSISTENCE_REGION);
- PersistentStoreConfiguration psiCfg = new PersistentStoreConfiguration()
- .setCheckpointingThreads(1)
- .setCheckpointingFrequency(1)
- .setWalMode(WALMode.LOG_ONLY);
+ ccfg.setAffinity(new RendezvousAffinityFunction(false, 4096));
- cfg.setPersistentStoreConfiguration(psiCfg);
+ cfg.setCacheConfiguration(ccfg, ccfgNp);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsMarshallerMappingRestoreOnNodeStartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsMarshallerMappingRestoreOnNodeStartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsMarshallerMappingRestoreOnNodeStartTest.java
index 517b9ea..0429d6b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsMarshallerMappingRestoreOnNodeStartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsMarshallerMappingRestoreOnNodeStartTest.java
@@ -23,8 +23,8 @@ import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.affinity.AffinityKeyMapped;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
/**
@@ -41,8 +41,8 @@ public class IgnitePdsMarshallerMappingRestoreOnNodeStartTest extends GridCommon
cfg.setWorkDirectory(Paths.get(tmpDir, "srv" + gridIndex).toString());
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
+ cfg.setDataStorageConfiguration(
+ new DataStorageConfiguration()
);
cfg.setCacheConfiguration(new CacheConfiguration()
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsMultiNodePutGetRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsMultiNodePutGetRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsMultiNodePutGetRestartTest.java
index 0437251..6a2c9b8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsMultiNodePutGetRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsMultiNodePutGetRestartTest.java
@@ -30,10 +30,10 @@ import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.BinaryConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -72,18 +72,12 @@ public class IgnitePdsMultiNodePutGetRestartTest extends GridCommonAbstractTest
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(100 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setInitialSize(100 * 1024 * 1024);
- memPlcCfg.setMaxSize(100 * 1024 * 1024);
-
- memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
- memCfg.setMemoryPolicies(memPlcCfg);
-
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
CacheConfiguration ccfg = new CacheConfiguration();
@@ -97,8 +91,6 @@ public class IgnitePdsMultiNodePutGetRestartTest extends GridCommonAbstractTest
cfg.setCacheConfiguration(ccfg);
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
-
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(IP_FINDER);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsPageSizesTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsPageSizesTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsPageSizesTest.java
index 1d6ba4b..d2ec33a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsPageSizesTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsPageSizesTest.java
@@ -23,10 +23,9 @@ import java.util.concurrent.ThreadLocalRandom;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -49,25 +48,13 @@ public class IgnitePdsPageSizesTest extends GridCommonAbstractTest {
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(100 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY)
+ .setPageSize(pageSize);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setInitialSize(100 * 1024 * 1024);
- memPlcCfg.setMaxSize(100 * 1024 * 1024);
-
- memCfg.setMemoryPolicies(memPlcCfg);
- memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- memCfg.setPageSize(pageSize);
-
- cfg.setMemoryConfiguration(memCfg);
-
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setWalMode(WALMode.LOG_ONLY)
- );
+ cfg.setDataStorageConfiguration(memCfg);
cfg.setCacheConfiguration(
new CacheConfiguration(cacheName)
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRecoveryAfterFileCorruptionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRecoveryAfterFileCorruptionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRecoveryAfterFileCorruptionTest.java
index 6e2752d..9369443 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRecoveryAfterFileCorruptionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRecoveryAfterFileCorruptionTest.java
@@ -26,10 +26,10 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.CacheRebalanceMode;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.pagemem.FullPageId;
import org.apache.ignite.internal.pagemem.PageIdAllocator;
@@ -69,7 +69,7 @@ public class IgnitePdsRecoveryAfterFileCorruptionTest extends GridCommonAbstract
private final String cacheName = "cache";
/** Policy name. */
- private final String policyName = "dfltMemPlc";
+ private final String policyName = "dfltDataRegion";
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
@@ -82,24 +82,17 @@ public class IgnitePdsRecoveryAfterFileCorruptionTest extends GridCommonAbstract
cfg.setCacheConfiguration(ccfg);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration()
+ .setMaxSize(1024 * 1024 * 1024)
+ .setPersistenceEnabled(true)
+ .setName(policyName))
+ .setWalMode(WALMode.LOG_ONLY)
+ .setCheckpointFrequency(500)
+ .setAlwaysWriteFullPages(true);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName(policyName);
- memPlcCfg.setInitialSize(1024 * 1024 * 1024);
- memPlcCfg.setMaxSize(1024 * 1024 * 1024);
-
- dbCfg.setMemoryPolicies(memPlcCfg);
- dbCfg.setDefaultMemoryPolicyName(policyName);
-
- cfg.setMemoryConfiguration(dbCfg);
-
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setCheckpointingFrequency(500)
- .setAlwaysWriteFullPages(true)
- );
+ cfg.setDataStorageConfiguration(memCfg);
cfg.setDiscoverySpi(
new TcpDiscoverySpi()
@@ -147,7 +140,7 @@ public class IgnitePdsRecoveryAfterFileCorruptionTest extends GridCommonAbstract
// Disable integrated checkpoint thread.
psMgr.enableCheckpoints(false).get();
- PageMemory mem = sharedCtx.database().memoryPolicy(policyName).pageMemory();
+ PageMemory mem = sharedCtx.database().dataRegion(policyName).pageMemory();
int cacheId = sharedCtx.cache().cache(cacheName).context().cacheId();
@@ -212,7 +205,7 @@ public class IgnitePdsRecoveryAfterFileCorruptionTest extends GridCommonAbstract
dbMgr.enableCheckpoints(false).get();
- PageMemory mem = shared.database().memoryPolicy(null).pageMemory();
+ PageMemory mem = shared.database().dataRegion(null).pageMemory();
for (FullPageId fullId : pages) {
long page = mem.acquirePage(fullId.groupId(), fullId.pageId());
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRemoveDuringRebalancingTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRemoveDuringRebalancingTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRemoveDuringRebalancingTest.java
index 78da14d..d2c157b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRemoveDuringRebalancingTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRemoveDuringRebalancingTest.java
@@ -25,10 +25,9 @@ import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheRebalanceMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
@@ -61,27 +60,17 @@ public class IgnitePdsRemoveDuringRebalancingTest extends GridCommonAbstractTest
.setRebalanceMode(CacheRebalanceMode.SYNC)
);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
-
- dbCfg.setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);
- dbCfg.setPageSize(1024);
-
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setInitialSize(100 * 1024 * 1024);
- memPlcCfg.setMaxSize(100 * 1024 * 1024);
- memPlcCfg.setSwapFilePath(DFLT_STORE_DIR);
-
- dbCfg.setMemoryPolicies(memPlcCfg);
- dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(dbCfg);
-
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration()
+ .setMaxSize(100 * 1024 * 1024)
+ .setPersistenceEnabled(true)
+ .setSwapPath(DFLT_STORE_DIR))
.setWalMode(WALMode.LOG_ONLY)
- );
+ .setPageSize(1024)
+ .setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);
+
+ cfg.setDataStorageConfiguration(memCfg);
cfg.setDiscoverySpi(
new TcpDiscoverySpi()
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsSingleNodePutGetPersistenceTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsSingleNodePutGetPersistenceTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsSingleNodePutGetPersistenceTest.java
index 4add384..18e31fc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsSingleNodePutGetPersistenceTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsSingleNodePutGetPersistenceTest.java
@@ -17,8 +17,8 @@
package org.apache.ignite.internal.processors.cache.persistence;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.processors.database.IgniteDbSingleNodePutGetTest;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -33,8 +33,8 @@ public class IgnitePdsSingleNodePutGetPersistenceTest extends IgniteDbSingleNode
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
+ cfg.setDataStorageConfiguration(
+ new DataStorageConfiguration()
.setWalMode(WALMode.LOG_ONLY)
);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistenceMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistenceMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistenceMetricsSelfTest.java
deleted file mode 100644
index cfa1706..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistenceMetricsSelfTest.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * 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.internal.processors.cache.persistence;
-
-import java.io.Serializable;
-import java.util.Objects;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.MemoryMetrics;
-import org.apache.ignite.PersistenceMetrics;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.cache.query.annotations.QuerySqlField;
-import org.apache.ignite.configuration.BinaryConfiguration;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
-import org.apache.ignite.configuration.WALMode;
-import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-import org.apache.ignite.internal.util.typedef.PAX;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
-
-/**
- *
- */
-public class IgnitePersistenceMetricsSelfTest extends GridCommonAbstractTest {
- /** */
- private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
- /** */
- private static final String GROUP1 = "grp1";
-
- /** {@inheritDoc} */
- @Override protected void afterTestsStopped() throws Exception {
- GridTestUtils.deleteDbFiles();
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- super.beforeTest();
-
- GridTestUtils.deleteDbFiles();
- }
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- cfg.setConsistentId(gridName);
-
- MemoryConfiguration memCfg = new MemoryConfiguration();
- memCfg.setPageSize(1024);
-
- memCfg.setDefaultMemoryPolicyName("dflt-plc");
-
- MemoryPolicyConfiguration memPlc = new MemoryPolicyConfiguration();
- memPlc.setName("dflt-plc");
- memPlc.setMaxSize(10 * 1024 * 1024);
- memPlc.setMetricsEnabled(true);
-
- memCfg.setMemoryPolicies(memPlc);
-
- cfg.setMemoryConfiguration(memCfg);
-
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration()
- .setMetricsEnabled(true).setWalMode(WALMode.LOG_ONLY));
-
- cfg.setBinaryConfiguration(new BinaryConfiguration().setCompactFooter(false));
-
- ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
-
- cfg.setCacheConfiguration(cacheConfiguration(GROUP1, "cache", PARTITIONED, ATOMIC, 1));
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- stopAllGrids();
-
- GridTestUtils.deleteDbFiles();
-
- super.afterTest();
- }
-
- /**
- * @param grpName Cache group name.
- * @param name Cache name.
- * @param cacheMode Cache mode.
- * @param atomicityMode Atomicity mode.
- * @param backups Backups number.
- * @return Cache configuration.
- */
- private CacheConfiguration cacheConfiguration(
- String grpName,
- String name,
- CacheMode cacheMode,
- CacheAtomicityMode atomicityMode,
- int backups
- ) {
- CacheConfiguration ccfg = new CacheConfiguration();
-
- ccfg.setName(name);
- ccfg.setGroupName(grpName);
- ccfg.setAtomicityMode(atomicityMode);
- ccfg.setBackups(backups);
- ccfg.setCacheMode(cacheMode);
- ccfg.setWriteSynchronizationMode(FULL_SYNC);
-
- return ccfg;
- }
-
- /**
- * @throws Exception if failed.
- */
- public void testPersistenceMetrics() throws Exception {
- final IgniteEx ig = startGrid(0);
-
- ig.active(true);
-
- try {
- IgniteCache<Object, Object> cache = ig.cache("cache");
-
- for (int i = 0; i < 10; i++)
- cache.put(i, new Person("first-" + i, "last-" + i));
-
- {
- MemoryMetrics memMetrics = ig.memoryMetrics("dflt-plc");
-
- assertNotNull(memMetrics);
- assertTrue(memMetrics.getDirtyPages() > 0);
- }
-
- ig.context().cache().context().database().waitForCheckpoint("test");
-
- GridTestUtils.waitForCondition(new PAX() {
- @Override public boolean applyx() {
- PersistenceMetrics pMetrics = ig.persistentStoreMetrics();
-
- assertNotNull(pMetrics);
-
- return pMetrics.getLastCheckpointTotalPagesNumber() != 0 &&
- pMetrics.getLastCheckpointDataPagesNumber() != 0;
- }
- }, 5_000);
- }
- finally {
- stopAllGrids();
- }
- }
-
- /**
- *
- */
- static class Person implements Serializable {
- /** */
- @GridToStringInclude
- @QuerySqlField(index = true, groups = "full_name")
- private String fName;
-
- /** */
- @GridToStringInclude
- @QuerySqlField(index = true, groups = "full_name")
- private String lName;
-
- /**
- * @param fName First name.
- * @param lName Last name.
- */
- public Person(String fName, String lName) {
- this.fName = fName;
- this.lName = lName;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(Person.class, this);
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
-
- if (o == null || getClass() != o.getClass())
- return false;
-
- Person person = (Person)o;
-
- return Objects.equals(fName, person.fName) &&
- Objects.equals(lName, person.lName);
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return Objects.hash(fName, lName);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistenceSequentialCheckpointTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistenceSequentialCheckpointTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistenceSequentialCheckpointTest.java
index 9295000..814ee57 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistenceSequentialCheckpointTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistenceSequentialCheckpointTest.java
@@ -18,7 +18,7 @@ package org.apache.ignite.internal.processors.cache.persistence;
import org.apache.ignite.configuration.CheckpointWriteOrder;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.WALMode;
/**
@@ -29,9 +29,9 @@ public class IgnitePersistenceSequentialCheckpointTest extends IgnitePersistentS
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration()
+ cfg.setDataStorageConfiguration(new DataStorageConfiguration()
.setWalMode(WALMode.LOG_ONLY)
- .setCheckpointingThreads(4)
+ .setCheckpointThreads(4)
.setCheckpointWriteOrder(CheckpointWriteOrder.SEQUENTIAL));
return cfg;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistentStoreCacheGroupsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistentStoreCacheGroupsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistentStoreCacheGroupsTest.java
index dc65177..1e7ad1b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistentStoreCacheGroupsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistentStoreCacheGroupsTest.java
@@ -33,9 +33,9 @@ import org.apache.ignite.cache.query.SqlQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.BinaryConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.processors.platform.cache.expiry.PlatformExpiryPolicy;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
@@ -85,13 +85,13 @@ public class IgnitePersistentStoreCacheGroupsTest extends GridCommonAbstractTest
cfg.setConsistentId(gridName);
- MemoryConfiguration memCfg = new MemoryConfiguration();
- memCfg.setPageSize(1024);
- memCfg.setDefaultMemoryPolicySize(100 * 1024 * 1024);
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(100 * 1024 * 1024).setPersistenceEnabled(true))
+ .setPageSize(1024)
+ .setWalMode(WALMode.LOG_ONLY);
- cfg.setMemoryConfiguration(memCfg);
-
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration().setWalMode(WALMode.LOG_ONLY));
+ cfg.setDataStorageConfiguration(memCfg);
cfg.setBinaryConfiguration(new BinaryConfiguration().setCompactFooter(false));
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistentStoreDataStructuresTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistentStoreDataStructuresTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistentStoreDataStructuresTest.java
index fed8766..e9828f5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistentStoreDataStructuresTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePersistentStoreDataStructuresTest.java
@@ -26,10 +26,9 @@ import org.apache.ignite.IgniteQueue;
import org.apache.ignite.IgniteSemaphore;
import org.apache.ignite.IgniteSet;
import org.apache.ignite.configuration.CollectionConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
@@ -50,20 +49,12 @@ public class IgnitePersistentStoreDataStructuresTest extends GridCommonAbstractT
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(200 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setInitialSize(200 * 1024 * 1024);
- memPlcCfg.setMaxSize(200 * 1024 * 1024);
-
- dbCfg.setMemoryPolicies(memPlcCfg);
- dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(dbCfg);
-
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration().setWalMode(WALMode.LOG_ONLY));
+ cfg.setDataStorageConfiguration(memCfg);
return cfg;
}
[30/50] [abbrv] ignite git commit: Removed redundant libs from
libs/optional
Posted by sb...@apache.org.
Removed redundant libs from libs/optional
(cherry picked from commit 347696d)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/280a22ab
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/280a22ab
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/280a22ab
Branch: refs/heads/ignite-3478-tree
Commit: 280a22ab759e2d4395e30dbdf04bedce2f6c8c11
Parents: 3700717
Author: Anton Vinogradov <av...@apache.org>
Authored: Fri Oct 20 17:15:39 2017 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Fri Oct 20 17:17:27 2017 +0300
----------------------------------------------------------------------
assembly/dependencies-fabric-lgpl.xml | 2 ++
assembly/dependencies-fabric.xml | 2 ++
2 files changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/280a22ab/assembly/dependencies-fabric-lgpl.xml
----------------------------------------------------------------------
diff --git a/assembly/dependencies-fabric-lgpl.xml b/assembly/dependencies-fabric-lgpl.xml
index e2fac3c..82b5d5c 100644
--- a/assembly/dependencies-fabric-lgpl.xml
+++ b/assembly/dependencies-fabric-lgpl.xml
@@ -133,6 +133,8 @@
<exclude>org.apache.ignite:ignite-yardstick</exclude>
<exclude>org.apache.ignite:ignite-benchmarks</exclude>
<exclude>org.apache.ignite:ignite-web-agent</exclude>
+ <exclude>org.apache.ignite:ignite-dev-utils</exclude>
+ <exclude>org.apache.ignite:ignite-extdata-platform</exclude>
</excludes>
<sources>
<includeModuleDirectory>true</includeModuleDirectory>
http://git-wip-us.apache.org/repos/asf/ignite/blob/280a22ab/assembly/dependencies-fabric.xml
----------------------------------------------------------------------
diff --git a/assembly/dependencies-fabric.xml b/assembly/dependencies-fabric.xml
index 6c4101e..3e9405b 100644
--- a/assembly/dependencies-fabric.xml
+++ b/assembly/dependencies-fabric.xml
@@ -138,6 +138,8 @@
<exclude>org.apache.ignite:ignite-yardstick</exclude>
<exclude>org.apache.ignite:ignite-benchmarks</exclude>
<exclude>org.apache.ignite:ignite-web-agent</exclude>
+ <exclude>org.apache.ignite:ignite-dev-utils</exclude>
+ <exclude>org.apache.ignite:ignite-extdata-platform</exclude>
</excludes>
<sources>
<includeModuleDirectory>true</includeModuleDirectory>
[35/50] [abbrv] ignite git commit: IGNITE-6710 Added pages replace
age metric
Posted by sb...@apache.org.
IGNITE-6710 Added pages replace age metric
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bb31a8a4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bb31a8a4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bb31a8a4
Branch: refs/heads/ignite-3478-tree
Commit: bb31a8a4e67190435d4cbfc98a63f2de2e000291
Parents: 5d90b8f
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Mon Oct 23 16:34:59 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Oct 23 16:34:59 2017 +0300
----------------------------------------------------------------------
.../org/apache/ignite/DataRegionMetrics.java | 11 +++++++
.../persistence/DataRegionMetricsImpl.java | 30 ++++++++++++++++----
.../DataRegionMetricsMXBeanImpl.java | 5 ++++
.../persistence/DataRegionMetricsSnapshot.java | 9 ++++++
.../persistence/DataStorageMetricsImpl.java | 4 +--
.../persistence/pagemem/PageMemoryImpl.java | 11 +++++--
.../ignite/mxbean/DataRegionMetricsMXBean.java | 4 +++
7 files changed, 63 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bb31a8a4/modules/core/src/main/java/org/apache/ignite/DataRegionMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/DataRegionMetrics.java b/modules/core/src/main/java/org/apache/ignite/DataRegionMetrics.java
index 86b91f4..ce5a122 100644
--- a/modules/core/src/main/java/org/apache/ignite/DataRegionMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/DataRegionMetrics.java
@@ -110,6 +110,17 @@ public interface DataRegionMetrics {
public float getPagesReplaceRate();
/**
+ * Gets average age (in milliseconds) for the pages being replaced from the disk storage.
+ * This number effectively represents the average time between the moment when a page is read
+ * from the disk and the time when the page is evicted. Note that if a page is never evicted, it does
+ * not contribute to this metric.
+ * This metric is enabled only for Ignite nodes with enabled persistence.
+ *
+ * @return Replaced pages age in milliseconds.
+ */
+ public float getPagesReplaceAge();
+
+ /**
* Gets total number of pages currently loaded to the RAM. When persistence is disabled, this metric is equal
* to {@link #getTotalAllocatedPages()}.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/bb31a8a4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsImpl.java
index 1d570f9..471ac94 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsImpl.java
@@ -59,6 +59,9 @@ public class DataRegionMetricsImpl implements DataRegionMetrics {
private volatile HitRateMetrics pageReplaceRate = new HitRateMetrics(60_000, 5);
/** */
+ private volatile HitRateMetrics pageReplaceAge = new HitRateMetrics(60_000, 5);
+
+ /** */
private final DataRegionConfiguration memPlcCfg;
/** */
@@ -103,7 +106,7 @@ public class DataRegionMetricsImpl implements DataRegionMetrics {
if (!metricsEnabled)
return 0;
- return ((float) allocRate.getRate()) / rateTimeInterval;
+ return ((float)allocRate.getRate() * 1000) / rateTimeInterval;
}
/** {@inheritDoc} */
@@ -142,7 +145,17 @@ public class DataRegionMetricsImpl implements DataRegionMetrics {
if (!metricsEnabled || !persistenceEnabled)
return 0;
- return ((float) pageReplaceRate.getRate()) / rateTimeInterval;
+ return ((float)pageReplaceRate.getRate() * 1000) / rateTimeInterval;
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getPagesReplaceAge() {
+ if (!metricsEnabled || !persistenceEnabled)
+ return 0;
+
+ long rep = pageReplaceRate.getRate();
+
+ return rep == 0 ? 0 : ((float)pageReplaceAge.getRate() / rep);
}
/** {@inheritDoc} */
@@ -158,9 +171,12 @@ public class DataRegionMetricsImpl implements DataRegionMetrics {
/**
* Updates pageReplaceRate metric.
*/
- public void updatePageReplaceRate() {
- if (metricsEnabled)
+ public void updatePageReplaceRate(long pageAge) {
+ if (metricsEnabled) {
pageReplaceRate.onHit();
+
+ pageReplaceAge.onHits(pageAge);
+ }
}
/**
@@ -263,7 +279,8 @@ public class DataRegionMetricsImpl implements DataRegionMetrics {
this.rateTimeInterval = rateTimeInterval;
allocRate = new HitRateMetrics((int) rateTimeInterval, subInts);
- pageReplaceRate = new HitRateMetrics((int) rateTimeInterval, subInts);
+ pageReplaceRate = new HitRateMetrics((int)rateTimeInterval, subInts);
+ pageReplaceAge = new HitRateMetrics((int)rateTimeInterval, subInts);
}
/**
@@ -281,6 +298,7 @@ public class DataRegionMetricsImpl implements DataRegionMetrics {
subInts = (int) rateTimeInterval / 10;
allocRate = new HitRateMetrics((int) rateTimeInterval, subInts);
- pageReplaceRate = new HitRateMetrics((int) rateTimeInterval, subInts);
+ pageReplaceRate = new HitRateMetrics((int)rateTimeInterval, subInts);
+ pageReplaceAge = new HitRateMetrics((int)rateTimeInterval, subInts);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bb31a8a4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsMXBeanImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsMXBeanImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsMXBeanImpl.java
index 141d0dc..86ea918 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsMXBeanImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsMXBeanImpl.java
@@ -77,6 +77,11 @@ class DataRegionMetricsMXBeanImpl implements DataRegionMetricsMXBean {
}
/** {@inheritDoc} */
+ @Override public float getPagesReplaceAge() {
+ return memMetrics.getPagesReplaceAge();
+ }
+
+ /** {@inheritDoc} */
@Override public long getPhysicalMemoryPages() {
return memMetrics.getPhysicalMemoryPages();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bb31a8a4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsSnapshot.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsSnapshot.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsSnapshot.java
index c39fdb0d..c9e3d08 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsSnapshot.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsSnapshot.java
@@ -48,6 +48,9 @@ public class DataRegionMetricsSnapshot implements DataRegionMetrics {
private float pageReplaceRate;
/** */
+ private float pageReplaceAge;
+
+ /** */
private long physicalMemoryPages;
/**
@@ -62,6 +65,7 @@ public class DataRegionMetricsSnapshot implements DataRegionMetrics {
pagesFillFactor = metrics.getPagesFillFactor();
dirtyPages = metrics.getDirtyPages();
pageReplaceRate = metrics.getPagesReplaceRate();
+ pageReplaceAge = metrics.getPagesReplaceAge();
physicalMemoryPages = metrics.getPhysicalMemoryPages();
}
@@ -106,6 +110,11 @@ public class DataRegionMetricsSnapshot implements DataRegionMetrics {
}
/** {@inheritDoc} */
+ @Override public float getPagesReplaceAge() {
+ return pageReplaceAge;
+ }
+
+ /** {@inheritDoc} */
@Override public long getPhysicalMemoryPages() {
return physicalMemoryPages;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bb31a8a4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsImpl.java
index 6d196dc..e871597 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsImpl.java
@@ -94,7 +94,7 @@ public class DataStorageMetricsImpl implements DataStorageMetricsMXBean {
if (!metricsEnabled)
return 0;
- return ((float)walLoggingRate.getRate()) / rateTimeInterval;
+ return ((float)walLoggingRate.getRate() * 1000) / rateTimeInterval;
}
/** {@inheritDoc} */
@@ -102,7 +102,7 @@ public class DataStorageMetricsImpl implements DataStorageMetricsMXBean {
if (!metricsEnabled)
return 0;
- return ((float)walWritingRate.getRate()) / rateTimeInterval;
+ return ((float)walWritingRate.getRate() * 1000) / rateTimeInterval;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/bb31a8a4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
index 8c64e0e..4a4fe9e 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
@@ -437,6 +437,8 @@ public class PageMemoryImpl implements PageMemoryEx {
long pageId = storeMgr.allocatePage(cacheId, partId, flags);
+ memMetrics.incrementTotalAllocatedPages();
+
assert PageIdUtils.pageIndex(pageId) > 0; //it's crucial for tracking pages (zero page is super one)
// We need to allocate page in memory for marking it dirty to save it in the next checkpoint.
@@ -608,8 +610,6 @@ public class PageMemoryImpl implements PageMemoryEx {
try {
ByteBuffer buf = wrapPointer(pageAddr, pageSize());
- memMetrics.updatePageReplaceRate();
-
storeMgr.read(cacheId, pageId, buf);
}
catch (IgniteDataIntegrityViolationException ignore) {
@@ -1781,6 +1781,8 @@ public class PageMemoryImpl implements PageMemoryEx {
if (cpPages != null && cpPages.contains(fullPageId)) {
assert storeMgr != null;
+ memMetrics.updatePageReplaceRate(U.currentTimeMillis() - PageHeader.readTimestamp(absPtr));
+
flushDirtyPage.applyx(
fullPageId,
wrapPointer(absPtr + PAGE_OVERHEAD, pageSize()),
@@ -1799,9 +1801,12 @@ public class PageMemoryImpl implements PageMemoryEx {
return false;
}
- else
+ else {
+ memMetrics.updatePageReplaceRate(U.currentTimeMillis() - PageHeader.readTimestamp(absPtr));
+
// Page was not modified, ok to evict.
return true;
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/bb31a8a4/modules/core/src/main/java/org/apache/ignite/mxbean/DataRegionMetricsMXBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/mxbean/DataRegionMetricsMXBean.java b/modules/core/src/main/java/org/apache/ignite/mxbean/DataRegionMetricsMXBean.java
index eeed496..16bc677 100644
--- a/modules/core/src/main/java/org/apache/ignite/mxbean/DataRegionMetricsMXBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/mxbean/DataRegionMetricsMXBean.java
@@ -82,6 +82,10 @@ public interface DataRegionMetricsMXBean extends DataRegionMetrics {
@Override public float getPagesReplaceRate();
/** {@inheritDoc} */
+ @MXBeanDescription("Average age at which pages in memory are replaced with pages from persistent storage (milliseconds).")
+ @Override public float getPagesReplaceAge();
+
+ /** {@inheritDoc} */
@MXBeanDescription("Number of pages residing in physical RAM.")
@Override public long getPhysicalMemoryPages();
[08/50] [abbrv] ignite git commit: IGNITE-6627 .NET: Fix repeated
known metadata updates
Posted by sb...@apache.org.
IGNITE-6627 .NET: Fix repeated known metadata updates
This closes #2876
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/92cbc6b3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/92cbc6b3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/92cbc6b3
Branch: refs/heads/ignite-3478-tree
Commit: 92cbc6b33dd936de2163bf1ec340c2c9f567e039
Parents: c65399c
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Oct 19 12:36:39 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Oct 19 12:36:39 2017 +0300
----------------------------------------------------------------------
.../BasicSerializableObjectsTest.cs | 3 +-
.../Impl/Binary/BinaryFullTypeDescriptor.cs | 19 ++-
.../Binary/BinarySurrogateTypeDescriptor.cs | 8 +-
.../Impl/Binary/IBinaryTypeDescriptor.cs | 6 +-
.../Impl/Binary/Structure/BinaryStructure.cs | 147 +++++++++----------
.../Binary/Structure/BinaryStructureTracker.cs | 16 +-
6 files changed, 97 insertions(+), 102 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/92cbc6b3/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/BasicSerializableObjectsTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/BasicSerializableObjectsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/BasicSerializableObjectsTest.cs
index e9b5576..846cd4c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/BasicSerializableObjectsTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/BasicSerializableObjectsTest.cs
@@ -44,12 +44,13 @@ namespace Apache.Ignite.Core.Tests.Binary.Serializable
public void TestEmptyObjectOnline()
{
using (var ignite = Ignition.Start(TestUtils.GetTestConfiguration()))
+ using (var ignite2 = Ignition.Start(TestUtils.GetTestConfiguration(name: "1")))
{
var cache = ignite.CreateCache<int, EmptyObject>("c");
cache[1] = new EmptyObject();
- var res = cache[1];
+ var res = ignite2.GetCache<int, EmptyObject>("c")[1];
Assert.IsNotNull(res);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/92cbc6b3/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryFullTypeDescriptor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryFullTypeDescriptor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryFullTypeDescriptor.cs
index e38b5ba..50c8c27 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryFullTypeDescriptor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryFullTypeDescriptor.cs
@@ -55,7 +55,7 @@ namespace Apache.Ignite.Core.Impl.Binary
private readonly string _affKeyFieldName;
/** Type structure. */
- private volatile BinaryStructure _writerTypeStruct = BinaryStructure.CreateEmpty();
+ private volatile BinaryStructure _writerTypeStruct;
/** Type structure. */
private volatile BinaryStructure _readerTypeStructure = BinaryStructure.CreateEmpty();
@@ -230,22 +230,27 @@ namespace Apache.Ignite.Core.Impl.Binary
}
/** <inheritDoc /> */
- public void UpdateWriteStructure(BinaryStructure exp, int pathIdx,
- IList<BinaryStructureUpdate> updates)
+ public void UpdateWriteStructure(int pathIdx, IList<BinaryStructureUpdate> updates)
{
lock (this)
{
- _writerTypeStruct = _writerTypeStruct.Merge(exp, pathIdx, updates);
+ if (_writerTypeStruct == null)
+ {
+ // Null struct serves as an indication of a binary type that has never been sent to the cluster,
+ // which is important for types without any fields.
+ _writerTypeStruct = BinaryStructure.CreateEmpty();
+ }
+
+ _writerTypeStruct = _writerTypeStruct.Merge(pathIdx, updates);
}
}
/** <inheritDoc /> */
- public void UpdateReadStructure(BinaryStructure exp, int pathIdx,
- IList<BinaryStructureUpdate> updates)
+ public void UpdateReadStructure(int pathIdx, IList<BinaryStructureUpdate> updates)
{
lock (this)
{
- _readerTypeStructure = _readerTypeStructure.Merge(exp, pathIdx, updates);
+ _readerTypeStructure = _readerTypeStructure.Merge(pathIdx, updates);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/92cbc6b3/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs
index 737c7c4..6fece77 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs
@@ -134,20 +134,20 @@ namespace Apache.Ignite.Core.Impl.Binary
}
/** <inheritDoc /> */
- public void UpdateWriteStructure(BinaryStructure exp, int pathIdx, IList<BinaryStructureUpdate> updates)
+ public void UpdateWriteStructure(int pathIdx, IList<BinaryStructureUpdate> updates)
{
lock (this)
{
- _writerTypeStruct = _writerTypeStruct.Merge(exp, pathIdx, updates);
+ _writerTypeStruct = _writerTypeStruct.Merge(pathIdx, updates);
}
}
/** <inheritDoc /> */
- public void UpdateReadStructure(BinaryStructure exp, int pathIdx, IList<BinaryStructureUpdate> updates)
+ public void UpdateReadStructure(int pathIdx, IList<BinaryStructureUpdate> updates)
{
lock (this)
{
- _readerTypeStructure = _readerTypeStructure.Merge(exp, pathIdx, updates);
+ _readerTypeStructure = _readerTypeStructure.Merge(pathIdx, updates);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/92cbc6b3/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryTypeDescriptor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryTypeDescriptor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryTypeDescriptor.cs
index 4bd7e73..840fc08 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryTypeDescriptor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryTypeDescriptor.cs
@@ -90,18 +90,16 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <summary>
/// Update write type structure.
/// </summary>
- /// <param name="exp">Expected type structure.</param>
/// <param name="pathIdx">Path index.</param>
/// <param name="updates">Recorded updates.</param>
- void UpdateWriteStructure(BinaryStructure exp, int pathIdx, IList<BinaryStructureUpdate> updates);
+ void UpdateWriteStructure(int pathIdx, IList<BinaryStructureUpdate> updates);
/// <summary>
/// Update read type structure.
/// </summary>
- /// <param name="exp">Expected type structure.</param>
/// <param name="pathIdx">Path index.</param>
/// <param name="updates">Recorded updates.</param>
- void UpdateReadStructure(BinaryStructure exp, int pathIdx, IList<BinaryStructureUpdate> updates);
+ void UpdateReadStructure(int pathIdx, IList<BinaryStructureUpdate> updates);
/// <summary>
/// Gets the schema.
http://git-wip-us.apache.org/repos/asf/ignite/blob/92cbc6b3/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructure.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructure.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructure.cs
index 92c841c..908059a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructure.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructure.cs
@@ -118,14 +118,12 @@ namespace Apache.Ignite.Core.Impl.Binary.Structure
/// <summary>
/// Merge updates into a new type structure.
/// </summary>
- /// <param name="exp">Expected type structure to apply updates to </param>
/// <param name="pathIdx">Path index.</param>
/// <param name="updates">Updates.</param>
/// <returns>New type structure with updates.</returns>
- public BinaryStructure Merge(BinaryStructure exp, int pathIdx,
- IList<BinaryStructureUpdate> updates)
+ public BinaryStructure Merge(int pathIdx, IList<BinaryStructureUpdate> updates)
{
- if (updates.Count == 0)
+ if (updates == null || updates.Count == 0)
return this;
// Algorithm ensures that updates are applied to the same type structure,
@@ -137,102 +135,97 @@ namespace Apache.Ignite.Core.Impl.Binary.Structure
// Note that field types are merged anyway to avoid metadata clashes.
BinaryStructure res = MergeFieldTypes(updates);
+ BinaryStructureUpdate firstUpdate = updates[0];
- if (ReferenceEquals(exp, this))
+ if (firstUpdate.Index == 0)
{
- BinaryStructureUpdate firstUpdate = updates[0];
+ // Special case: the very first structure update. Simply attach all updates.
+ Debug.Assert(_paths.Length == 1);
+ Debug.Assert(_paths[0].Length == 0);
+ Debug.Assert(pathIdx == 0);
- if (firstUpdate.Index == 0)
- {
- // Special case: the very first structure update. Simply attach all updates.
- Debug.Assert(_paths.Length == 1);
- Debug.Assert(_paths[0].Length == 0);
- Debug.Assert(pathIdx == 0);
-
- var newPaths = CopyPaths(updates.Count, 0);
+ var newPaths = CopyPaths(updates.Count, 0);
- ApplyUpdatesToPath(newPaths[0], updates);
-
- res = new BinaryStructure(newPaths, _jumps, res._fieldTypes);
- }
- else
- {
- // Get entry where updates should start.
- BinaryStructureEntry[] path = _paths[pathIdx];
+ ApplyUpdatesToPath(newPaths[0], updates);
- BinaryStructureEntry startEntry = default(BinaryStructureEntry);
-
- if (firstUpdate.Index < path.Length)
- startEntry = path[firstUpdate.Index];
+ res = new BinaryStructure(newPaths, _jumps, res._fieldTypes);
+ }
+ else
+ {
+ // Get entry where updates should start.
+ BinaryStructureEntry[] path = _paths[pathIdx];
- if (startEntry.IsEmpty)
- {
- // We are on the empty/non-existent entry. Continue the path without branching.
- var newPaths = CopyPaths(firstUpdate.Index + updates.Count, 0);
+ BinaryStructureEntry startEntry = default(BinaryStructureEntry);
- ApplyUpdatesToPath(newPaths[pathIdx], updates);
+ if (firstUpdate.Index < path.Length)
+ startEntry = path[firstUpdate.Index];
- res = new BinaryStructure(newPaths, _jumps, res._fieldTypes);
- }
- else if (startEntry.IsJumpTable)
- {
- // We are on the jump table. Add a new path and record it in the jump table.
-
- // 1. Prepare new structures.
- var newPaths = CopyPaths(firstUpdate.Index + updates.Count, 1);
- var newJumps = CopyJumps(0);
+ if (startEntry.IsEmpty)
+ {
+ // We are on the empty/non-existent entry. Continue the path without branching.
+ var newPaths = CopyPaths(firstUpdate.Index + updates.Count, 0);
- // New path will be the last one.
- int newPathIdx = newPaths.Length - 1;
+ ApplyUpdatesToPath(newPaths[pathIdx], updates);
- // Apply updates to the new path.
- ApplyUpdatesToPath(newPaths[newPathIdx], updates);
+ res = new BinaryStructure(newPaths, _jumps, res._fieldTypes);
+ }
+ else if (startEntry.IsJumpTable)
+ {
+ // We are on the jump table. Add a new path and record it in the jump table.
- // Add the jump to the table.
- newJumps[startEntry.Id] =
- newJumps[startEntry.Id].CopyAndAdd(firstUpdate.FieldName, newPathIdx);
+ // 1. Prepare new structures.
+ var newPaths = CopyPaths(firstUpdate.Index + updates.Count, 1);
+ var newJumps = CopyJumps(0);
- res = new BinaryStructure(newPaths, newJumps, res._fieldTypes);
- }
- else
- {
- // We are on existing entry. Need to create a new jump table here and two new paths.
+ // New path will be the last one.
+ int newPathIdx = newPaths.Length - 1;
- // 1. Prepaare new structures.
- var newPaths = CopyPaths(firstUpdate.Index + updates.Count, 2);
- var newJumps = CopyJumps(1);
+ // Apply updates to the new path.
+ ApplyUpdatesToPath(newPaths[newPathIdx], updates);
- // Old path will be moved here.
- int oldPathIdx = newPaths.Length - 2;
+ // Add the jump to the table.
+ newJumps[startEntry.Id] =
+ newJumps[startEntry.Id].CopyAndAdd(firstUpdate.FieldName, newPathIdx);
- // New path will reside here.
- int newPathIdx = newPaths.Length - 1;
+ res = new BinaryStructure(newPaths, newJumps, res._fieldTypes);
+ }
+ else
+ {
+ // We are on existing entry. Need to create a new jump table here and two new paths.
- // Create new jump table.
- int newJumpIdx = newJumps.Length - 1;
+ // 1. Prepaare new structures.
+ var newPaths = CopyPaths(firstUpdate.Index + updates.Count, 2);
+ var newJumps = CopyJumps(1);
- newJumps[newJumpIdx] = new BinaryStructureJumpTable(startEntry.Name, oldPathIdx,
- firstUpdate.FieldName, newPathIdx);
+ // Old path will be moved here.
+ int oldPathIdx = newPaths.Length - 2;
- // Re-create old path in two steps: move old path to the new place, then clean the old path.
- for (int i = firstUpdate.Index; i < path.Length; i++)
- {
- newPaths[oldPathIdx][i] = newPaths[pathIdx][i];
+ // New path will reside here.
+ int newPathIdx = newPaths.Length - 1;
- if (i == firstUpdate.Index)
- // Inject jump table ...
- newPaths[pathIdx][i] = new BinaryStructureEntry(newJumpIdx);
- else
- // ... or just reset.
- newPaths[pathIdx][i] = new BinaryStructureEntry();
- }
+ // Create new jump table.
+ int newJumpIdx = newJumps.Length - 1;
- // Apply updates to the new path.
- ApplyUpdatesToPath(newPaths[newPaths.Length - 1], updates);
+ newJumps[newJumpIdx] = new BinaryStructureJumpTable(startEntry.Name, oldPathIdx,
+ firstUpdate.FieldName, newPathIdx);
- res = new BinaryStructure(newPaths, newJumps, res._fieldTypes);
+ // Re-create old path in two steps: move old path to the new place, then clean the old path.
+ for (int i = firstUpdate.Index; i < path.Length; i++)
+ {
+ newPaths[oldPathIdx][i] = newPaths[pathIdx][i];
+
+ if (i == firstUpdate.Index)
+ // Inject jump table ...
+ newPaths[pathIdx][i] = new BinaryStructureEntry(newJumpIdx);
+ else
+ // ... or just reset.
+ newPaths[pathIdx][i] = new BinaryStructureEntry();
}
+ // Apply updates to the new path.
+ ApplyUpdatesToPath(newPaths[newPaths.Length - 1], updates);
+
+ res = new BinaryStructure(newPaths, newJumps, res._fieldTypes);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/92cbc6b3/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureTracker.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureTracker.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureTracker.cs
index 3517342..ee2e7e1 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureTracker.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureTracker.cs
@@ -68,7 +68,7 @@ namespace Apache.Ignite.Core.Impl.Binary.Structure
{
_curStructAction++;
- if (_curStructUpdates == null)
+ if (_curStructUpdates == null && _portStruct != null)
{
var fieldId = _portStruct.GetFieldId(fieldName, fieldTypeId, ref _curStructPath,
_curStructAction);
@@ -86,7 +86,7 @@ namespace Apache.Ignite.Core.Impl.Binary.Structure
public void UpdateReaderStructure()
{
if (_curStructUpdates != null)
- _desc.UpdateReadStructure(_desc.ReaderTypeStructure, _curStructPath, _curStructUpdates);
+ _desc.UpdateReadStructure(_curStructPath, _curStructUpdates);
}
/// <summary>
@@ -97,7 +97,7 @@ namespace Apache.Ignite.Core.Impl.Binary.Structure
{
if (_curStructUpdates != null)
{
- _desc.UpdateWriteStructure(_desc.WriterTypeStructure, _curStructPath, _curStructUpdates);
+ _desc.UpdateWriteStructure(_curStructPath, _curStructUpdates);
var marsh = writer.Marshaller;
@@ -115,15 +115,13 @@ namespace Apache.Ignite.Core.Impl.Binary.Structure
writer.SaveMetadata(_desc, fields);
}
}
- else
+ else if (_desc.WriterTypeStructure == null)
{
- // Special case when the object is with no properties.
- // Save meta to Marshaller.
+ // Empty object (no fields).
+ // Null WriterTypeStructure indicates that meta has never been sent for this type.
writer.Marshaller.GetBinaryTypeHandler(_desc);
-
- // Save meta to cluster.
writer.SaveMetadata(_desc, null);
- return;
+ _desc.UpdateWriteStructure(_curStructPath, null);
}
}
[44/50] [abbrv] ignite git commit: IGNITE-6708: Removed
ignite-compatibility module from "optional" build directory. This closes
#2902.
Posted by sb...@apache.org.
IGNITE-6708: Removed ignite-compatibility module from "optional" build directory. This closes #2902.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/05e07624
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/05e07624
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/05e07624
Branch: refs/heads/ignite-3478-tree
Commit: 05e0762414f5a5e9823b25da28f7c5a4259f161d
Parents: 896d4cd
Author: oleg-ostanin <oo...@gridgain.com>
Authored: Tue Oct 24 09:49:55 2017 +0300
Committer: devozerov <pp...@gmail.com>
Committed: Tue Oct 24 09:52:31 2017 +0300
----------------------------------------------------------------------
assembly/dependencies-fabric-lgpl.xml | 1 +
assembly/dependencies-fabric.xml | 1 +
2 files changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/05e07624/assembly/dependencies-fabric-lgpl.xml
----------------------------------------------------------------------
diff --git a/assembly/dependencies-fabric-lgpl.xml b/assembly/dependencies-fabric-lgpl.xml
index 1347c05..fe2932e 100644
--- a/assembly/dependencies-fabric-lgpl.xml
+++ b/assembly/dependencies-fabric-lgpl.xml
@@ -135,6 +135,7 @@
<exclude>org.apache.ignite:ignite-web-agent</exclude>
<exclude>org.apache.ignite:ignite-dev-utils</exclude>
<exclude>org.apache.ignite:ignite-extdata-platform</exclude>
+ <exclude>org.apache.ignite:ignite-compatibility</exclude>
<exclude>org.apache.ignite:ignite-sqlline</exclude>
</excludes>
<sources>
http://git-wip-us.apache.org/repos/asf/ignite/blob/05e07624/assembly/dependencies-fabric.xml
----------------------------------------------------------------------
diff --git a/assembly/dependencies-fabric.xml b/assembly/dependencies-fabric.xml
index 4d9c870..3bcae04 100644
--- a/assembly/dependencies-fabric.xml
+++ b/assembly/dependencies-fabric.xml
@@ -140,6 +140,7 @@
<exclude>org.apache.ignite:ignite-web-agent</exclude>
<exclude>org.apache.ignite:ignite-dev-utils</exclude>
<exclude>org.apache.ignite:ignite-extdata-platform</exclude>
+ <exclude>org.apache.ignite:ignite-compatibility</exclude>
<exclude>org.apache.ignite:ignite-sqlline</exclude>
</excludes>
<sources>
[31/50] [abbrv] ignite git commit: AI release notes.
Posted by sb...@apache.org.
AI release notes.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3b18170f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3b18170f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3b18170f
Branch: refs/heads/ignite-3478-tree
Commit: 3b18170ffc80061278e3ed6ffc3296aed4644161
Parents: 280a22a
Author: devozerov <vo...@gridgain.com>
Authored: Fri Oct 20 18:11:52 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Fri Oct 20 18:11:52 2017 +0300
----------------------------------------------------------------------
RELEASE_NOTES.txt | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 97 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3b18170f/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 23497d8..25007c7 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -1,6 +1,103 @@
Apache Ignite Release Notes
===========================
+Apache Ignite In-Memory Data Fabric 2.3
+---------------------------------------
+Ignite:
+* Ability to enable persistence per data region.
+* Default page size is changed to 4KB.
+* Ability to enable and disable rebalancing per-node.
+* Added methods for batch services deployment.
+* Introduced cache start/stop order on cluster activation.
+* EstimatedRebalancingFinishTime and RebalancingStartTime metrics are exposed through MXBean interface.
+* Ability to (de)activate cluster via http-rest API.
+* Added Ignite update notifier.
+* Updated Lucene dependency to version 5.5.2.
+* Added an option to disable MBeans.
+* Added sorted and multithreaded checkpoint modes.
+* Added calculation of fill factor memory metric in persistent mode.
+* Added estimated time for rebalance start and completion to cache metrics.
+* Added API to add binary metadata locally.
+* Added write throttling during an ongoing checkpoint to avoid zero performance drops.
+* Ability to convert WAL to human-redable form.
+* Ability to handle CacheObject from DataRecord in standalone WAL iterator.
+* Support for uninterruptable writes using AsyncFileIOFactory; enabled with -DIGNITE_USE_ASYNC_FILE_IO_FACTORY=true.
+* Enhanced persistent store path resolving to not rely on automatically generated consistent ID.
+* Pre-configure local event listeners with IgniteConfiguration.LocalEventListeners.
+* Massive performance and stability improvements.
+
+Ignite.NET:
+* LINQ: Local collections joins support.
+* LINQ: Regex support.
+
+Ignite CPP:
+* Added Compute::Broadcast method.
+* Added Ignite::SetActive method.
+
+SQL:
+* Added sqlline utility to the build.
+* CREATE TABLE: Added NOT NULL support.
+* CREATE TABLE: Ability to specify cache, key type and value type names.
+* CREATE TABLE: Added "WRAP_KEY" and "WRAP_VALUE" options to CREATE TABLE command.
+* CREATE TABLE: Added WRITE_SYNCHRONIZATION_MODE option.
+* ALTER TABLE: ADD COLUMN support.
+* Added lazy query execution mode (SqlFieldsQuery.setLazy).
+* Added QuerySqlField.inlineSize property.
+* Added FieldsQueryCursor interface to get fields metadata for SqlFieldsQuery.
+* Added QueryEntity(Class keyClass, Class valueClass) constructor.
+* Improved LocalDate, LocalTime and LocalDateTime support for Java 8.
+* Optimized memory consumption during query execution.
+* Fixed BigInteger data type handling.
+
+JDBC Driver:
+* Batch update support.
+* SQLSTATE error codes support.
+* Added "enforceJoinOrder" flag to connection string.
+* Added "skipReducerOnUpdate" flag.
+* Thin driver: Allowed execution of multiple SQL statements in one command.
+* Thin driver: Added metadata support.
+* Thin driver: Added type conversions in accordance with specification.
+* Thin driver: Added schema to connection string.
+* Thin driver: Added Statement.closeOnCompletion() support.
+* Appended UUID to thick driver's Ignite instance name to avoid collision with user-created instances.
+* Fixed a bug in PreparedStatement not clearing query parameters after execution.
+
+ODBC Driver:
+* SQLSTATE error codes support.
+* Support for BINARY and VARBINARY types.
+* DML statement batching.
+* SQL_ATTR_CONNECTION_DEAD connection attribute.
+* SQLGetInfo for info types.
+* Added "skipReducerOnUpdate" flag.
+* SQLRowCount now returns number of affected rows for non-batch queries.
+* SQLBindParameter do not unbind parameter if the ParameterValuePtr is NULL anymore.
+* Fixed error on cursor closing before all the rows from the result fetched.
+
+Machine Learning:
+* Implemented K-means clustering algorithm optimized for distributed storages.
+* Introduced sparse block distributed matrix.
+* Initial BLAS implementation.
+* Integration with BLAS via netlib.
+* Added getRow() and getCol() methods to Matrix API.
+
+Web Console:
+* Improved DDL support.
+* Added PK alias generation on Models screen.
+* Added generation of QueryEntity.keyFields on model import from RDBMS.
+* Added sanitize user on save.
+* Added charts with throughput and latency metrics for cache operations.
+* Added version to footer.
+* Added "Lazy ResultSet" flag on Queries screen.
+* Implemented refresh rate for Monitoring screen.
+* Implemented cluster nodes log viewer.
+
+Visor:
+* Ability to keep connection opened in batch mode.
+* Ability to activate/deactivate cluster.
+* Improved cache statistics.
+* Added missing configuration properties to "config" command.
+* Fixed script execution after alert throttling interval.
+
Apache Ignite In-Memory Data Fabric 2.2
---------------------------------------
Ignite:
[16/50] [abbrv] ignite git commit: IGNITE-6030 Allow enabling
persistence per data region
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/IgniteWalReaderTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/IgniteWalReaderTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/IgniteWalReaderTest.java
index 79387e3..88eacef 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/IgniteWalReaderTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/IgniteWalReaderTest.java
@@ -45,10 +45,9 @@ import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheRebalanceMode;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
@@ -131,31 +130,20 @@ public class IgniteWalReaderTest extends GridCommonAbstractTest {
cfg.setIncludeEventTypes(EventType.EVT_WAL_SEGMENT_ARCHIVED);
- final MemoryConfiguration dbCfg = new MemoryConfiguration();
-
- dbCfg.setPageSize(PAGE_SIZE);
-
- final MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
- memPlcCfg.setName("dfltMemPlc");
- memPlcCfg.setInitialSize(1024 * 1024 * 1024);
- memPlcCfg.setMaxSize(1024 * 1024 * 1024);
-
- dbCfg.setMemoryPolicies(memPlcCfg);
- dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(dbCfg);
-
- final PersistentStoreConfiguration pCfg = new PersistentStoreConfiguration();
- pCfg.setWalHistorySize(1);
- pCfg.setWalSegmentSize(1024 * 1024);
- pCfg.setWalSegments(WAL_SEGMENTS);
- pCfg.setWalMode(customWalMode != null ? customWalMode : WALMode.BACKGROUND);
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(1024 * 1024 * 1024).setPersistenceEnabled(true))
+ .setPageSize(PAGE_SIZE)
+ .setWalHistorySize(1)
+ .setWalSegmentSize(1024 * 1024)
+ .setWalSegments(WAL_SEGMENTS)
+ .setWalMode(customWalMode != null ? customWalMode : WALMode.BACKGROUND);
if (archiveIncompleteSegmentAfterInactivityMs > 0)
- pCfg.setWalAutoArchiveAfterInactivity(archiveIncompleteSegmentAfterInactivityMs);
+ memCfg.setWalAutoArchiveAfterInactivity(archiveIncompleteSegmentAfterInactivityMs);
+
+ cfg.setDataStorageConfiguration(memCfg);
- cfg.setPersistentStoreConfiguration(pCfg);
return cfg;
}
@@ -510,8 +498,8 @@ public class IgniteWalReaderTest extends GridCommonAbstractTest {
* @param factory WAL iterator factory.
* @param workDir Ignite work directory.
* @param subfolderName DB subfolder name based on consistent ID.
- * @param expCntEntries minimum expected entries count to find.
- * @param expTxCnt minimum expected transaction count to find.
+ * @param minCntEntries minimum expected entries count to find.
+ * @param minTxCnt minimum expected transaction count to find.
* @param objConsumer object handler, called for each object found in logical data records.
* @param dataRecordHnd data handler record
* @throws IgniteCheckedException if failed.
@@ -520,8 +508,8 @@ public class IgniteWalReaderTest extends GridCommonAbstractTest {
final IgniteWalIteratorFactory factory,
final String workDir,
final String subfolderName,
- final int expCntEntries,
- final int expTxCnt,
+ final int minCntEntries,
+ final int minTxCnt,
@Nullable final BiConsumer<Object, Object> objConsumer,
@Nullable final Consumer<DataRecord> dataRecordHnd) throws IgniteCheckedException {
@@ -556,8 +544,8 @@ public class IgniteWalReaderTest extends GridCommonAbstractTest {
final int entriesWork = valuesSum(cntWork.values());
log.info("Archive directory: Tx found " + txCntObservedWork + " entries " + entriesWork);
- assert entriesArch + entriesWork >= expCntEntries;
- assert txCntObservedWork + txCntObservedArch >= expTxCnt;
+ assert entriesArch + entriesWork >= minCntEntries;
+ assert txCntObservedWork + txCntObservedArch >= minTxCnt;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/MockWalIteratorFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/MockWalIteratorFactory.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/MockWalIteratorFactory.java
index 05636eb..5c9e084 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/MockWalIteratorFactory.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/MockWalIteratorFactory.java
@@ -21,8 +21,8 @@ import java.io.File;
import java.io.Serializable;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
import org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager;
@@ -86,20 +86,20 @@ public class MockWalIteratorFactory {
* @throws IgniteCheckedException if IO failed
*/
public WALIterator iterator(File wal, File walArchive) throws IgniteCheckedException {
- final PersistentStoreConfiguration persistentCfg1 = Mockito.mock(PersistentStoreConfiguration.class);
+ final DataStorageConfiguration persistentCfg1 = Mockito.mock(DataStorageConfiguration.class);
- when(persistentCfg1.getWalStorePath()).thenReturn(wal.getAbsolutePath());
+ when(persistentCfg1.getWalPath()).thenReturn(wal.getAbsolutePath());
when(persistentCfg1.getWalArchivePath()).thenReturn(walArchive.getAbsolutePath());
when(persistentCfg1.getWalSegments()).thenReturn(segments);
- when(persistentCfg1.getTlbSize()).thenReturn(PersistentStoreConfiguration.DFLT_TLB_SIZE);
- when(persistentCfg1.getWalRecordIteratorBufferSize()).thenReturn(PersistentStoreConfiguration.DFLT_WAL_RECORD_ITERATOR_BUFFER_SIZE);
+ when(persistentCfg1.getWalThreadLocalBufferSize()).thenReturn(DataStorageConfiguration.DFLT_TLB_SIZE);
+ when(persistentCfg1.getWalRecordIteratorBufferSize()).thenReturn(DataStorageConfiguration.DFLT_WAL_RECORD_ITERATOR_BUFFER_SIZE);
- final FileIOFactory fileIOFactory = new PersistentStoreConfiguration().getFileIOFactory();
+ final FileIOFactory fileIOFactory = new DataStorageConfiguration().getFileIOFactory();
when(persistentCfg1.getFileIOFactory()).thenReturn(fileIOFactory);
final IgniteConfiguration cfg = Mockito.mock(IgniteConfiguration.class);
- when(cfg.getPersistentStoreConfiguration()).thenReturn(persistentCfg1);
+ when(cfg.getDataStorageConfiguration()).thenReturn(persistentCfg1);
final GridKernalContext ctx = Mockito.mock(GridKernalContext.class);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/BPlusTreePageMemoryImplTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/BPlusTreePageMemoryImplTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/BPlusTreePageMemoryImplTest.java
index 56d09f8..d6bfe10 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/BPlusTreePageMemoryImplTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/BPlusTreePageMemoryImplTest.java
@@ -18,7 +18,7 @@
package org.apache.ignite.internal.processors.cache.persistence.pagemem;
import java.nio.ByteBuffer;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.mem.DirectMemoryProvider;
import org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider;
import org.apache.ignite.internal.pagemem.FullPageId;
@@ -26,7 +26,7 @@ import org.apache.ignite.internal.pagemem.PageMemory;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.persistence.CheckpointLockStateChecker;
import org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryMetricsImpl;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl;
import org.apache.ignite.internal.processors.database.BPlusTreeSelfTest;
import org.apache.ignite.internal.util.typedef.CIX3;
import org.apache.ignite.testframework.junits.GridTestKernalContext;
@@ -82,7 +82,7 @@ public class BPlusTreePageMemoryImplTest extends BPlusTreeSelfTest {
return true;
}
},
- new MemoryMetricsImpl(new MemoryPolicyConfiguration()),
+ new DataRegionMetricsImpl(new DataRegionConfiguration()),
false
);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/BPlusTreeReuseListPageMemoryImplTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/BPlusTreeReuseListPageMemoryImplTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/BPlusTreeReuseListPageMemoryImplTest.java
index 39183b2..dabd532 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/BPlusTreeReuseListPageMemoryImplTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/BPlusTreeReuseListPageMemoryImplTest.java
@@ -18,7 +18,7 @@
package org.apache.ignite.internal.processors.cache.persistence.pagemem;
import java.nio.ByteBuffer;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.mem.DirectMemoryProvider;
import org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider;
import org.apache.ignite.internal.pagemem.FullPageId;
@@ -26,7 +26,7 @@ import org.apache.ignite.internal.pagemem.PageMemory;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.persistence.CheckpointLockStateChecker;
import org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryMetricsImpl;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl;
import org.apache.ignite.internal.processors.database.BPlusTreeReuseSelfTest;
import org.apache.ignite.internal.util.lang.GridInClosure3X;
import org.apache.ignite.internal.util.typedef.CIX3;
@@ -82,7 +82,7 @@ public class BPlusTreeReuseListPageMemoryImplTest extends BPlusTreeReuseSelfTest
return true;
}
},
- new MemoryMetricsImpl(new MemoryPolicyConfiguration()),
+ new DataRegionMetricsImpl(new DataRegionConfiguration()),
false
);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/MetadataStoragePageMemoryImplTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/MetadataStoragePageMemoryImplTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/MetadataStoragePageMemoryImplTest.java
index a427c63..d5492ab 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/MetadataStoragePageMemoryImplTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/MetadataStoragePageMemoryImplTest.java
@@ -19,7 +19,7 @@ package org.apache.ignite.internal.processors.cache.persistence.pagemem;
import java.io.File;
import java.nio.ByteBuffer;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.mem.DirectMemoryProvider;
import org.apache.ignite.internal.mem.file.MappedFileMemoryProvider;
import org.apache.ignite.internal.pagemem.FullPageId;
@@ -27,7 +27,7 @@ import org.apache.ignite.internal.pagemem.PageMemory;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.persistence.CheckpointLockStateChecker;
import org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryMetricsImpl;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl;
import org.apache.ignite.internal.processors.database.MetadataStorageSelfTest;
import org.apache.ignite.internal.util.lang.GridInClosure3X;
import org.apache.ignite.internal.util.typedef.CIX3;
@@ -97,7 +97,7 @@ public class MetadataStoragePageMemoryImplTest extends MetadataStorageSelfTest{
return true;
}
},
- new MemoryMetricsImpl(new MemoryPolicyConfiguration()),
+ new DataRegionMetricsImpl(new DataRegionConfiguration()),
false
);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImplNoLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImplNoLoadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImplNoLoadTest.java
index 467ede4..db6d321 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImplNoLoadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImplNoLoadTest.java
@@ -19,7 +19,7 @@ package org.apache.ignite.internal.processors.cache.persistence.pagemem;
import java.io.File;
import java.nio.ByteBuffer;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.mem.DirectMemoryProvider;
import org.apache.ignite.internal.mem.file.MappedFileMemoryProvider;
import org.apache.ignite.internal.pagemem.FullPageId;
@@ -27,7 +27,7 @@ import org.apache.ignite.internal.pagemem.PageMemory;
import org.apache.ignite.internal.pagemem.impl.PageMemoryNoLoadSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.persistence.CheckpointLockStateChecker;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryMetricsImpl;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl;
import org.apache.ignite.internal.util.lang.GridInClosure3X;
import org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager;
import org.apache.ignite.internal.util.typedef.CIX3;
@@ -88,7 +88,7 @@ public class PageMemoryImplNoLoadTest extends PageMemoryNoLoadSelfTest {
return true;
}
},
- new MemoryMetricsImpl(new MemoryPolicyConfiguration()),
+ new DataRegionMetricsImpl(new DataRegionConfiguration()),
false
);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImplTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImplTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImplTest.java
index c5997fa..92c5ad6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImplTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImplTest.java
@@ -18,7 +18,7 @@
package org.apache.ignite.internal.processors.cache.persistence.pagemem;
import java.nio.ByteBuffer;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.mem.DirectMemoryProvider;
import org.apache.ignite.internal.mem.IgniteOutOfMemoryException;
import org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider;
@@ -27,7 +27,7 @@ import org.apache.ignite.internal.pagemem.PageIdAllocator;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.persistence.CheckpointLockStateChecker;
import org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryMetricsImpl;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl;
import org.apache.ignite.internal.util.lang.GridInClosure3X;
import org.apache.ignite.internal.util.typedef.CIX3;
import org.apache.ignite.testframework.junits.GridTestKernalContext;
@@ -110,7 +110,7 @@ public class PageMemoryImplTest extends GridCommonAbstractTest {
return true;
}
},
- new MemoryMetricsImpl(new MemoryPolicyConfiguration()),
+ new DataRegionMetricsImpl(new DataRegionConfiguration()),
false
);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSandboxTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSandboxTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSandboxTest.java
index e3de493..30fb492 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSandboxTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSandboxTest.java
@@ -24,15 +24,14 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteDataStreamer;
-import org.apache.ignite.MemoryMetrics;
+import org.apache.ignite.DataRegionMetrics;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager;
@@ -66,16 +65,18 @@ public class PagesWriteThrottleSandboxTest extends GridCommonAbstractTest {
TcpDiscoverySpi discoverySpi = (TcpDiscoverySpi)cfg.getDiscoverySpi();
discoverySpi.setIpFinder(ipFinder);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration dbCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setMaxSize(4000L * 1024 * 1024)
+ .setName("dfltDataRegion")
+ .setMetricsEnabled(true)
+ .setPersistenceEnabled(true))
+ .setWalMode(WALMode.BACKGROUND)
+ .setCheckpointFrequency(20_000)
+ .setCheckpointPageBufferSize(1000L * 1000 * 1000)
+ .setWriteThrottlingEnabled(true);
- dbCfg.setMemoryPolicies(new MemoryPolicyConfiguration()
- .setMaxSize(4000L * 1024 * 1024)
- .setName("dfltMemPlc")
- .setMetricsEnabled(true));
-
- dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(dbCfg);
+ cfg.setDataStorageConfiguration(dbCfg);
CacheConfiguration ccfg1 = new CacheConfiguration();
@@ -86,13 +87,6 @@ public class PagesWriteThrottleSandboxTest extends GridCommonAbstractTest {
cfg.setCacheConfiguration(ccfg1);
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setWalMode(WALMode.BACKGROUND)
- .setCheckpointingFrequency(20_000)
- .setCheckpointingPageBufferSize(1000L * 1000 * 1000)
- .setWriteThrottlingEnabled(true));
-
cfg.setConsistentId(gridName);
return cfg;
@@ -155,8 +149,8 @@ public class PagesWriteThrottleSandboxTest extends GridCommonAbstractTest {
while (run.get()) {
long dirtyPages = 0;
- for (MemoryMetrics m : ig.memoryMetrics())
- if (m.getName().equals("dfltMemPlc"))
+ for (DataRegionMetrics m : ig.dataRegionMetrics())
+ if (m.getName().equals("dfltDataRegion"))
dirtyPages = m.getDirtyPages();
long cpBufPages = 0;
@@ -170,7 +164,7 @@ public class PagesWriteThrottleSandboxTest extends GridCommonAbstractTest {
try {
cpBufPages = ((PageMemoryImpl)((IgniteEx)ignite(0)).context().cache().context().database()
- .memoryPolicy("dfltMemPlc").pageMemory()).checkpointBufferPagesCount();
+ .dataRegion("dfltDataRegion").pageMemory()).checkpointBufferPagesCount();
}
catch (IgniteCheckedException e) {
e.printStackTrace();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSmokeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSmokeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSmokeTest.java
index 70a1df8..ab7aab4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSmokeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSmokeTest.java
@@ -31,10 +31,9 @@ import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
@@ -64,7 +63,7 @@ public class PagesWriteThrottleSmokeTest extends GridCommonAbstractTest {
private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
/** Slow checkpoint enabled. */
- private final AtomicBoolean slowCheckpointEnabled = new AtomicBoolean(true);
+ private static final AtomicBoolean slowCheckpointEnabled = new AtomicBoolean(true);
/** Cache name. */
private static final String CACHE_NAME = "cache1";
@@ -76,16 +75,20 @@ public class PagesWriteThrottleSmokeTest extends GridCommonAbstractTest {
TcpDiscoverySpi discoverySpi = (TcpDiscoverySpi)cfg.getDiscoverySpi();
discoverySpi.setIpFinder(ipFinder);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
-
- dbCfg.setMemoryPolicies(new MemoryPolicyConfiguration()
- .setMaxSize(400 * 1024 * 1024)
- .setName("dfltMemPlc")
- .setMetricsEnabled(true));
-
- dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(dbCfg);
+ DataStorageConfiguration dbCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setMaxSize(400 * 1024 * 1024)
+ .setName("dfltDataRegion")
+ .setMetricsEnabled(true)
+ .setPersistenceEnabled(true))
+ .setWalMode(WALMode.BACKGROUND)
+ .setCheckpointFrequency(20_000)
+ .setCheckpointPageBufferSize(200 * 1000 * 1000)
+ .setWriteThrottlingEnabled(true)
+ .setCheckpointThreads(1)
+ .setFileIOFactory(new SlowCheckpointFileIOFactory());
+
+ cfg.setDataStorageConfiguration(dbCfg);
CacheConfiguration ccfg1 = new CacheConfiguration();
@@ -96,15 +99,6 @@ public class PagesWriteThrottleSmokeTest extends GridCommonAbstractTest {
cfg.setCacheConfiguration(ccfg1);
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setWalMode(WALMode.BACKGROUND)
- .setCheckpointingFrequency(20_000)
- .setCheckpointingPageBufferSize(200 * 1000 * 1000)
- .setWriteThrottlingEnabled(true)
- .setCheckpointingThreads(1)
- .setFileIOFactory(new SlowCheckpointFileIOFactory()));
-
cfg.setConsistentId(gridName);
return cfg;
@@ -285,7 +279,7 @@ public class PagesWriteThrottleSmokeTest extends GridCommonAbstractTest {
/**
* Create File I/O that emulates poor checkpoint write speed.
*/
- private class SlowCheckpointFileIOFactory implements FileIOFactory {
+ private static class SlowCheckpointFileIOFactory implements FileIOFactory {
/** Serial version uid. */
private static final long serialVersionUID = 0L;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/AbstractNodeJoinTemplate.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/AbstractNodeJoinTemplate.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/AbstractNodeJoinTemplate.java
index 436db1c..66e5b17 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/AbstractNodeJoinTemplate.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/AbstractNodeJoinTemplate.java
@@ -23,8 +23,9 @@ import java.util.List;
import java.util.Map;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
@@ -308,7 +309,10 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
/** {@inheritDoc} */
protected IgniteConfiguration persistentCfg(IgniteConfiguration cfg) throws Exception {
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
+ cfg.setDataStorageConfiguration(new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setMaxSize(100 * 1024 * 1024)
+ .setPersistenceEnabled(true)));
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateAbstractTest.java
index 4e575cc..71107d4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateAbstractTest.java
@@ -23,10 +23,10 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadLocalRandom;
import org.apache.ignite.Ignite;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
@@ -340,28 +340,21 @@ public abstract class IgniteChangeGlobalStateAbstractTest extends GridCommonAbst
@Override protected IgniteConfiguration getConfiguration(final String gridName) throws Exception {
final IgniteConfiguration cfg = super.getConfiguration(gridName);
- PersistentStoreConfiguration pCfg = new PersistentStoreConfiguration();
+ DataStorageConfiguration pCfg = new DataStorageConfiguration();
- pCfg.setPersistentStorePath(testName() + "/db");
+ pCfg.setStoragePath(testName() + "/db");
pCfg.setWalArchivePath(testName() + "/db/wal/archive");
- pCfg.setWalStorePath(testName() + "/db/wal");
+ pCfg.setWalPath(testName() + "/db/wal");
- cfg.setPersistentStoreConfiguration(pCfg);
+ pCfg.setPageSize(1024);
+ pCfg.setConcurrencyLevel(64);
- final MemoryConfiguration memCfg = new MemoryConfiguration();
+ pCfg.setWalMode(WALMode.LOG_ONLY);
- memCfg.setPageSize(1024);
- memCfg.setConcurrencyLevel(64);
+ pCfg.setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(200 * 1024 * 1024).setPersistenceEnabled(true));
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
- memPlcCfg.setInitialSize(200 * 1024 * 1024);
- memPlcCfg.setMaxSize(200 * 1024 * 1024);
- memPlcCfg.setName("dfltMemPlc");
-
- memCfg.setMemoryPolicies(memPlcCfg);
- memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(pCfg);
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateServiceTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateServiceTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateServiceTest.java
index 44e0357..e6c9ae5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateServiceTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateServiceTest.java
@@ -49,6 +49,8 @@ public class IgniteChangeGlobalStateServiceTest extends IgniteChangeGlobalStateA
*
*/
public void testDeployService() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-6629");
+
Ignite ig1P = primary(0);
Ignite ig1B = backUp(0);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java
index 77f89ba..300f9f8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java
@@ -28,8 +28,9 @@ import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
@@ -68,7 +69,12 @@ public class IgniteStandByClusterTest extends GridCommonAbstractTest {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(vmIpFinder));
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
+
+ cfg.setDataStorageConfiguration(new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setMaxSize(100 * 1024 * 1024)
+ .setPersistenceEnabled(true)));
+
cfg.setConsistentId(igniteInstanceName);
return cfg;
@@ -178,7 +184,7 @@ public class IgniteStandByClusterTest extends GridCommonAbstractTest {
for (IgniteEx ig : Arrays.asList(ig1, ig2, ig3)) {
Map<String, DynamicCacheDescriptor> desc = U.field(
- U.field(ig.context().cache(), "cachesInfo"), "registeredCaches");
+ (Object)U.field(ig.context().cache(), "cachesInfo"), "registeredCaches");
assertEquals(4, desc.size());
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivateExtensionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivateExtensionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivateExtensionTest.java
index f70dd1e..6ca29d8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivateExtensionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivateExtensionTest.java
@@ -21,11 +21,11 @@ import java.lang.reflect.Method;
import java.util.LinkedHashMap;
import java.util.Map;
import org.apache.ignite.Ignite;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.GridCacheAbstractFullApiSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearOnlyMultiNodeFullApiSelfTest;
@@ -61,31 +61,21 @@ public class GridActivateExtensionTest extends GridCacheAbstractFullApiSelfTest
cfg.setConsistentId("ConsId" + (condId++));
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(primaryIpFinder);
- PersistentStoreConfiguration pCfg = new PersistentStoreConfiguration();
+ DataStorageConfiguration pCfg = new DataStorageConfiguration();
- pCfg.setPersistentStorePath(testName + "/db");
+ pCfg.setStoragePath(testName + "/db");
pCfg.setWalArchivePath(testName + "/db/wal/archive");
- pCfg.setWalStorePath(testName + "/db/wal");
+ pCfg.setWalPath(testName + "/db/wal");
- cfg.setPersistentStoreConfiguration(pCfg);
+ pCfg.setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(200 * 1024 * 1024).setPersistenceEnabled(true));
- final MemoryConfiguration memCfg = new MemoryConfiguration();
+ pCfg.setWalMode(WALMode.LOG_ONLY);
- MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
+ pCfg.setPageSize(1024);
+ pCfg.setConcurrencyLevel(64);
- memPlcCfg.setInitialSize(200 * 1024 * 1024);
- memPlcCfg.setMaxSize(200 * 1024 * 1024);
-
- memPlcCfg.setName("dfltMemPlc");
-
- memCfg.setMemoryPolicies(memPlcCfg);
-
- memCfg.setDefaultMemoryPolicyName(memPlcCfg.getName());
-
- memCfg.setPageSize(1024);
- memCfg.setConcurrencyLevel(64);
-
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(pCfg);
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteAbstractStandByClientReconnectTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteAbstractStandByClientReconnectTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteAbstractStandByClientReconnectTest.java
index 59dcce2..5552d70 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteAbstractStandByClientReconnectTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteAbstractStandByClientReconnectTest.java
@@ -25,8 +25,9 @@ import java.util.Set;
import java.util.concurrent.CountDownLatch;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
import org.apache.ignite.internal.IgniteEx;
@@ -109,7 +110,11 @@ public abstract class IgniteAbstractStandByClientReconnectTest extends GridCommo
cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(clientIpFinder));
}
- cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
+ cfg.setDataStorageConfiguration(new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setMaxSize(100 * 1024 * 1024)
+ .setPersistenceEnabled(true)));
+
cfg.setConsistentId(name);
return cfg;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryBackupQueueTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryBackupQueueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryBackupQueueTest.java
index 85d68d3..5baa3a7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryBackupQueueTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryBackupQueueTest.java
@@ -33,8 +33,8 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.cache.query.ContinuousQuery;
import org.apache.ignite.cache.query.QueryCursor;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.processors.continuous.GridContinuousHandler;
import org.apache.ignite.internal.processors.continuous.GridContinuousProcessor;
@@ -90,10 +90,10 @@ public class IgniteCacheContinuousQueryBackupQueueTest extends GridCommonAbstrac
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration();
memCfg.setPageSize(16 * 1024);
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockCauseTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockCauseTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockCauseTest.java
index 530009b..4e760bc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockCauseTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockCauseTest.java
@@ -21,11 +21,9 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.*;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.util.typedef.CAX;
-import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -63,17 +61,10 @@ public class TxDeadlockCauseTest extends GridCommonAbstractTest {
cfg.setDiscoverySpi(discoSpi);
}
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(100 * 1024 * 1024));
- MemoryPolicyConfiguration plc = new MemoryPolicyConfiguration();
-
- plc.setName("dfltPlc");
- plc.setMaxSize(100L * 1024 * 1024);
-
- memCfg.setDefaultMemoryPolicyName("dfltPlc");
- memCfg.setMemoryPolicies(plc);
-
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
CacheConfiguration ccfg0 = ccfg == null ? new CacheConfiguration(DEFAULT_CACHE_NAME)
.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL) : ccfg;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxPessimisticDeadlockDetectionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxPessimisticDeadlockDetectionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxPessimisticDeadlockDetectionTest.java
index 82fa52c..60f1c96 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxPessimisticDeadlockDetectionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxPessimisticDeadlockDetectionTest.java
@@ -34,8 +34,8 @@ import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
@@ -89,17 +89,12 @@ public class TxPessimisticDeadlockDetectionTest extends AbstractDeadlockDetectio
cfg.setDiscoverySpi(discoSpi);
}
- MemoryConfiguration memCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration()
+ .setMaxSize(DataStorageConfiguration.DFLT_DATA_REGION_MAX_SIZE * 10)
+ .setName("dfltPlc"));
- MemoryPolicyConfiguration plc = new MemoryPolicyConfiguration();
-
- plc.setName("dfltPlc");
- plc.setMaxSize(MemoryConfiguration.DFLT_MEMORY_POLICY_MAX_SIZE * 10);
-
- memCfg.setDefaultMemoryPolicyName("dfltPlc");
- memCfg.setMemoryPolicies(plc);
-
- cfg.setMemoryConfiguration(memCfg);
+ cfg.setDataStorageConfiguration(memCfg);
cfg.setClientMode(client);
@@ -196,7 +191,7 @@ public class TxPessimisticDeadlockDetectionTest extends AbstractDeadlockDetectio
ccfg.setWriteSynchronizationMode(syncMode);
if (cacheMode == LOCAL)
- ccfg.setMemoryPolicyName("dfltPlc");
+ ccfg.setDataRegionName("dfltPlc");
IgniteCache cache = ignite(0).createCache(ccfg);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
index 9c0d791..7b4ca13 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
@@ -33,7 +33,7 @@ import java.util.concurrent.atomic.AtomicLongArray;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.Lock;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider;
import org.apache.ignite.internal.pagemem.FullPageId;
@@ -42,7 +42,7 @@ import org.apache.ignite.internal.pagemem.PageMemory;
import org.apache.ignite.internal.pagemem.PageUtils;
import org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl;
import org.apache.ignite.internal.processors.cache.persistence.DataStructure;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryMetricsImpl;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl;
import org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.BPlusIO;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.BPlusInnerIO;
@@ -1795,7 +1795,7 @@ public class BPlusTreeSelfTest extends GridCommonAbstractTest {
* @return Page memory.
*/
protected PageMemory createPageMemory() throws Exception {
- MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration()
+ DataRegionConfiguration plcCfg = new DataRegionConfiguration()
.setInitialSize(1024 * MB)
.setMaxSize(1024 * MB);
@@ -1804,7 +1804,7 @@ public class BPlusTreeSelfTest extends GridCommonAbstractTest {
null,
PAGE_SIZE,
plcCfg,
- new MemoryMetricsImpl(plcCfg), true);
+ new DataRegionMetricsImpl(plcCfg), true);
pageMem.start();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/database/DataRegionMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/DataRegionMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/DataRegionMetricsSelfTest.java
new file mode 100644
index 0000000..22e87b8
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/DataRegionMetricsSelfTest.java
@@ -0,0 +1,348 @@
+/*
+ * 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.internal.processors.database;
+
+import java.util.concurrent.CountDownLatch;
+import org.apache.ignite.DataRegionMetrics;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl;
+import org.apache.ignite.internal.processors.cache.ratemetrics.HitRateMetrics;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static java.lang.Thread.sleep;
+
+/**
+ *
+ */
+public class DataRegionMetricsSelfTest extends GridCommonAbstractTest {
+ /** */
+ private DataRegionMetricsImpl memMetrics;
+
+ /** */
+ private int threadsCnt = 1;
+
+ /** */
+ private Thread[] allocationThreads;
+
+ /** */
+ private Thread watcherThread;
+
+ /** */
+ private static final int RATE_TIME_INTERVAL_1 = 5_000;
+
+ /** */
+ private static final int RATE_TIME_INTERVAL_2 = 10_000;
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ DataRegionConfiguration plcCfg = new DataRegionConfiguration();
+
+ memMetrics = new DataRegionMetricsImpl(plcCfg);
+
+ memMetrics.enableMetrics();
+ }
+
+ /**
+ * Test for allocationRate metric in single-threaded mode.
+ * @throws Exception if any happens during test.
+ */
+ public void testAllocationRateSingleThreaded() throws Exception {
+ threadsCnt = 1;
+ memMetrics.rateTimeInterval(RATE_TIME_INTERVAL_2);
+
+ CountDownLatch startLatch = new CountDownLatch(1);
+
+ startAllocationThreads(startLatch, 340, 50);
+ AllocationRateWatcher watcher = startWatcherThread(startLatch, 20);
+
+ alignWithTimeInterval(RATE_TIME_INTERVAL_2, 5);
+
+ startLatch.countDown();
+
+ joinAllThreads();
+
+ assertTrue(watcher.rateDropsCntr > 3);
+
+ assertTrue(watcher.rateDropsCntr < 6);
+ }
+
+ /**
+ * Test for allocationRate metric in multi-threaded mode with short silent period in the middle of the test.
+ * @throws Exception if any happens during test.
+ */
+ public void testAllocationRateMultiThreaded() throws Exception {
+ threadsCnt = 4;
+ memMetrics.rateTimeInterval(RATE_TIME_INTERVAL_1);
+
+ CountDownLatch startLatch = new CountDownLatch(1);
+
+ startAllocationThreads(startLatch, 7_800, 1);
+
+ AllocationRateWatcher watcher = startWatcherThread(startLatch, 20);
+
+ alignWithTimeInterval(RATE_TIME_INTERVAL_1, 5);
+
+ startLatch.countDown();
+
+ joinAllocationThreads();
+
+ assertTrue("4 or 5 rate drops must be observed: " + watcher.rateDropsCntr, watcher.rateDropsCntr == 4 || watcher.rateDropsCntr == 5);
+
+ sleep(3);
+
+ threadsCnt = 8;
+
+ CountDownLatch restartLatch = new CountDownLatch(1);
+
+ startAllocationThreads(restartLatch, 8_000, 1);
+
+ restartLatch.countDown();
+
+ joinAllThreads();
+
+ assertTrue(watcher.rateDropsCntr > 4);
+ }
+
+ /**
+ * Test verifies that allocationRate calculation algorithm survives setting new values to rateTimeInterval parameter.
+ * @throws Exception if any happens during test.
+ */
+ public void testAllocationRateTimeIntervalConcurrentChange() throws Exception {
+ threadsCnt = 5;
+ memMetrics.rateTimeInterval(RATE_TIME_INTERVAL_1);
+
+ CountDownLatch startLatch = new CountDownLatch(1);
+
+ startAllocationThreads(startLatch, 10_000, 1);
+
+ AllocationRateWatcher watcher = startWatcherThread(startLatch, 20);
+
+ alignWithTimeInterval(RATE_TIME_INTERVAL_1, 5);
+
+ startLatch.countDown();
+
+ for (int i = 0; i < 10; i++) {
+ Thread.sleep(25);
+
+ memMetrics.rateTimeInterval(((2 + i * 5) % 3 + 1) * 1000);
+ }
+
+ joinAllThreads();
+
+ assertTrue(watcher.rateDropsCntr > 4);
+ }
+
+ /**
+ *
+ * @throws Exception if any happens during test.
+ */
+ public void testAllocationRateSubintervalsConcurrentChange() throws Exception {
+ threadsCnt = 5;
+ memMetrics.rateTimeInterval(RATE_TIME_INTERVAL_1);
+
+ CountDownLatch startLatch = new CountDownLatch(1);
+
+ startAllocationThreads(startLatch, 10_000, 1);
+
+ AllocationRateWatcher watcher = startWatcherThread(startLatch, 20);
+
+ alignWithTimeInterval(RATE_TIME_INTERVAL_1, 5);
+
+ startLatch.countDown();
+
+ for (int i = 0; i < 10; i++) {
+ Thread.sleep(25);
+
+ memMetrics.subIntervals((2 + i * 5) % 3 + 2);
+ }
+
+ joinAllThreads();
+
+ assertTrue(watcher.rateDropsCntr > 4);
+ }
+
+ /**
+ * As rate metrics {@link HitRateMetrics implementation} is tied to absolute time ticks
+ * (not related to the first hit) all tests need to align start time with this sequence of ticks.
+ *
+ * @param rateTimeInterval Rate time interval.
+ * @param size Size.
+ */
+ private void alignWithTimeInterval(int rateTimeInterval, int size) throws InterruptedException {
+ int subIntervalLength = rateTimeInterval / size;
+
+ long subIntCurTime = System.currentTimeMillis() % subIntervalLength;
+
+ Thread.sleep(subIntervalLength - subIntCurTime);
+ }
+
+ /**
+ * @param startLatch Start latch.
+ * @param watchingDelay Watching delay.
+ */
+ private AllocationRateWatcher startWatcherThread(CountDownLatch startLatch, int watchingDelay) {
+ AllocationRateWatcher watcher = new AllocationRateWatcher(startLatch, memMetrics, watchingDelay);
+
+ watcherThread = new Thread(watcher);
+
+ watcherThread.start();
+
+ return watcher;
+ }
+
+ /**
+ * @param startLatch Start latch.
+ * @param iterationsCnt Iterations count.
+ * @param allocationsDelay Allocations delay.
+ */
+ private void startAllocationThreads(CountDownLatch startLatch, int iterationsCnt, int allocationsDelay) {
+ assert threadsCnt > 0;
+
+ allocationThreads = new Thread[threadsCnt];
+
+ for (int i = 0; i < threadsCnt; i++) {
+ AllocationsIncrementer inc = new AllocationsIncrementer(startLatch, memMetrics, iterationsCnt, allocationsDelay);
+
+ Thread incThread = new Thread(inc);
+ incThread.start();
+
+ allocationThreads[i] = incThread;
+ }
+ }
+
+ /**
+ *
+ */
+ private void joinAllThreads() throws Exception {
+ joinAllocationThreads();
+
+ watcherThread.interrupt();
+ watcherThread.join();
+ }
+
+ /**
+ *
+ */
+ private void joinAllocationThreads() throws Exception {
+ assert allocationThreads != null;
+ assert allocationThreads.length > 0;
+
+ for (Thread allocationThread : allocationThreads)
+ allocationThread.join();
+ }
+
+ /**
+ *
+ */
+ private static class AllocationsIncrementer implements Runnable {
+ /** */
+ private final CountDownLatch startLatch;
+
+ /** */
+ private final DataRegionMetricsImpl memMetrics;
+
+ /** */
+ private final int iterationsCnt;
+
+ /** */
+ private final int delay;
+
+ /**
+ * @param startLatch Start latch.
+ * @param memMetrics Mem metrics.
+ * @param iterationsCnt Iterations count.
+ * @param delay Delay.
+ */
+ private AllocationsIncrementer(CountDownLatch startLatch, DataRegionMetricsImpl memMetrics, int iterationsCnt, int delay) {
+ this.startLatch = startLatch;
+ this.memMetrics = memMetrics;
+ this.iterationsCnt = iterationsCnt;
+ this.delay = delay;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void run() {
+ try {
+ startLatch.await();
+
+ for (int i = 0; i < iterationsCnt; i++) {
+ memMetrics.incrementTotalAllocatedPages();
+
+ sleep(delay);
+ }
+ }
+ catch (InterruptedException ignore) {
+ // No-op.
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ private static class AllocationRateWatcher implements Runnable {
+ /** */
+ private volatile int rateDropsCntr;
+
+ /** */
+ private final CountDownLatch startLatch;
+
+ /** */
+ private final DataRegionMetrics memMetrics;
+
+ /** */
+ private final int delay;
+
+ /**
+ * @param startLatch Start latch.
+ * @param memMetrics Mem metrics.
+ * @param delay Delay.
+ */
+ private AllocationRateWatcher(CountDownLatch startLatch, DataRegionMetrics memMetrics, int delay) {
+ this.startLatch = startLatch;
+ this.memMetrics = memMetrics;
+ this.delay = delay;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void run() {
+ try {
+ startLatch.await();
+
+ float prevRate = 0;
+
+ while (!Thread.currentThread().isInterrupted()) {
+ if (prevRate > memMetrics.getAllocationRate())
+ rateDropsCntr++;
+
+ prevRate = memMetrics.getAllocationRate();
+
+ sleep(delay);
+ }
+ }
+ catch (InterruptedException ignore) {
+ // No-op.
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/database/FreeListImplSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/FreeListImplSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/FreeListImplSelfTest.java
index c190b1d..72a1d81 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/FreeListImplSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/FreeListImplSelfTest.java
@@ -29,7 +29,7 @@ import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider;
import org.apache.ignite.internal.pagemem.PageIdAllocator;
import org.apache.ignite.internal.pagemem.PageMemory;
@@ -40,8 +40,8 @@ import org.apache.ignite.internal.processors.cache.CacheObjectContext;
import org.apache.ignite.internal.processors.cache.CacheObjectValueContext;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryMetricsImpl;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryPolicy;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegion;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl;
import org.apache.ignite.internal.processors.cache.persistence.evict.NoOpPageEvictionTracker;
import org.apache.ignite.internal.processors.cache.persistence.freelist.FreeList;
import org.apache.ignite.internal.processors.cache.persistence.freelist.FreeListImpl;
@@ -315,13 +315,13 @@ public class FreeListImplSelfTest extends GridCommonAbstractTest {
/**
* @return Page memory.
*/
- protected PageMemory createPageMemory(int pageSize, MemoryPolicyConfiguration plcCfg) throws Exception {
+ protected PageMemory createPageMemory(int pageSize, DataRegionConfiguration plcCfg) throws Exception {
PageMemory pageMem = new PageMemoryNoStoreImpl(log,
new UnsafeMemoryProvider(log),
null,
pageSize,
plcCfg,
- new MemoryMetricsImpl(plcCfg),
+ new DataRegionMetricsImpl(plcCfg),
true);
pageMem.start();
@@ -335,7 +335,7 @@ public class FreeListImplSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
protected FreeList createFreeList(int pageSize) throws Exception {
- MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration()
+ DataRegionConfiguration plcCfg = new DataRegionConfiguration()
.setInitialSize(1024 * MB)
.setMaxSize(1024 * MB);
@@ -343,9 +343,9 @@ public class FreeListImplSelfTest extends GridCommonAbstractTest {
long metaPageId = pageMem.allocatePage(1, 1, PageIdAllocator.FLAG_DATA);
- MemoryMetricsImpl metrics = new MemoryMetricsImpl(plcCfg);
+ DataRegionMetricsImpl metrics = new DataRegionMetricsImpl(plcCfg);
- MemoryPolicy memPlc = new MemoryPolicy(pageMem, plcCfg, metrics, new NoOpPageEvictionTracker());
+ DataRegion memPlc = new DataRegion(pageMem, plcCfg, metrics, new NoOpPageEvictionTracker());
return new FreeListImpl(1, "freelist", metrics, memPlc, null, null, metaPageId, true);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbAbstractTest.java
index c9e583f..1d5b624 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbAbstractTest.java
@@ -22,8 +22,8 @@ import java.util.Arrays;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
import org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -63,7 +63,7 @@ public abstract class IgniteDbAbstractTest extends GridCommonAbstractTest {
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration dbCfg = new DataStorageConfiguration();
if (client)
cfg.setClientMode(true);
@@ -77,7 +77,7 @@ public abstract class IgniteDbAbstractTest extends GridCommonAbstractTest {
configure(dbCfg);
- cfg.setMemoryConfiguration(dbCfg);
+ cfg.setDataStorageConfiguration(dbCfg);
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
@@ -149,9 +149,9 @@ public abstract class IgniteDbAbstractTest extends GridCommonAbstractTest {
}
/**
- * @param mCfg MemoryConfiguration.
+ * @param mCfg DataStorageConfiguration.
*/
- protected void configure(MemoryConfiguration mCfg){
+ protected void configure(DataStorageConfiguration mCfg){
// No-op.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbDynamicCacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbDynamicCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbDynamicCacheSelfTest.java
index e745482..e5c0e8a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbDynamicCacheSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbDynamicCacheSelfTest.java
@@ -25,9 +25,9 @@ import org.apache.ignite.cache.CacheRebalanceMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -39,18 +39,10 @@ public class IgniteDbDynamicCacheSelfTest extends GridCommonAbstractTest {
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- MemoryConfiguration dbCfg = new MemoryConfiguration();
+ DataStorageConfiguration memCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(200 * 1024 * 1024));
- MemoryPolicyConfiguration plc = new MemoryPolicyConfiguration();
-
- plc.setName("dfltPlc");
- plc.setInitialSize(200 * 1024 * 1024);
- plc.setMaxSize(200 * 1024 * 1024);
-
- dbCfg.setDefaultMemoryPolicyName("dfltPlc");
- dbCfg.setMemoryPolicies(plc);
-
- cfg.setMemoryConfiguration(dbCfg);
+ cfg.setDataStorageConfiguration(memCfg);
if (gridName.equals("client"))
cfg.setClientMode(true);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakAbstractTest.java
index 93e5181..c4e8bee 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbMemoryLeakAbstractTest.java
@@ -20,9 +20,9 @@ package org.apache.ignite.internal.processors.database;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
import org.apache.ignite.IgniteCache;
+import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
import org.apache.ignite.internal.processors.cache.persistence.DataStructure;
@@ -34,7 +34,7 @@ import static org.apache.ignite.IgniteSystemProperties.getInteger;
*/
public abstract class IgniteDbMemoryLeakAbstractTest extends IgniteDbAbstractTest {
/** */
- private static final int CONCURRENCY_LEVEL = 8;
+ private static final int CONCURRENCY_LEVEL = 16;
/** */
private static final int MIN_PAGE_CACHE_SIZE = 1048576 * CONCURRENCY_LEVEL;
@@ -76,13 +76,13 @@ public abstract class IgniteDbMemoryLeakAbstractTest extends IgniteDbAbstractTes
}
/** {@inheritDoc} */
- @Override protected void configure(MemoryConfiguration mCfg) {
+ @Override protected void configure(DataStorageConfiguration mCfg) {
mCfg.setConcurrencyLevel(CONCURRENCY_LEVEL);
long size = (1024 * (isLargePage() ? 16 : 1) + 24) * pagesMax();
- mCfg.setDefaultMemoryPolicyName("default").setMemoryPolicies(
- new MemoryPolicyConfiguration().setMaxSize(Math.max(size, MIN_PAGE_CACHE_SIZE)).setName("default"));
+ mCfg.setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(Math.max(size, MIN_PAGE_CACHE_SIZE)).setName("default"));
}
/**
@@ -234,7 +234,7 @@ public abstract class IgniteDbMemoryLeakAbstractTest extends IgniteDbAbstractTes
* @throws Exception If failed.
*/
protected final void check(IgniteCache cache) throws Exception {
- long pagesActual = ((IgniteCacheProxy)cache).context().memoryPolicy().pageMemory().loadedPages();
+ long pagesActual = ((IgniteCacheProxy)cache).context().dataRegion().pageMemory().loadedPages();
if (loadedPages > 0) {
delta += pagesActual - loadedPages;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MemoryMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MemoryMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MemoryMetricsSelfTest.java
deleted file mode 100644
index 7fc1035..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MemoryMetricsSelfTest.java
+++ /dev/null
@@ -1,348 +0,0 @@
-/*
- * 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.internal.processors.database;
-
-import java.util.concurrent.CountDownLatch;
-import org.apache.ignite.MemoryMetrics;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryMetricsImpl;
-import org.apache.ignite.internal.processors.cache.ratemetrics.HitRateMetrics;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-import static java.lang.Thread.sleep;
-
-/**
- *
- */
-public class MemoryMetricsSelfTest extends GridCommonAbstractTest {
- /** */
- private MemoryMetricsImpl memMetrics;
-
- /** */
- private int threadsCnt = 1;
-
- /** */
- private Thread[] allocationThreads;
-
- /** */
- private Thread watcherThread;
-
- /** */
- private static final int RATE_TIME_INTERVAL_1 = 5_000;
-
- /** */
- private static final int RATE_TIME_INTERVAL_2 = 10_000;
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration();
-
- memMetrics = new MemoryMetricsImpl(plcCfg);
-
- memMetrics.enableMetrics();
- }
-
- /**
- * Test for allocationRate metric in single-threaded mode.
- * @throws Exception if any happens during test.
- */
- public void testAllocationRateSingleThreaded() throws Exception {
- threadsCnt = 1;
- memMetrics.rateTimeInterval(RATE_TIME_INTERVAL_2);
-
- CountDownLatch startLatch = new CountDownLatch(1);
-
- startAllocationThreads(startLatch, 340, 50);
- AllocationRateWatcher watcher = startWatcherThread(startLatch, 20);
-
- alignWithTimeInterval(RATE_TIME_INTERVAL_2, 5);
-
- startLatch.countDown();
-
- joinAllThreads();
-
- assertTrue(watcher.rateDropsCntr > 3);
-
- assertTrue(watcher.rateDropsCntr < 6);
- }
-
- /**
- * Test for allocationRate metric in multi-threaded mode with short silent period in the middle of the test.
- * @throws Exception if any happens during test.
- */
- public void testAllocationRateMultiThreaded() throws Exception {
- threadsCnt = 4;
- memMetrics.rateTimeInterval(RATE_TIME_INTERVAL_1);
-
- CountDownLatch startLatch = new CountDownLatch(1);
-
- startAllocationThreads(startLatch, 7_800, 1);
-
- AllocationRateWatcher watcher = startWatcherThread(startLatch, 20);
-
- alignWithTimeInterval(RATE_TIME_INTERVAL_1, 5);
-
- startLatch.countDown();
-
- joinAllocationThreads();
-
- assertTrue("4 or 5 rate drops must be observed: " + watcher.rateDropsCntr, watcher.rateDropsCntr == 4 || watcher.rateDropsCntr == 5);
-
- sleep(3);
-
- threadsCnt = 8;
-
- CountDownLatch restartLatch = new CountDownLatch(1);
-
- startAllocationThreads(restartLatch, 8_000, 1);
-
- restartLatch.countDown();
-
- joinAllThreads();
-
- assertTrue(watcher.rateDropsCntr > 4);
- }
-
- /**
- * Test verifies that allocationRate calculation algorithm survives setting new values to rateTimeInterval parameter.
- * @throws Exception if any happens during test.
- */
- public void testAllocationRateTimeIntervalConcurrentChange() throws Exception {
- threadsCnt = 5;
- memMetrics.rateTimeInterval(RATE_TIME_INTERVAL_1);
-
- CountDownLatch startLatch = new CountDownLatch(1);
-
- startAllocationThreads(startLatch, 10_000, 1);
-
- AllocationRateWatcher watcher = startWatcherThread(startLatch, 20);
-
- alignWithTimeInterval(RATE_TIME_INTERVAL_1, 5);
-
- startLatch.countDown();
-
- for (int i = 0; i < 10; i++) {
- Thread.sleep(25);
-
- memMetrics.rateTimeInterval(((2 + i * 5) % 3 + 1) * 1000);
- }
-
- joinAllThreads();
-
- assertTrue(watcher.rateDropsCntr > 4);
- }
-
- /**
- *
- * @throws Exception if any happens during test.
- */
- public void testAllocationRateSubintervalsConcurrentChange() throws Exception {
- threadsCnt = 5;
- memMetrics.rateTimeInterval(RATE_TIME_INTERVAL_1);
-
- CountDownLatch startLatch = new CountDownLatch(1);
-
- startAllocationThreads(startLatch, 10_000, 1);
-
- AllocationRateWatcher watcher = startWatcherThread(startLatch, 20);
-
- alignWithTimeInterval(RATE_TIME_INTERVAL_1, 5);
-
- startLatch.countDown();
-
- for (int i = 0; i < 10; i++) {
- Thread.sleep(25);
-
- memMetrics.subIntervals((2 + i * 5) % 3 + 2);
- }
-
- joinAllThreads();
-
- assertTrue(watcher.rateDropsCntr > 4);
- }
-
- /**
- * As rate metrics {@link HitRateMetrics implementation} is tied to absolute time ticks
- * (not related to the first hit) all tests need to align start time with this sequence of ticks.
- *
- * @param rateTimeInterval Rate time interval.
- * @param size Size.
- */
- private void alignWithTimeInterval(int rateTimeInterval, int size) throws InterruptedException {
- int subIntervalLength = rateTimeInterval / size;
-
- long subIntCurTime = System.currentTimeMillis() % subIntervalLength;
-
- Thread.sleep(subIntervalLength - subIntCurTime);
- }
-
- /**
- * @param startLatch Start latch.
- * @param watchingDelay Watching delay.
- */
- private AllocationRateWatcher startWatcherThread(CountDownLatch startLatch, int watchingDelay) {
- AllocationRateWatcher watcher = new AllocationRateWatcher(startLatch, memMetrics, watchingDelay);
-
- watcherThread = new Thread(watcher);
-
- watcherThread.start();
-
- return watcher;
- }
-
- /**
- * @param startLatch Start latch.
- * @param iterationsCnt Iterations count.
- * @param allocationsDelay Allocations delay.
- */
- private void startAllocationThreads(CountDownLatch startLatch, int iterationsCnt, int allocationsDelay) {
- assert threadsCnt > 0;
-
- allocationThreads = new Thread[threadsCnt];
-
- for (int i = 0; i < threadsCnt; i++) {
- AllocationsIncrementer inc = new AllocationsIncrementer(startLatch, memMetrics, iterationsCnt, allocationsDelay);
-
- Thread incThread = new Thread(inc);
- incThread.start();
-
- allocationThreads[i] = incThread;
- }
- }
-
- /**
- *
- */
- private void joinAllThreads() throws Exception {
- joinAllocationThreads();
-
- watcherThread.interrupt();
- watcherThread.join();
- }
-
- /**
- *
- */
- private void joinAllocationThreads() throws Exception {
- assert allocationThreads != null;
- assert allocationThreads.length > 0;
-
- for (Thread allocationThread : allocationThreads)
- allocationThread.join();
- }
-
- /**
- *
- */
- private static class AllocationsIncrementer implements Runnable {
- /** */
- private final CountDownLatch startLatch;
-
- /** */
- private final MemoryMetricsImpl memMetrics;
-
- /** */
- private final int iterationsCnt;
-
- /** */
- private final int delay;
-
- /**
- * @param startLatch Start latch.
- * @param memMetrics Mem metrics.
- * @param iterationsCnt Iterations count.
- * @param delay Delay.
- */
- private AllocationsIncrementer(CountDownLatch startLatch, MemoryMetricsImpl memMetrics, int iterationsCnt, int delay) {
- this.startLatch = startLatch;
- this.memMetrics = memMetrics;
- this.iterationsCnt = iterationsCnt;
- this.delay = delay;
- }
-
- /** {@inheritDoc} */
- @Override public void run() {
- try {
- startLatch.await();
-
- for (int i = 0; i < iterationsCnt; i++) {
- memMetrics.incrementTotalAllocatedPages();
-
- sleep(delay);
- }
- }
- catch (InterruptedException ignore) {
- // No-op.
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
-
- /**
- *
- */
- private static class AllocationRateWatcher implements Runnable {
- /** */
- private volatile int rateDropsCntr;
-
- /** */
- private final CountDownLatch startLatch;
-
- /** */
- private final MemoryMetrics memMetrics;
-
- /** */
- private final int delay;
-
- /**
- * @param startLatch Start latch.
- * @param memMetrics Mem metrics.
- * @param delay Delay.
- */
- private AllocationRateWatcher(CountDownLatch startLatch, MemoryMetrics memMetrics, int delay) {
- this.startLatch = startLatch;
- this.memMetrics = memMetrics;
- this.delay = delay;
- }
-
- /** {@inheritDoc} */
- @Override public void run() {
- try {
- startLatch.await();
-
- float prevRate = 0;
-
- while (!Thread.currentThread().isInterrupted()) {
- if (prevRate > memMetrics.getAllocationRate())
- rateDropsCntr++;
-
- prevRate = memMetrics.getAllocationRate();
-
- sleep(delay);
- }
- }
- catch (InterruptedException ignore) {
- // No-op.
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
-}