Skip to content

Add helper methods to do safe partition reassignments#26

Open
wvanbergen wants to merge 3 commits intomasterfrom
reassignment_helpers
Open

Add helper methods to do safe partition reassignments#26
wvanbergen wants to merge 3 commits intomasterfrom
reassignment_helpers

Conversation

@wvanbergen
Copy link
Copy Markdown
Owner

@wvanbergen wvanbergen force-pushed the reassignment_helpers branch from 1061f83 to d1296f0 Compare December 2, 2015 19:00
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

basic ruby question probably, but why do we have to convert to Sets here but get away with comparing things like replicas == replicas.uniq above? I assume these are all intended to be set operations basically.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

replicas.uniq will remove duplicate entries but leaves the order alone, which means that the equation holds if all the entries in the array are unique. We could also do Set.new(replicas).length == replicas.length to get the same result.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ah ok, I didn't realize uniq will preserve order. Makes sense.

@wvanbergen wvanbergen force-pushed the reassignment_helpers branch from d1296f0 to 06557f2 Compare December 2, 2015 19:08
@wvanbergen
Copy link
Copy Markdown
Owner Author

cc @eapache because you were interested in the reassignment problem as well.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

should this default to 3?

@wvanbergen wvanbergen changed the title Add helper methods do do safe partition reassignments Add helper methods to do safe partition reassignments Dec 2, 2015
@mkobetic
Copy link
Copy Markdown
Collaborator

mkobetic commented Dec 2, 2015

Hm, I forgot about nils. Is it worth building in a preference for filling in nils, before dropping replicas? Maybe adding the compact check will do most of that already.

@kvs
Copy link
Copy Markdown
Collaborator

kvs commented Dec 4, 2015

Dunno if the new stuff I committed to rebalance.rb is useful here. It starts by filling up the nil-slots, then does something that's essentially identical to what's here.

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.

4 participants