Skip to content

sql: internal executor is very confusing about managing transaction state #78998

@rafiss

Description

@rafiss

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

Metadata

Metadata

Assignees

Labels

A-sql-executorSQL txn logicC-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)T-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions