Skip to content

tpcc: reuse fixed transaction inputs across retry attempts#1

Merged
zinal merged 1 commit into
someshitfrom
cursor/fix-retry-transaction-inputs-1700
Jul 22, 2026
Merged

tpcc: reuse fixed transaction inputs across retry attempts#1
zinal merged 1 commit into
someshitfrom
cursor/fix-retry-transaction-inputs-1700

Conversation

@zinal

@zinal zinal commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Fixes ydb-platform#1

Problem

The retry loop in terminal.cpp re-invokes the entire transaction coroutine on rollback. Random user inputs (district, customer, items, etc.) are generated inside transaction functions, so each retry effectively executes a different business transaction.

Solution

Mirror the approach from ydb-platform/ydb#47316:

  • Add FixedInputs to TTransactionContext and a FixedTransactionInputs<T>() helper that lazily generates and caches inputs.
  • Reset Context.FixedInputs before each new business transaction (outside the retry loop).
  • Wrap all random input generation in each transaction type (NewOrder, Delivery, OrderStatus, Payment, StockLevel) into a local TInputs struct cached via FixedTransactionInputs.

This ensures retries reuse the same user input while new business transactions still get fresh random values.

Open in Web Open in Cursor 

Generate user input once per business transaction and cache it in
TTransactionContext so retry loops do not re-roll RandomNumber and
execute a different business transaction.

Fixes ydb-platform#1

Co-authored-by: Maksim Zinal <zinal@ydb.tech>
@zinal
zinal changed the base branch from main to someshit July 22, 2026 10:49
@zinal
zinal marked this pull request as ready for review July 22, 2026 10:50
@zinal
zinal merged commit 4d2bbfc into someshit Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Повтор транзакций генерирует новые пользовательские входные данные

2 participants