innobackupex failed to copy-back backup if destination dir is not empty

Reported by Igor Tverdovskiy on 2012-02-18
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona XtraBackup
Low
Igor Tverdovskiy
2.0
Low
Igor Tverdovskiy
2.1
Low
Igor Tverdovskiy

Bug Description

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) {
==

Related branches

lp:~igor-tverdovskiy/percona-xtrabackup/bug_935847
Merged into lp:percona-xtrabackup/2.0 at revision 429
Stewart Smith (community): Approve on 2012-05-21
Valentine Gostev (community): Needs Fixing on 2012-02-19
Alexey Kopytov: Pending requested 2012-02-18
Changed in percona-xtrabackup:
assignee: nobody → Igor Tverdovskiy (igor-tverdovskiy)

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

Valentine Gostev (longbow) wrote :

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.

Changed in percona-xtrabackup:
status: New → Incomplete
Alexey Kopytov (akopytov) wrote :

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.

Changed in percona-xtrabackup:
status: Incomplete → Confirmed
Stewart Smith (stewart) on 2012-05-21
Changed in percona-xtrabackup:
status: Confirmed → Fix Committed
milestone: none → 2.0.1
importance: Undecided → Low
Stewart Smith (stewart) on 2012-05-21
Changed in percona-xtrabackup:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers