More fixup for hbase merge tool -- test for master being offline

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1021791 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-10-12 15:06:15 +00:00
parent d405dbeca6
commit e695ef3cd0
3 changed files with 11 additions and 2 deletions

View File

@ -31,6 +31,7 @@ import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.MasterNotRunningException;
import org.apache.hadoop.hbase.ZooKeeperConnectionException;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.HBaseAdmin;
@ -92,6 +93,8 @@ public class Merge extends Configured implements Tool {
HBaseAdmin.checkHBaseAvailable(getConf());
LOG.fatal("HBase cluster must be off-line.");
return -1;
} catch (ZooKeeperConnectionException zkce) {
// If no zk, presume no master.
} catch (MasterNotRunningException e) {
// Expected. Ignore.
}

View File

@ -29,6 +29,7 @@ import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.Abortable;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.ZooKeeperConnectionException;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
@ -90,10 +91,11 @@ public class ZooKeeperWatcher implements Watcher {
* @param descriptor Descriptive string that is added to zookeeper sessionid
* and used as identifier for this instance.
* @throws IOException
* @throws ZooKeeperConnectionException
*/
public ZooKeeperWatcher(Configuration conf, String descriptor,
Abortable abortable)
throws IOException {
throws IOException, ZooKeeperConnectionException {
this.quorum = ZKConfig.getZKQuorumServersString(conf);
// Identifier will get the sessionid appended later below down when we
// handle the syncconnect event.
@ -127,7 +129,8 @@ public class ZooKeeperWatcher implements Watcher {
ke = e;
}
} while (isFinishedRetryingRecoverable(finished));
if (ke != null) throw ke;
// Convert connectionloss exception to ZKCE.
if (ke != null) throw new ZooKeeperConnectionException(ke);
ZKUtil.createAndFailSilent(this, assignmentZNode);
ZKUtil.createAndFailSilent(this, rsZNode);
ZKUtil.createAndFailSilent(this, tableZNode);

View File

@ -58,6 +58,9 @@ public class TestMergeTool extends HBaseTestCase {
@Override
public void setUp() throws Exception {
// Set the timeout down else this test will take a while to complete.
this.conf.setLong("hbase.zookeeper.recoverable.waittime", 1000);
this.conf.set("hbase.hstore.compactionThreshold", "2");
// Create table description