Validating table name length

This commit is contained in:
Shlomi Noach 2017-02-21 17:34:49 -07:00
parent b848b78fcb
commit 06c909bd10
2 changed files with 6 additions and 0 deletions

View File

@ -142,6 +142,10 @@ func (this *Applier) ValidateOrDropExistingTables() error {
return err
}
}
if len(this.migrationContext.GetOldTableName()) > mysql.MaxTableNameLength {
log.Fatalf("--timestamp-old-table defined, but resulting table name (%s) is too long (only %d characters allowed)", this.migrationContext.GetOldTableName(), mysql.MaxTableNameLength)
}
if this.tableExists(this.migrationContext.GetOldTableName()) {
return fmt.Errorf("Table %s already exists. Panicking. Use --initially-drop-old-table to force dropping it, though I really prefer that you drop it or rename it away", sql.EscapeName(this.migrationContext.GetOldTableName()))
}

View File

@ -16,6 +16,8 @@ import (
"github.com/outbrain/golib/sqlutils"
)
const MaxTableNameLength = 64
type ReplicationLagResult struct {
Key InstanceKey
Lag time.Duration