Skip to content

[release-23.0] VTGate: fix warming reads timeout context (#19674)#19728

Merged
timvaillancourt merged 2 commits into
release-23.0from
backport-19674-to-release-23.0
Mar 28, 2026
Merged

[release-23.0] VTGate: fix warming reads timeout context (#19674)#19728
timvaillancourt merged 2 commits into
release-23.0from
backport-19674-to-release-23.0

Conversation

@vitess-bot
Copy link
Copy Markdown
Contributor

@vitess-bot vitess-bot Bot commented Mar 27, 2026

Description

This is a backport of #19674

Copilot AI review requested due to automatic review settings March 27, 2026 15:43
@vitess-bot vitess-bot Bot review requested due to automatic review settings March 27, 2026 15:43
@vitess-bot vitess-bot Bot added the Backport This is a backport label Mar 27, 2026
@vitess-bot
Copy link
Copy Markdown
Contributor Author

vitess-bot Bot commented Mar 27, 2026

Hello @timvaillancourt, there are conflicts in this backport.

Please address them in order to merge this Pull Request. You can execute the snippet below to reset your branch and resolve the conflict manually.

Make sure you replace origin by the name of the vitessio/vitess remote

git fetch --all
gh pr checkout 19728
git reset --hard origin/release-23.0
git cherry-pick -m 1 8c937df416bc9e3f30b5a06953e05f6fd9367a01

@timvaillancourt timvaillancourt removed Skip CI Skip CI actions from running Merge Conflict labels Mar 27, 2026
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
@timvaillancourt timvaillancourt force-pushed the backport-19674-to-release-23.0 branch from 900f8a9 to c67bb6f Compare March 27, 2026 18:22
Copilot AI review requested due to automatic review settings March 27, 2026 18:22
@timvaillancourt
Copy link
Copy Markdown
Contributor

Resolved conflicts for backport of #19674 to release-23.0.

Conflicting files:

  • go/vt/vtgate/executorcontext/vcursor_impl.go — Removed old timeout logic from CloneForReplicaWarming, kept new WarmingReadsContext method.
  • go/vt/vtgate/engine/route.go — Moved CloneForReplicaWarming inside channel select, used warmingCtx. Kept queries instead of warmingQueries since removeForUpdateLocks doesn't exist on this branch.
  • go/vt/vtgate/engine/route_warming_reads_test.go — Removed QueryStatement references (not on this branch), updated FOR UPDATE test expectations to keep the clause.

Reverted: go/vt/wrangler/fake_dbclient_test.go (not in upstream PR, dragged in by cherry-pick).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Backport of #19674 to release-23.0 to ensure VTGate “warming reads” use a dedicated, correctly-scoped timeout context that starts when the warming goroutine runs and is not canceled when the primary request finishes.

Changes:

  • Introduces VCursor.WarmingReadsContext(ctx) to create a timeout-bounded, parent-detached context (and cancel func) for warming reads.
  • Updates warming read execution to use the warming context for routing and execution, and to avoid unnecessary cloning when the warming channel is full.
  • Adds targeted tests covering timeout behavior, parent-cancel independence, and channel-full dropping.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
go/vt/vtgate/executorcontext/vcursor_impl.go Moves warming timeout/context creation into WarmingReadsContext, fixes cancel handling, and updates replica-warming clone setup.
go/vt/vtgate/engine/route.go Uses WarmingReadsContext inside the warming goroutine and clones only after acquiring a channel slot.
go/vt/vtgate/engine/primitive.go Extends VCursor interface with WarmingReadsContext and documents intended usage.
go/vt/vtgate/engine/fake_vcursor_test.go Updates test vcursor helpers to satisfy the extended VCursor interface and adds a ResolveDestinations hook.
go/vt/vtgate/engine/route_warming_reads_test.go Adds new tests validating warming context behavior (deadline, independence from parent cancel, dropping on full channel, deadline exceeded).

return context.WithTimeout(context.Background(), vc.warmingReadsTimeout)
}

func TestWarmingReadsSkipsForUpdate(t *testing.T) {
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test name TestWarmingReadsSkipsForUpdate doesn’t match what the test actually validates (context deadline independence / propagation and execution across multiple query shapes, including a regular SELECT). Renaming this test to reflect its assertions would make failures easier to interpret.

Suggested change
func TestWarmingReadsSkipsForUpdate(t *testing.T) {
func TestWarmingReadsContextDeadlineAndQueryShapes(t *testing.T) {

Copilot uses AI. Check for mistakes.
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 27, 2026

Codecov Report

❌ Patch coverage is 35.71429% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 45.70%. Comparing base (550459d) to head (c67bb6f).
⚠️ Report is 11 commits behind head on release-23.0.

Files with missing lines Patch % Lines
go/vt/vtgate/executorcontext/vcursor_impl.go 0.00% 9 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (550459d) and HEAD (c67bb6f). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (550459d) HEAD (c67bb6f)
1 0
Additional details and impacted files
@@                Coverage Diff                @@
##           release-23.0   #19728       +/-   ##
=================================================
- Coverage         69.45%   45.70%   -23.76%     
=================================================
  Files              1607       67     -1540     
  Lines            215090     7181   -207909     
=================================================
- Hits             149397     3282   -146115     
+ Misses            65693     3899    -61794     
Flag Coverage Δ
partial 45.70% <35.71%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@timvaillancourt timvaillancourt marked this pull request as ready for review March 27, 2026 20:21
@timvaillancourt timvaillancourt enabled auto-merge (squash) March 27, 2026 20:21
@timvaillancourt timvaillancourt merged commit 6a4f504 into release-23.0 Mar 28, 2026
112 of 114 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants