Skip to content

Commit 06c909b

Browse files
author
Shlomi Noach
committed
Validating table name length
1 parent b848b78 commit 06c909b

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

go/logic/applier.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ func (this *Applier) ValidateOrDropExistingTables() error {
142142
return err
143143
}
144144
}
145+
if len(this.migrationContext.GetOldTableName()) > mysql.MaxTableNameLength {
146+
log.Fatalf("--timestamp-old-table defined, but resulting table name (%s) is too long (only %d characters allowed)", this.migrationContext.GetOldTableName(), mysql.MaxTableNameLength)
147+
}
148+
145149
if this.tableExists(this.migrationContext.GetOldTableName()) {
146150
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()))
147151
}

go/mysql/utils.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import (
1616
"github.com/outbrain/golib/sqlutils"
1717
)
1818

19+
const MaxTableNameLength = 64
20+
1921
type ReplicationLagResult struct {
2022
Key InstanceKey
2123
Lag time.Duration

0 commit comments

Comments
 (0)