Skip to content

Commit

Permalink
schemadiff INSTANT DDL: impossible on tables with FULLTEXT oindex
Browse files Browse the repository at this point in the history
Signed-off-by: Shlomi Noach <[email protected]>
  • Loading branch information
shlomi-noach committed Apr 16, 2024
1 parent 4519c8f commit 6390291
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions go/vt/schemadiff/capability.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ import (
// alterOptionAvailableViaInstantDDL checks if the specific alter option is eligible to run via ALGORITHM=INSTANT
// reference: https://dev.mysql.com/doc/refman/8.0/en/innodb-online-ddl-operations.html
func alterOptionCapableOfInstantDDL(alterOption sqlparser.AlterOption, createTable *sqlparser.CreateTable, capableOf capabilities.CapableOf) (bool, error) {
// A table with FULLTEXT index can't have any sort of INSTANT DDL
for _, key := range createTable.TableSpec.Indexes {
if key.Info.Type == sqlparser.IndexTypeFullText {
return false, nil
}
}
findColumn := func(colName string) *sqlparser.ColumnDefinition {
if createTable == nil {
return nil
Expand Down
6 changes: 6 additions & 0 deletions go/vt/schemadiff/capability_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ func TestAlterTableCapableOfInstantDDL(t *testing.T) {
alter: "alter table t drop column i1",
expectCapableOfInstantDDL: false,
},
{
name: "drop column fail due to fulltext index in table",
create: "create table t(id int, i1 int not null, name varchar(128), primary key(id), fulltext key (name))",
alter: "alter table t drop column i1",
expectCapableOfInstantDDL: false,
},
{
name: "add two columns",
create: "create table t(id int, i1 int not null, primary key(id))",
Expand Down

0 comments on commit 6390291

Please sign in to comment.