-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-22699 refactor isMetaClearingException #578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -59,18 +58,28 @@ public static boolean isMetaClearingException(Throwable cur) { | |
if (cur == null) { | ||
return true; | ||
} | ||
return !isSpecialException(cur) || (cur instanceof RegionMovedException) | ||
|| cur instanceof NotServingRegionException; | ||
return !isMetaCachePreservingException(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); | ||
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; | ||
} | ||
|
||
private static boolean isMetaCachePreservingException(Throwable t) { | ||
return t instanceof RegionOpeningException || t instanceof RegionTooBusyException | ||
|| t instanceof RpcThrottlingException || t instanceof RetryImmediatelyException | ||
|| t instanceof RequestTooBigException; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, this list here is smaller than the list above in the old isSpecialException. I looked at one or two of the differences. It seems like superclasses are listed here and you drop the mention of subclasses. Is that the case? Just a little worried we're not catching something here that we used to. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, just remove subclasses, you mean the detailed messages in the subclass? |
||
} | ||
|
||
private static boolean isExceptionWeCare(Throwable t) { | ||
return isMetaCachePreservingException(t) || isInstanceOfRegionServerOverloadedException(t) | ||
|| t instanceof NotServingRegionException; | ||
} | ||
|
||
/** | ||
* Look for an exception we know in the remote exception: | ||
|
@@ -87,15 +96,15 @@ public static Throwable findException(Object exception) { | |
} | ||
Throwable cur = (Throwable) exception; | ||
while (cur != null) { | ||
if (isSpecialException(cur)) { | ||
if (isExceptionWeCare(cur)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok. Good. isSpecialException is an awful name. isExceptionWeCare is too but you made it private and it is only used here so its ok. |
||
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; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good namings.