@InterfaceAudience.Private public final class MetaTableLocator extends Object
RegionServerServices
. This class doesn't use ZK
watchers, rather accesses ZK directly.
TODO: rewrite using RPC calls to master to find out about hbase:meta.Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
LOG |
Modifier | Constructor and Description |
---|---|
private |
MetaTableLocator() |
Modifier and Type | Method and Description |
---|---|
private static ServerName |
blockUntilAvailable(ZKWatcher zkw,
int replicaId,
long timeout)
Wait until the meta region is available and is not in transition.
|
static void |
deleteMetaLocation(ZKWatcher zookeeper)
Deletes the location of
hbase:meta in ZooKeeper. |
static void |
deleteMetaLocation(ZKWatcher zookeeper,
int replicaId) |
static ServerName |
getMetaRegionLocation(ZKWatcher zkw)
Gets the meta region location, if available.
|
static ServerName |
getMetaRegionLocation(ZKWatcher zkw,
int replicaId)
Gets the meta region location, if available.
|
static RegionState |
getMetaRegionState(ZKWatcher zkw)
Load the meta region state from the meta server ZNode.
|
static RegionState |
getMetaRegionState(ZKWatcher zkw,
int replicaId)
Load the meta region state from the meta region server ZNode.
|
static void |
setMetaLocation(ZKWatcher zookeeper,
ServerName serverName,
int replicaId,
RegionState.State state)
Sets the location of
hbase:meta in ZooKeeper to the specified server address. |
static void |
setMetaLocation(ZKWatcher zookeeper,
ServerName serverName,
RegionState.State state)
Sets the location of
hbase:meta in ZooKeeper to the specified server address. |
private static ServerName |
waitMetaRegionLocation(ZKWatcher zkw,
int replicaId,
long timeout)
Gets the meta region location, if available, and waits for up to the specified timeout if not
immediately available.
|
static ServerName |
waitMetaRegionLocation(ZKWatcher zkw,
long timeout)
Gets the meta region location, if available, and waits for up to the specified timeout if not
immediately available.
|
private static final org.slf4j.Logger LOG
private MetaTableLocator()
public static ServerName getMetaRegionLocation(ZKWatcher zkw)
zkw
- zookeeper connection to usepublic static ServerName getMetaRegionLocation(ZKWatcher zkw, int replicaId)
zkw
- reference to the ZKWatcher
which also contains configuration and
operationreplicaId
- the ID of the replicapublic static ServerName waitMetaRegionLocation(ZKWatcher zkw, long timeout) throws InterruptedException, NotAllMetaRegionsOnlineException
zkw
- reference to the ZKWatcher
which also contains configuration and
operationtimeout
- maximum time to wait, in millisServerName
, or null
if none availableInterruptedException
- if interrupted while waitingNotAllMetaRegionsOnlineException
- if a meta or root region is not onlineprivate static ServerName waitMetaRegionLocation(ZKWatcher zkw, int replicaId, long timeout) throws InterruptedException, NotAllMetaRegionsOnlineException
zkw
- reference to the ZKWatcher
which also contains configuration and
operationreplicaId
- the ID of the replicatimeout
- maximum time to wait, in millisServerName
, or null
if none availableInterruptedException
- if waiting for the socket operation failsNotAllMetaRegionsOnlineException
- if a meta or root region is not onlinepublic static void setMetaLocation(ZKWatcher 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:meta
state
- The region transition stateorg.apache.zookeeper.KeeperException
- unexpected zookeeper exceptionpublic static void setMetaLocation(ZKWatcher zookeeper, ServerName serverName, int replicaId, RegionState.State state) throws org.apache.zookeeper.KeeperException
hbase:meta
in ZooKeeper to the specified server address.zookeeper
- reference to the ZKWatcher
which also contains configuration and
operationserverName
- the name of the serverreplicaId
- the ID of the replicastate
- the state of the regionorg.apache.zookeeper.KeeperException
- if a ZooKeeper operation failspublic static RegionState getMetaRegionState(ZKWatcher zkw) throws org.apache.zookeeper.KeeperException
org.apache.zookeeper.KeeperException
public static RegionState getMetaRegionState(ZKWatcher zkw, int replicaId) throws org.apache.zookeeper.KeeperException
zkw
- reference to the ZKWatcher
which also contains configuration and
operationreplicaId
- the ID of the replica n * @throws KeeperException if a ZooKeeper operation
failsorg.apache.zookeeper.KeeperException
public static void deleteMetaLocation(ZKWatcher zookeeper) throws org.apache.zookeeper.KeeperException
hbase:meta
in ZooKeeper.zookeeper
- zookeeper referenceorg.apache.zookeeper.KeeperException
- unexpected zookeeper exceptionpublic static void deleteMetaLocation(ZKWatcher zookeeper, int replicaId) throws org.apache.zookeeper.KeeperException
org.apache.zookeeper.KeeperException
private static ServerName blockUntilAvailable(ZKWatcher zkw, int replicaId, long timeout) throws InterruptedException
zkw
- reference to the ZKWatcher
which also contains configuration and
constantsreplicaId
- the ID of the replicatimeout
- maximum time to wait in millisInterruptedException
- if waiting for the socket operation failsCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.