]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson: add and use FuturizedStore::flush() interface
authorSamuel Just <sjust@redhat.com>
Fri, 14 Jan 2022 04:58:16 +0000 (04:58 +0000)
committerSamuel Just <sjust@redhat.com>
Fri, 14 Jan 2022 06:16:50 +0000 (22:16 -0800)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/os/futurized_store.h
src/crimson/osd/pg.cc

index d25c09484508a010f0cc264d41b820fed543b0b4..c35cba9b05d8bec734d199ea7a8be2c7ffe7bf51 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <seastar/core/future.hh>
 
+#include "os/Transaction.h"
 #include "crimson/osd/exceptions.h"
 #include "include/buffer_fwd.h"
 #include "include/uuid.h"
@@ -134,6 +135,18 @@ public:
 
   virtual seastar::future<> do_transaction(CollectionRef ch,
                                           ceph::os::Transaction&& txn) = 0;
+  /**
+   * flush
+   *
+   * Flushes outstanding transactions on ch, returned future resolves
+   * after any previously submitted transactions on ch have committed.
+   *
+   * @param ch [in] collection on which to flush
+   */
+  virtual seastar::future<> flush(CollectionRef ch) {
+    return do_transaction(ch, ceph::os::Transaction{});
+  }
+
   // error injection
   virtual seastar::future<> inject_data_error(const ghobject_t& o) {
     return seastar::now();
index aee8e833165726233b4f3e87227b03520b3916b6..f0b85b1f4bee40f710f58ad6801cf96de5a9a040 100644 (file)
@@ -131,19 +131,19 @@ PG::~PG() {}
 
 bool PG::try_flush_or_schedule_async() {
   logger().debug("PG::try_flush_or_schedule_async: do_transaction...");
-  (void)shard_services.get_store().do_transaction(
-    coll_ref,
-    ObjectStore::Transaction()).then(
-      [this, epoch=get_osdmap_epoch()]() {
-       return shard_services.start_operation<LocalPeeringEvent>(
-         this,
-         shard_services,
-         pg_whoami,
-         pgid,
-         epoch,
-         epoch,
-         PeeringState::IntervalFlush());
-      });
+  (void)shard_services.get_store().flush(
+    coll_ref
+  ).then(
+    [this, epoch=get_osdmap_epoch()]() {
+      return shard_services.start_operation<LocalPeeringEvent>(
+       this,
+       shard_services,
+       pg_whoami,
+       pgid,
+       epoch,
+       epoch,
+       PeeringState::IntervalFlush());
+    });
   return false;
 }