|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@InterfaceAudience.Public @InterfaceStability.Stable public interface HConnection
A cluster connection. Knows how to find the master, 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. This is NOT a connection to a
particular server but to all servers in the cluster. An implementation takes care of individual
connections at a lower level.
HConnections are used by HTable
mostly but also by
HBaseAdmin
, and CatalogTracker
. 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. HConnectionManager
does the
sharing for you if you go by it getting connections. Sharing makes cleanup of
HConnections awkward. See HConnectionManager
for cleanup discussion.
HConnectionManager
Method Summary | ||
---|---|---|
void |
clearCaches(ServerName sn)
Clear any caches that pertain to server name sn |
|
void |
clearRegionCache()
Allows flushing the region cache. |
|
void |
clearRegionCache(byte[] tableName)
Allows flushing the region cache of all locations that pertain to tableName |
|
void |
deleteCachedRegionLocation(HRegionLocation location)
Deletes cached locations for the specific region. |
|
AdminProtos.AdminService.BlockingInterface |
getAdmin(ServerName serverName)
Establishes a connection to the region server at the specified address. |
|
AdminProtos.AdminService.BlockingInterface |
getAdmin(ServerName serverName,
boolean getMaster)
Deprecated. You can pass master flag but nothing special is done. |
|
ClientProtos.ClientService.BlockingInterface |
getClient(ServerName serverName)
Establishes a connection to the region server at the specified address, and returns a region client protocol. |
|
org.apache.hadoop.conf.Configuration |
getConfiguration()
|
|
int |
getCurrentNrHRS()
Deprecated. This method will be changed from public to package protected. |
|
HTableDescriptor |
getHTableDescriptor(byte[] tableName)
|
|
HTableDescriptor[] |
getHTableDescriptors(List<String> tableNames)
|
|
org.apache.hadoop.hbase.client.MasterAdminKeepAliveConnection |
getKeepAliveMasterAdminService()
This function allows HBaseAdmin and potentially others to get a shared MasterAdminProtocol connection. |
|
org.apache.hadoop.hbase.client.MasterMonitorKeepAliveConnection |
getKeepAliveMasterMonitorService()
This function allows HBaseAdmin and potentially others to get a shared MasterMonitor connection. |
|
MasterAdminProtos.MasterAdminService.BlockingInterface |
getMasterAdmin()
Returns a MasterAdminKeepAliveConnection to the active master |
|
MasterMonitorProtos.MasterMonitorService.BlockingInterface |
getMasterMonitor()
Returns an MasterMonitorKeepAliveConnection to the active master |
|
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)
Deprecated. |
|
|
getRegionServerWithRetries(ServerCallable<T> callable)
Deprecated. |
|
boolean |
isClosed()
|
|
boolean |
isDeadServer(ServerName serverName)
|
|
boolean |
isMasterRunning()
|
|
boolean |
isTableAvailable(byte[] tableName)
|
|
boolean |
isTableAvailable(byte[] tableName,
byte[][] splitKeys)
Use this api to check if the table has been created with the specified number of splitkeys which was used while creating the given table. |
|
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. |
|
List<HRegionLocation> |
locateRegions(byte[] tableName)
Gets the locations of all regions in the specified table, tableName. |
|
List<HRegionLocation> |
locateRegions(byte[] tableName,
boolean useCache,
boolean offlined)
Gets the locations of all regions in the specified table, tableName. |
|
void |
processBatch(List<? extends Row> actions,
byte[] tableName,
ExecutorService pool,
Object[] results)
Deprecated. since 0.96 - Use HTableInterface.batch(java.util.List extends org.apache.hadoop.hbase.client.Row>, java.lang.Object[]) instead |
|
|
processBatchCallback(List<? extends Row> list,
byte[] tableName,
ExecutorService pool,
Object[] results,
Batch.Callback<R> callback)
Deprecated. since 0.96 - Use HTableInterface.batchCallback(java.util.List extends org.apache.hadoop.hbase.client.Row>, java.lang.Object[], org.apache.hadoop.hbase.client.coprocessor.Batch.Callback 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, isAborted |
Methods inherited from interface java.io.Closeable |
---|
close |
Method Detail |
---|
org.apache.hadoop.conf.Configuration getConfiguration()
boolean isMasterRunning() throws MasterNotRunningException, ZooKeeperConnectionException
MasterNotRunningException
ZooKeeperConnectionException
boolean isTableEnabled(byte[] tableName) throws IOException
tableName
- table name
IOException
- if a remote or network exception occursboolean isTableDisabled(byte[] tableName) throws IOException
tableName
- table name
IOException
- if a remote or network exception occursboolean isTableAvailable(byte[] tableName) throws IOException
tableName
- table name
IOException
- if a remote or network exception occursboolean isTableAvailable(byte[] tableName, byte[][] splitKeys) throws IOException
tableName
- tableNamesplitKeys
- splitKeys used while creating table
IOException
- if a remote or network exception occursHTableDescriptor[] listTables() throws IOException
IOException
- if a remote or network exception occursHTableDescriptor getHTableDescriptor(byte[] tableName) throws IOException
tableName
- table name
IOException
- if a remote or network exception occursHRegionLocation locateRegion(byte[] tableName, byte[] row) throws IOException
tableName
- name of the table row is inrow
- row key you're trying to find the region of
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.void deleteCachedRegionLocation(HRegionLocation location)
location
- The location object for the region, to be purged from cache.HRegionLocation relocateRegion(byte[] tableName, byte[] row) throws IOException
tableName
- name of the table row is inrow
- row key you're trying to find the region of
IOException
- if a remote or network exception occursHRegionLocation locateRegion(byte[] regionName) throws IOException
regionName
- name of the region to locate
IOException
- if a remote or network exception occursList<HRegionLocation> locateRegions(byte[] tableName) throws IOException
tableName
- table to get regions of
IOException
List<HRegionLocation> locateRegions(byte[] tableName, boolean useCache, boolean offlined) throws IOException
tableName
- table to get regions ofuseCache
- Should we use the cache to retrieve the region information.offlined
- True if we are to include offlined regions, false and we'll leave out offlined
regions from returned list.
IOException
MasterAdminProtos.MasterAdminService.BlockingInterface getMasterAdmin() throws IOException
MasterAdminKeepAliveConnection
to the active master
IOException
MasterMonitorProtos.MasterMonitorService.BlockingInterface getMasterMonitor() throws IOException
MasterMonitorKeepAliveConnection
to the active master
IOException
AdminProtos.AdminService.BlockingInterface getAdmin(ServerName serverName) throws IOException
serverName
-
IOException
- if a remote or network exception occursClientProtos.ClientService.BlockingInterface getClient(ServerName serverName) throws IOException
serverName
-
IOException
- if a remote or network exception occursAdminProtos.AdminService.BlockingInterface getAdmin(ServerName serverName, boolean getMaster) throws IOException
serverName
- getMaster
- do we check if master is alive
IOException
- if a remote or network exception occursHRegionLocation getRegionLocation(byte[] tableName, byte[] row, boolean reload) throws IOException
tableName
- table namerow
- Row to find.reload
- If true do not use cache, otherwise bypass.
IOException
- if a remote or network exception occurs@Deprecated <T> T getRegionServerWithRetries(ServerCallable<T> callable) throws IOException, RuntimeException
T
- the type of the return valuecallable
- callable to run
IOException
- if a remote or network exception occurs
RuntimeException
- other unspecified error@Deprecated <T> T getRegionServerWithoutRetries(ServerCallable<T> callable) throws IOException, RuntimeException
T
- the type of the return valuecallable
- callable to run
IOException
- if a remote or network exception occurs
RuntimeException
- other unspecified error@Deprecated void processBatch(List<? extends Row> actions, byte[] tableName, ExecutorService pool, Object[] results) throws IOException, InterruptedException
HTableInterface.batch(java.util.List extends org.apache.hadoop.hbase.client.Row>, java.lang.Object[])
instead
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.
IOException
- if there are problems talking to META. Per-item
exceptions are stored in the results array.
InterruptedException
@Deprecated <R> void processBatchCallback(List<? extends Row> list, byte[] tableName, ExecutorService pool, Object[] results, Batch.Callback<R> callback) throws IOException, InterruptedException
HTableInterface.batchCallback(java.util.List extends org.apache.hadoop.hbase.client.Row>, java.lang.Object[], org.apache.hadoop.hbase.client.coprocessor.Batch.Callback)
instead
Row
implementations.
IOException
InterruptedException
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
int getCurrentNrHRS() throws IOException
IOException
- if a remote or network exception occursHTableDescriptor[] getHTableDescriptors(List<String> tableNames) throws IOException
tableNames
- List of table names
IOException
- if a remote or network exception occursboolean isClosed()
void clearCaches(ServerName sn)
sn
sn
- A server nameorg.apache.hadoop.hbase.client.MasterMonitorKeepAliveConnection getKeepAliveMasterMonitorService() throws MasterNotRunningException
MasterNotRunningException
org.apache.hadoop.hbase.client.MasterAdminKeepAliveConnection getKeepAliveMasterAdminService() throws MasterNotRunningException
MasterNotRunningException
boolean isDeadServer(ServerName serverName)
serverName
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |