From 4032a1bab4856e08eabfd04f3b3a02435f531748 Mon Sep 17 00:00:00 2001 From: functioner Date: Thu, 14 Apr 2022 21:43:57 -0400 Subject: [PATCH] HBASE-26955 Improvement of the pause time between retries in Rpc caller --- .../apache/hadoop/hbase/client/AsyncRpcRetryingCaller.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRpcRetryingCaller.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRpcRetryingCaller.java index 65fbbd53f4a1..844941268387 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRpcRetryingCaller.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRpcRetryingCaller.java @@ -34,11 +34,13 @@ import org.apache.hadoop.hbase.DoNotRetryIOException; import org.apache.hadoop.hbase.HBaseServerException; import org.apache.hadoop.hbase.NotServingRegionException; +import org.apache.hadoop.hbase.PleaseHoldException; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TableNotEnabledException; import org.apache.hadoop.hbase.TableNotFoundException; import org.apache.hadoop.hbase.exceptions.ScannerResetException; import org.apache.hadoop.hbase.ipc.HBaseRpcController; +import org.apache.hadoop.hbase.ipc.ServerNotRunningYetException; import org.apache.hadoop.hbase.util.EnvironmentEdgeManager; import org.apache.hadoop.hbase.util.FutureUtils; import org.apache.yetus.audience.InterfaceAudience; @@ -139,6 +141,10 @@ private void tryScheduleRetry(Throwable error) { } else { delayNs = getPauseTime(pauseNsToUse, tries - 1); } + if (!(error instanceof ServerNotRunningYetException || error instanceof PleaseHoldException)) { + // when the error does not imply dead server, do not use the retry backoff factor + delayNs = Math.min(delayNs, pauseNsToUse); + } tries++; retryTimer.newTimeout(t -> doCall(), delayNs, TimeUnit.NANOSECONDS); }