[ 
https://issues.apache.org/jira/browse/CURATOR-483?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16678506#comment-16678506
 ] 

ASF GitHub Bot commented on CURATOR-483:
----------------------------------------

Github user njhill commented on a diff in the pull request:

    https://github.com/apache/curator/pull/281#discussion_r231591529
  
    --- Diff: 
curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentNode.java
 ---
    @@ -444,8 +447,19 @@ private void createNode()
     
             try
             {
    -            String existingPath = nodePath.get();
    -            String createPath = (existingPath != null && !useProtection) ? 
existingPath : basePath;
    +            String existingPath = nodePath.get(), createPath;
    +            if ( existingPath != null && !useProtection )
    +            {
    +                createPath = existingPath;
    +            }
    +            else
    +            {
    +                createPath = basePath;
    +                if ( useProtection && mode.isSequential() )
    +                {
    +                    createPath += 
existingPath.substring(existingPath.length()-SEQUENTIAL_SUFFIX_DIGITS);
    --- End diff --
    
    @cammckenzie :man_facepalming: apologies, now fixed!


> Sequential PersistentNodes with protection don't resync after reconnection
> --------------------------------------------------------------------------
>
>                 Key: CURATOR-483
>                 URL: https://issues.apache.org/jira/browse/CURATOR-483
>             Project: Apache Curator
>          Issue Type: Bug
>          Components: Recipes
>    Affects Versions: 4.0.1
>            Reporter: Nick Hill
>            Priority: Major
>
> When using a {{PersistentNode}} with a sequential creation mode (in my case 
> ephemeral but I think persistent would be the same) and "protection" turned 
> on, unexpected duplicate znodes get created upon reconnection after a 
> disconnect (without the sequence suffix), rather than it just taking 
> ownership of the previously created znode.
> I tracked down the cause of this and have made a simple fix.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to