Skip to content

Make sure lookup vindexes are queryable inside transaction#6499

Merged
sougou merged 2 commits intovitessio:masterfrom
planetscale:lookup-in-correct-tx
Aug 2, 2020
Merged

Make sure lookup vindexes are queryable inside transaction#6499
sougou merged 2 commits intovitessio:masterfrom
planetscale:lookup-in-correct-tx

Conversation

@systay
Copy link
Copy Markdown
Collaborator

@systay systay commented Jul 30, 2020

When adding data to tables that have consistent lookup vindexes defined on them, Vitess uses different connections to be able to commit data in discrete chunks - we INSERT new data to indexes before we add data to the base table. If something goes wrong along the way, it's acceptable to have data exist in the vindex that is not present in the base table - this will lead to unnecessary queries, but not inconsistent results.

The issue this PR is solving is that we were not querying the lookup vindex on the correct connection while still inside the transaction, which leads to no data being found.

Note: for DELETEd rows, we will query the vindex on the wrong connection, which will lead to unnecessary queries, but
no wrong results, since the data has been deleted from the base table.

systay added 2 commits July 30, 2020 08:45
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
@sougou sougou merged commit 4684798 into vitessio:master Aug 2, 2020
@harshit-gangal harshit-gangal deleted the lookup-in-correct-tx branch August 3, 2020 03:17
@askdba askdba added this to the v8.0 milestone Oct 5, 2020
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.

4 participants