Skip to content

Commit b875a8e

Browse files
author
Shlomi Noach
authored
Merge pull request #575 from github/validate-binlog-row-image
Enforcing binlog_row_image=FULL
2 parents 68bf933 + 160e7a1 commit b875a8e

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

go/logic/inspect.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,6 @@ func (this *Inspector) inspectOriginalAndGhostTables() (err error) {
165165
return fmt.Errorf("Chosen key (%s) has nullable columns. Bailing out. To force this operation to continue, supply --allow-nullable-unique-key flag. Only do so if you are certain there are no actual NULL values in this key. As long as there aren't, migration should be fine. NULL values in columns of this key will corrupt migration's data", this.migrationContext.UniqueKey)
166166
}
167167
}
168-
if !this.migrationContext.UniqueKey.IsPrimary() {
169-
if this.migrationContext.OriginalBinlogRowImage != "FULL" {
170-
return fmt.Errorf("binlog_row_image is '%s' and chosen key is %s, which is not the primary key. This operation cannot proceed. You may `set global binlog_row_image='full'` and try again", this.migrationContext.OriginalBinlogRowImage, this.migrationContext.UniqueKey)
171-
}
172-
}
173168

174169
this.migrationContext.SharedColumns, this.migrationContext.MappedSharedColumns = this.getSharedColumns(this.migrationContext.OriginalTableColumns, this.migrationContext.GhostTableColumns, this.migrationContext.ColumnRenameMap)
175170
log.Infof("Shared columns are %s", this.migrationContext.SharedColumns)
@@ -358,6 +353,9 @@ func (this *Inspector) validateBinlogs() error {
358353
this.migrationContext.OriginalBinlogRowImage = "FULL"
359354
}
360355
this.migrationContext.OriginalBinlogRowImage = strings.ToUpper(this.migrationContext.OriginalBinlogRowImage)
356+
if this.migrationContext.OriginalBinlogRowImage != "FULL" {
357+
return fmt.Errorf("%s:%d has '%s' binlog_row_image, and only 'FULL' is supported. This operation cannot proceed. You may `set global binlog_row_image='full'` and try again", this.connectionConfig.Key.Hostname, this.connectionConfig.Key.Port, this.migrationContext.OriginalBinlogRowImage)
358+
}
361359

362360
log.Infof("binary logs validated on %s:%d", this.connectionConfig.Key.Hostname, this.connectionConfig.Key.Port)
363361
return nil

0 commit comments

Comments
 (0)