hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aengin...@apache.org
Subject [46/50] [abbrv] hadoop git commit: HDFS-8932. NPE thrown in NameNode when try to get TotalSyncCount metric before editLogStream initialization. Contributed by Surendra Singh Lilhore
Date Tue, 25 Aug 2015 22:22:40 GMT
HDFS-8932. NPE thrown in NameNode when try to get TotalSyncCount metric before editLogStream
initialization. Contributed by Surendra Singh Lilhore


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

Branch: refs/heads/HDFS-7240
Commit: 3b00eaea256d252be3361a7d9106b88756fcb9ba
Parents: 66d0c81
Author: Xiaoyu Yao <xyao@apache.org>
Authored: Mon Aug 24 16:56:24 2015 -0700
Committer: Xiaoyu Yao <xyao@apache.org>
Committed: Mon Aug 24 16:56:24 2015 -0700

----------------------------------------------------------------------
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt             |  3 +++
 .../apache/hadoop/hdfs/server/namenode/FSEditLog.java   | 12 ++++++++----
 .../hadoop/hdfs/server/namenode/FSNamesystem.java       |  7 ++++++-
 3 files changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/3b00eaea/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index 1844357..7aadcc6 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -1211,6 +1211,9 @@ Release 2.8.0 - UNRELEASED
     HDFS-8948. Use GenericTestUtils to set log levels in TestPread and
     TestReplaceDatanodeOnFailure. (Mingliang Liu via wheat9)
 
+    HDFS-8932. NPE thrown in NameNode when try to get TotalSyncCount metric
+    before editLogStream initialization. (Surendra Singh Lilhore via xyao)
+
 Release 2.7.2 - UNRELEASED
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/3b00eaea/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java
index b1960d9..faaea63 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java
@@ -1692,10 +1692,14 @@ public class FSEditLog implements LogsPurgeable {
   }
 
   /**
-   +   * Return total number of syncs happened on this edit log.
-   +   * @return long - count
-   +   */
+   * Return total number of syncs happened on this edit log.
+   * @return long - count
+   */
   public long getTotalSyncCount() {
-    return editLogStream.getNumSync();
+    if (editLogStream != null) {
+      return editLogStream.getNumSync();
+    } else {
+      return 0;
+    }
   }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/3b00eaea/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
index 6baa70f..3c3ef0b 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
@@ -7295,7 +7295,12 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
   @Metric({"TotalSyncTimes",
               "Total time spend in sync operation on various edit logs"})
   public String getTotalSyncTimes() {
-    return fsImage.editLog.getJournalSet().getSyncTimes();
+    JournalSet journalSet = fsImage.editLog.getJournalSet();
+    if (journalSet != null) {
+      return journalSet.getSyncTimes();
+    } else {
+      return "";
+    }
   }
 }
 


Mime
View raw message