diff --git a/go/vt/vttablet/tabletserver/schema/tracker.go b/go/vt/vttablet/tabletserver/schema/tracker.go index dc3362d957d..161e6be0300 100644 --- a/go/vt/vttablet/tabletserver/schema/tracker.go +++ b/go/vt/vttablet/tabletserver/schema/tracker.go @@ -294,18 +294,21 @@ func MustReloadSchemaOnDDL(sql string, dbname string) bool { case sqlparser.DBDDLStatement: return false case sqlparser.DDLStatement: - table := stmt.GetTable() - if table.IsEmpty() { - return false - } - if !table.Qualifier.IsEmpty() && table.Qualifier.String() != dbname { - return false - } - tableName := table.Name.String() - if schema.IsOnlineDDLTableName(tableName) { - return false + tables := []sqlparser.TableName{stmt.GetTable()} + tables = append(tables, stmt.GetToTables()...) + for _, table := range tables { + if table.IsEmpty() { + continue + } + if !table.Qualifier.IsEmpty() && table.Qualifier.String() != dbname { + continue + } + tableName := table.Name.String() + if schema.IsOnlineDDLTableName(tableName) { + continue + } + return true } - return true } return false } diff --git a/go/vt/vttablet/tabletserver/schema/tracker_test.go b/go/vt/vttablet/tabletserver/schema/tracker_test.go index 39d97dc46a6..2b30ee47e55 100644 --- a/go/vt/vttablet/tabletserver/schema/tracker_test.go +++ b/go/vt/vttablet/tabletserver/schema/tracker_test.go @@ -160,6 +160,7 @@ func TestMustReloadSchemaOnDDL(t *testing.T) { {"create table x(i int);", db1, true}, {"bad", db2, false}, {"create table db2.x(i int);", db2, true}, + {"rename table db2.x to db2.y;", db2, true}, {"create table db1.x(i int);", db2, false}, {"create table _vt.x(i int);", db1, false}, {"DROP VIEW IF EXISTS `pseudo_gtid`.`_pseudo_gtid_hint__asc:55B364E3:0000000000056EE2:6DD57B85`", db2, false},