diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java index 54fbfe9..fbd9f51 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java @@ -440,7 +440,7 @@ public class HTable implements Table { connConfiguration.getRetriesNumber(), operationTimeout, connConfiguration.getPrimaryCallTimeoutMicroSecond()); - return callable.call(); + return callable.call(operationTimeout); } diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerWithReadReplicas.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerWithReadReplicas.java index 425d314..1fce88b 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerWithReadReplicas.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerWithReadReplicas.java @@ -188,7 +188,7 @@ public class RpcRetryingCallerWithReadReplicas { * Globally, the number of retries, timeout and so on still applies, but it's per replica, * not global. We continue until all retries are done, or all timeouts are exceeded. */ - public synchronized Result call() + public synchronized Result call(int operationTimeout) throws DoNotRetryIOException, InterruptedIOException, RetriesExhaustedException { boolean isTargetReplicaSpecified = (get.getReplicaId() >= 0); @@ -221,7 +221,10 @@ public class RpcRetryingCallerWithReadReplicas { try { try { - Future f = cs.take(); + Future f = cs.poll(operationTimeout, TimeUnit.MILLISECONDS); + if (f == null) { + throw new RetriesExhaustedException("timed out after " + operationTimeout + " ms"); + } return f.get(); } catch (ExecutionException e) { throwEnrichedException(e, retries);