Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/20310 )
Change subject: KUDU-3497 optimize leader rebalancer algorithm ...................................................................... Patch Set 17: Code-Review+2 (1 comment) http://gerrit.cloudera.org:8080/#/c/20310/10/src/kudu/master/auto_leader_rebalancer.cc File src/kudu/master/auto_leader_rebalancer.cc: http://gerrit.cloudera.org:8080/#/c/20310/10/src/kudu/master/auto_leader_rebalancer.cc@248 PS10, Line 248: string leader_uuid = from_info.first; : int32_t need_transfer_count = from_info.second; : int32_t pick_count = 0; : vector<string>& uuid_leaders = leader_tablet_ids_by_ts_uuid[leader_uuid]; : std::shuffle(uuid_leaders.begin(), uuid_leaders.end(), random_generator_); : // This loop would generate 'uuid_leaders.size()' leader transferring tasks at most. : // Every task would p > Here we have calculated how many leader num X the tserver should have, and Thank you for the explanation. My comment originated from the perception 'remaining_tservers' is staying the same, but it actually changes while iterating through the cycle, indeed. I guess, in the essence this code is adjusting 'remaining_tablets' because of the rounding errors when computing 'target_leader_count' above. OK, that sounds reasonable to me. Does the logic in the code above guarantees that 'remaining_tablets' cannot effectively turn negative, overflowing its unsigned integer variable? If not, maybe add a condition on breaking out of the cycle if that is about to happen, so 'target_leader_count' isn't becoming absurdly huge at last iterations of the cycle. -- To view, visit http://gerrit.cloudera.org:8080/20310 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: kudu Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I0f1fe796fd98da2d8764da793b7e254319e6348a Gerrit-Change-Number: 20310 Gerrit-PatchSet: 17 Gerrit-Owner: Song Jiacheng <[email protected]> Gerrit-Reviewer: Alexey Serbin <[email protected]> Gerrit-Reviewer: Kudu Jenkins (120) Gerrit-Reviewer: Song Jiacheng <[email protected]> Gerrit-Reviewer: Tidy Bot (241) Gerrit-Reviewer: Wang Xixu <[email protected]> Gerrit-Reviewer: Yingchun Lai <[email protected]> Gerrit-Reviewer: Yuqi Du <[email protected]> Gerrit-Comment-Date: Mon, 20 Nov 2023 19:39:07 +0000 Gerrit-HasComments: Yes
