Skip to content

Commit

Permalink
OnlineDDL: skip GetSchema where possible (vitessio#10107)
Browse files Browse the repository at this point in the history
Signed-off-by: Shlomi Noach <[email protected]>
  • Loading branch information
shlomi-noach authored Apr 20, 2022
1 parent 619de68 commit 54e61a5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions go/vt/schemamanager/tablet_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,17 @@ func (exec *TabletExecutor) isOnlineSchemaDDL(stmt sqlparser.Statement) (isOnlin
// 1. Alter more than 100,000 rows.
// 2. Change a table with more than 2,000,000 rows (Drops are fine).
func (exec *TabletExecutor) detectBigSchemaChanges(ctx context.Context, parsedDDLs []sqlparser.DDLStatement) (bool, error) {
// We want to avoid any overhead if possible. If all DDLs are online schema changes, then we want to
// skip GetSchema altogether.
foundAnyNonOnlineDDL := false
for _, ddl := range parsedDDLs {
if !exec.isOnlineSchemaDDL(ddl) {
foundAnyNonOnlineDDL = true
}
}
if !foundAnyNonOnlineDDL {
return false, nil
}
// exec.tablets is guaranteed to have at least one element;
// Otherwise, Open should fail and executor should fail.
primaryTabletInfo := exec.tablets[0]
Expand Down

0 comments on commit 54e61a5

Please sign in to comment.