Skip to content

Commit b21a4fd

Browse files
committed
HADOOP-18922: Race condition in ZKDelegationTokenSecretManager creating znode
1 parent 0cfffb3 commit b21a4fd

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/ZKDelegationTokenSecretManager.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,9 @@ public void startThreads() throws IOException {
270270
CuratorFramework nullNsFw = zkClient.usingNamespace(null);
271271
try {
272272
String nameSpace = "/" + zkClient.getNamespace();
273-
Stat stat = nullNsFw.checkExists().forPath(nameSpace);
274-
if (stat == null) {
275-
nullNsFw.create().creatingParentContainersIfNeeded().forPath(nameSpace);
276-
}
273+
nullNsFw.create().creatingParentContainersIfNeeded().forPath(nameSpace);
274+
} catch (KeeperException.NodeExistsException ignore) {
275+
// We don't care if the znode already exists
277276
} catch (Exception e) {
278277
throw new IOException("Could not create namespace", e);
279278
}

0 commit comments

Comments
 (0)