HBASE-2866 Region permanently offlined
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@967290 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6dddd674cf
commit
1415130b41
|
@ -449,6 +449,7 @@ Release 0.21.0 - Unreleased
|
||||||
HBASE-2859 Cleanup deprecated stuff in TestHLog (Alex Newman via Stack)
|
HBASE-2859 Cleanup deprecated stuff in TestHLog (Alex Newman via Stack)
|
||||||
HBASE-2858 TestReplication.queueFailover fails half the time
|
HBASE-2858 TestReplication.queueFailover fails half the time
|
||||||
HBASE-2863 HBASE-2553 removed an important edge case
|
HBASE-2863 HBASE-2553 removed an important edge case
|
||||||
|
HBASE-2866 Region permanently offlined
|
||||||
|
|
||||||
IMPROVEMENTS
|
IMPROVEMENTS
|
||||||
HBASE-1760 Cleanup TODOs in HTable
|
HBASE-1760 Cleanup TODOs in HTable
|
||||||
|
|
|
@ -169,6 +169,7 @@ public class ZKUnassignedWatcher implements Watcher {
|
||||||
String region = zNodePath.substring(
|
String region = zNodePath.substring(
|
||||||
zNodePath.indexOf(rgnInTransitNode) + rgnInTransitNode.length() + 1);
|
zNodePath.indexOf(rgnInTransitNode) + rgnInTransitNode.length() + 1);
|
||||||
HBaseEventType rsEvent = HBaseEventType.fromByte(data[0]);
|
HBaseEventType rsEvent = HBaseEventType.fromByte(data[0]);
|
||||||
|
LOG.debug("Got event type [ " + rsEvent + " ] for region " + region);
|
||||||
|
|
||||||
// if the node was CLOSED then handle it
|
// if the node was CLOSED then handle it
|
||||||
if(rsEvent == HBaseEventType.RS2ZK_REGION_CLOSED) {
|
if(rsEvent == HBaseEventType.RS2ZK_REGION_CLOSED) {
|
||||||
|
|
|
@ -1133,22 +1133,36 @@ public class ZooKeeperWrapper implements Watcher {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(LOG.isDebugEnabled()) {
|
Stat stat = new Stat();
|
||||||
// Check existing state for logging purposes.
|
byte[] oldData = null;
|
||||||
Stat stat = new Stat();
|
try {
|
||||||
byte[] oldData = null;
|
oldData = readZNode(znode, stat);
|
||||||
try {
|
} catch (IOException e) {
|
||||||
oldData = readZNode(znode, stat);
|
LOG.error("Error reading data for " + znode);
|
||||||
} catch (IOException e) {
|
|
||||||
LOG.error("Error reading data for " + znode);
|
|
||||||
}
|
|
||||||
if(oldData == null) {
|
|
||||||
LOG.debug("While updating UNASSIGNED region " + regionName + " - node exists with no data" );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LOG.debug("While updating UNASSIGNED region " + regionName + " exists, state = " + (HBaseEventType.fromByte(oldData[0])));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// If there is no data in the ZNode, then update it
|
||||||
|
if(oldData == null) {
|
||||||
|
LOG.debug("While updating UNASSIGNED region " + regionName + " - node exists with no data" );
|
||||||
|
}
|
||||||
|
// If there is data in the ZNode, do not update if it is already correct
|
||||||
|
else {
|
||||||
|
HBaseEventType curState = HBaseEventType.fromByte(oldData[0]);
|
||||||
|
HBaseEventType newState = HBaseEventType.fromByte(data[0]);
|
||||||
|
// If the znode has the right state already, do not update it. Updating
|
||||||
|
// the znode again and again will bump up the zk version. This may cause
|
||||||
|
// the region server to fail. The RS expects that the znode is never
|
||||||
|
// updated by anyone else while it is opening/closing a region.
|
||||||
|
if(curState == newState) {
|
||||||
|
LOG.debug("No need to update UNASSIGNED region " + regionName +
|
||||||
|
" as it already exists in state = " + curState);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the ZNode is in another state, then update it
|
||||||
|
LOG.debug("UNASSIGNED region " + regionName + " is currently in state = " +
|
||||||
|
curState + ", updating it to " + newState);
|
||||||
|
}
|
||||||
|
// Update the ZNode
|
||||||
synchronized(unassignedZNodesWatched) {
|
synchronized(unassignedZNodesWatched) {
|
||||||
unassignedZNodesWatched.add(znode);
|
unassignedZNodesWatched.add(znode);
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue