Skip to content

Instantly share code, notes, and snippets.

@tav
Created November 18, 2013 02:33
Show Gist options
  • Save tav/7521514 to your computer and use it in GitHub Desktop.
Save tav/7521514 to your computer and use it in GitHub Desktop.
dynamodb election:
- find node responsible for key K
- look up K 'master'
- value in K is of the format <seqid>|<status>|<address>|<port>
- if addr:port is self and status != C, then assume role, incr seqid and poll/update K every N/2
- connect to addr:port
- if connected, it would only respond with results if it is still within timer,
else it would send back notification of not-responsible-any-more.
- if not responsible, check store again
- else, initiate new election
- CAS with status set to "C" (Contested)
- wait N seconds
- if node exists, it would have updated status back to OK
- CAS with new address and port
- if leader, check K every N/2 and set status to OK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment