From 72b760130aee907de12db09d1123880b9935523f Mon Sep 17 00:00:00 2001 From: zhtttylz Date: Thu, 19 Jan 2023 07:56:41 +0800 Subject: [PATCH] HDFS-16893. Standardize the usage of DFSClient debug log (#5303) Co-authored-by: Zhtttylz Reviewed-by: Ayush Saxena Signed-off-by: Shilun Fan --- .../apache/hadoop/hdfs/DFSStripedOutputStream.java | 4 +--- .../java/org/apache/hadoop/hdfs/HAUtilClient.java | 12 ++++-------- .../hadoop/hdfs/util/TestByteArrayManager.java | 2 +- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSStripedOutputStream.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSStripedOutputStream.java index 1233c033ee..931c2bba36 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSStripedOutputStream.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSStripedOutputStream.java @@ -293,9 +293,7 @@ private void flipDataBuffers() { DataChecksum checksum, String[] favoredNodes) throws IOException { super(dfsClient, src, stat, flag, progress, checksum, favoredNodes, false); - if (LOG.isDebugEnabled()) { - LOG.debug("Creating DFSStripedOutputStream for " + src); - } + LOG.debug("Creating DFSStripedOutputStream for {}", src); ecPolicy = stat.getErasureCodingPolicy(); final int numParityBlocks = ecPolicy.getNumParityUnits(); diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/HAUtilClient.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/HAUtilClient.java index 47288f77df..bfbee41d14 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/HAUtilClient.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/HAUtilClient.java @@ -135,16 +135,12 @@ public static void cloneDelegationTokenForLogicalUri( HdfsConstants.HDFS_URI_SCHEME) + "//" + specificToken.getService()); ugi.addToken(alias, specificToken); - if (LOG.isDebugEnabled()) { - LOG.debug("Mapped HA service delegation token for logical URI " + - haUri + " to namenode " + singleNNAddr); - } + LOG.debug("Mapped HA service delegation token for logical URI {}" + + " to namenode {}", haUri, singleNNAddr); } } else { - if (LOG.isDebugEnabled()) { - LOG.debug("No HA service delegation token found for logical URI " + - haUri); - } + LOG.debug("No HA service delegation token found for logical URI {}", + haUri); } } } diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/util/TestByteArrayManager.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/util/TestByteArrayManager.java index a47ffa7713..b624f18bd1 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/util/TestByteArrayManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/util/TestByteArrayManager.java @@ -342,7 +342,7 @@ public void run() { } if ((i & 0xFF) == 0) { - LOG.info("randomRecycler sleep, i=" + i); + LOG.info("randomRecycler sleep, i={}", i); sleepMs(100); } }