From 4e8ff997c0ea8991ab705acff39a43daaf09f04b Mon Sep 17 00:00:00 2001 From: Pradeep Chhetri Date: Tue, 7 Nov 2023 14:20:40 +0800 Subject: [PATCH] fix --- src/Coordination/FourLetterCommand.cpp | 3 ++- src/Coordination/KeeperDispatcher.h | 2 +- src/Coordination/KeeperServer.cpp | 2 +- src/Coordination/KeeperServer.h | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Coordination/FourLetterCommand.cpp b/src/Coordination/FourLetterCommand.cpp index 85d18e36feb2..be2c5ebd0710 100644 --- a/src/Coordination/FourLetterCommand.cpp +++ b/src/Coordination/FourLetterCommand.cpp @@ -584,7 +584,8 @@ String FeatureFlagsCommand::run() String YieldLeadershipCommand::run() { - return keeper_dispatcher.yieldLeadership() ? "Sent yield leadership request to leader." : "Failed to send yield leadership request to leader."; + keeper_dispatcher.yieldLeadership(); + return "Sent yield leadership request to leader."; } } diff --git a/src/Coordination/KeeperDispatcher.h b/src/Coordination/KeeperDispatcher.h index 43cedd5aa2cb..6483de7bd197 100644 --- a/src/Coordination/KeeperDispatcher.h +++ b/src/Coordination/KeeperDispatcher.h @@ -238,7 +238,7 @@ class KeeperDispatcher } /// Yield leadership and become follower. - bool yieldLeadership() + void yieldLeadership() { return server->yieldLeadership(); } diff --git a/src/Coordination/KeeperServer.cpp b/src/Coordination/KeeperServer.cpp index ef6a88cd141f..d1a9eeca61c6 100644 --- a/src/Coordination/KeeperServer.cpp +++ b/src/Coordination/KeeperServer.cpp @@ -1087,7 +1087,7 @@ bool KeeperServer::requestLeader() return isLeader() || raft_instance->request_leadership(); } -bool KeeperServer::yieldLeadership() +void KeeperServer::yieldLeadership() { if (isLeader()) raft_instance->yield_leadership(); diff --git a/src/Coordination/KeeperServer.h b/src/Coordination/KeeperServer.h index 63bf77dc43ed..fcba4a2fffd2 100644 --- a/src/Coordination/KeeperServer.h +++ b/src/Coordination/KeeperServer.h @@ -141,7 +141,7 @@ class KeeperServer bool requestLeader(); - bool yieldLeadership(); + void yieldLeadership(); void recalculateStorageStats(); };