You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by "xyuanlu (via GitHub)" <gi...@apache.org> on 2023/05/01 23:39:24 UTC

[GitHub] [helix] xyuanlu opened a new pull request, #2470: code clean up - debug log format

xyuanlu opened a new pull request, #2470:
URL: https://github.com/apache/helix/pull/2470

   ### Issues
   
   - [X] My PR addresses the following Helix issues and references them in the PR description:
   
   #1521
   
   ### Description
   
   - [X] Here are some details about my PR, including screenshots of any UI changes:
   
   We no longer need to do isDebugEnabled check in slf4j.Logger. It is already had performance improvement integrated. 
   
   ### Tests
   
   - [X] The following tests are written for this issue:
   
   NA
   
   - The following is the result of the "mvn test" command on the appropriate module:
   
   (If CI test fails due to known issue, please specify the issue and test PR locally. Then copy & paste the result of "mvn test" to here.)
   
   ### Changes that Break Backward Compatibility (Optional)
   
   - My PR contains changes that break backward compatibility or previous assumptions for certain methods or API. They include:
   
   (Consider including all behavior changes for public methods or API. Also include these changes in merge description so that other developers are aware of these changes. This allows them to make relevant code changes in feature branches accounting for the new method/API behavior.)
   
   ### Documentation (Optional)
   
   - In case of new functionality, my PR adds documentation in the following wiki page:
   
   (Link the GitHub wiki you added)
   
   ### Commits
   
   - My commits all reference appropriate Apache Helix GitHub issues in their subject lines. In addition, my commits follow the guidelines from "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)":
     1. Subject is separated from body by a blank line
     1. Subject is limited to 50 characters (not including Jira issue reference)
     1. Subject does not end with a period
     1. Subject uses the imperative mood ("add", not "adding")
     1. Body wraps at 72 characters
     1. Body explains "what" and "why", not "how"
   
   ### Code Quality
   
   - My diff has been formatted using helix-style.xml 
   (helix-style-intellij.xml if IntelliJ IDE is used)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] xyuanlu merged pull request #2470: code clean up - debug log format

Posted by "xyuanlu (via GitHub)" <gi...@apache.org>.
xyuanlu merged PR #2470:
URL: https://github.com/apache/helix/pull/2470


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] desaikomal commented on a diff in pull request #2470: code clean up - debug log format

Posted by "desaikomal (via GitHub)" <gi...@apache.org>.
desaikomal commented on code in PR #2470:
URL: https://github.com/apache/helix/pull/2470#discussion_r1186220302


##########
helix-core/src/main/java/org/apache/helix/controller/rebalancer/AutoRebalancer.java:
##########
@@ -129,14 +129,12 @@ public IdealState computeNewIdealState(String resourceName,
     ZNRecord newMapping = _rebalanceStrategy
         .computePartitionAssignment(allNodes, liveNodes, currentMapping, clusterData);
 
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("currentMapping: " + currentMapping);
-      LOG.debug("stateCountMap: " + stateCountMap);
-      LOG.debug("liveNodes: " + liveNodes);
-      LOG.debug("allNodes: " + allNodes);
-      LOG.debug("maxPartition: " + maxPartition);
-      LOG.debug("newMapping: " + newMapping);
-    }
+      LOG.debug("currentMapping: {}", currentMapping);

Review Comment:
   nit: alignment may be off. please fix it if possible.



##########
helix-core/src/main/java/org/apache/helix/controller/rebalancer/DelayedAutoRebalancer.java:
##########
@@ -60,9 +60,7 @@ public IdealState computeNewIdealState(String resourceName,
 
     IdealState cachedIdealState = getCachedIdealState(resourceName, clusterData);
     if (cachedIdealState != null) {
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("Use cached IdealState for " + resourceName);
-      }
+        LOG.debug("Use cached IdealState for {}", resourceName);

Review Comment:
   nit: alignment.



##########
helix-core/src/main/java/org/apache/helix/manager/zk/ZkCacheEventThread.java:
##########
@@ -74,11 +72,9 @@ public void run() {
         } catch (ThreadDeath death) {
           throw death;
         } catch (Throwable e) {
-          LOG.error("Error handling event " + zkEvent, e);
-        }
-        if (LOG.isDebugEnabled()) {
-          LOG.debug("Delivering event #" + eventId + " done");
+          LOG.error("Error handling event {} ", zkEvent, e);
         }
+          LOG.debug("Delivering event # {} done", eventId);

Review Comment:
   nit: alignment



##########
helix-core/src/main/java/org/apache/helix/controller/rebalancer/DelayedAutoRebalancer.java:
##########
@@ -181,16 +179,14 @@ public IdealState computeNewIdealState(String resourceName,
 
     finalMapping.getListFields().putAll(userDefinedPreferenceList);
 
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("currentMapping: " + currentMapping);
-      LOG.debug("stateCountMap: " + stateCountMap);
-      LOG.debug("liveEnabledNodes: " + liveEnabledNodes);
-      LOG.debug("activeNodes: " + activeNodes);
-      LOG.debug("allNodes: " + allNodes);
-      LOG.debug("maxPartition: " + maxPartition);
-      LOG.debug("newIdealMapping: " + newIdealMapping);
-      LOG.debug("finalMapping: " + finalMapping);
-    }
+      LOG.debug("currentMapping: {}", currentMapping);

Review Comment:
   nit: alignment



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] xyuanlu commented on a diff in pull request #2470: code clean up - debug log format

Posted by "xyuanlu (via GitHub)" <gi...@apache.org>.
xyuanlu commented on code in PR #2470:
URL: https://github.com/apache/helix/pull/2470#discussion_r1191586647


