@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 |
|---|---|
static ServerName |
blockUntilAvailable(ZKWatcher zkw,
int replicaId,
long timeout)
Wait until the meta region is available and is not in transition.
|
static ServerName |
blockUntilAvailable(ZKWatcher zkw,
long timeout)
Wait until the meta region is available and is not in transition.
|
static List<ServerName> |
blockUntilAvailable(ZKWatcher zkw,
long timeout,
org.apache.hadoop.conf.Configuration conf)
Wait until the primary meta region is available.
|
static void |
deleteMetaLocation(ZKWatcher zookeeper)
Deletes the location of
hbase:meta in ZooKeeper. |
static void |
deleteMetaLocation(ZKWatcher zookeeper,
int replicaId) |
private static List<RegionInfo> |
getListOfRegionInfos(List<Pair<RegionInfo,ServerName>> pairs) |
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 List<RegionInfo> |
getMetaRegions(ZKWatcher zkw)
Gets the meta regions for the given path with the default replica ID.
|
static List<RegionInfo> |
getMetaRegions(ZKWatcher zkw,
int replicaId)
Gets the meta regions for the given path and replica ID.
|
static List<Pair<RegionInfo,ServerName>> |
getMetaRegionsAndLocations(ZKWatcher zkw) |
static List<Pair<RegionInfo,ServerName>> |
getMetaRegionsAndLocations(ZKWatcher zkw,
int replicaId)
Gets the meta regions and their locations for the given path and replica ID.
|
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 server ZNode.
|
static boolean |
isLocationAvailable(ZKWatcher zkw)
Checks if the meta region location is available.
|
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. |
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 boolean isLocationAvailable(ZKWatcher zkw)
public static List<Pair<RegionInfo,ServerName>> getMetaRegionsAndLocations(ZKWatcher zkw)
zkw - ZooKeeper watcher to be usedpublic static List<Pair<RegionInfo,ServerName>> getMetaRegionsAndLocations(ZKWatcher zkw, int replicaId)
zkw - reference to the ZKWatcher which also contains configuration and operationreplicaId - the ID of the replicapublic static List<RegionInfo> getMetaRegions(ZKWatcher zkw)
zkw - ZooKeeper watcher to be usedpublic static List<RegionInfo> getMetaRegions(ZKWatcher zkw, int replicaId)
zkw - reference to the ZKWatcher which also contains configuration and operationreplicaId - the ID of the replicaprivate static List<RegionInfo> getListOfRegionInfos(List<Pair<RegionInfo,ServerName>> pairs)
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 onlinepublic 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:metastate - 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.KeeperExceptionpublic 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 replicaorg.apache.zookeeper.KeeperException - if a ZooKeeper operation failspublic 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.KeeperExceptionpublic static List<ServerName> blockUntilAvailable(ZKWatcher zkw, long timeout, org.apache.hadoop.conf.Configuration conf) throws InterruptedException
zkw - reference to the ZKWatcher which also contains configuration and operationtimeout - maximum time to wait in millisconf - the Configuration to useInterruptedException - if waiting for the socket operation failspublic static ServerName blockUntilAvailable(ZKWatcher zkw, long timeout) throws InterruptedException
zkw - zookeeper connection to usetimeout - maximum time to wait, in millisInterruptedException - if waiting for the socket operation failspublic 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.