You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@curator.apache.org by "Cameron McKenzie (JIRA)" <ji...@apache.org> on 2016/05/24 22:54:12 UTC

[jira] [Resolved] (CURATOR-329) SharedValue.start() method does not update to current value if version of value currently stored in zookeeper is 0 (zero)

     [ https://issues.apache.org/jira/browse/CURATOR-329?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Cameron McKenzie resolved CURATOR-329.
--------------------------------------
       Resolution: Fixed
    Fix Version/s: 3.2.0
                   2.11.0

> SharedValue.start() method does not update to current value if version of value currently stored in zookeeper is 0 (zero)
> -------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CURATOR-329
>                 URL: https://issues.apache.org/jira/browse/CURATOR-329
>             Project: Apache Curator
>          Issue Type: Bug
>          Components: Recipes
>    Affects Versions: 2.10.0
>            Reporter: Algirdas Rascius
>            Priority: Blocker
>             Fix For: 2.11.0, 3.2.0
>
>
> When zookeeper node stores value with version 0 and SharedCount instance is created and started for this node, getCount() method returns seedValue passed to SharedCount constructor instead of actual value stored in zookeeper node. This only happens when zookeeper node version is 0 (zero).
> For example:
> {code}
> // Node /count does not exists before the test
> SharedCount count1 = new SharedCount(client, "/count", 10);
> SharedCount count2 = new SharedCount(client, "/count", 20);
> count1.start();
> count2.start();
> Assert.assertEquals(count1.getCount(), 10);
> Assert.assertEquals(count2.getCount(), 10); // Should return 10, but returns 20 instead
> {code}
> Issue arrises because when constructed class SharedValue initializes instance variable currentValue with version 0 and does not update value in updateValue(..) method if version returned by zookeeper is 0.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)