#include <seastar/core/future.hh>
+#include "os/Transaction.h"
#include "crimson/osd/exceptions.h"
#include "include/buffer_fwd.h"
#include "include/uuid.h"
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();
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;
}