|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.catalog.CatalogTracker
public class CatalogTracker
Tracks the availability of the catalog tables -ROOT-
and
.META.
.
This class is "read-only" in that the locations of the catalog tables cannot
be explicitly set. Instead, ZooKeeper is used to learn of the availability
and location of -ROOT-
. -ROOT-
is used to learn of
the location of .META.
If not available in -ROOT-
,
ZooKeeper is used to monitor for a new location of .META.
.
Call start()
to start up operation. Call stop()
} to
interrupt waits and close up shop.
Field Summary | |
---|---|
static byte[] |
META_REGION
|
static byte[] |
ROOT_REGION
|
Constructor Summary | |
---|---|
CatalogTracker(HConnection connection)
Constructs a catalog tracker. |
|
CatalogTracker(ZooKeeperWatcher zk,
HConnection connection,
Abortable abortable)
Constructs the catalog tracker. |
|
CatalogTracker(ZooKeeperWatcher zk,
HConnection connection,
Abortable abortable,
int defaultTimeout)
Constructs the catalog tracker. |
Method Summary | |
---|---|
HConnection |
getConnection()
|
HServerAddress |
getMetaLocation()
|
HServerAddress |
getRootLocation()
Gets the current location for -ROOT- or null if location is
not currently available. |
void |
start()
Starts the catalog tracker. |
void |
stop()
Stop working. |
boolean |
verifyMetaRegionLocation(long timeout)
Verify .META. is deployed and accessible. |
boolean |
verifyRootRegionLocation(long timeout)
Verify -ROOT- is deployed and accessible. |
void |
waitForMeta()
Waits indefinitely for availability of .META. . |
HServerAddress |
waitForMeta(long timeout)
Gets the current location for .META. if available and waits
for up to the specified timeout if not immediately available. |
HRegionInterface |
waitForMetaServerConnection(long timeout)
Gets a connection to the server hosting meta, as reported by ZooKeeper, waiting up to the specified timeout for availability. |
HRegionInterface |
waitForMetaServerConnectionDefault()
Gets a connection to the server hosting meta, as reported by ZooKeeper, waiting up to the specified timeout for availability. |
void |
waitForRoot()
Waits indefinitely for availability of -ROOT- . |
HRegionInterface |
waitForRootServerConnection(long timeout)
Gets a connection to the server hosting root, as reported by ZooKeeper, waiting up to the specified timeout for availability. |
HRegionInterface |
waitForRootServerConnectionDefault()
Gets a connection to the server hosting root, as reported by ZooKeeper, waiting for the default timeout specified on instantiation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte[] ROOT_REGION
public static final byte[] META_REGION
Constructor Detail |
---|
public CatalogTracker(HConnection connection) throws IOException
start()
post construction.
Does not timeout.
connection
- Server connection; if problem, this connections
Abortable.abort(String, Throwable)
will be called.
IOException
public CatalogTracker(ZooKeeperWatcher zk, HConnection connection, Abortable abortable) throws IOException
start()
post construction.
Does not timeout.
zk
- connection
- server connectionabortable
- if fatal exception
IOException
public CatalogTracker(ZooKeeperWatcher zk, HConnection connection, Abortable abortable, int defaultTimeout) throws IOException
start()
post construction.
zk
- connection
- server connectionabortable
- if fatal exceptiondefaultTimeout
- Timeout to use. Pass zero for no timeout
(Object.wait(long)
when passed a 0
waits for ever).
IOException
Method Detail |
---|
public void start() throws IOException, InterruptedException
IOException
InterruptedException
public void stop()
public HServerAddress getRootLocation() throws InterruptedException
-ROOT-
or null if location is
not currently available.
InterruptedException
public HServerAddress getMetaLocation()
public void waitForRoot() throws InterruptedException
-ROOT-
. Used during
cluster startup.
InterruptedException
- if interrupted while waitingpublic HRegionInterface waitForRootServerConnection(long timeout) throws InterruptedException, NotAllMetaRegionsOnlineException, IOException
InterruptedException
NotAllMetaRegionsOnlineException
- if timed out waiting
IOException
for additional information
public HRegionInterface waitForRootServerConnectionDefault() throws NotAllMetaRegionsOnlineException, IOException
NotAllMetaRegionsOnlineException
- if timed out waiting
IOException
for additional information
public void waitForMeta() throws InterruptedException
.META.
. Used during
cluster startup.
InterruptedException
- if interrupted while waitingpublic HServerAddress waitForMeta(long timeout) throws InterruptedException, IOException, NotAllMetaRegionsOnlineException
.META.
if available and waits
for up to the specified timeout if not immediately available. Throws an
exception if timed out waiting. This method differs from waitForMeta()
in that it will go ahead and verify the location gotten from ZooKeeper by
trying to use returned connection.
timeout
- maximum time to wait for meta availability, in milliseconds
InterruptedException
- if interrupted while waiting
IOException
- unexpected exception connecting to meta server
NotAllMetaRegionsOnlineException
- if meta not available before
timeoutpublic HRegionInterface waitForMetaServerConnection(long timeout) throws InterruptedException, NotAllMetaRegionsOnlineException, IOException
InterruptedException
NotAllMetaRegionsOnlineException
- if timed out waiting
IOException
for additional information
public HRegionInterface waitForMetaServerConnectionDefault() throws NotAllMetaRegionsOnlineException, IOException
NotAllMetaRegionsOnlineException
- if timed out or interrupted
IOException
for additional information
public boolean verifyRootRegionLocation(long timeout) throws InterruptedException, IOException
-ROOT-
is deployed and accessible.
timeout
- How long to wait on zk for root address (passed through to
the internal call to waitForRootServerConnection(long)
.
-ROOT-
location is healthy.
IOException
InterruptedException
public boolean verifyMetaRegionLocation(long timeout) throws InterruptedException, IOException
.META.
is deployed and accessible.
timeout
- How long to wait on zk for .META.
address
(passed through to the internal call to waitForMetaServerConnection(long)
.
.META.
location is healthy.
IOException
- Some unexpected IOE.
InterruptedException
public HConnection getConnection()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |