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

leader election pseudo code probably incorrect

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.4.3
    • None
    • documentation
    • None

    Description

      The pseudo code for leader election in the recipes.html page of 3.4.3 documentation is the following...

      Let ELECTION be a path of choice of the application. To volunteer to be a leader:

      1.Create znode z with path "ELECTION/guid-n_" with both SEQUENCE and EPHEMERAL flags;

      2.Let C be the children of "ELECTION", and i be the sequence number of z;

      3.Watch for changes on "ELECTION/guid-n_j", where j is the smallest sequence number such that j < i and n_j is a znode in C;

      Upon receiving a notification of znode deletion:

      1.Let C be the new set of children of ELECTION;

      2.If z is the smallest node in C, then execute leader procedure;

      3.Otherwise, watch for changes on "ELECTION/guid-n_j", where j is the smallest sequence number such that j < i and n_j is a znode in C;

      I think, in both third steps highest should appear instead of smallest.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              robvarga Robert Varga
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: