Merge lp:~akopytov/percona-xtrabackup/bug1418820-2.3 into lp:percona-xtrabackup/2.3

Proposed by Alexey Kopytov on 2015-02-09
Status: Merged
Approved by: Alexey Kopytov on 2015-02-09
Approved revision: 5067
Merged at revision: 5067
Proposed branch: lp:~akopytov/percona-xtrabackup/bug1418820-2.3
Merge into: lp:percona-xtrabackup/2.3
Diff against target: 101 lines (+41/-3)
3 files modified
storage/innobase/xtrabackup/doc/source/innobackupex/innobackupex_option_reference.rst (+5/-0)
storage/innobase/xtrabackup/innobackupex.pl (+11/-3)
storage/innobase/xtrabackup/test/t/backup_locks.sh (+25/-0)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/bug1418820-2.3
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Approve on 2015-02-09
Review via email: mp+249041@code.launchpad.net
To post a comment you must log in.
Alexey Kopytov (akopytov) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'storage/innobase/xtrabackup/doc/source/innobackupex/innobackupex_option_reference.rst'
2--- storage/innobase/xtrabackup/doc/source/innobackupex/innobackupex_option_reference.rst 2015-01-16 17:52:02 +0000
3+++ storage/innobase/xtrabackup/doc/source/innobackupex/innobackupex_option_reference.rst 2015-02-09 09:06:14 +0000
4@@ -14,6 +14,11 @@
5
6 Prepare a backup in ``BACKUP-DIR`` by applying the transaction log file named :file:`xtrabackup_logfile` located in the same directory. Also, create new transaction logs. The InnoDB configuration is read from the file :file:`backup-my.cnf` created by |innobackupex| when the backup was made. innobackupex --apply-log uses InnoDB configuration from ``backup-my.cnf`` by default, or from --defaults-file, if specified. InnoDB configuration in this context means server variables that affect data format, i.e. :option:`innodb_page_size`, :option:`innodb_log_block_size`, etc. Location-related variables, like :option:`innodb_log_group_home_dir` or :option:`innodb_data_file_path` are always ignored by --apply-log, so preparing a backup always works with data files from the backup directory, rather than any external ones.
7
8+.. option:: --backup-locks
9+
10+ This option controls if backup locks should be used instead of FLUSH TABLES WITH READ LOCK on the backup stage. The option has no effect when backup locks are not supported by the server. This option is enabled by default, disable with ``--no-backup-locks``.
11+
12+
13 .. option:: --close-files
14
15 Do not keep files opened. This option is passed directly to xtrabackup. When xtrabackup opens tablespace it normally doesn't close its file handle in order to handle the DDL operations correctly. However, if the number of tablespaces is really huge and can not fit into any limit, there is an option to close file handles once they are no longer accessed. |Percona XtraBackup| can produce inconsistent backups with this option enabled. Use at your own risk.
16
17=== modified file 'storage/innobase/xtrabackup/innobackupex.pl'
18--- storage/innobase/xtrabackup/innobackupex.pl 2015-01-31 11:37:13 +0000
19+++ storage/innobase/xtrabackup/innobackupex.pl 2015-02-09 09:06:14 +0000
20@@ -159,6 +159,8 @@
21 my $option_incremental_history_name = '';
22 my $option_incremental_history_uuid = '';
23
24+my $option_backup_locks = '1';
25+
26 # name of the my.cnf configuration file
27 #my $config_file = '';
28
29@@ -1701,7 +1703,7 @@
30 END {
31 # We only want to execute this in the parent script process, and ignore
32 # for all child processes it may spawn
33- if ($$ == $innobackupex_pid) {
34+ if (defined ($innobackupex_pid) and $$ == $innobackupex_pid) {
35 kill_child_processes();
36 }
37 }
38@@ -3851,7 +3853,8 @@
39 \$option_ftwrl_wait_query_type,
40 'version-check!' => \$option_version_check,
41 'force-non-empty-directories' =>
42- \$option_force_non_empty_dirs
43+ \$option_force_non_empty_dirs,
44+ 'backup-locks!' => \$option_backup_locks
45 );
46
47 if ($option_help) {
48@@ -4980,7 +4983,8 @@
49 get_mysql_slave_status($con);
50 }
51
52- $have_backup_locks = defined($con->{vars}->{have_backup_locks});
53+ $have_backup_locks = $option_backup_locks &&
54+ defined($con->{vars}->{have_backup_locks});
55
56 $have_galera_enabled = defined($con->{vars}->{wsrep_on});
57
58@@ -5358,6 +5362,10 @@
59
60 Prepare a backup in BACKUP-DIR by applying the transaction log file named "xtrabackup_logfile" located in the same directory. Also, create new transaction logs. The InnoDB configuration is read from the file "backup-my.cnf".
61
62+=item --backup-locks
63+
64+This option controls if backup locks should be used instead of FLUSH TABLES WITH READ LOCK on the backup stage. The option has no effect when backup locks are not supported by the server. This option is enabled by default, disable with --no-backup-locks.
65+
66 =item --close-files
67
68 Do not keep files opened. This option is passed directly to xtrabackup. Use at your own risk.
69
70=== modified file 'storage/innobase/xtrabackup/test/t/backup_locks.sh'
71--- storage/innobase/xtrabackup/test/t/backup_locks.sh 2014-09-04 16:53:33 +0000
72+++ storage/innobase/xtrabackup/test/t/backup_locks.sh 2015-02-09 09:06:14 +0000
73@@ -49,3 +49,28 @@
74 Com_unlock_tables 2
75 Com_flush 2
76 EOF
77+
78+########################################################################
79+# Bug #1418820: Make backup locks usage optional
80+########################################################################
81+
82+# Test that --no-backup-lock forces FTWRL
83+
84+rm -rf $topdir/full_backup
85+
86+innobackupex --no-timestamp --no-backup-locks $topdir/full_backup
87+
88+$MYSQL $MYSQL_ARGS -Ns -e \
89+ "SHOW GLOBAL STATUS LIKE 'Com_%lock%'; \
90+ SHOW GLOBAL STATUS LIKE 'Com_flush%'" \
91+ > $topdir/status3
92+
93+diff $topdir/status3 - <<EOF
94+Com_lock_tables 0
95+Com_lock_tables_for_backup 2
96+Com_lock_binlog_for_backup 2
97+Com_show_slave_status_nolock 0
98+Com_unlock_binlog 2
99+Com_unlock_tables 3
100+Com_flush 4
101+EOF

Subscribers

People subscribed via source and target branches

to all changes: