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

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

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


##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java:
##########
@@ -478,10 +478,7 @@ public void recoverUnfinalizedSegments() throws 
IOException {
     Map<AsyncLogger, NewEpochResponseProto> resps = createNewUniqueEpoch();
     LOG.info("Successfully started new epoch " + loggers.getEpoch());
 
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("newEpoch(" + loggers.getEpoch() + ") responses:\n" +
-        QuorumCall.mapToString(resps));
-    }
+    LOG.debug("newEpoch({}) responses:\n{}", loggers.getEpoch(), 
QuorumCall.mapToString(resps));

Review Comment:
   This particular one should stay within the isDebugEnabled() to avoid the 
mapToString



##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java:
##########
@@ -618,10 +612,8 @@ private void selectStreamingInputStreams(
     Map<AsyncLogger, RemoteEditLogManifest> resps =
         loggers.waitForWriteQuorum(q, selectInputStreamsTimeoutMs,
             "selectStreamingInputStreams");
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("selectStreamingInputStream manifests:\n {}",
-          Joiner.on("\n").withKeyValueSeparator(": ").join(resps));
-    }
+    LOG.debug("selectStreamingInputStream manifests:\n {}",

Review Comment:
   This probably should stay.



##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java:
##########
@@ -2908,11 +2896,9 @@ public boolean processReport(final DatanodeID nodeID,
 
     if (blockLog.isDebugEnabled()) {
       for (Block b : invalidatedBlocks) {
-        if (blockLog.isDebugEnabled()) {
-          blockLog.debug("BLOCK* processReport 0x{} with lease ID 0x{}: {} on 
node {} size {} " +
-                          "does not belong to any file.", strBlockReportId, 
fullBrLeaseId, b,
-                           node, b.getNumBytes());
-        }
+        blockLog.debug("BLOCK* processReport 0x{} with lease ID 0x{}: {} on 
node {} size {} " +

Review Comment:
   Don't we want to keep the check?





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

    Worklog Id:     (was: 788834)
    Time Spent: 1h 20m  (was: 1h 10m)

> 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 20m
>  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