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 <joao@suse.de>
This commit is contained in:
Joao Eduardo Luis 2015-06-18 14:55:19 +01:00
parent d240a76d44
commit 677372d8d8
3 changed files with 7 additions and 7 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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);
}