@InterfaceAudience.Private public class MetaTableLocator extends Object
RegionServerServices.
This class doesn't use ZK watchers, rather accesses ZK directly.
This class it stateless. The only reason it's not made a non-instantiable util class
with a collection of static methods is that it'd be rather hard to mock properly in tests.
TODO: rewrite using RPC calls to master to find out about hbase:meta.| Constructor and Description |
|---|
MetaTableLocator() |
| Modifier and Type | Method and Description |
|---|---|
ServerName |
blockUntilAvailable(ZooKeeperWatcher zkw,
long timeout)
Wait until the meta region is available and is not in transition.
|
void |
deleteMetaLocation(ZooKeeperWatcher zookeeper)
Deletes the location of
hbase:meta in ZooKeeper. |
ServerName |
getMetaRegionLocation(ZooKeeperWatcher zkw)
Gets the meta region location, if available.
|
List<HRegionInfo> |
getMetaRegions(ZooKeeperWatcher zkw) |
List<Pair<HRegionInfo,ServerName>> |
getMetaRegionsAndLocations(ZooKeeperWatcher zkw) |
static RegionState |
getMetaRegionState(ZooKeeperWatcher zkw)
Load the meta region state from the meta server ZNode.
|
boolean |
isLocationAvailable(ZooKeeperWatcher zkw)
Checks if the meta region location is available.
|
static void |
setMetaLocation(ZooKeeperWatcher zookeeper,
ServerName serverName,
RegionState.State state)
Sets the location of
hbase:meta in ZooKeeper to the
specified server address. |
void |
stop()
Stop working.
|
boolean |
verifyMetaRegionLocation(HConnection hConnection,
ZooKeeperWatcher zkw,
long timeout)
Verify
hbase:meta is deployed and accessible. |
void |
waitMetaRegionLocation(ZooKeeperWatcher zkw)
Waits indefinitely for availability of
hbase:meta. |
ServerName |
waitMetaRegionLocation(ZooKeeperWatcher zkw,
long timeout)
Gets the meta region location, if available, and waits for up to the
specified timeout if not immediately available.
|
public boolean isLocationAvailable(ZooKeeperWatcher zkw)
public List<Pair<HRegionInfo,ServerName>> getMetaRegionsAndLocations(ZooKeeperWatcher zkw)
zkw - ZooKeeper watcher to be usedpublic List<HRegionInfo> getMetaRegions(ZooKeeperWatcher zkw)
zkw - ZooKeeper watcher to be used@Nullable public ServerName getMetaRegionLocation(ZooKeeperWatcher zkw)
zkw - zookeeper connection to usepublic ServerName waitMetaRegionLocation(ZooKeeperWatcher zkw, long timeout) throws InterruptedException, NotAllMetaRegionsOnlineException
timeout - maximum time to wait, in millisServerName, or null if none availableInterruptedException - if interrupted while waitingNotAllMetaRegionsOnlineExceptionpublic void waitMetaRegionLocation(ZooKeeperWatcher zkw) throws InterruptedException
hbase:meta. Used during
cluster startup. Does not verify meta, just that something has been
set up in zk.InterruptedException - if interrupted while waitingwaitMetaRegionLocation(org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher, long)public boolean verifyMetaRegionLocation(HConnection hConnection, ZooKeeperWatcher zkw, long timeout) throws InterruptedException, IOException
hbase:meta is deployed and accessible.timeout - How long to wait on zk for meta address (passed through to
the internal call to getMetaServerConnection(org.apache.hadoop.hbase.client.HConnection, org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher, long).hbase:meta location is healthy.IOExceptionInterruptedExceptionpublic static void setMetaLocation(ZooKeeperWatcher zookeeper, ServerName serverName, RegionState.State state) throws org.apache.zookeeper.KeeperException
hbase:meta in ZooKeeper to the
specified server address.zookeeper - zookeeper referenceserverName - The server hosting hbase:metastate - The region transition stateorg.apache.zookeeper.KeeperException - unexpected zookeeper exceptionpublic static RegionState getMetaRegionState(ZooKeeperWatcher zkw) throws org.apache.zookeeper.KeeperException
org.apache.zookeeper.KeeperExceptionpublic void deleteMetaLocation(ZooKeeperWatcher zookeeper) throws org.apache.zookeeper.KeeperException
hbase:meta in ZooKeeper.zookeeper - zookeeper referenceorg.apache.zookeeper.KeeperException - unexpected zookeeper exceptionpublic ServerName blockUntilAvailable(ZooKeeperWatcher zkw, long timeout) throws InterruptedException
zkw - zookeeper connection to usetimeout - maximum time to wait, in millisInterruptedExceptionpublic void stop()
Copyright © 2007-2016 The Apache Software Foundation. All Rights Reserved.