Repository: helix
Updated Branches:
  refs/heads/master be619d462 -> b654c543c


Add debug log for CustomRebalancer, CurrentState and MessageGeneration


Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/78f4b2ad
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/78f4b2ad
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/78f4b2ad

Branch: refs/heads/master
Commit: 78f4b2adb711b021d16fd88dec971de8fa3fe347
Parents: be619d4
Author: Junkai Xue <[email protected]>
Authored: Wed Jun 6 12:10:48 2018 -0700
Committer: Your Name <[email protected]>
Committed: Thu Jul 12 13:52:37 2018 -0700

----------------------------------------------------------------------
 .../helix/common/caches/CurrentStateCache.java       |  3 +++
 .../controller/rebalancer/CustomRebalancer.java      |  8 ++++----
 .../helix/controller/stages/ClusterDataCache.java    | 15 +++++++--------
 .../controller/stages/MessageGenerationPhase.java    |  6 ++++++
 4 files changed, 20 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/78f4b2ad/helix-core/src/main/java/org/apache/helix/common/caches/CurrentStateCache.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/main/java/org/apache/helix/common/caches/CurrentStateCache.java
 
b/helix-core/src/main/java/org/apache/helix/common/caches/CurrentStateCache.java
index 35a7179..4c6ecb8 100644
--- 
a/helix-core/src/main/java/org/apache/helix/common/caches/CurrentStateCache.java
+++ 
b/helix-core/src/main/java/org/apache/helix/common/caches/CurrentStateCache.java
@@ -95,6 +95,9 @@ public class CurrentStateCache extends AbstractDataCache {
     long endTime = System.currentTimeMillis();
     LOG.info("END: CurrentStateCache.refresh() for cluster " + _clusterName + 
", took " + (endTime
         - startTime) + " ms");
+    if (LOG.isDebugEnabled()) {
+      LOG.debug(String.format("Current State freshed : ", 
_currentStateMap.toString()));
+    }
     return true;
   }
 

http://git-wip-us.apache.org/repos/asf/helix/blob/78f4b2ad/helix-core/src/main/java/org/apache/helix/controller/rebalancer/CustomRebalancer.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/main/java/org/apache/helix/controller/rebalancer/CustomRebalancer.java
 
b/helix-core/src/main/java/org/apache/helix/controller/rebalancer/CustomRebalancer.java
index 1f4adca..ebc156a 100644
--- 
a/helix-core/src/main/java/org/apache/helix/controller/rebalancer/CustomRebalancer.java
+++ 
b/helix-core/src/main/java/org/apache/helix/controller/rebalancer/CustomRebalancer.java
@@ -69,9 +69,6 @@ public class CustomRebalancer extends AbstractRebalancer {
 
     String stateModelDefName = idealState.getStateModelDefRef();
     StateModelDefinition stateModelDef = 
cache.getStateModelDef(stateModelDefName);
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("Processing resource:" + resource.getResourceName());
-    }
     partitionMapping = new ResourceAssignment(resource.getResourceName());
     for (Partition partition : resource.getPartitions()) {
       Map<String, String> currentStateMap =
@@ -87,7 +84,10 @@ public class CustomRebalancer extends AbstractRebalancer {
     }
 
     cache.setCachedResourceAssignment(resource.getResourceName(), 
partitionMapping);
-
+    if (LOG.isDebugEnabled()) {
+      LOG.debug(String.format("Processing resource:", 
resource.getResourceName()));
+      LOG.debug(String.format("Final Mapping of resource", 
partitionMapping.toString()));
+    }
     return partitionMapping;
   }
 

http://git-wip-us.apache.org/repos/asf/helix/blob/78f4b2ad/helix-core/src/main/java/org/apache/helix/controller/stages/ClusterDataCache.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/main/java/org/apache/helix/controller/stages/ClusterDataCache.java
 
b/helix-core/src/main/java/org/apache/helix/controller/stages/ClusterDataCache.java
index f3f9e0b..87a3a10 100644
--- 
a/helix-core/src/main/java/org/apache/helix/controller/stages/ClusterDataCache.java
+++ 
b/helix-core/src/main/java/org/apache/helix/controller/stages/ClusterDataCache.java
@@ -142,25 +142,25 @@ public class ClusterDataCache {
       _propertyDataChangedMap.put(ChangeType.IDEAL_STATE, false);
       clearCachedResourceAssignments();
       _idealStateCache.refresh(accessor);
+      LOG.info("Refresh IdealStates for cluster " + _clusterName + ", took " + 
(
+          System.currentTimeMillis() - startTime) + " ms");
     }
 
     if (_propertyDataChangedMap.get(ChangeType.LIVE_INSTANCE)) {
-      long start = System.currentTimeMillis();
+      startTime = System.currentTimeMillis();
       _propertyDataChangedMap.put(ChangeType.LIVE_INSTANCE, false);
       clearCachedResourceAssignments();
       _liveInstanceCacheMap = 
accessor.getChildValuesMap(keyBuilder.liveInstances(), true);
       _updateInstanceOfflineTime = true;
       LOG.info("Refresh LiveInstances for cluster " + _clusterName + ", took " 
+ (
-          System.currentTimeMillis() - start) + " ms");
+          System.currentTimeMillis() - startTime) + " ms");
     }
 
     if (_propertyDataChangedMap.get(ChangeType.INSTANCE_CONFIG)) {
       _propertyDataChangedMap.put(ChangeType.INSTANCE_CONFIG, false);
       clearCachedResourceAssignments();
       _instanceConfigCacheMap = 
accessor.getChildValuesMap(keyBuilder.instanceConfigs(), true);
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("Reload InstanceConfig: " + 
_instanceConfigCacheMap.keySet());
-      }
+      LOG.info("Reload InstanceConfig: " + _instanceConfigCacheMap.keySet());
     }
 
     if (_propertyDataChangedMap.get(ChangeType.RESOURCE_CONFIG)) {
@@ -168,9 +168,8 @@ public class ClusterDataCache {
       clearCachedResourceAssignments();
       _resourceConfigCacheMap =
           accessor.getChildValuesMap(accessor.keyBuilder().resourceConfigs(), 
true);
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("Reload ResourceConfigs: " + _resourceConfigCacheMap.size());
-      }
+      LOG.info("Reload ResourceConfigs: " + _resourceConfigCacheMap.keySet());
+
     }
 
     _liveInstanceMap = new HashMap<>(_liveInstanceCacheMap);

http://git-wip-us.apache.org/repos/asf/helix/blob/78f4b2ad/helix-core/src/main/java/org/apache/helix/controller/stages/MessageGenerationPhase.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/main/java/org/apache/helix/controller/stages/MessageGenerationPhase.java
 
b/helix-core/src/main/java/org/apache/helix/controller/stages/MessageGenerationPhase.java
index 86bacea..5a4f039 100644
--- 
a/helix-core/src/main/java/org/apache/helix/controller/stages/MessageGenerationPhase.java
+++ 
b/helix-core/src/main/java/org/apache/helix/controller/stages/MessageGenerationPhase.java
@@ -193,6 +193,12 @@ public class MessageGenerationPhase extends 
AbstractBaseStage {
                   createStateTransitionMessage(manager, resource, 
partition.getPartitionName(),
                       instanceName, currentState, nextState, 
sessionIdMap.get(instanceName),
                       stateModelDef.getId());
+
+              if (logger.isDebugEnabled()) {
+                logger.debug(String.format(
+                    "Resource %s partition %s for instance %s with 
currentState %s and nextState %s",
+                    resource, partition.getPartitionName(), instanceName, 
currentState, nextState));
+              }
             }
           }
 

Reply via email to