HBASE-8800 Return non-zero exit codes when a region server aborts
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1496559 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6f54a1d4b3
commit
9a151d2e73
|
@ -84,7 +84,7 @@ public class HMasterCommandLine extends ServerCommandLine {
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
LOG.error("Could not parse: ", e);
|
LOG.error("Could not parse: ", e);
|
||||||
usage(null);
|
usage(null);
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ public class HMasterCommandLine extends ServerCommandLine {
|
||||||
List<String> remainingArgs = cmd.getArgList();
|
List<String> remainingArgs = cmd.getArgList();
|
||||||
if (remainingArgs.size() != 1) {
|
if (remainingArgs.size() != 1) {
|
||||||
usage(null);
|
usage(null);
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
String command = remainingArgs.get(0);
|
String command = remainingArgs.get(0);
|
||||||
|
@ -135,10 +135,10 @@ public class HMasterCommandLine extends ServerCommandLine {
|
||||||
} else if ("stop".equals(command)) {
|
} else if ("stop".equals(command)) {
|
||||||
return stopMaster();
|
return stopMaster();
|
||||||
} else if ("clear".equals(command)) {
|
} else if ("clear".equals(command)) {
|
||||||
return (ZNodeClearer.clear(getConf()) ? 0 : -1);
|
return (ZNodeClearer.clear(getConf()) ? 0 : 1);
|
||||||
} else {
|
} else {
|
||||||
usage("Invalid command: " + command);
|
usage("Invalid command: " + command);
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ public class HMasterCommandLine extends ServerCommandLine {
|
||||||
HMaster master = HMaster.constructMaster(masterClass, conf);
|
HMaster master = HMaster.constructMaster(masterClass, conf);
|
||||||
if (master.isStopped()) {
|
if (master.isStopped()) {
|
||||||
LOG.info("Won't bring the Master up as a shutdown is requested");
|
LOG.info("Won't bring the Master up as a shutdown is requested");
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
master.start();
|
master.start();
|
||||||
master.join();
|
master.join();
|
||||||
|
@ -191,8 +191,8 @@ public class HMasterCommandLine extends ServerCommandLine {
|
||||||
throw new RuntimeException("HMaster Aborted");
|
throw new RuntimeException("HMaster Aborted");
|
||||||
}
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
LOG.error("Failed to start master", t);
|
LOG.error("Master exiting", t);
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -206,19 +206,19 @@ public class HMasterCommandLine extends ServerCommandLine {
|
||||||
adm = new HBaseAdmin(getConf());
|
adm = new HBaseAdmin(getConf());
|
||||||
} catch (MasterNotRunningException e) {
|
} catch (MasterNotRunningException e) {
|
||||||
LOG.error("Master not running");
|
LOG.error("Master not running");
|
||||||
return -1;
|
return 1;
|
||||||
} catch (ZooKeeperConnectionException e) {
|
} catch (ZooKeeperConnectionException e) {
|
||||||
LOG.error("ZooKeeper not available");
|
LOG.error("ZooKeeper not available");
|
||||||
return -1;
|
return 1;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOG.error("Got IOException: " +e.getMessage(), e);
|
LOG.error("Got IOException: " +e.getMessage(), e);
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
adm.shutdown();
|
adm.shutdown();
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
LOG.error("Failed to stop master", t);
|
LOG.error("Failed to stop master", t);
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,16 +50,26 @@ public class HRegionServerCommandLine extends ServerCommandLine {
|
||||||
|
|
||||||
private int start() throws Exception {
|
private int start() throws Exception {
|
||||||
Configuration conf = getConf();
|
Configuration conf = getConf();
|
||||||
|
try {
|
||||||
|
// If 'local', don't start a region server here. Defer to
|
||||||
|
// LocalHBaseCluster. It manages 'local' clusters.
|
||||||
|
if (LocalHBaseCluster.isLocal(conf)) {
|
||||||
|
LOG.warn("Not starting a distinct region server because "
|
||||||
|
+ HConstants.CLUSTER_DISTRIBUTED + " is false");
|
||||||
|
} else {
|
||||||
|
logJVMInfo();
|
||||||
|
HRegionServer hrs = HRegionServer.constructRegionServer(regionServerClass, conf);
|
||||||
|
HRegionServer.startRegionServer(hrs);
|
||||||
|
Thread rsThread = HRegionServer.startRegionServer(hrs);
|
||||||
|
|
||||||
// If 'local', don't start a region server here. Defer to
|
rsThread.join();
|
||||||
// LocalHBaseCluster. It manages 'local' clusters.
|
if (hrs.isAborted()) {
|
||||||
if (LocalHBaseCluster.isLocal(conf)) {
|
throw new RuntimeException("HRegionServer Aborted");
|
||||||
LOG.warn("Not starting a distinct region server because "
|
}
|
||||||
+ HConstants.CLUSTER_DISTRIBUTED + " is false");
|
}
|
||||||
} else {
|
} catch (Throwable t) {
|
||||||
logJVMInfo();
|
LOG.error("Region server exiting", t);
|
||||||
HRegionServer hrs = HRegionServer.constructRegionServer(regionServerClass, conf);
|
return 1;
|
||||||
HRegionServer.startRegionServer(hrs);
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +77,7 @@ public class HRegionServerCommandLine extends ServerCommandLine {
|
||||||
public int run(String args[]) throws Exception {
|
public int run(String args[]) throws Exception {
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
usage(null);
|
usage(null);
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
String cmd = args[0];
|
String cmd = args[0];
|
||||||
|
@ -79,10 +89,10 @@ public class HRegionServerCommandLine extends ServerCommandLine {
|
||||||
"To shutdown the regionserver run " +
|
"To shutdown the regionserver run " +
|
||||||
"bin/hbase-daemon.sh stop regionserver or send a kill signal to" +
|
"bin/hbase-daemon.sh stop regionserver or send a kill signal to" +
|
||||||
"the regionserver pid");
|
"the regionserver pid");
|
||||||
return -1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
usage("Unknown command: " + args[0]);
|
usage("Unknown command: " + args[0]);
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue