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
Nested ClassesModifier and TypeClassDescriptionprivate static classLikeConnectionClosedExceptionbut thrown from the checkClosed call which looks at the local this.closed flag.(package private) static classState of the MasterService connection/setup.private final classClass to make a MasterServiceStubMaker stub.(package private) static classThe record of errors for servers. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate final StringAllow setting an alternate BufferedMutator implementation via config.private final AsyncProcessprivate final ClientBackoffPolicyprivate ThreadPoolExecutorprivate ChoreServiceprivate booleanprivate booleanprotected String(package private) ClusterStatusListenerprivate final org.apache.hadoop.conf.Configurationprivate final ConnectionConfigurationprivate final RetryingCallerInterceptorprivate static final org.slf4j.Loggerstatic final Stringprivate final Object(package private) final ConnectionImplementation.MasterServiceStateSupplier to get masterState.By default uses simple supplier without TTL cache.private final MetaCacheprivate ThreadPoolExecutorprivate final Objectprivate final intprivate CatalogReplicaModeprivate final MetricsConnectionprivate Stringprivate static NonceGeneratorGlobal nonceGenerator shared per client.private static final ObjectThe nonce generator lock.private final intprivate final ConnectionRegistryCluster registry of basic info such as clusterid and meta region location.static final Stringprivate final RpcRetryingCallerFactoryprivate final RpcClientprivate final RpcControllerFactory(package private) final intprivate final ServerStatisticTrackerprivate final ConcurrentMap<String,Object> protected Userprivate final ReentrantLocklock 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
ConstructorsConstructorDescriptionConnectionImplementation(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 TypeMethodDescriptionvoidAbort the server or client.voidcacheLocation(TableName tableName, RegionLocations location) Put a newly discovered HRegionLocation into the cache.private voidcacheLocation(TableName tableName, ServerName source, HRegionLocation location) Put a newly discovered HRegionLocation into the cache.private voidvoidclearCaches(ServerName serverName) Clear any caches that pertain to server namesn.voidclearRegionCache(TableName tableName) Allows flushing the region cache of all locations that pertain totableNamevoidclearRegionCache(TableName tableName, byte[] row) voidClear all the entries in the region location cache, for all the tables.voidclose()private voidImmediate close of the shared master.private voidprotected voidfinalize()Close the connection for good.private static <T> Tget(CompletableFuture<T> future) getAdmin()Retrieve an Admin implementation to administer an HBase cluster.org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.BlockingInterfacegetAdmin(ServerName serverName) Establishes a connection to the region server at the specified address.org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.BlockingInterfaceGet 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 ThreadPoolExecutorRetrieve aBufferedMutatorfor performing client-side buffering of writes.getBufferedMutator(TableName tableName) Retrieve aBufferedMutatorfor performing client-side buffering of writes.(package private) RegionLocationsgetCachedLocation(TableName tableName, byte[] row) Search the cache for a location that fits our table and row key.(package private) ChoreServiceIf choreService has not been created yet, create the ChoreService.org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.BlockingInterfacegetClient(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.ConfigurationReturns Configuration instance being used by this Connection instance.Returns a ConnectionConfiguration object holding parsed configuration valuesReturns the MetricsConnection instance associated with this connection.Get theConnectionRegistryused to orient this cluster.protected ExecutorServiceprotected ExecutorServicegetHbck()Retrieve an Hbck implementation to fix an HBase cluster.getHbck(ServerName masterServer) Retrieve an Hbck implementation to fix an HBase cluster.private MasterKeepAliveConnectiongetLiveRegionServers(Supplier<ServerName> masterAddrTracker, int count) Get live region servers from masters.Returns aMasterKeepAliveConnectionto the active master(package private) ConnectionImplementation.MasterServiceStateVisible for testsprivate ThreadPoolExecutorgetNewRpcRetryingCallerFactory(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) intgetNumberOfCachedRegionLocations(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) RpcClientFor 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 anTableBuilderfor creatingTable.getTableState(TableName tableName) Retrieve TableState, represent current table state.private ThreadPoolExecutorgetThreadPool(int maxThreads, int coreThreads, String nameHint, BlockingQueue<Runnable> passedWorkQueue) getUser()Get theUserassociated with this connection.booleanReturns true when this connection uses aCodecand so supports cell blocks.(package private) static NonceGeneratorbooleanCheck if the server or client was aborted.booleanisClosed()Returns whether the connection is closed or not.private booleanprivate booleanbooleanDeprecated.this has been deprecated without a replacementbooleanisTableAvailable(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.booleanisTableDisabled(TableName tableName) Check if a table is disabled.booleanisTableEnabled(TableName tableName) A table that isTableEnabled == false and isTableDisabled == false is possible.private RegionLocationslocateMeta(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 RegionLocationslocateRegionInMeta(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) voidrelocateRegion(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 voidprotected voidprivate voidprivate voidprivate voidspawnRenewalChore(org.apache.hadoop.security.UserGroupInformation user) (package private) voidtoString()An identifier that will remain the same for a given connection.(package private) voidupdateCachedLocation(RegionInfo hri, ServerName source, ServerName serverName, long seqNum) voidupdateCachedLocations(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, waitMethods inherited from interface org.apache.hadoop.hbase.client.ClusterConnection
clearRegionCacheMethods 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:ConnectionRetrieve 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:
getTablein 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:ConnectionReturns anTableBuilderfor creatingTable.- Specified by:
getTableBuilderin interfaceConnection- Parameters:
tableName- the name of the tablepool- the thread pool to use for requests like batch and scan
-
getBufferedMutator
Description copied from interface:ConnectionRetrieve aBufferedMutatorfor performing client-side buffering of writes. TheBufferedMutatorreturned 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 returnedBufferedMutatorinstance.- Specified by:
getBufferedMutatorin interfaceConnection- Parameters:
params- details on how to instantiate theBufferedMutator.- Returns:
- a
BufferedMutatorfor the supplied tableName.
-
getBufferedMutator
Description copied from interface:ConnectionRetrieve a
BufferedMutatorfor performing client-side buffering of writes. TheBufferedMutatorreturned 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 returnedBufferedMutatorinstance.- Specified by:
getBufferedMutatorin interfaceConnection- Parameters:
tableName- the name of the table- Returns:
- a
BufferedMutatorfor the supplied tableName.
-
getRegionLocator
Description copied from interface:ConnectionRetrieve 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:
getRegionLocatorin 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:ConnectionRetrieve 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:
getAdminin interfaceConnection- Returns:
- an Admin instance for cluster administration
- Throws:
IOException
-
getHbck
Description copied from interface:ConnectionRetrieve 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:
getHbckin interfaceConnection- Returns:
- an Hbck instance for active master. Active master is fetched from the zookeeper.
- Throws:
IOException
-
getHbck
Description copied from interface:ConnectionRetrieve 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:
getHbckin interfaceConnection- Parameters:
masterServer- explicitServerNamefor master server- Returns:
- an Hbck instance for a specified master server
- Throws:
IOException
-
getConnectionMetrics
Description copied from interface:ClusterConnectionReturns the MetricsConnection instance associated with this connection.- Specified by:
getConnectionMetricsin interfaceClusterConnection
-
getUser
Description copied from interface:ClusterConnectionGet theUserassociated with this connection. May benull.- Specified by:
getUserin interfaceClusterConnection
-
getConnectionRegistry
Description copied from interface:ClusterConnectionGet theConnectionRegistryused to orient this cluster.- Specified by:
getConnectionRegistryin 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:ConnectionReturns Configuration instance being used by this Connection instance.- Specified by:
getConfigurationin interfaceConnection
-
checkClosed
-
isMasterRunning
@Deprecated public boolean isMasterRunning() throws MasterNotRunningException, ZooKeeperConnectionExceptionDeprecated.this has been deprecated without a replacement- Specified by:
isMasterRunningin 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:ClusterConnectionFind region location hosting passed row- Specified by:
getRegionLocationin 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:ClusterConnectionA 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:
isTableEnabledin 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:ClusterConnectionCheck if a table is disabled.- Specified by:
isTableDisabledin 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:ClusterConnectionUse 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:
isTableAvailablein interfaceClusterConnection- Throws:
IOException
-
locateRegion
Description copied from interface:ClusterConnectionGets the location of the region of regionName.- Specified by:
locateRegionin 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:ClusterConnectionGets the locations of all regions in the specified table, tableName.- Specified by:
locateRegionsin 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:ClusterConnectionGets the locations of all regions in the specified table, tableName.- Specified by:
locateRegionsin 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:ClusterConnectionFind the location of the region of tableName that row lives in.- Specified by:
locateRegionin 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:ClusterConnectionFind the location of the region of tableName that row lives in, ignoring any value that might be in the cache.- Specified by:
relocateRegionin 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:ClusterConnectionFind the location of the region of tableName that row lives in, ignoring any value that might be in the cache.- Specified by:
relocateRegionin 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:ClusterConnectionGets the locations of the region in the specified table, tableName, for a given row.- Specified by:
locateRegionin 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:ClusterConnectionGets the locations of the region in the specified table, tableName, for a given row.- Specified by:
locateRegionin 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:
cacheLocationin 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:ClusterConnectionClear any caches that pertain to server namesn.- Specified by:
clearCachesin interfaceClusterConnection- Parameters:
serverName- A server name
-
clearRegionLocationCache
Description copied from interface:ConnectionClear 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:
clearRegionLocationCachein interfaceConnection
-
clearRegionCache
Description copied from interface:ClusterConnectionAllows flushing the region cache of all locations that pertain totableName- Specified by:
clearRegionCachein 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:ClusterConnectionGet the admin service for master.- Specified by:
getAdminForMasterin interfaceClusterConnection- Throws:
IOException
-
getAdmin
public org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.BlockingInterface getAdmin(ServerName serverName) throws IOException Description copied from interface:ClusterConnectionEstablishes a connection to the region server at the specified address.- Specified by:
getAdminin 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:ClusterConnectionEstablishes a connection to the region server at the specified address, and returns a region client protocol.- Specified by:
getClientin 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:ClusterConnectionReturns aMasterKeepAliveConnectionto the active master- Specified by:
getMasterin 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:
updateCachedLocationsin 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:ClusterConnectionReturns Default AsyncProcess associated with this connection.- Specified by:
getAsyncProcessin interfaceClusterConnection
-
getStatisticsTracker
Description copied from interface:ClusterConnectionReturns the current statistics tracker associated with this connection- Specified by:
getStatisticsTrackerin interfaceClusterConnection
-
getBackoffPolicy
Description copied from interface:ClusterConnectionReturns the configured client backoff policy- Specified by:
getBackoffPolicyin interfaceClusterConnection
-
getNumberOfCachedRegionLocations
-
abort
Description copied from interface:AbortableAbort the server or client. -
isClosed
Description copied from interface:ConnectionReturns whether the connection is closed or not.- Specified by:
isClosedin interfaceConnection- Returns:
- true if this connection is closed
-
isAborted
Description copied from interface:AbortableCheck if the server or client was aborted. -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein 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:ClusterConnectionReturns Nonce generator for this ClusterConnection; may be null if disabled in configuration.- Specified by:
getNonceGeneratorin interfaceClusterConnection
-
getTableState
Description copied from interface:ClusterConnectionRetrieve TableState, represent current table state.- Specified by:
getTableStatein 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:ClusterConnectionReturns a new RpcRetryingCallerFactory from the givenConfiguration. This RpcRetryingCallerFactory lets the users createRpcRetryingCallers which can be intercepted with the configuredRetryingCallerInterceptor- Specified by:
getNewRpcRetryingCallerFactoryin interfaceClusterConnection- Parameters:
conf- configuration
-
hasCellBlockSupport
Description copied from interface:ClusterConnectionReturns true when this connection uses aCodecand so supports cell blocks.- Specified by:
hasCellBlockSupportin interfaceClusterConnection
-
getConnectionConfiguration
Description copied from interface:ClusterConnectionReturns a ConnectionConfiguration object holding parsed configuration values- Specified by:
getConnectionConfigurationin interfaceClusterConnection
-
getRpcRetryingCallerFactory
Description copied from interface:ClusterConnectionReturns Connection's RpcRetryingCallerFactory instance- Specified by:
getRpcRetryingCallerFactoryin interfaceClusterConnection
-
getRpcControllerFactory
Description copied from interface:ClusterConnectionReturns Connection's RpcControllerFactory instance- Specified by:
getRpcControllerFactoryin interfaceClusterConnection
-
get
- Throws:
IOException
-
getLiveRegionServers
public List<ServerName> getLiveRegionServers(Supplier<ServerName> masterAddrTracker, int count) throws IOException Description copied from interface:ClusterConnectionGet live region servers from masters.- Specified by:
getLiveRegionServersin interfaceClusterConnection- Throws:
IOException
-
getAllBootstrapNodes
Description copied from interface:ClusterConnectionGet the bootstrap node list of another region server.- Specified by:
getAllBootstrapNodesin interfaceClusterConnection- Throws:
IOException
-
getClusterId
Description copied from interface:ConnectionReturns the cluster ID unique to this HBase cluster.
The default implementation is added to keep client compatibility.- Specified by:
getClusterIdin interfaceConnection
-