##########
helix-core/src/main/java/org/apache/helix/spectator/RoutingDataCache.java:
##########
@@ -130,23 +130,21 @@ public synchronized void refresh(HelixDataAccessor accessor) {
         }
         _propertyDataChangedMap.put(HelixConstants.ChangeType.CUSTOMIZED_VIEW, false);
       }
-        break;
-      default:
-        break;
+      break;
+        default:
+          break;
       }
     }
     long endTime = System.currentTimeMillis();
     LOG.info("END: RoutingDataCache.refresh() for cluster " + _clusterName + ", took " + (endTime
         - startTime) + " ms");
 
-    if (LOG.isDebugEnabled()) {

Review Comment:
   TFTR. Good call. Updated.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] rahulrane50 commented on a diff in pull request #2470: code clean up - debug log format

Posted by "rahulrane50 (via GitHub)" <gi...@apache.org>.
rahulrane50 commented on code in PR #2470:
URL: https://github.com/apache/helix/pull/2470#discussion_r1189123288


##########
helix-core/src/main/java/org/apache/helix/spectator/RoutingDataCache.java:
##########
@@ -130,23 +130,21 @@ public synchronized void refresh(HelixDataAccessor accessor) {
         }
         _propertyDataChangedMap.put(HelixConstants.ChangeType.CUSTOMIZED_VIEW, false);
       }
-        break;
-      default:
-        break;
+      break;
+        default:
+          break;
       }
     }
     long endTime = System.currentTimeMillis();
     LOG.info("END: RoutingDataCache.refresh() for cluster " + _clusterName + ", took " + (endTime
         - startTime) + " ms");
 
-    if (LOG.isDebugEnabled()) {

Review Comment:
   May be we want to keep this because if debug mode is not enabled then we won't even iterate on _sourceDataTypeMap below.



##########
helix-core/src/main/java/org/apache/helix/spectator/RoutingDataCache.java:
##########
@@ -130,23 +130,21 @@ public synchronized void refresh(HelixDataAccessor accessor) {
         }
         _propertyDataChangedMap.put(HelixConstants.ChangeType.CUSTOMIZED_VIEW, false);
       }
-        break;
-      default:
-        break;
+      break;
+        default:

Review Comment:
   nit : can remove this?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] desaikomal commented on a diff in pull request #2470: code clean up - debug log format

Posted by "desaikomal (via GitHub)" <gi...@apache.org>.
desaikomal commented on code in PR #2470:
URL: https://github.com/apache/helix/pull/2470#discussion_r1181979972


##########
helix-agent/src/main/java/org/apache/helix/agent/AgentStateModel.java:
##########
@@ -148,8 +148,8 @@ public void genericStateTransitionHandler(Message message, NotificationContext c
     // + " output:\n" + externalCmd.getStringOutput());
 
     if (_logger.isDebugEnabled()) {

Review Comment:
   you need to remove this line.



##########
helix-core/src/main/java/org/apache/helix/controller/rebalancer/AutoRebalancer.java:
##########
@@ -130,12 +130,12 @@ public IdealState computeNewIdealState(String resourceName,
         .computePartitionAssignment(allNodes, liveNodes, currentMapping, clusterData);
 
     if (LOG.isDebugEnabled()) {

Review Comment:
   this is not required



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] xyuanlu commented on a diff in pull request #2470: code clean up - debug log format

Posted by "xyuanlu (via GitHub)" <gi...@apache.org>.
xyuanlu commented on code in PR #2470:
URL: https://github.com/apache/helix/pull/2470#discussion_r1191804983


##########
helix-core/src/main/java/org/apache/helix/spectator/RoutingDataCache.java:
##########
@@ -130,23 +130,21 @@ public synchronized void refresh(HelixDataAccessor accessor) {
         }
         _propertyDataChangedMap.put(HelixConstants.ChangeType.CUSTOMIZED_VIEW, false);
       }
-        break;
-      default:
-        break;
+      break;
+        default:

Review Comment:
   Thanks for the suggestion. This is an accidental change and i changed it back. Let's keep this PR only for log formatting. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] xyuanlu commented on pull request #2470: code clean up - debug log format

Posted by "xyuanlu (via GitHub)" <gi...@apache.org>.
xyuanlu commented on PR #2470:
URL: https://github.com/apache/helix/pull/2470#issuecomment-1546062568

   This PR is ready to be merged. Approved by @qqu0127 and @desaikomal 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] xyuanlu commented on a diff in pull request #2470: code clean up - debug log format

Posted by "xyuanlu (via GitHub)" <gi...@apache.org>.
xyuanlu commented on code in PR #2470:
URL: https://github.com/apache/helix/pull/2470#discussion_r1188995874


##########
helix-core/src/main/java/org/apache/helix/controller/rebalancer/AutoRebalancer.java:
##########
@@ -129,14 +129,12 @@ public IdealState computeNewIdealState(String resourceName,
     ZNRecord newMapping = _rebalanceStrategy
         .computePartitionAssignment(allNodes, liveNodes, currentMapping, clusterData);
 
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("currentMapping: " + currentMapping);
-      LOG.debug("stateCountMap: " + stateCountMap);
-      LOG.debug("liveNodes: " + liveNodes);
-      LOG.debug("allNodes: " + allNodes);
-      LOG.debug("maxPartition: " + maxPartition);
-      LOG.debug("newMapping: " + newMapping);
-    }
+      LOG.debug("currentMapping: {}", currentMapping);

Review Comment:
   TFTR. Updated



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org