HBASE-4308 Race between RegionOpenedHandler and AssignmentManager(Ram)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1205513 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
10407c9a16
commit
42104d08f2
|
@ -441,6 +441,7 @@ Release 0.92.0 - Unreleased
|
|||
HBASE-4623 Remove @deprecated Scan methods in 0.90 from TRUNK and 0.92
|
||||
HBASE-4842 [hbck] Fix intermittent failures on TestHBaseFsck.testHBaseFsck
|
||||
(Jon Hsieh)
|
||||
HBASE-4308 Race between RegionOpenedHandler and AssignmentManager (Ram)
|
||||
|
||||
TESTS
|
||||
HBASE-4450 test for number of blocks read: to serve as baseline for expected
|
||||
|
|
|
@ -966,16 +966,36 @@ public class AssignmentManager extends ZooKeeperListener {
|
|||
ZKAssign.getRegionName(this.master.getZooKeeper(), path);
|
||||
RegionState rs = this.regionsInTransition.get(regionName);
|
||||
if (rs != null) {
|
||||
HRegionInfo regionInfo = rs.getRegion();
|
||||
if (rs.isSplitting() || rs.isSplit()) {
|
||||
LOG.debug("Ephemeral node deleted, regionserver crashed?, " +
|
||||
"clearing from RIT; rs=" + rs);
|
||||
clearRegionFromTransition(rs.getRegion());
|
||||
} else {
|
||||
LOG.warn("Node deleted but still in RIT: " + rs);
|
||||
LOG.debug("The znode of region " + regionInfo.getRegionNameAsString()
|
||||
+ " has been deleted.");
|
||||
if (rs.isOpened()) {
|
||||
makeRegionOnline(rs, regionInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void makeRegionOnline(RegionState rs, HRegionInfo regionInfo) {
|
||||
regionOnline(regionInfo, rs.serverName);
|
||||
LOG.info("The master has opened the region "
|
||||
+ regionInfo.getRegionNameAsString() + " that was online on "
|
||||
+ rs.serverName);
|
||||
if (this.getZKTable().isDisablingOrDisabledTable(
|
||||
regionInfo.getTableNameAsString())) {
|
||||
debugLog(regionInfo, "Opened region "
|
||||
+ regionInfo.getRegionNameAsString() + " but "
|
||||
+ "this table is disabled, triggering close of region");
|
||||
unassign(regionInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* New unassigned node has been created.
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.apache.hadoop.hbase.HRegionInfo;
|
|||
import org.apache.hadoop.hbase.Server;
|
||||
import org.apache.hadoop.hbase.ServerName;
|
||||
import org.apache.hadoop.hbase.executor.EventHandler;
|
||||
import org.apache.hadoop.hbase.executor.EventHandler.EventType;
|
||||
import org.apache.hadoop.hbase.master.AssignmentManager;
|
||||
import org.apache.hadoop.hbase.master.AssignmentManager.RegionState;
|
||||
import org.apache.hadoop.hbase.zookeeper.ZKAssign;
|
||||
|
@ -98,28 +97,26 @@ public class OpenedRegionHandler extends EventHandler implements TotesHRegionInf
|
|||
// Code to defend against case where we get SPLIT before region open
|
||||
// processing completes; temporary till we make SPLITs go via zk -- 0.92.
|
||||
RegionState regionState = this.assignmentManager.isRegionInTransition(regionInfo);
|
||||
boolean openedNodeDeleted = false;
|
||||
if (regionState != null
|
||||
&& regionState.getState().equals(RegionState.State.OPEN)) {
|
||||
if (deleteOpenedNode(expectedVersion)) {
|
||||
// Remove region from in-memory transition and unassigned node from ZK
|
||||
this.assignmentManager.regionOnline(regionInfo, this.sn);
|
||||
debugLog(regionInfo, "The master has opened the region " +
|
||||
regionInfo.getRegionNameAsString() + " that was online on " +
|
||||
this.sn.toString());
|
||||
} else {
|
||||
LOG.error("The znode of region " + regionInfo.getRegionNameAsString() +
|
||||
" could not be deleted.");
|
||||
openedNodeDeleted = deleteOpenedNode(expectedVersion);
|
||||
if (!openedNodeDeleted) {
|
||||
LOG.error("The znode of region " + regionInfo.getRegionNameAsString()
|
||||
+ " could not be deleted.");
|
||||
}
|
||||
} else {
|
||||
LOG.warn("Skipping the onlining of " + regionInfo.getRegionNameAsString() +
|
||||
" because regions is NOT in RIT -- presuming this is because it SPLIT");
|
||||
}
|
||||
if (this.assignmentManager.getZKTable().isDisablingOrDisabledTable(
|
||||
regionInfo.getTableNameAsString())) {
|
||||
debugLog(regionInfo,
|
||||
"Opened region " + regionInfo.getRegionNameAsString() + " but "
|
||||
+ "this table is disabled, triggering close of region");
|
||||
assignmentManager.unassign(regionInfo);
|
||||
if (!openedNodeDeleted) {
|
||||
if (this.assignmentManager.getZKTable().isDisablingOrDisabledTable(
|
||||
regionInfo.getTableNameAsString())) {
|
||||
debugLog(regionInfo, "Opened region "
|
||||
+ regionInfo.getRegionNameAsString() + " but "
|
||||
+ "this table is disabled, triggering close of region");
|
||||
assignmentManager.unassign(regionInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue