HBASE-7933 NPE in TableLockManager
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1450554 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
60859badfb
commit
4d356e24e1
|
@ -143,11 +143,6 @@ public abstract class ZKInterProcessLockBase implements InterProcessLock {
|
||||||
this.fullyQualifiedZNode = ZKUtil.joinZNode(parentLockNode, childNode);
|
this.fullyQualifiedZNode = ZKUtil.joinZNode(parentLockNode, childNode);
|
||||||
this.metadata = metadata;
|
this.metadata = metadata;
|
||||||
this.handler = handler;
|
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 ZKInterProcessLockBase implements InterProcessLock {
|
||||||
boolean hasTimeout = timeoutMs != -1;
|
boolean hasTimeout = timeoutMs != -1;
|
||||||
long waitUntilMs =
|
long waitUntilMs =
|
||||||
hasTimeout ?EnvironmentEdgeManager.currentTimeMillis() + timeoutMs : -1;
|
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) {
|
while (true) {
|
||||||
List<String> children;
|
List<String> children;
|
||||||
try {
|
try {
|
||||||
|
@ -221,13 +221,14 @@ public abstract class ZKInterProcessLockBase implements InterProcessLock {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String createLockZNode() {
|
private String createLockZNode() throws KeeperException {
|
||||||
try {
|
try {
|
||||||
return ZKUtil.createNodeIfNotExistsNoWatch(zkWatcher, fullyQualifiedZNode,
|
return ZKUtil.createNodeIfNotExistsNoWatch(zkWatcher, fullyQualifiedZNode,
|
||||||
metadata, CreateMode.EPHEMERAL_SEQUENTIAL);
|
metadata, CreateMode.EPHEMERAL_SEQUENTIAL);
|
||||||
} catch (KeeperException ex) {
|
} catch (KeeperException.NoNodeException nne) {
|
||||||
LOG.warn("Failed to create znode: " + fullyQualifiedZNode, ex);
|
//create parents, retry
|
||||||
return null;
|
ZKUtil.createWithParents(zkWatcher, parentLockNode);
|
||||||
|
return createLockZNode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue