This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git


The following commit(s) were added to refs/heads/master by this push:
     new 8369b3771 [tools] KUDU-3487 rebalancer checks the voter num.
8369b3771 is described below

commit 8369b3771c4ee58dcc20068626e64a212717cc65
Author: 宋家成 <[email protected]>
AuthorDate: Tue Jul 25 15:14:33 2023 +0800

    [tools] KUDU-3487 rebalancer checks the voter num.
    
    Replace rebalance for the tables whose replication factor is 1 might
    stuck for a long time because the rebalancer send LeaderStepDown request
    even if there is no other voter to transfer leadership.
    
    So check the voter num before sending the request.
    
    Change-Id: I3b3d5dfb383719f56a2d32b62d2b659b17928794
    Reviewed-on: http://gerrit.cloudera.org:8080/20264
    Tested-by: Kudu Jenkins
    Reviewed-by: Alexey Serbin <[email protected]>
---
 src/kudu/tools/tool_replica_util.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/kudu/tools/tool_replica_util.cc 
b/src/kudu/tools/tool_replica_util.cc
index f627f3297..0a0ae5a5d 100644
--- a/src/kudu/tools/tool_replica_util.cc
+++ b/src/kudu/tools/tool_replica_util.cc
@@ -514,7 +514,9 @@ Status CheckCompleteReplace(const 
client::sp::shared_ptr<client::KuduClient>& cl
       // replica will not be evicted prior the new non-voter replica becomes
       // is promoted into voter. Demoting former leader too early might even
       // delay promotion of already caught-up non-leader replica.
-      if (is_all_voters &&
+      // Also, do not send LeaderStepDown request if voter num is 1 since
+      // it make no sense and will make the leader stuck for a long time.
+      if (is_all_voters && cstate.committed_config().peers().size() > 1 &&
           leader_uuid == ts_uuid && leader_uuid == cstate.leader_uuid()) {
         // The leader is the node we intend to remove; make it step down.
         ignore_result(DoLeaderStepDown(tablet_id, leader_uuid, leader_hp,

Reply via email to