mirror of
https://github.com/ceph/ceph
synced 2026-08-02 07:03:18 +00:00
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:
commit
683121dbd4
@ -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();
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user