-
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
release-22.1: sql: execute batch statements in an implicit transaction #77865
Conversation
This commit will make the next one easier to review. Release justification: test only change Release note: None
Release justification: high value bug fix to existing functionality. Release note (bug fix): Previously statements that arrived in a batch during the simple query protocol would all execute in their own implicit transactions. Now, we match the Postgres wire protocol, so all these statements share the same implicit transaction. If a BEGIN is included in a statement batch, then the existing implicit transaction is upgraded to an explicit transaction.
Release justification: low risk new setting. Release note (sql change): The enable_implicit_transaction_for_batch_statements session variable was added. It defaults to true. When it is true, multiple statements in a single query (a.k.a. a "batch statement") will all be run in the same implicit transaction, which matches the Postgres wire protocol. This setting is provided for users who want to preserve the behavior of CockroachDB versions v21.2 and earlier.
Thanks for opening a backport. Please check the backport criteria before merging:
If some of the basic criteria cannot be satisfied, ensure that the exceptional criteria are satisfied within.
Add a brief release justification to the body of your PR to justify this backport. Some other things to consider:
|
Have we considered setting the default value on the cluster setting to |
I viewed it as a bug fix, so didn't think that was necessary. It was discussed here: #76834 (comment) I'm still in favor of keeping the fixed behavior on by default, but also happy to hear more perspectives and discuss.
I didn't follow this point though. We don't put up release notes for features that are coming at some point in the future. The release notes only communicate was in the binary that is being documented. Also, now this bug fix will be documented in the If the point is about a release's worth of testing, then I see what you mean. But I think all the testing that we'll get on I guess ultimately it comes back to the "bug fix or breaking change" debate. I view this one as a bug fix since it's something at the pgwire protocol level, and the general sentiment of our docs says that we implement the pgwire protocol as exactly as we can. |
Just because it's a "bug fix" doesn't mean it is not a breaking change. We've had many a bug fix in the past that broke stuff and customers were unhappy. What's worse about this one, in my opinion, is that it's not a bug in the sense of what we documented or in the sense that it caused corruption or invalid results. It's an incompatibility and behavior difference with postgres, so we call it a bug. I think I'd frame this more as a compatibility improvement that comes with a breaking change which we should give our users notice about. |
It's also fortunate that this isn't a stateful property: we don't need a migration, it's just a switch. Anybody who wants this behavior change and has been waiting for it will be excited to see they can have it. Folks who know nothing about this will be actively upset when their stuff which currently works breaks. They will be right to complain. |
Let's get @vy-ton to explicitly sign off. This feels like exactly the sort of thing we should be more cautious about because it costs us nearly nothing to be cautious. |
changed to false by default in #77973 |
Backport 3/3 commits from #76834.
/cc @cockroachdb/release
fixes #44803
relates to #76490
Release justification: high value bug fix to existing functionality
*: prepare tests for batch stmt txn change
This commit will make the next one easier to review.
sql: execute batch statements in an implicit transaction
Release note (bug fix): Previously statements that arrived in a batch
during the simple query protocol would all execute in their own implicit
transactions. Now, we match the Postgres wire protocol, so all these
statements share the same implicit transaction. If a BEGIN is included
in a statement batch, then the existing implicit transaction is
upgraded to an explicit transaction.
sql: add session var for old implicit txn behavior
Release note (sql change): The enable_implicit_transaction_for_batch_statements
session variable was added. It defaults to true. When it is true,
multiple statements in a single query (a.k.a. a "batch statement") will
all be run in the same implicit transaction, which matches the Postgres
wire protocol. This setting is provided for users who want to preserve
the behavior of CockroachDB versions v21.2 and earlier.