From: Joao Eduardo Luis Date: Wed, 10 Jun 2015 00:49:23 +0000 (+0100) Subject: mon: PaxosService: have wait_for_* functions requiring an op X-Git-Tag: v9.1.0~535^2~25 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b9e6696c09bad72ca392fa5a65fcf9aed729aa08;p=ceph.git mon: PaxosService: have wait_for_* functions requiring an op Basically, so we can mark the op accordinly; we'll leave context-only functions to maintain compatibility with other users of these functions that do not use them for op-related callbacks. Signed-off-by: Joao Eduardo Luis --- diff --git a/src/mon/PaxosService.h b/src/mon/PaxosService.h index e89004f3c41b..624631f52743 100644 --- a/src/mon/PaxosService.h +++ b/src/mon/PaxosService.h @@ -609,21 +609,34 @@ public: * * @param c The callback to be awaken once the proposal is finished. */ - void wait_for_finished_proposal(Context *c) { + void wait_for_finished_proposal(MonOpRequestRef op, Context *c) { + if (op) + op->mark_event(service_name + ":wait_for_finished_proposal"); waiting_for_finished_proposal.push_back(c); } + void wait_for_finished_proposal(Context *c) { + MonOpRequestRef o; + wait_for_finished_proposal(o, c); + } /** * Wait for us to become active * * @param c The callback to be awaken once we become active. */ - void wait_for_active(Context *c) { + void wait_for_active(MonOpRequestRef op, Context *c) { + if (op) + op->mark_event(service_name + ":wait_for_active"); + if (!is_proposing()) { - paxos->wait_for_active(c); + paxos->wait_for_active(op, c); return; } - wait_for_finished_proposal(c); + wait_for_finished_proposal(op, c); + } + void wait_for_active(Context *c) { + MonOpRequestRef o; + wait_for_active(o, c); } /** @@ -632,19 +645,31 @@ public: * @param c The callback to be awaken once we become active. * @param ver The version we want to wait on. */ - void wait_for_readable(Context *c, version_t ver = 0) { + void wait_for_readable(MonOpRequestRef op, Context *c, version_t ver = 0) { /* This is somewhat of a hack. We only do check if a version is readable on * PaxosService::dispatch(), but, nonetheless, we must make sure that if that * is why we are not readable, then we must wait on PaxosService and not on * Paxos; otherwise, we may assert on Paxos::wait_for_readable() if it * happens to be readable at that specific point in time. */ + if (op) + op->mark_event(service_name + ":wait_for_readable"); + if (is_proposing() || ver > get_last_committed() || get_last_committed() == 0) - wait_for_finished_proposal(c); - else - paxos->wait_for_readable(c); + wait_for_finished_proposal(op, c); + else { + if (op) + op->mark_event(service_name + ":wait_for_readable/paxos"); + + paxos->wait_for_readable(op, c); + } + } + + void wait_for_readable(Context *c, version_t ver = 0) { + MonOpRequestRef o; // will initialize the shared_ptr to NULL + wait_for_readable(o, c, ver); } /** @@ -652,15 +677,23 @@ public: * * @param c The callback to be awaken once we become writeable. */ - void wait_for_writeable(Context *c) { + void wait_for_writeable(MonOpRequestRef op, Context *c) { + if (op) + op->mark_event(service_name + ":wait_for_writeable"); + if (is_proposing()) - wait_for_finished_proposal(c); + wait_for_finished_proposal(op, c); else if (!is_write_ready()) - wait_for_active(c); + wait_for_active(op, c); else - paxos->wait_for_writeable(c); + paxos->wait_for_writeable(op, c); + } + void wait_for_writeable(Context *c) { + MonOpRequestRef o; + wait_for_writeable(o, c); } + /** * @defgroup PaxosService_h_Trim Functions for trimming states * @{