Skip to content
/ server Public

Conversation

@FarihaIS
Copy link
Contributor

@FarihaIS FarihaIS commented Jan 30, 2026

Description

The mariadb-backup --copy-back operation was not creating the mariadb_upgrade_info file in the restored datadir, causing MariaDB to incorrectly prompt for an upgrade even when restoring from a backup of the same version.

Without this file, mariadb-upgrade cannot determine the database version and assumes an upgrade is needed, forcing users to run unnecessary upgrade operations during disaster recovery.

This fix creates the mariadb_upgrade_info file with the server version string (MYSQL_SERVER_VERSION) after a successful --copy-back operation, ensuring mariadb-upgrade correctly recognizes the database is already at the current version.

Release Notes

N/A

How can this PR be tested?

Execute the mariabackup.full_backup test in mysql-test-run. This commit adds a test in this file that verifies the creation of mariadb_upgrade_info during a successful copy-back.

Before the fix

mysqltest: At line 39: command "file_exists" failed with error: 1  my_errno: 175  errno: 2

The result from queries just before the failure was:
< snip >
INSERT INTO t VALUES(1);
SET GLOBAL innodb_max_purge_lag_wait=0;
# xtrabackup backup
NOT FOUND /InnoDB: Allocated tablespace ID/ in backup.log
SELECT variable_value FROM information_schema.global_status
WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY';
variable_value
0
INSERT INTO t VALUES(2);
# xtrabackup prepare
# shutdown server
# remove datadir
# xtrabackup move back
# restart
SELECT * FROM t;
i
1
#
# MDEV-34713 Check that mariadb_upgrade_info is created during copy-back
...
Failing test(s): mariabackup.full_backup

After the fix

mariabackup.full_backup '8k'             w5 [ pass ]   9257
mariabackup.full_backup '16k'            w4 [ pass ]   9979
mariabackup.full_backup '4k'             w1 [ pass ]   9954
mariabackup.full_backup '32k'            w3 [ pass ]  10984
mariabackup.full_backup '64k'            w2 [ pass ]  12634
--------------------------------------------------------------------------
The servers were restarted 0 times
Spent 52.808 of 17 seconds executing testcases

Completed: All 5 tests were successful.

Basing the PR against the correct MariaDB version

  • This is a bug fix, and the PR is based against the main branch.

Copyright

All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

mariadb-backup --copy-back was not creating the mariadb_upgrade_info
file in the restored datadir, causing unnecessary upgrade prompts
after restore.

The file is now created with the server version string to prevent
mariadb-upgrade from incorrectly detecting that an upgrade is needed.

All new code of the whole pull request, including one or several
files that are either new files or modified ones, are contributed
under the BSD-new license. I am contributing on behalf of my
employer Amazon Web Services, Inc.
@FarihaIS FarihaIS changed the title MDEV-34713 Create mysql_upgrade_info during mariadb-backup --copy-back MDEV-34713 Create mariadb_upgrade_info during mariadb-backup --copy-back Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants