-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: internal executor is very confusing about managing transaction state #78998
Copy link
Copy link
Closed
Closed
Copy link
Labels
A-sql-executorSQL txn logicSQL txn logicC-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)T-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Description
The way the internal executor works is that when it manages the txn lifecycle (i.e. you pass it nil), then it runs the whole transaction state machine.
However, when you pass in a txn, then it moves itself to the open state with totally bogus extraTxnState and then when the statement finishes, it throws that bogus extraTxnState away.
This can lead to problems, since it bypasses the lifecycle and state management which normally happens for SQL transactions. For example: the deferred creation of jobs and the checking of the two version invariant.
See #76764 for an example where this caused real corruption.
Jira issue: CRDB-14493
Epic CRDB-14492
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-sql-executorSQL txn logicSQL txn logicC-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)T-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)SQL Foundations Team (formerly SQL Schema + SQL Sessions)