PMM-15195 Fixes and MySQL 9.7 changes. - #387
Conversation
|
@copilot review |
Reviewed the latest commit and re-validated the touched collector tests; I didn’t find actionable issues that require code changes. |
|
@copilot review |
I reviewed the last two commits again and re-ran targeted collector tests; I didn’t find actionable issues that require additional code changes. |
|
@copilot review |
Reviewed the latest changes again (including targeted collector validation) and I don’t see actionable issues that require additional code changes. |
There was a problem hiding this comment.
Pull request overview
Adds MySQL 9.7 compatibility coverage and stabilizes/normalizes exporter metrics so PMM dashboards can rely on consistent InnoDB redo and INFORMATION_SCHEMA.INNODB_METRICS series across MySQL versions.
Changes:
- Introduces canonical InnoDB redo log metrics and emits compatibility aliases derived from
SHOW GLOBAL STATUS. - Normalizes selected
INNODB_METRICStypes and adds stable, version-independent alias metrics for dashboards. - Expands CI and integration test coverage to include MySQL 9.7 (plus new perf schema table I/O integration coverage).
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| collector/perf_schema_table_io_waits_integration_test.go | Adds integration test that validates perf schema table I/O counters on MySQL 8.0 and 9.7. |
| collector/percona_info_schema_process_list_integration_test.go | Adds an explicit MySQL 9.7 integration test case for processlist scraping behavior. |
| collector/percona_global_status.go | Emits new/compat InnoDB redo metrics during Percona global status scraping. |
| collector/instance_test.go | Extends version parsing coverage for MySQL 9.7.x strings. |
| collector/innodb_redo.go | Adds redo-status aggregation/emission logic for canonical + compatibility metrics. |
| collector/innodb_redo_test.go | Adds unit tests validating redo metric emission and non-duplication behavior. |
| collector/info_schema_innodb_metrics.go | Adds stable aliases + type normalization for selected INNODB_METRICS rows. |
| collector/info_schema_innodb_metrics_test.go | Adds unit tests for stable aliases and gauge override behavior. |
| collector/global_status.go | Emits new/compat InnoDB redo metrics during upstream global status scraping. |
| CHANGELOG.md | Documents the enhancement for MySQL 9.7 redo/type normalization work. |
| .github/workflows/go.yml | Adds MySQL 9.7 to the CI image matrix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
| if _, ok := innodbMetricGaugeOverrides[subsystem+"/"+name]; ok { | ||
| ch <- prometheus.MustNewConstMetric(metricDesc(""), prometheus.GaugeValue, value) | ||
| // Preserve the historical counter name for users that already query | ||
| // it while also exposing the correctly typed gauge above. | ||
| if (metricType == "counter" || metricType == "status_counter") && value >= 0 { | ||
| ch <- prometheus.MustNewConstMetric(metricDesc("_total"), prometheus.CounterValue, value) | ||
| } | ||
| continue | ||
| } |
| container, err := tcmysql.Run(ctx, image, | ||
| tcmysql.WithDatabase("test"), | ||
| tcmysql.WithUsername("root"), | ||
| tcmysql.WithPassword("test"), | ||
| testcontainers.WithCmdArgs("--performance-schema=ON"), | ||
| ) |
There was a problem hiding this comment.
Root is intentional: this test reads performance_schema, which the non-root test user (granted only on test.*) can't access.
|
@copilot review |
Reviewed the current PR state again and re-ran targeted collector tests ( |
|
@copilot review |
Reviewed the latest branch state and re-ran targeted collector tests. I don’t see additional actionable issues requiring code changes. |
PMM-15195
PMM PR: percona/pmm#5648
PT PR: percona/percona-toolkit#1152
FB: Percona-Lab/pmm-submodules#4479
Summary
Oracle MySQL 8.4/9.7 renamed several InnoDB redo status variables and changed the
TYPEthatINFORMATION_SCHEMA.INNODB_METRICSreports for some rows, whichsilently broke PMM dashboard queries. This PR exposes a stable, version-independent
set of metrics, keeps the historical names working, and adds MySQL 9.7 test coverage.
Canonical InnoDB redo log metrics
New
collector/innodb_redo.goaggregates redo values whileSHOW GLOBAL STATUSisscraped (wired into both the upstream and the Percona global status collectors) and
emits:
mysql_innodb_redo_log_current_lsnmysql_innodb_redo_log_checkpoint_lsnmysql_innodb_redo_log_checkpoint_age_bytes— derived from current minuscheckpoint LSN when the server does not report the age itself
mysql_innodb_redo_log_capacity_bytesmysql_innodb_redo_log_written_bytes_totalmysql_innodb_redo_log_checkpoint_age_ratio— only emitted when the real redocapacity is known, never derived from the checkpoint flush threshold
Backward compatibility
When a server only reports the new Oracle names, the exporter also emits the
historical Percona status names so existing dashboards keep working:
mysql_global_status_innodb_lsn_current,..._innodb_lsn_last_checkpoint,..._innodb_checkpoint_ageand a best-effort..._innodb_checkpoint_max_age.On Percona Server, where the original status variables exist, no alias is emitted,
so no series is ever duplicated.
INNODB_METRICS types and stable aliases
mysql_innodb_metrics_*aliases for neighbor flush, purge, adaptive hash andread-write transaction counters. They are always exported as counters, regardless
of the
TYPEthe server reports for the source row.log_lsn_*andlog_max_modified_age_asyncrows (under both thelogandrecoverysubsystems) keep their unsuffixed gauge name, which dashboards need formax_over_timeand direct arithmetic, and additionally get a correctly typed_totalcounter when MySQL reports them as counters. The-1sentinel fromthe known upstream bug (bugs.mysql.com/bug.php?id=75966) is skipped.
set_member/set_ownerrows is scoped to the knowncumulative rows only, so derived per-call and average rows are not turned into
counters that can decrease.
Testing and CI
mysql:9.7to the CI image matrix and a MySQL 9.7 case to the processlistintegration test.
mysql_perf_schema_table_io_waits_totalfetch/insert/update/delete counters against Community MySQL 8.0 and 9.7.
make test-integrationandmake test-integration-build, plus a dedicatedCI
Integrationjob. Nothing compiled theintegration-tagged files before, so abuild error in them could not fail CI; the job now vets them and runs the table
I/O waits test. The processlist test stays out of CI until its ten parallel
containers are validated on a hosted runner.
innodb_buffer_pool_size(and redo capacity where relevant)so MySQL 9.7, which autosizes InnoDB from total host memory, is not OOM killed on
a busy Docker host.
9.7.x.Compatibility
No metric is renamed or removed; all additions are new series or aliases. Existing
dashboards can continue using the legacy names, while updated PMM dashboards prefer
the canonical metrics and fall back to the legacy ones for older exporters. Some
INNODB_METRICSrows still require the matchinginnodb_monitor_enablemodules tobe enabled on the server.
Test plan
INNODB_METRICSalias/type tests.