Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/11207 )
Change subject: [master] replica selection honors placement policy ...................................................................... Patch Set 3: (1 comment) http://gerrit.cloudera.org:8080/#/c/11207/3/src/kudu/master/placement_policy.cc File src/kudu/master/placement_policy.cc: http://gerrit.cloudera.org:8080/#/c/11207/3/src/kudu/master/placement_policy.cc@101 PS3, Line 101: boost::optional<string> SelectLocation( : const vector<string>& all, : const set<string>& excluded, : const LocationToDescriptorsMap& ltd, : const unordered_map<string, int>& location_info, : ThreadSafeRandom* rng) { : vector<string> two_choices; : rng->ReservoirSample(all, 2, excluded, &two_choices); : DCHECK_LE(two_choices.size(), 2); : if (two_choices.size() == 1) { : return two_choices.front(); : } : if (two_choices.size() == 2) { : // Pick the better of the two. : return PickBetterLocation(two_choices, ltd, location_info, rng); : } : return boost::none; : } We discussed this offline an it seems we can do better if selecting locations priority queue-style (based on their weight). Once we picked the location n/2 times (where n is replication factor), we remove the location from the location pool for next steps. That is better because it will make the location-wise distribution more balanced and the rebalancer will not need to move too many replicas. Basically, the idea is to use the same criteria for replica placement and balancing to reduce later movements attempted by rebalancer. We need to update the design doc accordingly. -- To view, visit http://gerrit.cloudera.org:8080/11207 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: kudu Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I4169098abf17d5591d4c1675561afc15b5477fcd Gerrit-Change-Number: 11207 Gerrit-PatchSet: 3 Gerrit-Owner: Alexey Serbin <aser...@cloudera.com> Gerrit-Reviewer: Alexey Serbin <aser...@cloudera.com> Gerrit-Reviewer: Kudu Jenkins Gerrit-Reviewer: Will Berkeley <wdberke...@gmail.com> Gerrit-Comment-Date: Wed, 15 Aug 2018 18:38:00 +0000 Gerrit-HasComments: Yes