重要参数
参见: org.apache.hadoop.hbase.HConstants
hbase.rpc.timeout:表示一次RPC请求的超时时间 默认值: public static int DEFAULT_HBASE_RPC_TIMEOUT = 60000;
hbase.client.operation.timeout:该值与hbase.rpc.timeout的区别为,hbase.rpc.timeout为一次rpc调用的超时时间。而hbase.client.operation.timeout为一次操作总的时间(从开始调用到重试n次之后失败的总时间) 默认值: public static final int DEFAULT_HBASE_CLIENT_OPERATION_TIMEOUT = Integer.MAX_VALUE;
hbase.client.pause:失败重试时等待时间,随着重试次数越多,重试等待时间越长 默认值: public static long DEFAULT_HBASE_CLIENT_PAUSE = 100;
hbase.client.retries.number:失败时重试次数 默认值: public static int DEFAULT_HBASE_CLIENT_RETRIES_NUMBER = 31;
hbase.client.scanner.timeout.period:HBase客户端2次scan操作间隔时间 默认值: public static int DEFAULT_HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD = 60000;
源代码分析
参见:org.apache.hadoop.hbase.client.HTable
可见hbase.client.operation.timeout和get、append、increment、delete、put 等操作相关
具体分析
rpcCallerFactory.<Result> newCaller().callWithRetries(callable, this.operationTimeout)
源码如下
/**
* Retries if invocation fails.
* @param callTimeout Timeout for this call
* @param callable The {@link RetryingCallable} to run.
* @return an object of type T
* @throws IOException if a remote or network exception occurs
* @throws RuntimeException other unspecified error
*/
@edu.umd.cs.findbugs.annotations.SuppressWarnings
(value = "SWL_SLEEP_WITH_LOCK_HELD", justification = "na")
public synchronized T callWithRetries(RetryingCallable<T> callable, int callTimeout)
throws IOException, RuntimeException {
this.callTimeout = callTimeout;
List<RetriesExhaustedException.ThrowableWithExtraContext> exceptions =
new ArrayList<RetriesExhaustedException.ThrowableWithExtraContext>();
this.globalStartTime = EnvironmentEdgeManager.currentTimeMillis();
for (int tries = 0;; tries++) {
long expectedSleep = 0;
try {
beforeCall();
callable.prepare(tries != 0); /