HBASE-1890 hbase-1506 where assignment is done at regionserver doesn't work

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@822804 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2009-10-07 17:05:20 +00:00
parent f52749cacd
commit 7293cefa98
5 changed files with 14 additions and 38 deletions

View File

@ -60,6 +60,7 @@ Release 0.21.0 - Unreleased
hbase-1784) hbase-1784)
HBASE-1831 Scanning API must be reworked to allow for fully functional HBASE-1831 Scanning API must be reworked to allow for fully functional
Filters client-side Filters client-side
HBASE-1890 hbase-1506 where assignment is done at regionserver doesn't work
IMPROVEMENTS IMPROVEMENTS
HBASE-1760 Cleanup TODOs in HTable HBASE-1760 Cleanup TODOs in HTable

View File

@ -341,17 +341,8 @@ class RegionManager implements HConstants {
LOG.info("Assigning region " + regionName + " to " + sinfo.getServerName()); LOG.info("Assigning region " + regionName + " to " + sinfo.getServerName());
rs.setPendingOpen(sinfo.getServerName()); rs.setPendingOpen(sinfo.getServerName());
this.regionsInTransition.put(regionName, rs); this.regionsInTransition.put(regionName, rs);
if (returnMsgs != null) {
returnMsgs.add(new HMsg(HMsg.Type.MSG_REGION_OPEN, rs.getRegionInfo()));
}
}
/** returnMsgs.add(new HMsg(HMsg.Type.MSG_REGION_OPEN, rs.getRegionInfo()));
* @param regionName
* @param sinfo
*/
void doRegionAssignment(final String regionName, final HServerInfo sinfo) {
doRegionAssignment(this.regionsInTransition.get(regionName), sinfo, null);
} }
/* /*

View File

@ -454,8 +454,7 @@ class ServerManager implements HConstants {
break; break;
case MSG_REPORT_SPLIT: case MSG_REPORT_SPLIT:
processSplitRegion(serverInfo, region, incomingMsgs[++i], processSplitRegion(region, incomingMsgs[++i], incomingMsgs[++i]);
incomingMsgs[++i]);
break; break;
default: default:
@ -497,26 +496,18 @@ class ServerManager implements HConstants {
* @param splitB * @param splitB
* @param returnMsgs * @param returnMsgs
*/ */
private void processSplitRegion(final HServerInfo si, final HRegionInfo region, private void processSplitRegion(HRegionInfo region, HMsg splitA, HMsg splitB) {
final HMsg splitA, final HMsg splitB) {
synchronized (master.regionManager) { synchronized (master.regionManager) {
// Cancel any actions pending for the affected region. // Cancel any actions pending for the affected region.
// This prevents the master from sending a SPLIT message if the table // This prevents the master from sending a SPLIT message if the table
// has already split by the region server. // has already split by the region server.
this.master.regionManager.endActions(region.getRegionName()); master.regionManager.endActions(region.getRegionName());
// Region A is now opened immediately on the splitting server. The message assignSplitDaughter(splitA.getRegionInfo());
// that its been successfully opened is probably just behind this split
// message. Set up the master state so that its properly primed for the
// coming open message.
HRegionInfo a = splitA.getRegionInfo();
assignSplitDaughter(a);
this.master.regionManager.doRegionAssignment(a.getRegionNameAsString(), si);
// Region B will be assigned old-school style by the master.
assignSplitDaughter(splitB.getRegionInfo()); assignSplitDaughter(splitB.getRegionInfo());
if (region.isMetaTable()) { if (region.isMetaTable()) {
// A meta region has split. // A meta region has split.
this.master.regionManager.offlineMetaRegion(region.getStartKey()); master.regionManager.offlineMetaRegion(region.getStartKey());
this.master.regionManager.incrementNumMetaRegions(); master.regionManager.incrementNumMetaRegions();
} }
} }
} }
@ -587,7 +578,7 @@ class ServerManager implements HConstants {
if (duplicateAssignment) { if (duplicateAssignment) {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("region server " + serverInfo.getServerAddress().toString() LOG.debug("region server " + serverInfo.getServerAddress().toString()
+ " should not have opened region " + Bytes.toString(region.getRegionName())); + " should not have opened region " + Bytes.toString(region.getRegionName()));
} }
// This Region should not have been opened. // This Region should not have been opened.

View File

@ -219,8 +219,8 @@ class CompactSplitThread extends Thread implements HConstants {
newRegions[i].getRegionInfo())); newRegions[i].getRegionInfo()));
t.put(put); t.put(put);
} }
// Now tell the master about the new regions. Note that we'll online
// the A region ourselves on this server. Master only has to online B. // Now tell the master about the new regions
server.reportSplit(oldRegionInfo, newRegions[0].getRegionInfo(), server.reportSplit(oldRegionInfo, newRegions[0].getRegionInfo(),
newRegions[1].getRegionInfo()); newRegions[1].getRegionInfo());
LOG.info("region split, META updated, and report to master all" + LOG.info("region split, META updated, and report to master all" +
@ -228,15 +228,8 @@ class CompactSplitThread extends Thread implements HConstants {
", new regions: " + newRegions[0].toString() + ", " + ", new regions: " + newRegions[0].toString() + ", " +
newRegions[1].toString() + ". Split took " + newRegions[1].toString() + ". Split took " +
StringUtils.formatTimeDiff(System.currentTimeMillis(), startTime)); StringUtils.formatTimeDiff(System.currentTimeMillis(), startTime));
// Server region A. Let master assign region B.
HRegionInfo hri = newRegions[0].getRegionInfo(); // Do not serve the new regions. Let the Master assign them.
HMsg msg = new HMsg(HMsg.Type.MSG_REGION_OPEN, hri,
Bytes.toBytes("Local immediate open"));
try {
this.server.toDo.put(new HRegionServer.ToDoEntry(msg));
} catch (InterruptedException e) {
throw new IOException("Failed queue of open of " + hri, e);
}
} }
/** /**

View File

@ -1396,7 +1396,7 @@ public class HRegionServer implements HConstants, HRegionInterface,
/* /*
* Data structure to hold a HMsg and retries count. * Data structure to hold a HMsg and retries count.
*/ */
static final class ToDoEntry { private static final class ToDoEntry {
protected final AtomicInteger tries = new AtomicInteger(0); protected final AtomicInteger tries = new AtomicInteger(0);
protected final HMsg msg; protected final HMsg msg;