Skip to content

Commit

Permalink
fixed missing schema qualifier in init query
Browse files Browse the repository at this point in the history
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
  • Loading branch information
shlomi-noach committed Oct 4, 2020
1 parent c305450 commit df502e9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions go/vt/vttablet/onlineddl/executor.go
Expand Up @@ -22,6 +22,7 @@ import (
"flag"
"fmt"
"io/ioutil"
"math"
"os"
"path"
"strconv"
Expand Down Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion go/vt/vttablet/onlineddl/schema.go
Expand Up @@ -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',
Expand Down

0 comments on commit df502e9

Please sign in to comment.