Skip to content

Zk leader election (sequence)#28

Closed
Dareen wants to merge 7 commits intoairbnb:masterfrom
dubizzle:ZK_leader_election
Closed

Zk leader election (sequence)#28
Dareen wants to merge 7 commits intoairbnb:masterfrom
dubizzle:ZK_leader_election

Conversation

@Dareen
Copy link

@Dareen Dareen commented Nov 21, 2013

added the ability to use ZK leader election capability

@igor47
Copy link
Collaborator

igor47 commented Nov 21, 2013

can you give a little more context here? if a number of nodes register with the same service, you want to pick the one with the lowest sequential id to write to? how/where do you use these sequential nodes?

@Dareen
Copy link
Author

Dareen commented Nov 22, 2013

yes but there's an issue that i found in deleting the node, because @key doesn't contain the sequence and the node doesn't know which sequence did it get, i'll work on that and update the code.

as for usage, yes it's for leader election, to use the node with the lowest sequence as the master node, suitable for services that must have a leader/master such as DB's, the consumer that will have synapse installed, will read the lowest sequence node from haproxy and consider it the master node

@Dareen
Copy link
Author

Dareen commented Nov 24, 2013

@igor47 the pull request is ready now

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think you meant || here instead of | ?

@igor47
Copy link
Collaborator

igor47 commented Nov 25, 2013

i am not sure how this code would be used right now; i would like to see a matching PR for nerve that takes advantage of this feature before merging.

i am concerned that if the sequential id is being appended to the node name (@key) you might not get what you expect from a straightforward aphanumeric sort.

additionally, i've heard concerns about the general node naming strategy for nerve. i might be open to the idea of making all node names sequential ids, and including more information (like hostname) in the node information instead. this would solve the problem we fix here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the '-' is inserted to help visualize the sequence and separate from the port in the node path/key

@Dareen
Copy link
Author

Dareen commented Nov 25, 2013

I'm currently working on consuming this feature and will be opening a PR for the usage of it.

as for using the sequence as an id, a key must be provided before the sequence can be appended to it, that is not a problem however and it's still a valid approach because each time a new sequential node is created with the same key, a new sequence will be appended and thus can fix the issue.

@Dareen
Copy link
Author

Dareen commented Nov 25, 2013

I opened a PR for synapse to consume this feature, and use haproxy to set the slave nodes as backup servers airbnb/synapse#29

@lwf
Copy link

lwf commented Jan 23, 2014

+1 for this. Would be a very useful feature when dealing with master/slave db pairs and similar setups.

@Dareen
Copy link
Author

Dareen commented Feb 4, 2014

@igor47 what's the status of merging this PR?

@igor47 igor47 mentioned this pull request Feb 6, 2014
@igor47 igor47 closed this in #40 Feb 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants