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
Nested ClassesModifier and TypeClassDescription(package private) static classWhen 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.ShortCircuitingClusterConnectionin 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, theRegionScannercreated 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.rpcCallbackmay 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 theRegionScannercreated 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
FieldsModifier and TypeFieldDescriptionprivate final org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.BlockingInterfaceprivate final org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.BlockingInterfaceprivate final org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.BlockingInterfaceprivate final ServerNameFields inherited from class org.apache.hadoop.hbase.client.ConnectionImplementation
clusterId, clusterStatusListener, MASTER_STATE_CACHE_TIMEOUT_SEC, masterServiceState, RETRIES_BY_SERVER_KEY, rpcTimeout, userFields inherited from interface org.apache.hadoop.hbase.client.ClusterConnection
HBASE_CLIENT_CONNECTION_IMPL -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateShortCircuitingClusterConnection(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.BlockingInterfacegetAdmin(ServerName sn) Establishes a connection to the region server at the specified address.org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.BlockingInterfacegetClient(ServerName sn) Establishes a connection to the region server at the specified address, and returns a region client protocol.Returns aMasterKeepAliveConnectionto 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, updateCachedLocationsMethods 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
-
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:ClusterConnectionEstablishes a connection to the region server at the specified address.- Specified by:
getAdminin interfaceClusterConnection- Overrides:
getAdminin 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:ClusterConnectionEstablishes a connection to the region server at the specified address, and returns a region client protocol.- Specified by:
getClientin interfaceClusterConnection- Overrides:
getClientin 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:ClusterConnectionReturns aMasterKeepAliveConnectionto the active master- Specified by:
getMasterin interfaceClusterConnection- Overrides:
getMasterin classConnectionImplementation- Throws:
IOException
-