Package org.apache.hadoop.hbase.client
Class AbstractRpcBasedConnectionRegistry
java.lang.Object
org.apache.hadoop.hbase.client.AbstractRpcBasedConnectionRegistry
- All Implemented Interfaces:
Closeable,AutoCloseable,ConnectionRegistry
- Direct Known Subclasses:
MasterRegistry,RpcConnectionRegistry
@Private
abstract class AbstractRpcBasedConnectionRegistry
extends Object
implements ConnectionRegistry
Base class for rpc based connection registry implementation.
The implementation needs a bootstrap node list in configuration, and then it will use the methods
in
RegistryProtos.ClientMetaService to refresh the connection registry end points.
It also supports hedged reads, the default fan out value is 2.
For the actual configuration names, see javadoc of sub classes.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interfaceFor describing the actual asynchronous rpc call. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault value for the fan out of hedged requests.private final intprivate final RegistryEndpointsRefresherprivate final RpcControllerFactoryprivate final ConnectionRegistryRpcStubHolder -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate IOExceptionbadResponse(String debug) protected final <T extends org.apache.hbase.thirdparty.com.google.protobuf.Message>
CompletableFuture<T>call(AbstractRpcBasedConnectionRegistry.Callable<T> callable, Predicate<T> isValidResp, String debug) private <T extends org.apache.hbase.thirdparty.com.google.protobuf.Message>
CompletableFuture<T>call(org.apache.hadoop.hbase.shaded.protobuf.generated.RegistryProtos.ClientMetaService.Interface stub, AbstractRpcBasedConnectionRegistry.Callable<T> callable) voidclose()Closes this instance and releases any system resources associated with itprotected abstract CompletableFuture<Set<ServerName>>Get the address of active HMaster.protected abstract Set<ServerName>getBootstrapNodes(org.apache.hadoop.conf.Configuration conf) Should only be called once.Get the location of meta region(s).(package private) Set<ServerName>private <T extends org.apache.hbase.thirdparty.com.google.protobuf.Message>
voidgroupCall(CompletableFuture<T> future, Set<ServerName> servers, List<org.apache.hadoop.hbase.shaded.protobuf.generated.RegistryProtos.ClientMetaService.Interface> stubs, int startIndexInclusive, AbstractRpcBasedConnectionRegistry.Callable<T> callable, Predicate<T> isValidResp, String debug, ConcurrentLinkedQueue<Throwable> errors) send requests concurrently to hedgedReadsFanout end points.private voidprivate static RegionLocationstransformMetaRegionLocations(org.apache.hadoop.hbase.shaded.protobuf.generated.RegistryProtos.GetMetaRegionLocationsResponse resp) Simple helper to transform the result of getMetaRegionLocations() rpc.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.hbase.client.ConnectionRegistry
getConnectionString
-
Field Details
-
HEDGED_REQS_FANOUT_DEFAULT
Default value for the fan out of hedged requests.- See Also:
-
hedgedReadFanOut
-
rpcStubHolder
-
rpcControllerFactory
-
registryEndpointRefresher
-
-
Constructor Details
-
AbstractRpcBasedConnectionRegistry
protected AbstractRpcBasedConnectionRegistry(org.apache.hadoop.conf.Configuration conf, User user, String hedgedReqsFanoutConfigName, String initialRefreshDelaySecsConfigName, String refreshIntervalSecsConfigName, String minRefreshIntervalSecsConfigName) throws IOException - Throws:
IOException
-
-
Method Details
-
getBootstrapNodes
protected abstract Set<ServerName> getBootstrapNodes(org.apache.hadoop.conf.Configuration conf) throws IOException - Throws:
IOException
-
fetchEndpoints
-
refreshStubs
- Throws:
IOException
-
call
private <T extends org.apache.hbase.thirdparty.com.google.protobuf.Message> CompletableFuture<T> call(org.apache.hadoop.hbase.shaded.protobuf.generated.RegistryProtos.ClientMetaService.Interface stub, AbstractRpcBasedConnectionRegistry.Callable<T> callable) -
badResponse
-
groupCall
private <T extends org.apache.hbase.thirdparty.com.google.protobuf.Message> void groupCall(CompletableFuture<T> future, Set<ServerName> servers, List<org.apache.hadoop.hbase.shaded.protobuf.generated.RegistryProtos.ClientMetaService.Interface> stubs, int startIndexInclusive, AbstractRpcBasedConnectionRegistry.Callable<T> callable, Predicate<T> isValidResp, String debug, ConcurrentLinkedQueue<Throwable> errors) send requests concurrently to hedgedReadsFanout end points. If any of the request is succeeded, we will complete the future and quit. If all the requests in one round are failed, we will start another round to send requests concurrently tohedgedReadsFanout end points. If all end points have been tried and all of them are failed, we will fail the future. -
call
protected final <T extends org.apache.hbase.thirdparty.com.google.protobuf.Message> CompletableFuture<T> call(AbstractRpcBasedConnectionRegistry.Callable<T> callable, Predicate<T> isValidResp, String debug) -
getParsedServers
- Throws:
IOException
-
transformMetaRegionLocations
private static RegionLocations transformMetaRegionLocations(org.apache.hadoop.hbase.shaded.protobuf.generated.RegistryProtos.GetMetaRegionLocationsResponse resp) Simple helper to transform the result of getMetaRegionLocations() rpc. -
getMetaRegionLocations
Description copied from interface:ConnectionRegistryGet the location of meta region(s).- Specified by:
getMetaRegionLocationsin interfaceConnectionRegistry
-
getClusterId
Description copied from interface:ConnectionRegistryShould only be called once.The upper layer should store this value somewhere as it will not be change any more.
- Specified by:
getClusterIdin interfaceConnectionRegistry
-
getActiveMaster
Description copied from interface:ConnectionRegistryGet the address of active HMaster.- Specified by:
getActiveMasterin interfaceConnectionRegistry
-
close
Description copied from interface:ConnectionRegistryCloses this instance and releases any system resources associated with it- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceConnectionRegistry
-