-
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
vttablet sidecar schema:use schemadiff to reach desired schema on tablet init replacing the withDDL-based approach #11520
vttablet sidecar schema:use schemadiff to reach desired schema on tablet init replacing the withDDL-based approach #11520
Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
If a new flag is being introduced:
If a workflow is added or modified:
Bug fixes
Non-trivial changes
New/Existing features
Backward compatibility
|
0bd5572
to
2bbae28
Compare
7cd38bd
to
27a206f
Compare
d33a2f9
to
a761961
Compare
ba61177
to
cd581e0
Compare
348d0b1
to
dd7865d
Compare
1d2fef9
to
ca49239
Compare
@@ -53,44 +52,6 @@ var ( | |||
` | |||
) | |||
|
|||
func TestBlockedLoadKeyspace(t *testing.T) { |
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.
This test is no longer valid after the change in how we initialize _vt
.
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 a nice bonus, we no longer have to worry about this test being flaky (which it has been in the past).
Signed-off-by: Shlomi Noach <[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]>
…e to get rid of the comments and make related changes to tests 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]>
|
||
CREATE TABLE IF NOT EXISTS _vt.vdiff | ||
( | ||
`id` bigint(20) NOT NULL AUTO_INCREMENT, |
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.
@rohit-nayak-ps For a separate follow up PR, but I think we should drop lengths for bigint
and other int
types, since that is deprecated and on MySQL 8.0 doesn't do anything.
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.
👍 and also worth mentioning that schemadiff
ignores the length values (unless it's 1
), so whether they exist or not, does not make any change to prod.
Description
This PR changes the way we maintain the
_vt
schema. Instead of usingwithddl
introduced in #6348 we use a declarative approach. This is made possible byschemadiff
which is used in Online DDL's declarative strategy.The desired schema is specified, one per table. A new module
sidecardb
, compares this to the existing schema and performs the required create or alter to reach it. This is done on the primary, on every vttablet startup.An intended side-effect of this PR is to be able to minimize the time window, on a replica, where the database is NOT in super-read-only mode.
The sidecar tables
local_metadata
andshard_metadata
are no longer in use and all references to them are removed in this PR. There were used previously forOrchestrator
support, which has been superseded byvtorc
Notes
Replicas cannot be started with super-read-only on
We cannot start a replica with super-read-only on since we have a bootstrap problem: vttablet needs to connect to its mysql instance to manage it. For that it needs to user credentials. To create user credentials we first need to create the users. This is done by executing the queries in
init_db.sql
, when the database is first created.Also until a primary is selected we don't know if the current vttablet is going to be a replica or not. If it becomes a primary then it will insert a row into
reparent_journal
for the other replicas to move forward as replicas.Implementation Notes
Working Notes related to implementation, todos and misc notes, in no particular order, to be appropriately folded into the main description before completion.
go/vt/vttablet/tabletserver/schema/engine.go
The schema creation/updation is done in
EnsureConnectionAndDB()
, both for replicas and primaryconfig/init_db.sql
Incidental flaky test fixes
Implementation Todos
DemotePrimary()
_vt
, during first tablet loadMinor:
Related Issue(s)
#10133
Previous related PRs
These were created previously and closed since those didn't work well.
#11235
Checklist
Follow-up todos after the initial merge
Docs
_vt
schema updats (update/extend theLife of a cluster
doc)