PMM-15195 Fixes and MySQL 9.7 changes. - #1152
Conversation
Avoid requiring mysqldump for reports without schema analysis and use dynamic redo log capacity when legacy log variables are unavailable. Co-authored-by: Cursor <cursoragent@cursor.com>
Fail early when mysqldump is unavailable so Service Summary cannot silently omit schema-related information. Co-authored-by: Cursor <cursoragent@cursor.com>
This reverts commit ff936cd.
|
@copilot review |
There was a problem hiding this comment.
Pull request overview
Updates pt-mysql-summary to better support MySQL 8.0.30+ / MySQL 9.7 InnoDB redo logging, while making mysqldump optional unless schema analysis is explicitly requested. Also aligns Go toolchain versions for generated binaries/package builds.
Changes:
- Report InnoDB “Log File Size” using
innodb_redo_log_capacitywhen available, with legacy fallback toinnodb_log_file_size * innodb_log_files_in_group. - Require
mysqldumponly when--databasesor--all-databasesschema analysis is requested; add test coverage for this behavior. - Bump Go version to
1.26.5and align the package builder script withgo.mod.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| t/pt-mysql-summary/samples/expected_output_temp_enc009.txt | Updates expected InnoDB log size output to match redo capacity reporting. |
| t/pt-mysql-summary/samples/expected_output_temp_enc008.txt | Same expected-output update for another sample fixture. |
| t/pt-mysql-summary/pt-mysql-summary.t | Adds tests ensuring mysqldump is optional for default summary but required for schema analysis. |
| t/lib/bash/report_mysql_info.sh | Adds a focused test validating formatting via innodb_redo_log_capacity; updates TAP plan. |
| lib/bash/report_mysql_info.sh | Implements redo-capacity-based “Log File Size” reporting with legacy fallback and “Unknown” fallback. |
| go.mod | Bumps the Go toolchain directive to 1.26.5. |
| config/scripts/pt_builder.sh | Aligns builder-installed Go version with go.mod. |
| bin/pt-mysql-summary | Mirrors redo-capacity logic in the shipped script and gates mysqldump validation on schema-analysis options. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot review |
There was a problem hiding this comment.
Two inline comments below. Two points that don't anchor to the diff:
=head1 OUTPUT POD is now stale
bin/pt-mysql-summary:3136 still documents:
Log File Size | 2 * 5.0M = 10.0M
and the sample config just below at bin/pt-mysql-summary:3245 reinforces it with innodb_log_file_size = 5M. Nothing tells the reader that on 8.0.30+ this field switches from count * per-file = total to a bare total. "Documentation updated - no changes needed" is fair for =head1 SYSTEM REQUIREMENTS (it never mentioned mysqldump), but the OUTPUT section now describes only the legacy rendering. A one-sentence note there should head off some "why did my summary format change?" reports.
Changelog
Changelog isn't updated, and at least one user-visible item here arguably belongs in it: Log File Size output format change for MySQL 8.0.30+. Convention in this repo looks like release-time updates rather than per-PR, so if release prep picks these up, could you confirm both land in the next version? Otherwise a short entry in this PR would be good.
| local log_size="$(get_var innodb_log_file_size "$variables_file")" | ||
| local log_file="$(get_var innodb_log_files_in_group "$variables_file")" | ||
| if [ -n "${log_size}" ] && [ -n "${log_file}" ]; then | ||
| local log_total=$(awk "BEGIN {printf \"%.2f\n\", ${log_size}*${log_file}}" ) | ||
| name_val "Log File Size" \ | ||
| "${log_file} * $(shorten ${log_size} 1) = $(shorten ${log_total} 1)" | ||
| else | ||
| name_val "Log File Size" "Unknown" |
There was a problem hiding this comment.
Requiring both log_size and log_file means a server that exposes only innodb_log_file_size now reports Unknown, discarding a value it actually has. Verified by driving section_innodb with innodb_log_files_in_group stripped and no innodb_redo_log_capacity present:
Log File Size | Unknown
That combination is MariaDB 10.5+, which dropped innodb_log_files_in_group and never had innodb_redo_log_capacity. The old code wasn't correct there either — it emitted a malformed * 92.0M = — so this isn't a clean regression, but it trades garbage for no information instead of for the number. Defaulting the multiplier costs one line:
| local log_size="$(get_var innodb_log_file_size "$variables_file")" | |
| local log_file="$(get_var innodb_log_files_in_group "$variables_file")" | |
| if [ -n "${log_size}" ] && [ -n "${log_file}" ]; then | |
| local log_total=$(awk "BEGIN {printf \"%.2f\n\", ${log_size}*${log_file}}" ) | |
| name_val "Log File Size" \ | |
| "${log_file} * $(shorten ${log_size} 1) = $(shorten ${log_total} 1)" | |
| else | |
| name_val "Log File Size" "Unknown" | |
| local log_size="$(get_var innodb_log_file_size "$variables_file")" | |
| local log_file="$(get_var innodb_log_files_in_group "$variables_file")" | |
| if [ -n "${log_size}" ]; then | |
| [ -n "${log_file}" ] || log_file=1 | |
| local log_total=$(awk "BEGIN {printf \"%.2f\n\", ${log_size}*${log_file}}" ) | |
| name_val "Log File Size" \ | |
| "${log_file} * $(shorten ${log_size} 1) = $(shorten ${log_total} 1)" | |
| else | |
| name_val "Log File Size" "Unknown" |
Worth confirming whether MariaDB is in scope for pt-mysql-summary at all — there are no MariaDB samples under t/pt-mysql-summary/samples/, so CI wouldn't catch it either way.
| cp "$samples/temp001/mysql-variables" "$PT_TMPDIR/mysql-variables-redo-capacity" | ||
| printf 'innodb_redo_log_capacity\t104857600\n' >> "$PT_TMPDIR/mysql-variables-redo-capacity" |
There was a problem hiding this comment.
This appends innodb_redo_log_capacity to a sample that still contains both legacy variables, so the test proves precedence — the MySQL 8.0.30 case where all three exist. It doesn't cover the MySQL 9.7 shape (redo capacity present, legacy variables gone), which is what the ticket is actually about. The Unknown branch is untested too.
I confirmed the 9.7 path renders correctly by hand, but nothing in CI would catch a regression in it. One extra case closes the gap:
grep -vE '^innodb_log_file_size|^innodb_log_files_in_group' \
"$samples/temp001/mysql-variables" > "$PT_TMPDIR/mysql-variables-97"
printf 'innodb_redo_log_capacity\t104857600\n' >> "$PT_TMPDIR/mysql-variables-97"
(with plan 48 bumped accordingly)
|
Hi @svetasmirnova, I saw that you opened this PR yesterday: #1155. My ticket on the PMM side is to add support for MySQL 9.7. To implement it fully, I also created a PR for Percona Toolkit with the necessary changes. What do you think would be the best approach at this point? Thank you. |
PMM-15195
PMM PR: percona/pmm#5648
MySQL Exporter PR: percona/mysqld_exporter#387
FB: Percona-Lab/pmm-submodules#4479
Summary
Updates
pt-mysql-summaryfor MySQL 9.7 and removes an unnecessary historicaldependency on
mysqldump.Log File Sizefrominnodb_redo_log_capacityon MySQL8.0.30+ and MySQL 9.7, where the legacy redo log variables no longer exist.
innodb_log_file_size/innodb_log_files_in_grouprendering for older MySQL versions, and falls back to a multiplier of
1when only
innodb_log_file_sizeis exposed (MariaDB 10.5+), so a value theserver does report is no longer discarded as
Unknown.mysqldumponly when schema analysis is explicitly requested with--databasesor--all-databases; the default summary no longer fails whenmysqldumpis missing.=head1 OUTPUTthat theLog File Sizerendering is versiondependent, so the change from
count * per-file = totalto a bare total on8.0.30+ is not a surprise.
aligns
config/scripts/pt_builder.shwith the version declared ingo.mod.Compatibility
Default
pt-mysql-summaryand PMM Service Summary reports carry the sameinformation as before. On MySQL 8.0.30+ the
Log File Sizeline prints thetotal redo log capacity instead of
files * size = total, because theper-file variables are gone. Schema analysis still requires
mysqldump.Test plan
8.0.30 shape (all three variables present, capacity wins), the 9.7 shape
(capacity only, legacy variables gone), the MariaDB shape (
innodb_log_file_sizeonly), and the
Unknownbranch.mysqldumpis optional for the default summary andrequired for
--databases/--all-databases.Oracle MySQL 9.7.
mysqldumpbinary can connect to MySQL 9.7.package builder shell syntax.