-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Re-add options to QueryService interface
#19075
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
Merged
Merged
Conversation
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
vitessio#19007 updated the `QueryService` interface with a new `Session` interface that contains the session UUID and the existing `ExecuteOptions`. Since the `options` parameter was now redundant and can be pulled from the `Session` directly, it was removed. This caused a lot of unnecessary changes, but also introduced a race condition in `scatter_conn.go`: ```diff allErrors := stc.multiGoTransaction( // ... func(rs *srvtopo.ResolvedShard, i int, info *shardActionInfo) (*shardActionInfo, error) { // ... // Goroutine A reading session if session != nil && session.Session != nil { opts = session.Options } // Goroutine B writing session if opts == nil && fetchLastInsertID { opts = &querypb.ExecuteOptions{FetchLastInsertId: fetchLastInsertID} + session = econtext.NewSafeSession(&vtgatepb.Session{Options: opts}) } // ... } ) ``` This PR removes `GetOptions` from the new `Session` interface and adds back the `options` parameter to the `QueryService` interface. This allows each goroutine in that `scatter_conn.go` logic to keep its own local `opts` and not overwrite the shared `session`, reverting the logic to how it was before. Signed-off-by: Mohamed Hamza <[email protected]>
Contributor
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
|
Signed-off-by: Mohamed Hamza <[email protected]>
arthurschreiber
approved these changes
Dec 23, 2025
timvaillancourt
approved these changes
Dec 24, 2025
Signed-off-by: Mohamed Hamza <[email protected]>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #19075 +/- ##
==========================================
- Coverage 69.90% 69.89% -0.01%
==========================================
Files 1612 1612
Lines 215817 215789 -28
==========================================
- Hits 150865 150824 -41
- Misses 64952 64965 +13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
mhamza15
added a commit
to mhamza15/vitess
that referenced
this pull request
Jan 5, 2026
Signed-off-by: Mohamed Hamza <[email protected]>
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.
Description
#19007 updated the
QueryServiceinterface with a newSessioninterface that contains the session UUID and the existingExecuteOptions. Since theoptionsparameter was now redundant and can be pulled from theSessiondirectly, it was removed. This caused a lot of unnecessary changes, but also introduced a race condition inscatter_conn.go:allErrors := stc.multiGoTransaction( // ... func(rs *srvtopo.ResolvedShard, i int, info *shardActionInfo) (*shardActionInfo, error) { // ... // Goroutine A reading session if session != nil && session.Session != nil { opts = session.Options } // Goroutine B writing session if opts == nil && fetchLastInsertID { opts = &querypb.ExecuteOptions{FetchLastInsertId: fetchLastInsertID} + session = econtext.NewSafeSession(&vtgatepb.Session{Options: opts}) } // ... } )This PR removes
GetOptionsfrom the newSessioninterface and adds back theoptionsparameter to theQueryServiceinterface. This allows each goroutine in thatscatter_conn.gologic to keep its own localoptsand not overwrite the sharedsession, reverting the logic to how it was before.Related Issue(s)
Checklist
Deployment Notes
AI Disclosure