Zoltan Martonka has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/24683 )

Change subject: KUDU-3761 prefer follower moves cross-location
......................................................................


Patch Set 2:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/24683/2/src/kudu/rebalance/rebalance_algo.cc
File src/kudu/rebalance/rebalance_algo.cc:

http://gerrit.cloudera.org:8080/#/c/24683/2/src/kudu/rebalance/rebalance_algo.cc@718
PS2, Line 718:     if (!leader_fallback_src) {
             :       leader_fallback_src = ts_id;
             :     }
You should  not look up it_follower or do the for loop if we have 
prefer_follower_moves=false.
It can be written without unecesarry operations (and in my subjective opinion 
better readable like this):

    // make sure we have a fallback option
    string src_ts_id = max_range.first->second;

    if (prefer_follower_moves) {
        const auto& followers_by_table_and_tag =
            cluster_info.ts_with_followers_by_table_and_tag;
        const auto it_followers = followers_by_table_and_tag.find(
            TableIdAndTag{ table_info.table_id, table_info.tag });
        if (it_followers != followers_by_table_and_tag.end()) {
            // find a follower.
            for (auto it = max_range.first; it != max_range.second; ++it) {
                const auto& ts_id = it->second;
                if (ContainsKey(it_followers->second, ts_id)) {
                    src_ts_id = ts_id;
                    break;
                }
            }
        }
    }



--
To view, visit http://gerrit.cloudera.org:8080/24683
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8a162a227071caf37d572ba60c2bc49608d14e65
Gerrit-Change-Number: 24683
Gerrit-PatchSet: 2
Gerrit-Owner: Gabriella Lotz <[email protected]>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Zoltan Martonka <[email protected]>
Gerrit-Comment-Date: Thu, 13 Aug 2026 14:40:33 +0000
Gerrit-HasComments: Yes

Reply via email to