Skip to content

workload/tpcc: fix consistency checks for READ COMMITTED and snapshot…#170881

Open
cpj2195 wants to merge 1 commit into
cockroachdb:masterfrom
cpj2195:cpj/fix-tpcc-consistency-checks
Open

workload/tpcc: fix consistency checks for READ COMMITTED and snapshot…#170881
cpj2195 wants to merge 1 commit into
cockroachdb:masterfrom
cpj2195:cpj/fix-tpcc-consistency-checks

Conversation

@cpj2195
Copy link
Copy Markdown
Contributor

@cpj2195 cpj2195 commented May 25, 2026

Previously, beginAsOfSystemTime did not set an explicit isolation level, so it inherited the cluster default. When the default was READ COMMITTED, SET TRANSACTION AS OF SYSTEM TIME would fail with "unsupported in READ COMMITTED isolation". Fix by explicitly setting SERIALIZABLE isolation.

Additionally, check3322 and check3324 acquired a timestamp inside a transaction, rolled it back, then ran queries outside the transaction using AS OF SYSTEM TIME with that timestamp. This created a race where concurrent TPC-C transactions could cause snapshot inconsistencies between the three queries. Fix by keeping the transaction open and running all queries within it, which guarantees a consistent snapshot.

Resolves: #170876
Resolves: #170877
Epic: none
Release note: None

@cpj2195 cpj2195 requested a review from a team as a code owner May 25, 2026 06:43
@cpj2195 cpj2195 requested review from herkolategan and srosenberg and removed request for a team May 25, 2026 06:43
@trunk-io
Copy link
Copy Markdown
Contributor

trunk-io Bot commented May 25, 2026

Merging to master in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

… races

Previously, `beginAsOfSystemTime` did not set an explicit isolation level,
so it inherited the cluster default. When the default was READ COMMITTED,
`SET TRANSACTION AS OF SYSTEM TIME` would fail with "unsupported in READ
COMMITTED isolation". Fix by explicitly setting SERIALIZABLE isolation.

Additionally, `check3322` and `check3324` acquired a timestamp inside a
transaction, rolled it back, then ran queries outside the transaction
using `AS OF SYSTEM TIME` with that timestamp. This created a race where
concurrent TPC-C transactions could cause snapshot inconsistencies between
the three queries. Fix by keeping the transaction open and running all
queries within it, which guarantees a consistent snapshot.

Resolves: cockroachdb#170876
Resolves: cockroachdb#170877
Epic: none
Release note: None

Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
@cpj2195 cpj2195 force-pushed the cpj/fix-tpcc-consistency-checks branch from ad7709e to ae9e477 Compare May 25, 2026 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants