-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
WIP: add optional flag to enable multi shard autocommit by default #17635
base: main
Are you sure you want to change the base?
Conversation
Adds a new vtgate flag --default-multi-shard-autocommit which, as the name implies, opts the query engine into using multi-shard autocommit semantics by default, even if the plan does not contain the query directive MULTI_SHARD_AUTOCOMMIT. Signed-off-by: Michael Demmer <[email protected]>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17635 +/- ##
==========================================
+ Coverage 67.68% 67.69% +0.01%
==========================================
Files 1586 1586
Lines 255647 255654 +7
==========================================
+ Hits 173034 173075 +41
+ Misses 82613 82579 -34 ☔ View full report in Codecov by Sentry. |
How about we use |
Great question -- I considered that as well and if that's what we all think would be a better way to do this, I could try it out and see how it goes.
That said, I opted for a separate option for a couple reasons:
1. Conceptually, a new "MULTI_AUTOCOMMIT_ALLOWED" transaction mode would be basically the same as MULTI just with this one tweak.
So, the change seemed more like the `--no-scatter` option which was added a while back in that it affects a particular behavior of the vtgate rather than defining a whole new "mode".
2. Pragmatically, doing a new transaction mode would be a more involved patch to plumb down into all the right places and would involve a lot more boilerplate changes to end up in the 2-3 places that we actually have to change the executor.
|
Description
Note this is a RFC Draft PR -- soliciting feedback on the idea / proposed implementation.
Adds a new vtgate flag
--default-multi-shard-autocommit
which, as the name implies, opts the query engine into using multi-shard autocommit semantics by default, even if the plan does not contain the query directive MULTI_SHARD_AUTOCOMMIT.The aim of this change is to help protect Slack or other large scale Vitess adopters that use autocommit from inadvertently expensive extra round trips on scatter DMLs.
As a general rule, Slack avoids scatter DMLs, but on occasion when they are needed, prefer the semantics of the MULTI_SHARD_AUTOCOMMIT=1 query directive (in which each shard executes its own autocommit DML) as opposed to the default behavior (in which each shard runs the DML in a transaction and vtgate issues a second round trip to commit).
We generally apply this as a directive in the application code, but that doesn't prevent mistakes where developers can inadvertently forget to apply the directive.
This PR adds an option to change the default behavior so that this is opted in by default. It should not affect any semantics on explicit transactions, nor should it affect any deployments that don't enable the feature.
Related Issue(s)
None.
Checklist
Deployment Notes