Skip to content

Commit beb307b

Browse files
ArthurSXL8Apache9
authored andcommitted
HBASE-22699 refactor isMetaClearingException (#436)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
1 parent b33da76 commit beb307b

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/ClientExceptionsUtil.java

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import org.apache.hadoop.hbase.CallDroppedException;
3333
import org.apache.hadoop.hbase.CallQueueTooBigException;
3434
import org.apache.hadoop.hbase.DoNotRetryIOException;
35-
import org.apache.hadoop.hbase.MultiActionResultTooLarge;
3635
import org.apache.hadoop.hbase.NotServingRegionException;
3736
import org.apache.hadoop.hbase.RegionTooBusyException;
3837
import org.apache.hadoop.hbase.RetryImmediatelyException;
@@ -59,18 +58,23 @@ public static boolean isMetaClearingException(Throwable cur) {
5958
if (cur == null) {
6059
return true;
6160
}
62-
return !isSpecialException(cur) || (cur instanceof RegionMovedException)
63-
|| cur instanceof NotServingRegionException;
61+
return !regionDefinitelyOnTheRegionServerException(cur);
6462
}
6563

66-
public static boolean isSpecialException(Throwable cur) {
67-
return (cur instanceof RegionMovedException || cur instanceof RegionOpeningException
68-
|| cur instanceof RegionTooBusyException || cur instanceof RpcThrottlingException
69-
|| cur instanceof MultiActionResultTooLarge || cur instanceof RetryImmediatelyException
70-
|| cur instanceof CallQueueTooBigException || cur instanceof CallDroppedException
71-
|| cur instanceof NotServingRegionException || cur instanceof RequestTooBigException);
64+
private static boolean regionDefinitelyOnTheRegionServerException(Throwable t) {
65+
return (t instanceof RegionTooBusyException || t instanceof RpcThrottlingException
66+
|| t instanceof RetryImmediatelyException || t instanceof CallQueueTooBigException
67+
|| t instanceof CallDroppedException || t instanceof NotServingRegionException
68+
|| t instanceof RequestTooBigException);
7269
}
7370

71+
/**
72+
* This function is the alias of regionDefinitelyOnTheRegionServerException,
73+
* whose name is confusing in the function findException().
74+
*/
75+
private static boolean matchExceptionWeCare(Throwable t) {
76+
return regionDefinitelyOnTheRegionServerException(t);
77+
}
7478

7579
/**
7680
* Look for an exception we know in the remote exception:
@@ -87,15 +91,15 @@ public static Throwable findException(Object exception) {
8791
}
8892
Throwable cur = (Throwable) exception;
8993
while (cur != null) {
90-
if (isSpecialException(cur)) {
94+
if (matchExceptionWeCare(cur)) {
9195
return cur;
9296
}
9397
if (cur instanceof RemoteException) {
9498
RemoteException re = (RemoteException) cur;
9599
cur = re.unwrapRemoteException();
96100

97101
// unwrapRemoteException can return the exception given as a parameter when it cannot
98-
// unwrap it. In this case, there is no need to look further
102+
// unwrap it. In this case, there is no need to look further
99103
// noinspection ObjectEquality
100104
if (cur == re) {
101105
return cur;

0 commit comments

Comments
 (0)