IGNITE-5436 .NET: CacheConfiguration.GroupName

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

Branch: refs/heads/ignite-5414
Commit: 5c77dab546f1eded908fd74a51eaef59054e038c
Parents: bd5065b
Author: Pavel Tupitsyn <ptupit...@apache.org>
Authored: Thu Jun 8 12:33:13 2017 +0300
Committer: Pavel Tupitsyn <ptupit...@apache.org>
Committed: Thu Jun 8 12:33:13 2017 +0300

----------------------------------------------------------------------
 .../platform/utils/PlatformConfigurationUtils.java    |  2 ++
 .../Cache/CacheConfigurationTest.cs                   |  2 ++
 .../IgniteConfigurationSerializerTest.cs              |  6 ++++--
 .../Cache/Configuration/CacheConfiguration.cs         | 14 ++++++++++++++
 .../Apache.Ignite.Core/IgniteConfigurationSection.xsd |  5 +++++
 5 files changed, 27 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/5c77dab5/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 40dafbd..176d77b 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
@@ -178,6 +178,7 @@ public class PlatformConfigurationUtils {
             ccfg.setMemoryPolicyName(memoryPolicyName);
 
         
ccfg.setPartitionLossPolicy(PartitionLossPolicy.fromOrdinal((byte)in.readInt()));
+        ccfg.setGroupName(in.readString());
 
         Object storeFactory = in.readObjectDetached();
 
@@ -829,6 +830,7 @@ public class PlatformConfigurationUtils {
         writer.writeBoolean(ccfg.isStatisticsEnabled());
         writer.writeString(ccfg.getMemoryPolicyName());
         writer.writeInt(ccfg.getPartitionLossPolicy().ordinal());
+        writer.writeString(ccfg.getGroupName());
 
         if (ccfg.getCacheStoreFactory() instanceof 
PlatformDotNetCacheStoreFactoryNative)
             
writer.writeObject(((PlatformDotNetCacheStoreFactoryNative)ccfg.getCacheStoreFactory()).getNativeFactory());

http://git-wip-us.apache.org/repos/asf/ignite/blob/5c77dab5/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 7935cc3..b674b0e 100644
--- 
a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
+++ 
b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
@@ -247,6 +247,7 @@ namespace Apache.Ignite.Core.Tests.Cache
             Assert.AreEqual(x.EnableStatistics, y.EnableStatistics);
             Assert.AreEqual(x.MemoryPolicyName, y.MemoryPolicyName);
             Assert.AreEqual(x.PartitionLossPolicy, y.PartitionLossPolicy);
+            Assert.AreEqual(x.GroupName, y.GroupName);
 
             if (x.ExpiryPolicyFactory != null)
                 
Assert.AreEqual(x.ExpiryPolicyFactory.CreateInstance().GetType(),
@@ -512,6 +513,7 @@ namespace Apache.Ignite.Core.Tests.Cache
                 ReadThrough = true,
                 WriteThrough = true,
                 WriteBehindCoalescing = false,
+                GroupName = "someGroup",
                 QueryEntities = new[]
                 {
                     new QueryEntity

http://git-wip-us.apache.org/repos/asf/ignite/blob/5c77dab5/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 7ba4ed2..3229de9 100644
--- 
a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
+++ 
b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
@@ -92,7 +92,7 @@ namespace Apache.Ignite.Core.Tests
                                 <iLifecycleHandler 
type='Apache.Ignite.Core.Tests.IgniteConfigurationSerializerTest+LifecycleBean' 
foo='15' />
                             </lifecycleHandlers>
                             <cacheConfiguration>
-                                <cacheConfiguration cacheMode='Replicated' 
readThrough='true' writeThrough='true' enableStatistics='true' 
writeBehindCoalescing='false' partitionLossPolicy='ReadWriteAll'>
+                                <cacheConfiguration cacheMode='Replicated' 
readThrough='true' writeThrough='true' enableStatistics='true' 
writeBehindCoalescing='false' partitionLossPolicy='ReadWriteAll' 
groupName='fooGroup'>
                                     <queryEntities>    
                                         <queryEntity keyType='System.Int32' 
valueType='System.String' tableName='myTable'>
                                             <fields>
@@ -179,6 +179,7 @@ namespace Apache.Ignite.Core.Tests
             Assert.IsTrue(cacheCfg.EnableStatistics);
             Assert.IsFalse(cacheCfg.WriteBehindCoalescing);
             Assert.AreEqual(PartitionLossPolicy.ReadWriteAll, 
cacheCfg.PartitionLossPolicy);
+            Assert.AreEqual("fooGroup", cacheCfg.GroupName);
 
             var queryEntity = cacheCfg.QueryEntities.Single();
             Assert.AreEqual(typeof(int), queryEntity.KeyType);
@@ -725,7 +726,8 @@ namespace Apache.Ignite.Core.Tests
                             new MyPluginConfiguration()
                         },
                         MemoryPolicyName = "somePolicy",
-                        PartitionLossPolicy = PartitionLossPolicy.ReadOnlyAll
+                        PartitionLossPolicy = PartitionLossPolicy.ReadOnlyAll,
+                        GroupName = "abc"
                     }
                 },
                 ClientMode = true,

http://git-wip-us.apache.org/repos/asf/ignite/blob/5c77dab5/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 1ee7c97..04198dd 100644
--- 
a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
+++ 
b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
@@ -236,6 +236,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
             EnableStatistics = reader.ReadBoolean();
             MemoryPolicyName = reader.ReadString();
             PartitionLossPolicy = (PartitionLossPolicy) reader.ReadInt();
+            GroupName = reader.ReadString();
             CacheStoreFactory = reader.ReadObject<IFactory<ICacheStore>>();
 
             var count = reader.ReadInt();
@@ -293,6 +294,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
             writer.WriteBoolean(EnableStatistics);
             writer.WriteString(MemoryPolicyName);
             writer.WriteInt((int) PartitionLossPolicy);
+            writer.WriteString(GroupName);
             writer.WriteObject(CacheStoreFactory);
 
             if (QueryEntities != null)
@@ -643,5 +645,17 @@ namespace Apache.Ignite.Core.Cache.Configuration
         /// </summary>
         [DefaultValue(DefaultPartitionLossPolicy)]
         public PartitionLossPolicy PartitionLossPolicy { get; set; }
+
+        /// <summary>
+        /// Gets or sets the cache group name. Caches with the same group name 
share single underlying 'physical'
+        /// cache (partition set), but are logically isolated. 
+        /// <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"/>
+        /// <para />
+        /// Grouping caches reduces overall overhead, since internal data 
structures are shared.
+        /// </summary>
+        public string GroupName { get;set; }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/5c77dab5/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 0cd58ed..f0b7f44 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
@@ -743,6 +743,11 @@
                                             <xs:documentation>Partition loss 
policy defines how Ignite will react to a situation when all nodes for some 
partition leave the cluster.</xs:documentation>
                                         </xs:annotation>
                                     </xs:attribute>
+                                    <xs:attribute name="groupName" 
type="xs:string">
+                                        <xs:annotation>
+                                            <xs:documentation>Cache group 
name. Caches with the same group name share single underlying 'physical' cache 
(partition set), but are logically isolated.</xs:documentation>
+                                        </xs:annotation>
+                                    </xs:attribute>
                                 </xs:complexType>
                             </xs:element>
                         </xs:sequence>

Reply via email to