From: Xuehan Xu Date: Sat, 23 May 2026 04:05:06 +0000 (+0800) Subject: crimson/os/seastore: allow concurrent rewrite transactions X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ee6879ff57163aae9beefacf7432ecc53271bae7;p=ceph-ci.git crimson/os/seastore: allow concurrent rewrite transactions Since promote/demote background processes can run concurrently with trimming and cleaning, there maybe more than one sources that block client transactions from submitting. We need to allow such cases. Signed-off-by: Xuehan Xu --- diff --git a/src/crimson/os/seastore/cached_extent.cc b/src/crimson/os/seastore/cached_extent.cc index 4394480b573..8ce636a580a 100644 --- a/src/crimson/os/seastore/cached_extent.cc +++ b/src/crimson/os/seastore/cached_extent.cc @@ -594,7 +594,7 @@ void ExtentCommitter::block_trans(Transaction &t) { for (auto &item : prior.read_transactions) { TRACET("blocking trans {} for rewriting {}", t, item.t->get_trans_id(), *item.ref); - item.t->need_wait_visibility = true; + item.t->blocked_by.insert(t.get_trans_id()); } } @@ -604,7 +604,7 @@ void ExtentCommitter::unblock_trans(Transaction &t) { for (auto &item : prior.read_transactions) { TRACET("unblocking trans {} for rewriting {}", t, item.t->get_trans_id(), *item.ref); - item.t->need_wait_visibility = false; + item.t->blocked_by.erase(t.get_trans_id()); } } diff --git a/src/crimson/os/seastore/transaction.h b/src/crimson/os/seastore/transaction.h index 1e77b3acc72..4abcf240c71 100644 --- a/src/crimson/os/seastore/transaction.h +++ b/src/crimson/os/seastore/transaction.h @@ -551,7 +551,7 @@ public: ool_write_stats = {}; rewrite_stats = {}; conflicted = false; - need_wait_visibility = false; + blocked_by.clear(); assert(backref_entries.empty()); if (!has_reset) { has_reset = true; @@ -679,7 +679,12 @@ public: btree_cursor_stats_t cursor_stats; - bool need_wait_visibility = false; + // XXX: To allow multiple rewrite transactions to block the same + // transaction, we can't simply use a counter. Because a client + // transaction may be add to the read_transactions of an extent + // when the rewrite transactions that modifies the extent are + // committing. + std::set blocked_by;; private: friend class Cache; diff --git a/src/crimson/os/seastore/transaction_manager.cc b/src/crimson/os/seastore/transaction_manager.cc index 83fa50d7545..97d8d15f779 100644 --- a/src/crimson/os/seastore/transaction_manager.cc +++ b/src/crimson/os/seastore/transaction_manager.cc @@ -740,7 +740,7 @@ TransactionManager::do_submit_transaction( tref.get_handle().enter(write_pipeline.prepare) ); - while (tref.need_wait_visibility) { + while (!tref.blocked_by.empty()) { co_await trans_intr::make_interruptible(seastar::yield()); } if (trim_alloc_to && *trim_alloc_to != JOURNAL_SEQ_NULL) { @@ -991,7 +991,6 @@ TransactionManager::rewrite_extent_ret TransactionManager::rewrite_extent( rewrite_gen_printer_t{target_generation}, sea_time_point_printer_t{modify_time}, *extent); - ceph_assert(!extent->is_pending_io()); } assert(extent->is_valid() && !extent->is_initial_pending());