HDFS-8932. NPE thrown in NameNode when try to get TotalSyncCount metric before editLogStream initialization. Contributed by Surendra Singh Lilhore
(cherry picked from commit 3b00eaea25
)
This commit is contained in:
parent
ef8437a382
commit
137bde0755
|
@ -867,6 +867,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
|
||||
|
|
|
@ -1648,10 +1648,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7291,7 +7291,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 "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue