|
||||||||||
| 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 java.io.IOException
start() post construction.
Does not timeout.
connection - Server connection; if problem, this connections
Abortable.abort(String, Throwable) will be called.
java.io.IOException
public CatalogTracker(ZooKeeperWatcher zk,
HConnection connection,
Abortable abortable)
throws java.io.IOException
start() post construction.
Does not timeout.
zk - connection - server connectionabortable - if fatal exception
java.io.IOException
public CatalogTracker(ZooKeeperWatcher zk,
HConnection connection,
Abortable abortable,
int defaultTimeout)
throws java.io.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).
java.io.IOException| Method Detail |
|---|
public void start()
throws java.io.IOException,
java.lang.InterruptedException
java.io.IOException
java.lang.InterruptedExceptionpublic void stop()
public HServerAddress getRootLocation()
throws java.lang.InterruptedException
-ROOT- or null if location is
not currently available.
java.lang.InterruptedExceptionpublic HServerAddress getMetaLocation()
public void waitForRoot()
throws java.lang.InterruptedException
-ROOT-. Used during
cluster startup.
java.lang.InterruptedException - if interrupted while waiting
public HRegionInterface waitForRootServerConnection(long timeout)
throws java.lang.InterruptedException,
NotAllMetaRegionsOnlineException,
java.io.IOException
java.lang.InterruptedException
NotAllMetaRegionsOnlineException - if timed out waiting
java.io.IOExceptionfor additional information
public HRegionInterface waitForRootServerConnectionDefault()
throws NotAllMetaRegionsOnlineException,
java.io.IOException
NotAllMetaRegionsOnlineException - if timed out waiting
java.io.IOExceptionfor additional information
public void waitForMeta()
throws java.lang.InterruptedException
.META.. Used during
cluster startup.
java.lang.InterruptedException - if interrupted while waiting
public HServerAddress waitForMeta(long timeout)
throws java.lang.InterruptedException,
java.io.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
java.lang.InterruptedException - if interrupted while waiting
java.io.IOException - unexpected exception connecting to meta server
NotAllMetaRegionsOnlineException - if meta not available before
timeout
public HRegionInterface waitForMetaServerConnection(long timeout)
throws java.lang.InterruptedException,
NotAllMetaRegionsOnlineException,
java.io.IOException
java.lang.InterruptedException
NotAllMetaRegionsOnlineException - if timed out waiting
java.io.IOExceptionfor additional information
public HRegionInterface waitForMetaServerConnectionDefault()
throws NotAllMetaRegionsOnlineException,
java.io.IOException
NotAllMetaRegionsOnlineException - if timed out or interrupted
java.io.IOExceptionfor additional information
public boolean verifyRootRegionLocation(long timeout)
throws java.lang.InterruptedException,
java.io.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.
java.io.IOException
java.lang.InterruptedException
public boolean verifyMetaRegionLocation(long timeout)
throws java.lang.InterruptedException,
java.io.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.
java.io.IOException - Some unexpected IOE.
java.lang.InterruptedExceptionpublic HConnection getConnection()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||