HBASE-3258 EOF when version file is empty
HBASE-3259 Can't kill the region servers when they wait on the master or the cluster state znode git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1038346 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a7b528a712
commit
899b7093d6
|
@ -702,6 +702,9 @@ Release 0.90.0 - Unreleased
|
|||
HBASE-3252 TestZooKeeperNodeTracker sometimes fails due to a race condition
|
||||
in test notification (Gary Helmling via Andrew Purtell)
|
||||
HBASE-3253 Thrift's missing from all the repositories in pom.xml
|
||||
HBASE-3258 EOF when version file is empty
|
||||
HBASE-3259 Can't kill the region servers when they wait on the master or
|
||||
the cluster state znode
|
||||
|
||||
|
||||
IMPROVEMENTS
|
||||
|
|
|
@ -557,7 +557,7 @@ implements HMasterInterface, HMasterRegionInterface, MasterServices, Server {
|
|||
}
|
||||
if (this.rpcServer != null) this.rpcServer.stop();
|
||||
// Clean up and close up shop
|
||||
this.logCleaner.interrupt();
|
||||
if (this.logCleaner!= null) this.logCleaner.interrupt();
|
||||
if (this.infoServer != null) {
|
||||
LOG.info("Stopping infoServer");
|
||||
try {
|
||||
|
|
|
@ -119,6 +119,7 @@ import org.apache.hadoop.hbase.util.Sleeper;
|
|||
import org.apache.hadoop.hbase.util.Threads;
|
||||
import org.apache.hadoop.hbase.zookeeper.ClusterStatusTracker;
|
||||
import org.apache.hadoop.hbase.zookeeper.ZKUtil;
|
||||
import org.apache.hadoop.hbase.zookeeper.ZooKeeperNodeTracker;
|
||||
import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
|
||||
import org.apache.hadoop.io.MapWritable;
|
||||
import org.apache.hadoop.io.Writable;
|
||||
|
@ -456,15 +457,15 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
|||
// Create the master address manager, register with zk, and start it. Then
|
||||
// block until a master is available. No point in starting up if no master
|
||||
// running.
|
||||
this.masterAddressManager = new MasterAddressTracker(zooKeeper, this);
|
||||
this.masterAddressManager = new MasterAddressTracker(this.zooKeeper, this);
|
||||
this.masterAddressManager.start();
|
||||
this.masterAddressManager.blockUntilAvailable();
|
||||
blockAndCheckIfStopped(this.masterAddressManager);
|
||||
|
||||
// Wait on cluster being up. Master will set this flag up in zookeeper
|
||||
// when ready.
|
||||
this.clusterStatusTracker = new ClusterStatusTracker(this.zooKeeper, this);
|
||||
this.clusterStatusTracker.start();
|
||||
this.clusterStatusTracker.blockUntilAvailable();
|
||||
blockAndCheckIfStopped(this.clusterStatusTracker);
|
||||
|
||||
// Create the catalog tracker and start it;
|
||||
this.catalogTracker = new CatalogTracker(this.zooKeeper, this.connection,
|
||||
|
@ -472,6 +473,22 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
|||
catalogTracker.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Utilty method to wait indefinitely on a znode availability while checking
|
||||
* if the region server is shut down
|
||||
* @param tracker znode tracker to use
|
||||
* @throws IOException any IO exception, plus if the RS is stopped
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
private void blockAndCheckIfStopped(ZooKeeperNodeTracker tracker)
|
||||
throws IOException, InterruptedException {
|
||||
while (tracker.blockUntilAvailable(this.msgInterval) == null) {
|
||||
if (this.stopped) {
|
||||
throw new IOException("Received the shutdown message while waiting.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return False if cluster shutdown in progress
|
||||
*/
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.apache.hadoop.hdfs.protocol.FSConstants;
|
|||
import org.apache.hadoop.io.SequenceFile;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
|
@ -149,6 +150,8 @@ public class FSUtils {
|
|||
fs.open(versionFile);
|
||||
try {
|
||||
version = DataInputStream.readUTF(s);
|
||||
} catch (EOFException eof) {
|
||||
LOG.warn("Version file was empty, odd, will try to set it.");
|
||||
} finally {
|
||||
s.close();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue