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 e3a5e90ae [tools] fix mistake in LeaderStepDown()
e3a5e90ae is described below

commit e3a5e90ae719a961fa711996e718044f5ae4b3bb
Author: Alexey Serbin <[email protected]>
AuthorDate: Thu Dec 8 23:05:51 2022 -0800

    [tools] fix mistake in LeaderStepDown()
    
    This patch fixes mistake in LeaderStepDown() that lead to SIGSEGV in
    some scenarios when using the 'kudu tablet leader_step_down' CLI tool.
    
    This is a follow-up to 7f7e2cf4611e9fb6fe07a57df8762f1ce2e71b8f.
    
    Change-Id: I3ee51c2b99c37f1eec96d94a6538c0fd78f39be2
    Reviewed-on: http://gerrit.cloudera.org:8080/19332
    Tested-by: Kudu Jenkins
    Reviewed-by: Ashwani Raina <[email protected]>
    Reviewed-by: Attila Bukor <[email protected]>
---
 src/kudu/tools/tool_action_tablet.cc | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/kudu/tools/tool_action_tablet.cc 
b/src/kudu/tools/tool_action_tablet.cc
index c4351b33c..60d48f772 100644
--- a/src/kudu/tools/tool_action_tablet.cc
+++ b/src/kudu/tools/tool_action_tablet.cc
@@ -193,13 +193,16 @@ Status LeaderStepDown(const RunnerContext& context) {
   RETURN_NOT_OK(s);
 
   // If the requested new leader is the leader, the command can short-circuit.
-  if (new_leader_uuid && (leader_uuid == *new_leader_uuid || leader_uuid == 
*current_leader_uuid)) {
+  if (new_leader_uuid && leader_uuid == *new_leader_uuid) {
     cout << Substitute("Requested new leader $0 is already the leader",
                        leader_uuid) << endl;
     return Status::OK();
   }
-  return DoLeaderStepDown(tablet_id, current_leader_uuid ? 
*current_leader_uuid : leader_uuid,
-                          leader_hp, mode, new_leader_uuid,
+  return DoLeaderStepDown(tablet_id,
+                          current_leader_uuid ? *current_leader_uuid : 
leader_uuid,
+                          leader_hp,
+                          mode,
+                          new_leader_uuid,
                           client->default_admin_operation_timeout());
 }
 

Reply via email to