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
|
HBASE-3252 TestZooKeeperNodeTracker sometimes fails due to a race condition
|
||||||
in test notification (Gary Helmling via Andrew Purtell)
|
in test notification (Gary Helmling via Andrew Purtell)
|
||||||
HBASE-3253 Thrift's missing from all the repositories in pom.xml
|
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
|
IMPROVEMENTS
|
||||||
|
|
|
@ -557,7 +557,7 @@ implements HMasterInterface, HMasterRegionInterface, MasterServices, Server {
|
||||||
}
|
}
|
||||||
if (this.rpcServer != null) this.rpcServer.stop();
|
if (this.rpcServer != null) this.rpcServer.stop();
|
||||||
// Clean up and close up shop
|
// Clean up and close up shop
|
||||||
this.logCleaner.interrupt();
|
if (this.logCleaner!= null) this.logCleaner.interrupt();
|
||||||
if (this.infoServer != null) {
|
if (this.infoServer != null) {
|
||||||
LOG.info("Stopping infoServer");
|
LOG.info("Stopping infoServer");
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -119,6 +119,7 @@ import org.apache.hadoop.hbase.util.Sleeper;
|
||||||
import org.apache.hadoop.hbase.util.Threads;
|
import org.apache.hadoop.hbase.util.Threads;
|
||||||
import org.apache.hadoop.hbase.zookeeper.ClusterStatusTracker;
|
import org.apache.hadoop.hbase.zookeeper.ClusterStatusTracker;
|
||||||
import org.apache.hadoop.hbase.zookeeper.ZKUtil;
|
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.hbase.zookeeper.ZooKeeperWatcher;
|
||||||
import org.apache.hadoop.io.MapWritable;
|
import org.apache.hadoop.io.MapWritable;
|
||||||
import org.apache.hadoop.io.Writable;
|
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
|
// 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
|
// block until a master is available. No point in starting up if no master
|
||||||
// running.
|
// running.
|
||||||
this.masterAddressManager = new MasterAddressTracker(zooKeeper, this);
|
this.masterAddressManager = new MasterAddressTracker(this.zooKeeper, this);
|
||||||
this.masterAddressManager.start();
|
this.masterAddressManager.start();
|
||||||
this.masterAddressManager.blockUntilAvailable();
|
blockAndCheckIfStopped(this.masterAddressManager);
|
||||||
|
|
||||||
// Wait on cluster being up. Master will set this flag up in zookeeper
|
// Wait on cluster being up. Master will set this flag up in zookeeper
|
||||||
// when ready.
|
// when ready.
|
||||||
this.clusterStatusTracker = new ClusterStatusTracker(this.zooKeeper, this);
|
this.clusterStatusTracker = new ClusterStatusTracker(this.zooKeeper, this);
|
||||||
this.clusterStatusTracker.start();
|
this.clusterStatusTracker.start();
|
||||||
this.clusterStatusTracker.blockUntilAvailable();
|
blockAndCheckIfStopped(this.clusterStatusTracker);
|
||||||
|
|
||||||
// Create the catalog tracker and start it;
|
// Create the catalog tracker and start it;
|
||||||
this.catalogTracker = new CatalogTracker(this.zooKeeper, this.connection,
|
this.catalogTracker = new CatalogTracker(this.zooKeeper, this.connection,
|
||||||
|
@ -472,6 +473,22 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
||||||
catalogTracker.start();
|
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
|
* @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 org.apache.hadoop.io.SequenceFile;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.EOFException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
@ -149,6 +150,8 @@ public class FSUtils {
|
||||||
fs.open(versionFile);
|
fs.open(versionFile);
|
||||||
try {
|
try {
|
||||||
version = DataInputStream.readUTF(s);
|
version = DataInputStream.readUTF(s);
|
||||||
|
} catch (EOFException eof) {
|
||||||
|
LOG.warn("Version file was empty, odd, will try to set it.");
|
||||||
} finally {
|
} finally {
|
||||||
s.close();
|
s.close();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue