HDFS-9519. Some coding improvement in SecondaryNameNode#main. (Xiao Chen via Yongjun Zhang)

This commit is contained in:
Yongjun Zhang 2015-12-11 18:44:01 -08:00
parent f5a911452f
commit 2a4c7d4fac
2 changed files with 9 additions and 8 deletions

View File

@ -1742,6 +1742,9 @@ Release 2.8.0 - UNRELEASED
HDFS-9532. Detailed exception info is lost in reportTo methods of HDFS-9532. Detailed exception info is lost in reportTo methods of
ErrorReportAction and ReportBadBlockAction. (Yongjun Zhang) ErrorReportAction and ReportBadBlockAction. (Yongjun Zhang)
HDFS-9519. Some coding improvement in SecondaryNameNode#main.
(Xiao Chen via Yongjun Zhang)
OPTIMIZATIONS OPTIMIZATIONS
HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than

View File

@ -679,18 +679,16 @@ public class SecondaryNameNode implements Runnable,
SecondaryNameNode secondary = null; SecondaryNameNode secondary = null;
secondary = new SecondaryNameNode(tconf, opts); secondary = new SecondaryNameNode(tconf, opts);
// SecondaryNameNode can be started in 2 modes:
// 1. run a command (i.e. checkpoint or geteditsize) then terminate
// 2. run as a daemon when {@link #parseArgs} yields no commands
if (opts != null && opts.getCommand() != null) { if (opts != null && opts.getCommand() != null) {
// mode 1
int ret = secondary.processStartupCommand(opts); int ret = secondary.processStartupCommand(opts);
terminate(ret); terminate(ret);
} } else {
// mode 2
if (secondary != null) {
// The web server is only needed when starting SNN as a daemon,
// and not needed if called from shell command. Starting the web server
// from shell may fail when getting credentials, if the environment
// is not set up for it, which is most of the case.
secondary.startInfoServer(); secondary.startInfoServer();
secondary.startCheckpointThread(); secondary.startCheckpointThread();
secondary.join(); secondary.join();
} }