hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [02/50] hadoop git commit: HDFS-10264. Logging improvements in FSImageFormatProtobuf.Saver. (Contributed by Xiaobing Zhou)
Date Tue, 03 May 2016 22:05:49 GMT
HDFS-10264. Logging improvements in FSImageFormatProtobuf.Saver. (Contributed by Xiaobing Zhou)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/a13628fe
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/a13628fe
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/a13628fe

Branch: refs/heads/branch-2.8
Commit: a13628fe4a7ee0bc1d803cfc983cf30a6f6cb665
Parents: 1860b8c
Author: Arpit Agarwal <arp@apache.org>
Authored: Tue Apr 19 11:26:30 2016 -0700
Committer: Arpit Agarwal <arp@apache.org>
Committed: Tue Apr 19 11:27:46 2016 -0700

----------------------------------------------------------------------
 .../server/namenode/FSImageFormatProtobuf.java     | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/a13628fe/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageFormatProtobuf.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageFormatProtobuf.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageFormatProtobuf.java
index 7c8a857..5552e29 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageFormatProtobuf.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageFormatProtobuf.java
@@ -18,6 +18,8 @@
 
 package org.apache.hadoop.hdfs.server.namenode;
 
+import static org.apache.hadoop.util.Time.monotonicNow;
+
 import java.io.BufferedInputStream;
 import java.io.BufferedOutputStream;
 import java.io.File;
@@ -38,8 +40,8 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.CacheDirectiveInfoProto;
@@ -74,7 +76,8 @@ import com.google.protobuf.CodedOutputStream;
  */
 @InterfaceAudience.Private
 public final class FSImageFormatProtobuf {
-  private static final Log LOG = LogFactory.getLog(FSImageFormatProtobuf.class);
+  private static final Logger LOG = LoggerFactory
+      .getLogger(FSImageFormatProtobuf.class);
 
   public static final class LoaderContext {
     private String[] stringTable;
@@ -179,7 +182,7 @@ public final class FSImageFormatProtobuf {
       try {
         loadInternal(raFile, fin);
         long end = Time.monotonicNow();
-        LOG.info("Loaded FSImage in " + (end - start) / 1000 + " seconds.");
+        LOG.info("Loaded FSImage in {} seconds.", (end - start) / 1000);
       } finally {
         fin.close();
         raFile.close();
@@ -285,7 +288,7 @@ public final class FSImageFormatProtobuf {
         }
           break;
         default:
-          LOG.warn("Unrecognized section " + n);
+          LOG.warn("Unrecognized section {}", n);
           break;
         }
       }
@@ -419,7 +422,11 @@ public final class FSImageFormatProtobuf {
       FileOutputStream fout = new FileOutputStream(file);
       fileChannel = fout.getChannel();
       try {
+        LOG.info("Saving image file {} using {}", file, compression);
+        long startTime = monotonicNow();
         saveInternal(fout, compression, file.getAbsolutePath());
+        LOG.info("Image file {} of size {} bytes saved in {} seconds.", file,
+            file.length(), (monotonicNow() - startTime) / 1000);
       } finally {
         fout.close();
       }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message