Skip to content

PMM-15195 Fixes and MySQL 9.7 changes. - #387

Open
JiriCtvrtka wants to merge 12 commits into
mainfrom
PMM-15195-mysql-97
Open

PMM-15195 Fixes and MySQL 9.7 changes.#387
JiriCtvrtka wants to merge 12 commits into
mainfrom
PMM-15195-mysql-97

Conversation

@JiriCtvrtka

@JiriCtvrtka JiriCtvrtka commented Jul 15, 2026

Copy link
Copy Markdown

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
TYPE that INFORMATION_SCHEMA.INNODB_METRICS reports for some rows, which
silently 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.go aggregates redo values while SHOW GLOBAL STATUS is
scraped (wired into both the upstream and the Percona global status collectors) and
emits:

  • mysql_innodb_redo_log_current_lsn
  • mysql_innodb_redo_log_checkpoint_lsn
  • mysql_innodb_redo_log_checkpoint_age_bytes — derived from current minus
    checkpoint LSN when the server does not report the age itself
  • mysql_innodb_redo_log_capacity_bytes
  • mysql_innodb_redo_log_written_bytes_total
  • mysql_innodb_redo_log_checkpoint_age_ratio — only emitted when the real redo
    capacity 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_age and 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

  • Adds mysql_innodb_metrics_* aliases for neighbor flush, purge, adaptive hash and
    read-write transaction counters. They are always exported as counters, regardless
    of the TYPE the server reports for the source row.
  • log_lsn_* and log_max_modified_age_async rows (under both the log and
    recovery subsystems) keep their unsuffixed gauge name, which dashboards need for
    max_over_time and direct arithmetic, and additionally get a correctly typed
    _total counter when MySQL reports them as counters. The -1 sentinel from
    the known upstream bug (bugs.mysql.com/bug.php?id=75966) is skipped.
  • Counter typing for set_member / set_owner rows is scoped to the known
    cumulative rows only, so derived per-call and average rows are not turned into
    counters that can decrease.

Testing and CI

  • Adds mysql:9.7 to the CI image matrix and a MySQL 9.7 case to the processlist
    integration test.
  • Adds a new integration test that validates mysql_perf_schema_table_io_waits_total
    fetch/insert/update/delete counters against Community MySQL 8.0 and 9.7.
  • Adds make test-integration and make test-integration-build, plus a dedicated
    CI Integration job. Nothing compiled the integration-tagged files before, so a
    build 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.
  • Integration tests pin 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.
  • Extends version parsing coverage for 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_METRICS rows still require the matching innodb_monitor_enable modules to
be enabled on the server.

Test plan

  • Collector unit tests, including new redo and INNODB_METRICS alias/type tests.
  • MySQL 8.0 and 9.7 table activity integration tests.
  • Verified canonical and compatibility metrics on a live MySQL 9.7 instance.
  • Verified metrics and affected dashboard queries through a PMM Feature Build.

@JiriCtvrtka

Copy link
Copy Markdown
Author

@copilot review

Copilot AI commented Jul 15, 2026

Copy link
Copy Markdown

@copilot review

Reviewed the latest commit and re-validated the touched collector tests; I didn’t find actionable issues that require code changes.

@JiriCtvrtka

Copy link
Copy Markdown
Author

@copilot review

Copilot AI commented Jul 16, 2026

Copy link
Copy Markdown

@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.

@JiriCtvrtka

Copy link
Copy Markdown
Author

@copilot review

Copilot AI commented Jul 18, 2026

Copy link
Copy Markdown

@copilot review

Reviewed the latest changes again (including targeted collector validation) and I don’t see actionable issues that require additional code changes.

@JiriCtvrtka JiriCtvrtka changed the title PMM-15195 Fixies and MySQL 9.7 changes. PMM-15195 Fixes and MySQL 9.7 changes. Jul 18, 2026
@JiriCtvrtka
JiriCtvrtka marked this pull request as ready for review July 18, 2026 14:25
@JiriCtvrtka
JiriCtvrtka requested a review from a team as a code owner July 18, 2026 14:25
@JiriCtvrtka
JiriCtvrtka requested review from 4nte, ademidoff and maxkondr and removed request for a team July 18, 2026 14:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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_METRICS types 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.

Comment thread collector/info_schema_innodb_metrics.go Outdated
Comment thread collector/perf_schema_table_io_waits_integration_test.go
JiriCtvrtka and others added 2 commits July 24, 2026 12:10
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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Comment on lines +264 to +272
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
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Changed.

Comment on lines +93 to +98
container, err := tcmysql.Run(ctx, image,
tcmysql.WithDatabase("test"),
tcmysql.WithUsername("root"),
tcmysql.WithPassword("test"),
testcontainers.WithCmdArgs("--performance-schema=ON"),
)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Root is intentional: this test reads performance_schema, which the non-root test user (granted only on test.*) can't access.

@JiriCtvrtka

Copy link
Copy Markdown
Author

@copilot review

Copilot AI commented Jul 24, 2026

Copy link
Copy Markdown

@copilot review

Reviewed the current PR state again and re-ran targeted collector tests (TestScrapeInnodbMetrics, TestScrapeInnodbMetricsStableAliases, TestScrapeInnodbMetricsGaugeOverrideSkipsNegative). I don’t see additional actionable issues requiring code changes.

@JiriCtvrtka

Copy link
Copy Markdown
Author

@copilot review

Copilot AI commented Jul 26, 2026

Copy link
Copy Markdown

@copilot review

Reviewed the latest branch state and re-ran targeted collector tests. I don’t see additional actionable issues requiring code changes.

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