LP #935847: innobackupex failed to copy-back backup if destination dir is not empty

Description

**Reported in Launchpad by Igor Tverdovskiy last update 23-05-2012 15:06:13

Hi,

innobackupex requires empty destination dir in order to copy backup to it. I think this is wrong behaviour, because target dir could/should contain custom my.cnf or master.info files. In such a case innobackupex should not consider non empty dir as error.

How to reproduce:
==
> ls -lh /var/192.168.1.7/mysql/
total 8,0K
rw-rw--- 1 mysql mysql 69 Feb 18 23:08 master.info
rw-r---- 1 mysql mysql 404 Feb 18 23:09 my.cnf
==

> sudo innobackupex --copy-back /var/tmps/backup
===
Original data directory is not empty! at /usr/bin/innobackupex line 574.
===

Fix:
I have modified template which decides whether directory is empty or not.
==
--if ( ! scalar( grep { $_ ne "." && $_ ne ".." } readdir($dh)) == 0) {
++if ( ! scalar( grep { $_ ne "." && $_ ne ".." && $_ ne "my.cnf" && $_ ne "master.info"} readdir($dh)) == 0) {
==

Environment

None

Smart Checklist

Activity

Show:

lpjirasync January 19, 2018 at 6:12 PM

**Comment from Launchpad by: Alexey Kopytov on: 22-03-2012 04:27:53

datadir is the default location for master.info. I don't see any problems with adding those exceptions, as XtraBackup does not backup those files, so it won't overwrite anything.

lpjirasync January 19, 2018 at 6:12 PM

**Comment from Launchpad by: Valentine Gostev on: 19-02-2012 07:09:25

It is not very good practice to keep my.cnf and master.info in datadir, much safer to keep it at external location, that's why explicit check for empty directory was added in https://bugs.launchpad.net/percona-xtrabackup/+bug/737569

Anyway, if you need such exceptions current approach is not reasonable, I would recommend to add an option, which could accept a list of files to ignore.

lpjirasync January 19, 2018 at 6:12 PM

**Comment from Launchpad by: Igor Tverdovskiy on: 18-02-2012 23:56:23

also it should be backported to 1.6 release, changes are the same...

Done

Details

Assignee

Reporter

Priority

Smart Checklist

Created January 19, 2018 at 6:12 PM
Updated January 19, 2018 at 6:12 PM
Resolved January 19, 2018 at 6:12 PM