From: Matan Breizman Date: Mon, 4 Aug 2025 10:54:34 +0000 (+0000) Subject: crimson/os/seastore: introduce with_repeat_trans_intr X-Git-Tag: testing/wip-vshankar-testing-20250813.085004-debug~14^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=22ad727fed7f640f591c5e17c81978d7ec171d3e;p=ceph-ci.git crimson/os/seastore: introduce with_repeat_trans_intr Most of with_trans_intr use repeat_eagain so it makes sense to introduce this wrapper and audit exisitng users (future PR). Note: each repeated iteration should use a fresh txn if we failed in-flight. Signed-off-by: Matan Breizman --- diff --git a/src/crimson/os/seastore/transaction_interruptor.h b/src/crimson/os/seastore/transaction_interruptor.h index 794564fdc81..9057ad419b2 100644 --- a/src/crimson/os/seastore/transaction_interruptor.h +++ b/src/crimson/os/seastore/transaction_interruptor.h @@ -73,6 +73,21 @@ auto with_trans_intr(Transaction &t, F &&f, Args&&... args) { std::forward(args)...); } +template +auto with_repeat_trans_intr(Transaction &t, F &&f, Args&&... args) { + return repeat_eagain([&t, f=std::move(f), ... args = std::forward(args) ] { + // Try again with a fresh transaction + t.reset_preserve_handle(); + return trans_intr::with_interruption_to_error( + std::move(f), + TransactionConflictCondition(t), + t, + std::forward(args)...); + }); + + +} + template using with_trans_ertr = typename T::base_ertr::template extend;