HBASE-4816 Regionserver wouldn't go down because split happened exactly at same time we issued bulk user region close call on our way out

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1203814 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2011-11-18 20:01:30 +00:00
parent 8df0e84cf7
commit b5f5e2aeeb
3 changed files with 16 additions and 3 deletions

View File

@ -435,6 +435,8 @@ Release 0.92.0 - Unreleased
HBASE-4793 HBase shell still using deprecated methods removed in HBASE-4436 HBASE-4793 HBase shell still using deprecated methods removed in HBASE-4436
HBASE-4801 alter_status shell prints sensible message at completion HBASE-4801 alter_status shell prints sensible message at completion
HBASE-4796 Race between SplitRegionHandlers for the same region kills the master HBASE-4796 Race between SplitRegionHandlers for the same region kills the master
HBASE-4816 Regionserver wouldn't go down because split happened exactly at same
time we issued bulk user region close call on our way out
TESTS TESTS
HBASE-4450 test for number of blocks read: to serve as baseline for expected HBASE-4450 test for number of blocks read: to serve as baseline for expected

View File

@ -671,7 +671,6 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
LOG.info("Closing user regions"); LOG.info("Closing user regions");
closeUserRegions(this.abortRequested); closeUserRegions(this.abortRequested);
} else if (this.stopping) { } else if (this.stopping) {
LOG.info("Stopping meta regions, if the HRegionServer hosts any");
boolean allUserRegionsOffline = areAllUserRegionsOffline(); boolean allUserRegionsOffline = areAllUserRegionsOffline();
if (allUserRegionsOffline) { if (allUserRegionsOffline) {
// Set stopped if no requests since last time we went around the loop. // Set stopped if no requests since last time we went around the loop.
@ -681,6 +680,11 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
break; break;
} }
oldRequestCount = this.requestCount.get(); oldRequestCount = this.requestCount.get();
} else {
// Make sure all regions have been closed -- some regions may
// have not got it because we were splitting at the time of
// the call to closeUserRegions.
closeUserRegions(this.abortRequested);
} }
LOG.debug("Waiting on " + getOnlineRegionsAsPrintableString()); LOG.debug("Waiting on " + getOnlineRegionsAsPrintableString());
} }
@ -1812,6 +1816,8 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
/** /**
* Schedule closes on all user regions. * Schedule closes on all user regions.
* Should be safe calling multiple times because it wont' close regions
* that are already closed or that are closing.
* @param abort Whether we're running an abort. * @param abort Whether we're running an abort.
*/ */
void closeUserRegions(final boolean abort) { void closeUserRegions(final boolean abort) {
@ -1820,6 +1826,7 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
for (Map.Entry<String, HRegion> e: this.onlineRegions.entrySet()) { for (Map.Entry<String, HRegion> e: this.onlineRegions.entrySet()) {
HRegion r = e.getValue(); HRegion r = e.getValue();
if (!r.getRegionInfo().isMetaRegion()) { if (!r.getRegionInfo().isMetaRegion()) {
if (r.isClosed() || r.isClosing()) continue;
// Don't update zk with this close transition; pass false. // Don't update zk with this close transition; pass false.
closeRegion(r.getRegionInfo(), abort, false); closeRegion(r.getRegionInfo(), abort, false);
} }

View File

@ -52,6 +52,11 @@ class SplitRequest implements Runnable {
@Override @Override
public void run() { public void run() {
if (this.server.isStopping() || this.server.isStopped()) {
LOG.debug("Skipping split because server is stopping=" +
this.server.isStopping() + " or stopped=" + this.server.isStopped());
return;
}
try { try {
final long startTime = System.currentTimeMillis(); final long startTime = System.currentTimeMillis();
SplitTransaction st = new SplitTransaction(parent, midKey); SplitTransaction st = new SplitTransaction(parent, midKey);
@ -90,5 +95,4 @@ class SplitRequest implements Runnable {
server.checkFileSystem(); server.checkFileSystem();
} }
} }
} }