@InterfaceAudience.Private public class MasterRegistry extends Object implements ConnectionRegistry
MASTER_REGISTRY_HEDGED_REQS_FANOUT_KEY
to a value greater than 1
will enable
it(the default value is MASTER_REGISTRY_HEDGED_REQS_FANOUT_DEFAULT
).
TODO: Handle changes to the configuration dynamically without having to restart the client.Modifier and Type | Class and Description |
---|---|
private static interface |
MasterRegistry.Callable<T>
For describing the actual asynchronous rpc call.
|
Modifier and Type | Field and Description |
---|---|
private int |
hedgedReadFanOut |
private static String |
MASTER_ADDRS_CONF_SEPARATOR |
static int |
MASTER_REGISTRY_HEDGED_REQS_FANOUT_DEFAULT
Default value for the fan out of hedged requests.
|
static String |
MASTER_REGISTRY_HEDGED_REQS_FANOUT_KEY
Configuration key that controls the fan out of requests
|
private org.apache.hbase.thirdparty.com.google.common.collect.ImmutableMap<ServerName,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.ClientMetaService.Interface> |
masterAddr2Stub |
private RpcClient |
rpcClient |
private RpcControllerFactory |
rpcControllerFactory |
Constructor and Description |
---|
MasterRegistry(org.apache.hadoop.conf.Configuration conf) |
Modifier and Type | Method and Description |
---|---|
private IOException |
badResponse(String debug) |
private <T extends org.apache.hbase.thirdparty.com.google.protobuf.Message> |
call(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.ClientMetaService.Interface stub,
MasterRegistry.Callable<T> callable) |
private <T extends org.apache.hbase.thirdparty.com.google.protobuf.Message> |
call(MasterRegistry.Callable<T> callable,
Predicate<T> isValidResp,
String debug) |
void |
close()
Closes this instance and releases any system resources associated with it
|
CompletableFuture<ServerName> |
getActiveMaster()
Get the address of active HMaster.
|
CompletableFuture<String> |
getClusterId()
Should only be called once.
|
static String |
getMasterAddr(org.apache.hadoop.conf.Configuration conf)
Builds the default master address end point if it is not specified in the configuration.
|
CompletableFuture<RegionLocations> |
getMetaRegionLocations()
Get the location of meta region(s).
|
(package private) Set<ServerName> |
getParsedMasterServers() |
private <T extends org.apache.hbase.thirdparty.com.google.protobuf.Message> |
groupCall(CompletableFuture<T> future,
List<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.ClientMetaService.Interface> masterStubs,
int startIndexInclusive,
MasterRegistry.Callable<T> callable,
Predicate<T> isValidResp,
String debug,
ConcurrentLinkedQueue<Throwable> errors)
send requests concurrently to hedgedReadsFanout masters.
|
private static Set<ServerName> |
parseMasterAddrs(org.apache.hadoop.conf.Configuration conf)
Parses the list of master addresses from the provided configuration.
|
private RegionLocations |
transformMetaRegionLocations(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.GetMetaRegionLocationsResponse resp)
Simple helper to transform the result of getMetaRegionLocations() rpc.
|
private ServerName |
transformServerName(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.GetActiveMasterResponse resp) |
public static final String MASTER_REGISTRY_HEDGED_REQS_FANOUT_KEY
public static final int MASTER_REGISTRY_HEDGED_REQS_FANOUT_DEFAULT
private static final String MASTER_ADDRS_CONF_SEPARATOR
private final int hedgedReadFanOut
private final org.apache.hbase.thirdparty.com.google.common.collect.ImmutableMap<ServerName,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.ClientMetaService.Interface> masterAddr2Stub
private final RpcControllerFactory rpcControllerFactory
MasterRegistry(org.apache.hadoop.conf.Configuration conf) throws IOException
IOException
private static Set<ServerName> parseMasterAddrs(org.apache.hadoop.conf.Configuration conf) throws UnknownHostException
conf
- Configuration to parse from.UnknownHostException
public static String getMasterAddr(org.apache.hadoop.conf.Configuration conf) throws UnknownHostException
HBaseTestingUtility
.UnknownHostException
private <T extends org.apache.hbase.thirdparty.com.google.protobuf.Message> CompletableFuture<T> call(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.ClientMetaService.Interface stub, MasterRegistry.Callable<T> callable)
private IOException badResponse(String debug)
private <T extends org.apache.hbase.thirdparty.com.google.protobuf.Message> void groupCall(CompletableFuture<T> future, List<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.ClientMetaService.Interface> masterStubs, int startIndexInclusive, MasterRegistry.Callable<T> callable, Predicate<T> isValidResp, String debug, ConcurrentLinkedQueue<Throwable> errors)
private <T extends org.apache.hbase.thirdparty.com.google.protobuf.Message> CompletableFuture<T> call(MasterRegistry.Callable<T> callable, Predicate<T> isValidResp, String debug)
private RegionLocations transformMetaRegionLocations(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.GetMetaRegionLocationsResponse resp)
public CompletableFuture<RegionLocations> getMetaRegionLocations()
ConnectionRegistry
getMetaRegionLocations
in interface ConnectionRegistry
public CompletableFuture<String> getClusterId()
ConnectionRegistry
The upper layer should store this value somewhere as it will not be change any more.
getClusterId
in interface ConnectionRegistry
private ServerName transformServerName(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.GetActiveMasterResponse resp)
public CompletableFuture<ServerName> getActiveMaster()
ConnectionRegistry
getActiveMaster
in interface ConnectionRegistry
Set<ServerName> getParsedMasterServers()
public void close()
ConnectionRegistry
close
in interface Closeable
close
in interface AutoCloseable
close
in interface ConnectionRegistry
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.