Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#24778] DocDB: Set field pg_txn_start_us for restarted txns
Summary: Commit 269a518 / D39339 rightly changed the way we set field `pg_txn_start_us` for docdb transactions, by setting it during the first call to `DoBeginTransactionIfNecessary` instead of setting it on each `Perform` call. We seem to have missed setting the field when a new transaction is created through `PgClientSession::RestartTransaction`. This path is triggered by transactions that encounter read restart error, and that undergo retries triggered by the query layer. `pg_txn_start_us` field is used by the wait-queue to resume waiters in order of earliest transactions first i.e for a set of resolved waiters, the resumption is in the order - earliest to the latest txn start time. The wait-queue has a DCHECK ensuring that docdb distributed txns have a non-zero txn start time, which was not being set for txns restarted due to read restarts, and hence the failures of test `TestPgTransparentRestarts#testUpdateLong`. This diff addresses the issue by explicitly copying `pg_txn_start_us` in `YBTransaction::Impl::FillRestartedTransaction`, essentially restoring the behavior of preserving priority of waiter resumption for read-restarted txns. Jira: DB-13873 Test Plan: Jenkins ./yb_build.sh fastdebug --java-test TestPgTransparentRestarts#testUpdateLong -n 10 --tp 1 Reviewers: sergei, pjain, patnaik.balivada Reviewed By: sergei Subscribers: ybase Differential Revision: https://phorge.dev.yugabyte.com/D39713
- Loading branch information