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-4623 Remove @deprecated Scan methods in 0.90 from TRUNK and 0.92
|
||||||
HBASE-4842 [hbck] Fix intermittent failures on TestHBaseFsck.testHBaseFsck
|
HBASE-4842 [hbck] Fix intermittent failures on TestHBaseFsck.testHBaseFsck
|
||||||
(Jon Hsieh)
|
(Jon Hsieh)
|
||||||
|
HBASE-4308 Race between RegionOpenedHandler and AssignmentManager (Ram)
|
||||||
|
|
||||||
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
|
||||||
|
|
|
@ -966,17 +966,37 @@ public class AssignmentManager extends ZooKeeperListener {
|
||||||
ZKAssign.getRegionName(this.master.getZooKeeper(), path);
|
ZKAssign.getRegionName(this.master.getZooKeeper(), path);
|
||||||
RegionState rs = this.regionsInTransition.get(regionName);
|
RegionState rs = this.regionsInTransition.get(regionName);
|
||||||
if (rs != null) {
|
if (rs != null) {
|
||||||
|
HRegionInfo regionInfo = rs.getRegion();
|
||||||
if (rs.isSplitting() || rs.isSplit()) {
|
if (rs.isSplitting() || rs.isSplit()) {
|
||||||
LOG.debug("Ephemeral node deleted, regionserver crashed?, " +
|
LOG.debug("Ephemeral node deleted, regionserver crashed?, " +
|
||||||
"clearing from RIT; rs=" + rs);
|
"clearing from RIT; rs=" + rs);
|
||||||
clearRegionFromTransition(rs.getRegion());
|
clearRegionFromTransition(rs.getRegion());
|
||||||
} else {
|
} 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.
|
* 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.Server;
|
||||||
import org.apache.hadoop.hbase.ServerName;
|
import org.apache.hadoop.hbase.ServerName;
|
||||||
import org.apache.hadoop.hbase.executor.EventHandler;
|
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;
|
||||||
import org.apache.hadoop.hbase.master.AssignmentManager.RegionState;
|
import org.apache.hadoop.hbase.master.AssignmentManager.RegionState;
|
||||||
import org.apache.hadoop.hbase.zookeeper.ZKAssign;
|
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
|
// Code to defend against case where we get SPLIT before region open
|
||||||
// processing completes; temporary till we make SPLITs go via zk -- 0.92.
|
// processing completes; temporary till we make SPLITs go via zk -- 0.92.
|
||||||
RegionState regionState = this.assignmentManager.isRegionInTransition(regionInfo);
|
RegionState regionState = this.assignmentManager.isRegionInTransition(regionInfo);
|
||||||
|
boolean openedNodeDeleted = false;
|
||||||
if (regionState != null
|
if (regionState != null
|
||||||
&& regionState.getState().equals(RegionState.State.OPEN)) {
|
&& regionState.getState().equals(RegionState.State.OPEN)) {
|
||||||
if (deleteOpenedNode(expectedVersion)) {
|
openedNodeDeleted = deleteOpenedNode(expectedVersion);
|
||||||
// Remove region from in-memory transition and unassigned node from ZK
|
if (!openedNodeDeleted) {
|
||||||
this.assignmentManager.regionOnline(regionInfo, this.sn);
|
LOG.error("The znode of region " + regionInfo.getRegionNameAsString()
|
||||||
debugLog(regionInfo, "The master has opened the region " +
|
+ " could not be deleted.");
|
||||||
regionInfo.getRegionNameAsString() + " that was online on " +
|
|
||||||
this.sn.toString());
|
|
||||||
} else {
|
|
||||||
LOG.error("The znode of region " + regionInfo.getRegionNameAsString() +
|
|
||||||
" could not be deleted.");
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG.warn("Skipping the onlining of " + regionInfo.getRegionNameAsString() +
|
LOG.warn("Skipping the onlining of " + regionInfo.getRegionNameAsString() +
|
||||||
" because regions is NOT in RIT -- presuming this is because it SPLIT");
|
" because regions is NOT in RIT -- presuming this is because it SPLIT");
|
||||||
}
|
}
|
||||||
if (this.assignmentManager.getZKTable().isDisablingOrDisabledTable(
|
if (!openedNodeDeleted) {
|
||||||
regionInfo.getTableNameAsString())) {
|
if (this.assignmentManager.getZKTable().isDisablingOrDisabledTable(
|
||||||
debugLog(regionInfo,
|
regionInfo.getTableNameAsString())) {
|
||||||
"Opened region " + regionInfo.getRegionNameAsString() + " but "
|
debugLog(regionInfo, "Opened region "
|
||||||
+ "this table is disabled, triggering close of region");
|
+ regionInfo.getRegionNameAsString() + " but "
|
||||||
assignmentManager.unassign(regionInfo);
|
+ "this table is disabled, triggering close of region");
|
||||||
|
assignmentManager.unassign(regionInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue