Browse Source

HDFS-15835. Erasure coding: Add/remove logs for the better readability/debugging. Contributed by Bhavik Patel.

(cherry picked from commit 25af8901a978e1b5220a961813d0e0c834010553)
Takanobu Asanuma 4 years ago
parent
commit
1125e3f0c0

+ 3 - 2
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ErasureCodingPolicyManager.java

@@ -343,6 +343,7 @@ public final class ErasureCodingPolicyManager {
         policiesByName.values().toArray(new ErasureCodingPolicyInfo[0]);
         policiesByName.values().toArray(new ErasureCodingPolicyInfo[0]);
     allPersistedPolicies.put(policy.getId(),
     allPersistedPolicies.put(policy.getId(),
         new ErasureCodingPolicyInfo(policy));
         new ErasureCodingPolicyInfo(policy));
+    LOG.info("Added erasure coding policy " + policy);
     return policy;
     return policy;
   }
   }
 
 
@@ -414,7 +415,7 @@ public final class ErasureCodingPolicyManager {
       enabledPolicies =
       enabledPolicies =
           enabledPoliciesByName.values().toArray(new ErasureCodingPolicy[0]);
           enabledPoliciesByName.values().toArray(new ErasureCodingPolicy[0]);
       info.setState(ErasureCodingPolicyState.DISABLED);
       info.setState(ErasureCodingPolicyState.DISABLED);
-      LOG.info("Disable the erasure coding policy " + name);
+      LOG.info("Disabled the erasure coding policy " + name);
       allPersistedPolicies.put(info.getPolicy().getId(),
       allPersistedPolicies.put(info.getPolicy().getId(),
           createPolicyInfo(info.getPolicy(),
           createPolicyInfo(info.getPolicy(),
               ErasureCodingPolicyState.DISABLED));
               ErasureCodingPolicyState.DISABLED));
@@ -448,7 +449,7 @@ public final class ErasureCodingPolicyManager {
         enabledPoliciesByName.values().toArray(new ErasureCodingPolicy[0]);
         enabledPoliciesByName.values().toArray(new ErasureCodingPolicy[0]);
     allPersistedPolicies.put(ecPolicy.getId(),
     allPersistedPolicies.put(ecPolicy.getId(),
         createPolicyInfo(info.getPolicy(), ErasureCodingPolicyState.ENABLED));
         createPolicyInfo(info.getPolicy(), ErasureCodingPolicyState.ENABLED));
-    LOG.info("Enable the erasure coding policy " + name);
+    LOG.info("Enabled the erasure coding policy " + name);
     return true;
     return true;
   }
   }
 
 

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

@@ -8077,7 +8077,6 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
     checkOperation(OperationCategory.WRITE);
     checkOperation(OperationCategory.WRITE);
     checkErasureCodingSupported(operationName);
     checkErasureCodingSupported(operationName);
     boolean success = false;
     boolean success = false;
-    LOG.info("Disable the erasure coding policy " + ecPolicyName);
     try {
     try {
       writeLock();
       writeLock();
       try {
       try {

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

@@ -2262,10 +2262,10 @@ public class NameNodeRpcServer implements NamenodeProtocols {
     try {
     try {
       if (ecPolicyName == null) {
       if (ecPolicyName == null) {
         ecPolicyName = defaultECPolicyName;
         ecPolicyName = defaultECPolicyName;
-        LOG.trace("No policy name is specified, " +
+        LOG.debug("No policy name is specified, " +
             "set the default policy name instead");
             "set the default policy name instead");
       }
       }
-      LOG.trace("Set erasure coding policy " + ecPolicyName + " on " + src);
+      LOG.debug("Set erasure coding policy {} on {}", ecPolicyName, src);
       namesystem.setErasureCodingPolicy(src, ecPolicyName, cacheEntry != null);
       namesystem.setErasureCodingPolicy(src, ecPolicyName, cacheEntry != null);
       success = true;
       success = true;
     } finally {
     } finally {
@@ -2516,6 +2516,7 @@ public class NameNodeRpcServer implements NamenodeProtocols {
     }
     }
     boolean success = false;
     boolean success = false;
     try {
     try {
+      LOG.debug("Unset erasure coding policy on {}", src);
       namesystem.unsetErasureCodingPolicy(src, cacheEntry != null);
       namesystem.unsetErasureCodingPolicy(src, cacheEntry != null);
       success = true;
       success = true;
     } finally {
     } finally {