MySQL 8.0 to 8.4 LTS Upgrade Guide — Part 2: Upgrade Testing

Learn how to test your MySQL 8.0 to 8.4 upgrade using pt-upgrade, dry-run procedures, application compatibility checks, and canary testing before touching production.

Testing is the most time-consuming but most valuable phase of the upgrade process. Skipping testing for a major version upgrade carries extreme risk. For large datasets (multi-terabyte), a failed untested upgrade could result in 10-20+ hours of downtime for rollback alone.

This part covers setting up a test environment, running pt-upgrade for query compatibility, performing a full dry-run, verifying tool compatibility, and optional canary testing.

Test Environment Setup

Set up a test environment that mirrors production as closely as possible. You need two instances for pt-upgrade comparison testing:

InstanceVersionPurpose
Test Instance AMySQL 8.0.37Baseline matching production (control)
Test Instance BMySQL 8.4.8Upgrade target (test candidate)

Setup Steps

  1. Restore both instances from a recent production backup
  2. Ensure both instances have identical data at the same point-in-time
  3. Configure the 8.4 instance with your planned my.cnf (cleaned of removed parameters)
  4. Apply binary logs to both so data matches the start of your slow query log capture window
  5. Verify both instances are healthy and serving queries

Estimated Time: 15-20 hours

Query Compatibility Testing with pt-upgrade

pt-upgrade (Percona Toolkit) replays your actual production workload against both MySQL versions side-by-side and reports differences in query results, errors, or performance.

Step-by-Step Process

Step 1: Enable slow query logging on the production source to capture workload:

SET GLOBAL slow_query_log = ON;
SET GLOBAL long_query_time = 0;  -- Capture ALL queries

Step 2: Collect 1-3 hours of production traffic during peak hours.

Step 3: Disable slow query logging and copy the log:

SET GLOBAL slow_query_log = OFF;
cp /var/lib/mysql/*-slow.log /root/pt-upgrade-workload.log

Step 4: Create a query digest for structured replay:

pt-query-digest /root/pt-upgrade-workload.log --output slowlog \
  > /root/pt-upgrade-digest.out

Step 5: Run pt-upgrade (read-only test):

pt-upgrade h=test_80_host,u=user,p=pass \
  h=test_84_host,u=user,p=pass \
  --max-examples=1 /root/pt-upgrade-digest.out \
  1> pt-upgrade_RO.out 2> pt-upgrade_RO.err

Step 6: Run pt-upgrade (read-write test):

pt-upgrade h=test_80_host,u=user,p=pass \
  h=test_84_host,u=user,p=pass \
  --no-read-only --max-examples=1 /root/pt-upgrade-digest.out \
  1> pt-upgrade_RW.out 2> pt-upgrade_RW.err

Step 7: Analyze results for query failures, row count differences, and performance regressions.

Estimated Time: 20-25 hours (including collection, RO test, RW test, and analysis)

BEST PRACTICE: Percona strongly recommends performing both compatibility checks and pt-upgrade testing. The risk of skipping testing on large datasets is a failed upgrade requiring 10-20+ hours of rollback downtime, far exceeding the testing investment.

Full Dry-Run Upgrade

Beyond query testing, perform the entire upgrade procedure end-to-end on a staging replica before touching production. This validates:

BEST PRACTICE: A dry-run on staging is standard DBA practice for major version upgrades. It catches issues that query-level testing cannot, such as package dependency conflicts, file permission problems, and systemd service configuration changes.

Need help setting up your test environment?

Building a proper test environment with pt-upgrade, staging replicas, and canary routing takes time and expertise. If you'd like a DBA team to handle this, book a free assessment call.

Book Free Assessment →

Application and Tool Compatibility Testing

Verify that all ecosystem components work with MySQL 8.4:

ComponentMinimum Version for 8.4Verification Steps
Percona Toolkit (pt-*)3.5+Run pt-table-checksum and pt-online-schema-change on test
PMMLatest releaseVerify metrics collection from 8.4 instance
ProxySQL2.5.4+Test auth chain and query routing
Percona XtraBackup8.4.x matching targetTake and restore a test backup on 8.4
MySQL Shell8.4.xRun upgrade checker and dump utilities
OrchestratorVerify SOURCE/REPLICA supportTest failover on staging
Application ConnectorsSee Part 1, Section 2.7End-to-end CRUD tests

Canary Testing (Optional but Recommended)

For critical production databases, consider canary testing before full cutover:

  1. Set up the 8.4 instance as a replica receiving real production traffic
  2. Configure ProxySQL or your load balancer to route a small percentage (5-10%) of read traffic to the 8.4 replica
  3. Monitor error rates, query latency, and result correctness for 24-48 hours
  4. Gradually increase traffic percentage if no issues are found
  5. Proceed to full cutover once confident

This approach catches subtle issues under real production load patterns that synthetic testing may miss.

Part 2 Quick Checklist

Continue the Series

  1. ← Part 1: Pre-Upgrade Preparation
  2. Part 2: Upgrade Testing (You Are Here)
  3. Part 3: Upgrade Execution →
M

Mughees — ReliaDB

ReliaDB is a specialist DBA team for PostgreSQL and MySQL performance, high availability, and cloud database optimization. More about ReliaDB →