ignite-5075

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

Branch: refs/heads/ignite-5075
Commit: 9c7f9f25a3c0bb6fd0efa7d5e0c1aa177eefa71d
Parents: 88b0944
Author: sboikov <sboi...@gridgain.com>
Authored: Wed May 17 23:03:40 2017 +0300
Committer: sboikov <sboi...@gridgain.com>
Committed: Wed May 17 23:03:40 2017 +0300

----------------------------------------------------------------------
 .../affinity/GridAffinityAssignmentCache.java     | 18 +++++++++---------
 .../cache/CacheAffinitySharedManager.java         |  8 ++++----
 .../processors/cache/CacheGroupDescriptor.java    |  4 ++++
 .../cache/CacheGroupInfrastructure.java           |  2 +-
 4 files changed, 18 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/9c7f9f25/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
index 2adab4d..48d7a44 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
@@ -61,7 +61,7 @@ public class GridAffinityAssignmentCache {
     private final int MAX_HIST_SIZE = getInteger(IGNITE_AFFINITY_HISTORY_SIZE, 
500);
 
     /** Group name. */
-    private final String grpName;
+    private final String cacheOrGrpName;
 
     /** Group ID. */
     private final int grpId;
@@ -115,7 +115,7 @@ public class GridAffinityAssignmentCache {
      * Constructs affinity cached calculations.
      *
      * @param ctx Kernal context.
-     * @param grpName Cache group name.
+     * @param cacheOrGrpName Cache or cache group name.
      * @param grpId Group ID.
      * @param aff Affinity function.
      * @param nodeFilter Node filter.
@@ -124,7 +124,7 @@ public class GridAffinityAssignmentCache {
      */
     @SuppressWarnings("unchecked")
     public GridAffinityAssignmentCache(GridKernalContext ctx,
-        String grpName,
+        String cacheOrGrpName,
         int grpId,
         AffinityFunction aff,
         IgnitePredicate<ClusterNode> nodeFilter,
@@ -139,7 +139,7 @@ public class GridAffinityAssignmentCache {
         this.ctx = ctx;
         this.aff = aff;
         this.nodeFilter = nodeFilter;
-        this.grpName = grpName;
+        this.cacheOrGrpName = cacheOrGrpName;
         this.grpId = grpId;
         this.backups = backups;
         this.locCache = locCache;
@@ -163,10 +163,10 @@ public class GridAffinityAssignmentCache {
     }
 
     /**
-     * @return Cache group name.
+     * @return Group name if it is specified, otherwise cache name.
      */
-    public String groupName() {
-        return grpName;
+    public String cacheOrGroupName() {
+        return cacheOrGrpName;
     }
 
     /**
@@ -434,7 +434,7 @@ public class GridAffinityAssignmentCache {
      */
     public void dumpDebugInfo() {
         if (!readyFuts.isEmpty()) {
-            U.warn(log, "Pending affinity ready futures [grp=" + grpName + ", 
lastVer=" + lastVersion() + "]:");
+            U.warn(log, "Pending affinity ready futures [grp=" + 
cacheOrGrpName + ", lastVer=" + lastVersion() + "]:");
 
             for (AffinityReadyFuture fut : readyFuts.values())
                 U.warn(log, ">>> " + fut);
@@ -463,7 +463,7 @@ public class GridAffinityAssignmentCache {
             if (cache == null) {
                 throw new IllegalStateException("Getting affinity for topology 
version earlier than affinity is " +
                     "calculated [locNode=" + ctx.discovery().localNode() +
-                    ", group=" + grpName +
+                    ", group=" + cacheOrGrpName +
                     ", topVer=" + topVer +
                     ", head=" + head.get().topologyVersion() +
                     ", history=" + affCache.keySet() +

http://git-wip-us.apache.org/repos/asf/ignite/blob/9c7f9f25/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 55f56e75..37c17df 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
@@ -613,7 +613,7 @@ public class CacheAffinitySharedManager<K, V> extends 
GridCacheSharedManagerAdap
 
                 CacheGroupDescriptor desc = registeredGrps.get(aff.groupId());
 
-                assert desc != null : aff.groupName();
+                assert desc != null : aff.cacheOrGroupName();
 
                 IgniteUuid deploymentId = desc.deploymentId();
 
@@ -638,7 +638,7 @@ public class CacheAffinitySharedManager<K, V> extends 
GridCacheSharedManagerAdap
                         List<ClusterNode> nodes = toNodes(topVer, 
e.getValue());
 
                         assert !nodes.equals(assignment.get(part)) : 
"Assignment did not change " +
-                            "[cacheGrp=" + aff.groupName() +
+                            "[cacheGrp=" + aff.cacheOrGroupName() +
                             ", part=" + part +
                             ", cur=" + F.nodeIds(assignment.get(part)) +
                             ", new=" + F.nodeIds(nodes) +
@@ -897,7 +897,7 @@ public class CacheAffinitySharedManager<K, V> extends 
GridCacheSharedManagerAdap
 
         CacheGroupDescriptor grpDesc = registeredGrps.get(aff.groupId());
 
-        assert grpDesc != null : aff.groupName();
+        assert grpDesc != null : aff.cacheOrGroupName();
 
         return fut.cacheGroupAddedOnExchange(aff.groupId(), 
grpDesc.receivedFrom()) ||
             !fut.exchangeId().nodeId().equals(cctx.localNodeId()) ||
@@ -1749,7 +1749,7 @@ public class CacheAffinitySharedManager<K, V> extends 
GridCacheSharedManagerAdap
             U.startLifecycleAware(F.asList(affFunc));
 
             GridAffinityAssignmentCache aff = new 
GridAffinityAssignmentCache(cctx.kernalContext(),
-                grpDesc.groupName(),
+                grpDesc.cacheOrGroupName(),
                 grpDesc.groupId(),
                 affFunc,
                 ccfg.getNodeFilter(),

http://git-wip-us.apache.org/repos/asf/ignite/blob/9c7f9f25/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 9ac9584..af92f91 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
@@ -124,6 +124,10 @@ public class CacheGroupDescriptor {
         return grpName != null;
     }
 
+    public String cacheOrGroupName() {
+        return grpName != null ? grpName : cacheCfg.getName();
+    }
+
     public String groupName() {
         return grpName;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/9c7f9f25/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupInfrastructure.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupInfrastructure.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupInfrastructure.java
index addcfcc..800fdb2 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupInfrastructure.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupInfrastructure.java
@@ -597,7 +597,7 @@ public class CacheGroupInfrastructure {
      */
     public void start() throws IgniteCheckedException {
         aff = new GridAffinityAssignmentCache(ctx.kernalContext(),
-            name(),
+            cacheOrGroupName(),
             grpId,
             ccfg.getAffinity(),
             ccfg.getNodeFilter(),

Reply via email to