curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CURATOR-483) Sequential PersistentNodes with protection don't resync after reconnection
Date Wed, 07 Nov 2018 01:39:00 GMT

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

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_r231356314
  
    --- 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 --
    
    Thanks @cammckenzie. I reworked this to use if statements and defined a constant for the
10 number. I couldn't find such a constant defined elsewhere; it's hardcoded in the zookeeper
code: https://github.com/apache/zookeeper/blob/master/zookeeper-server/src/main/java/org/apache/zookeeper/server/PrepRequestProcessor.java#L662.
    
    I also removed the redundant added static `isSequential(CreateMode)` method, didn't notice
that this is already a method on the enum.


> 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)

Mime
View raw message