Skip to content
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

[DAP-5297] Backport fix for incorrect error message on duplicate key error for consistent_lookup_unique vindex #23

Merged
merged 1 commit into from
Apr 19, 2024

Conversation

swu-etsy
Copy link
Contributor

@swu-etsy swu-etsy commented Apr 19, 2024

This PR

This PR backports this bugfix from the upstream Vitess repo to v.15.0.2 of our fork. (Original bug report) In the upstream repo, the bugfix was only backported to v.17 and later. But there is precedence for backporting this fix to v.15.0.* -- it was backported to v.15.0.3 of Shopify's Vitess fork.

To summarize, in the case where a duplicate is found in a consistent lookup vindex, Vitess attempts to lock the existing row corresponding to the duplicate in the lookup table. There is a bug in a function call to ExecuteKeyspaceId within that logic, where an empty context element rather than the actual context of the request is passed in. Since the empty context element does not contain caller id information, ExecuteKeyspaceId returns a missing caller id error when it because it is unable to perform Access Control List checks against the caller.

The fix is to pass in the request context to ExecuteKeyspaceId instead of the empty context object.

Other context

This fix unblocks the following:

Testing

Unit tests in vitess/go/vt/vtgate/vindexes pass.

In our Vitess sandbox, I repro'd the bug and tested that the fix produced the correct Duplicate entry... error message instead of the missing caller id... message. I confirmed the Duplicate entry... error appeared when attempting to store a record that violated either UNIQUE KEY or PRIMARY KEY constraints. (Gist with manual test steps)

@swu-etsy swu-etsy changed the title Backport fix for incorrect error message on duplicate key error for consistent_lookup_unique vindex [DAP-5297] Backport fix for incorrect error message on duplicate key error for consistent_lookup_unique vindex Apr 19, 2024
@swu-etsy swu-etsy marked this pull request as ready for review April 19, 2024 15:31
@swu-etsy swu-etsy requested a review from a team as a code owner April 19, 2024 15:31
@swu-etsy swu-etsy merged commit 92fdb9a into main Apr 19, 2024
@swu-etsy swu-etsy deleted the swu-DAP-5297-sv-backport branch April 19, 2024 18:57
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.

2 participants