HBASE-3290 Regionserver can close during a split causing double assignment -- addendum

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1042073 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-12-04 00:47:23 +00:00
parent 1da8a78ff9
commit b7a9bdf0b4
1 changed files with 20 additions and 10 deletions

View File

@ -1033,19 +1033,21 @@ public class AssignmentManager extends ZooKeeperListener {
} }
try { try {
// TODO: We should consider making this look more like it does for the // TODO: We should consider making this look more like it does for the
// region open where we catch all throwables and never abort // region open where we catch all throwables and never abort
if(serverManager.sendRegionClose(server, state.getRegion())) { if (serverManager.sendRegionClose(server, state.getRegion())) {
LOG.debug("Sent CLOSE to " + server + " for region " + LOG.debug("Sent CLOSE to " + server + " for region " +
region.getRegionNameAsString()); region.getRegionNameAsString());
return; return;
} }
LOG.debug("Server " + server + " region CLOSE RPC returned false"); LOG.debug("Server " + server + " region CLOSE RPC returned false");
} catch (NotServingRegionException nsre) { } catch (NotServingRegionException nsre) {
// Failed to close, so pass through and reassign // Failed to close, so pass through and reassign
LOG.info("Server " + server + " returned " + nsre); LOG.info("Server " + server + " returned " + nsre + " for " +
region.getEncodedName());
} catch (ConnectException e) { } catch (ConnectException e) {
// Failed to connect, so pass through and reassign // Failed to connect, so pass through and reassign
LOG.info("Server " + server + " returned " + e.getMessage()); LOG.info("Server " + server + " returned " + e.getMessage() + " for " +
region.getEncodedName());
} catch (java.net.SocketTimeoutException e) { } catch (java.net.SocketTimeoutException e) {
// Failed to connect, so pass through and reassign // Failed to connect, so pass through and reassign
LOG.info("Server " + server + " returned " + e.getMessage()); LOG.info("Server " + server + " returned " + e.getMessage());
@ -1055,21 +1057,29 @@ public class AssignmentManager extends ZooKeeperListener {
LOG.debug("Server " + server + " returned NotServingRegionException"); LOG.debug("Server " + server + " returned NotServingRegionException");
} else { } else {
this.master.abort("Remote unexpected exception", this.master.abort("Remote unexpected exception",
re.unwrapRemoteException()); re.unwrapRemoteException());
} }
} catch (Throwable t) { } catch (Throwable t) {
// For now call abort if unexpected exception -- radical, but will get fellas attention. // For now call abort if unexpected exception -- radical, but will get
// St.Ack 20101012 // fellas attention. St.Ack 20101012
this.master.abort("Remote unexpected exception", t); this.master.abort("Remote unexpected exception", t);
} }
/* This looks way wrong at least for the case where close failed because
* it was being concurrently split. It also looks wrong for case where
* we cannot connect to remote server. In that case, let the server
* expiration do the fixup. I'm leaving this code here commented out for
* the moment in case I've missed something and this code is actually needed.
* St.Ack 12/04/2010.
*
// Did not CLOSE, so set region offline and assign it // Did not CLOSE, so set region offline and assign it
LOG.debug("Attempted to send CLOSE to " + server + LOG.debug("Attempted to send CLOSE to " + server +
" for region " + region.getRegionNameAsString() + " but failed, " + " for region " + region.getRegionNameAsString() + " but failed, " +
"setting region as OFFLINE and reassigning"); "setting region as OFFLINE and reassigning");
synchronized (regionsInTransition) { synchronized (regionsInTransition) {
forceRegionStateToOffline(region); forceRegionStateToOffline(region);
} }
assign(region, true); assign(region, true);
*/
} }
/** /**