From 14d4538477046067ae24104002a50049e61218ba Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Fri, 14 Jan 2022 04:58:16 +0000 Subject: [PATCH] crimson: add and use FuturizedStore::flush() interface Signed-off-by: Samuel Just --- src/crimson/os/futurized_store.h | 13 +++++++++++++ src/crimson/osd/pg.cc | 26 +++++++++++++------------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/crimson/os/futurized_store.h b/src/crimson/os/futurized_store.h index d25c0948450..c35cba9b05d 100644 --- a/src/crimson/os/futurized_store.h +++ b/src/crimson/os/futurized_store.h @@ -10,6 +10,7 @@ #include +#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(); diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index aee8e833165..f0b85b1f4be 100644 --- a/src/crimson/osd/pg.cc +++ b/src/crimson/osd/pg.cc @@ -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( - 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( + this, + shard_services, + pg_whoami, + pgid, + epoch, + epoch, + PeeringState::IntervalFlush()); + }); return false; } -- 2.39.5