You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Robert Varga (Updated) (JIRA)" <ji...@apache.org> on 2012/03/05 13:06:57 UTC

[jira] [Updated] (ZOOKEEPER-1404) leader election pseudo code probably incorrect

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

Robert Varga updated ZOOKEEPER-1404:
------------------------------------

    Description: 
The pseudo code for leader election in the 3.4.3 documentation is the following...

{quote}
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 {color:red}*smallest*{color} 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 {color:red}*smallest*{color} sequence number such that j < i and n_j is a znode in C; 
{quote}


I think, in both third steps *highest* should appear instead of {color:red}*smallest*{color}.


  was:
The pseudo code for leader election in the 3.4.3 documentation is the following...

{quote}
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 {color:red}*smallest*{color} 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 {color:red}*smallest*{color} sequence number such that j < i and n_j is a znode in C; 
{quote}


I think, in both third steps highest should appear instead of {color:red}*smallest*{color}.


    
> leader election pseudo code probably incorrect
> ----------------------------------------------
>
>                 Key: ZOOKEEPER-1404
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1404
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: documentation
>    Affects Versions: 3.4.3
>            Reporter: Robert Varga
>
> The pseudo code for leader election in the 3.4.3 documentation is the following...
> {quote}
> 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 {color:red}*smallest*{color} 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 {color:red}*smallest*{color} sequence number such that j < i and n_j is a znode in C; 
> {quote}
> I think, in both third steps *highest* should appear instead of {color:red}*smallest*{color}.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira