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

Experimental: Add missing tables to globally routed list in schema tracker only if they are not already present in a VSchema #17371

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

rohit-nayak-ps
Copy link
Contributor

@rohit-nayak-ps rohit-nayak-ps commented Dec 11, 2024

Description

Follows up on the idea in #16517 by not considering tables already present in the globally routable list of tables.

Related Issue(s)

#16516

Checklist

  • "Backport to:" labels have been added if this change should be back-ported to release branches
  • If this change is to be back-ported to previous releases, a justification is included in the PR description
  • Tests were added or are not required
  • Did the new or modified tests pass consistently locally and on CI?
  • Documentation was added or is not required

Deployment Notes

…they are not already present in a VSchema

Signed-off-by: Rohit Nayak <[email protected]>
Copy link
Contributor

vitess-bot bot commented Dec 11, 2024

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 Dec 11, 2024
@rohit-nayak-ps rohit-nayak-ps added Type: Enhancement Logical improvement (somewhere between a bug and feature) Component: Query Serving and removed NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsWebsiteDocsUpdate What it says 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 Dec 11, 2024
@github-actions github-actions bot added this to the v22.0.0 milestone Dec 11, 2024
Copy link

codecov bot commented Dec 11, 2024

Codecov Report

Attention: Patch coverage is 97.43590% with 1 line in your changes missing coverage. Please review.

Project coverage is 67.67%. Comparing base (747a61c) to head (f060616).
Report is 35 commits behind head on main.

Files with missing lines Patch % Lines
go/vt/vtgate/vtgate.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17371      +/-   ##
==========================================
+ Coverage   67.48%   67.67%   +0.18%     
==========================================
  Files        1577     1583       +6     
  Lines      253424   254357     +933     
==========================================
+ Hits       171033   172132    +1099     
+ Misses      82391    82225     -166     

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

Copy link
Member

@GuptaManan100 GuptaManan100 left a comment

Choose a reason for hiding this comment

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

Just a nomenclature nit, otherwise looks good to me!

go/vt/vtgate/vindexes/vschema.go Outdated Show resolved Hide resolved
…e variable name had changed from positive to negative intent ...

Signed-off-by: Rohit Nayak <[email protected]>
@rohit-nayak-ps rohit-nayak-ps marked this pull request as ready for review December 12, 2024 18:10
Copy link
Member

@harshit-gangal harshit-gangal left a comment

Choose a reason for hiding this comment

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

The issue with this approach arises when there are multiple unsharded keyspaces. This makes adding the table to global routing non-deterministic, failing to fully achieve the intended purpose of this PR.

Signed-off-by: Rohit Nayak <[email protected]>
@rohit-nayak-ps
Copy link
Contributor Author

The issue with this approach arises when there are multiple unsharded keyspaces. This makes adding the table to global routing non-deterministic, failing to fully achieve the intended purpose of this PR.

You mean if there are tables of the same name in multiple unsharded keyspaces (and which are not in the VSchemas).

We could collect all tables names which will be added like this (not in VSchema, but found by schema tracking) first and validate that there are no duplicates, marking ones with duplicates as ambiguous, while others get globally routed.

@rohit-nayak-ps
Copy link
Contributor Author

rohit-nayak-ps commented Dec 13, 2024

Discussed with @harshit-gangal . His point is that:

  1. We start with a sharded keyspace Sharded1 and one unsharded keyspace Unsharded1. Unsharded1 has no vschema defined yet.
  2. After this PR, schema tracking finds a table ut1 in Unsharded1 that is not in the current VSchema. It then adds it to the global tables list. User starts depending on select * from ut1.
  3. Later user adds another unsharded keyspace Unsharded2 which also has table named ut1.
  4. Now we will mark ut1 as ambiguous (this logic is not yet part of this PR, but is the enhancement I referred to in Experimental: Add missing tables to globally routed list in schema tracker only if they are not already present in a VSchema #17371 (comment))
  5. Suddenly the user's select * from ut1 query will start erroring out. User won't have visibility as to why this has happened since they have not done anything obvious in Vitess like modifying/adding a VSchema and will have downtime until they drop the other table, which could be difficult to diagnose/fix.

Options here are:

  1. Close this PR and not do anything
  2. Merge this PR (with enhanced logic to detect ambiguous tables outside of current VSchemas), which will solve the problem for X% of customers who currently have downtime because we don't do this

I guess the question is what is X. Is it high enough to merge this. Or even if X is high, do we want to do this from a principled viewpoint.

@rohit-nayak-ps rohit-nayak-ps marked this pull request as draft December 16, 2024 16:23
…ut vschemas to the global routing. Create more comprehensive unit test.

Signed-off-by: Rohit Nayak <[email protected]>
…h no vschema as global. Enhance e2e test to handle both flag states with and without vschema

Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Query Serving Type: Enhancement Logical improvement (somewhere between a bug and feature)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants