Merge lp:~sergei.glushchenko/percona-xtrabackup/xb21-partial into lp:percona-xtrabackup/2.1

Proposed by Sergei Glushchenko
Status: Superseded
Proposed branch: lp:~sergei.glushchenko/percona-xtrabackup/xb21-partial
Merge into: lp:percona-xtrabackup/2.1
Diff against target: 917 lines (+601/-162) (has conflicts)
9 files modified
innobackupex (+23/-6)
src/xtrabackup.c (+236/-156)
test/inc/ib_part.sh (+92/-0)
test/t/ib_part_databases.sh (+39/-0)
test/t/ib_part_include.sh (+47/-0)
test/t/ib_part_include_stream.sh (+39/-0)
test/t/ib_part_tf_innodb.sh (+46/-0)
test/t/ib_part_tf_innodb_stream.sh (+40/-0)
test/t/ib_part_tf_myisam.sh (+39/-0)
Text conflict in src/xtrabackup.c
To merge this branch: bzr merge lp:~sergei.glushchenko/percona-xtrabackup/xb21-partial
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Needs Fixing
Review via email: mp+136016@code.launchpad.net

This proposal has been superseded by a proposal from 2012-12-07.

Description of the change

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.

http://jenkins.percona.com/view/XtraBackup/job/percona-xtrabackup-2.1-param/89/

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'innobackupex'
2--- innobackupex 2012-11-29 04:25:17 +0000
3+++ innobackupex 2012-12-07 11:29:22 +0000
4@@ -1993,7 +1993,8 @@
5 next unless check_if_required($database, $file);
6
7 if($option_include) {
8- if (!("$database.$file" =~ /$option_include/)) {
9+ my $table_name = get_table_name($file);
10+ if (!("$database.$table_name" =~ /$option_include/)) {
11 print STDERR "$database.$file is skipped because it does not match $option_include.\n";
12 next;
13 }
14@@ -2315,6 +2316,26 @@
15 return ${$group_hash_ref}{$option_name};
16 }
17
18+# get_table_name subroutine returns table name of specified file.
19+# Parameters:
20+# $_[0] table path
21+# Return value:
22+# 1 table name
23+#
24+sub get_table_name {
25+ my $table_path = shift;
26+ my $filename;
27+ my $table;
28+
29+ # get the last component in the table pathname
30+ $filename = (reverse(split(/\//, $table_path)))[0];
31+ # get name of the table by removing file suffix
32+ $table = (split(/\./, $filename))[0];
33+ # and partition suffix
34+ $table = (split('#P#', $table))[0];
35+
36+ return $table;
37+}
38
39 # check_if_required subroutine returns 1 if the specified database and
40 # table needs to be backed up.
41@@ -2328,7 +2349,6 @@
42 my ( $db, $table_path ) = @_;
43 my $db_count = scalar keys %databases_list;
44 my $tbl_count = scalar keys %table_list;
45- my $filename;
46 my $table;
47
48 if ( $db_count == 0 && $tbl_count == 0 ) {
49@@ -2338,10 +2358,7 @@
50 }
51 else {
52 if ( $table_path ) {
53- # get the last component in the table pathname
54- $filename = (reverse(split(/\//, $table_path)))[0];
55- # get name of the table by removing file suffix
56- $table = (split(/\./, $filename))[0];
57+ $table = get_table_name($table_path);
58 }
59 }
60
61
62=== modified file 'src/xtrabackup.c'
63--- src/xtrabackup.c 2012-11-21 13:51:49 +0000
64+++ src/xtrabackup.c 2012-12-07 11:29:22 +0000
65@@ -1500,6 +1500,7 @@
66 }
67 }
68
69+<<<<<<< TREE
70 /************************************************************************
71 Checks if a table specified as a path should be skipped from backup
72 based on the --tables or --tables-file options.
73@@ -1576,6 +1577,84 @@
74 return(TRUE);
75 }
76
77+=======
78+/************************************************************************
79+Checks if a table specified as a path should be skipped from backup
80+based on the --tables or --tables-file options.
81+
82+@return TRUE if the table should be skipped. */
83+static
84+my_bool
85+check_if_skip_table(
86+/******************/
87+ char* path, /*!< in: path to the table */
88+ char* suffix) /*!< in: suffix */
89+{
90+ char buf[FN_REFLEN];
91+ const char *dbname, *tbname;
92+ const char *ptr;
93+ char *eptr;
94+ int dbname_len;
95+
96+ if (xtrabackup_tables == NULL && xtrabackup_tables_file == NULL) {
97+ return(FALSE);
98+ }
99+
100+ dbname = NULL;
101+ tbname = path;
102+ while ((ptr = strstr(tbname, SRV_PATH_SEPARATOR_STR)) != NULL) {
103+ dbname = tbname;
104+ tbname = ptr + 1;
105+ }
106+
107+ if (dbname == NULL) {
108+ return(FALSE);
109+ }
110+
111+ strncpy(buf, dbname, FN_REFLEN);
112+ buf[FN_REFLEN - 1] = 0;
113+ buf[tbname - 1 - dbname] = '.';
114+
115+ dbname_len = strlen(dbname) - strlen(suffix);
116+ if (dbname_len < 1) {
117+ return(FALSE);
118+ }
119+ buf[dbname_len - 1] = 0;
120+
121+ if ((eptr = strstr(buf, "#P#")) != NULL) {
122+ *eptr = 0;
123+ }
124+
125+ if (xtrabackup_tables) {
126+ int regres = REG_NOMATCH;
127+ int i;
128+ for (i = 0; i < tables_regex_num; i++) {
129+ regres = xb_regexec(&tables_regex[i], buf, 1,
130+ tables_regmatch, 0);
131+ if (regres != REG_NOMATCH) {
132+ break;
133+ }
134+ }
135+ if (regres == REG_NOMATCH) {
136+ return(TRUE);
137+ }
138+ }
139+
140+ if (xtrabackup_tables_file) {
141+ xtrabackup_tables_t* table;
142+
143+ XB_HASH_SEARCH(name_hash, tables_hash, ut_fold_string(buf),
144+ table, ut_ad(table->name),
145+ !strcmp(table->name, buf));
146+ if (!table) {
147+ return(TRUE);
148+ }
149+ }
150+
151+ return(FALSE);
152+}
153+
154+>>>>>>> MERGE-SOURCE
155 /***********************************************************************
156 Reads the space flags from a given data file and returns the compressed
157 page size, or 0 if the space is not compressed. */
158@@ -1611,6 +1690,7 @@
159 my_bool
160 xtrabackup_copy_datafile(fil_node_t* node, uint thread_n)
161 {
162+<<<<<<< TREE
163 char dst_name[FN_REFLEN];
164 ds_file_t *dstfile = NULL;
165 xb_fil_cur_t cursor;
166@@ -1626,6 +1706,23 @@
167
168 res = xb_fil_cur_open(&cursor, node, thread_n);
169 if (res == XB_FIL_CUR_SKIP) {
170+=======
171+ char dst_name[FN_REFLEN];
172+ ds_file_t *dstfile = NULL;
173+ xb_fil_cur_t cursor;
174+ xb_fil_cur_result_t res;
175+ xb_write_filt_t *write_filter = NULL;
176+ xb_write_filt_ctxt_t write_filt_ctxt;
177+
178+ if (!trx_sys_sys_space(node->space->id) && /* don't skip system space */
179+ check_if_skip_table(node->name, "ibd")) {
180+ msg("[%02u] Skipping %s\n", thread_n, node->name);
181+ return(FALSE);
182+ }
183+
184+ res = xb_fil_cur_open(&cursor, node, thread_n);
185+ if (res == XB_FIL_CUR_SKIP) {
186+>>>>>>> MERGE-SOURCE
187 goto skip;
188 } else if (res == XB_FIL_CUR_ERROR) {
189 goto error;
190@@ -2339,6 +2436,132 @@
191 msg("xtrabackup: Error: failed to create file '%s'\n", path);
192
193 return(FALSE);
194+<<<<<<< TREE
195+=======
196+}
197+
198+static
199+void
200+xb_filters_init()
201+{
202+ if (xtrabackup_tables) {
203+ /* init regexp */
204+ char *p, *next;
205+ int i;
206+ char errbuf[100];
207+
208+ tables_regex_num = 1;
209+
210+ p = xtrabackup_tables;
211+ while ((p = strchr(p, ',')) != NULL) {
212+ p++;
213+ tables_regex_num++;
214+ }
215+
216+ tables_regex = ut_malloc(sizeof(xb_regex_t) * tables_regex_num);
217+
218+ p = xtrabackup_tables;
219+ for (i=0; i < tables_regex_num; i++) {
220+ next = strchr(p, ',');
221+ ut_a(next || i == tables_regex_num - 1);
222+
223+ next++;
224+ if (i != tables_regex_num - 1)
225+ *(next - 1) = '\0';
226+
227+ xb_regerror(xb_regcomp(&tables_regex[i], p,
228+ REG_EXTENDED),
229+ &tables_regex[i], errbuf, sizeof(errbuf));
230+ msg("xtrabackup: tables regcomp(%s): %s\n", p, errbuf);
231+
232+ if (i != tables_regex_num - 1)
233+ *(next - 1) = ',';
234+ p = next;
235+ }
236+ }
237+
238+ if (xtrabackup_tables_file) {
239+ char name_buf[NAME_LEN*2+2];
240+ FILE *fp;
241+
242+ name_buf[NAME_LEN*2+1] = '\0';
243+
244+ /* init tables_hash */
245+ tables_hash = hash_create(1000);
246+
247+ /* read and store the filenames */
248+ fp = fopen(xtrabackup_tables_file,"r");
249+ if (!fp) {
250+ msg("xtrabackup: cannot open %s\n",
251+ xtrabackup_tables_file);
252+ exit(EXIT_FAILURE);
253+ }
254+ for (;;) {
255+ xtrabackup_tables_t* table;
256+ char* p = name_buf;
257+
258+ if ( fgets(name_buf, NAME_LEN*2+1, fp) == 0 ) {
259+ break;
260+ }
261+
262+ p = strchr(name_buf, '\n');
263+ if (p)
264+ {
265+ *p = '\0';
266+ }
267+
268+ table = malloc(sizeof(xtrabackup_tables_t) + strlen(name_buf) + 1);
269+ memset(table, '\0', sizeof(xtrabackup_tables_t) + strlen(name_buf) + 1);
270+ table->name = ((char*)table) + sizeof(xtrabackup_tables_t);
271+ strcpy(table->name, name_buf);
272+
273+ HASH_INSERT(xtrabackup_tables_t, name_hash, tables_hash,
274+ ut_fold_string(table->name), table);
275+
276+ msg("xtrabackup: table '%s' is registered to the "
277+ "list.\n", table->name);
278+ }
279+ }
280+}
281+
282+static
283+void
284+xb_filters_free()
285+{
286+ if (xtrabackup_tables) {
287+ /* free regexp */
288+ int i;
289+
290+ for (i = 0; i < tables_regex_num; i++) {
291+ xb_regfree(&tables_regex[i]);
292+ }
293+ ut_free(tables_regex);
294+ }
295+
296+ if (xtrabackup_tables_file) {
297+ ulint i;
298+
299+ /* free the hash elements */
300+ for (i = 0; i < hash_get_n_cells(tables_hash); i++) {
301+ xtrabackup_tables_t* table;
302+
303+ table = HASH_GET_FIRST(tables_hash, i);
304+
305+ while (table) {
306+ xtrabackup_tables_t* prev_table = table;
307+
308+ table = HASH_GET_NEXT(name_hash, prev_table);
309+
310+ HASH_DELETE(xtrabackup_tables_t, name_hash, tables_hash,
311+ ut_fold_string(prev_table->name), prev_table);
312+ free(prev_table);
313+ }
314+ }
315+
316+ /* free tables_hash */
317+ hash_table_free(tables_hash);
318+ }
319+>>>>>>> MERGE-SOURCE
320 }
321
322 static void
323@@ -2451,6 +2674,8 @@
324 os_sync_mutex = NULL;
325 srv_general_init();
326
327+ xb_filters_init();
328+
329 {
330 ibool log_file_created;
331 ibool log_created = FALSE;
332@@ -2781,6 +3006,11 @@
333
334 msg("xtrabackup: Transaction log of lsn (%llu) to (%llu) was copied.\n",
335 checkpoint_lsn_start, log_copy_scanned_lsn);
336+<<<<<<< TREE
337+=======
338+
339+ xb_filters_free();
340+>>>>>>> MERGE-SOURCE
341
342 xb_data_files_close();
343 }
344@@ -3066,6 +3296,8 @@
345 if(innodb_init())
346 exit(EXIT_FAILURE);
347
348+ xb_filters_init();
349+
350 fprintf(stdout, "\n\n<INDEX STATISTICS>\n");
351
352 /* gather stats */
353@@ -3140,43 +3372,8 @@
354 mem_free(table_name);
355
356
357- if (xtrabackup_tables) {
358- char *p;
359- int regres = REG_NOMATCH;
360- int i;
361-
362- p = strstr(table->name, SRV_PATH_SEPARATOR_STR);
363-
364- if (p)
365- *p = '.';
366-
367- for (i = 0; i < tables_regex_num; i++) {
368- regres = xb_regexec(&tables_regex[i],
369- table->name, 1,
370- tables_regmatch, 0);
371- if (regres != REG_NOMATCH)
372- break;
373- }
374-
375- if (p)
376- *p = SRV_PATH_SEPARATOR;
377-
378- if ( regres == REG_NOMATCH )
379- goto skip;
380- }
381-
382- if (xtrabackup_tables_file) {
383- xtrabackup_tables_t* xtable;
384-
385- XB_HASH_SEARCH(name_hash, tables_hash,
386- ut_fold_string(table->name),
387- xtable,
388- ut_ad(xtable->name),
389- !strcmp(xtable->name, table->name));
390-
391- if (!xtable)
392- goto skip;
393- }
394+ if (table && check_if_skip_table(table->name, ""))
395+ goto skip;
396
397
398 if (table == NULL) {
399@@ -3272,6 +3469,8 @@
400 end:
401 putc('\n', stdout);
402
403+ xb_filters_free();
404+
405 /* shutdown InnoDB */
406 if(innodb_end())
407 exit(EXIT_FAILURE);
408@@ -4695,91 +4894,6 @@
409 my_load_path(xtrabackup_real_target_dir, xtrabackup_target_dir, NULL);
410 xtrabackup_target_dir= xtrabackup_real_target_dir;
411
412- if (xtrabackup_tables) {
413- /* init regexp */
414- char *p, *next;
415- int i;
416- char errbuf[100];
417-
418- tables_regex_num = 1;
419-
420- p = xtrabackup_tables;
421- while ((p = strchr(p, ',')) != NULL) {
422- p++;
423- tables_regex_num++;
424- }
425-
426- tables_regex = ut_malloc(sizeof(xb_regex_t) * tables_regex_num);
427-
428- p = xtrabackup_tables;
429- for (i=0; i < tables_regex_num; i++) {
430- next = strchr(p, ',');
431- ut_a(next || i == tables_regex_num - 1);
432-
433- next++;
434- if (i != tables_regex_num - 1)
435- *(next - 1) = '\0';
436-
437- xb_regerror(xb_regcomp(&tables_regex[i], p,
438- REG_EXTENDED),
439- &tables_regex[i], errbuf, sizeof(errbuf));
440- msg("xtrabackup: tables regcomp(%s): %s\n", p, errbuf);
441-
442- if (i != tables_regex_num - 1)
443- *(next - 1) = ',';
444- p = next;
445- }
446- }
447-
448- if (xtrabackup_tables_file) {
449- char name_buf[NAME_LEN*2+2];
450- FILE *fp;
451-
452- name_buf[NAME_LEN*2+1] = '\0';
453-
454- /* init tables_hash */
455- tables_hash = hash_create(1000);
456-
457- /* read and store the filenames */
458- fp = fopen(xtrabackup_tables_file,"r");
459- if (!fp) {
460- msg("xtrabackup: cannot open %s\n",
461- xtrabackup_tables_file);
462- exit(EXIT_FAILURE);
463- }
464- for (;;) {
465- xtrabackup_tables_t* table;
466- char* p = name_buf;
467-
468- if ( fgets(name_buf, NAME_LEN*2+1, fp) == 0 ) {
469- break;
470- }
471-
472- while (*p != '\0') {
473- if (*p == '.') {
474- *p = '/';
475- }
476- p++;
477- }
478- p = strchr(name_buf, '\n');
479- if (p)
480- {
481- *p = '\0';
482- }
483-
484- table = malloc(sizeof(xtrabackup_tables_t) + strlen(name_buf) + 1);
485- memset(table, '\0', sizeof(xtrabackup_tables_t) + strlen(name_buf) + 1);
486- table->name = ((char*)table) + sizeof(xtrabackup_tables_t);
487- strcpy(table->name, name_buf);
488-
489- HASH_INSERT(xtrabackup_tables_t, name_hash, tables_hash,
490- ut_fold_string(table->name), table);
491-
492- msg("xtrabackup: table '%s' is registered to the "
493- "list.\n", table->name);
494- }
495- }
496-
497 #ifdef XTRADB_BASED
498 /* temporary setting of enough size */
499 srv_page_size_shift = UNIV_PAGE_SIZE_SHIFT_MAX;
500@@ -4933,40 +5047,6 @@
501 if (xtrabackup_prepare)
502 xtrabackup_prepare_func();
503
504- if (xtrabackup_tables) {
505- /* free regexp */
506- int i;
507-
508- for (i = 0; i < tables_regex_num; i++) {
509- xb_regfree(&tables_regex[i]);
510- }
511- ut_free(tables_regex);
512- }
513-
514- if (xtrabackup_tables_file) {
515- ulint i;
516-
517- /* free the hash elements */
518- for (i = 0; i < hash_get_n_cells(tables_hash); i++) {
519- xtrabackup_tables_t* table;
520-
521- table = HASH_GET_FIRST(tables_hash, i);
522-
523- while (table) {
524- xtrabackup_tables_t* prev_table = table;
525-
526- table = HASH_GET_NEXT(name_hash, prev_table);
527-
528- HASH_DELETE(xtrabackup_tables_t, name_hash, tables_hash,
529- ut_fold_string(prev_table->name), prev_table);
530- free(prev_table);
531- }
532- }
533-
534- /* free tables_hash */
535- hash_table_free(tables_hash);
536- }
537-
538 xb_regex_end();
539
540 exit(EXIT_SUCCESS);
541
542=== added file 'test/inc/ib_part.sh'
543--- test/inc/ib_part.sh 1970-01-01 00:00:00 +0000
544+++ test/inc/ib_part.sh 2012-12-07 11:29:22 +0000
545@@ -0,0 +1,92 @@
546+
547+
548+function check_partitioning()
549+{
550+ $MYSQL $MYSQL_ARGS -Ns -e "show variables like 'have_partitioning'"
551+}
552+
553+function require_partitioning()
554+{
555+ PARTITION_CHECK=`check_partitioning`
556+
557+ if [ -z "$PARTITION_CHECK" ]; then
558+ echo "Requires Partitioning." > $SKIPPED_REASON
559+ exit $SKIPPED_EXIT_CODE
560+ fi
561+}
562+
563+function ib_part_schema()
564+{
565+ topdir=$1
566+ engine=$2
567+
568+ cat <<EOF
569+CREATE TABLE test (
570+ a int(11) DEFAULT NULL
571+) ENGINE=$engine DEFAULT CHARSET=latin1
572+PARTITION BY RANGE (a)
573+(PARTITION p0 VALUES LESS THAN (100) ENGINE = $engine,
574+ PARTITION P1 VALUES LESS THAN (200) ENGINE = $engine,
575+ PARTITION p2 VALUES LESS THAN (300)
576+ DATA DIRECTORY = '$topdir/ext' INDEX DIRECTORY = '$topdir/ext'
577+ ENGINE = $engine,
578+ PARTITION p3 VALUES LESS THAN (400)
579+ DATA DIRECTORY = '$topdir/ext' INDEX DIRECTORY = '$topdir/ext'
580+ ENGINE = $engine,
581+ PARTITION p4 VALUES LESS THAN MAXVALUE ENGINE = $engine);
582+EOF
583+}
584+
585+function ib_part_data()
586+{
587+ echo 'INSERT INTO test VALUES (1), (101), (201), (301), (401);';
588+}
589+
590+function ib_part_init()
591+{
592+ topdir=$1
593+ engine=$2
594+
595+ if [ -d $topdir/ext ] ; then
596+ rm -rf $topdir/ext
597+ fi
598+ mkdir -p $topdir/ext
599+
600+ ib_part_schema $topdir $engine | run_cmd $MYSQL $MYSQL_ARGS test
601+ ib_part_data $topdir $engine | run_cmd $MYSQL $MYSQL_ARGS test
602+}
603+
604+function ib_part_restore()
605+{
606+ topdir=$1
607+ mysql_datadir=$2
608+
609+ # Remove database
610+ rm -rf $mysql_datadir/test/*
611+ rm -rf $topdir/ext/*
612+ vlog "Original database removed"
613+
614+ # Restore database from backup
615+ cp -rv $topdir/backup/test/* $mysql_datadir/test
616+ vlog "database restored from backup"
617+
618+}
619+
620+function ib_part_assert_checksum()
621+{
622+ checksum_a=$1
623+
624+ vlog "Checking checksums"
625+ checksum_b=`checksum_table test test`
626+
627+ vlog "Checksums are $checksum_a and $checksum_b"
628+
629+ if [ "$checksum_a" != "$checksum_b" ]
630+ then
631+ vlog "Checksums are not equal"
632+ exit -1
633+ fi
634+
635+ vlog "Checksums are OK"
636+
637+}
638
639=== added file 'test/t/ib_part_databases.sh'
640--- test/t/ib_part_databases.sh 1970-01-01 00:00:00 +0000
641+++ test/t/ib_part_databases.sh 2012-12-07 11:29:22 +0000
642@@ -0,0 +1,39 @@
643+########################################################################
644+# Bug #711166: Partitioned tables are not correctly handled by the
645+# --databases and --tables-file options of innobackupex,
646+# and by the --tables option of xtrabackup.
647+# Testcase covers using --databases option with MyISAM
648+# database
649+########################################################################
650+
651+. inc/common.sh
652+. inc/ib_part.sh
653+
654+start_server
655+
656+require_partitioning
657+
658+# Create MyISAM partitioned table with some partitions in
659+# different location
660+ib_part_init $topdir MyISAM
661+
662+# Saving the checksum of original table
663+checksum_a=`checksum_table test test`
664+
665+# Take a backup
666+cat >$topdir/databases_file <<EOF
667+test.test
668+EOF
669+innobackupex --no-timestamp --databases=$topdir/databases_file $topdir/backup
670+innobackupex --apply-log $topdir/backup
671+vlog "Backup taken"
672+
673+stop_server
674+
675+# Restore partial backup
676+ib_part_restore $topdir $mysql_datadir
677+
678+start_server
679+
680+# compare checksum
681+ib_part_assert_checksum $checksum_a
682
683=== added file 'test/t/ib_part_include.sh'
684--- test/t/ib_part_include.sh 1970-01-01 00:00:00 +0000
685+++ test/t/ib_part_include.sh 2012-12-07 11:29:22 +0000
686@@ -0,0 +1,47 @@
687+########################################################################
688+# Bug #711166: Partitioned tables are not correctly handled by the
689+# --databases and --tables-file options of innobackupex,
690+# and by the --tables option of xtrabackup.
691+# Testcase covers using --include option with InnoDB
692+# database
693+########################################################################
694+
695+. inc/common.sh
696+. inc/ib_part.sh
697+
698+start_server --innodb_file_per_table
699+
700+require_partitioning
701+
702+# Create InnoDB partitioned table
703+ib_part_init $topdir InnoDB
704+
705+# Saving the checksum of original table
706+checksum_a=`checksum_table test test`
707+
708+# Take a backup
709+# Only backup of test.test table will be taken
710+cat >$topdir/tables <<EOF
711+test.test
712+EOF
713+innobackupex --no-timestamp --include='test.test$' $topdir/backup
714+innobackupex --apply-log $topdir/backup
715+vlog "Backup taken"
716+
717+# also test xtrabackup --stats work with --tables-file
718+COUNT=`xtrabackup --stats --tables='test.test$' --datadir=$topdir/backup 2>&1 \
719+ | grep table: | awk '{print $2}' | sort -u | wc -l`
720+
721+if [ $COUNT != 5 ] ; then
722+ vlog "xtrabackup --stats does not work"
723+ exit -1
724+fi
725+
726+stop_server
727+
728+# Restore partial backup
729+ib_part_restore $topdir $mysql_datadir
730+
731+start_server
732+
733+ib_part_assert_checksum $checksum_a
734
735=== added file 'test/t/ib_part_include_stream.sh'
736--- test/t/ib_part_include_stream.sh 1970-01-01 00:00:00 +0000
737+++ test/t/ib_part_include_stream.sh 2012-12-07 11:29:22 +0000
738@@ -0,0 +1,39 @@
739+########################################################################
740+# Bug #711166: Partitioned tables are not correctly handled by the
741+# --databases and --tables-file options of innobackupex,
742+# and by the --tables option of xtrabackup.
743+# Testcase covers using --include option with InnoDB
744+# database and --stream mode
745+########################################################################
746+
747+. inc/common.sh
748+. inc/ib_part.sh
749+
750+start_server --innodb_file_per_table
751+
752+require_partitioning
753+
754+# Create MyISAM partitioned table
755+ib_part_init $topdir MyISAM
756+
757+# Saving the checksum of original table
758+checksum_a=`checksum_table test test`
759+
760+# Take a backup
761+mkdir -p $topdir/backup
762+innobackupex --stream=tar --include='test.test$' $topdir/backup > $topdir/backup/backup.tar
763+$TAR ixvf $topdir/backup/backup.tar -C $topdir/backup
764+$TAR cvhf $topdir/backup/backup11.tar $mysql_datadir/test/*
765+
766+innobackupex --apply-log $topdir/backup
767+
768+vlog "Backup taken"
769+
770+stop_server
771+
772+# Restore partial backup
773+ib_part_restore $topdir $mysql_datadir
774+
775+start_server
776+
777+ib_part_assert_checksum $checksum_a
778
779=== added file 'test/t/ib_part_tf_innodb.sh'
780--- test/t/ib_part_tf_innodb.sh 1970-01-01 00:00:00 +0000
781+++ test/t/ib_part_tf_innodb.sh 2012-12-07 11:29:22 +0000
782@@ -0,0 +1,46 @@
783+########################################################################
784+# Bug #711166: Partitioned tables are not correctly handled by the
785+# --databases and --tables-file options of innobackupex,
786+# and by the --tables option of xtrabackup.
787+# Testcase covers using --tables-file option with InnoDB
788+# database
789+########################################################################
790+
791+. inc/common.sh
792+. inc/ib_part.sh
793+
794+start_server --innodb_file_per_table
795+
796+require_partitioning
797+
798+# Create InnoDB partitioned table
799+ib_part_init $topdir InnoDB
800+
801+# Saving the checksum of original table
802+checksum_a=`checksum_table test test`
803+
804+# Take a backup
805+# Only backup of test.test table will be taken
806+cat >$topdir/tables <<EOF
807+test.test
808+EOF
809+innobackupex --no-timestamp --tables-file=$topdir/tables $topdir/backup
810+innobackupex --apply-log $topdir/backup
811+vlog "Backup taken"
812+
813+COUNT=`xtrabackup --stats --tables-file=$topdir/tables --datadir=$topdir/backup 2>&1 \
814+ | grep table: | awk '{print $2}' | sort -u | wc -l`
815+
816+if [ $COUNT != 5 ] ; then
817+ vlog "xtrabackup --stats does not work"
818+ exit -1
819+fi
820+
821+stop_server
822+
823+# Restore partial backup
824+ib_part_restore $topdir $mysql_datadir
825+
826+start_server
827+
828+ib_part_assert_checksum $checksum_a
829
830=== added file 'test/t/ib_part_tf_innodb_stream.sh'
831--- test/t/ib_part_tf_innodb_stream.sh 1970-01-01 00:00:00 +0000
832+++ test/t/ib_part_tf_innodb_stream.sh 2012-12-07 11:29:22 +0000
833@@ -0,0 +1,40 @@
834+########################################################################
835+# Bug #711166: Partitioned tables are not correctly handled by the
836+# --databases and --tables-file options of innobackupex,
837+# and by the --tables option of xtrabackup.
838+# Testcase covers using --tables-file option with InnoDB
839+# database and --stream mode
840+########################################################################
841+
842+. inc/common.sh
843+. inc/ib_part.sh
844+
845+start_server --innodb_file_per_table
846+
847+require_partitioning
848+
849+# Create InnoDB partitioned table
850+ib_part_init $topdir InnoDB
851+
852+# Saving the checksum of original table
853+checksum_a=`checksum_table test test`
854+
855+# Take a backup
856+# Only backup of test.test table will be taken
857+cat >$topdir/tables <<EOF
858+test.test
859+EOF
860+mkdir -p $topdir/backup
861+innobackupex --stream=tar --no-timestamp --tables-file=$topdir/tables $topdir/backup > $topdir/backup/backup.tar
862+$TAR ixvf $topdir/backup/backup.tar -C $topdir/backup
863+innobackupex --apply-log $topdir/backup
864+vlog "Backup taken"
865+
866+stop_server
867+
868+# Restore partial backup
869+ib_part_restore $topdir $mysql_datadir
870+
871+start_server
872+
873+ib_part_assert_checksum $checksum_a
874
875=== added file 'test/t/ib_part_tf_myisam.sh'
876--- test/t/ib_part_tf_myisam.sh 1970-01-01 00:00:00 +0000
877+++ test/t/ib_part_tf_myisam.sh 2012-12-07 11:29:22 +0000
878@@ -0,0 +1,39 @@
879+########################################################################
880+# Bug #711166: Partitioned tables are not correctly handled by the
881+# --databases and --tables-file options of innobackupex,
882+# and by the --tables option of xtrabackup.
883+# Testcase covers using --tables-file option with MyISAM
884+# database
885+########################################################################
886+
887+. inc/common.sh
888+. inc/ib_part.sh
889+
890+start_server
891+
892+require_partitioning
893+
894+# Create MyISAM partitioned table with some partitions in
895+# different location
896+ib_part_init $topdir MyISAM
897+
898+# Saving the checksum of original table
899+checksum_a=`checksum_table test test`
900+
901+# Take a backup
902+# Only backup of test.test table will be taken
903+cat >$topdir/tables <<EOF
904+test.test
905+EOF
906+innobackupex --no-timestamp --tables-file=$topdir/tables $topdir/backup
907+innobackupex --apply-log $topdir/backup
908+vlog "Backup taken"
909+
910+stop_server
911+
912+# Restore partial backup
913+ib_part_restore $topdir $mysql_datadir
914+
915+start_server
916+
917+ib_part_assert_checksum $checksum_a

Subscribers

People subscribed via source and target branches