Skip to content

canal: string for historical data, int64 for new data when parsing binlog #1051

@yl

Description

@yl

When listening to the binlog, the enum fields in historical data are returned as strings, while the enum fields in newly inserted data are returned as int64.

Example log information:

([]interface {}) (len=13 cap=13) {
 (uint64) 7,
 (string) (len=6) "CANCEL",
 (uint64) 2,
 (uint64) 1,
 (string) (len=3) "ASK",
 (decimal.Decimal) 1,
 (decimal.Decimal) 0,
 (decimal.Decimal) 1,
 (string) (len=3) "GTC",
 (string) (len=2) "NO",
 (interface {}) <nil>,
 (string) (len=23) "2025-07-19 08:24:25.209",
 (interface {}) <nil>
}
(binlog.000002, 11901)
2025/07/19 16:29:32 INFO dump MySQL and parse OK use=596.411ms position="(binlog.000002, 11901)"
2025/07/19 16:29:32 INFO begin to sync binlog from position position="(binlog.000002, 11901)"
2025/07/19 16:29:32 INFO Connected to server flavor=mysql version=8.4.5
2025/07/19 16:29:32 INFO start sync binlog at binlog file pos="(binlog.000002, 11901)"
2025/07/19 16:29:32 INFO rotate to next binlog file=binlog.000002 position=11901
2025/07/19 16:29:32 INFO received fake rotate event nextLogName=binlog.000002
(binlog.000002, 12068)
([]interface {}) (len=13 cap=13) {
 (uint64) 8,
 (int64) 1,
 (uint64) 3,
 (uint64) 1,
 (int64) 1,
 (decimal.Decimal) 1,
 (decimal.Decimal) 0,
 (decimal.Decimal) 1,
 (int64) 1,
 (int64) 1,
 (interface {}) <nil>,
 (string) (len=23) "2025-07-19 16:29:53.527",
 (interface {}) <nil>
}
(binlog.000002, 12297)

Why are enum fields in historical data returned as strings, while in newly inserted data they are returned as int64? What causes this phenomenon, and how can consistent data types be ensured?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions