HBASE-11687 No need to abort on postOpenDeployTasks exception if region opening is cancelled

This commit is contained in:
Jimmy Xiang 2014-08-12 15:49:03 -07:00
parent 4bd2da4783
commit ce6c204078
1 changed files with 14 additions and 6 deletions

View File

@ -319,13 +319,16 @@ public class OpenRegionHandler extends EventHandler {
public void run() {
try {
this.services.postOpenDeployTasks(this.region);
} catch (IOException e) {
server.abort("Exception running postOpenDeployTasks; region=" +
this.region.getRegionInfo().getEncodedName(), e);
} catch (Throwable e) {
LOG.warn("Exception running postOpenDeployTasks; region=" +
this.region.getRegionInfo().getEncodedName(), e);
String msg = "Exception running postOpenDeployTasks; region=" +
this.region.getRegionInfo().getEncodedName();
this.exception = e;
if (e instanceof IOException
&& isRegionStillOpening(region.getRegionInfo(), services)) {
server.abort(msg, e);
} else {
LOG.warn(msg, e);
}
}
// We're done. Set flag then wake up anyone waiting on thread to complete.
this.signaller.set(true);
@ -394,9 +397,14 @@ public class OpenRegionHandler extends EventHandler {
}
}
private boolean isRegionStillOpening() {
private static boolean isRegionStillOpening(
HRegionInfo regionInfo, RegionServerServices rsServices) {
byte[] encodedName = regionInfo.getEncodedNameAsBytes();
Boolean action = rsServices.getRegionsInTransitionInRS().get(encodedName);
return Boolean.TRUE.equals(action); // true means opening for RIT
}
private boolean isRegionStillOpening() {
return isRegionStillOpening(regionInfo, rsServices);
}
}