Skip to content
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

ISPN-7461 Cache is not rebalanced on merge #5015

Closed
wants to merge 1 commit into from

Conversation

jurakp
Copy link

@jurakp jurakp commented Mar 23, 2017

@ghost
Copy link

ghost commented Mar 23, 2017

Can one of the admins verify this patch?

@wburns
Copy link
Member

wburns commented Mar 24, 2017

@danberindei can you take a look at this? It seems this might be a good one for 9.0, wdyt?

@rvansa
Copy link
Member

rvansa commented Mar 27, 2017

@wburns It's meant for 5.2 :) I don't think we can guarantee much after merge - merge without partition handling is scarcely tested (if at all). A proper solution is related to AP mode - diverged entries merge (I don't know if @ryanemerson is about to work on that given that he has worked on the consistency checker).

@ryanemerson
Copy link
Contributor

@rvansa @wburns The plan is for Automatic Merging with various merge strategies to be implemented for 9.1. This is currently a WIP, but you can see the rough design docs here.

@wburns
Copy link
Member

wburns commented Mar 27, 2017

@rvansa Oh I know that we can't guarantee anything after merge in regards to data. I was more asking because this change only has to do with the topology updates.

@danberindei
Copy link
Member

Oops, I missed this one... for some reason I'm showing up as a reviewer here but not in the PR list :)

I'm don't think this is the right approach. DefaultRebalancePolicy.updateCacheStatus() is called from lots of places, and I'm afraid without this check it could get into an infinite loop. I would rather fix isBalanced(), making it more like the check in startRebalance():

     ConsistentHash updatedMembersCH = chFactory.updateMembers(currentCH, newMembers);
     ConsistentHash balancedCH = chFactory.rebalance(updatedMembersCH);
     return balancedCH.equals(currentCH);

@jurakp
Copy link
Author

jurakp commented Apr 3, 2017

I have rewritten it based on @danberindei comment. The main problem was encapsulation of cache status map. I did not want to modify ClusterTopologyManagerImpl just for test, therefore I use reflection to get that map in TestingUtil.

Copy link
Member

@danberindei danberindei left a comment

Choose a reason for hiding this comment

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

Just one minor comment

ConsistentHash currentCH = cacheTopology.getCurrentCH();
ConsistentHash updatedMembersCH = chFactory.updateMembers(currentCH, cacheStatus.getMembers());
ConsistentHash balancedCH = chFactory.rebalance(updatedMembersCH);
if (currentCH == null || balancedCH.equals(currentCH)) {
Copy link
Member

Choose a reason for hiding this comment

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

If currentCH == null, updateMembers(currentCH, ...) would throw a NPE. So we should either check for null before, or remove the check here. I don't think it's possible to have a CacheTopology with a currentCH == null, is it?

@jurakp
Copy link
Author

jurakp commented Apr 19, 2017

@danberindei You were right. I have removed unnecessary null check.

@danberindei
Copy link
Member

Integrated, thanks Petr!

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.

6 participants