From d839167e49e4c85454079a2c478bec788a0b351f Mon Sep 17 00:00:00 2001 From: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> Date: Sun, 29 Nov 2020 13:40:29 +0200 Subject: [PATCH 1/7] Support CREATE, DROP statements in ApplySchema and online DDL Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> --- go/vt/schemamanager/tablet_executor.go | 10 +- go/vt/vtctld/api.go | 4 + go/vt/vttablet/onlineddl/executor.go | 127 ++++++++++++++++++------- 3 files changed, 100 insertions(+), 41 deletions(-) diff --git a/go/vt/schemamanager/tablet_executor.go b/go/vt/schemamanager/tablet_executor.go index 659c0c693af..2351ad84de2 100644 --- a/go/vt/schemamanager/tablet_executor.go +++ b/go/vt/schemamanager/tablet_executor.go @@ -155,9 +155,6 @@ func (exec *TabletExecutor) isOnlineSchemaDDL(ddl *sqlparser.DDL) (isOnline bool if ddl == nil { return false, strategy, options } - if ddl.Action != sqlparser.AlterDDLAction { - return false, strategy, options - } strategy, options, _ = schema.ParseDDLStrategy(exec.ddlStrategy) if strategy != schema.DDLStrategyNormal { return true, strategy, options @@ -258,7 +255,12 @@ func (exec *TabletExecutor) Execute(ctx context.Context, sqls []string) *Execute tableName := "" switch ddl := stat.(type) { case *sqlparser.DDL: - tableName = ddl.Table.Name.String() + switch ddl.Action { + case sqlparser.DropDDLAction: + tableName = ddl.FromTables[0].Name.String() + default: + tableName = ddl.Table.Name.String() + } isOnlineDDL, strategy, options = exec.isOnlineSchemaDDL(ddl) } exec.wr.Logger().Infof("Received DDL request. strategy=%+v", strategy) diff --git a/go/vt/vtctld/api.go b/go/vt/vtctld/api.go index 1b25263096f..24606ffc5bc 100644 --- a/go/vt/vtctld/api.go +++ b/go/vt/vtctld/api.go @@ -614,6 +614,7 @@ func initAPI(ctx context.Context, ts *topo.Server, actions *ActionRepository, re req := struct { Keyspace, SQL string ReplicaTimeoutSeconds int + DDLStrategy string `json:"ddl_strategy,omitempty"` }{} if err := unmarshalRequest(r, &req); err != nil { return fmt.Errorf("can't unmarshal request: %v", err) @@ -630,6 +631,9 @@ func initAPI(ctx context.Context, ts *topo.Server, actions *ActionRepository, re executor := schemamanager.NewTabletExecutor( wr, time.Duration(req.ReplicaTimeoutSeconds)*time.Second, ) + if err := executor.SetDDLStrategy(req.DDLStrategy); err != nil { + return fmt.Errorf("error setting DDL strategy: %v", err) + } return schemamanager.Run(ctx, schemamanager.NewUIController(req.SQL, req.Keyspace, w), executor) diff --git a/go/vt/vttablet/onlineddl/executor.go b/go/vt/vttablet/onlineddl/executor.go index 859797b7380..4f4e534563a 100644 --- a/go/vt/vttablet/onlineddl/executor.go +++ b/go/vt/vttablet/onlineddl/executor.go @@ -349,6 +349,25 @@ func (e *Executor) tableExists(ctx context.Context, tableName string) (bool, err return (row != nil), nil } +// executeDirectly runs a DDL query directly on the backend MySQL server +func (e *Executor) executeDirectly(ctx context.Context, onlineDDL *schema.OnlineDDL) error { + e.migrationMutex.Lock() + defer e.migrationMutex.Unlock() + + conn, err := dbconnpool.NewDBConnection(ctx, e.env.Config().DB.DbaWithDB()) + if err != nil { + return err + } + defer conn.Close() + + if _, err := conn.ExecuteFetch(onlineDDL.SQL, 0, false); err != nil { + return err + } + _ = e.onSchemaMigrationStatus(ctx, onlineDDL.UUID, schema.OnlineDDLStatusComplete, false, 100.0) + + return nil +} + // ExecuteWithGhost validates and runs a gh-ost process. // Validation included testing the backend MySQL server and the gh-ost binary itself // Execution runs first a dry run, then an actual migration @@ -930,6 +949,53 @@ func (e *Executor) scheduleNextMigration(ctx context.Context) error { return err } +func (e *Executor) executeMigration(ctx context.Context, onlineDDL *schema.OnlineDDL) error { + failMigration := func(err error) error { + _ = e.updateMigrationStatus(ctx, onlineDDL.UUID, schema.OnlineDDLStatusFailed) + return err + } + + stmt, err := sqlparser.Parse(onlineDDL.SQL) + if err != nil { + return failMigration(fmt.Errorf("Error parsing statement: SQL=%s, error=%+v", onlineDDL.SQL, err)) + } + switch stmt := stmt.(type) { + case sqlparser.DDLStatement: + switch stmt.GetAction() { + case sqlparser.CreateDDLAction, sqlparser.DropDDLAction: + go func() { + if err := e.executeDirectly(ctx, onlineDDL); err != nil { + failMigration(err) + } + }() + case sqlparser.AlterDDLAction: + switch onlineDDL.Strategy { + case schema.DDLStrategyGhost: + go func() { + if err := e.ExecuteWithGhost(ctx, onlineDDL); err != nil { + failMigration(err) + } + }() + case schema.DDLStrategyPTOSC: + go func() { + if err := e.ExecuteWithPTOSC(ctx, onlineDDL); err != nil { + failMigration(err) + } + }() + default: + { + return failMigration(fmt.Errorf("Unsupported strategy: %+v", onlineDDL.Strategy)) + } + } + } + default: + { + return failMigration(fmt.Errorf("Unsupported query type: %+v", onlineDDL.SQL)) + } + } + return nil +} + func (e *Executor) runNextMigration(ctx context.Context) error { e.migrationMutex.Lock() defer e.migrationMutex.Unlock() @@ -955,25 +1021,7 @@ func (e *Executor) runNextMigration(ctx context.Context) error { Options: row["options"].ToString(), Status: schema.OnlineDDLStatus(row["migration_status"].ToString()), } - switch onlineDDL.Strategy { - case schema.DDLStrategyGhost: - go func() { - if err := e.ExecuteWithGhost(ctx, onlineDDL); err != nil { - _ = e.updateMigrationStatus(ctx, onlineDDL.UUID, schema.OnlineDDLStatusFailed) - } - }() - case schema.DDLStrategyPTOSC: - go func() { - if err := e.ExecuteWithPTOSC(ctx, onlineDDL); err != nil { - _ = e.updateMigrationStatus(ctx, onlineDDL.UUID, schema.OnlineDDLStatusFailed) - } - }() - default: - { - _ = e.updateMigrationStatus(ctx, onlineDDL.UUID, schema.OnlineDDLStatusFailed) - return fmt.Errorf("Unsupported strategy: %+v", onlineDDL.Strategy) - } - } + e.executeMigration(ctx, onlineDDL) // the query should only ever return a single row at the most // but let's make it also explicit here that we only run a single migration if i == 0 { @@ -1362,15 +1410,8 @@ func (e *Executor) retryMigration(ctx context.Context, whereExpr string) (result return result, err } -// OnSchemaMigrationStatus is called by TabletServer's API, which is invoked by a running gh-ost migration's hooks. -func (e *Executor) OnSchemaMigrationStatus(ctx context.Context, uuidParam, statusParam, dryrunParam, progressParam string) (err error) { - status := schema.OnlineDDLStatus(statusParam) - dryRun := (dryrunParam == "true") - var progressPct float64 - if pct, err := strconv.ParseFloat(progressParam, 32); err == nil { - progressPct = pct - } - +// onSchemaMigrationStatus is called when a status is set/changed for a running migration +func (e *Executor) onSchemaMigrationStatus(ctx context.Context, uuid string, status schema.OnlineDDLStatus, dryRun bool, progressPct float64) (err error) { if dryRun && status != schema.OnlineDDLStatusFailed { // We don't consider dry-run reports unless there's a failure return nil @@ -1378,37 +1419,49 @@ func (e *Executor) OnSchemaMigrationStatus(ctx context.Context, uuidParam, statu switch status { case schema.OnlineDDLStatusReady: { - err = e.updateMigrationTimestamp(ctx, "ready_timestamp", uuidParam) + err = e.updateMigrationTimestamp(ctx, "ready_timestamp", uuid) } case schema.OnlineDDLStatusRunning: { - _ = e.updateMigrationStartedTimestamp(ctx, uuidParam) - err = e.updateMigrationTimestamp(ctx, "liveness_timestamp", uuidParam) + _ = e.updateMigrationStartedTimestamp(ctx, uuid) + err = e.updateMigrationTimestamp(ctx, "liveness_timestamp", uuid) } case schema.OnlineDDLStatusComplete: { - _ = e.updateMigrationStartedTimestamp(ctx, uuidParam) - err = e.updateMigrationTimestamp(ctx, "completed_timestamp", uuidParam) + _ = e.updateMigrationStartedTimestamp(ctx, uuid) + err = e.updateMigrationTimestamp(ctx, "completed_timestamp", uuid) } case schema.OnlineDDLStatusFailed: { - _ = e.updateMigrationStartedTimestamp(ctx, uuidParam) - err = e.updateMigrationTimestamp(ctx, "completed_timestamp", uuidParam) + _ = e.updateMigrationStartedTimestamp(ctx, uuid) + err = e.updateMigrationTimestamp(ctx, "completed_timestamp", uuid) } } if err != nil { return err } - if err = e.updateMigrationStatus(ctx, uuidParam, status); err != nil { + if err = e.updateMigrationStatus(ctx, uuid, status); err != nil { return err } - if err = e.updateMigrationProgress(ctx, uuidParam, progressPct); err != nil { + if err = e.updateMigrationProgress(ctx, uuid, progressPct); err != nil { return err } return nil } +// OnSchemaMigrationStatus is called by TabletServer's API, which is invoked by a running gh-ost migration's hooks. +func (e *Executor) OnSchemaMigrationStatus(ctx context.Context, uuidParam, statusParam, dryrunParam, progressParam string) (err error) { + status := schema.OnlineDDLStatus(statusParam) + dryRun := (dryrunParam == "true") + var progressPct float64 + if pct, err := strconv.ParseFloat(progressParam, 32); err == nil { + progressPct = pct + } + + return e.onSchemaMigrationStatus(ctx, uuidParam, status, dryRun, progressPct) +} + // VExec is called by a VExec invocation func (e *Executor) VExec(ctx context.Context, vx *vexec.TabletVExec) (qr *querypb.QueryResult, err error) { response := func(result *sqltypes.Result, err error) (*querypb.QueryResult, error) { From 90452dfdc056484df5ff85da27c051c15ec4b1b6 Mon Sep 17 00:00:00 2001 From: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> Date: Sun, 29 Nov 2020 14:25:35 +0200 Subject: [PATCH 2/7] fixed unit test Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> --- go/vt/schemamanager/tablet_executor_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/go/vt/schemamanager/tablet_executor_test.go b/go/vt/schemamanager/tablet_executor_test.go index 265077d5db9..b231773c16f 100644 --- a/go/vt/schemamanager/tablet_executor_test.go +++ b/go/vt/schemamanager/tablet_executor_test.go @@ -236,7 +236,8 @@ func TestIsOnlineSchemaDDL(t *testing.T) { { query: "CREATE TABLE t(id int)", ddlStrategy: "gh-ost", - isOnlineDDL: false, + isOnlineDDL: true, + strategy: schema.DDLStrategyGhost, }, { query: "ALTER TABLE t ADD COLUMN i INT", From 496f28c5fc4db3f98fa8bb016a877bf988c1e0f1 Mon Sep 17 00:00:00 2001 From: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> Date: Sun, 29 Nov 2020 14:25:58 +0200 Subject: [PATCH 3/7] added CREATE/DROP online DDL endtoend tests Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> --- go/test/endtoend/onlineddl/onlineddl_test.go | 60 +++++++++++++------- 1 file changed, 41 insertions(+), 19 deletions(-) diff --git a/go/test/endtoend/onlineddl/onlineddl_test.go b/go/test/endtoend/onlineddl/onlineddl_test.go index bc80ee466b3..a961a19209f 100644 --- a/go/test/endtoend/onlineddl/onlineddl_test.go +++ b/go/test/endtoend/onlineddl/onlineddl_test.go @@ -48,33 +48,41 @@ var ( ddlStrategyUnchanged = "-" createTable = ` CREATE TABLE %s ( - id BIGINT(20) not NULL, - msg varchar(64), - PRIMARY KEY (id) + id bigint(20) NOT NULL, + msg varchar(64), + PRIMARY KEY (id) ) ENGINE=InnoDB;` // To verify non online-DDL behavior alterTableNormalStatement = ` ALTER TABLE %s - ADD COLUMN non_online INT UNSIGNED NOT NULL` + ADD COLUMN non_online int UNSIGNED NOT NULL` // A trivial statement which must succeed and does not change the schema alterTableTrivialStatement = ` ALTER TABLE %s - ENGINE=InnoDB` + ENGINE=InnoDB` // The following statement is valid alterTableSuccessfulStatement = ` ALTER TABLE %s - MODIFY id BIGINT UNSIGNED NOT NULL, - ADD COLUMN ghost_col INT NOT NULL, - ADD INDEX idx_msg(msg)` + MODIFY id bigint UNSIGNED NOT NULL, + ADD COLUMN ghost_col int NOT NULL, + ADD INDEX idx_msg(msg)` // The following statement will fail because gh-ost requires some shared unique key alterTableFailedStatement = ` ALTER TABLE %s - DROP PRIMARY KEY, - DROP COLUMN ghost_col` + DROP PRIMARY KEY, + DROP COLUMN ghost_col` // We will run this query with "gh-ost --max-load=Threads_running=1" alterTableThrottlingStatement = ` ALTER TABLE %s - DROP COLUMN ghost_col` + DROP COLUMN ghost_col` + onlineDDLCreateTableStatement = ` + CREATE TABLE %s ( + id bigint NOT NULL, + online_ddl_create_col INT NOT NULL, + PRIMARY KEY (id) + ) ENGINE=InnoDB;` + onlineDDLDropTableStatement = ` + DROP TABLE %s` ) func fullWordUUIDRegexp(uuid, searchWord string) *regexp.Regexp { @@ -156,33 +164,45 @@ func TestSchemaChange(t *testing.T) { assert.Equal(t, 2, len(clusterInstance.Keyspaces[0].Shards)) testWithInitialSchema(t) { - _ = testAlterTable(t, alterTableNormalStatement, string(schema.DDLStrategyNormal), "vtctl", "non_online") + _ = testOnlineDDLStatement(t, alterTableNormalStatement, string(schema.DDLStrategyNormal), "vtctl", "non_online") } { - uuid := testAlterTable(t, alterTableSuccessfulStatement, ddlStrategyUnchanged, "vtgate", "ghost_col") + uuid := testOnlineDDLStatement(t, alterTableSuccessfulStatement, ddlStrategyUnchanged, "vtgate", "ghost_col") checkRecentMigrations(t, uuid, schema.OnlineDDLStatusComplete) checkCancelMigration(t, uuid, false) checkRetryMigration(t, uuid, false) } { - uuid := testAlterTable(t, alterTableTrivialStatement, "gh-ost", "vtctl", "ghost_col") + uuid := testOnlineDDLStatement(t, alterTableTrivialStatement, "gh-ost", "vtctl", "ghost_col") checkRecentMigrations(t, uuid, schema.OnlineDDLStatusComplete) checkCancelMigration(t, uuid, false) checkRetryMigration(t, uuid, false) } { - uuid := testAlterTable(t, alterTableThrottlingStatement, "gh-ost --max-load=Threads_running=1", "vtgate", "ghost_col") + uuid := testOnlineDDLStatement(t, alterTableThrottlingStatement, "gh-ost --max-load=Threads_running=1", "vtgate", "ghost_col") checkRecentMigrations(t, uuid, schema.OnlineDDLStatusRunning) checkCancelMigration(t, uuid, true) time.Sleep(2 * time.Second) checkRecentMigrations(t, uuid, schema.OnlineDDLStatusFailed) } { - uuid := testAlterTable(t, alterTableFailedStatement, "gh-ost", "vtgate", "ghost_col") + uuid := testOnlineDDLStatement(t, alterTableFailedStatement, "gh-ost", "vtgate", "ghost_col") checkRecentMigrations(t, uuid, schema.OnlineDDLStatusFailed) checkCancelMigration(t, uuid, false) checkRetryMigration(t, uuid, true) } + { + uuid := testOnlineDDLStatement(t, onlineDDLDropTableStatement, "gh-ost", "vtctl", "") + checkRecentMigrations(t, uuid, schema.OnlineDDLStatusComplete) + checkCancelMigration(t, uuid, false) + checkRetryMigration(t, uuid, false) + } + { + uuid := testOnlineDDLStatement(t, onlineDDLCreateTableStatement, "gh-ost", "vtctl", "online_ddl_create_col") + checkRecentMigrations(t, uuid, schema.OnlineDDLStatusComplete) + checkCancelMigration(t, uuid, false) + checkRetryMigration(t, uuid, false) + } } func testWithInitialSchema(t *testing.T) { @@ -198,8 +218,8 @@ func testWithInitialSchema(t *testing.T) { checkTables(t, totalTableCount) } -// testAlterTable runs an online DDL, ALTER statement -func testAlterTable(t *testing.T, alterStatement string, ddlStrategy string, executeStrategy string, expectColumn string) (uuid string) { +// testOnlineDDLStatement runs an online DDL, ALTER statement +func testOnlineDDLStatement(t *testing.T, alterStatement string, ddlStrategy string, executeStrategy string, expectColumn string) (uuid string) { tableName := fmt.Sprintf("vt_onlineddl_test_%02d", 3) sqlQuery := fmt.Sprintf(alterStatement, tableName) if executeStrategy == "vtgate" { @@ -224,7 +244,9 @@ func testAlterTable(t *testing.T, alterStatement string, ddlStrategy string, exe time.Sleep(time.Second * 20) } - checkMigratedTable(t, tableName, expectColumn) + if expectColumn != "" { + checkMigratedTable(t, tableName, expectColumn) + } return uuid } From 2f06eb6fbaadac3075ca0501dc7b42b2314b56d9 Mon Sep 17 00:00:00 2001 From: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> Date: Sun, 29 Nov 2020 21:19:34 +0200 Subject: [PATCH 4/7] trigger early next invocation of onMigrationCheckTick upon: - migration completion - migration failure - new INSERT to schema_migrations throttle invocation of onMigrationCheckTick() to at most 1/sec Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> --- go/vt/vttablet/onlineddl/executor.go | 46 +++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/go/vt/vttablet/onlineddl/executor.go b/go/vt/vttablet/onlineddl/executor.go index 4f4e534563a..fa671e96021 100644 --- a/go/vt/vttablet/onlineddl/executor.go +++ b/go/vt/vttablet/onlineddl/executor.go @@ -93,10 +93,12 @@ var emptyResult = &sqltypes.Result{ var ghostOverridePath = flag.String("gh-ost-path", "", "override default gh-ost binary full path") var ptOSCOverridePath = flag.String("pt-osc-path", "", "override default pt-online-schema-change binary full path") var migrationCheckInterval = flag.Duration("migration_check_interval", 1*time.Minute, "Interval between migration checks") +var migrationNextCheckInterval = 5 * time.Second const ( - maxPasswordLength = 32 // MySQL's *replication* password may not exceed 32 characters - staleMigrationMinutes = 10 + maxPasswordLength = 32 // MySQL's *replication* password may not exceed 32 characters + staleMigrationMinutes = 10 + progressPctFull float64 = 100.0 ) var ( @@ -117,10 +119,11 @@ type Executor struct { shard string dbName string - initMutex sync.Mutex - migrationMutex sync.Mutex - migrationRunning int64 - lastMigrationUUID string + initMutex sync.Mutex + migrationMutex sync.Mutex + migrationRunning int64 + lastMigrationUUID string + tickReentranceFlag int64 ticks *timer.Timer isOpen bool @@ -245,6 +248,11 @@ func (e *Executor) Close() { e.isOpen = false } +// triggerNextCheckInterval the next tick sooner than normal +func (e *Executor) triggerNextCheckInterval() { + e.ticks.TriggerAfter(migrationNextCheckInterval) +} + func (e *Executor) ghostPanicFlagFileName(uuid string) string { return path.Join(os.TempDir(), fmt.Sprintf("ghost.%s.panic.flag", uuid)) } @@ -363,7 +371,7 @@ func (e *Executor) executeDirectly(ctx context.Context, onlineDDL *schema.Online if _, err := conn.ExecuteFetch(onlineDDL.SQL, 0, false); err != nil { return err } - _ = e.onSchemaMigrationStatus(ctx, onlineDDL.UUID, schema.OnlineDDLStatusComplete, false, 100.0) + _ = e.onSchemaMigrationStatus(ctx, onlineDDL.UUID, schema.OnlineDDLStatusComplete, false, progressPctFull) return nil } @@ -1242,6 +1250,20 @@ func (e *Executor) gcArtifacts(ctx context.Context) error { // onMigrationCheckTick runs all migrations life cycle func (e *Executor) onMigrationCheckTick() { + // This function can be called by multiple triggers. First, there's the normal ticker. + // Then, any time a migration completes, we set a timer to trigger this function. + // also, any time a new INSERT arrives, we set a timer to trigger this function. + // Some of these may be correlated. To avoid spamming of this function we: + // - ensure the function is non-reentrant, using tickReentranceFlag + // - clean up tickReentranceFlag 1 second after function completes; this throttles calls to + // this function at no more than 1/sec rate. + if atomic.CompareAndSwapInt64(&e.tickReentranceFlag, 0, 1) { + defer time.AfterFunc(time.Second, func() { atomic.StoreInt64(&e.tickReentranceFlag, 0) }) + } else { + // An instance of this function is already running + return + } + if e.tabletTypeFunc() != topodatapb.TabletType_MASTER { return } @@ -1249,6 +1271,7 @@ func (e *Executor) onMigrationCheckTick() { log.Errorf("Executor.onMigrationCheckTick(): empty keyspace") return } + ctx := context.Background() if err := e.initSchema(ctx); err != nil { log.Error(err) @@ -1428,6 +1451,7 @@ func (e *Executor) onSchemaMigrationStatus(ctx context.Context, uuid string, sta } case schema.OnlineDDLStatusComplete: { + progressPct = progressPctFull _ = e.updateMigrationStartedTimestamp(ctx, uuid) err = e.updateMigrationTimestamp(ctx, "completed_timestamp", uuid) } @@ -1447,6 +1471,13 @@ func (e *Executor) onSchemaMigrationStatus(ctx context.Context, uuid string, sta return err } + if !dryRun { + switch status { + case schema.OnlineDDLStatusComplete, schema.OnlineDDLStatusFailed: + e.triggerNextCheckInterval() + } + } + return nil } @@ -1489,6 +1520,7 @@ func (e *Executor) VExec(ctx context.Context, vx *vexec.TabletVExec) (qr *queryp vx.ReplaceInsertColumnVal("shard", vx.ToStringVal(e.shard)) vx.ReplaceInsertColumnVal("mysql_schema", vx.ToStringVal(e.dbName)) vx.AddOrReplaceInsertColumnVal("tablet", vx.ToStringVal(e.TabletAliasString())) + e.triggerNextCheckInterval() return response(e.execQuery(ctx, vx.Query)) case *sqlparser.Update: match, err := sqlparser.QueryMatchesTemplates(vx.Query, vexecUpdateTemplates) From a1ac2cf66dcfd52c45bc603f8e814c9038716a66 Mon Sep 17 00:00:00 2001 From: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> Date: Sun, 29 Nov 2020 21:26:47 +0200 Subject: [PATCH 5/7] triggering initial tick early on Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> --- go/vt/vttablet/onlineddl/executor.go | 1 + 1 file changed, 1 insertion(+) diff --git a/go/vt/vttablet/onlineddl/executor.go b/go/vt/vttablet/onlineddl/executor.go index fa671e96021..4af2772f51b 100644 --- a/go/vt/vttablet/onlineddl/executor.go +++ b/go/vt/vttablet/onlineddl/executor.go @@ -224,6 +224,7 @@ func (e *Executor) Open() error { } e.pool.Open(e.env.Config().DB.AppWithDB(), e.env.Config().DB.DbaWithDB(), e.env.Config().DB.AppDebugWithDB()) e.ticks.Start(e.onMigrationCheckTick) + e.triggerNextCheckInterval() if _, err := sqlparser.QueryMatchesTemplates("select 1 from dual", vexecUpdateTemplates); err != nil { // this validates vexecUpdateTemplates From e167fa9444c5eb6146b758e32ad7a9dca25e445b Mon Sep 17 00:00:00 2001 From: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> Date: Sun, 29 Nov 2020 21:28:31 +0200 Subject: [PATCH 6/7] TODO comment Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> --- go/vt/schemamanager/tablet_executor.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/go/vt/schemamanager/tablet_executor.go b/go/vt/schemamanager/tablet_executor.go index 2351ad84de2..9b674851dbf 100644 --- a/go/vt/schemamanager/tablet_executor.go +++ b/go/vt/schemamanager/tablet_executor.go @@ -257,6 +257,8 @@ func (exec *TabletExecutor) Execute(ctx context.Context, sqls []string) *Execute case *sqlparser.DDL: switch ddl.Action { case sqlparser.DropDDLAction: + // TODO (shlomi): break into distinct per-table DROP statements; on a future PR where + // we implement lazy DROP TABLE on Online DDL tableName = ddl.FromTables[0].Name.String() default: tableName = ddl.Table.Name.String() From b62c71d5635c9628b103d1ea71b8506a19cb7d58 Mon Sep 17 00:00:00 2001 From: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> Date: Sun, 6 Dec 2020 21:44:50 +0200 Subject: [PATCH 7/7] goimports Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> --- go/vt/vtctld/api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/vt/vtctld/api.go b/go/vt/vtctld/api.go index 828a8f4bfab..6b5570dbf67 100644 --- a/go/vt/vtctld/api.go +++ b/go/vt/vtctld/api.go @@ -636,7 +636,7 @@ func initAPI(ctx context.Context, ts *topo.Server, actions *ActionRepository, re requestContext := fmt.Sprintf("vtctld/api:%s", apiCallUUID) executor := schemamanager.NewTabletExecutor(requestContext, wr, time.Duration(req.ReplicaTimeoutSeconds)*time.Second) - if err := executor.SetDDLStrategy(req.DDLStrategy); err != nil { + if err := executor.SetDDLStrategy(req.DDLStrategy); err != nil { return fmt.Errorf("error setting DDL strategy: %v", err) }