This is an automated email from the ASF dual-hosted git repository.
zhangduo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/master by this push:
new d4085d1 HBASE-21715 set timeout instead of throwing Exception when
calling ProcedureFuture.get in client side.
d4085d1 is described below
commit d4085d11bc2ff1c0b329f603052e94d35a7e2ad0
Author: xujunhong <[email protected]>
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 <[email protected]>
---
.../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 34b5769..d38cc2a 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;
@@ -44,6 +45,7 @@ import java.util.function.Supplier;
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;
@@ -251,6 +253,7 @@ public class HBaseAdmin implements Admin {
private boolean aborted;
private int operationTimeout;
private int rpcTimeout;
+ private int getProcedureTimeout;
private RpcRetryingCallerFactory rpcCallerFactory;
private RpcControllerFactory rpcControllerFactory;
@@ -277,6 +280,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();
@@ -3472,7 +3477,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