HDFS-11238. Fix checkstyle warnings in NameNode#createNameNode. Contributed by Ethan Li.
This commit is contained in:
parent
1e11080b78
commit
8acb376c9c
@ -1579,64 +1579,55 @@ public static NameNode createNameNode(String argv[], Configuration conf)
|
|||||||
}
|
}
|
||||||
setStartupOption(conf, startOpt);
|
setStartupOption(conf, startOpt);
|
||||||
|
|
||||||
|
boolean aborted = false;
|
||||||
switch (startOpt) {
|
switch (startOpt) {
|
||||||
case FORMAT: {
|
case FORMAT:
|
||||||
boolean aborted = format(conf, startOpt.getForceFormat(),
|
aborted = format(conf, startOpt.getForceFormat(),
|
||||||
startOpt.getInteractiveFormat());
|
startOpt.getInteractiveFormat());
|
||||||
terminate(aborted ? 1 : 0);
|
terminate(aborted ? 1 : 0);
|
||||||
return null; // avoid javac warning
|
return null; // avoid javac warning
|
||||||
}
|
case GENCLUSTERID:
|
||||||
case GENCLUSTERID: {
|
|
||||||
System.err.println("Generating new cluster id:");
|
System.err.println("Generating new cluster id:");
|
||||||
System.out.println(NNStorage.newClusterID());
|
System.out.println(NNStorage.newClusterID());
|
||||||
terminate(0);
|
terminate(0);
|
||||||
return null;
|
return null;
|
||||||
}
|
case ROLLBACK:
|
||||||
case ROLLBACK: {
|
aborted = doRollback(conf, true);
|
||||||
boolean aborted = doRollback(conf, true);
|
|
||||||
terminate(aborted ? 1 : 0);
|
terminate(aborted ? 1 : 0);
|
||||||
return null; // avoid warning
|
return null; // avoid warning
|
||||||
}
|
case BOOTSTRAPSTANDBY:
|
||||||
case BOOTSTRAPSTANDBY: {
|
String[] toolArgs = Arrays.copyOfRange(argv, 1, argv.length);
|
||||||
String toolArgs[] = Arrays.copyOfRange(argv, 1, argv.length);
|
|
||||||
int rc = BootstrapStandby.run(toolArgs, conf);
|
int rc = BootstrapStandby.run(toolArgs, conf);
|
||||||
terminate(rc);
|
terminate(rc);
|
||||||
return null; // avoid warning
|
return null; // avoid warning
|
||||||
}
|
case INITIALIZESHAREDEDITS:
|
||||||
case INITIALIZESHAREDEDITS: {
|
aborted = initializeSharedEdits(conf,
|
||||||
boolean aborted = initializeSharedEdits(conf,
|
|
||||||
startOpt.getForceFormat(),
|
startOpt.getForceFormat(),
|
||||||
startOpt.getInteractiveFormat());
|
startOpt.getInteractiveFormat());
|
||||||
terminate(aborted ? 1 : 0);
|
terminate(aborted ? 1 : 0);
|
||||||
return null; // avoid warning
|
return null; // avoid warning
|
||||||
}
|
|
||||||
case BACKUP:
|
case BACKUP:
|
||||||
case CHECKPOINT: {
|
case CHECKPOINT:
|
||||||
NamenodeRole role = startOpt.toNodeRole();
|
NamenodeRole role = startOpt.toNodeRole();
|
||||||
DefaultMetricsSystem.initialize(role.toString().replace(" ", ""));
|
DefaultMetricsSystem.initialize(role.toString().replace(" ", ""));
|
||||||
return new BackupNode(conf, role);
|
return new BackupNode(conf, role);
|
||||||
}
|
case RECOVER:
|
||||||
case RECOVER: {
|
|
||||||
NameNode.doRecovery(startOpt, conf);
|
NameNode.doRecovery(startOpt, conf);
|
||||||
return null;
|
return null;
|
||||||
}
|
case METADATAVERSION:
|
||||||
case METADATAVERSION: {
|
|
||||||
printMetadataVersion(conf);
|
printMetadataVersion(conf);
|
||||||
terminate(0);
|
terminate(0);
|
||||||
return null; // avoid javac warning
|
return null; // avoid javac warning
|
||||||
}
|
case UPGRADEONLY:
|
||||||
case UPGRADEONLY: {
|
|
||||||
DefaultMetricsSystem.initialize("NameNode");
|
DefaultMetricsSystem.initialize("NameNode");
|
||||||
new NameNode(conf);
|
new NameNode(conf);
|
||||||
terminate(0);
|
terminate(0);
|
||||||
return null;
|
return null;
|
||||||
}
|
default:
|
||||||
default: {
|
|
||||||
DefaultMetricsSystem.initialize("NameNode");
|
DefaultMetricsSystem.initialize("NameNode");
|
||||||
return new NameNode(conf);
|
return new NameNode(conf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In federation configuration is set for a set of
|
* In federation configuration is set for a set of
|
||||||
|
Loading…
Reference in New Issue
Block a user