HBASE-25937: Clarify UnknownRegionException (#3330)

Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
belugabehr 2021-06-22 10:36:30 -04:00 committed by GitHub
parent f640eef924
commit d44292ac1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 6 deletions

View File

@ -29,9 +29,21 @@ public class UnknownRegionException extends DoNotRetryRegionException {
private static final long serialVersionUID = 1968858760475205392L;
/**
* @param regionName the name of the region which is unknown
* Constructs a new UnknownRegionException with the specified detail message.
*
* @param message the detail message
*/
public UnknownRegionException(String regionName) {
super(regionName);
public UnknownRegionException(String message) {
super(message);
}
/**
* Constructs a new UnknownRegionException with the specified detail message and cause.
*
* @param message the detail message
* @param cause the cause of the exception
*/
public UnknownRegionException(String message, Throwable cause) {
super(message, cause);
}
}

View File

@ -37,6 +37,10 @@ public class DoNotRetryRegionException extends DoNotRetryIOException {
super(s);
}
public DoNotRetryRegionException(String s, Throwable cause) {
super(s, cause);
}
public DoNotRetryRegionException(Throwable cause) {
super(cause);
}

View File

@ -1628,9 +1628,9 @@ public class AssignmentManager {
regionStateStore.visitMetaForRegion(regionEncodedName, visitor);
return regionStates.getRegionState(regionEncodedName) == null ? null :
regionStates.getRegionState(regionEncodedName).getRegion();
} catch(IOException e) {
LOG.error("Error trying to load region {} from META", regionEncodedName, e);
throw new UnknownRegionException("Error while trying load region from meta");
} catch (IOException e) {
throw new UnknownRegionException(
"Error trying to load region " + regionEncodedName + " from META", e);
}
}