From cf97daccb53c36a721513bb15924da67ca7da9e0 Mon Sep 17 00:00:00 2001 From: Yingxin Cheng Date: Wed, 19 Jan 2022 15:47:43 +0800 Subject: [PATCH] crimson/osd: skip empty transaction in ShardServices::dispatch_context_transaction Signed-off-by: Yingxin Cheng --- src/crimson/osd/pg.cc | 2 +- src/crimson/osd/shard_services.cc | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index 45ae1875b2b..736e512c370 100644 --- a/src/crimson/osd/pg.cc +++ b/src/crimson/osd/pg.cc @@ -130,7 +130,7 @@ PG::PG( PG::~PG() {} bool PG::try_flush_or_schedule_async() { - logger().debug("PG::try_flush_or_schedule_async: do_transaction..."); + logger().debug("PG::try_flush_or_schedule_async: flush ..."); (void)shard_services.get_store().flush( coll_ref ).then( diff --git a/src/crimson/osd/shard_services.cc b/src/crimson/osd/shard_services.cc index 17192e65d76..b9d97b2b283 100644 --- a/src/crimson/osd/shard_services.cc +++ b/src/crimson/osd/shard_services.cc @@ -106,7 +106,12 @@ seastar::future<> ShardServices::send_to_osd( seastar::future<> ShardServices::dispatch_context_transaction( crimson::os::CollectionRef col, PeeringCtx &ctx) { - logger().debug("ShardServices::dispatch_context_transaction: do_transaction..."); + if (ctx.transaction.empty()) { + logger().debug("ShardServices::dispatch_context_transaction: empty transaction"); + return seastar::now(); + } + + logger().debug("ShardServices::dispatch_context_transaction: do_transaction ..."); auto ret = store.do_transaction( col, std::move(ctx.transaction)); -- 2.39.5