Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-2384

Support atomic increment / decrement of znode value

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Later
    • None
    • None
    • None

    Description

      Use case is to store reference count (integer type) in znode.

      It is desirable to provide support for atomic increment / decrement of the znode value.

      Suggestion from Flavio:

      you can read the znode, keep the version of the znode, update the value, write back conditionally. The condition for the setData operation to succeed is that the version is the same that it read

      While the above is feasible, developer has to implement retry logic him/herself. It is not easy to combine increment / decrement with other operations using multi.

      Attachments

        Activity

          People

            Unassigned Unassigned
            yuzhihong@gmail.com Ted Yu
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: