Repository: hbase Updated Branches: refs/heads/0.98 da94cd398 -> 174b59ff8
HBASE-11374 RpcRetryingCaller#callWithoutRetries has a timeout of zero Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/174b59ff Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/174b59ff Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/174b59ff Branch: refs/heads/0.98 Commit: 174b59ff8f59643b6aacbbf269108432336e7116 Parents: da94cd3 Author: Nicolas Liochon <nkey...@gmail.com> Authored: Thu Jun 19 10:59:41 2014 +0200 Committer: Nicolas Liochon <nkey...@gmail.com> Committed: Thu Jun 19 10:59:41 2014 +0200 ---------------------------------------------------------------------- .../main/java/org/apache/hadoop/hbase/client/AsyncProcess.java | 6 +++++- .../java/org/apache/hadoop/hbase/client/RpcRetryingCaller.java | 4 +++- .../java/org/apache/hadoop/hbase/client/TestAsyncProcess.java | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/174b59ff/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncProcess.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncProcess.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncProcess.java index 0c9ce20..7ad3d7b 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncProcess.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncProcess.java @@ -108,6 +108,7 @@ class AsyncProcess<CResult> { new ConcurrentSkipListMap<byte[], AtomicInteger>(Bytes.BYTES_COMPARATOR); protected final ConcurrentMap<ServerName, AtomicInteger> taskCounterPerServer = new ConcurrentHashMap<ServerName, AtomicInteger>(); + protected final int timeout; /** * The number of tasks simultaneously executed on the cluster. @@ -218,6 +219,9 @@ class AsyncProcess<CResult> { HConstants.DEFAULT_HBASE_CLIENT_PAUSE); this.numTries = conf.getInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, HConstants.DEFAULT_HBASE_CLIENT_RETRIES_NUMBER); + this.timeout = conf.getInt(HConstants.HBASE_RPC_TIMEOUT_KEY, + HConstants.DEFAULT_HBASE_RPC_TIMEOUT); + this.maxTotalConcurrentTasks = conf.getInt(HConstants.HBASE_CLIENT_MAX_TOTAL_TASKS, HConstants.DEFAULT_HBASE_CLIENT_MAX_TOTAL_TASKS); @@ -536,7 +540,7 @@ class AsyncProcess<CResult> { try { MultiServerCallable<Row> callable = createCallable(loc, multiAction); try { - res = createCaller(callable).callWithoutRetries(callable); + res = createCaller(callable).callWithoutRetries(callable, timeout); } catch (IOException e) { // The service itself failed . It may be an error coming from the communication // layer, but, as well, a functional error raised by the server. http://git-wip-us.apache.org/repos/asf/hbase/blob/174b59ff/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCaller.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCaller.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCaller.java index 1dd6634..f6ad76a 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCaller.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCaller.java @@ -169,10 +169,11 @@ public class RpcRetryingCaller<T> { * @throws IOException if a remote or network exception occurs * @throws RuntimeException other unspecified error */ - public T callWithoutRetries(RetryingCallable<T> callable) + public T callWithoutRetries(RetryingCallable<T> callable, int callTimeout) throws IOException, RuntimeException { // The code of this method should be shared with withRetries. this.globalStartTime = EnvironmentEdgeManager.currentTimeMillis(); + this.callTimeout = callTimeout; try { beforeCall(); callable.prepare(false); @@ -191,6 +192,7 @@ public class RpcRetryingCaller<T> { } } + /** * Get the good or the remote exception if any, throws the DoNotRetryIOException. * @param t the throwable to analyze http://git-wip-us.apache.org/repos/asf/hbase/blob/174b59ff/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncProcess.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncProcess.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncProcess.java index a9402cc..74fbb17 100644 --- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncProcess.java +++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncProcess.java @@ -109,7 +109,7 @@ public class TestAsyncProcess { nbMultiResponse, nbActions); return new RpcRetryingCaller<MultiResponse>(100, 10) { @Override - public MultiResponse callWithoutRetries( RetryingCallable<MultiResponse> callable) + public MultiResponse callWithoutRetries(RetryingCallable<MultiResponse> callable, int to) throws IOException, RuntimeException { try { // sleep one second in order for threadpool to start another thread instead of reusing @@ -131,7 +131,7 @@ public class TestAsyncProcess { } @Override - public MultiResponse callWithoutRetries(RetryingCallable<MultiResponse> callable) + public MultiResponse callWithoutRetries(RetryingCallable<MultiResponse> callable, int to) throws IOException, RuntimeException { throw new IOException("test"); }