-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sql: internal executor is very confusing about managing transaction state #78998
Comments
+1. I'm also putting all these in the same jira epic |
We should probably make the internal executor return an error if you feed it more than one statement in a batch. It has odd semantics both with and without a |
It actually does error right now now since we call |
Okay, cool. One thing we could do is return an error for any schema change statement or non-DML that has a transaction provided by the call. |
Fixes cockroachdb#69495 Fixes cockroachdb#78998 Release note: None
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 bogusextraTxnState
and then when the statement finishes, it throws that bogusextraTxnState
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
The text was updated successfully, but these errors were encountered: