diff --git a/go/vt/vttablet/onlineddl/executor.go b/go/vt/vttablet/onlineddl/executor.go index 60ff5569dc5..5210ebfc72f 100644 --- a/go/vt/vttablet/onlineddl/executor.go +++ b/go/vt/vttablet/onlineddl/executor.go @@ -22,6 +22,7 @@ import ( "flag" "fmt" "io/ioutil" + "math" "os" "path" "strconv" @@ -162,11 +163,19 @@ func (e *Executor) execQuery(ctx context.Context, query string) (result *sqltype return result, err } defer conn.Recycle() - return withDDL.Exec(ctx, query, conn.Exec) + return conn.Exec(ctx, query, math.MaxInt32, true) } func (e *Executor) initSchema(ctx context.Context) error { - _, err := e.execQuery(ctx, sqlValidationQuery) + defer e.env.LogError() + + conn, err := e.pool.Get(ctx) + if err != nil { + return err + } + defer conn.Recycle() + parsed := sqlparser.BuildParsedQuery(sqlValidationQuery, "_vt") + _, err = withDDL.Exec(ctx, parsed.Query, conn.Exec) return err } diff --git a/go/vt/vttablet/onlineddl/schema.go b/go/vt/vttablet/onlineddl/schema.go index ad7da5e19df..debc8135cf8 100644 --- a/go/vt/vttablet/onlineddl/schema.go +++ b/go/vt/vttablet/onlineddl/schema.go @@ -51,7 +51,7 @@ const ( KEY keyspace_shard_idx (keyspace,shard), KEY status_idx (migration_status, liveness_timestamp) ) engine=InnoDB DEFAULT CHARSET=utf8mb4` - sqlValidationQuery = `select 1 from schema_migrations limit 1` + sqlValidationQuery = `select 1 from %s.schema_migrations limit 1` sqlScheduleSingleMigration = `UPDATE %s.schema_migrations SET migration_status='ready',