hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject svn commit: r1450554 - /hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/lock/ZKInterProcessLockBase.java
Date Wed, 27 Feb 2013 00:39:41 GMT
Author: enis
Date: Wed Feb 27 00:39:41 2013
New Revision: 1450554

URL: http://svn.apache.org/r1450554
Log:
HBASE-7933 NPE in TableLockManager

Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/lock/ZKInterProcessLockBase.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/lock/ZKInterProcessLockBase.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/lock/ZKInterProcessLockBase.java?rev=1450554&r1=1450553&r2=1450554&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/lock/ZKInterProcessLockBase.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/lock/ZKInterProcessLockBase.java
Wed Feb 27 00:39:41 2013
@@ -143,11 +143,6 @@ public abstract class ZKInterProcessLock
     this.fullyQualifiedZNode = ZKUtil.joinZNode(parentLockNode, childNode);
     this.metadata = metadata;
     this.handler = handler;
-    try {
-      ZKUtil.createWithParents(zkWatcher, parentLockNode);
-    } catch (KeeperException ex) {
-      LOG.warn("Failed to create znode:" + parentLockNode, ex);
-    }
   }
 
   /**
@@ -167,7 +162,12 @@ public abstract class ZKInterProcessLock
     boolean hasTimeout = timeoutMs != -1;
     long waitUntilMs =
         hasTimeout ?EnvironmentEdgeManager.currentTimeMillis() + timeoutMs : -1;
-    String createdZNode = createLockZNode();
+    String createdZNode;
+    try {
+      createdZNode = createLockZNode();
+    } catch (KeeperException ex) {
+      throw new IOException("Failed to create znode: " + fullyQualifiedZNode, ex);
+    }
     while (true) {
       List<String> children;
       try {
@@ -221,13 +221,14 @@ public abstract class ZKInterProcessLock
     return true;
   }
 
-  private String createLockZNode() {
+  private String createLockZNode() throws KeeperException {
     try {
       return ZKUtil.createNodeIfNotExistsNoWatch(zkWatcher, fullyQualifiedZNode,
           metadata, CreateMode.EPHEMERAL_SEQUENTIAL);
-    } catch (KeeperException ex) {
-      LOG.warn("Failed to create znode: " + fullyQualifiedZNode, ex);
-      return null;
+    } catch (KeeperException.NoNodeException nne) {
+      //create parents, retry
+      ZKUtil.createWithParents(zkWatcher, parentLockNode);
+      return createLockZNode();
     }
   }
 



Mime
View raw message