xtrabackup --copy-back tries to create directories in the backup directory (src), which may cause the operation to fail if it receives a "permission denied" error

Description

When running xtrabackup --copy-back it chdir() into the backup directory and tries to mkdir() into this directory.

We had a case with a customer where the NFS mount point didn't have write permissions and it will fail. It is very common that the source (backup) directory will be read-only. Is this an intended operation? It is common for the backup directory to be a read-only NFS that you mount in the database server you want to restore, which causes this mkdir operation to fail. The directory is necessary on the new data directory, but it is unclear why xtrabackup attempts to recreate it on the directory where the backup was created.

I found out it tries to create any directory that is not a database. For example:

Unfortunately, I couldn't reproduce the same error as our customer but it is clear from the strace that it tries to mkdir for each new directory created in the backup after the prepare. In my tests even if mkdir() returns an error (-1 EEXIST (File exists)) because the d
irectory exists the copy doesn't fail as when it receives a permission denied.

Environment

None

AFFECTED CS IDs

CS0046357

Activity

Details

Assignee

Reporter

Needs QA

Yes

Affects versions

Priority

Smart Checklist

Created May 17, 2024 at 9:45 PM
Updated May 20, 2024 at 5:06 PM