]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: PaxosService: use wait_for_.*_ctx() in absence of an op
authorJoao Eduardo Luis <joao@suse.de>
Thu, 18 Jun 2015 13:55:19 +0000 (14:55 +0100)
committerJoao Eduardo Luis <joao@suse.de>
Thu, 16 Jul 2015 17:06:08 +0000 (18:06 +0100)
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>
src/mon/PGMonitor.cc
src/mon/PaxosService.cc
src/mon/PaxosService.h

index a4226bccc14a527e9927d450743b40d59fbda5b0..fe464bf1b453794ea81f04e867ba558b6281e6c1 100644 (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;
   }
 
index 690c580fb854190a7c8b7769e1983f45fe0be425..c7f19e7b0069770eef404d75120cbb70102934de 100644 (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;
index 624631f5274386ad6abdef0fd1753e1fbbbc1d55..c7f6cf919f93209db9fd66931c8730ca4392f5ac 100644 (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);
   }