You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ps...@apache.org on 2019/09/19 11:23:24 UTC

[hbase] branch branch-2.2 updated: Revert "HBASE-22700 refactor isMetaClearingException (#578)"

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

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


The following commit(s) were added to refs/heads/branch-2.2 by this push:
     new 6698268  Revert "HBASE-22700 refactor isMetaClearingException (#578)"
6698268 is described below

commit 669826882b6b327fb15ad09ce7e3f136e05cd51c
Author: Peter Somogyi <ps...@apache.org>
AuthorDate: Thu Sep 19 13:22:42 2019 +0200

    Revert "HBASE-22700 refactor isMetaClearingException (#578)"
    
    This reverts commit b1d487872485325b044dcfaca3b3c62a6afb05e7.
---
 .../hbase/client/AsyncRegionLocatorHelper.java     |  4 +--
 .../hbase/client/AsyncRequestFutureImpl.java       |  6 ++---
 .../hbase/client/ConnectionImplementation.java     |  3 +--
 .../hbase/exceptions/ClientExceptionsUtil.java     | 31 ++++++++--------------
 .../apache/hadoop/hbase/client/TestMetaCache.java  | 10 ++-----
 5 files changed, 17 insertions(+), 37 deletions(-)

diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRegionLocatorHelper.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRegionLocatorHelper.java
index a4191d9..5f4bc9f 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRegionLocatorHelper.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRegionLocatorHelper.java
@@ -19,7 +19,6 @@ package org.apache.hadoop.hbase.client;
 
 import static org.apache.hadoop.hbase.exceptions.ClientExceptionsUtil.findException;
 import static org.apache.hadoop.hbase.exceptions.ClientExceptionsUtil.isMetaClearingException;
-import static org.apache.hadoop.hbase.exceptions.ClientExceptionsUtil.isRegionServerOverloadedException;
 
 import java.util.Arrays;
 import java.util.Optional;
@@ -68,8 +67,7 @@ final class AsyncRegionLocatorHelper {
       LOG.debug("The actual exception when updating {} is {}", loc,
         cause != null ? cause.toString() : "none");
     }
