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:
Jean-Daniel Cryans 2010-07-23 22:44:21 +00:00
parent 6dddd674cf
commit 1415130b41
3 changed files with 31 additions and 15 deletions

View File

@ -449,6 +449,7 @@ Release 0.21.0 - Unreleased
HBASE-2859 Cleanup deprecated stuff in TestHLog (Alex Newman via Stack)
HBASE-2858 TestReplication.queueFailover fails half the time
HBASE-2863 HBASE-2553 removed an important edge case
HBASE-2866 Region permanently offlined
IMPROVEMENTS
HBASE-1760 Cleanup TODOs in HTable

View File

@ -169,6 +169,7 @@ public class ZKUnassignedWatcher implements Watcher {
String region = zNodePath.substring(
zNodePath.indexOf(rgnInTransitNode) + rgnInTransitNode.length() + 1);
HBaseEventType rsEvent = HBaseEventType.fromByte(data[0]);
LOG.debug("Got event type [ " + rsEvent + " ] for region " + region);
// if the node was CLOSED then handle it
if(rsEvent == HBaseEventType.RS2ZK_REGION_CLOSED) {

View File

@ -1133,8 +1133,6 @@ public class ZooKeeperWrapper implements Watcher {
return;
}
if(LOG.isDebugEnabled()) {
// Check existing state for logging purposes.
Stat stat = new Stat();
byte[] oldData = null;
try {
@ -1142,13 +1140,29 @@ public class ZooKeeperWrapper implements Watcher {
} catch (IOException e) {
LOG.error("Error reading data for " + znode);
}
// 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 {
LOG.debug("While updating UNASSIGNED region " + regionName + " exists, state = " + (HBaseEventType.fromByte(oldData[0])));
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) {
unassignedZNodesWatched.add(znode);
try {