From 677372d8d8d68fb2a207e279622c7a8382a4c927 Mon Sep 17 00:00:00 2001 From: Joao Eduardo Luis Date: Thu, 18 Jun 2015 14:55:19 +0100 Subject: [PATCH] mon: PaxosService: use wait_for_.*_ctx() in absence of an op The vast majority of cases use PaxosService's wait_for_{state}() functions to wait on given {state} before waking up a given op-related callback. E.g., to reply to a command once a proposal finishes. However, there are a few cases[1] in which the callback waiting for the state change does not map to an op. To maintain compatibility, we were keeping the functions just taking a callback and no op with the same name as those taking ops (because c++ is amazing that way), but we realized that developers could keep on using these functions just as before, disregarding the fact that they likely want to use the version taking the op. As such, this patch changes the name of the function taking only the callback, such that it is used solely when the developer really wants to take just the callback. [1] at time of this patch, only three calls were being made that would use only a callback. Out of over one hundred calls using ops. Signed-off-by: Joao Eduardo Luis --- src/mon/PGMonitor.cc | 4 ++-- src/mon/PaxosService.cc | 2 +- src/mon/PaxosService.h | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc index a4226bccc14a5..fe464bf1b4537 100644 --- a/src/mon/PGMonitor.cc +++ b/src/mon/PGMonitor.cc @@ -871,13 +871,13 @@ void PGMonitor::check_osd_map(epoch_t epoch) if (!mon->osdmon()->is_readable()) { dout(10) << "check_osd_map -- osdmap not readable, waiting" << dendl; - mon->osdmon()->wait_for_readable(new RetryCheckOSDMap(this, epoch)); + mon->osdmon()->wait_for_readable_ctx(new RetryCheckOSDMap(this, epoch)); return; } if (!is_writeable()) { dout(10) << "check_osd_map -- pgmap not writeable, waiting" << dendl; - wait_for_writeable(new RetryCheckOSDMap(this, epoch)); + wait_for_writeable_ctx(new RetryCheckOSDMap(this, epoch)); return; } diff --git a/src/mon/PaxosService.cc b/src/mon/PaxosService.cc index 690c580fb8541..c7f19e7b00697 100644 --- a/src/mon/PaxosService.cc +++ b/src/mon/PaxosService.cc @@ -269,7 +269,7 @@ void PaxosService::_active() } if (!is_active()) { dout(10) << "_active - not active" << dendl; - wait_for_active(new C_Active(this)); + wait_for_active_ctx(new C_Active(this)); return; } dout(10) << "_active" << dendl; diff --git a/src/mon/PaxosService.h b/src/mon/PaxosService.h index 624631f527438..c7f6cf919f932 100644 --- a/src/mon/PaxosService.h +++ b/src/mon/PaxosService.h @@ -614,7 +614,7 @@ public: op->mark_event(service_name + ":wait_for_finished_proposal"); waiting_for_finished_proposal.push_back(c); } - void wait_for_finished_proposal(Context *c) { + void wait_for_finished_proposal_ctx(Context *c) { MonOpRequestRef o; wait_for_finished_proposal(o, c); } @@ -634,7 +634,7 @@ public: } wait_for_finished_proposal(op, c); } - void wait_for_active(Context *c) { + void wait_for_active_ctx(Context *c) { MonOpRequestRef o; wait_for_active(o, c); } @@ -667,7 +667,7 @@ public: } } - void wait_for_readable(Context *c, version_t ver = 0) { + void wait_for_readable_ctx(Context *c, version_t ver = 0) { MonOpRequestRef o; // will initialize the shared_ptr to NULL wait_for_readable(o, c, ver); } @@ -688,7 +688,7 @@ public: else paxos->wait_for_writeable(op, c); } - void wait_for_writeable(Context *c) { + void wait_for_writeable_ctx(Context *c) { MonOpRequestRef o; wait_for_writeable(o, c); } -- 2.39.5