]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG: call op_applied for submit_log_entries based repops 10886/head
authorSamuel Just <sjust@redhat.com>
Fri, 3 Jun 2016 21:41:13 +0000 (14:41 -0700)
committerLoic Dachary <ldachary@redhat.com>
Fri, 26 Aug 2016 06:59:06 +0000 (08:59 +0200)
Signed-off-by: Samuel Just <sjust@redhat.com>
(cherry picked from commit 8bde0ae122f384817f4e522604379d1e9b21d8d9)

src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index 5e8af4eaa205f8cb6bf1d4e3746b844ec48dce33..4a92dc71cc47de405182b746099a2e111f26b6f5 100644 (file)
@@ -8701,6 +8701,8 @@ void ReplicatedPG::submit_log_entries(
          });
     }
   }
+  t.register_on_applied(
+    new C_OSD_OnApplied{this, get_osdmap()->get_epoch(), info.last_update});
   int r = osd->store->queue_transaction(osr.get(), std::move(t), NULL);
   assert(r == 0);
 }
@@ -9686,7 +9688,7 @@ void ReplicatedPG::do_update_log_missing(OpRequestRef &op)
   append_log_entries_update_missing(m->entries, t);
   // TODO FIX
 
-  Context *c = new FunctionContext(
+  Context *complete = new FunctionContext(
       [=](int) {
        MOSDPGUpdateLogMissing *msg =
          static_cast<MOSDPGUpdateLogMissing*>(
@@ -9704,10 +9706,12 @@ void ReplicatedPG::do_update_log_missing(OpRequestRef &op)
   /* Hack to work around the fact that ReplicatedBackend sends
    * ack+commit if commit happens first */
   if (pool.info.ec_pool()) {
-    t.register_on_complete(c);
+    t.register_on_complete(complete);
   } else {
-    t.register_on_commit(c);
+    t.register_on_commit(complete);
   }
+  t.register_on_applied(
+    new C_OSD_OnApplied{this, get_osdmap()->get_epoch(), info.last_update});
   int tr = osd->store->queue_transaction(
     osr.get(),
     std::move(t),
index 47a6a1613d3a66126770aac545e1bb514a47ac63..d45ac96df7042056c6959d91aa4a4fb493817e2f 100644 (file)
@@ -398,6 +398,22 @@ public:
     append_log(logv, trim_to, trim_rollback_to, t, transaction_applied);
   }
 
+  struct C_OSD_OnApplied : Context {
+    ReplicatedPGRef pg;
+    epoch_t epoch;
+    eversion_t v;
+    C_OSD_OnApplied(
+      ReplicatedPGRef pg,
+      epoch_t epoch,
+      eversion_t v)
+      : pg(pg), epoch(epoch), v(v) {}
+    void finish(int) override {
+      pg->lock();
+      if (!pg->pg_has_reset_since(epoch))
+       pg->op_applied(v);
+      pg->unlock();
+    }
+  };
   void op_applied(
     const eversion_t &applied_version);