Package org.apache.hadoop.hbase.client
Interface ClusterConnection
- All Superinterfaces:
Abortable
,AutoCloseable
,Closeable
,Connection
- All Known Implementing Classes:
ConnectionImplementation
,ConnectionUtils.MasterlessConnection
,ServerConnectionUtils.ShortCircuitingClusterConnection
Internal methods on Connection that should not be used by user code.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Key for configuration in Configuration whose value is the class we implement making a new Connection instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
cacheLocation
(TableName tableName, RegionLocations location) void
Clear any caches that pertain to server namesn
.default void
Deprecated.void
clearRegionCache
(TableName tableName) Allows flushing the region cache of all locations that pertain totableName
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 policyorg.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 a ConnectionConfiguration object holding parsed configuration valuesReturns the MetricsConnection instance associated with this connection.Get theConnectionRegistry
used to orient this cluster.getLiveRegionServers
(Supplier<ServerName> masterAddrTracker, int count) Get live region servers from masters.Returns aMasterKeepAliveConnection
to the active mastergetNewRpcRetryingCallerFactory
(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.getRegionLocation
(TableName tableName, byte[] row, boolean reload) Find region location hosting passed rowReturns Connection's RpcControllerFactory instanceReturns Connection's RpcRetryingCallerFactory instanceReturns the current statistics tracker associated with this connectiongetTableState
(TableName tableName) Retrieve TableState, represent current table state.getUser()
Get theUser
associated with this connection.boolean
Returns true when this connection uses aCodec
and so supports cell blocks.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.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.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.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.void
updateCachedLocations
(TableName tableName, byte[] regionName, byte[] rowkey, Object exception, ServerName source) Update the location cache.Methods inherited from interface org.apache.hadoop.hbase.client.Connection
clearRegionLocationCache, close, getAdmin, getBufferedMutator, getBufferedMutator, getClusterId, getConfiguration, getHbck, getHbck, getRegionLocator, getTable, getTable, getTableBuilder, isClosed
-
Field Details
-
HBASE_CLIENT_CONNECTION_IMPL
Key for configuration in Configuration whose value is the class we implement making a new Connection instance.- See Also:
-
-
Method Details
-
isMasterRunning
@Deprecated boolean isMasterRunning() throws MasterNotRunningException, ZooKeeperConnectionExceptionDeprecated.this has been deprecated without a replacement- Returns:
- - true if the master server is running
- Throws:
MasterNotRunningException
ZooKeeperConnectionException
-
isTableAvailable
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- Throws:
IOException
-
isTableEnabled
A table that isTableEnabled == false and isTableDisabled == false is possible. This happens when a table has a lot of regions that must be processed.- Parameters:
tableName
- table name- Returns:
- true if the table is enabled, false otherwise
- Throws:
IOException
- if a remote or network exception occurs
-
isTableDisabled
Check if a table is disabled.- Parameters:
tableName
- table name- Returns:
- true if the table is disabled, false otherwise
- Throws:
IOException
- if a remote or network exception occurs
-
getTableState
Retrieve TableState, represent current table state.- Parameters:
tableName
- table state for- Returns:
- state of the table
- Throws:
IOException
-
locateRegion
Find the location of the region of tableName that row lives in.- 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
-
clearRegionCache
Deprecated.Clear the region location cache. -
cacheLocation
-
clearRegionCache
Allows flushing the region cache of all locations that pertain totableName
- Parameters:
tableName
- Name of the table whose regions we are to remove from cache.
-
relocateRegion
Find the location of the region of tableName that row lives in, ignoring any value that might be in the cache.- 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
Find the location of the region of tableName that row lives in, ignoring any value that might be in the cache.- 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
-
updateCachedLocations
void updateCachedLocations(TableName tableName, byte[] regionName, byte[] rowkey, Object exception, ServerName source) Update the location cache. This is used internally by HBase, in most cases it should not be used by the client application.- Parameters:
tableName
- the table nameregionName
- the region namerowkey
- the rowexception
- the exception if any. Can be null.source
- the previous location
-
locateRegion
Gets the location of the region of regionName.- 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
-
locateRegions
Gets the locations of all regions in the specified table, tableName.- Parameters:
tableName
- table to get regions of- Returns:
- list of region locations for all regions of table
- Throws:
IOException
- if IO failure occurs
-
locateRegions
List<HRegionLocation> locateRegions(TableName tableName, boolean useCache, boolean offlined) throws IOException Gets the locations of all regions in the specified table, tableName.- 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
RegionLocations locateRegion(TableName tableName, byte[] row, boolean useCache, boolean retry) throws IOException Gets the locations of the region in the specified table, tableName, for a given row.- 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
RegionLocations locateRegion(TableName tableName, byte[] row, boolean useCache, boolean retry, int replicaId) throws IOException Gets the locations of the region in the specified table, tableName, for a given row.- 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
-
getMaster
Returns aMasterKeepAliveConnection
to the active master- Throws:
IOException
-
getAdminForMaster
org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.BlockingInterface getAdminForMaster() throws IOExceptionGet the admin service for master.- Throws:
IOException
-
getAdmin
org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.BlockingInterface getAdmin(ServerName serverName) throws IOException Establishes a connection to the region server at the specified address.- Parameters:
serverName
- the region server to connect to- Returns:
- proxy for HRegionServer
- Throws:
IOException
- if a remote or network exception occurs
-
getClient
org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.BlockingInterface getClient(ServerName serverName) throws IOException Establishes a connection to the region server at the specified address, and returns a region client protocol.- Parameters:
serverName
- the region server to connect to- Returns:
- ClientProtocol proxy for RegionServer
- Throws:
IOException
- if a remote or network exception occurs
-
getRegionLocation
HRegionLocation getRegionLocation(TableName tableName, byte[] row, boolean reload) throws IOException Find region location hosting passed row- 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
-
clearCaches
Clear any caches that pertain to server namesn
.- Parameters:
sn
- A server name
-
getNonceGenerator
Returns Nonce generator for this ClusterConnection; may be null if disabled in configuration. -
getAsyncProcess
Returns Default AsyncProcess associated with this connection. -
getNewRpcRetryingCallerFactory
Returns a new RpcRetryingCallerFactory from the givenConfiguration
. This RpcRetryingCallerFactory lets the users createRpcRetryingCaller
s which can be intercepted with the configuredRetryingCallerInterceptor
- Parameters:
conf
- configuration
-
getRpcRetryingCallerFactory
Returns Connection's RpcRetryingCallerFactory instance -
getRpcControllerFactory
Returns Connection's RpcControllerFactory instance -
getConnectionConfiguration
Returns a ConnectionConfiguration object holding parsed configuration values -
getStatisticsTracker
Returns the current statistics tracker associated with this connection -
getBackoffPolicy
Returns the configured client backoff policy -
getConnectionMetrics
Returns the MetricsConnection instance associated with this connection. -
hasCellBlockSupport
boolean hasCellBlockSupport()Returns true when this connection uses aCodec
and so supports cell blocks. -
getLiveRegionServers
List<ServerName> getLiveRegionServers(Supplier<ServerName> masterAddrTracker, int count) throws IOException Get live region servers from masters.- Throws:
IOException
-
getAllBootstrapNodes
Get the bootstrap node list of another region server.- Throws:
IOException
-
getUser
Get theUser
associated with this connection. May benull
. -
getConnectionRegistry
Get theConnectionRegistry
used to orient this cluster.
-
Connection.clearRegionLocationCache()
instead.