|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface HConnection
Cluster connection. Hosts a connection to the ZooKeeper ensemble and
thereafter into the HBase cluster. Knows how to locate regions out on the cluster,
keeps a cache of locations and then knows how to recalibrate after they move.
HConnectionManager manages instances of this class.
HConnections are used by HTable mostly but also by
HBaseAdmin, CatalogTracker,
and ZooKeeperWatcher. HConnection instances can be shared. Sharing
is usually what you want because rather than each HConnection instance
having to do its own discovery of regions out on the cluster, instead, all
clients get to share the one cache of locations. Sharing makes cleanup of
HConnections awkward. See HConnectionManager for cleanup
discussion.
HConnectionManager| Method Summary | ||
|---|---|---|
void |
clearRegionCache()
Allows flushing the region cache. |
|
void |
clearRegionCache(byte[] tableName)
Allows flushing the region cache of all locations that pertain to tableName |
|
org.apache.hadoop.conf.Configuration |
getConfiguration()
|
|
HRegionInterface |
getHRegionConnection(HServerAddress regionServer)
Establishes a connection to the region server at the specified address. |
|
HRegionInterface |
getHRegionConnection(HServerAddress regionServer,
boolean getMaster)
Establishes a connection to the region server at the specified address. |
|
HTableDescriptor |
getHTableDescriptor(byte[] tableName)
|
|
HMasterInterface |
getMaster()
|
|
boolean |
getRegionCachePrefetch(byte[] tableName)
Check whether region cache prefetch is enabled or not. |
|
HRegionLocation |
getRegionLocation(byte[] tableName,
byte[] row,
boolean reload)
Find region location hosting passed row |
|
|
getRegionServerWithoutRetries(ServerCallable<T> callable)
Pass in a ServerCallable with your particular bit of logic defined and this method will pass it to the defined region server. |
|
|
getRegionServerWithRetries(ServerCallable<T> callable)
Pass in a ServerCallable with your particular bit of logic defined and this method will manage the process of doing retries with timed waits and refinds of missing regions. |
|
ZooKeeperWatcher |
getZooKeeperWatcher()
Retrieve ZooKeeperWatcher used by this connection. |
|
boolean |
isMasterRunning()
|
|
boolean |
isTableAvailable(byte[] tableName)
|
|
boolean |
isTableDisabled(byte[] tableName)
|
|
boolean |
isTableEnabled(byte[] tableName)
A table that isTableEnabled == false and isTableDisabled == false is possible. |
|
HTableDescriptor[] |
listTables()
List all the userspace tables. |
|
HRegionLocation |
locateRegion(byte[] regionName)
Gets the location of the region of regionName. |
|
HRegionLocation |
locateRegion(byte[] tableName,
byte[] row)
Find the location of the region of tableName that row lives in. |
|
java.util.List<HRegionLocation> |
locateRegions(byte[] tableName)
Gets the locations of all regions in the specified table, tableName. |
|
void |
prewarmRegionCache(byte[] tableName,
java.util.Map<HRegionInfo,HServerAddress> regions)
Load the region map and warm up the global region cache for the table. |
|
void |
processBatch(java.util.List<Row> actions,
byte[] tableName,
java.util.concurrent.ExecutorService pool,
java.lang.Object[] results)
Process a mixed batch of Get, Put and Delete actions. |
|
void |
processBatchOfPuts(java.util.List<Put> list,
byte[] tableName,
java.util.concurrent.ExecutorService pool)
Deprecated. Use HConnectionManager::processBatch instead. |
|
HRegionLocation |
relocateRegion(byte[] tableName,
byte[] row)
Find the location of the region of tableName that row lives in, ignoring any value that might be in the cache. |
|
void |
setRegionCachePrefetch(byte[] tableName,
boolean enable)
Enable or disable region cache prefetch for the table. |
|
| Methods inherited from interface org.apache.hadoop.hbase.Abortable |
|---|
abort |
| Method Detail |
|---|
org.apache.hadoop.conf.Configuration getConfiguration()
ZooKeeperWatcher getZooKeeperWatcher()
throws java.io.IOException
java.io.IOException - if a remote or network exception occurs
HMasterInterface getMaster()
throws MasterNotRunningException,
ZooKeeperConnectionException
MasterNotRunningException - if the master is not running
ZooKeeperConnectionException - if unable to connect to zookeeper
boolean isMasterRunning()
throws MasterNotRunningException,
ZooKeeperConnectionException
MasterNotRunningException
ZooKeeperConnectionException
boolean isTableEnabled(byte[] tableName)
throws java.io.IOException
tableName - table name
java.io.IOException - if a remote or network exception occurs
boolean isTableDisabled(byte[] tableName)
throws java.io.IOException
tableName - table name
java.io.IOException - if a remote or network exception occurs
boolean isTableAvailable(byte[] tableName)
throws java.io.IOException
tableName - table name
java.io.IOException - if a remote or network exception occurs
HTableDescriptor[] listTables()
throws java.io.IOException
java.io.IOException - if a remote or network exception occurs
HTableDescriptor getHTableDescriptor(byte[] tableName)
throws java.io.IOException
tableName - table name
java.io.IOException - if a remote or network exception occurs
HRegionLocation locateRegion(byte[] tableName,
byte[] row)
throws java.io.IOException
tableName - name of the table row is inrow - row key you're trying to find the region of
java.io.IOException - if a remote or network exception occursvoid clearRegionCache()
void clearRegionCache(byte[] tableName)
tableName
tableName - Name of the table whose regions we are to remove from
cache.
HRegionLocation relocateRegion(byte[] tableName,
byte[] row)
throws java.io.IOException
tableName - name of the table row is inrow - row key you're trying to find the region of
java.io.IOException - if a remote or network exception occurs
HRegionLocation locateRegion(byte[] regionName)
throws java.io.IOException
regionName - name of the region to locate
java.io.IOException - if a remote or network exception occurs
java.util.List<HRegionLocation> locateRegions(byte[] tableName)
throws java.io.IOException
tableName - table to get regions of
java.io.IOException
HRegionInterface getHRegionConnection(HServerAddress regionServer)
throws java.io.IOException
regionServer - - the server to connect to
java.io.IOException - if a remote or network exception occurs
HRegionInterface getHRegionConnection(HServerAddress regionServer,
boolean getMaster)
throws java.io.IOException
regionServer - - the server to connect togetMaster - - do we check if master is alive
java.io.IOException - if a remote or network exception occurs
HRegionLocation getRegionLocation(byte[] tableName,
byte[] row,
boolean reload)
throws java.io.IOException
tableName - table namerow - Row to find.reload - If true do not use cache, otherwise bypass.
java.io.IOException - if a remote or network exception occurs
<T> T getRegionServerWithRetries(ServerCallable<T> callable)
throws java.io.IOException,
java.lang.RuntimeException
T - the type of the return valuecallable - callable to run
java.io.IOException - if a remote or network exception occurs
java.lang.RuntimeException - other unspecified error
<T> T getRegionServerWithoutRetries(ServerCallable<T> callable)
throws java.io.IOException,
java.lang.RuntimeException
T - the type of the return valuecallable - callable to run
java.io.IOException - if a remote or network exception occurs
java.lang.RuntimeException - other unspecified error
void processBatch(java.util.List<Row> actions,
byte[] tableName,
java.util.concurrent.ExecutorService pool,
java.lang.Object[] results)
throws java.io.IOException,
java.lang.InterruptedException
actions - The collection of actions.tableName - Name of the hbase tablepool - thread pool for parallel executionresults - An empty array, same size as list. If an exception is thrown,
you can test here for partial results, and to determine which actions
processed successfully.
java.io.IOException - if there are problems talking to META. Per-item
exceptions are stored in the results array.
java.lang.InterruptedException
void processBatchOfPuts(java.util.List<Put> list,
byte[] tableName,
java.util.concurrent.ExecutorService pool)
throws java.io.IOException
list - The collection of actions. The list is mutated: all successful Puts
are removed from the list.tableName - Name of the hbase tablepool - Thread pool for parallel execution
java.io.IOException
void setRegionCachePrefetch(byte[] tableName,
boolean enable)
tableName - name of table to configure.enable - Set to true to enable region cache prefetch.boolean getRegionCachePrefetch(byte[] tableName)
tableName - name of table to check
void prewarmRegionCache(byte[] tableName,
java.util.Map<HRegionInfo,HServerAddress> regions)
tableName - name of the table to perform region cache prewarm.regions - a region map.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||