Github user cammckenzie commented on a diff in the pull request:
https://github.com/apache/curator/pull/281#discussion_r233280744
--- Diff:
curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentNode.java
---
@@ -445,7 +445,8 @@ private void createNode()
try
{
String existingPath = nodePath.get();
- String createPath = (existingPath != null && !useProtection) ?
existingPath : basePath;
+ String createPath = existingPath == null || (useProtection &&
!isSequential(mode)) ? basePath
+ : (useProtection ? basePath +
existingPath.substring(existingPath.length()-10) : existingPath);
--- End diff --
Good question @njhill I don't really have a super strong preference, but
I'd prefer that the constant defining the size of the sequential bit is not in
the PersisteNode class. Perhaps just have a method in ZKPaths that extracts the
last 10 digits without any checks. We can make it more defensive down the track
if it gets used elsewhere.
I don't think that efficiency is a huge concern here as it's only going to
happen when the node is created.
---