-
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
Vindexes: Pass context in consistent lookup handleDup #14653
Vindexes: Pass context in consistent lookup handleDup #14653
Conversation
Signed-off-by: Brendan Dougherty <[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
|
Is it possible to add a unit test that verifies the new behavior? |
I could update the consistent lookup unit tests in go/vt/vtgate/vindexes/consistent_lookup_test.go to assert that the same context is used for all queries, or I could update the vtgate lookup endtoend tests to use table ACLs by configuring them in go/test/endtoend/vtgate/main_test.go. Either way would catch the bug and verify the fix. Do you have a preference? I'm not sure if the project has strong opinions about testing the implementation vs testing the behavior. |
Haha there's differing opinions her as well. But the general agreement is that unit testing is more predictable, less flaky, easier to debug. Also, at the end of the day, "why not both?" |
Signed-off-by: Brendan Dougherty <[email protected]>
I've updated the unit tests for consistent lookup vindexes to ensure they're passing the expected context whenever they execute a query. I didn't update the vtgate endtoend tests to use table ACLs since it would apply to all tests in that package. The tests still pass, but it could make debugging other issues more complicated. Happy to add that if you think it's worth doing. |
Would it be possible to add backport labels to this PR? The bug presents a slight MySQL compatibility issue for clients in that they can't catch and recover from the expected duplicate entry error code 1062, so I think backporting it would be nice. |
@harshit-gangal for backport consideration |
Signed-off-by: Brendan Dougherty <[email protected]>
Signed-off-by: Brendan Dougherty <[email protected]>
…14653) (#14911) Signed-off-by: Brendan Dougherty <[email protected]> Co-authored-by: Brendan Dougherty <[email protected]>
…14653) (#14912) Signed-off-by: Brendan Dougherty <[email protected]> Co-authored-by: Brendan Dougherty <[email protected]>
Signed-off-by: Brendan Dougherty <[email protected]>
…r-id-error-with-consistent-lookup-vindexes Backport: Vindexes: Pass context in consistent lookup handleDup (vitessio#14653)
Signed-off-by: Brendan Dougherty <[email protected]>
Signed-off-by: Brendan Dougherty <[email protected]>
…r-id-error-with-consistent-lookup-vindexes Backport: Vindexes: Pass context in consistent lookup handleDup (vitessio#14653)
…r-id-error-with-consistent-lookup-vindexes Backport: Vindexes: Pass context in consistent lookup handleDup (vitessio#14653) (cherry picked from commit aacae86)
Description
Context handling was refactored in c43a162 which included this TODO
This causes consistent lookup duplicate row handling to fail when tablets are using strict table ACL enforcement because there is no caller id in the context.
It looks like the TODO and
context.Background()
was left behind inadvertently, so this PR simply passes the existing context through. cc @harshit-gangal in case there was a reason for it.Related Issue(s)
Fixes #14652
Checklist
Deployment Notes
n/a