|
||||||||||
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.
Constructor Summary | |
---|---|
CatalogTracker(org.apache.hadoop.conf.Configuration conf)
Constructs a catalog tracker. |
|
CatalogTracker(ZooKeeperWatcher zk,
org.apache.hadoop.conf.Configuration conf,
Abortable abortable)
Constructs the catalog tracker. |
Method Summary | |
---|---|
HConnection |
getConnection()
|
ServerName |
getMetaLocation()
|
ServerName |
getMetaLocationOrReadLocationFromRoot()
Method used by master on startup trying to figure state of cluster. |
ServerName |
getRootLocation()
Gets the current location for -ROOT- or null if location is
not currently available. |
void |
resetMetaLocation()
Called when we figure current meta is off (called from zk callback). |
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. . |
ServerName |
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)
Deprecated. Does not retry; use an HTable instance instead. |
void |
waitForRoot()
Waits indefinitely for availability of -ROOT- . |
HRegionInterface |
waitForRootServerConnection(long timeout)
Deprecated. Use #getRootServerConnection(long) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CatalogTracker(org.apache.hadoop.conf.Configuration conf) throws IOException
start()
post construction. Does
not timeout.
conf
- the Configuration
from which a HConnection
will be
obtained; if problem, this connections
Abortable.abort(String, Throwable)
will be called.
IOException
public CatalogTracker(ZooKeeperWatcher zk, org.apache.hadoop.conf.Configuration conf, Abortable abortable) throws IOException
start()
post construction.
Does not timeout.
zk
- If zk is null, we'll create an instance (and shut it down
when stop()
is called) else we'll use what is passed.conf
- abortable
- If fatal exception we'll call abort on this. May be null.
If it is we'll use the Connection associated with the passed
Configuration
as our Abortable.
IOException
Method Detail |
---|
public void start() throws IOException, InterruptedException
IOException
InterruptedException
public void stop()
public ServerName getRootLocation() throws InterruptedException
-ROOT-
or null if location is
not currently available.
ServerName
for server hosting -ROOT-
or null
if none available
InterruptedException
public ServerName getMetaLocation()
ServerName
for server hosting .META.
or null
if none availablepublic ServerName getMetaLocationOrReadLocationFromRoot() throws IOException
-ROOT-
and
return that.
ServerName
for server hosting .META.
or if null,
we'll read the location that is up in -ROOT-
table (which
could be null or just plain stale).
IOException
public void waitForRoot() throws InterruptedException
-ROOT-
. Used during
cluster startup.
InterruptedException
- if interrupted while waitingpublic HRegionInterface waitForRootServerConnection(long timeout) throws InterruptedException, NotAllMetaRegionsOnlineException, IOException
timeout
- How long to wait on root location
InterruptedException
NotAllMetaRegionsOnlineException
- if timed out waiting
IOException
for additional information
public void waitForMeta() throws InterruptedException
.META.
. Used during
cluster startup. Does not verify meta, just that something has been
set up in zk.
InterruptedException
- if interrupted while waitingwaitForMeta(long)
public ServerName 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 and
-ROOT- region by trying to use returned connection.
timeout
- maximum time to wait for meta availability, in milliseconds
ServerName
for server hosting .META.
or null
if none available
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 void resetMetaLocation()
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 |