@InterfaceAudience.Private public final class ConnectionUtils extends Object
Modifier and Type | Class and Description |
---|---|
(package private) static interface |
ConnectionUtils.Converter<D,I,S> |
(package private) static interface |
ConnectionUtils.RpcCall<RESP,REQ> |
Modifier and Type | Field and Description |
---|---|
static String |
HBASE_CLIENT_CONNECTION_IMPL
Key for configuration in Configuration whose value is the class we implement making a new
Connection instance.
|
private static org.slf4j.Logger |
LOG |
(package private) static byte[] |
MAX_BYTE_ARRAY |
private static String |
MY_ADDRESS |
(package private) static NonceGenerator |
NO_NONCE_GENERATOR
Dummy nonce generator for disabled nonces.
|
(package private) static long |
SLEEP_DELTA_NS |
Modifier | Constructor and Description |
---|---|
private |
ConnectionUtils() |
Modifier and Type | Method and Description |
---|---|
(package private) static <T> CompletableFuture<List<T>> |
allOf(List<CompletableFuture<T>> futures) |
(package private) static long |
calcEstimatedSize(Result rs) |
(package private) static int |
calcPriority(int priority,
TableName tableName)
Select the priority for the rpc call.
|
(package private) static <REQ,PREQ,PRESP,RESP> |
call(HBaseRpcController controller,
HRegionLocation loc,
org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.Interface stub,
REQ req,
ConnectionUtils.Converter<PREQ,byte[],REQ> reqConvert,
ConnectionUtils.RpcCall<PRESP,PREQ> rpcCall,
ConnectionUtils.Converter<RESP,HBaseRpcController,PRESP> respConverter) |
(package private) static void |
checkHasFamilies(Mutation mutation) |
private static <T> void |
connect(CompletableFuture<T> srcFuture,
CompletableFuture<T> dstFuture,
Optional<MetricsConnection> metrics)
Connect the two futures, if the src future is done, then mark the dst future as done.
|
(package private) static byte[] |
createCloseRowBefore(byte[] row)
Create a row before the specified row and very close to the specified row.
|
(package private) static byte[] |
createClosestRowAfter(byte[] row)
Create the closest row after the specified row
|
static ScanResultCache |
createScanResultCache(Scan scan) |
(package private) static Result |
filterCells(Result result,
Cell keepCellsAfter) |
(package private) static RegionLocateType |
getLocateType(Scan scan) |
private static String |
getMyAddress() |
(package private) static <T> CompletableFuture<T> |
getOrFetch(AtomicReference<T> cacheRef,
AtomicReference<CompletableFuture<T>> futureRef,
boolean reload,
Supplier<CompletableFuture<T>> fetch,
Predicate<T> validator,
String type) |
static long |
getPauseTime(long pause,
int tries)
Calculate pause time.
|
(package private) static int |
getPriority(TableName tableName) |
(package private) static String |
getStubKey(String serviceName,
ServerName serverName)
Get a unique key for the rpc stub to the given server.
|
(package private) static void |
incRegionCountMetrics(ScanMetrics scanMetrics) |
(package private) static void |
incRPCCallsMetrics(ScanMetrics scanMetrics,
boolean isRegionServerRemote) |
(package private) static void |
incRPCRetriesMetrics(ScanMetrics scanMetrics,
boolean isRegionServerRemote) |
(package private) static boolean |
isEmptyStartRow(byte[] row) |
(package private) static boolean |
isEmptyStopRow(byte[] row) |
(package private) static boolean |
isRemote(String host) |
(package private) static boolean |
noMoreResultsForReverseScan(Scan scan,
RegionInfo info) |
(package private) static boolean |
noMoreResultsForScan(Scan scan,
RegionInfo info) |
(package private) static void |
resetController(HBaseRpcController controller,
long timeoutNs,
int priority) |
(package private) static int |
retries2Attempts(int retries)
Return retires + 1.
|
private static <T> void |
sendRequestsToSecondaryReplicas(Function<Integer,CompletableFuture<T>> requestReplica,
RegionLocations locs,
CompletableFuture<T> future,
Optional<MetricsConnection> metrics) |
(package private) static void |
setCoprocessorError(org.apache.hbase.thirdparty.com.google.protobuf.RpcController controller,
Throwable error) |
static void |
setServerSideHConnectionRetriesConfig(org.apache.hadoop.conf.Configuration c,
String sn,
org.slf4j.Logger log)
Changes the configuration to set the number of retries needed when using Connection internally,
e.g.
|
(package private) static void |
shutdownPool(ExecutorService pool) |
(package private) static <T> CompletableFuture<T> |
timelineConsistentRead(AsyncRegionLocator locator,
TableName tableName,
Query query,
byte[] row,
RegionLocateType locateType,
Function<Integer,CompletableFuture<T>> requestReplica,
long rpcTimeoutNs,
long primaryCallTimeoutNs,
org.apache.hbase.thirdparty.io.netty.util.Timer retryTimer,
Optional<MetricsConnection> metrics) |
(package private) static Get |
toCheckExistenceOnly(Get get) |
(package private) static List<Get> |
toCheckExistenceOnly(List<Get> gets) |
(package private) static Throwable |
translateException(Throwable t) |
(package private) static void |
updateResultsMetrics(ScanMetrics scanMetrics,
Result[] rrs,
boolean isRegionServerRemote) |
(package private) static void |
updateServerSideMetrics(ScanMetrics scanMetrics,
org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ScanResponse response)
Use the scan metrics returned by the server to add to the identically named counters in the
client side metrics.
|
(package private) static void |
updateStats(Optional<ServerStatisticTracker> optStats,
Optional<MetricsConnection> optMetrics,
ServerName serverName,
MultiResponse resp) |
(package private) static void |
validatePut(Put put,
int maxKeyValueSize) |
(package private) static void |
validatePutsInRowMutations(RowMutations rowMutations,
int maxKeyValueSize) |
private static final org.slf4j.Logger LOG
public static final String HBASE_CLIENT_CONNECTION_IMPL
static final NonceGenerator NO_NONCE_GENERATOR
static final byte[] MAX_BYTE_ARRAY
static final long SLEEP_DELTA_NS
private static final String MY_ADDRESS
private ConnectionUtils()
public static long getPauseTime(long pause, int tries)
HConstants.RETRY_BACKOFF
.pause
- time to pausetries
- amount of triestries
retriespublic static void setServerSideHConnectionRetriesConfig(org.apache.hadoop.conf.Configuration c, String sn, org.slf4j.Logger log)
c
- The Configuration instance to set the retries into.log
- Used to log what we set in here.static String getStubKey(String serviceName, ServerName serverName)
static int retries2Attempts(int retries)
static void checkHasFamilies(Mutation mutation)
static byte[] createClosestRowAfter(byte[] row)
static byte[] createCloseRowBefore(byte[] row)
static boolean isEmptyStartRow(byte[] row)
static boolean isEmptyStopRow(byte[] row)
static void resetController(HBaseRpcController controller, long timeoutNs, int priority)
static Throwable translateException(Throwable t)
static long calcEstimatedSize(Result rs)
static Result filterCells(Result result, Cell keepCellsAfter)
static Get toCheckExistenceOnly(Get get)
static List<Get> toCheckExistenceOnly(List<Get> gets)
static RegionLocateType getLocateType(Scan scan)
static boolean noMoreResultsForScan(Scan scan, RegionInfo info)
static boolean noMoreResultsForReverseScan(Scan scan, RegionInfo info)
static <T> CompletableFuture<List<T>> allOf(List<CompletableFuture<T>> futures)
public static ScanResultCache createScanResultCache(Scan scan)
private static String getMyAddress()
static void incRPCCallsMetrics(ScanMetrics scanMetrics, boolean isRegionServerRemote)
static void incRPCRetriesMetrics(ScanMetrics scanMetrics, boolean isRegionServerRemote)
static void updateResultsMetrics(ScanMetrics scanMetrics, Result[] rrs, boolean isRegionServerRemote)
static void updateServerSideMetrics(ScanMetrics scanMetrics, org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ScanResponse response)
static void incRegionCountMetrics(ScanMetrics scanMetrics)
private static <T> void connect(CompletableFuture<T> srcFuture, CompletableFuture<T> dstFuture, Optional<MetricsConnection> metrics)
private static <T> void sendRequestsToSecondaryReplicas(Function<Integer,CompletableFuture<T>> requestReplica, RegionLocations locs, CompletableFuture<T> future, Optional<MetricsConnection> metrics)
static <T> CompletableFuture<T> timelineConsistentRead(AsyncRegionLocator locator, TableName tableName, Query query, byte[] row, RegionLocateType locateType, Function<Integer,CompletableFuture<T>> requestReplica, long rpcTimeoutNs, long primaryCallTimeoutNs, org.apache.hbase.thirdparty.io.netty.util.Timer retryTimer, Optional<MetricsConnection> metrics)
static void validatePut(Put put, int maxKeyValueSize)
static void validatePutsInRowMutations(RowMutations rowMutations, int maxKeyValueSize)
static int calcPriority(int priority, TableName tableName)
HConstants.SYSTEMTABLE_QOS
.HConstants.NORMAL_QOS
.priority
- the priority set by user, can be HConstants.PRIORITY_UNSET
.tableName
- the table we operate onstatic int getPriority(TableName tableName)
static <T> CompletableFuture<T> getOrFetch(AtomicReference<T> cacheRef, AtomicReference<CompletableFuture<T>> futureRef, boolean reload, Supplier<CompletableFuture<T>> fetch, Predicate<T> validator, String type)
static void updateStats(Optional<ServerStatisticTracker> optStats, Optional<MetricsConnection> optMetrics, ServerName serverName, MultiResponse resp)
static <REQ,PREQ,PRESP,RESP> CompletableFuture<RESP> call(HBaseRpcController controller, HRegionLocation loc, org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.Interface stub, REQ req, ConnectionUtils.Converter<PREQ,byte[],REQ> reqConvert, ConnectionUtils.RpcCall<PRESP,PREQ> rpcCall, ConnectionUtils.Converter<RESP,HBaseRpcController,PRESP> respConverter)
static void shutdownPool(ExecutorService pool)
static void setCoprocessorError(org.apache.hbase.thirdparty.com.google.protobuf.RpcController controller, Throwable error)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.