-    if (cause == null || !isMetaClearingException(cause)
-        || isRegionServerOverloadedException(cause)) {
+    if (cause == null || !isMetaClearingException(cause)) {
       LOG.debug("Will not update {} because the exception is null or not the one we care about",
         loc);
       return;
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 c76cd0b..e46a50e 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
@@ -711,8 +711,7 @@ class AsyncRequestFutureImpl<CResult> implements AsyncRequestFuture {
       // Do not use the exception for updating cache because it might be coming from
       // any of the regions in the MultiAction.
       updateCachedLocations(server, regionName, row,
-        ClientExceptionsUtil.isMetaClearingException(t) &&
-            !ClientExceptionsUtil.isRegionServerOverloadedException(t) ? null : t);
+        ClientExceptionsUtil.isMetaClearingException(t) ? null : t);
       for (Action action : e.getValue()) {
         Retry retry = manageError(
             action.getOriginalIndex(), action.getAction(), canRetry, t, server);
@@ -914,8 +913,7 @@ class AsyncRequestFutureImpl<CResult> implements AsyncRequestFuture {
   }
 
   private void cleanServerCache(ServerName server, Throwable regionException) {
-    if (ClientExceptionsUtil.isMetaClearingException(regionException)
-        && !ClientExceptionsUtil.isRegionServerOverloadedException(regionException)) {
+    if (ClientExceptionsUtil.isMetaClearingException(regionException)) {
       // We want to make sure to clear the cache in case there were location-related exceptions.
       // We don't to clear the cache for every possible exception that comes through, however.
       asyncProcess.connection.clearCaches(server);
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java
index 43fd65d..af8429e 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java
@@ -1911,8 +1911,7 @@ class ConnectionImplementation implements ClusterConnection, Closeable {
     RegionInfo regionInfo = oldLocation.getRegion();
     Throwable cause = ClientExceptionsUtil.findException(exception);
     if (cause != null) {
-      if (!ClientExceptionsUtil.isMetaClearingException(cause)
-          || ClientExceptionsUtil.isRegionServerOverloadedException(cause)) {
+      if (!ClientExceptionsUtil.isMetaClearingException(cause)) {
         // We know that the region is still on this region server
         return;
       }
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/ClientExceptionsUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/ClientExceptionsUtil.java
index e330c3c..6b1e251 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/ClientExceptionsUtil.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/ClientExceptionsUtil.java
@@ -32,6 +32,7 @@ import java.util.concurrent.TimeoutException;
 import org.apache.hadoop.hbase.CallDroppedException;
 import org.apache.hadoop.hbase.CallQueueTooBigException;
 import org.apache.hadoop.hbase.DoNotRetryIOException;
+import org.apache.hadoop.hbase.MultiActionResultTooLarge;
 import org.apache.hadoop.hbase.NotServingRegionException;
 import org.apache.hadoop.hbase.RegionTooBusyException;
 import org.apache.hadoop.hbase.RetryImmediatelyException;
@@ -58,28 +59,18 @@ public final class ClientExceptionsUtil {
     if (cur == null) {
       return true;
     }
-    return !isMetaCachePreservingException(cur);
+    return !isSpecialException(cur) || (cur instanceof RegionMovedException)
+        || cur instanceof NotServingRegionException;
   }
 
-  public static boolean isRegionServerOverloadedException(Throwable t) {
-    t = findException(t);
-    return isInstanceOfRegionServerOverloadedException(t);
-  }
-
-  private static boolean isInstanceOfRegionServerOverloadedException(Throwable t) {
-    return t instanceof CallQueueTooBigException || t instanceof CallDroppedException;
+  public static boolean isSpecialException(Throwable cur) {
+    return (cur instanceof RegionMovedException || cur instanceof RegionOpeningException
+        || cur instanceof RegionTooBusyException || cur instanceof RpcThrottlingException
+        || cur instanceof MultiActionResultTooLarge || cur instanceof RetryImmediatelyException
+        || cur instanceof CallQueueTooBigException || cur instanceof CallDroppedException
+        || cur instanceof NotServingRegionException || cur instanceof RequestTooBigException);
   }
 
-  private static boolean isMetaCachePreservingException(Throwable t) {
-    return t instanceof RegionOpeningException || t instanceof RegionTooBusyException
-        || t instanceof RpcThrottlingException || t instanceof RetryImmediatelyException
-        || t instanceof RequestTooBigException;
-  }
-
-  private static boolean isExceptionWeCare(Throwable t) {
-    return isMetaCachePreservingException(t) || isInstanceOfRegionServerOverloadedException(t)
-        || t instanceof NotServingRegionException;
-  }
 
   /**
    * Look for an exception we know in the remote exception:
@@ -96,7 +87,7 @@ public final class ClientExceptionsUtil {
     }
     Throwable cur = (Throwable) exception;
     while (cur != null) {
-      if (isExceptionWeCare(cur)) {
+      if (isSpecialException(cur)) {
         return cur;
       }
       if (cur instanceof RemoteException) {
@@ -104,7 +95,7 @@ public final class ClientExceptionsUtil {
         cur = re.unwrapRemoteException();
 
         // unwrapRemoteException can return the exception given as a parameter when it cannot
-        // unwrap it. In this case, there is no need to look further
+        //  unwrap it. In this case, there is no need to look further
         // noinspection ObjectEquality
         if (cur == re) {
           return cur;
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaCache.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaCache.java
index f159ab8..3870244 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaCache.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaCache.java
@@ -27,7 +27,6 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.CallDroppedException;
 import org.apache.hadoop.hbase.CallQueueTooBigException;
 import org.apache.hadoop.hbase.HBaseClassTestRule;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
@@ -41,7 +40,6 @@ import org.apache.hadoop.hbase.RetryImmediatelyException;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.exceptions.ClientExceptionsUtil;
 import org.apache.hadoop.hbase.exceptions.RegionOpeningException;
-import org.apache.hadoop.hbase.exceptions.RequestTooBigException;
 import org.apache.hadoop.hbase.quotas.RpcThrottlingException;
 import org.apache.hadoop.hbase.regionserver.HRegionServer;
 import org.apache.hadoop.hbase.regionserver.RSRpcServices;
@@ -145,14 +143,12 @@ public class TestMetaCache {
           table.mutateRow(mutations);
         } catch (IOException ex) {
           // Only keep track of the last exception that updated the meta cache
-          if ((ClientExceptionsUtil.isMetaClearingException(ex)
-              && !ClientExceptionsUtil.isRegionServerOverloadedException(ex)) || success) {
+          if (ClientExceptionsUtil.isMetaClearingException(ex) || success) {
             exp = ex;
           }
         }
         // Do not test if we did not touch the meta cache in this iteration.
-        if (exp != null && ClientExceptionsUtil.isMetaClearingException(exp)
-            && !ClientExceptionsUtil.isRegionServerOverloadedException(exp)) {
+        if (exp != null && ClientExceptionsUtil.isMetaClearingException(exp)) {
           assertNull(conn.getCachedLocation(TABLE_NAME, row));
         } else if (success) {
           assertNotNull(conn.getCachedLocation(TABLE_NAME, row));
@@ -211,9 +207,7 @@ public class TestMetaCache {
         add(new RpcThrottlingException(" "));
         add(new MultiActionResultTooLarge(" "));
         add(new RetryImmediatelyException(" "));
-        add(new RequestTooBigException());
         add(new CallQueueTooBigException());
-        add(new CallDroppedException());
     }};
   }