]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: add OpRequest flag point when commit is sent
authorSage Weil <sage@inktank.com>
Mon, 21 Jan 2013 22:14:25 +0000 (14:14 -0800)
committerSage Weil <sage@inktank.com>
Tue, 22 Jan 2013 22:47:40 +0000 (14:47 -0800)
With writeahead journaling in particular, we can get requests that
stay in the queue for a long time even after the commit is sent to the
client while we are waiting for the transaction to apply to the fs.
Instead of showing up as 'waiting for subops', make it clear that the
client has gotten its reply and it is local state that is slow.

Signed-off-by: Sage Weil <sage@inktank.com>
src/osd/OpRequest.h
src/osd/ReplicatedPG.cc

index 0b35fd89f70bcf1aa4189d988018be42a5ebed02..93277789ddf3816daab8036a00436dc5e6043b64 100644 (file)
@@ -139,6 +139,7 @@ private:
   static const uint8_t flag_delayed =     1 << 2;
   static const uint8_t flag_started =     1 << 3;
   static const uint8_t flag_sub_op_sent = 1 << 4;
+  static const uint8_t flag_commit_sent = 1 << 5;
 
   OpRequest(Message *req, OpTracker *tracker) :
     request(req), xitem(this),
@@ -162,11 +163,13 @@ public:
   bool been_delayed() { return hit_flag_points & flag_delayed; }
   bool been_started() { return hit_flag_points & flag_started; }
   bool been_sub_op_sent() { return hit_flag_points & flag_sub_op_sent; }
+  bool been_commit_sent() { return hit_flag_points & flag_commit_sent; }
   bool currently_queued_for_pg() { return latest_flag_point & flag_queued_for_pg; }
   bool currently_reached_pg() { return latest_flag_point & flag_reached_pg; }
   bool currently_delayed() { return latest_flag_point & flag_delayed; }
   bool currently_started() { return latest_flag_point & flag_started; }
   bool currently_sub_op_sent() { return latest_flag_point & flag_sub_op_sent; }
+  bool currently_commit_sent() { return latest_flag_point & flag_commit_sent; }
 
   const char *state_string() const {
     switch(latest_flag_point) {
@@ -175,6 +178,7 @@ public:
     case flag_delayed: return "delayed";
     case flag_started: return "started";
     case flag_sub_op_sent: return "waiting for sub ops";
+    case flag_commit_sent: return "commit sent; apply or cleanup";
     default: break;
     }
     return "no flag points reached";
@@ -204,6 +208,11 @@ public:
     hit_flag_points |= flag_sub_op_sent;
     latest_flag_point = flag_sub_op_sent;
   }
+  void mark_commit_sent() {
+    mark_event("commit_sent");
+    hit_flag_points |= flag_commit_sent;
+    latest_flag_point = flag_commit_sent;
+  }
 
   void mark_event(const string &event);
   osd_reqid_t get_reqid() const {
index 2e15e945b10b5f1c9adcb12678ef8a546f5244d7..1738d29edb935cef231ebdb7fb1d4d262658426c 100644 (file)
@@ -3876,6 +3876,7 @@ void ReplicatedPG::eval_repop(RepGather *repop)
        assert(entity_name_t::TYPE_OSD != m->get_connection()->peer_type);
        osd->send_message_osd_client(reply, m->get_connection());
        repop->sent_disk = true;
+       repop->ctx->op->mark_commit_sent();
       }
     }