Package org.apache.hadoop.hbase.client
Class ConnectionImplementation
java.lang.Object
org.apache.hadoop.hbase.client.ConnectionImplementation
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Abortable
,ClusterConnection
,Connection
- Direct Known Subclasses:
ConnectionUtils.MasterlessConnection
,ServerConnectionUtils.ShortCircuitingClusterConnection
@Private
public class ConnectionImplementation
extends Object
implements ClusterConnection, Closeable
Main implementation of
Connection
and ClusterConnection
interfaces. Encapsulates
connection to zookeeper and regionservers.-
Nested Class Summary
Modifier and TypeClassDescriptionprivate static class
LikeConnectionClosedException
but thrown from the checkClosed call which looks at the local this.closed flag.(package private) static class
State of the MasterService connection/setup.private final class
Class to make a MasterServiceStubMaker stub.(package private) static class
The record of errors for servers. -
Field Summary
Modifier and TypeFieldDescriptionprivate boolean
private final String
Allow setting an alternate BufferedMutator implementation via config.private final AsyncProcess
private final ClientBackoffPolicy
private ThreadPoolExecutor
private ChoreService
private boolean
private boolean
protected String
(package private) ClusterStatusListener
private final org.apache.hadoop.conf.Configuration
private final ConnectionConfiguration
private final RetryingCallerInterceptor
private static final org.slf4j.Logger
static final String
private final Object
(package private) final ConnectionImplementation.MasterServiceState
Supplier to get masterState.By default uses simple supplier without TTL cache.private final MetaCache
private ThreadPoolExecutor
private final Object
private final int
private CatalogReplicaMode
private final MetricsConnection
private String
private static NonceGenerator
Global nonceGenerator shared per client.private static final Object
The nonce generator lock.private final int
private final ConnectionRegistry
Cluster registry of basic info such as clusterid and meta region location.static final String
private final RpcRetryingCallerFactory
private final RpcClient
private final RpcControllerFactory
(package private) final int
private final ServerStatisticTracker
private final ConcurrentMap<String,
Object> protected User
private final ReentrantLock
lock guards against multiple threads trying to query the meta region at the same timeFields inherited from interface org.apache.hadoop.hbase.client.ClusterConnection
HBASE_CLIENT_CONNECTION_IMPL
-
Constructor Summary
ConstructorDescriptionConnectionImplementation
(org.apache.hadoop.conf.Configuration conf, ExecutorService pool, User user) constructorConnectionImplementation
(org.apache.hadoop.conf.Configuration conf, ExecutorService pool, User user, Map<String, byte[]> connectionAttributes) constructorConnectionImplementation
(org.apache.hadoop.conf.Configuration conf, ExecutorService pool, User user, ConnectionRegistry registry) Constructor, for creating cluster connection with provided ConnectionRegistry.ConnectionImplementation
(org.apache.hadoop.conf.Configuration conf, ExecutorService pool, User user, ConnectionRegistry registry, Map<String, byte[]> connectionAttributes) Constructor, for creating cluster connection with provided ConnectionRegistry. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Abort the server or client.void
cacheLocation
(TableName tableName, RegionLocations location) Put a newly discovered HRegionLocation into the cache.private void
cacheLocation
(TableName tableName, ServerName source, HRegionLocation location) Put a newly discovered HRegionLocation into the cache.private void
void
clearCaches
(ServerName serverName) Clear any caches that pertain to server namesn
.void
clearRegionCache
(TableName tableName) Allows flushing the region cache of all locations that pertain totableName
void
clearRegionCache
(TableName tableName, byte[] row) void
Clear all the entries in the region location cache, for all the tables.void
close()
private void
Immediate close of the shared master.private void
protected void
finalize()
Close the connection for good.private static <T> T
get
(CompletableFuture<T> future) getAdmin()
Retrieve an Admin implementation to administer an HBase cluster.org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.BlockingInterface
getAdmin
(ServerName serverName) Establishes a connection to the region server at the specified address.org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.BlockingInterface
Get the admin service for master.getAllBootstrapNodes
(ServerName regionServer) Get the bootstrap node list of another region server.Returns Default AsyncProcess associated with this connection.Returns the configured client backoff policyprivate ThreadPoolExecutor
Retrieve aBufferedMutator
for performing client-side buffering of writes.getBufferedMutator
(TableName tableName) Retrieve aBufferedMutator
for performing client-side buffering of writes.(package private) RegionLocations
getCachedLocation
(TableName tableName, byte[] row) Search the cache for a location that fits our table and row key.(package private) ChoreService
If choreService has not been created yet, create the ChoreService.org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.BlockingInterface
getClient
(ServerName serverName) Establishes a connection to the region server at the specified address, and returns a region client protocol.Returns the cluster ID unique to this HBase cluster.org.apache.hadoop.conf.Configuration
Returns Configuration instance being used by this Connection instance.Returns a ConnectionConfiguration object holding parsed configuration valuesReturns the MetricsConnection instance associated with this connection.Get theConnectionRegistry
used to orient this cluster.protected ExecutorService
protected ExecutorService
getHbck()
Retrieve an Hbck implementation to fix an HBase cluster.getHbck
(ServerName masterServer) Retrieve an Hbck implementation to fix an HBase cluster.private MasterKeepAliveConnection
getLiveRegionServers
(Supplier<ServerName> masterAddrTracker, int count) Get live region servers from masters.Returns aMasterKeepAliveConnection
to the active master(package private) ConnectionImplementation.MasterServiceState
Visible for testsprivate ThreadPoolExecutor
getNewRpcRetryingCallerFactory
(org.apache.hadoop.conf.Configuration conf) Returns a new RpcRetryingCallerFactory from the givenConfiguration
.Returns Nonce generator for this ClusterConnection; may be null if disabled in configuration.(package private) int
getNumberOfCachedRegionLocations
(TableName tableName) getRegionLocation
(TableName tableName, byte[] row, boolean reload) Find region location hosting passed rowgetRegionLocator
(TableName tableName) Retrieve a RegionLocator implementation to inspect region information on a table.(package private) RpcClient
For tests only.Returns Connection's RpcControllerFactory instanceReturns Connection's RpcRetryingCallerFactory instanceReturns the current statistics tracker associated with this connectionRetrieve a Table implementation for accessing a table.getTableBuilder
(TableName tableName, ExecutorService pool) Returns anTableBuilder
for creatingTable
.getTableState
(TableName tableName) Retrieve TableState, represent current table state.private ThreadPoolExecutor
getThreadPool
(int maxThreads, int coreThreads, String nameHint, BlockingQueue<Runnable> passedWorkQueue) getUser()
Get theUser
associated with this connection.boolean
Returns true when this connection uses aCodec
and so supports cell blocks.(package private) static NonceGenerator
boolean
Check if the server or client was aborted.boolean
isClosed()
Returns whether the connection is closed or not.private boolean
private boolean
boolean
Deprecated.this has been deprecated without a replacementboolean
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
(TableName tableName) Check if a table is disabled.boolean
isTableEnabled
(TableName tableName) A table that isTableEnabled == false and isTableDisabled == false is possible.private RegionLocations
locateMeta
(TableName tableName, boolean useCache, int replicaId) locateRegion
(byte[] regionName) Gets the location of the region of regionName.locateRegion
(TableName tableName, byte[] row) Find the location of the region of tableName that row lives in.locateRegion
(TableName tableName, byte[] row, boolean useCache, boolean retry) Gets the locations of the region in the specified table, tableName, for a given row.locateRegion
(TableName tableName, byte[] row, boolean useCache, boolean retry, int replicaId) Gets the locations of the region in the specified table, tableName, for a given row.private RegionLocations
locateRegionInMeta
(TableName tableName, byte[] row, boolean useCache, boolean retry, int replicaId) Search the hbase:meta table for the HRegionLocation info that contains the table and row we're seeking.locateRegions
(TableName tableName) Gets the locations of all regions in the specified table, tableName.locateRegions
(TableName tableName, boolean useCache, boolean offlined) Gets the locations of all regions in the specified table, tableName.Visible for testsprivate static void
(package private) void
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.relocateRegion
(TableName tableName, byte[] row, int replicaId) Find the location of the region of tableName that row lives in, ignoring any value that might be in the cache.private void
protected void
private void
private void
private void
spawnRenewalChore
(org.apache.hadoop.security.UserGroupInformation user) (package private) void
toString()
An identifier that will remain the same for a given connection.(package private) void
updateCachedLocation
(RegionInfo hri, ServerName source, ServerName serverName, long seqNum) void
updateCachedLocations
(TableName tableName, byte[] regionName, byte[] rowkey, Object exception, ServerName source) Update the location with the new value (if the exception is a RegionMovedException) or delete it from the cache.Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.hadoop.hbase.client.ClusterConnection
clearRegionCache
Methods inherited from interface org.apache.hadoop.hbase.client.Connection
getTable
-
Field Details
-
RETRIES_BY_SERVER_KEY
- See Also:
-
MASTER_STATE_CACHE_TIMEOUT_SEC
- See Also:
-
LOG
-
metaReplicaMode
-
metaReplicaSelector
-
metaReplicaCallTimeoutScanInMicroSecond
-
numTries
-
rpcTimeout
-
nonceGenerator
Global nonceGenerator shared per client. Currently there's no reason to limit its scope. Once it's set under nonceGeneratorCreateLock, it is never unset or changed. -
nonceGeneratorCreateLock
The nonce generator lock. Only taken when creating Connection, which gets a private copy. -
asyncProcess
-
stats
-
closed
-
aborted
-
clusterStatusListener
-
metaRegionLock
-
masterLock
-
batchPool
-
metaLookupPool
-
cleanupPool
-
conf
-
connectionConfig
-
rpcClient
-
metaCache
-
metricsScope
-
metrics
-
user
-
rpcCallerFactory
-
rpcControllerFactory
-
interceptor
-
registry
Cluster registry of basic info such as clusterid and meta region location. -
backoffPolicy
-
alternateBufferedMutatorClassName
Allow setting an alternate BufferedMutator implementation via config. If null, use default. -
userRegionLock
lock guards against multiple threads trying to query the meta region at the same time -
masterStateSupplier
Supplier to get masterState.By default uses simple supplier without TTL cache. When hbase.client.master.state.cache.timeout.sec > 0 it uses TTL Cache. -
choreService
-
clusterId
-
stubs
-
masterServiceState
-
-
Constructor Details
-
ConnectionImplementation
ConnectionImplementation(org.apache.hadoop.conf.Configuration conf, ExecutorService pool, User user) throws IOException constructor- Parameters:
conf
- Configuration object- Throws:
IOException
-
ConnectionImplementation
ConnectionImplementation(org.apache.hadoop.conf.Configuration conf, ExecutorService pool, User user, Map<String, byte[]> connectionAttributes) throws IOExceptionconstructor- Parameters:
conf
- Configuration object- Throws:
IOException
-
ConnectionImplementation
ConnectionImplementation(org.apache.hadoop.conf.Configuration conf, ExecutorService pool, User user, ConnectionRegistry registry) throws IOException Constructor, for creating cluster connection with provided ConnectionRegistry.- Throws:
IOException
-
ConnectionImplementation
ConnectionImplementation(org.apache.hadoop.conf.Configuration conf, ExecutorService pool, User user, ConnectionRegistry registry, Map<String, byte[]> connectionAttributes) throws IOExceptionConstructor, for creating cluster connection with provided ConnectionRegistry.- Throws:
IOException
-
-
Method Details
-
masterConnectionStateSupplier
Visible for tests -
spawnRenewalChore
-
injectNonceGeneratorForTesting
- Parameters:
conn
- The connection for which to replace the generator.cnm
- Replaces the nonce generator used, for testing.- Returns:
- old nonce generator.
-
getTable
Description copied from interface:Connection
Retrieve a Table implementation for accessing a table. The returned Table is not thread safe, a new instance should be created for each using thread. This is a lightweight operation, pooling or caching of the returned Table is neither required nor desired.The caller is responsible for calling
Table.close()
on the returned table instance.Since 0.98.1 this method no longer checks table existence. An exception will be thrown if the table does not exist only when the first operation is attempted.
- Specified by:
getTable
in interfaceConnection
- Parameters:
tableName
- the name of the table- Returns:
- a Table to use for interactions with this table
- Throws:
IOException
-
getTableBuilder
Description copied from interface:Connection
Returns anTableBuilder
for creatingTable
.- Specified by:
getTableBuilder
in interfaceConnection
- Parameters:
tableName
- the name of the tablepool
- the thread pool to use for requests like batch and scan
-
getBufferedMutator
Description copied from interface:Connection
Retrieve aBufferedMutator
for performing client-side buffering of writes. TheBufferedMutator
returned by this method is thread-safe. This object can be used for long lived table operations. If user passes ThreadPool in BufferedMutatorParams then we will use that otherwise we will create for the user. For user specified ThreadPool, it is the user's responsibility to shutdown. For ThreadPool created by us, we will shutdown when user callsBufferedMutator.close()
. The caller is responsible for callingBufferedMutator.close()
on the returnedBufferedMutator
instance.- Specified by:
getBufferedMutator
in interfaceConnection
- Parameters:
params
- details on how to instantiate theBufferedMutator
.- Returns:
- a
BufferedMutator
for the supplied tableName.
-
getBufferedMutator
Description copied from interface:Connection
Retrieve a
BufferedMutator
for performing client-side buffering of writes. TheBufferedMutator
returned by this method is thread-safe. This accessor will create a new ThreadPoolExecutor and will be shutdown once we close the BufferedMutator. This object can be used for long lived operations.The caller is responsible for calling
BufferedMutator.close()
on the returnedBufferedMutator
instance.- Specified by:
getBufferedMutator
in interfaceConnection
- Parameters:
tableName
- the name of the table- Returns:
- a
BufferedMutator
for the supplied tableName.
-
getRegionLocator
Description copied from interface:Connection
Retrieve a RegionLocator implementation to inspect region information on a table. The returned RegionLocator is not thread-safe, so a new instance should be created for each using thread. This is a lightweight operation. Pooling or caching of the returned RegionLocator is neither required nor desired.
The caller is responsible for callingCloseable.close()
on the returned RegionLocator instance. RegionLocator needs to be unmanaged- Specified by:
getRegionLocator
in interfaceConnection
- Parameters:
tableName
- Name of the table who's region is to be examined- Returns:
- A RegionLocator instance
- Throws:
IOException
-
getAdmin
Description copied from interface:Connection
Retrieve an Admin implementation to administer an HBase cluster. The returned Admin is not guaranteed to be thread-safe. A new instance should be created for each using thread. This is a lightweight operation. Pooling or caching of the returned Admin is not recommended.
The caller is responsible for callingAdmin.close()
on the returned Admin instance.- Specified by:
getAdmin
in interfaceConnection
- Returns:
- an Admin instance for cluster administration
- Throws:
IOException
-
getHbck
Description copied from interface:Connection
Retrieve an Hbck implementation to fix an HBase cluster. The returned Hbck is not guaranteed to be thread-safe. A new instance should be created by each thread. This is a lightweight operation. Pooling or caching of the returned Hbck instance is not recommended.
The caller is responsible for callingCloseable.close()
on the returned Hbck instance.
This will be used mostly by hbck tool.- Specified by:
getHbck
in interfaceConnection
- Returns:
- an Hbck instance for active master. Active master is fetched from the zookeeper.
- Throws:
IOException
-
getHbck
Description copied from interface:Connection
Retrieve an Hbck implementation to fix an HBase cluster. The returned Hbck is not guaranteed to be thread-safe. A new instance should be created by each thread. This is a lightweight operation. Pooling or caching of the returned Hbck instance is not recommended.
The caller is responsible for callingCloseable.close()
on the returned Hbck instance.
This will be used mostly by hbck tool. This may only be used to by pass getting registered master from ZK. In situations where ZK is not available or active master is not registered with ZK and user can get master address by other means, master can be explicitly specified.- Specified by:
getHbck
in interfaceConnection
- Parameters:
masterServer
- explicitServerName
for master server- Returns:
- an Hbck instance for a specified master server
- Throws:
IOException
-
getConnectionMetrics
Description copied from interface:ClusterConnection
Returns the MetricsConnection instance associated with this connection.- Specified by:
getConnectionMetrics
in interfaceClusterConnection
-
getUser
Description copied from interface:ClusterConnection
Get theUser
associated with this connection. May benull
.- Specified by:
getUser
in interfaceClusterConnection
-
getConnectionRegistry
Description copied from interface:ClusterConnection
Get theConnectionRegistry
used to orient this cluster.- Specified by:
getConnectionRegistry
in interfaceClusterConnection
-
getBatchPool
-
getThreadPool
private ThreadPoolExecutor getThreadPool(int maxThreads, int coreThreads, String nameHint, BlockingQueue<Runnable> passedWorkQueue) -
getMetaLookupPool
-
getCurrentMetaLookupPool
-
getCurrentBatchPool
-
shutdownPools
-
shutdownBatchPool
-
getRpcClient
For tests only. -
toString
An identifier that will remain the same for a given connection. -
retrieveClusterId
-
getChoreService
If choreService has not been created yet, create the ChoreService. -
getConfiguration
Description copied from interface:Connection
Returns Configuration instance being used by this Connection instance.- Specified by:
getConfiguration
in interfaceConnection
-
checkClosed
-
isMasterRunning
@Deprecated public boolean isMasterRunning() throws MasterNotRunningException, ZooKeeperConnectionExceptionDeprecated.this has been deprecated without a replacement- Specified by:
isMasterRunning
in interfaceClusterConnection
- Returns:
- true if the master is running, throws an exception otherwise
- Throws:
MasterNotRunningException
- - if the master is not runningZooKeeperConnectionException
-
getRegionLocation
public HRegionLocation getRegionLocation(TableName tableName, byte[] row, boolean reload) throws IOException Description copied from interface:ClusterConnection
Find region location hosting passed row- Specified by:
getRegionLocation
in interfaceClusterConnection
- Parameters:
tableName
- table namerow
- Row to find.reload
- If true do not use cache, otherwise bypass.- Returns:
- Location of row.
- Throws:
IOException
- if a remote or network exception occurs
-
isTableEnabled
Description copied from interface:ClusterConnection
A table that isTableEnabled == false and isTableDisabled == false is possible. This happens when a table has a lot of regions that must be processed.- Specified by:
isTableEnabled
in interfaceClusterConnection
- Parameters:
tableName
- table name- Returns:
- true if the table is enabled, false otherwise
- Throws:
IOException
- if a remote or network exception occurs
-
isTableDisabled
Description copied from interface:ClusterConnection
Check if a table is disabled.- Specified by:
isTableDisabled
in interfaceClusterConnection
- Parameters:
tableName
- table name- Returns:
- true if the table is disabled, false otherwise
- Throws:
IOException
- if a remote or network exception occurs
-
isTableAvailable
public boolean isTableAvailable(TableName tableName, @Nullable byte[][] splitKeys) throws IOException Description copied from interface:ClusterConnection
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. Note : If this api is used after a table's region gets splitted, the api may return false. tableName splitKeys used while creating table if a remote or network exception occurs- Specified by:
isTableAvailable
in interfaceClusterConnection
- Throws:
IOException
-
locateRegion
Description copied from interface:ClusterConnection
Gets the location of the region of regionName.- Specified by:
locateRegion
in interfaceClusterConnection
- Parameters:
regionName
- name of the region to locate- Returns:
- HRegionLocation that describes where to find the region in question
- Throws:
IOException
- if a remote or network exception occurs
-
isDeadServer
-
locateRegions
Description copied from interface:ClusterConnection
Gets the locations of all regions in the specified table, tableName.- Specified by:
locateRegions
in interfaceClusterConnection
- Parameters:
tableName
- table to get regions of- Returns:
- list of region locations for all regions of table
- Throws:
IOException
- if IO failure occurs
-
locateRegions
public List<HRegionLocation> locateRegions(TableName tableName, boolean useCache, boolean offlined) throws IOException Description copied from interface:ClusterConnection
Gets the locations of all regions in the specified table, tableName.- Specified by:
locateRegions
in interfaceClusterConnection
- Parameters:
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.- Returns:
- list of region locations for all regions of table
- Throws:
IOException
- if IO failure occurs
-
locateRegion
Description copied from interface:ClusterConnection
Find the location of the region of tableName that row lives in.- Specified by:
locateRegion
in interfaceClusterConnection
- Parameters:
tableName
- name of the table row is inrow
- row key you're trying to find the region of- Returns:
- HRegionLocation that describes where to find the region in question
- Throws:
IOException
- if a remote or network exception occurs
-
relocateRegion
Description copied from interface:ClusterConnection
Find the location of the region of tableName that row lives in, ignoring any value that might be in the cache.- Specified by:
relocateRegion
in interfaceClusterConnection
- Parameters:
tableName
- name of the table row is inrow
- row key you're trying to find the region of- Returns:
- HRegionLocation that describes where to find the region in question
- Throws:
IOException
- if a remote or network exception occurs
-
relocateRegion
public RegionLocations relocateRegion(TableName tableName, byte[] row, int replicaId) throws IOException Description copied from interface:ClusterConnection
Find the location of the region of tableName that row lives in, ignoring any value that might be in the cache.- Specified by:
relocateRegion
in interfaceClusterConnection
- Parameters:
tableName
- name of the table row is inrow
- row key you're trying to find the region ofreplicaId
- the replicaId of the region- Returns:
- RegionLocations that describe where to find the region in question
- Throws:
IOException
- if a remote or network exception occurs
-
locateRegion
public RegionLocations locateRegion(TableName tableName, byte[] row, boolean useCache, boolean retry) throws IOException Description copied from interface:ClusterConnection
Gets the locations of the region in the specified table, tableName, for a given row.- Specified by:
locateRegion
in interfaceClusterConnection
- Parameters:
tableName
- table to get regions ofrow
- the rowuseCache
- Should we use the cache to retrieve the region information.retry
- do we retry- Returns:
- region locations for this row.
- Throws:
IOException
- if IO failure occurs
-
locateRegion
public RegionLocations locateRegion(TableName tableName, byte[] row, boolean useCache, boolean retry, int replicaId) throws IOException Description copied from interface:ClusterConnection
Gets the locations of the region in the specified table, tableName, for a given row.- Specified by:
locateRegion
in interfaceClusterConnection
- Parameters:
tableName
- table to get regions ofrow
- the rowuseCache
- Should we use the cache to retrieve the region information.retry
- do we retryreplicaId
- the replicaId for the region- Returns:
- region locations for this row.
- Throws:
IOException
- if IO failure occurs
-
locateMeta
private RegionLocations locateMeta(TableName tableName, boolean useCache, int replicaId) throws IOException - Throws:
IOException
-
locateRegionInMeta
private RegionLocations locateRegionInMeta(TableName tableName, byte[] row, boolean useCache, boolean retry, int replicaId) throws IOException Search the hbase:meta table for the HRegionLocation info that contains the table and row we're seeking.- Throws:
IOException
-
takeUserRegionLock
- Throws:
IOException
-
cacheLocation
Put a newly discovered HRegionLocation into the cache.- Specified by:
cacheLocation
in interfaceClusterConnection
- Parameters:
tableName
- The table name.location
- the new location
-
getCachedLocation
Search the cache for a location that fits our table and row key. Return null if no suitable region is located.- Returns:
- Null or region location found in cache.
-
clearRegionCache
-
clearCaches
Description copied from interface:ClusterConnection
Clear any caches that pertain to server namesn
.- Specified by:
clearCaches
in interfaceClusterConnection
- Parameters:
serverName
- A server name
-
clearRegionLocationCache
Description copied from interface:Connection
Clear all the entries in the region location cache, for all the tables. If you only want to clear the cache for a specific table, useRegionLocator.clearRegionLocationCache()
. This may cause performance issue so use it with caution.- Specified by:
clearRegionLocationCache
in interfaceConnection
-
clearRegionCache
Description copied from interface:ClusterConnection
Allows flushing the region cache of all locations that pertain totableName
- Specified by:
clearRegionCache
in interfaceClusterConnection
- Parameters:
tableName
- Name of the table whose regions we are to remove from cache.
-
cacheLocation
Put a newly discovered HRegionLocation into the cache.- Parameters:
tableName
- The table name.source
- the source of the new location, if it's not coming from metalocation
- the new location
-
getAdminForMaster
public org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.BlockingInterface getAdminForMaster() throws IOExceptionDescription copied from interface:ClusterConnection
Get the admin service for master.- Specified by:
getAdminForMaster
in interfaceClusterConnection
- Throws:
IOException
-
getAdmin
public org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.BlockingInterface getAdmin(ServerName serverName) throws IOException Description copied from interface:ClusterConnection
Establishes a connection to the region server at the specified address.- Specified by:
getAdmin
in interfaceClusterConnection
- Parameters:
serverName
- the region server to connect to- Returns:
- proxy for HRegionServer
- Throws:
IOException
- if a remote or network exception occurs
-
getClient
public org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.BlockingInterface getClient(ServerName serverName) throws IOException Description copied from interface:ClusterConnection
Establishes a connection to the region server at the specified address, and returns a region client protocol.- Specified by:
getClient
in interfaceClusterConnection
- Parameters:
serverName
- the region server to connect to- Returns:
- ClientProtocol proxy for RegionServer
- Throws:
IOException
- if a remote or network exception occurs
-
getMasterServiceState
Visible for tests -
getMaster
Description copied from interface:ClusterConnection
Returns aMasterKeepAliveConnection
to the active master- Specified by:
getMaster
in interfaceClusterConnection
- Throws:
IOException
-
resetMasterServiceState
-
getKeepAliveMasterService
- Throws:
IOException
-
release
-
isKeepAliveMasterConnectedAndRunning
-
releaseMaster
-
closeMasterService
-
closeMaster
Immediate close of the shared master. Can be by the delayed close or when closing the connection itself. -
updateCachedLocation
-
updateCachedLocations
public void updateCachedLocations(TableName tableName, byte[] regionName, byte[] rowkey, Object exception, ServerName source) Update the location with the new value (if the exception is a RegionMovedException) or delete it from the cache. Does nothing if we can be sure from the exception that the location is still accurate, or if the cache has already been updated.- Specified by:
updateCachedLocations
in interfaceClusterConnection
- Parameters:
exception
- 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 nameregionName
- the region namerowkey
- the row
-
getAsyncProcess
Description copied from interface:ClusterConnection
Returns Default AsyncProcess associated with this connection.- Specified by:
getAsyncProcess
in interfaceClusterConnection
-
getStatisticsTracker
Description copied from interface:ClusterConnection
Returns the current statistics tracker associated with this connection- Specified by:
getStatisticsTracker
in interfaceClusterConnection
-
getBackoffPolicy
Description copied from interface:ClusterConnection
Returns the configured client backoff policy- Specified by:
getBackoffPolicy
in interfaceClusterConnection
-
getNumberOfCachedRegionLocations
-
abort
Description copied from interface:Abortable
Abort the server or client. -
isClosed
Description copied from interface:Connection
Returns whether the connection is closed or not.- Specified by:
isClosed
in interfaceConnection
- Returns:
- true if this connection is closed
-
isAborted
Description copied from interface:Abortable
Check if the server or client was aborted. -
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceConnection
-
finalize
Close the connection for good. 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 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. -
getNonceGenerator
Description copied from interface:ClusterConnection
Returns Nonce generator for this ClusterConnection; may be null if disabled in configuration.- Specified by:
getNonceGenerator
in interfaceClusterConnection
-
getTableState
Description copied from interface:ClusterConnection
Retrieve TableState, represent current table state.- Specified by:
getTableState
in interfaceClusterConnection
- Parameters:
tableName
- table state for- Returns:
- state of the table
- Throws:
IOException
-
getNewRpcRetryingCallerFactory
public RpcRetryingCallerFactory getNewRpcRetryingCallerFactory(org.apache.hadoop.conf.Configuration conf) Description copied from interface:ClusterConnection
Returns a new RpcRetryingCallerFactory from the givenConfiguration
. This RpcRetryingCallerFactory lets the users createRpcRetryingCaller
s which can be intercepted with the configuredRetryingCallerInterceptor
- Specified by:
getNewRpcRetryingCallerFactory
in interfaceClusterConnection
- Parameters:
conf
- configuration
-
hasCellBlockSupport
Description copied from interface:ClusterConnection
Returns true when this connection uses aCodec
and so supports cell blocks.- Specified by:
hasCellBlockSupport
in interfaceClusterConnection
-
getConnectionConfiguration
Description copied from interface:ClusterConnection
Returns a ConnectionConfiguration object holding parsed configuration values- Specified by:
getConnectionConfiguration
in interfaceClusterConnection
-
getRpcRetryingCallerFactory
Description copied from interface:ClusterConnection
Returns Connection's RpcRetryingCallerFactory instance- Specified by:
getRpcRetryingCallerFactory
in interfaceClusterConnection
-
getRpcControllerFactory
Description copied from interface:ClusterConnection
Returns Connection's RpcControllerFactory instance- Specified by:
getRpcControllerFactory
in interfaceClusterConnection
-
get
- Throws:
IOException
-
getLiveRegionServers
public List<ServerName> getLiveRegionServers(Supplier<ServerName> masterAddrTracker, int count) throws IOException Description copied from interface:ClusterConnection
Get live region servers from masters.- Specified by:
getLiveRegionServers
in interfaceClusterConnection
- Throws:
IOException
-
getAllBootstrapNodes
Description copied from interface:ClusterConnection
Get the bootstrap node list of another region server.- Specified by:
getAllBootstrapNodes
in interfaceClusterConnection
- Throws:
IOException
-
getClusterId
Description copied from interface:Connection
Returns the cluster ID unique to this HBase cluster.
The default implementation is added to keep client compatibility.- Specified by:
getClusterId
in interfaceConnection
-