Conversation
…up vindex params Vitess supports the multi_shard_autocommit param on lookup vindexes (v15+), which sends lookup-table inserts as per-shard autocommit statements. This is required for multi-row inserts whose lookup rows span shards when vtgate runs with transaction_mode=SINGLE: with only autocommit=true, the lookup insert is still a normal multi-shard transaction and SINGLE mode rejects it with "lookup.Create: multi-db transaction attempted". VschemaLinter previously rejected any vschema using this param. Accept it in its alphabetical position, matching the existing no_verify handling. Amp-Thread-ID: https://ampcode.com/threads/T-019ff12a-d813-77ea-9aea-f7c88d5d8ab7 Co-authored-by: Amp <amp@ampcode.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Vitess supports the
multi_shard_autocommitparam on lookup vindexes (v15+), which makes vtgate send lookup-table inserts with a/*vt+ MULTI_SHARD_AUTOCOMMIT=1 */directive — independent per-shard autocommit statements instead of a transaction.This param is required when vtgate runs with
transaction_mode=SINGLEand an insert creates lookup rows spanning multiple shards: with onlyautocommit=true, the lookup insert is still an ordinary multi-shard transaction (just a separate one), and SINGLE mode rejects it withlookup.Create: multi-db transaction attempted(seelookup_internal.goin vitess).VschemaLintercurrently hardcodes the allowed lookup params and throwsVitessTestDbSchemaLintExceptionfor any vschema usingmulti_shard_autocommit, forcing services that need it to disablelintSchemaentirely.Change
Accept
multi_shard_autocommitin its alphabetical position in the ordered params list, following the existing conditional handling forno_verify.Verified with
bin/gradle :misk-vitess:test --tests 'misk.vitess.testing.internal.VschemaLinterTest'including a new test case.Context
Found while enabling
TransactionMode.SINGLEinStartVitessDatabaseTaskfor cash-server's contacts service to match its production vtgate settings (squareup/cash-server#118654).