From eb5e28e4e16ddb8e0b7a420167903b617de20672 Mon Sep 17 00:00:00 2001 From: Jean-Daniel Cryans Date: Wed, 16 Nov 2011 00:42:52 +0000 Subject: [PATCH] HBASE-4792 SplitRegionHandler doesn't care if it deletes the znode or not, leaves the parent region stuck offline git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1202487 13f79535-47bb-0310-9956-ffa450edef68 --- .../hbase/master/handler/SplitRegionHandler.java | 12 +++++++++--- .../org/apache/hadoop/hbase/zookeeper/ZKAssign.java | 6 +++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/apache/hadoop/hbase/master/handler/SplitRegionHandler.java b/src/main/java/org/apache/hadoop/hbase/master/handler/SplitRegionHandler.java index 10cbf831c7d..931cb64376a 100644 --- a/src/main/java/org/apache/hadoop/hbase/master/handler/SplitRegionHandler.java +++ b/src/main/java/org/apache/hadoop/hbase/master/handler/SplitRegionHandler.java @@ -87,9 +87,15 @@ public class SplitRegionHandler extends EventHandler implements TotesHRegionInfo this.daughters.get(0), this.daughters.get(1)); // Remove region from ZK try { - ZKAssign.deleteNode(this.server.getZooKeeper(), - this.parent.getEncodedName(), - EventHandler.EventType.RS_ZK_REGION_SPLIT); + + boolean successful = false; + while (!successful) { + // It's possible that the RS tickles in between the reading of the + // znode and the deleting, so it's safe to retry. + successful = ZKAssign.deleteNode(this.server.getZooKeeper(), + this.parent.getEncodedName(), + EventHandler.EventType.RS_ZK_REGION_SPLIT); + } } catch (KeeperException e) { server.abort("Error deleting SPLIT node in ZK for transition ZK node (" + parent.getEncodedName() + ")", e); diff --git a/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKAssign.java b/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKAssign.java index 3ba70e6aca4..6a23cdaaa2e 100644 --- a/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKAssign.java +++ b/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKAssign.java @@ -499,13 +499,13 @@ public class ZKAssign { } if (expectedVersion != -1 && stat.getVersion() != expectedVersion) { - LOG.warn("The node we are trying to delete is not the expected one. " + - "Got a version mismatch"); + LOG.warn("The node " + regionName + " we are trying to delete is not" + + " the expected one. Got a version mismatch"); return false; } if(!ZKUtil.deleteNode(zkw, node, stat.getVersion())) { LOG.warn(zkw.prefix("Attempting to delete " + - "unassigned node in " + expectedState + + "unassigned node " + regionName + " in " + expectedState + " state but after verifying state, we got a version mismatch")); return false; }