Skip to content

[mysql source versioning] add binlog setting to mysql source details at purification#36253

Open
patrickwwbutler wants to merge 5 commits intoMaterializeInc:mainfrom
patrickwwbutler:patrick/mysql-binlog-setting
Open

[mysql source versioning] add binlog setting to mysql source details at purification#36253
patrickwwbutler wants to merge 5 commits intoMaterializeInc:mainfrom
patrickwwbutler:patrick/mysql-binlog-setting

Conversation

@patrickwwbutler
Copy link
Copy Markdown
Contributor

Now adds a check at sql purification time to see what the binlog setting of the upstream mysql db is, and saves that setting in the mysql source details, so that we can check the original value during replication, and maintain a consistent decoding strategy

Co-authored-by: Copilot <copilot@github.com>
@patrickwwbutler patrickwwbutler requested review from a team as code owners April 24, 2026 20:07
@patrickwwbutler patrickwwbutler requested a review from ggevay April 24, 2026 20:07
Comment thread src/sql/src/pure.rs Outdated
Comment thread src/sql/src/pure.rs Outdated
Comment thread src/sql/src/pure.rs Outdated
Comment thread src/sql/src/pure.rs Outdated
Comment thread src/sql/src/pure.rs Outdated
@patrickwwbutler patrickwwbutler requested a review from def- April 27, 2026 14:33
Copy link
Copy Markdown
Contributor

@martykulma martykulma left a comment

Choose a reason for hiding this comment

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

Thanks @patrickwwbutler - some comments around tidying up.

Comment thread src/sql/src/pure.rs Outdated
Err(
MySqlSourcePurificationError::UnsupportedBinlogMetadataSetting {
setting: "Using MySQL version < 8.0.1, which does not support full binlog row metadata".to_string(),
},
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.

This should just be a separate error variant - e.g.
MySqlSourcePurificationError::UnsupportedVersion { version }, or something to that effect.

Comment thread src/sql/src/pure.rs Outdated
}
let binlog_metadata_setting =
mz_mysql_util::query_sys_var(&mut conn, "binlog_row_metadata").await?;
let binlog_full_metadata = binlog_metadata_setting.to_uppercase() == "FULL";
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.

prefer .eq_ignore_ascii_case("FULL") over to_uppercase

Comment thread src/sql/src/pure.rs Outdated
Comment on lines +1520 to +1529
let binlog_full_metadata = version_compare::compare_to(
mz_mysql_util::query_sys_var(&mut conn, "version").await?,
"8.0.1",
version_compare::Cmp::Ge,
)
.is_ok_and(|is_ge| is_ge)
&& mz_mysql_util::query_sys_var(&mut conn, "binlog_row_metadata")
.await?
.to_uppercase()
== "FULL";
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.

Could combine the code into a single helper function that results Result<(), MySqlSourcePurificationError>

-- for boolean --
let binlog_full_metadata = ensure_binlog_full_metadata(&mut conn).await.is_ok();


-- for error --
ensure_binlog_full_metadata(&mut conn).await?;
// binlog_full_metadata is true if the above didn't fail

…ype, use better str cmp function

Co-authored-by: Copilot <copilot@github.com>
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.

3 participants