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

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


The following commit(s) were added to refs/heads/branch-2 by this push:
     new 6fb44d07183 HBASE-29372 Meta cache clear metrics and logs shouldn't 
use "UnknownException" (#6961)
6fb44d07183 is described below

commit 6fb44d071839789319925cf1a45762dbb5da0e29
Author: Hernan Romer <[email protected]>
AuthorDate: Wed Jun 4 09:28:54 2025 -0400

    HBASE-29372 Meta cache clear metrics and logs shouldn't use 
"UnknownException" (#6961)
    
    Co-authored-by: Hernan Gelaf-Romer <[email protected]>
    Signed-off-by: Duo Zhang <[email protected]>
    Signed-off-by: Ray Mattingly <[email protected]>
---
 .../hbase/client/AsyncRequestFutureImpl.java       | 28 +++++++++++++---------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRequestFutureImpl.java
 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRequestFutureImpl.java
index b34ef863d56..498ab19b50e 100644
--- 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRequestFutureImpl.java
+++ 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRequestFutureImpl.java
@@ -219,13 +219,14 @@ class AsyncRequestFutureImpl<CResult> implements 
AsyncRequestFuture {
         } 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.
-          receiveGlobalFailure(multiAction, server, numAttempt, e, true);
+
+          receiveGlobalFailure(multiAction, server, numAttempt, e);
           return;
         } catch (Throwable t) {
           // This should not happen. Let's log & retry anyway.
           LOG.error("id=" + asyncProcess.id + ", caught throwable. Unexpected."
             + " Retrying. Server=" + server + ", tableName=" + tableName, t);
-          receiveGlobalFailure(multiAction, server, numAttempt, t, true);
+          receiveGlobalFailure(multiAction, server, numAttempt, t);
           return;
         }
         if (res.type() == AbstractResponse.ResponseType.MULTI) {
@@ -570,7 +571,6 @@ class AsyncRequestFutureImpl<CResult> implements 
AsyncRequestFuture {
    */
   void sendMultiAction(Map<ServerName, MultiAction> actionsByServer, int 
numAttempt,
     List<Action> actionsForReplicaThread, boolean reuseThread) {
-    boolean clearServerCache = true;
     // Run the last item on the same thread if we are already on a send thread.
     // We hope most of the time it will be the only item, so we can cut down 
on threads.
     int actionsRemaining = actionsByServer.size();
@@ -606,7 +606,6 @@ class AsyncRequestFutureImpl<CResult> implements 
AsyncRequestFuture {
               LOG.warn("id=" + asyncProcess.id + ", task rejected by pool. 
Unexpected." + " Server="
                 + server.getServerName(), t);
               // Do not update cache if exception is from failing to submit 
action to thread pool
-              clearServerCache = false;
             } else {
               // see #HBASE-14359 for more details
               LOG.warn("Caught unexpected exception/error: ", t);
@@ -614,7 +613,7 @@ class AsyncRequestFutureImpl<CResult> implements 
AsyncRequestFuture {
             asyncProcess.decTaskCounters(multiAction.getRegions(), server);
             // We're likely to fail again, but this will increment the attempt 
counter,
             // so it will finish.
-            receiveGlobalFailure(multiAction, server, numAttempt, t, 
clearServerCache);
+            receiveGlobalFailure(multiAction, server, numAttempt, t);
           }
         }
       }
@@ -764,13 +763,24 @@ class AsyncRequestFutureImpl<CResult> implements 
AsyncRequestFuture {
    * @param t          the throwable (if any) that caused the resubmit
    */
   private void receiveGlobalFailure(MultiAction rsActions, ServerName server, 
int numAttempt,
-    Throwable t, boolean clearServerCache) {
+    Throwable t) {
     errorsByServer.reportServerError(server);
     Retry canRetry = errorsByServer.canTryMore(numAttempt) ? Retry.YES : 
Retry.NO_RETRIES_EXHAUSTED;
+    boolean clearServerCache;
+
+    if (t instanceof RejectedExecutionException) {
+      clearServerCache = false;
+    } else {
+      clearServerCache = ClientExceptionsUtil.isMetaClearingException(t);
+    }
 
     // Do not update cache if exception is from failing to submit action to 
thread pool
     if (clearServerCache) {
       cleanServerCache(server, t);
+
+      if (LOG.isTraceEnabled()) {
+        LOG.trace("Cleared meta cache for server {} due to global failure {}", 
server, t);
+      }
     }
 
     int failed = 0;
@@ -779,12 +789,8 @@ class AsyncRequestFutureImpl<CResult> implements 
AsyncRequestFuture {
     for (Map.Entry<byte[], List<Action>> e : rsActions.actions.entrySet()) {
       byte[] regionName = e.getKey();
       byte[] row = e.getValue().get(0).getAction().getRow();
-      // Do not use the exception for updating cache because it might be 
coming from
-      // any of the regions in the MultiAction and do not update cache if 
exception is
-      // from failing to submit action to thread pool
       if (clearServerCache) {
-        updateCachedLocations(server, regionName, row,
-          ClientExceptionsUtil.isMetaClearingException(t) ? null : t);
+        updateCachedLocations(server, regionName, row, t);
       }
       for (Action action : e.getValue()) {
         Retry retry =

Reply via email to