Skip to content

misk-vitess: allow multi_shard_autocommit param in VschemaLinter lookup vindex params - #3905

Open
eeSeeGee wants to merge 1 commit into
masterfrom
young/vschema-linter-multi-shard-autocommit
Open

eeSeeGee wants to merge 1 commit into
masterfrom
young/vschema-linter-multi-shard-autocommit

Conversation

@eeSeeGee

Copy link
Copy Markdown
Collaborator

Problem

Vitess supports the multi_shard_autocommit param 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=SINGLE and an insert creates lookup rows spanning multiple shards: with only autocommit=true, the lookup insert is still an ordinary multi-shard transaction (just a separate one), and SINGLE mode rejects it with lookup.Create: multi-db transaction attempted (see lookup_internal.go in vitess).

VschemaLinter currently hardcodes the allowed lookup params and throws VitessTestDbSchemaLintException for any vschema using multi_shard_autocommit, forcing services that need it to disable lintSchema entirely.

Change

Accept multi_shard_autocommit in its alphabetical position in the ordered params list, following the existing conditional handling for no_verify.

Verified with bin/gradle :misk-vitess:test --tests 'misk.vitess.testing.internal.VschemaLinterTest' including a new test case.

Context

Found while enabling TransactionMode.SINGLE in StartVitessDatabaseTask for cash-server's contacts service to match its production vtgate settings (squareup/cash-server#118654).

…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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant