HBASE-4796 Race between SplitRegionHandlers for the same region kills the master

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1202935 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2011-11-16 23:40:29 +00:00
parent f67a900446
commit ac6e9a1125
2 changed files with 16 additions and 5 deletions

View File

@ -434,6 +434,7 @@ Release 0.92.0 - Unreleased
leaves the parent region stuck offline leaves the parent region stuck offline
HBASE-4793 HBase shell still using deprecated methods removed in HBASE-4436 HBASE-4793 HBase shell still using deprecated methods removed in HBASE-4436
HBASE-4801 alter_status shell prints sensible message at completion HBASE-4801 alter_status shell prints sensible message at completion
HBASE-4796 Race between SplitRegionHandlers for the same region kills the master
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

View File

@ -29,7 +29,9 @@ 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.master.AssignmentManager; import org.apache.hadoop.hbase.master.AssignmentManager;
import org.apache.hadoop.hbase.zookeeper.ZKAssign; import org.apache.hadoop.hbase.zookeeper.ZKAssign;
import org.apache.hadoop.hbase.zookeeper.ZKUtil;
import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.KeeperException.NoNodeException;
/** /**
* Handles SPLIT region event on Master. * Handles SPLIT region event on Master.
@ -75,7 +77,8 @@ public class SplitRegionHandler extends EventHandler implements TotesHRegionInfo
@Override @Override
public void process() { public void process() {
LOG.debug("Handling SPLIT event for " + this.parent.getEncodedName() + String encodedRegionName = this.parent.getEncodedName();
LOG.debug("Handling SPLIT event for " + encodedRegionName +
"; deleting node"); "; deleting node");
// The below is for testing ONLY! We can't do fault injection easily, so // The below is for testing ONLY! We can't do fault injection easily, so
// resort to this kinda uglyness -- St.Ack 02/25/2011. // resort to this kinda uglyness -- St.Ack 02/25/2011.
@ -93,16 +96,23 @@ public class SplitRegionHandler extends EventHandler implements TotesHRegionInfo
// It's possible that the RS tickles in between the reading of the // It's possible that the RS tickles in between the reading of the
// znode and the deleting, so it's safe to retry. // znode and the deleting, so it's safe to retry.
successful = ZKAssign.deleteNode(this.server.getZooKeeper(), successful = ZKAssign.deleteNode(this.server.getZooKeeper(),
this.parent.getEncodedName(), encodedRegionName,
EventHandler.EventType.RS_ZK_REGION_SPLIT); EventHandler.EventType.RS_ZK_REGION_SPLIT);
} }
} catch (KeeperException e) { } catch (KeeperException e) {
server.abort("Error deleting SPLIT node in ZK for transition ZK node (" + if (e instanceof NoNodeException) {
parent.getEncodedName() + ")", e); String znodePath = ZKUtil.joinZNode(
this.server.getZooKeeper().splitLogZNode, encodedRegionName);
LOG.debug("The znode " + znodePath
+ " does not exist. May be deleted already.");
} else {
server.abort("Error deleting SPLIT node in ZK for transition ZK node (" +
parent.getEncodedName() + ")", e);
}
} }
LOG.info("Handled SPLIT report); parent=" + LOG.info("Handled SPLIT report); parent=" +
this.parent.getRegionNameAsString() + this.parent.getRegionNameAsString() +
" daughter a=" + this.daughters.get(0).getRegionNameAsString() + " daughter a=" + this.daughters.get(0).getRegionNameAsString() +
"daughter b=" + this.daughters.get(1).getRegionNameAsString()); "daughter b=" + this.daughters.get(1).getRegionNameAsString());
} }
} }