Uploaded image for project: 'Apache Curator'
  1. Apache Curator
  2. CURATOR-329

SharedValue.start() method does not update to current value if version of value currently stored in zookeeper is 0 (zero)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 2.10.0
    • 2.11.0, 3.2.0
    • Recipes
    • None

    Description

      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:

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

      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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ARascius Algirdas Rascius
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: