HBASE-703 Invalid regions listed by regionserver.jsp

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@673770 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2008-07-03 19:27:09 +00:00
parent 94eba4e517
commit 0423f172b5
3 changed files with 23 additions and 9 deletions

View File

@ -166,6 +166,7 @@ Trunk (unreleased changes)
HBASE-712 midKey found compacting is the first, not necessarily the optimal
HBASE-719 Find out why users have network problems in HBase and not in Hadoop
and HConnectionManager (Jean-Daniel Cryans via Stack)
HBASE-703 Invalid regions listed by regionserver.jsp (Izaak Rubin via Stack)
IMPROVEMENTS
HBASE-559 MR example job to count table rows

View File

@ -159,6 +159,9 @@ class CompactSplitThread extends Thread implements HConstants {
// NOTE: there is no need for retry logic here. HTable does it for us.
oldRegionInfo.setOffline(true);
oldRegionInfo.setSplit(true);
// Inform the HRegionServer that the parent HRegion is no-longer online.
this.server.removeFromOnlineRegions(oldRegionInfo);
BatchUpdate update = new BatchUpdate(oldRegionInfo.getRegionName());
update.put(COL_REGIONINFO, Writables.getBytes(oldRegionInfo));
update.put(COL_SPLITA, Writables.getBytes(newRegions[0].getRegionInfo()));

View File

@ -904,15 +904,8 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable {
}
void closeRegion(final HRegionInfo hri, final boolean reportWhenCompleted)
throws IOException {
this.lock.writeLock().lock();
HRegion region = null;
try {
region = onlineRegions.remove(Bytes.mapKey(hri.getRegionName()));
} finally {
this.lock.writeLock().unlock();
}
throws IOException {
HRegion region = this.removeFromOnlineRegions(hri);
if (region != null) {
region.close();
if(reportWhenCompleted) {
@ -1326,6 +1319,23 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable {
}
return result;
}
/**
* This method removes HRegion corresponding to hri from the Map of onlineRegions.
*
* @param hri the HRegionInfo corresponding to the HRegion to-be-removed.
* @return the removed HRegion, or null if the HRegion was not in onlineRegions.
*/
HRegion removeFromOnlineRegions(HRegionInfo hri) {
this.lock.writeLock().lock();
HRegion toReturn = null;
try {
toReturn = onlineRegions.remove(Bytes.mapKey(hri.getRegionName()));
} finally {
this.lock.writeLock().unlock();
}
return toReturn;
}
/**
* @return A new Map of online regions sorted by region size with the first