HBASE-4008 Problem while stopping HBase
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1159494 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
284c7a38a8
commit
3910bd4b6d
|
@ -203,6 +203,7 @@ Release 0.91.0 - Unreleased
|
||||||
HBASE-4211 Do init-sizing of the StringBuilder making a ServerName
|
HBASE-4211 Do init-sizing of the StringBuilder making a ServerName
|
||||||
(Benoît Sigoure)
|
(Benoît Sigoure)
|
||||||
HBASE-4175 Fix FSUtils.createTableDescriptor() (Ramkrishna)
|
HBASE-4175 Fix FSUtils.createTableDescriptor() (Ramkrishna)
|
||||||
|
HBASE-4008 Problem while stopping HBase (Akash Ashok)
|
||||||
|
|
||||||
IMPROVEMENTS
|
IMPROVEMENTS
|
||||||
HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack)
|
HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack)
|
||||||
|
|
|
@ -1336,6 +1336,11 @@ implements HMasterInterface, HMasterRegionInterface, MasterServices, Server {
|
||||||
return this.stopped;
|
return this.stopped;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isAborted() {
|
||||||
|
return this.abort;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Report whether this master is currently the active master or not.
|
* Report whether this master is currently the active master or not.
|
||||||
* If not active master, we are parked on ZK waiting to become active.
|
* If not active master, we are parked on ZK waiting to become active.
|
||||||
|
|
|
@ -36,6 +36,7 @@ import org.apache.hadoop.hbase.MasterNotRunningException;
|
||||||
import org.apache.hadoop.hbase.ZooKeeperConnectionException;
|
import org.apache.hadoop.hbase.ZooKeeperConnectionException;
|
||||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||||
import org.apache.hadoop.hbase.regionserver.HRegionServer;
|
import org.apache.hadoop.hbase.regionserver.HRegionServer;
|
||||||
|
import org.apache.hadoop.hbase.util.JVMClusterUtil;
|
||||||
import org.apache.hadoop.hbase.util.ServerCommandLine;
|
import org.apache.hadoop.hbase.util.ServerCommandLine;
|
||||||
import org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster;
|
import org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster;
|
||||||
import org.apache.zookeeper.KeeperException;
|
import org.apache.zookeeper.KeeperException;
|
||||||
|
@ -138,6 +139,7 @@ public class HMasterCommandLine extends ServerCommandLine {
|
||||||
LocalHMaster.class, HRegionServer.class);
|
LocalHMaster.class, HRegionServer.class);
|
||||||
((LocalHMaster)cluster.getMaster(0)).setZKCluster(zooKeeperCluster);
|
((LocalHMaster)cluster.getMaster(0)).setZKCluster(zooKeeperCluster);
|
||||||
cluster.startup();
|
cluster.startup();
|
||||||
|
waitOnMasterThreads(cluster);
|
||||||
} else {
|
} else {
|
||||||
HMaster master = HMaster.constructMaster(masterClass, conf);
|
HMaster master = HMaster.constructMaster(masterClass, conf);
|
||||||
if (master.isStopped()) {
|
if (master.isStopped()) {
|
||||||
|
@ -146,6 +148,8 @@ public class HMasterCommandLine extends ServerCommandLine {
|
||||||
}
|
}
|
||||||
master.start();
|
master.start();
|
||||||
master.join();
|
master.join();
|
||||||
|
if(master.isAborted())
|
||||||
|
throw new RuntimeException("HMaster Aborted");
|
||||||
}
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
LOG.error("Failed to start master", t);
|
LOG.error("Failed to start master", t);
|
||||||
|
@ -177,6 +181,27 @@ public class HMasterCommandLine extends ServerCommandLine {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void waitOnMasterThreads(LocalHBaseCluster cluster) throws InterruptedException{
|
||||||
|
List<JVMClusterUtil.MasterThread> masters = cluster.getMasters();
|
||||||
|
List<JVMClusterUtil.RegionServerThread> regionservers = cluster.getRegionServers();
|
||||||
|
|
||||||
|
if (masters != null) {
|
||||||
|
for (JVMClusterUtil.MasterThread t : masters) {
|
||||||
|
t.join();
|
||||||
|
if(t.getMaster().isAborted()) {
|
||||||
|
closeAllRegionServerThreads(regionservers);
|
||||||
|
throw new RuntimeException("HMaster Aborted");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void closeAllRegionServerThreads(List<JVMClusterUtil.RegionServerThread> regionservers) {
|
||||||
|
for(JVMClusterUtil.RegionServerThread t : regionservers){
|
||||||
|
t.getRegionServer().stop("HMaster Aborted; Bringing down regions servers");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Version of master that will shutdown the passed zk cluster on its way out.
|
* Version of master that will shutdown the passed zk cluster on its way out.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue