-
Notifications
You must be signed in to change notification settings - Fork 74
[manifold] shard the partitioner #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
lib/manifold.ex
Outdated
| partitioner(:erlang.phash2(pid, 4)) | ||
| end | ||
|
|
||
| defp partitioner(0), do: Manifold.Partitioner |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be compile time generated. but i dont want to pull out the ol' macro handbook.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you add a macro its worth commenting why the first one has no number suffix. (backwards compat)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be a pretty simple macro. What precisely do you want it to generate?
lib/manifold.ex
Outdated
| end | ||
|
|
||
| def partitioner_for(pid) do | ||
| partitioner(:erlang.phash2(pid, 4)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reference of 3, or 4, should be a config.
e096654 to
3c27b68
Compare
3c27b68 to
8ed150d
Compare
lib/manifold.ex
Outdated
| def send(nil, _message), do: :ok | ||
|
|
||
| def current_partitioner() do | ||
| partitioner_for(self()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we think this can ever have a situation where during a handoff stuff starts being sent to another partitioner out of order?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, there is no linearization requirement for handoffs across processes 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure?
If a manifold is backed up on a server.. then there is a handoff on another service which changes the current pid.. you might send things to a new partitioner on the backed up server, causing messages to arrive out of order?
|
@vishnevskiy see f192229 for what we discussed in DM. |
this is just a PoC to the sharding strategy. The idea is to register 4 partitioners with a preset of names, and then send to the correct partitioner in
Manifold.sendbased off the pid of what is sending.TODO: