-
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
declarative Online DDL #7725
declarative Online DDL #7725
Conversation
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
…gy specified Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
…into online-ddl-idempotent-tests Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
…t for the new table. Some minor refactor of reading MySQL variables Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Reviewers: the main changes to review are in
when we handle a new migration request, we now first check to see if it's
Diffing the table via
|
…clarative mode Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
@shlomi-noach Awesome! I'm not going to review the implementation unless you'd like me to. From a perspective of a user of the functionality, it looks perfect. |
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
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.
lgtm. This is really nice!
go/vt/vttablet/onlineddl/executor.go
Outdated
// - is it CREATE / DROP / ALTER? | ||
// - it is a Revert request? | ||
// - what's the migration strategy? | ||
// The function invokes th eappropriate handlers for each of those cases. |
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.
th eappropriate handlers => the appropriate handlers
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.
fixed
go/vt/vttablet/onlineddl/executor.go
Outdated
if exists { | ||
// table does exist, so this declarative DROP turns out to really be an actual DROP. No further action is needed here | ||
} else { | ||
// table does not exist. We mark this CREATE as implicitly sucessful |
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.
should be DROP here and not CREATE?
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.
fixed!
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Description
This PR introduces (partial) declarative schema changes in Online DDL. In a declarative schema change you tell vitess "this is a table's schema, make it so". If the table does not exist, vitess creates it. If the table exists and with a different schema, vitess evaluates the required
ALTER
statement and migrates the table.Declarative changes have the property of being idempotent. You may issue the same migration multiple times with no harm done. If vitess find that no change is required, it implicitly markes the migration as successful.
This PR implements partial declarative changes. In a full declarative schema change, one gives their database a list of all tables in a schema. In a partial declarative schema change, we give vitess a single table at a time.
This means:
CREATE TABLE
CREATE TABLE
DROP TABLE
.Vitess supports the
-declarative
flag indddl_strategy
to enable this functionality.Usage
consider:
you may use
-declarative
in all online DDL strategies:online
,gh-ost
,pt-osc
.Documentation to follow.
Related Issue(s)
Tracking: #6926
Checklist
Deployment Notes
Impacted Areas in Vitess
Components that this PR will affect: