Merge lp:~sergei.glushchenko/percona-xtrabackup/bug711166_part-1.6 into lp:percona-xtrabackup/2.0

Proposed by Sergei Glushchenko
Status: Rejected
Rejected by: Alexey Kopytov
Proposed branch: lp:~sergei.glushchenko/percona-xtrabackup/bug711166_part-1.6
Merge into: lp:percona-xtrabackup/2.0
Diff against target: 194 lines (+163/-0)
4 files modified
innobackupex (+2/-0)
test/t/bug711166-innodb.sh (+77/-0)
test/t/bug711166-myisam.sh (+79/-0)
xtrabackup.c (+5/-0)
To merge this branch: bzr merge lp:~sergei.glushchenko/percona-xtrabackup/bug711166_part-1.6
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Needs Resubmitting
Review via email: mp+91014@code.launchpad.net

Description of the change

Merge of fix for 1.6 series

To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) wrote :

Sergei,

Please merge to a separate trunk-based tree, and run it through Jenkins before submitting a MP.

I also have some comments on the 1.6 version of the fix.

review: Needs Resubmitting

Unmerged revisions

348. By Sergei Glushchenko

Partitioned tables are not correctly handled by the --databases, --include,
--tables-file options of innobackupex, and by the --tables and
--tables-file options of xtrabackup.
Solution is to remove partition suffix (#P#...) before doing filtering.
Testcases cover variants of using filtering options with MyISAM and
InnoDB tables (to test both innobackupex and xtrabackup) with either stream
mode turned on and turned off.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'innobackupex'
--- innobackupex 2012-01-31 01:46:10 +0000
+++ innobackupex 2012-02-01 04:33:50 +0000
@@ -2345,6 +2345,8 @@
2345 $filename = (reverse(split(/\//, $table_path)))[0];2345 $filename = (reverse(split(/\//, $table_path)))[0];
2346 # get name of the table by removing file suffix2346 # get name of the table by removing file suffix
2347 $table = (split(/\./, $filename))[0];2347 $table = (split(/\./, $filename))[0];
2348 # and partition suffix
2349 $table = (split('#P#', $table))[0];
2348 }2350 }
2349 }2351 }
23502352
23512353
=== added file 'test/t/bug711166-innodb.sh'
--- test/t/bug711166-innodb.sh 1970-01-01 00:00:00 +0000
+++ test/t/bug711166-innodb.sh 2012-02-01 04:33:50 +0000
@@ -0,0 +1,77 @@
1########################################################################
2# Bug #711166: If xtrabackup is being used with --tables-file option
3# (and the table list contains partitioned table) - only
4# *.par files are being backed up.
5########################################################################
6
7. inc/common.sh
8
9init
10run_mysqld --innodb_file_per_table
11
12mkdir -p $topdir/ext
13
14# Create InnoDB partitioned table
15run_cmd $MYSQL $MYSQL_ARGS test <<EOF
16CREATE TABLE test (
17 a int(11) DEFAULT NULL
18) ENGINE=InnoDB DEFAULT CHARSET=latin1
19PARTITION BY RANGE (a)
20(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
21 PARTITION P1 VALUES LESS THAN (200) ENGINE = InnoDB,
22 PARTITION p2 VALUES LESS THAN (300) ENGINE = InnoDB,
23 PARTITION p3 VALUES LESS THAN (400) ENGINE = InnoDB,
24 PARTITION p4 VALUES LESS THAN MAXVALUE ENGINE = InnoDB);
25EOF
26
27# Adding 500 rows
28
29vlog "Adding initial rows to database..."
30
31numrow=500
32count=0
33while [ "$numrow" -gt "$count" ]
34do
35 ${MYSQL} ${MYSQL_ARGS} -e "insert into test values ($count);" test
36 let "count=count+1"
37done
38
39# Saving the checksum of original table
40checksum_a=`checksum_table test test`
41
42# Take a backup
43# Only backup of test.test table will be taken
44cat >$topdir/tables <<EOF
45test.test
46EOF
47xtrabackup --datadir=$mysql_datadir --backup --target-dir=$topdir/backup \
48 --tables-file=$topdir/tables
49vlog "Backup taken"
50xtrabackup --datadir=$mysql_datadir --prepare --target-dir=$topdir/backup
51vlog "Backup prepared"
52
53stop_mysqld
54
55# Remove original table
56rm $mysql_datadir/test/test*.ibd
57rm -rf $topdir/ext/*
58vlog "Original test.test removed"
59
60# Restore test.test from backup
61cp -r $topdir/backup/* $mysql_datadir
62vlog "test.test copied from backup"
63
64run_mysqld
65
66vlog "Cheking checksums"
67checksum_b=`checksum_table test test`
68
69vlog "Checksums are $checksum_a and $checksum_b"
70
71if [ "$checksum_a" != "$checksum_b" ]
72then
73 vlog "Checksums are not equal"
74 exit -1
75fi
76
77vlog "Checksums are OK"
078
=== added file 'test/t/bug711166-myisam.sh'
--- test/t/bug711166-myisam.sh 1970-01-01 00:00:00 +0000
+++ test/t/bug711166-myisam.sh 2012-02-01 04:33:50 +0000
@@ -0,0 +1,79 @@
1########################################################################
2# Bug #711166: If innobackupex is being used with --tables-file option
3# (and the table list contains partitioned table) - only
4# *.par files are being backed up.
5########################################################################
6
7. inc/common.sh
8
9init
10run_mysqld
11
12mkdir -p $topdir/ext
13
14# Create MyISAM partitioned table with some partitions in
15# different location
16run_cmd $MYSQL $MYSQL_ARGS test <<EOF
17CREATE TABLE test (
18 a int(11) DEFAULT NULL
19) ENGINE=MyISAM DEFAULT CHARSET=latin1
20PARTITION BY RANGE (a)
21(PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM,
22 PARTITION P1 VALUES LESS THAN (200) ENGINE = MyISAM,
23 PARTITION p2 VALUES LESS THAN (300)
24 DATA DIRECTORY = '$topdir/ext' INDEX DIRECTORY = '$topdir/ext'
25 ENGINE = MyISAM,
26 PARTITION p3 VALUES LESS THAN (400)
27 DATA DIRECTORY = '$topdir/ext' INDEX DIRECTORY = '$topdir/ext'
28 ENGINE = MyISAM,
29 PARTITION p4 VALUES LESS THAN MAXVALUE ENGINE = MyISAM);
30EOF
31
32# Adding 500 rows
33
34vlog "Adding initial rows to database..."
35
36numrow=500
37count=0
38while [ "$numrow" -gt "$count" ]
39do
40 ${MYSQL} ${MYSQL_ARGS} -e "insert into test values ($count);" test
41 let "count=count+1"
42done
43
44# Saving the checksum of original table
45checksum_a=`checksum_table test test`
46
47# Take a backup
48# Only backup of test.test table will be taken
49cat >$topdir/tables <<EOF
50test.test
51EOF
52$IB_BIN $IB_ARGS --no-timestamp --tables-file=$topdir/tables $topdir/backup
53vlog "Backup taken"
54
55stop_mysqld
56
57# Remove original table
58rm $mysql_datadir/test/test*
59rm -rf $topdir/ext/*
60vlog "Original test.test removed"
61
62# Restore test.test from backup
63cp -r $topdir/backup/* $mysql_datadir
64vlog "test.test copied from backup"
65
66run_mysqld
67
68vlog "Cheking checksums"
69checksum_b=`checksum_table test test`
70
71vlog "Checksums are $checksum_a and $checksum_b"
72
73if [ "$checksum_a" != "$checksum_b" ]
74then
75 vlog "Checksums are not equal"
76 exit -1
77fi
78
79vlog "Checksums are OK"
080
=== modified file 'xtrabackup.c'
--- xtrabackup.c 2012-01-31 01:46:10 +0000
+++ xtrabackup.c 2012-02-01 04:33:50 +0000
@@ -2877,6 +2877,11 @@
2877 p = next + 1;2877 p = next + 1;
2878 }2878 }
2879 p_len = strlen(p) - strlen(".ibd");2879 p_len = strlen(p) - strlen(".ibd");
2880 /* in case file is parttition of a table it contains #P# magic
2881 after the table name.
2882 */
2883 if ((next = strstr(p, "#P#")) != NULL)
2884 p_len = next - p;
28802885
2881 if (p_len < 1) {2886 if (p_len < 1) {
2882 /* unknown situation: skip filtering */2887 /* unknown situation: skip filtering */

Subscribers

People subscribed via source and target branches