[ 
https://issues.apache.org/jira/browse/HDFS-16648?focusedWorklogId=788369&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-788369
 ]

ASF GitHub Bot logged work on HDFS-16648:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 06/Jul/22 19:01
            Start Date: 06/Jul/22 19:01
    Worklog Time Spent: 10m 
      Work Description: goiri commented on code in PR #4529:
URL: https://github.com/apache/hadoop/pull/4529#discussion_r915161873


##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java:
##########
@@ -4203,8 +4211,10 @@ public void removeStoredBlock(BlockInfo storedBlock, 
DatanodeDescriptor node) {
     assert (namesystem.hasWriteLock());
     {
       if (storedBlock == null || !blocksMap.removeNode(storedBlock, node)) {
-        blockLog.debug("BLOCK* removeStoredBlock: {} has already been" +
-            " removed from node {}", storedBlock, node);
+        if (blockLog.isDebugEnabled()) {
+          blockLog.debug("BLOCK* removeStoredBlock: {} has already been" +

Review Comment:
   With the new checkstyle, the string fits in one line without splitting:
   ```
   blockLog.debug("BLOCK* removeStoredBlock: {} has already been removed from 
node {}",
       storedBlock, node);
   ```



##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockPlacementPolicyDefault.java:
##########
@@ -238,8 +238,10 @@ DatanodeStorageInfo[] chooseTarget(String src,
       return getPipeline(writer,
           results.toArray(new DatanodeStorageInfo[results.size()]));
     } catch (NotEnoughReplicasException nr) {
-      LOG.debug("Failed to choose with favored nodes (={}), disregard favored"
-          + " nodes hint and retry.", favoredNodes, nr);
+      if (LOG.isDebugEnabled()) {

Review Comment:
   The string fits in one line if you do:
   ```
   LOG.debug(
       "Failed to choose with favored nodes (={}), disregard favored nodes hint 
and retry.",
       favoredNodes, nr);
   ```



##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockPlacementPolicyDefault.java:
##########
@@ -745,9 +749,12 @@ private DatanodeStorageInfo chooseFromNextRack(Node next,
       return chooseRandom(nextRack, excludedNodes, blocksize, maxNodesPerRack,
           results, avoidStaleNodes, storageTypes);
     } catch (NotEnoughReplicasException e) {
-      LOG.debug("Failed to choose from the next rack (location = {}), "
-          + "retry choosing randomly", nextRack, e);
-        // otherwise randomly choose one from the network
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("Failed to choose from the next rack (location = {}), "

Review Comment:
   The string fits in one line.



##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/CacheManager.java:
##########
@@ -1003,9 +1005,11 @@ public final void processCacheReport(final DatanodeID 
datanodeID,
     if (metrics != null) {
       metrics.addCacheBlockReport((int) (endTime - startTime));
     }
-    LOG.debug("Processed cache report from {}, blocks: {}, " +
-        "processing time: {} msecs", datanodeID, blockIds.size(), 
-        (endTime - startTime));
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("Processed cache report from {}, blocks: {}, " +

Review Comment:
   The string fits in one line.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 788369)
    Time Spent: 1h  (was: 50m)

> Normalize the usage of debug logs in NameNode
> ---------------------------------------------
>
>                 Key: HDFS-16648
>                 URL: https://issues.apache.org/jira/browse/HDFS-16648
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>            Reporter: ZanderXu
>            Assignee: ZanderXu
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> There are many irregular debug logs in NameNode.  such as:
> Error type1: 
> {code:java}
> if (LOG.isDebugEnabled()) {
>       LOG.debug("Getting groups for user " + user);
> }
> {code}
> we can format it to:
> {code:java}
> LOG.debug("Getting groups for user {}. ", user);
> {code}
> Error type2:
> {code:java}
> LOG.debug("*DIR* NameNode.renameSnapshot: Snapshot Path {}, " +
>         "snapshotOldName {}, snapshotNewName {}", snapshotRoot,
>         snapshotOldName, snapshotNewName);
> {code}
> we can format it to:
> {code:java}
> if (LOG.isDebugEnabled()) {
>   LOG.debug("*DIR* NameNode.renameSnapshot: Snapshot Path {}, " +
>         "snapshotOldName {}, snapshotNewName {}", snapshotRoot,
>         snapshotOldName, snapshotNewName); 
> }
> {code}
> Error type3:
> {code:java}
> if (LOG.isDebugEnabled()) {
>       LOG.debug("getAdditionalDatanode: src=" + src
>           + ", fileId=" + fileId
>           + ", blk=" + blk
>           + ", existings=" + Arrays.asList(existings)
>           + ", excludes=" + Arrays.asList(excludes)
>           + ", numAdditionalNodes=" + numAdditionalNodes
>           + ", clientName=" + clientName);
>     }
> {code}
> We can format it to:
> {code:java}
>  if (LOG.isDebugEnabled()) {
>    LOG.debug("getAdditionalDatanode: src={}, fileId={}, "
>            + "blk={}, existings={}, excludes={}, numAdditionalNodes={}, "
>           + "clientName={}.", src, fileId, blk, Arrays.asList(existings),
>           Arrays.asList(excludes), numAdditionalNodes, clientName);
>  }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to