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:
parent
f52749cacd
commit
7293cefa98
|
@ -60,6 +60,7 @@ Release 0.21.0 - Unreleased
|
|||
hbase-1784)
|
||||
HBASE-1831 Scanning API must be reworked to allow for fully functional
|
||||
Filters client-side
|
||||
HBASE-1890 hbase-1506 where assignment is done at regionserver doesn't work
|
||||
|
||||
IMPROVEMENTS
|
||||
HBASE-1760 Cleanup TODOs in HTable
|
||||
|
|
|
@ -341,17 +341,8 @@ class RegionManager implements HConstants {
|
|||
LOG.info("Assigning region " + regionName + " to " + sinfo.getServerName());
|
||||
rs.setPendingOpen(sinfo.getServerName());
|
||||
this.regionsInTransition.put(regionName, rs);
|
||||
if (returnMsgs != null) {
|
||||
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);
|
||||
returnMsgs.add(new HMsg(HMsg.Type.MSG_REGION_OPEN, rs.getRegionInfo()));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -454,8 +454,7 @@ class ServerManager implements HConstants {
|
|||
break;
|
||||
|
||||
case MSG_REPORT_SPLIT:
|
||||
processSplitRegion(serverInfo, region, incomingMsgs[++i],
|
||||
incomingMsgs[++i]);
|
||||
processSplitRegion(region, incomingMsgs[++i], incomingMsgs[++i]);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -497,26 +496,18 @@ class ServerManager implements HConstants {
|
|||
* @param splitB
|
||||
* @param returnMsgs
|
||||
*/
|
||||
private void processSplitRegion(final HServerInfo si, final HRegionInfo region,
|
||||
final HMsg splitA, final HMsg splitB) {
|
||||
private void processSplitRegion(HRegionInfo region, HMsg splitA, HMsg splitB) {
|
||||
synchronized (master.regionManager) {
|
||||
// Cancel any actions pending for the affected region.
|
||||
// This prevents the master from sending a SPLIT message if the table
|
||||
// has already split by the region server.
|
||||
this.master.regionManager.endActions(region.getRegionName());
|
||||
// Region A is now opened immediately on the splitting server. The message
|
||||
// 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.
|
||||
master.regionManager.endActions(region.getRegionName());
|
||||
assignSplitDaughter(splitA.getRegionInfo());
|
||||
assignSplitDaughter(splitB.getRegionInfo());
|
||||
if (region.isMetaTable()) {
|
||||
// A meta region has split.
|
||||
this.master.regionManager.offlineMetaRegion(region.getStartKey());
|
||||
this.master.regionManager.incrementNumMetaRegions();
|
||||
master.regionManager.offlineMetaRegion(region.getStartKey());
|
||||
master.regionManager.incrementNumMetaRegions();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -587,7 +578,7 @@ class ServerManager implements HConstants {
|
|||
if (duplicateAssignment) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
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.
|
||||
|
|
|
@ -219,8 +219,8 @@ class CompactSplitThread extends Thread implements HConstants {
|
|||
newRegions[i].getRegionInfo()));
|
||||
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(),
|
||||
newRegions[1].getRegionInfo());
|
||||
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() + ", " +
|
||||
newRegions[1].toString() + ". Split took " +
|
||||
StringUtils.formatTimeDiff(System.currentTimeMillis(), startTime));
|
||||
// Server region A. Let master assign region B.
|
||||
HRegionInfo hri = newRegions[0].getRegionInfo();
|
||||
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);
|
||||
}
|
||||
|
||||
// Do not serve the new regions. Let the Master assign them.
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1396,7 +1396,7 @@ public class HRegionServer implements HConstants, HRegionInterface,
|
|||
/*
|
||||
* 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 HMsg msg;
|
||||
|
||||
|
|
Loading…
Reference in New Issue