Skip to content

mysql: log row shape on decoding error#36190

Open
martykulma wants to merge 4 commits intoMaterializeInc:mainfrom
martykulma:maz-mysql-debug-decode-err
Open

mysql: log row shape on decoding error#36190
martykulma wants to merge 4 commits intoMaterializeInc:mainfrom
martykulma:maz-mysql-debug-decode-err

Conversation

@martykulma
Copy link
Copy Markdown
Contributor

@martykulma martykulma commented Apr 21, 2026

If MySQL fails to decode a binlog row, it unfortunately doesn't provide much information. This adds additional logging that provide the row shape information for debugging.

In pushing this further down into pack_mysql_row, I did some additional refactoring.

Sample output:

WARN timely{name="storage" worker_id=0}: mz_mysql_util::decoding: mysql decode error for `public`.`decode_err` column `f2`: Couldn't convert the value `Time("'029:59:59'")` to a desired type; gtid_set=Some("Partitioned((Interval { lower: 693e00a9-3dce-11f1-9e2c-ca0de7a4a79f, upper: 693e00a9-3dce-11f1-9e2c-ca0de7a4a79f }, Active(11)))"); row_shape=[{name=f1, wire=MYSQL_TYPE_LONG, charset=0, expected=Int32, val=int}, {name=f2, wire=MYSQL_TYPE_TIME2, charset=0, expected=Time, val=time}]

@martykulma martykulma marked this pull request as ready for review April 21, 2026 20:09
@martykulma martykulma requested a review from a team as a code owner April 21, 2026 20:09
Copy link
Copy Markdown
Contributor

@ublubu ublubu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems legit

for (binlog_row, diff) in updates.into_iter().flatten() {
let row = mysql_async::Row::try_from(binlog_row)?;
for (output, row_val) in outputs.iter().repeat_clone(row) {
let row_shape = describe_row_shape(&row_val, &output.desc);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing we aren't bothered by creating all these strings.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch - I'll push it down to only get built in pack_mysql_row

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patrickwwbutler ptal - moving the error handling further down required me to make some additional changes that you were probably also making.

I ran with the changes in 11312 and it passed successfully.

@martykulma martykulma requested a review from a team as a code owner April 22, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants