@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,
int replicaId,
long timeout)
Wait until the meta region is available and is not in transition.
|
ServerName |
blockUntilAvailable(ZooKeeperWatcher zkw,
long timeout)
Wait until the meta region is available and is not in transition.
|
List<ServerName> |
blockUntilAvailable(ZooKeeperWatcher zkw,
long timeout,
org.apache.hadoop.conf.Configuration conf)
Wait until the primary meta region is available.
|
void |
deleteMetaLocation(ZooKeeperWatcher zookeeper)
Deletes the location of
hbase:meta in ZooKeeper. |
void |
deleteMetaLocation(ZooKeeperWatcher zookeeper,
int replicaId) |
ServerName |
getMetaRegionLocation(ZooKeeperWatcher zkw)
Gets the meta region location, if available.
|
ServerName |
getMetaRegionLocation(ZooKeeperWatcher zkw,
int replicaId)
Gets the meta region location, if available.
|
List<HRegionInfo> |
getMetaRegions(ZooKeeperWatcher zkw) |
List<HRegionInfo> |
getMetaRegions(ZooKeeperWatcher zkw,
int replicaId) |
List<Pair<HRegionInfo,ServerName>> |
getMetaRegionsAndLocations(ZooKeeperWatcher zkw) |
List<Pair<HRegionInfo,ServerName>> |
getMetaRegionsAndLocations(ZooKeeperWatcher zkw,
int replicaId) |
static RegionState |
getMetaRegionState(ZooKeeperWatcher zkw)
Load the meta region state from the meta server ZNode.
|
static RegionState |
getMetaRegionState(ZooKeeperWatcher zkw,
int replicaId)
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,
int replicaId,
RegionState.State state)
Sets the location of
hbase:meta in ZooKeeper to the
specified server address. |
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. |
boolean |
verifyMetaRegionLocation(HConnection hConnection,
ZooKeeperWatcher zkw,
long timeout,
int replicaId)
Verify
hbase:meta is deployed and accessible. |
void |
waitMetaRegionLocation(ZooKeeperWatcher zkw)
Waits indefinitely for availability of
hbase:meta. |
ServerName |
waitMetaRegionLocation(ZooKeeperWatcher zkw,
int replicaId,
long timeout)
Gets the meta region location, if available, and waits for up to the
specified timeout if not immediately available.
|
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<Pair<HRegionInfo,ServerName>> getMetaRegionsAndLocations(ZooKeeperWatcher zkw, int replicaId)
zkw - replicaId - public List<HRegionInfo> getMetaRegions(ZooKeeperWatcher zkw)
zkw - ZooKeeper watcher to be usedpublic List<HRegionInfo> getMetaRegions(ZooKeeperWatcher zkw, int replicaId)
zkw - replicaId - public ServerName getMetaRegionLocation(ZooKeeperWatcher zkw)
zkw - zookeeper connection to usepublic ServerName getMetaRegionLocation(ZooKeeperWatcher zkw, int replicaId)
zkw - replicaId - public ServerName waitMetaRegionLocation(ZooKeeperWatcher zkw, long timeout) throws InterruptedException, NotAllMetaRegionsOnlineException
zkw - timeout - maximum time to wait, in millisServerName, or null if none availableInterruptedException - if interrupted while waitingNotAllMetaRegionsOnlineExceptionpublic ServerName waitMetaRegionLocation(ZooKeeperWatcher zkw, int replicaId, long timeout) throws InterruptedException, NotAllMetaRegionsOnlineException
zkw - replicaId - timeout - maximum time to wait, in millisServerName, or null if none availableInterruptedExceptionNotAllMetaRegionsOnlineExceptionpublic 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.hConnection - zkw - 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, int).hbase:meta location is healthy.IOExceptionInterruptedExceptionpublic boolean verifyMetaRegionLocation(HConnection hConnection, ZooKeeperWatcher zkw, long timeout, int replicaId) throws InterruptedException, IOException
hbase:meta is deployed and accessible.hConnection - zkw - timeout - How long to wait on zk for meta address (passed through toreplicaId - hbase:meta location is healthy.InterruptedExceptionIOExceptionpublic 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 void setMetaLocation(ZooKeeperWatcher zookeeper, ServerName serverName, int replicaId, RegionState.State state) throws org.apache.zookeeper.KeeperException
hbase:meta in ZooKeeper to the
specified server address.zookeeper - serverName - replicaId - state - org.apache.zookeeper.KeeperExceptionpublic static RegionState getMetaRegionState(ZooKeeperWatcher zkw) throws org.apache.zookeeper.KeeperException
org.apache.zookeeper.KeeperExceptionpublic static RegionState getMetaRegionState(ZooKeeperWatcher zkw, int replicaId) throws org.apache.zookeeper.KeeperException
zkw - replicaId - 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 void deleteMetaLocation(ZooKeeperWatcher zookeeper, int replicaId) throws org.apache.zookeeper.KeeperException
org.apache.zookeeper.KeeperExceptionpublic List<ServerName> blockUntilAvailable(ZooKeeperWatcher zkw, long timeout, org.apache.hadoop.conf.Configuration conf) throws InterruptedException
zkw - timeout - conf - InterruptedExceptionpublic ServerName blockUntilAvailable(ZooKeeperWatcher zkw, long timeout) throws InterruptedException
zkw - zookeeper connection to usetimeout - maximum time to wait, in millisInterruptedExceptionpublic ServerName blockUntilAvailable(ZooKeeperWatcher zkw, int replicaId, long timeout) throws InterruptedException
zkw - replicaId - timeout - InterruptedExceptionpublic void stop()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.