From 0b27d453d5abf006537155264e36257d7f3e5db7 Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Mon, 13 Mar 2023 10:25:55 -0400 Subject: [PATCH] mon: fix semantic error prepare_update return The return value is used to indicate whether the pending state should be committed. There is no concept of "handled message" here (unlike preprocess_query). Signed-off-by: Patrick Donnelly (cherry picked from commit 8caa1fd5abe0fd16e579e10a1ad45a4147994862) --- src/mon/MgrMonitor.cc | 4 ++-- src/mon/PaxosService.h | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/mon/MgrMonitor.cc b/src/mon/MgrMonitor.cc index 55309e203d358..422724e708094 100644 --- a/src/mon/MgrMonitor.cc +++ b/src/mon/MgrMonitor.cc @@ -441,13 +441,13 @@ bool MgrMonitor::prepare_update(MonOpRequestRef op) } catch (const bad_cmd_get& e) { bufferlist bl; mon.reply_command(op, -EINVAL, e.what(), bl, get_last_committed()); - return true; + return false; /* nothing to propose! */ } default: mon.no_reply(op); derr << "Unhandled message type " << m->get_type() << dendl; - return true; + return false; /* nothing to propose! */ } } diff --git a/src/mon/PaxosService.h b/src/mon/PaxosService.h index 93c5e7c81f932..de3145b9bbabc 100644 --- a/src/mon/PaxosService.h +++ b/src/mon/PaxosService.h @@ -358,8 +358,7 @@ public: * @invariant This function is only called on a Leader. * * @param m An update message - * @returns 'true' if the update message was handled (e.g., a command that - * went through); 'false' otherwise. + * @returns 'true' if the pending state should be proposed; 'false' otherwise. */ virtual bool prepare_update(MonOpRequestRef op) = 0; /** -- 2.39.5