]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/ReplicatedPG: do not send ACK separate from COMMIT
authorSage Weil <sage@redhat.com>
Sat, 10 Dec 2016 23:03:10 +0000 (17:03 -0600)
committerSage Weil <sage@redhat.com>
Thu, 29 Dec 2016 15:30:07 +0000 (10:30 -0500)
This never comes before COMMIT, making it useless to clients.  And it's
just unnecessary overhead.

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/PrimaryLogPG.cc
src/osd/PrimaryLogPG.h

index b89c30146806e9f53b142fe5dc628564c11960a5..bf4bada253d067b0e9c429f48372bc9083f96c10 100644 (file)
@@ -3262,32 +3262,13 @@ void PrimaryLogPG::execute_ctx(OpContext *ctx)
 
   // no need to capture PG ref, repop cancel will handle that
   // Can capture the ctx by pointer, it's owned by the repop
-  ctx->register_on_applied(
-    [m, ctx, this](){
-      if (m && m->wants_ack() && !ctx->sent_ack && !ctx->sent_disk) {
-       // send ack
-       MOSDOpReply *reply = ctx->reply;
-       if (reply)
-         ctx->reply = NULL;
-       else {
-         reply = new MOSDOpReply(m, 0, get_osdmap()->get_epoch(), 0, true);
-         reply->set_reply_versions(ctx->at_version,
-                                   ctx->user_at_version);
-       }
-       reply->add_flags(CEPH_OSD_FLAG_ACK);
-       dout(10) << " sending ack: " << *m << " " << reply << dendl;
-       osd->send_message_osd_client(reply, m->get_connection());
-       ctx->sent_ack = true;
-      }
-    });
   ctx->register_on_commit(
     [m, ctx, this](){
       if (ctx->op)
        log_op_stats(
          ctx);
 
-      if (m && m->wants_ondisk() && !ctx->sent_disk) {
-       // send commit.
+      if (m && (m->wants_ondisk() || m->wants_ack()) && !ctx->sent_reply) {
        MOSDOpReply *reply = ctx->reply;
        if (reply)
          ctx->reply = NULL;
@@ -3297,9 +3278,9 @@ void PrimaryLogPG::execute_ctx(OpContext *ctx)
                                    ctx->user_at_version);
        }
        reply->add_flags(CEPH_OSD_FLAG_ACK | CEPH_OSD_FLAG_ONDISK);
-       dout(10) << " sending commit on " << *m << " " << reply << dendl;
+       dout(10) << " sending reply on " << *m << " " << reply << dendl;
        osd->send_message_osd_client(reply, m->get_connection());
-       ctx->sent_disk = true;
+       ctx->sent_reply = true;
        ctx->op->mark_commit_sent();
       }
     });
index 9430456672451df42f09bc059c14ccddea4dc0ba..50b32365153b1659b70a993c7bb167e87cc5a8d0 100644 (file)
@@ -544,8 +544,7 @@ public:
       on_committed.emplace_back(std::forward<F>(f));
     }
 
-    bool sent_ack;
-    bool sent_disk;
+    bool sent_reply;
 
     // pending async reads <off, len, op_flags> -> <outbl, outr>
     list<pair<boost::tuple<uint64_t, uint64_t, unsigned>,
@@ -581,7 +580,7 @@ public:
       num_read(0),
       num_write(0),
       copy_cb(NULL),
-      sent_ack(false), sent_disk(false),
+      sent_reply(false),
       async_read_result(0),
       inflightreads(0),
       lock_type(ObjectContext::RWState::RWNONE) {