running a backup without "datadir" in my.cnf copies data from / instead of mysql data directory
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona XtraBackup moved to https://jira.percona.com/projects/PXB |
Triaged
|
Low
|
Unassigned | ||
2.1 |
Won't Fix
|
Undecided
|
Unassigned | ||
2.2 |
Triaged
|
Low
|
Unassigned | ||
2.3 |
Triaged
|
Low
|
Unassigned |
Bug Description
If you run xtrabackup as a normal user, not root, and there is no datadir on the my.cnf, it starts to copy server's storage content instead of mysql.
root@hbase:~# sudo su - mysql
mysql@hbase:/$ strace xtrabackup --backup --target-dir=/tmp
[...]
open("/
open("/
[...]
stat("./undo001", 0x7fffbe521cd0) = -1 ENOENT (No such file or directory)
open("./undo001", O_RDONLY) = -1 ENOENT (No such file or directory)
open(".", O_RDONLY|
getdents(6, /* 26 entries */, 32768) = 680
stat("./proc", {st_mode=
open("./proc", O_RDONLY|
getdents(7, /* 119 entries */, 32768) = 3184
stat(".
stat("./proc/dri", {st_mode=
stat(".
stat(".
stat(".
stat(".
stat(".
stat("./proc/keys", {st_mode=
stat(".
stat(".
stat("./proc/kmsg", {st_mode=
stat(".
stat(".
stat(".
stat(".
stat("./proc/stat", {st_mode=
[...]
tat("./bin/zmore", {st_mode=
stat(".
stat(".
stat("./bin/echo", {st_mode=
stat("./bin/bzcmp", {st_mode=
stat(".
stat(".
stat("./bin/mt", {st_mode=
stat(".
stat(".
stat(".
stat(".
stat(".
stat(".
[...]
write(2, "2014-10-02 04:05:39 7fec22f64720", 322014-10-02 04:05:39 7fec22f64720) = 32
write(2, " InnoDB: Operating system error"..., 64 InnoDB: Operating system error number 13 in a file operation.
) = 64
write(2, "InnoDB: The error means mysqld d"..., 89InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
This also makes PXC to fail, because SST is run under mysql user:
xtrabackup version 2.2.4 based on MySQL server 5.6.17 Linux (x86_64) (revision id: )
xtrabackup: uses posix_fadvise().
xtrabackup: cd to
xtrabackup: open files limit requested 65535, set to 65535
xtrabackup: using the following InnoDB configuration:
xtrabackup: innodb_
xtrabackup: innodb_
xtrabackup: innodb_
xtrabackup: innodb_
xtrabackup: innodb_
xtrabackup: using O_DIRECT
>> log scanned up to (689721549)
2014-10-02 04:02:02 7f60b6b33720 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
innobackupex: Error: The xtrabackup child process has died at /usr//bin/
ii percona-xtrabackup 2.2.4-5004-1.wheezy amd64 Open source backup tool for InnoDB and XtraDB
tags: | added: low-hanging-fruit |
This is the my.cnf I used when trying to reproduce another bug:
[client] default- character- set = utf8mb4
loose-
port = 3306
[isamchk]
key_buffer = 16M
[mysql] character- set = utf8mb4 packet = 64M
default-
max_allowed_
[mysqld] set-client- handshake = FALSE set-server = utf8mb4 storage- engine = INNODB connection = utf8mb4_unicode_ci; SET NAMES utf8mb4' autoinc_ lock_mode = 2 file_format = Barracuda file_per_ table = true flush_log_ at_trx_ commit = 0 flush_method = O_DIRECT large_prefix = true lock_wait_ timeout = 30 locks_unsafe_ for_binlog = 1 log_buffer_ size = 8M log_file_ size = 50331648
binlog_cache_size = 32M
binlog_format = ROW
character-
character-
collation-server = utf8mb4_unicode_ci
default-
expire_logs_days = 10
init-connect = 'SET collation_
innodb_
innodb_
innodb_
innodb_
innodb_
innodb_
innodb_
innodb_
innodb_
innodb_
key_buffer = 16M verbosity = microtime, query_plan, innodb packet = 64M table_size = 67108864 external- locking = true SUBSTITUTION definition_ cache = 1024 causal_ reads = ON cluster_ address = gcomm:/ /192.168. 1.106,192. 168.1.107, 192.168. 1.108 cluster_ name = mycluster node_address = 192.168.1.106 libgalera_ smm.so slave_threads = 64 data_home_ dir = /var/lib/mysql log_group_ home_dir = /var/lib/mysql character- set = latin1
log_bin = mysql-bin.log
log_error = error.log
log_slave_updates = true
log_slow_
long_query_time = 1
max_allowed_
max_binlog_size = 100M
max_connections = 800
max_heap_
myisam-recover = BACKUP
open_files_limit = 65535
port = 3306
query_cache_size = 0
query_cache_type = 0
server-id = 2127359171
skip-
slave-net-timeout = 10
sql-mode = NO_ENGINE_
table_
table_open_cache = 2048
thread_cache_size = 80
thread_stack = 192K
thread_statistics = OFF
tmp_table_size = 67108864
user = mysql
userstat = ON
wsrep_OSU_method = TOI
wsrep_
wsrep_
wsrep_
wsrep_
wsrep_node_name = xtradb1
wsrep_provider = /usr/lib/
wsrep_
wsrep_sst_auth = sst:sst
wsrep_sst_method = xtrabackup-v2
innodb_
innodb_
[xtrabackup]
default-