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

schemadiff: Online DDL support, declarative based #16462

Merged
merged 10 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const (
testFilterEnvVar = "ONLINEDDL_SUITE_TEST_FILTER"
)

// Use $VREPL_SUITE_TEST_FILTER environment variable to filter tests by name.
func TestMain(m *testing.M) {
defer cluster.PanicHandler(nil)
flag.Parse()
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Found no possible
found no possible
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Found no possible
found no possible
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
drop table if exists onlineddl_test;
create table onlineddl_test (
f float,
f float not null,
i int not null,
ts timestamp default current_timestamp,
dt datetime,
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Found no possible
found no possible
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Found no possible
found no possible
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add column v varchar(32)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
drop table if exists onlineddl_test;
create table onlineddl_test (
id int,
i int not null,
ts timestamp default current_timestamp,
dt datetime,
key i_idx(i),
unique key id_uidx(id)
) auto_increment=1;

drop event if exists onlineddl_test;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
found no possible
16 changes: 2 additions & 14 deletions go/vt/schemadiff/capability.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,6 @@ func alterOptionCapableOfInstantDDL(alterOption sqlparser.AlterOption, createTab
}
}

isGeneratedColumn := func(col *sqlparser.ColumnDefinition) (bool, sqlparser.ColumnStorage) {
if col == nil {
return false, 0
}
if col.Type.Options == nil {
return false, 0
}
if col.Type.Options.As == nil {
return false, 0
}
return true, col.Type.Options.Storage
}
colStringStrippedDown := func(col *sqlparser.ColumnDefinition, stripEnum bool) string {
strippedCol := sqlparser.Clone(col)
// strip `default`
Expand Down Expand Up @@ -153,7 +141,7 @@ func alterOptionCapableOfInstantDDL(alterOption sqlparser.AlterOption, createTab
return false, nil
}
for _, column := range opt.Columns {
if isGenerated, storage := isGeneratedColumn(column); isGenerated {
if isGenerated, storage := IsGeneratedColumn(column); isGenerated {
if storage == sqlparser.StoredStorage {
// Adding a generated "STORED" column is unsupported
return false, nil
Expand Down Expand Up @@ -188,7 +176,7 @@ func alterOptionCapableOfInstantDDL(alterOption sqlparser.AlterOption, createTab
// not supported if the column is part of an index
return false, nil
}
if isGenerated, _ := isGeneratedColumn(col); isGenerated {
if isGenerated, _ := IsGeneratedColumn(col); isGenerated {
// supported by all 8.0 versions
// Note: according to the docs dropping a STORED generated column is not INSTANT-able,
// but in practice this is supported. This is why we don't test for STORED here, like
Expand Down
Loading
Loading