Skip to content

Read binlog row column metadata in one pass - #203

Open
cyppe wants to merge 1 commit into
blackbeam:masterfrom
cyppe:binlog-row-metadata-one-pass
Open

cyppe wants to merge 1 commit into
blackbeam:masterfrom
cyppe:binlog-row-metadata-one-pass

Conversation

@cyppe

@cyppe cyppe commented Nov 19, 2026

Copy link
Copy Markdown

BinlogRow::deserialize calls TableMapEvent::get_column_metadata(i) for every column, and get_column_metadata walks the metadata of all columns before i. Decoding a row is therefore quadratic in the number of columns.

This change reads the column metadata in one pass, alongside the columns. Once a column's metadata cannot be read, every later column gets empty metadata, as get_column_metadata returns None for it today. get_column_metadata itself is unchanged.

Decoding every rows event of one 1 GB binlog file: 627,225 UPDATE_ROWS events on a 171-column table, binlog_row_metadata=MINIMAL, binlog_row_image=FULL. Ryzen AI MAX+ 395, one pinned core, median of 10 runs:

Before After
Decode time 80.5 s 42.7 s

The decoded values are covered by binlog_event_roundtrip (cargo test --features test,binlog). It fails when the metadata offset is wrong.

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.

1 participant