Browse Source

HDFS-15229. Truncate info should be logged at INFO level. Contributed by Ravuri Sushma sree.

hemanthboyina 4 years ago
parent
commit
528a799a78

+ 1 - 1
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java

@@ -2270,7 +2270,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
     requireEffectiveLayoutVersionForFeature(Feature.TRUNCATE);
     requireEffectiveLayoutVersionForFeature(Feature.TRUNCATE);
     FSDirTruncateOp.TruncateResult r = null;
     FSDirTruncateOp.TruncateResult r = null;
     try {
     try {
-      NameNode.stateChangeLog.debug(
+      NameNode.stateChangeLog.info(
           "DIR* NameSystem.truncate: src={} newLength={}", src, newLength);
           "DIR* NameSystem.truncate: src={} newLength={}", src, newLength);
       if (newLength < 0) {
       if (newLength < 0) {
         throw new HadoopIllegalArgumentException(
         throw new HadoopIllegalArgumentException(

+ 2 - 4
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java

@@ -1100,10 +1100,8 @@ public class NameNodeRpcServer implements NamenodeProtocols {
   public boolean truncate(String src, long newLength, String clientName)
   public boolean truncate(String src, long newLength, String clientName)
       throws IOException {
       throws IOException {
     checkNNStartup();
     checkNNStartup();
-    if(stateChangeLog.isDebugEnabled()) {
-      stateChangeLog.debug("*DIR* NameNode.truncate: " + src + " to " +
-          newLength);
-    }
+    stateChangeLog
+        .debug("*DIR* NameNode.truncate: " + src + " to " + newLength);
     String clientMachine = getClientMachine();
     String clientMachine = getClientMachine();
     try {
     try {
       return namesystem.truncate(
       return namesystem.truncate(