Skip to content
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: detection of single-statement implicit transactions broken in batch #78970

Closed
ajwerner opened this issue Mar 29, 2022 · 2 comments
Closed
Assignees
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)

Comments

@ajwerner
Copy link
Contributor

ajwerner commented Mar 29, 2022

Describe the problem

In #76834 we changed the behavior of how a batch of statements are
executed when sent in a single protocol message. A number of features in cockroach use the TxnImplicit field of the EvalContext to decide whether the statement being executed is a single-statement explicit transaction. Below is a non-exhaustive list:

  • ALTER COLUMN TYPE
  • ALTER TABLE DROP COLUMN
  • CREATE TABLE AS SELECT
  • REFRESH MATERIALIZED VIEW
  • enabling the declarative schema changer
  • deserializing the session state
  • SET CLUSTER SETTING
  • SET LOCAL
  • DECLARE CURSOR
    • Maybe we also don't want to allow this in the single batch, I don't know
  • crdb_internal.gc_tenant
  • Some code about statement stats and their transaction fingerprint.
  • Metrics tracking in here.

This might be as simple as moving everything to use the AutoCommit concept instead of the Implicit concept. I'm not sure. I think AutoCommit might permit these things to happen as the last statement in a multi-statement "implicit" transaction. That worries me.

Jira issue: CRDB-14467

@ajwerner ajwerner added the C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. label Mar 29, 2022
@blathers-crl blathers-crl bot added the T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) label Mar 29, 2022
@ajwerner
Copy link
Contributor Author

The work in #78512 attempted to address some of this, but is incomplete

@rafiss rafiss self-assigned this Mar 29, 2022
@rafiss
Copy link
Collaborator

rafiss commented Apr 21, 2022

further work on #78512 seems to have completely addressed this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Projects
None yet
Development

No branches or pull requests

3 participants