This is an automated email from the ASF dual-hosted git repository.

zhangduo pushed a commit to branch branch-3
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-3 by this push:
     new fa9a2c382e1 HBASE-29232 give up retrying earlier for some admin 
operations (#6871)
fa9a2c382e1 is described below

commit fa9a2c382e103ea3292c0bb2cff2ad991286348c
Author: Duo Zhang <[email protected]>
AuthorDate: Fri Apr 11 21:59:57 2025 +0800

    HBASE-29232 give up retrying earlier for some admin operations (#6871)
    
    We do not implement complicated relocating logic for admin operations,
    so when region is moved, we just fail the operations immediately, like
    compacting table, etc.
    
    Signed-off-by: Nihal Jain <[email protected]>
    Reviewed-by: lvhaiping.lhp <[email protected]>
    (cherry picked from commit 295f0781bca36aa6b4620a0dd2bf2197f58d6440)
---
 .../hbase/client/AsyncAdminRequestRetryingCaller.java    | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncAdminRequestRetryingCaller.java
 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncAdminRequestRetryingCaller.java
index f7fa7e9f03f..966ba7c6898 100644
--- 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncAdminRequestRetryingCaller.java
+++ 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncAdminRequestRetryingCaller.java
@@ -22,6 +22,8 @@ import static 
org.apache.hadoop.hbase.util.FutureUtils.addListener;
 import java.io.IOException;
 import java.util.Collections;
 import java.util.concurrent.CompletableFuture;
+import org.apache.hadoop.hbase.DoNotRetryIOException;
+import org.apache.hadoop.hbase.NotServingRegionException;
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.ipc.HBaseRpcController;
 import org.apache.yetus.audience.InterfaceAudience;
@@ -50,6 +52,20 @@ public class AsyncAdminRequestRetryingCaller<T> extends 
AsyncRpcRetryingCaller<T
     this.callable = callable;
   }
 
+  @Override
+  protected Throwable preProcessError(Throwable error) {
+    // This retrying caller is mainly used for admin operations, thus we do 
not implement
+    // complicated relocating logic. If here we get a 
NotServingRegionException, there is no way to
+    // recover since we just pass in the server name, which means we can not 
send request to another
+    // region server. So here we just wrap it with a DoNotRetryIOException to 
fail the request
+    // immediately
+    if (error instanceof NotServingRegionException) {
+      return new DoNotRetryIOException("region is not on " + serverName + ", 
give up retrying",
+        error);
+    }
+    return error;
+  }
+
   @Override
   protected void doCall() {
     AdminService.Interface adminStub;

Reply via email to