Merge pull request #69211 from Matan-B/wip-matanb-seastore-conflict-counters

crimsn/os/seastore: separate reset accounting from transaction creation

Reviewed-by: Xuehan Xu <xuxuehan@qianxin.com>
This commit is contained in:
Matan Breizman 2026-06-09 16:53:42 +03:00 committed by GitHub
commit 683121dbd4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 11 deletions

View File

@ -141,7 +141,6 @@ public:
LOG_PREFIX(Cache::reset_transaction_preserve_handle);
if (t.did_reset()) {
SUBDEBUGT(seastore_t, "reset", t);
++(get_by_src(stats.trans_created_by_src, t.get_src()));
}
t.reset_preserve_handle();
}

View File

@ -1652,6 +1652,10 @@ seastar::future<> SeaStore::Shard::do_transaction_no_callbacks(
++(shard_stats.processing_inlock_io_num);
co_await with_repeat_trans_intr(
[&, this] {
// Preserve handle and rewind the external iterator before each attempt.
ctx.reset_preserve_handle(*transaction_manager);
},
*ctx.transaction,
seastar::coroutine::lambda([&ctx, this, FNAME](auto &t)
-> tm_ret {
@ -1674,7 +1678,6 @@ seastar::future<> SeaStore::Shard::do_transaction_no_callbacks(
ctx.iter.colls.size(),
ctx.iter.objects.size());
ctx.reset_preserve_handle(*transaction_manager);
std::vector<OnodeRef> onodes(ctx.iter.objects.size());
// Get the total number of operations from the transaction

View File

@ -68,25 +68,35 @@ using base_iertr = trans_iertr<base_ertr>;
template <typename F, typename... Args>
auto with_trans_intr(Transaction &t, F &&f, Args&&... args) {
return trans_intr::with_interruption_to_error<crimson::ct_error::eagain>(
std::move(f),
std::forward<F>(f),
TransactionConflictCondition(t),
t,
std::forward<Args>(args)...);
}
template <typename F, typename... Args>
auto with_repeat_trans_intr(Transaction &t, F &&f, Args&&... args) {
return repeat_eagain([&t, f=std::move(f), ... args = std::forward<Args>(args) ] {
// Try again with a fresh transaction
t.reset_preserve_handle();
template <typename Prepare, typename F, typename... Args>
auto with_repeat_trans_intr(Prepare &&prepare_attempt, Transaction &t, F &&f, Args&&... args) {
return repeat_eagain(
[&t,
prepare_attempt = std::forward<Prepare>(prepare_attempt),
f = std::forward<F>(f),
... args = std::forward<Args>(args) ] {
prepare_attempt();
return trans_intr::with_interruption_to_error<crimson::ct_error::eagain>(
std::move(f),
f,
TransactionConflictCondition(t),
t,
std::forward<Args>(args)...);
args...);
});
}
template <typename F, typename... Args>
auto with_repeat_trans_intr(Transaction &t, F &&f, Args&&... args) {
return with_repeat_trans_intr(
[] {},
t,
std::forward<F>(f),
std::forward<Args>(args)...);
}
template <typename T>