You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2019/01/24 07:10:46 UTC
[hbase] branch branch-2.0 updated: HBASE-21715 set timeout instead
of throwing Exception when calling ProcedureFuture.get in client side.
This is an automated email from the ASF dual-hosted git repository.
zhangduo pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 2f2d2ae HBASE-21715 set timeout instead of throwing Exception when calling ProcedureFuture.get in client side.
2f2d2ae is described below
commit 2f2d2ae06617aa4c02f13d6d37f0bb822916e7ee
Author: xujunhong <xu...@xiaomi.com>
AuthorDate: Wed Jan 23 19:42:59 2019 +0800
HBASE-21715 set timeout instead of throwing Exception when calling ProcedureFuture.get in client side.
Signed-off-by: Duo Zhang <zh...@apache.org>
---
.../java/org/apache/hadoop/hbase/client/HBaseAdmin.java | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
index a050d2d..474cd9d 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
@@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.client;
import com.google.protobuf.Descriptors;
import com.google.protobuf.Message;
import com.google.protobuf.RpcController;
+
import java.io.Closeable;
import java.io.IOException;
import java.io.InterruptedIOException;
@@ -43,6 +44,7 @@ import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.Abortable;
import org.apache.hadoop.hbase.CacheEvictionStats;
@@ -234,6 +236,7 @@ public class HBaseAdmin implements Admin {
private boolean aborted;
private int operationTimeout;
private int rpcTimeout;
+ private int getProcedureTimeout;
private RpcRetryingCallerFactory rpcCallerFactory;
private RpcControllerFactory rpcControllerFactory;
@@ -260,6 +263,8 @@ public class HBaseAdmin implements Admin {
HConstants.DEFAULT_HBASE_RPC_TIMEOUT);
this.syncWaitTimeout = this.conf.getInt(
"hbase.client.sync.wait.timeout.msec", 10 * 60000); // 10min
+ this.getProcedureTimeout =
+ this.conf.getInt("hbase.client.procedure.future.get.timeout.msec", 10 * 60000); // 10min
this.rpcCallerFactory = connection.getRpcRetryingCallerFactory();
this.rpcControllerFactory = connection.getRpcControllerFactory();
@@ -3403,7 +3408,15 @@ public class HBaseAdmin implements Admin {
@Override
public V get() throws InterruptedException, ExecutionException {
// TODO: should we ever spin forever?
- throw new UnsupportedOperationException();
+ // fix HBASE-21715. TODO: If the function call get() without timeout limit is not allowed,
+ // is it possible to compose instead of inheriting from the class Future for this class?
+ try {
+ return get(admin.getProcedureTimeout, TimeUnit.MILLISECONDS);
+ } catch (TimeoutException e) {
+ LOG.warn("Failed to get the procedure with procId=" + procId + " throws exception " + e
+ .getMessage(), e);
+ return null;
+ }
}
@Override