@InterfaceAudience.Public @InterfaceStability.Evolving public interface HConnection extends Abortable, Closeable
HConnectionManager
manages instances of this
class. See it for how to get one of these.
This is NOT a connection to a particular server but to ALL servers in the cluster. Individual connections are managed 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
Modifier and Type | Field and Description |
---|---|
static String |
HBASE_CLIENT_CONNECTION_IMPL
Key for configuration in Configuration whose value is the class we implement making a
new HConnection instance.
|
Modifier and Type | Method and Description |
---|---|
void |
clearCaches(ServerName sn)
Clear any caches that pertain to server name
sn . |
void |
clearRegionCache()
Allows flushing the region cache.
|
void |
clearRegionCache(byte[] tableName)
Deprecated.
|
void |
clearRegionCache(TableName 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.
|
ClientBackoffPolicy |
getBackoffPolicy() |
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)
Deprecated.
|
HTableDescriptor |
getHTableDescriptor(TableName tableName) |
HTableDescriptor[] |
getHTableDescriptors(List<String> tableNames)
Deprecated.
|
HTableDescriptor[] |
getHTableDescriptorsByTableName(List<TableName> tableNames) |
org.apache.hadoop.hbase.client.MasterKeepAliveConnection |
getKeepAliveMasterService()
Deprecated.
Since 0.96.0
|
MasterProtos.MasterService.BlockingInterface |
getMaster()
Returns a
MasterKeepAliveConnection to the active master |
NonceGenerator |
getNonceGenerator() |
boolean |
getRegionCachePrefetch(byte[] tableName) |
boolean |
getRegionCachePrefetch(TableName tableName)
Check whether region cache prefetch is enabled or not.
|
HRegionLocation |
getRegionLocation(byte[] tableName,
byte[] row,
boolean reload)
Deprecated.
|
HRegionLocation |
getRegionLocation(TableName tableName,
byte[] row,
boolean reload)
Find region location hosting passed row
|
ServerStatisticTracker |
getStatisticsTracker() |
HTableInterface |
getTable(byte[] tableName)
Retrieve an HTableInterface implementation for access to a table.
|
HTableInterface |
getTable(byte[] tableName,
ExecutorService pool)
Retrieve an HTableInterface implementation for access to a table.
|
HTableInterface |
getTable(String tableName)
Retrieve an HTableInterface implementation for access to a table.
|
HTableInterface |
getTable(String tableName,
ExecutorService pool)
Retrieve an HTableInterface implementation for access to a table.
|
HTableInterface |
getTable(TableName tableName)
Retrieve an HTableInterface implementation for access to a table.
|
HTableInterface |
getTable(TableName tableName,
ExecutorService pool)
Retrieve an HTableInterface implementation for access to a table.
|
String[] |
getTableNames()
Deprecated.
|
boolean |
isClosed() |
boolean |
isDeadServer(ServerName serverName) |
boolean |
isMasterRunning() |
boolean |
isTableAvailable(byte[] tableName)
Deprecated.
|
boolean |
isTableAvailable(byte[] tableName,
byte[][] splitKeys)
Deprecated.
|
boolean |
isTableAvailable(TableName tableName) |
boolean |
isTableAvailable(TableName 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)
Deprecated.
|
boolean |
isTableDisabled(TableName tableName) |
boolean |
isTableEnabled(byte[] tableName)
Deprecated.
|
boolean |
isTableEnabled(TableName tableName)
A table that isTableEnabled == false and isTableDisabled == false
is possible.
|
TableName[] |
listTableNames() |
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)
Deprecated.
|
HRegionLocation |
locateRegion(TableName tableName,
byte[] row)
Find the location of the region of tableName that row
lives in.
|
List<HRegionLocation> |
locateRegions(byte[] tableName)
Deprecated.
|
List<HRegionLocation> |
locateRegions(byte[] tableName,
boolean useCache,
boolean offlined)
Deprecated.
|
List<HRegionLocation> |
locateRegions(TableName tableName)
Gets the locations of all regions in the specified table, tableName.
|
List<HRegionLocation> |
locateRegions(TableName 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.
|
void |
processBatch(List<? extends Row> actions,
TableName tableName,
ExecutorService pool,
Object[] results)
Deprecated.
|
<R> void |
processBatchCallback(List<? extends Row> list,
byte[] tableName,
ExecutorService pool,
Object[] results,
Batch.Callback<R> callback)
Deprecated.
|
<R> void |
processBatchCallback(List<? extends Row> list,
TableName tableName,
ExecutorService pool,
Object[] results,
Batch.Callback<R> callback)
|
HRegionLocation |
relocateRegion(byte[] tableName,
byte[] row)
Deprecated.
|
HRegionLocation |
relocateRegion(TableName 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) |
void |
setRegionCachePrefetch(TableName tableName,
boolean enable)
Enable or disable region cache prefetch for the table.
|
void |
updateCachedLocations(byte[] tableName,
byte[] rowkey,
Object exception,
HRegionLocation source)
Deprecated.
|
void |
updateCachedLocations(TableName tableName,
byte[] rowkey,
Object exception,
HRegionLocation source)
Update the location cache.
|
static final String HBASE_CLIENT_CONNECTION_IMPL
org.apache.hadoop.conf.Configuration getConfiguration()
HTableInterface getTable(String tableName) throws IOException
HConnectionManager.createConnection(Configuration)
).tableName
- IOException
HTableInterface getTable(byte[] tableName) throws IOException
HConnectionManager.createConnection(Configuration)
).tableName
- IOException
HTableInterface getTable(TableName tableName) throws IOException
HConnectionManager.createConnection(Configuration)
).tableName
- IOException
HTableInterface getTable(String tableName, ExecutorService pool) throws IOException
HConnectionManager.createConnection(Configuration)
).tableName
- pool
- The thread pool to use for batch operations, null to use a default pool.IOException
HTableInterface getTable(byte[] tableName, ExecutorService pool) throws IOException
HConnectionManager.createConnection(Configuration)
).tableName
- pool
- The thread pool to use for batch operations, null to use a default pool.IOException
HTableInterface getTable(TableName tableName, ExecutorService pool) throws IOException
HConnectionManager.createConnection(Configuration)
).tableName
- pool
- The thread pool to use for batch operations, null to use a default pool.IOException
boolean isMasterRunning() throws MasterNotRunningException, ZooKeeperConnectionException
MasterNotRunningException
ZooKeeperConnectionException
boolean isTableEnabled(TableName tableName) throws IOException
tableName
- table nameIOException
- if a remote or network exception occurs@Deprecated boolean isTableEnabled(byte[] tableName) throws IOException
IOException
boolean isTableDisabled(TableName tableName) throws IOException
tableName
- table nameIOException
- if a remote or network exception occurs@Deprecated boolean isTableDisabled(byte[] tableName) throws IOException
IOException
boolean isTableAvailable(TableName tableName) throws IOException
tableName
- table nameIOException
- if a remote or network exception occurs@Deprecated boolean isTableAvailable(byte[] tableName) throws IOException
IOException
boolean isTableAvailable(TableName tableName, byte[][] splitKeys) throws IOException
tableName
- tableNamesplitKeys
- splitKeys used while creating tableIOException
- if a remote or network exception occurs@Deprecated boolean isTableAvailable(byte[] tableName, byte[][] splitKeys) throws IOException
IOException
HTableDescriptor[] listTables() throws IOException
IOException
- if a remote or network exception occurs@Deprecated String[] getTableNames() throws IOException
IOException
TableName[] listTableNames() throws IOException
IOException
HTableDescriptor getHTableDescriptor(TableName tableName) throws IOException
tableName
- table nameIOException
- if a remote or network exception occurs@Deprecated HTableDescriptor getHTableDescriptor(byte[] tableName) throws IOException
IOException
HRegionLocation locateRegion(TableName tableName, byte[] row) throws IOException
tableName
- name of the table row is inrow
- row key you're trying to find the region ofIOException
- if a remote or network exception occurs@Deprecated HRegionLocation locateRegion(byte[] tableName, byte[] row) throws IOException
IOException
void clearRegionCache()
void clearRegionCache(TableName tableName)
tableName
tableName
- Name of the table whose regions we are to remove from
cache.@Deprecated void clearRegionCache(byte[] tableName)
void deleteCachedRegionLocation(HRegionLocation location)
location
- The location object for the region, to be purged from cache.HRegionLocation relocateRegion(TableName tableName, byte[] row) throws IOException
tableName
- name of the table row is inrow
- row key you're trying to find the region ofIOException
- if a remote or network exception occurs@Deprecated HRegionLocation relocateRegion(byte[] tableName, byte[] row) throws IOException
IOException
void updateCachedLocations(TableName tableName, byte[] rowkey, Object exception, HRegionLocation source)
tableName
- the table namerowkey
- the rowexception
- the exception if any. Can be null.source
- the previous location@Deprecated void updateCachedLocations(byte[] tableName, byte[] rowkey, Object exception, HRegionLocation source)
HRegionLocation locateRegion(byte[] regionName) throws IOException
regionName
- name of the region to locateIOException
- if a remote or network exception occursList<HRegionLocation> locateRegions(TableName tableName) throws IOException
tableName
- table to get regions ofIOException
@Deprecated List<HRegionLocation> locateRegions(byte[] tableName) throws IOException
IOException
List<HRegionLocation> locateRegions(TableName 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
@Deprecated List<HRegionLocation> locateRegions(byte[] tableName, boolean useCache, boolean offlined) throws IOException
IOException
MasterProtos.MasterService.BlockingInterface getMaster() throws IOException
MasterKeepAliveConnection
to the active masterIOException
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 aliveIOException
- if a remote or network exception occursHRegionLocation getRegionLocation(TableName 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 HRegionLocation getRegionLocation(byte[] tableName, byte[] row, boolean reload) throws IOException
IOException
@Deprecated void processBatch(List<? extends Row> actions, TableName tableName, ExecutorService pool, Object[] results) throws IOException, InterruptedException
HTableInterface.batch(java.util.List<? extends org.apache.hadoop.hbase.client.Row>, java.lang.Object[])
insteadactions
- 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 void processBatch(List<? extends Row> actions, byte[] tableName, ExecutorService pool, Object[] results) throws IOException, InterruptedException
IOException
InterruptedException
@Deprecated <R> void processBatchCallback(List<? extends Row> list, TableName 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<R>)
insteadRow
implementations.IOException
InterruptedException
@Deprecated <R> void processBatchCallback(List<? extends Row> list, byte[] tableName, ExecutorService pool, Object[] results, Batch.Callback<R> callback) throws IOException, InterruptedException
IOException
InterruptedException
void setRegionCachePrefetch(TableName tableName, boolean enable)
tableName
- name of table to configure.enable
- Set to true to enable region cache prefetch.void setRegionCachePrefetch(byte[] tableName, boolean enable)
boolean getRegionCachePrefetch(TableName tableName)
tableName
- name of table to checkboolean getRegionCachePrefetch(byte[] tableName)
int getCurrentNrHRS() throws IOException
IOException
- if a remote or network exception occursHTableDescriptor[] getHTableDescriptorsByTableName(List<TableName> tableNames) throws IOException
tableNames
- List of table namesIOException
- if a remote or network exception occurs@Deprecated HTableDescriptor[] getHTableDescriptors(List<String> tableNames) throws IOException
IOException
boolean isClosed()
void clearCaches(ServerName sn)
sn
.sn
- A server name@Deprecated org.apache.hadoop.hbase.client.MasterKeepAliveConnection getKeepAliveMasterService() throws MasterNotRunningException
MasterNotRunningException
boolean isDeadServer(ServerName serverName)
serverName
- NonceGenerator getNonceGenerator()
ServerStatisticTracker getStatisticsTracker()
ClientBackoffPolicy getBackoffPolicy()
Copyright © 2015 The Apache Software Foundation. All Rights Reserved.