@InterfaceAudience.Private abstract class AbstractRpcBasedConnectionRegistry extends Object implements ConnectionRegistry
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.| Modifier and Type | Class and Description |
|---|---|
protected static interface |
AbstractRpcBasedConnectionRegistry.Callable<T>
For describing the actual asynchronous rpc call.
|
| Modifier and Type | Field and Description |
|---|---|
private org.apache.hbase.thirdparty.com.google.common.collect.ImmutableMap<ServerName,org.apache.hadoop.hbase.shaded.protobuf.generated.RegistryProtos.ClientMetaService.Interface> |
addr2Stub |
static int |
HEDGED_REQS_FANOUT_DEFAULT
Default value for the fan out of hedged requests.
|
private int |
hedgedReadFanOut |
private RegistryEndpointsRefresher |
registryEndpointRefresher |
private RpcClient |
rpcClient |
private RpcControllerFactory |
rpcControllerFactory |
private int |
rpcTimeoutMs |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractRpcBasedConnectionRegistry(org.apache.hadoop.conf.Configuration conf,
String hedgedReqsFanoutConfigName,
String initialRefreshDelaySecsConfigName,
String refreshIntervalSecsConfigName,
String minRefreshIntervalSecsConfigName) |
| Modifier and Type | Method and Description |
|---|---|
private IOException |
badResponse(String debug) |
protected <T extends org.apache.hbase.thirdparty.com.google.protobuf.Message> |
call(AbstractRpcBasedConnectionRegistry.Callable<T> callable,
Predicate<T> isValidResp,
String debug) |
private <T extends org.apache.hbase.thirdparty.com.google.protobuf.Message> |
call(org.apache.hadoop.hbase.shaded.protobuf.generated.RegistryProtos.ClientMetaService.Interface stub,
AbstractRpcBasedConnectionRegistry.Callable<T> callable) |
void |
close()
Closes this instance and releases any system resources associated with it
|
protected abstract CompletableFuture<Set<ServerName>> |
fetchEndpoints() |
CompletableFuture<ServerName> |
getActiveMaster()
Get the address of active HMaster.
|
protected abstract Set<ServerName> |
getBootstrapNodes(org.apache.hadoop.conf.Configuration conf) |
CompletableFuture<String> |
getClusterId()
Should only be called once.
|
CompletableFuture<RegionLocations> |
getMetaRegionLocations()
Get the location of meta region(s).
|
(package private) Set<ServerName> |
getParsedServers() |
private <T extends org.apache.hbase.thirdparty.com.google.protobuf.Message> |
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.
|
private void |
populateStubs(Set<ServerName> addrs) |
private void |
refreshStubs() |
private static RegionLocations |
transformMetaRegionLocations(org.apache.hadoop.hbase.shaded.protobuf.generated.RegistryProtos.GetMetaRegionLocationsResponse resp)
Simple helper to transform the result of getMetaRegionLocations() rpc.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetConnectionStringpublic static final int HEDGED_REQS_FANOUT_DEFAULT
private final int hedgedReadFanOut
private volatile org.apache.hbase.thirdparty.com.google.common.collect.ImmutableMap<ServerName,org.apache.hadoop.hbase.shaded.protobuf.generated.RegistryProtos.ClientMetaService.Interface> addr2Stub
private final RpcControllerFactory rpcControllerFactory
private final int rpcTimeoutMs
private final RegistryEndpointsRefresher registryEndpointRefresher
protected AbstractRpcBasedConnectionRegistry(org.apache.hadoop.conf.Configuration conf, String hedgedReqsFanoutConfigName, String initialRefreshDelaySecsConfigName, String refreshIntervalSecsConfigName, String minRefreshIntervalSecsConfigName) throws IOException
IOExceptionprotected abstract Set<ServerName> getBootstrapNodes(org.apache.hadoop.conf.Configuration conf) throws IOException
IOExceptionprotected abstract CompletableFuture<Set<ServerName>> fetchEndpoints()
private void refreshStubs() throws IOException
IOExceptionprivate void populateStubs(Set<ServerName> addrs) throws IOException
IOExceptionprivate <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)
private IOException badResponse(String debug)
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)
protected final <T extends org.apache.hbase.thirdparty.com.google.protobuf.Message> CompletableFuture<T> call(AbstractRpcBasedConnectionRegistry.Callable<T> callable, Predicate<T> isValidResp, String debug)
Set<ServerName> getParsedServers()
private static RegionLocations transformMetaRegionLocations(org.apache.hadoop.hbase.shaded.protobuf.generated.RegistryProtos.GetMetaRegionLocationsResponse resp)
public CompletableFuture<RegionLocations> getMetaRegionLocations()
ConnectionRegistrygetMetaRegionLocations in interface ConnectionRegistrypublic CompletableFuture<String> getClusterId()
ConnectionRegistryThe upper layer should store this value somewhere as it will not be change any more.
getClusterId in interface ConnectionRegistrypublic CompletableFuture<ServerName> getActiveMaster()
ConnectionRegistrygetActiveMaster in interface ConnectionRegistrypublic void close()
ConnectionRegistryclose in interface Closeableclose in interface AutoCloseableclose in interface ConnectionRegistryCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.