Skip to content

Conversation

@maxenglander
Copy link
Collaborator

@maxenglander maxenglander commented Oct 20, 2025

Description

Allow mirrored queries to execute against the target of a MoveTables workflow in spite of the presence of denied tables in the tablet control record.

Details

Achieve this by adding a new allow_reads field to tablet controls as part of MirrorTraffic command. When this field is set, tablets will allow Select* plans to bypass the query rules built from tablet controls.

Alternatives

Some alternatives I considered but decided against. Happy to switch to either of these or another approach if we don't like this PR's direction.

Add Mirrored field to tablet Execute RPCs

Set this field when executing mirrored queries. Have VTTablet pass this field down to query rule evaluation, allowing it to bypass denied tables query rule when (1) plan is Select* and (2) Mirrored is true.

This approach seemed about equivalent to what the PR does now.

Unconditionally allow Select* plan to bypass denied tables

This would simplify things a lot. The main downside seems pretty small, I think mainly users might be surprised to find that some plans could bypass denied tables, and others could not. But figured I'd at least show that it's easy enough to conditionally allow reads only when traffic mirroring is enabled.

Related Issue(s)

Fixes #18774

Checklist

  • "Backport to:" labels not necessary, not applied
  • Not backported, so no backport justification provided
  • Tests were added or are not required
  • Tests pass consistently locally and on CI
  • Documentation is not required

Deployment Notes

AI Disclosure

AI was not used.

@vitess-bot
Copy link
Contributor

vitess-bot bot commented Oct 20, 2025

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • Ensure there is a link to an issue (except for internal cleanup and flaky test fixes), new features should have an RFC that documents use cases and test cases.

Tests

  • Bug fixes should have at least one unit or end-to-end test, enhancement and new features should have a sufficient number of tests.

Documentation

  • Apply the release notes (needs details) label if users need to know about this change.
  • New features should be documented.
  • There should be some code comments as to why things are implemented the way they are.
  • There should be a comment at the top of each new or modified test to explain what the test does.

New flags

  • Is this flag really necessary?
  • Flag names must be clear and intuitive, use dashes (-), and have a clear help text.

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow needs to be marked as required, the maintainer team must be notified.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from vitess-operator and arewefastyet, if used there.
  • vtctl command output order should be stable and awk-able.

@vitess-bot vitess-bot bot added NeedsBackportReason If backport labels have been applied to a PR, a justification is required NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsWebsiteDocsUpdate What it says labels Oct 20, 2025
@github-actions github-actions bot added this to the v24.0.0 milestone Oct 20, 2025
Signed-off-by: Max Englander <[email protected]>
Signed-off-by: Max Englander <[email protected]>
Signed-off-by: Max Englander <[email protected]>
@codecov
Copy link

codecov bot commented Oct 21, 2025

Codecov Report

❌ Patch coverage is 87.00000% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.72%. Comparing base (aecef57) to head (129ab4b).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
go/vt/vtctl/workflow/server.go 72.72% 9 Missing ⚠️
go/vt/vtctl/workflow/traffic_switcher.go 85.71% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #18775   +/-   ##
=======================================
  Coverage   69.72%   69.72%           
=======================================
  Files        1607     1607           
  Lines      214641   214734   +93     
=======================================
+ Hits       149651   149722   +71     
- Misses      64990    65012   +22     

☔ 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.

@maxenglander maxenglander changed the title mirror rules: allow read only queries to bypass denied tables movetables mirrortraffic: allow read only queries to bypass denied tables Oct 21, 2025
@maxenglander maxenglander changed the title movetables mirrortraffic: allow read only queries to bypass denied tables movetables mirrortraffic: read-only queries bypass denied tables Oct 21, 2025
Signed-off-by: Max Englander <[email protected]>
Signed-off-by: Max Englander <[email protected]>
Signed-off-by: Max Englander <[email protected]>
Signed-off-by: Max Englander <[email protected]>
@maxenglander maxenglander changed the title movetables mirrortraffic: read-only queries bypass denied tables movetables mirrortraffic: let read-only queries bypass denied tables Oct 22, 2025
@maxenglander maxenglander self-assigned this Oct 27, 2025
Signed-off-by: Max Englander <[email protected]>
Copy link
Member

@mattlord mattlord left a comment

Choose a reason for hiding this comment

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

Thanks @maxenglander ! This could definitely make total sense for MirrorTraffic workflows. Can we enforce that this new topo option ONLY be used with that command / workflow type? It defeats the purpose of the denied tables list to a large degree, so I think it's worth being extra cautious and limiting its use as much as possible. This might be what you were thinking in this noted potential alternative Add Mirrored field to tablet Execute RPCs.

When would an operator want this enabled or not for a MirrorTraffic workflow? Should we always enable it for them?

@mattlord mattlord added Type: Enhancement Logical improvement (somewhere between a bug and feature) Component: VReplication and removed NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Nov 5, 2025
@maxenglander
Copy link
Collaborator Author

Hey @mattlord 👋

Can we enforce that this new topo option ONLY be used with that command / workflow type?

I think so! I'll look into that.

When would an operator want this enabled or not for a MirrorTraffic workflow? Should we always enable it for them?

I think an operator would always want this anytime they specify MirrorTraffic with --percent [value] for [value] greater than zero. Otherwise, any SELECT traffic that gets mirrored will be denied.

@maxenglander
Copy link
Collaborator Author

maxenglander commented Nov 15, 2025

Hey @mattlord,

Can we enforce that this new topo option ONLY be used with that command / workflow type?

I thought more about this, and I'm actually not sure what a good way to do this would be.

  • I don't think I can really enforce this at the workflow command level. The topo option isn't exposed anywhere at that level. It is implicit to the MirrorTraffic command, but no other command enables that option.
  • One place where it technically could be enforced is at the go/vt/topo level, e.g. in UpdateDeniedTables. However, doing what you're asking would mean bringing knowledge about workflows into the topo level, which seems to me would introduce a circular dependency between the topo and workflow layers.

Currently, the SetShardTabletControl vtctldclient command doesn't even expose this option, it's part of the RPC protobuf definition, but isn't exposed to users in any other way than a direct RPC call or implicitly through MoveTables MirrorTraffic.

When would an operator want this enabled or not for a MirrorTraffic workflow? Should we always enable it for them?

Just to add to what I said above, the MirrorTraffic command always enables AllowReads when it is called with a --percent value greater than zero, and disables it otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: VReplication NeedsWebsiteDocsUpdate What it says Type: Enhancement Logical improvement (somewhere between a bug and feature)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: allow mirrored traffic to bypass denied tables

2 participants