-
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
Add missing tables to globally routed list in schema tracker only if they are not already present in a VSchema #17371
base: main
Are you sure you want to change the base?
Conversation
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
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17371 +/- ##
=======================================
Coverage 67.67% 67.67%
=======================================
Files 1583 1584 +1
Lines 254363 254391 +28
=======================================
+ Hits 172140 172163 +23
- Misses 82223 82228 +5 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this 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!
There was a problem hiding this 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.
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. |
Discussed with @harshit-gangal . His point is that:
Options here are:
I guess the question is what is |
…they are not already present in a VSchema Signed-off-by: Rohit Nayak <[email protected]>
…e variable name had changed from positive to negative intent ... Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
…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]>
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]>
f5d5a62
to
a3032db
Compare
After discussions we decided to go ahead with the implementation as detailed in the RFC |
… debugging Signed-off-by: Rohit Nayak <[email protected]>
I have added a vtgate flag, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest LGTM!
@@ -200,6 +202,7 @@ func registerFlags(fs *pflag.FlagSet) { | |||
fs.IntVar(&warmingReadsConcurrency, "warming-reads-concurrency", 500, "Number of concurrent warming reads allowed") | |||
fs.DurationVar(&warmingReadsQueryTimeout, "warming-reads-query-timeout", 5*time.Second, "Timeout of warming read queries") | |||
|
|||
fs.BoolVar(&MarkUniqueUnshardedTablesAsGlobal, "mark_unique_unsharded_tables_as_global", MarkUniqueUnshardedTablesAsGlobal, "Mark unique unsharded tables as global tables") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, I don't think we need the flag
@@ -473,6 +473,46 @@ func buildGlobalTables(source *vschemapb.SrvVSchema, vschema *VSchema) { | |||
} | |||
} | |||
|
|||
// AddAdditionalGlobalTables adds unique tables from unsharded keyspaces to the global tables. | |||
// It is expected to be called from the schema tracking code. | |||
func AddAdditionalGlobalTables(source *vschemapb.SrvVSchema, vschema *VSchema) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code logic looks 💯 correct!
Tables: map[string]*vschemapb.Table{ | ||
"table6": {}, // unique | ||
"scommon2": {}, // common with sharded2, but has RequireExplicitRouting | ||
"scommon3": {}, // common with sharded2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect comment. scommon3
is not common with anything. It is unique.
Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Description
Follows up on the idea in #16517 by not considering tables already present in the globally routable list of tables.
See RFC for design and implementation details.
Related Issue(s)
#16516
Checklist
Deployment Notes