Skip to content

Commit

Permalink
HBASE-22699 refactor isMetaClearingException (#436)
Browse files Browse the repository at this point in the history
Signed-off-by: Duo Zhang <[email protected]>
  • Loading branch information
ArthurSXL8 authored and Apache9 committed Aug 12, 2019
1 parent c9d02f9 commit a0d5627
Showing 1 changed file with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
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;
Expand All @@ -59,18 +58,23 @@ public static boolean isMetaClearingException(Throwable cur) {
if (cur == null) {
return true;
}
return !isSpecialException(cur) || (cur instanceof RegionMovedException)
|| cur instanceof NotServingRegionException;
return !regionDefinitelyOnTheRegionServerException(cur);
}

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 regionDefinitelyOnTheRegionServerException(Throwable t) {
return (t instanceof RegionTooBusyException || t instanceof RpcThrottlingException
|| t instanceof RetryImmediatelyException || t instanceof CallQueueTooBigException
|| t instanceof CallDroppedException || t instanceof NotServingRegionException
|| t instanceof RequestTooBigException);
}

/**
* This function is the alias of regionDefinitelyOnTheRegionServerException,
* whose name is confusing in the function findException().
*/
private static boolean matchExceptionWeCare(Throwable t) {
return regionDefinitelyOnTheRegionServerException(t);
}

/**
* Look for an exception we know in the remote exception:
Expand All @@ -87,15 +91,15 @@ public static Throwable findException(Object exception) {
}
Throwable cur = (Throwable) exception;
while (cur != null) {
if (isSpecialException(cur)) {
if (matchExceptionWeCare(cur)) {
return cur;
}
if (cur instanceof RemoteException) {
RemoteException re = (RemoteException) cur;
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;
Expand Down

0 comments on commit a0d5627

Please sign in to comment.