HDFS-12683. DFSZKFailOverController re-order logic for logging Exception. Contributed by Bharat Viswanadham.
This commit is contained in:
parent
921338cd86
commit
4b00c9a47f
@ -184,40 +184,45 @@ public Integer run() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (RuntimeException rte) {
|
} catch (RuntimeException rte) {
|
||||||
LOG.error("The failover controller encounters runtime error: " + rte);
|
|
||||||
throw (Exception)rte.getCause();
|
throw (Exception)rte.getCause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private int doRun(String[] args)
|
private int doRun(String[] args)
|
||||||
throws HadoopIllegalArgumentException, IOException, InterruptedException {
|
throws Exception {
|
||||||
try {
|
try {
|
||||||
initZK();
|
initZK();
|
||||||
} catch (KeeperException ke) {
|
} catch (KeeperException ke) {
|
||||||
LOG.error("Unable to start failover controller. Unable to connect "
|
LOG.error("Unable to start failover controller. Unable to connect "
|
||||||
+ "to ZooKeeper quorum at " + zkQuorum + ". Please check the "
|
+ "to ZooKeeper quorum at " + zkQuorum + ". Please check the "
|
||||||
+ "configured value for " + ZK_QUORUM_KEY + " and ensure that "
|
+ "configured value for " + ZK_QUORUM_KEY + " and ensure that "
|
||||||
+ "ZooKeeper is running.");
|
+ "ZooKeeper is running.", ke);
|
||||||
return ERR_CODE_NO_ZK;
|
return ERR_CODE_NO_ZK;
|
||||||
}
|
}
|
||||||
if (args.length > 0) {
|
try {
|
||||||
if ("-formatZK".equals(args[0])) {
|
if (args.length > 0) {
|
||||||
boolean force = false;
|
if ("-formatZK".equals(args[0])) {
|
||||||
boolean interactive = true;
|
boolean force = false;
|
||||||
for (int i = 1; i < args.length; i++) {
|
boolean interactive = true;
|
||||||
if ("-force".equals(args[i])) {
|
for (int i = 1; i < args.length; i++) {
|
||||||
force = true;
|
if ("-force".equals(args[i])) {
|
||||||
} else if ("-nonInteractive".equals(args[i])) {
|
force = true;
|
||||||
interactive = false;
|
} else if ("-nonInteractive".equals(args[i])) {
|
||||||
} else {
|
interactive = false;
|
||||||
badArg(args[i]);
|
} else {
|
||||||
|
badArg(args[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return formatZK(force, interactive);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
badArg(args[0]);
|
||||||
}
|
}
|
||||||
return formatZK(force, interactive);
|
|
||||||
} else {
|
|
||||||
badArg(args[0]);
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception e){
|
||||||
|
LOG.error("The failover controller encounters runtime error", e);
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!elector.parentZNodeExists()) {
|
if (!elector.parentZNodeExists()) {
|
||||||
@ -236,11 +241,14 @@ private int doRun(String[] args)
|
|||||||
return ERR_CODE_NO_FENCER;
|
return ERR_CODE_NO_FENCER;
|
||||||
}
|
}
|
||||||
|
|
||||||
initRPC();
|
|
||||||
initHM();
|
|
||||||
startRPC();
|
|
||||||
try {
|
try {
|
||||||
|
initRPC();
|
||||||
|
initHM();
|
||||||
|
startRPC();
|
||||||
mainLoop();
|
mainLoop();
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.error("The failover controller encounters runtime error: ", e);
|
||||||
|
throw e;
|
||||||
} finally {
|
} finally {
|
||||||
rpcServer.stopAndJoin();
|
rpcServer.stopAndJoin();
|
||||||
|
|
||||||
|
@ -194,7 +194,8 @@ public static void main(String args[])
|
|||||||
try {
|
try {
|
||||||
retCode = zkfc.run(parser.getRemainingArgs());
|
retCode = zkfc.run(parser.getRemainingArgs());
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
LOG.fatal("Got a fatal error, exiting now", t);
|
LOG.fatal("DFSZKFailOverController exiting due to earlier exception "
|
||||||
|
+ t);
|
||||||
}
|
}
|
||||||
System.exit(retCode);
|
System.exit(retCode);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user