public static class HConnectionManager.HConnectionImplementation extends Object implements HConnection, Closeable
| Modifier and Type | Field and Description |
|---|---|
protected String |
clusterId |
HBASE_CLIENT_CONNECTION_IMPL| Modifier | Constructor and Description |
|---|---|
protected |
HConnectionManager.HConnectionImplementation(org.apache.hadoop.conf.Configuration conf)
For tests.
|
| Modifier and Type | Method and Description |
|---|---|
void |
abort(String msg,
Throwable t)
Abort the server or client.
|
void |
clearCaches(ServerName serverName)
Clear any caches that pertain to server name
sn. |
void |
clearRegionCache()
Allows flushing the region cache.
|
void |
clearRegionCache(byte[] tableName) |
void |
clearRegionCache(TableName tableName)
Allows flushing the region cache of all locations that pertain to
tableName |
void |
close() |
protected <R> org.apache.hadoop.hbase.client.AsyncProcess |
createAsyncProcess(TableName tableName,
ExecutorService pool,
org.apache.hadoop.hbase.client.AsyncProcess.AsyncProcessCallback<R> callback,
org.apache.hadoop.conf.Configuration conf) |
void |
deleteCachedRegionLocation(HRegionLocation location)
Deletes cached locations for the specific region.
|
protected void |
finalize()
Close the connection for good, regardless of what the current value of
refCount is. |
AdminProtos.AdminService.BlockingInterface |
getAdmin(ServerName serverName)
Establishes a connection to the region server at the specified address.
|
AdminProtos.AdminService.BlockingInterface |
getAdmin(ServerName serverName,
boolean master)
Establishes a connection to the region server at the specified address.
|
ClientProtos.ClientService.BlockingInterface |
getClient(ServerName sn)
Establishes a connection to the region server at the specified address, and returns
a region client protocol.
|
org.apache.hadoop.conf.Configuration |
getConfiguration() |
protected ExecutorService |
getCurrentBatchPool() |
int |
getCurrentNrHRS() |
HTableDescriptor |
getHTableDescriptor(byte[] tableName) |
HTableDescriptor |
getHTableDescriptor(TableName tableName)
Connects to the master to get the table descriptor.
|
HTableDescriptor[] |
getHTableDescriptors(List<String> names) |
HTableDescriptor[] |
getHTableDescriptorsByTableName(List<TableName> tableNames) |
org.apache.hadoop.hbase.client.MasterKeepAliveConnection |
getKeepAliveMasterService()
This function allows HBaseAdmin and potentially others to get a shared MasterService
connection.
|
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) |
HRegionLocation |
getRegionLocation(TableName tableName,
byte[] row,
boolean reload)
Find region location hosting passed row
|
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() |
boolean |
isAborted()
Check if the server or client was aborted.
|
boolean |
isClosed() |
boolean |
isDeadServer(ServerName sn) |
boolean |
isMasterRunning() |
boolean |
isTableAvailable(byte[] tableName) |
boolean |
isTableAvailable(byte[] tableName,
byte[][] splitKeys) |
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) |
boolean |
isTableDisabled(TableName tableName) |
boolean |
isTableEnabled(byte[] tableName) |
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) |
HRegionLocation |
locateRegion(TableName tableName,
byte[] row)
Find the location of the region of tableName that row
lives in.
|
List<HRegionLocation> |
locateRegions(byte[] tableName) |
List<HRegionLocation> |
locateRegions(byte[] tableName,
boolean useCache,
boolean offlined) |
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> list,
byte[] tableName,
ExecutorService pool,
Object[] results)
Deprecated.
|
void |
processBatch(List<? extends Row> list,
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) |
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.
|
String |
toString()
An identifier that will remain the same for a given connection.
|
void |
updateCachedLocations(byte[] tableName,
byte[] rowkey,
Object exception,
HRegionLocation source) |
void |
updateCachedLocations(TableName tableName,
byte[] rowkey,
Object exception,
HRegionLocation source)
Update the location with the new value (if the exception is a RegionMovedException)
or delete it from the cache.
|
protected String clusterId
protected HConnectionManager.HConnectionImplementation(org.apache.hadoop.conf.Configuration conf)
public HTableInterface getTable(String tableName) throws IOException
HConnectionHConnectionManager.createConnection(Configuration)).getTable in interface HConnectionIOExceptionpublic HTableInterface getTable(byte[] tableName) throws IOException
HConnectionHConnectionManager.createConnection(Configuration)).getTable in interface HConnectionIOExceptionpublic HTableInterface getTable(TableName tableName) throws IOException
HConnectionHConnectionManager.createConnection(Configuration)).getTable in interface HConnectionIOExceptionpublic HTableInterface getTable(String tableName, ExecutorService pool) throws IOException
HConnectionHConnectionManager.createConnection(Configuration)).getTable in interface HConnectionpool - The thread pool to use for batch operations, null to use a default pool.IOExceptionpublic HTableInterface getTable(byte[] tableName, ExecutorService pool) throws IOException
HConnectionHConnectionManager.createConnection(Configuration)).getTable in interface HConnectionpool - The thread pool to use for batch operations, null to use a default pool.IOExceptionpublic HTableInterface getTable(TableName tableName, ExecutorService pool) throws IOException
HConnectionHConnectionManager.createConnection(Configuration)).getTable in interface HConnectionpool - The thread pool to use for batch operations, null to use a default pool.IOExceptionprotected ExecutorService getCurrentBatchPool()
public String toString()
public org.apache.hadoop.conf.Configuration getConfiguration()
getConfiguration in interface HConnectionpublic boolean isMasterRunning()
throws MasterNotRunningException,
ZooKeeperConnectionException
isMasterRunning in interface HConnectionMasterNotRunningException - - if the master is not runningZooKeeperConnectionExceptionpublic HRegionLocation getRegionLocation(TableName tableName, byte[] row, boolean reload) throws IOException
HConnectiongetRegionLocation in interface HConnectiontableName - table namerow - Row to find.reload - If true do not use cache, otherwise bypass.IOException - if a remote or network exception occurspublic HRegionLocation getRegionLocation(byte[] tableName, byte[] row, boolean reload) throws IOException
getRegionLocation in interface HConnectionIOExceptionpublic boolean isTableEnabled(TableName tableName) throws IOException
HConnectionisTableEnabled in interface HConnectiontableName - table nameIOException - if a remote or network exception occurspublic boolean isTableEnabled(byte[] tableName)
throws IOException
isTableEnabled in interface HConnectionIOExceptionpublic boolean isTableDisabled(TableName tableName) throws IOException
isTableDisabled in interface HConnectiontableName - table nameIOException - if a remote or network exception occurspublic boolean isTableDisabled(byte[] tableName)
throws IOException
isTableDisabled in interface HConnectionIOExceptionpublic boolean isTableAvailable(TableName tableName) throws IOException
isTableAvailable in interface HConnectiontableName - table nameIOException - if a remote or network exception occurspublic boolean isTableAvailable(byte[] tableName)
throws IOException
isTableAvailable in interface HConnectionIOExceptionpublic boolean isTableAvailable(TableName tableName, byte[][] splitKeys) throws IOException
HConnectionisTableAvailable in interface HConnectiontableName - tableNamesplitKeys - splitKeys used while creating tableIOException - if a remote or network exception occurspublic boolean isTableAvailable(byte[] tableName,
byte[][] splitKeys)
throws IOException
isTableAvailable in interface HConnectionIOExceptionpublic HRegionLocation locateRegion(byte[] regionName) throws IOException
HConnectionlocateRegion in interface HConnectionregionName - name of the region to locateIOException - if a remote or network exception occurspublic boolean isDeadServer(ServerName sn)
isDeadServer in interface HConnectionpublic List<HRegionLocation> locateRegions(TableName tableName) throws IOException
HConnectionlocateRegions in interface HConnectiontableName - table to get regions ofIOExceptionpublic List<HRegionLocation> locateRegions(byte[] tableName) throws IOException
locateRegions in interface HConnectionIOExceptionpublic List<HRegionLocation> locateRegions(TableName tableName, boolean useCache, boolean offlined) throws IOException
HConnectionlocateRegions in interface HConnectiontableName - 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.IOExceptionpublic List<HRegionLocation> locateRegions(byte[] tableName, boolean useCache, boolean offlined) throws IOException
locateRegions in interface HConnectionIOExceptionpublic HRegionLocation locateRegion(TableName tableName, byte[] row) throws IOException
HConnectionlocateRegion in interface HConnectiontableName - name of the table row is inrow - row key you're trying to find the region ofIOException - if a remote or network exception occurspublic HRegionLocation locateRegion(byte[] tableName, byte[] row) throws IOException
locateRegion in interface HConnectionIOExceptionpublic HRegionLocation relocateRegion(TableName tableName, byte[] row) throws IOException
HConnectionrelocateRegion in interface HConnectiontableName - name of the table row is inrow - row key you're trying to find the region ofIOException - if a remote or network exception occurspublic HRegionLocation relocateRegion(byte[] tableName, byte[] row) throws IOException
relocateRegion in interface HConnectionIOExceptionpublic void clearCaches(ServerName serverName)
HConnectionsn.clearCaches in interface HConnectionserverName - A server namepublic void clearRegionCache()
HConnectionclearRegionCache in interface HConnectionpublic void clearRegionCache(TableName tableName)
HConnectiontableNameclearRegionCache in interface HConnectiontableName - Name of the table whose regions we are to remove from
cache.public void clearRegionCache(byte[] tableName)
clearRegionCache in interface HConnectionpublic AdminProtos.AdminService.BlockingInterface getAdmin(ServerName serverName) throws IOException
HConnectiongetAdmin in interface HConnectionIOException - if a remote or network exception occurspublic AdminProtos.AdminService.BlockingInterface getAdmin(ServerName serverName, boolean master) throws IOException
HConnectiongetAdmin in interface HConnectionmaster - do we check if master is aliveIOException - if a remote or network exception occurspublic ClientProtos.ClientService.BlockingInterface getClient(ServerName sn) throws IOException
HConnectiongetClient in interface HConnectionIOException - if a remote or network exception occurspublic MasterProtos.MasterService.BlockingInterface getMaster() throws MasterNotRunningException
HConnectionMasterKeepAliveConnection to the active mastergetMaster in interface HConnectionMasterNotRunningExceptionpublic org.apache.hadoop.hbase.client.MasterKeepAliveConnection getKeepAliveMasterService()
throws MasterNotRunningException
HConnectiongetKeepAliveMasterService in interface HConnectionMasterNotRunningExceptionpublic void deleteCachedRegionLocation(HRegionLocation location)
HConnectiondeleteCachedRegionLocation in interface HConnectionlocation - The location object for the region, to be purged from cache.public void updateCachedLocations(TableName tableName, byte[] rowkey, Object exception, HRegionLocation source)
updateCachedLocations in interface HConnectionexception - an object (to simplify user code) on which we will try to find a nested
or wrapped or both RegionMovedExceptionsource - server that is the source of the location update.tableName - the table namerowkey - the rowpublic void updateCachedLocations(byte[] tableName,
byte[] rowkey,
Object exception,
HRegionLocation source)
updateCachedLocations in interface HConnection@Deprecated public void processBatch(List<? extends Row> list, TableName tableName, ExecutorService pool, Object[] results) throws IOException, InterruptedException
HConnectionprocessBatch in interface HConnectionlist - 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 public void processBatch(List<? extends Row> list, byte[] tableName, ExecutorService pool, Object[] results) throws IOException, InterruptedException
processBatch in interface HConnectionIOExceptionInterruptedException@Deprecated public <R> void processBatchCallback(List<? extends Row> list, TableName tableName, ExecutorService pool, Object[] results, Batch.Callback<R> callback) throws IOException, InterruptedException
HTable.processBatchCallback(java.util.List<? extends org.apache.hadoop.hbase.client.Row>, java.lang.Object[], org.apache.hadoop.hbase.client.coprocessor.Batch.Callback<R>) insteadprocessBatchCallback in interface HConnectionIOExceptionInterruptedException@Deprecated public <R> void processBatchCallback(List<? extends Row> list, byte[] tableName, ExecutorService pool, Object[] results, Batch.Callback<R> callback) throws IOException, InterruptedException
processBatchCallback in interface HConnectionIOExceptionInterruptedExceptionprotected <R> org.apache.hadoop.hbase.client.AsyncProcess createAsyncProcess(TableName tableName, ExecutorService pool, org.apache.hadoop.hbase.client.AsyncProcess.AsyncProcessCallback<R> callback, org.apache.hadoop.conf.Configuration conf)
public void setRegionCachePrefetch(TableName tableName, boolean enable)
HConnectionsetRegionCachePrefetch in interface HConnectiontableName - name of table to configure.enable - Set to true to enable region cache prefetch.public void setRegionCachePrefetch(byte[] tableName,
boolean enable)
setRegionCachePrefetch in interface HConnectionpublic boolean getRegionCachePrefetch(TableName tableName)
HConnectiongetRegionCachePrefetch in interface HConnectiontableName - name of table to checkpublic boolean getRegionCachePrefetch(byte[] tableName)
getRegionCachePrefetch in interface HConnectionpublic void abort(String msg, Throwable t)
Abortablepublic boolean isClosed()
isClosed in interface HConnectionpublic boolean isAborted()
Abortablepublic int getCurrentNrHRS()
throws IOException
getCurrentNrHRS in interface HConnectionIOException - if a remote or network exception occurspublic void close()
close in interface Closeableclose in interface AutoCloseableprotected void finalize()
throws Throwable
refCount is. Ideally, refCount should be zero at this
point, which would be the case if all of its consumers close the
connection. However, on the off chance that someone is unable to close
the connection, perhaps because it bailed out prematurely, the method
below will ensure that this HConnection instance is cleaned up.
Caveat: The JVM may take an unknown amount of time to call finalize on an
unreachable object, so our hope is that every consumer cleans up after
itself, like any good citizen.public HTableDescriptor[] listTables() throws IOException
HConnectionlistTables in interface HConnectionIOException - if a remote or network exception occurspublic String[] getTableNames() throws IOException
getTableNames in interface HConnectionIOExceptionpublic TableName[] listTableNames() throws IOException
listTableNames in interface HConnectionIOExceptionpublic HTableDescriptor[] getHTableDescriptorsByTableName(List<TableName> tableNames) throws IOException
getHTableDescriptorsByTableName in interface HConnectiontableNames - List of table namesIOException - if a remote or network exception occurspublic HTableDescriptor[] getHTableDescriptors(List<String> names) throws IOException
getHTableDescriptors in interface HConnectionIOExceptionpublic NonceGenerator getNonceGenerator()
getNonceGenerator in interface HConnectionpublic HTableDescriptor getHTableDescriptor(TableName tableName) throws IOException
getHTableDescriptor in interface HConnectiontableName - table nameIOException - if the connection to master fails or if the table
is not found.public HTableDescriptor getHTableDescriptor(byte[] tableName) throws IOException
getHTableDescriptor in interface HConnectionIOExceptionCopyright © 2014 The Apache Software Foundation. All rights reserved.