Package org.apache.hadoop.hbase.client
Class ServerConnectionUtils.ShortCircuitingClusterConnection
java.lang.Object
org.apache.hadoop.hbase.client.ConnectionImplementation
org.apache.hadoop.hbase.client.ServerConnectionUtils.ShortCircuitingClusterConnection
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Abortable
,ClusterConnection
,Connection
- Enclosing class:
- ServerConnectionUtils
public static final class ServerConnectionUtils.ShortCircuitingClusterConnection
extends ConnectionImplementation
A ClusterConnection that will short-circuit RPC making direct invocations against the localhost
if the invocation target is 'this' server; save on network and protobuf invocations.
-
Nested Class Summary
Modifier and TypeClassDescription(package private) static class
When we directly invokeRSRpcServices.get(org.apache.hbase.thirdparty.com.google.protobuf.RpcController, org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.GetRequest)
on the same RegionServer throughServerConnectionUtils.ShortCircuitingClusterConnection
in region CPs such asRegionObserver.postScannerOpen(org.apache.hadoop.hbase.coprocessor.ObserverContext<org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment>, org.apache.hadoop.hbase.client.Scan, org.apache.hadoop.hbase.regionserver.RegionScanner)
to get other rows, theRegionScanner
created for the directlyRSRpcServices.get(org.apache.hbase.thirdparty.com.google.protobuf.RpcController, org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.GetRequest)
may not be closed until the outmost rpc call is completed if there is an outmostRpcCall
, and even worse , theServerCall.rpcCallback
may be override which would cause serious problem,so forgetClient(org.apache.hadoop.hbase.ServerName)
, if returnlocalHostClient
,we would add a wrapper class to wrap it , which usingRpcServer.unsetCurrentCall()
and {RpcServer#setCurrentCall} to surround the scan and get method call,so theRegionScanner
created for the directlyRSRpcServices.get(org.apache.hbase.thirdparty.com.google.protobuf.RpcController, org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.GetRequest)
could be closed immediately,see HBASE-26812 for more.Nested classes/interfaces inherited from class org.apache.hadoop.hbase.client.ConnectionImplementation
ConnectionImplementation.MasterServiceState, ConnectionImplementation.ServerErrorTracker
-
Field Summary
Modifier and TypeFieldDescriptionprivate final org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.BlockingInterface
private final org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.BlockingInterface
private final org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.BlockingInterface
private final ServerName
Fields inherited from class org.apache.hadoop.hbase.client.ConnectionImplementation
clusterId, clusterStatusListener, MASTER_STATE_CACHE_TIMEOUT_SEC, masterServiceState, RETRIES_BY_SERVER_KEY, rpcTimeout, user
Fields inherited from interface org.apache.hadoop.hbase.client.ClusterConnection
HBASE_CLIENT_CONNECTION_IMPL
-
Constructor Summary
ModifierConstructorDescriptionprivate
ShortCircuitingClusterConnection
(org.apache.hadoop.conf.Configuration conf, User user, ServerName serverName, org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin, org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.BlockingInterface client, ConnectionRegistry registry) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.BlockingInterface
getAdmin
(ServerName sn) Establishes a connection to the region server at the specified address.org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.BlockingInterface
getClient
(ServerName sn) Establishes a connection to the region server at the specified address, and returns a region client protocol.Returns aMasterKeepAliveConnection
to the active masterMethods inherited from class org.apache.hadoop.hbase.client.ConnectionImplementation
abort, cacheLocation, clearCaches, clearRegionCache, clearRegionCache, clearRegionLocationCache, close, finalize, getAdmin, getAdminForMaster, getAllBootstrapNodes, getAsyncProcess, getBackoffPolicy, getBufferedMutator, getBufferedMutator, getCachedLocation, getChoreService, getClusterId, getConfiguration, getConnectionConfiguration, getConnectionMetrics, getConnectionRegistry, getCurrentBatchPool, getCurrentMetaLookupPool, getHbck, getHbck, getLiveRegionServers, getMasterServiceState, getNewRpcRetryingCallerFactory, getNonceGenerator, getNumberOfCachedRegionLocations, getRegionLocation, getRegionLocator, getRpcClient, getRpcControllerFactory, getRpcRetryingCallerFactory, getStatisticsTracker, getTable, getTableBuilder, getTableState, getUser, hasCellBlockSupport, injectNonceGeneratorForTesting, isAborted, isClosed, isMasterRunning, isTableAvailable, isTableDisabled, isTableEnabled, locateRegion, locateRegion, locateRegion, locateRegion, locateRegions, locateRegions, masterConnectionStateSupplier, releaseMaster, relocateRegion, relocateRegion, retrieveClusterId, takeUserRegionLock, toString, updateCachedLocation, updateCachedLocations
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
-
serverName
-
localHostAdmin
private final org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.BlockingInterface localHostAdmin -
localHostClient
private final org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.BlockingInterface localHostClient -
localClientServiceBlockingInterfaceWrapper
private final org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.BlockingInterface localClientServiceBlockingInterfaceWrapper
-
-
Constructor Details
-
ShortCircuitingClusterConnection
private ShortCircuitingClusterConnection(org.apache.hadoop.conf.Configuration conf, User user, ServerName serverName, org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin, org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.BlockingInterface client, ConnectionRegistry registry) throws IOException - Throws:
IOException
-
-
Method Details
-
getAdmin
public org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.BlockingInterface getAdmin(ServerName sn) throws IOException Description copied from interface:ClusterConnection
Establishes a connection to the region server at the specified address.- Specified by:
getAdmin
in interfaceClusterConnection
- Overrides:
getAdmin
in classConnectionImplementation
- Parameters:
sn
- 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 sn) 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
- Overrides:
getClient
in classConnectionImplementation
- Parameters:
sn
- the region server to connect to- Returns:
- ClientProtocol proxy for RegionServer
- Throws:
IOException
- if a remote or network exception occurs
-
getMaster
Description copied from interface:ClusterConnection
Returns aMasterKeepAliveConnection
to the active master- Specified by:
getMaster
in interfaceClusterConnection
- Overrides:
getMaster
in classConnectionImplementation
- Throws:
IOException
-