Skip to content

Commit

Permalink
source-mysql: Omit unexpected DB_ROW_HASH_1 column values
Browse files Browse the repository at this point in the history
See #1344 for the
full explanation, but this commit adds a special-case to our
document value translation logic to exclude columns by the name
of `DB_ROW_HASH_1` for which we have no type information.

There is no accompanying test because this can only be reproduced
on MariaDB and we use MySQL for our default test setup, but I have
tested this locally and confirmed that it fixes what would otherwise
be a capture error.
  • Loading branch information
willdonnelly committed Mar 15, 2024
1 parent 4065367 commit d59e97e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions source-mysql/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,15 @@ func (db *mysqlDatabase) translateRecordFields(columnTypes map[string]interface{
return nil
}
for id, val := range f {
// MariaDB versions 10.4 and up include a synthetic `DB_ROW_HASH_1` column in the
// binlog row change events for certain tables with unique hash indices (see issue
// https://github.com/estuary/connectors/issues/1344). In such cases we won't have
// any type information for the column, but we also don't want it anyway, so as a
// special case we just delete the 'DB_ROW_HASH_1' property from the document.
if id == "DB_ROW_HASH_1" && columnTypes[id] == nil {
delete(f, id)
continue
}
var translated, err = db.translateRecordField(columnTypes[id], val)
if err != nil {
return fmt.Errorf("error translating field %q value %v: %w", id, val, err)
Expand Down

0 comments on commit d59e97e

Please sign in to comment.