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

Bug #935847 reported by Igor Tverdovskiy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona XtraBackup moved to https://jira.percona.com/projects/PXB
Fix Released
Low
Igor Tverdovskiy
2.0
Fix Released
Low
Igor Tverdovskiy
2.1
Fix Released
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) {
==

Tags: empty is not

Related branches

Changed in percona-xtrabackup:
assignee: nobody → Igor Tverdovskiy (igor-tverdovskiy)
Revision history for this message
Igor Tverdovskiy (igor-tverdovskiy) wrote :

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

Revision history for this message
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
Revision history for this message
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)
Changed in percona-xtrabackup:
status: Confirmed → Fix Committed
milestone: none → 2.0.1
importance: Undecided → Low
Stewart Smith (stewart)
Changed in percona-xtrabackup:
status: Fix Committed → Fix Released
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PXB-845

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.