§ Migrating from Percona to GreatSQL


This article introduces how to migrate/upgrade from Percona to the GreatSQL database.

§ Why Migrate/Upgrade

GreatSQL is an open-source branch forked from Percona, focusing on improving MGR reliability and performance, and supporting features such as InnoDB parallel query.

GreatSQL has many excellent features compared with Percona, including but not limited to the following:

1. Main Features GreatSQL 8.0.32-27 Percona 8.0.32-24
LoongArch support ✔️ ❌
2. Performance Enhancement Extensions GreatSQL 8.0.32-27 Percona 8.0.32-24
Rapid Engine ✔️ HeatWave only in cloud
Turbo Engine ✔️ ❌
NUMA affinity optimization ✔️ ❌
Non-blocking DDL ✔️ ❌
Import optimization for tables without a primary key ✔️ ❌
InnoDB parallel query ✔️ primary key scan only
Parallel LOAD DATA ✔️ ❌
InnoDB transaction ReadView lock-free optimization ✔️ ❌
InnoDB transaction large lock split optimization ✔️ ❌
3. Developer-Oriented Improvements GreatSQL 8.0.32-25 MySQL 8.0.32
Oracle compatibility - data types ✔️ ❌
Oracle compatibility - functions ✔️ ❌
Oracle compatibility - SQL syntax ✔️ ❌
Oracle compatibility - stored routines ✔️ ❌
4. Basic Feature Improvements GreatSQL 8.0.32-25 MySQL 8.0.32
MGR enhancement - zone tags ✔️ ❌
MGR enhancement - arbitrator ✔️ ❌
MGR enhancement - read/write node bound VIP ✔️ ❌
MGR enhancement - fast single-primary mode ✔️ ❌
MGR enhancement - smart primary election ✔️ ❌
MGR enhancement - new flow control algorithm ✔️ ❌
MGR enhancement - network partition exception handling ✔️ ❌
MGR enhancement - node abnormal exit handling ✔️ ❌
MGR enhancement - node disk full handling ✔️ ❌
MGR enhancement - automatic donor node selection ✔️ ❌
Clone incremental backup ✔️ ❌
Clone backup compression ✔️ ❌
Binlog read speed limit ✔️ ❌
5. Security Enhancements GreatSQL 8.0.32-25 MySQL 8.0.32
National Cryptographic (GM) Support ✔️ ❌
Backup encryption ✔️ ❌
Policy-based data masking ✔️ ❌
Audit log into tables ✔️ ❌
Last login recording ✔️ ❌

§ Preparation Before Migration/Upgrade

First download the GreatSQL 8.0 installation package. It is recommended to choose the latest GreatSQL 8.0.32-25 release (opens new window). Whether to choose RPM or binary tarball depends on the specific situation and personal preference.

It is recommended to use GreatSQL Shell for the pre-upgrade check and fix any possible problems in advance. For details, see: Upgrade Check.

This article uses the binary tarball installation method.

Before the formal migration/upgrade, be sure to back up your data. You can use any of the following methods:

  1. Stop for maintenance, copy the current database directory, and make a full physical backup. This method is the fastest to restore.
  2. Use backup tools such as mysqldump/xtrabackup to perform a full backup.
  3. Use source-replica replication or MGR to perform a backup on one of the nodes, or temporarily take a node offline/exit as a standby node.

Next, determine which of the following situations this migration/upgrade belongs to:

  1. Migrate+upgrade from Percona 5.7 directly to GreatSQL 8.0.32 in one go.
  2. Migrate/upgrade from Percona 8.0.32 and lower versions to GreatSQL 8.0.32.
  3. For migrating+upgrading from Percona 5.6 and lower versions to GreatSQL 8.0.32, you should first upgrade the major versions one by one, e.g., 5.5=>5.6, 5.6=>the latest 5.7, and then upgrade to GreatSQL 8.0.32-25 in one go.

For the first two situations, refer to the method in the document: Upgrading GreatSQL 5.7 to 8.0 to migrate/upgrade. The process is exactly the same.

For the third situation, refer to the logical backup + import method introduced in the document: Migrating from MySQL to GreatSQL to perform the downgrade.

Migrating from Percona to GreatSQL is the fastest. The metadata database tables are almost identical, and the InnoDB table data is universal, so a smooth migration can almost be achieved.

§ Downgrading to GreatSQL 8.0.32-27

If you want to downgrade from a version after Percona 8.0.32 to GreatSQL 8.0.32-27, you need to use the logical backup + logical import method to complete the downgrade (it is not supported to start GreatSQL 8.0.32-27 in-place on the original datadir to complete the downgrade replacement). In addition, on the first restart after the logical backup import is completed, be sure to set upgrade=FORCE to force the upgrade of all data tables, including system tables.

The downgrade process is roughly as follows:

  1. Logically back up all data on the higher version
mysqldump -S/data/MySQL/mysql.sock -A --triggers --routines --events --single-transaction > /data/backup/fulldump.sql
1
  1. Import the logical backup file in the GreatSQL 8.0.32-27 environment to complete logical restore
mysql -S/data/GreatSQL/mysql.sock -f < /data/backup/fulldump.sql
1
  1. Modify my.cnf to ensure upgrade=FORCE is set
[mysqld]
upgrade=FORCE
1
2
  1. Restart GreatSQL to complete the downgrade
systemctl restart greatsql
1

During the restart, you can see a forced upgrade process similar to the following in the logs

[Note] [MY-013387] [Server] Upgrading system table data.
[Note] [MY-013385] [Server] Upgrading the sys schema.
[Note] [MY-013400] [Server] Upgrade of help tables started.
[Note] [MY-013400] [Server] Upgrade of help tables completed.
[Note] [MY-013394] [Server] Checking 'mysql' schema.
[Note] [MY-013394] [Server] Checking 'sys' schema.
[System] [MY-013381] [Server] Server upgrade from '80032' to '80032' completed.
1
2
3
4
5
6
7

If upgrade=FORCE is not set to force the upgrade of all tables, corruption errors may occur in the system table mysql.procs_priv, and an error similar to the following may be reported when creating a user:

greatsql> create user tpch identified by 'tpch';
ERROR 1728 (HY000): Cannot load from mysql.procs_priv. The table is probably corrupted
1
2

§ Notes

The MGR group view UUID feature (group_replication_view_change_uuid (opens new window)) was introduced in MySQL 8.0.26. Therefore, if the version of a current MGR cluster is 8.0.25 or lower, it cannot be smoothly upgraded/migrated to 8.0.26. You need to apply for a downtime maintenance window, perform in-place upgrades on each node of the MGR cluster, and complete the upgrade from 8.0.25 to 8.0.26 or higher.

For details, please refer to: Smoothly upgrading an MGR cluster from GreatSQL-8.0.25 to GreatSQL-8.0.32 (opens new window).

Reference Documents

Scan the QR code to follow our WeChat official account

greatsql-wx