Merge lp:~akopytov/percona-xtrabackup/bug930062-2.0 into lp:percona-xtrabackup/2.0

Proposed by Alexey Kopytov
Status: Merged
Approved by: Sergei Glushchenko
Approved revision: no longer in the source branch.
Merged at revision: 509
Proposed branch: lp:~akopytov/percona-xtrabackup/bug930062-2.0
Merge into: lp:percona-xtrabackup/2.0
Diff against target: 125 lines (+68/-13)
4 files modified
doc/source/xtrabackup_bin/exporting_importing_tables.rst (+2/-2)
src/xtrabackup.cc (+5/-3)
test/t/bug930062.sh (+61/-0)
test/t/xb_export.sh (+0/-8)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/bug930062-2.0
Reviewer Review Type Date Requested Status
Sergei Glushchenko (community) g2 Approve
Review via email: mp+152107@code.launchpad.net

Description of the change

  Bug #930062: Innobackupex doesn't add file-per-table setting for
               table-independent backups

  Made xtrabackup auto-enable innodb_file_per_table when the --export
  option is used and updated xb_export.sh and docs accordingly.

http://jenkins.percona.com/view/XtraBackup/job/percona-xtrabackup-2.0-param/358/

To post a comment you must log in.
Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote :

Approve

review: Approve (g2)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'doc/source/xtrabackup_bin/exporting_importing_tables.rst'
2--- doc/source/xtrabackup_bin/exporting_importing_tables.rst 2011-07-07 05:32:50 +0000
3+++ doc/source/xtrabackup_bin/exporting_importing_tables.rst 2013-03-07 08:14:29 +0000
4@@ -18,9 +18,9 @@
5 $ find /data/backups/mysql/ -name export_test.*
6 /data/backups/mysql/test/export_test.ibd
7
8-when you prepare the backup, add the extra parameter :option:`--export` to the command. If you do not have :term:`innodb_file_per_table` in your `my.cnf`, you must add that to the command-line options. Here is an example: ::
9+when you prepare the backup, add the extra parameter :option:`--export` to the command. Here is an example: ::
10
11- $ xtrabackup --prepare --export --innodb-file-per-table --target-dir=/data/backups/mysql/
12+ $ xtrabackup --prepare --export --target-dir=/data/backups/mysql/
13
14 Now you should see a :term:`.exp` file in the target directory: ::
15
16
17=== modified file 'src/xtrabackup.cc'
18--- src/xtrabackup.cc 2013-03-01 06:54:51 +0000
19+++ src/xtrabackup.cc 2013-03-07 08:14:29 +0000
20@@ -7208,6 +7208,8 @@
21 if (innobase_doublewrite_file != NULL) {
22 printf("innodb_doublewrite_file = %s\n", innobase_doublewrite_file);
23 }
24+ printf("innodb_file_per_table = %d\n",
25+ (int) innobase_file_per_table);
26 #endif
27 exit(EXIT_SUCCESS);
28 }
29@@ -7231,9 +7233,9 @@
30 }
31
32 if (xtrabackup_export && innobase_file_per_table == FALSE) {
33- msg("xtrabackup: error: --export option can only "
34- "be used with --innodb-file-per-table=ON.\n");
35- exit(EXIT_FAILURE);
36+ msg("xtrabackup: auto-enabling --innodb-file-per-table due to "
37+ "the --export option\n");
38+ innobase_file_per_table = TRUE;
39 }
40
41 if (xtrabackup_incremental && xtrabackup_stream &&
42
43=== added file 'test/t/bug930062.sh'
44--- test/t/bug930062.sh 1970-01-01 00:00:00 +0000
45+++ test/t/bug930062.sh 2013-03-07 08:14:29 +0000
46@@ -0,0 +1,61 @@
47+########################################################################
48+# Bug #930062: Innobackupex doesn't add file-per-table setting for
49+# table-independent backups
50+########################################################################
51+
52+. inc/common.sh
53+
54+if [ -z "$XTRADB_VERSION" ]; then
55+ echo "Requires XtraDB" > $SKIPPED_REASON
56+ exit $SKIPPED_EXIT_CODE
57+fi
58+
59+if [ ${MYSQL_VERSION:0:3} = "5.5" ]
60+then
61+ import_option="--innodb_import_table_from_xtrabackup=1"
62+else
63+ import_option="--innodb_expand_import=1"
64+fi
65+
66+mysql_extra_args="--innodb_file_per_table $import_option"
67+
68+start_server $mysql_extra_args
69+
70+backup_dir=$topdir/backup
71+
72+load_dbase_schema sakila
73+load_dbase_data sakila
74+
75+checksum_1=`checksum_table sakila actor`
76+
77+innobackupex --no-timestamp --include='actor' $backup_dir
78+
79+stop_server
80+
81+# Test that there's no innodb_file_per_table = 1 in any of configuration sources
82+cnt=`xtrabackup --print-param | grep -c 'innodb_file_per_table = 1' || true`
83+if [ "$cnt" -ne 0 ]
84+then
85+ vlog "innodb_file_per_table is enabled by default"
86+ exit 1
87+fi
88+
89+innobackupex --apply-log --export $backup_dir
90+
91+start_server $mysql_extra_args
92+
93+run_cmd ${MYSQL} ${MYSQL_ARGS} sakila <<EOF
94+SET foreign_key_checks=0;
95+ALTER TABLE actor DISCARD TABLESPACE;
96+EOF
97+
98+run_cmd cp $backup_dir/sakila/actor* $MYSQLD_DATADIR/sakila/
99+run_cmd ${MYSQL} ${MYSQL_ARGS} -e "ALTER TABLE actor IMPORT TABLESPACE" sakila
100+
101+checksum_2=`checksum_table sakila actor`
102+
103+if [ "$checksum_1" != "$checksum_2" ]
104+then
105+ vlog "Table checksums mismatch."
106+ exit 1
107+fi
108
109=== modified file 'test/t/xb_export.sh'
110--- test/t/xb_export.sh 2012-10-15 16:14:59 +0000
111+++ test/t/xb_export.sh 2013-03-07 08:14:29 +0000
112@@ -54,14 +54,6 @@
113
114 run_cmd ${MYSQL} ${MYSQL_ARGS} -e "alter table test discard tablespace;" incremental_sample
115
116-# Test the with innodb_file_per_table=0 --export bails out with an error
117-# (bug #758888)
118-
119-run_cmd_expect_failure $XB_BIN $XB_ARGS --datadir=$mysql_datadir --prepare \
120- --export --target-dir=$backup_dir --innodb-file-per-table=0
121-
122-XB_ARGS="$XB_ARGS --innodb-file-per-table=1"
123-
124 xtrabackup --datadir=$mysql_datadir --prepare --export \
125 --target-dir=$backup_dir
126

Subscribers

People subscribed via source and target branches