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
=== modified file 'innobackupex'
--- innobackupex 2012-11-29 04:25:17 +0000
+++ innobackupex 2012-12-07 11:29:22 +0000
@@ -1993,7 +1993,8 @@
1993 next unless check_if_required($database, $file);1993 next unless check_if_required($database, $file);
19941994
1995 if($option_include) {1995 if($option_include) {
1996 if (!("$database.$file" =~ /$option_include/)) {1996 my $table_name = get_table_name($file);
1997 if (!("$database.$table_name" =~ /$option_include/)) {
1997 print STDERR "$database.$file is skipped because it does not match $option_include.\n";1998 print STDERR "$database.$file is skipped because it does not match $option_include.\n";
1998 next;1999 next;
1999 }2000 }
@@ -2315,6 +2316,26 @@
2315 return ${$group_hash_ref}{$option_name};2316 return ${$group_hash_ref}{$option_name};
2316}2317}
23172318
2319# get_table_name subroutine returns table name of specified file.
2320# Parameters:
2321# $_[0] table path
2322# Return value:
2323# 1 table name
2324#
2325sub get_table_name {
2326 my $table_path = shift;
2327 my $filename;
2328 my $table;
2329
2330 # get the last component in the table pathname
2331 $filename = (reverse(split(/\//, $table_path)))[0];
2332 # get name of the table by removing file suffix
2333 $table = (split(/\./, $filename))[0];
2334 # and partition suffix
2335 $table = (split('#P#', $table))[0];
2336
2337 return $table;
2338}
23182339
2319# check_if_required subroutine returns 1 if the specified database and2340# check_if_required subroutine returns 1 if the specified database and
2320# table needs to be backed up.2341# table needs to be backed up.
@@ -2328,7 +2349,6 @@
2328 my ( $db, $table_path ) = @_;2349 my ( $db, $table_path ) = @_;
2329 my $db_count = scalar keys %databases_list;2350 my $db_count = scalar keys %databases_list;
2330 my $tbl_count = scalar keys %table_list;2351 my $tbl_count = scalar keys %table_list;
2331 my $filename;
2332 my $table;2352 my $table;
23332353
2334 if ( $db_count == 0 && $tbl_count == 0 ) {2354 if ( $db_count == 0 && $tbl_count == 0 ) {
@@ -2338,10 +2358,7 @@
2338 }2358 }
2339 else {2359 else {
2340 if ( $table_path ) {2360 if ( $table_path ) {
2341 # get the last component in the table pathname 2361 $table = get_table_name($table_path);
2342 $filename = (reverse(split(/\//, $table_path)))[0];
2343 # get name of the table by removing file suffix
2344 $table = (split(/\./, $filename))[0];
2345 }2362 }
2346 }2363 }
23472364
23482365
=== modified file 'src/xtrabackup.c'
--- src/xtrabackup.c 2012-11-21 13:51:49 +0000
+++ src/xtrabackup.c 2012-12-07 11:29:22 +0000
@@ -1500,6 +1500,7 @@
1500 }1500 }
1501}1501}
15021502
1503<<<<<<< TREE
1503/************************************************************************1504/************************************************************************
1504Checks if a table specified as a path should be skipped from backup1505Checks if a table specified as a path should be skipped from backup
1505based on the --tables or --tables-file options.1506based on the --tables or --tables-file options.
@@ -1576,6 +1577,84 @@
1576 return(TRUE);1577 return(TRUE);
1577}1578}
15781579
1580=======
1581/************************************************************************
1582Checks if a table specified as a path should be skipped from backup
1583based on the --tables or --tables-file options.
1584
1585@return TRUE if the table should be skipped. */
1586static
1587my_bool
1588check_if_skip_table(
1589/******************/
1590 char* path, /*!< in: path to the table */
1591 char* suffix) /*!< in: suffix */
1592{
1593 char buf[FN_REFLEN];
1594 const char *dbname, *tbname;
1595 const char *ptr;
1596 char *eptr;
1597 int dbname_len;
1598
1599 if (xtrabackup_tables == NULL && xtrabackup_tables_file == NULL) {
1600 return(FALSE);
1601 }
1602
1603 dbname = NULL;
1604 tbname = path;
1605 while ((ptr = strstr(tbname, SRV_PATH_SEPARATOR_STR)) != NULL) {
1606 dbname = tbname;
1607 tbname = ptr + 1;
1608 }
1609
1610 if (dbname == NULL) {
1611 return(FALSE);
1612 }
1613
1614 strncpy(buf, dbname, FN_REFLEN);
1615 buf[FN_REFLEN - 1] = 0;
1616 buf[tbname - 1 - dbname] = '.';
1617
1618 dbname_len = strlen(dbname) - strlen(suffix);
1619 if (dbname_len < 1) {
1620 return(FALSE);
1621 }
1622 buf[dbname_len - 1] = 0;
1623
1624 if ((eptr = strstr(buf, "#P#")) != NULL) {
1625 *eptr = 0;
1626 }
1627
1628 if (xtrabackup_tables) {
1629 int regres = REG_NOMATCH;
1630 int i;
1631 for (i = 0; i < tables_regex_num; i++) {
1632 regres = xb_regexec(&tables_regex[i], buf, 1,
1633 tables_regmatch, 0);
1634 if (regres != REG_NOMATCH) {
1635 break;
1636 }
1637 }
1638 if (regres == REG_NOMATCH) {
1639 return(TRUE);
1640 }
1641 }
1642
1643 if (xtrabackup_tables_file) {
1644 xtrabackup_tables_t* table;
1645
1646 XB_HASH_SEARCH(name_hash, tables_hash, ut_fold_string(buf),
1647 table, ut_ad(table->name),
1648 !strcmp(table->name, buf));
1649 if (!table) {
1650 return(TRUE);
1651 }
1652 }
1653
1654 return(FALSE);
1655}
1656
1657>>>>>>> MERGE-SOURCE
1579/***********************************************************************1658/***********************************************************************
1580Reads the space flags from a given data file and returns the compressed1659Reads the space flags from a given data file and returns the compressed
1581page size, or 0 if the space is not compressed. */1660page size, or 0 if the space is not compressed. */
@@ -1611,6 +1690,7 @@
1611my_bool1690my_bool
1612xtrabackup_copy_datafile(fil_node_t* node, uint thread_n)1691xtrabackup_copy_datafile(fil_node_t* node, uint thread_n)
1613{1692{
1693<<<<<<< TREE
1614 char dst_name[FN_REFLEN];1694 char dst_name[FN_REFLEN];
1615 ds_file_t *dstfile = NULL;1695 ds_file_t *dstfile = NULL;
1616 xb_fil_cur_t cursor;1696 xb_fil_cur_t cursor;
@@ -1626,6 +1706,23 @@
16261706
1627 res = xb_fil_cur_open(&cursor, node, thread_n);1707 res = xb_fil_cur_open(&cursor, node, thread_n);
1628 if (res == XB_FIL_CUR_SKIP) {1708 if (res == XB_FIL_CUR_SKIP) {
1709=======
1710 char dst_name[FN_REFLEN];
1711 ds_file_t *dstfile = NULL;
1712 xb_fil_cur_t cursor;
1713 xb_fil_cur_result_t res;
1714 xb_write_filt_t *write_filter = NULL;
1715 xb_write_filt_ctxt_t write_filt_ctxt;
1716
1717 if (!trx_sys_sys_space(node->space->id) && /* don't skip system space */
1718 check_if_skip_table(node->name, "ibd")) {
1719 msg("[%02u] Skipping %s\n", thread_n, node->name);
1720 return(FALSE);
1721 }
1722
1723 res = xb_fil_cur_open(&cursor, node, thread_n);
1724 if (res == XB_FIL_CUR_SKIP) {
1725>>>>>>> MERGE-SOURCE
1629 goto skip;1726 goto skip;
1630 } else if (res == XB_FIL_CUR_ERROR) {1727 } else if (res == XB_FIL_CUR_ERROR) {
1631 goto error;1728 goto error;
@@ -2339,6 +2436,132 @@
2339 msg("xtrabackup: Error: failed to create file '%s'\n", path);2436 msg("xtrabackup: Error: failed to create file '%s'\n", path);
23402437
2341 return(FALSE);2438 return(FALSE);
2439<<<<<<< TREE
2440=======
2441}
2442
2443static
2444void
2445xb_filters_init()
2446{
2447 if (xtrabackup_tables) {
2448 /* init regexp */
2449 char *p, *next;
2450 int i;
2451 char errbuf[100];
2452
2453 tables_regex_num = 1;
2454
2455 p = xtrabackup_tables;
2456 while ((p = strchr(p, ',')) != NULL) {
2457 p++;
2458 tables_regex_num++;
2459 }
2460
2461 tables_regex = ut_malloc(sizeof(xb_regex_t) * tables_regex_num);
2462
2463 p = xtrabackup_tables;
2464 for (i=0; i < tables_regex_num; i++) {
2465 next = strchr(p, ',');
2466 ut_a(next || i == tables_regex_num - 1);
2467
2468 next++;
2469 if (i != tables_regex_num - 1)
2470 *(next - 1) = '\0';
2471
2472 xb_regerror(xb_regcomp(&tables_regex[i], p,
2473 REG_EXTENDED),
2474 &tables_regex[i], errbuf, sizeof(errbuf));
2475 msg("xtrabackup: tables regcomp(%s): %s\n", p, errbuf);
2476
2477 if (i != tables_regex_num - 1)
2478 *(next - 1) = ',';
2479 p = next;
2480 }
2481 }
2482
2483 if (xtrabackup_tables_file) {
2484 char name_buf[NAME_LEN*2+2];
2485 FILE *fp;
2486
2487 name_buf[NAME_LEN*2+1] = '\0';
2488
2489 /* init tables_hash */
2490 tables_hash = hash_create(1000);
2491
2492 /* read and store the filenames */
2493 fp = fopen(xtrabackup_tables_file,"r");
2494 if (!fp) {
2495 msg("xtrabackup: cannot open %s\n",
2496 xtrabackup_tables_file);
2497 exit(EXIT_FAILURE);
2498 }
2499 for (;;) {
2500 xtrabackup_tables_t* table;
2501 char* p = name_buf;
2502
2503 if ( fgets(name_buf, NAME_LEN*2+1, fp) == 0 ) {
2504 break;
2505 }
2506
2507 p = strchr(name_buf, '\n');
2508 if (p)
2509 {
2510 *p = '\0';
2511 }
2512
2513 table = malloc(sizeof(xtrabackup_tables_t) + strlen(name_buf) + 1);
2514 memset(table, '\0', sizeof(xtrabackup_tables_t) + strlen(name_buf) + 1);
2515 table->name = ((char*)table) + sizeof(xtrabackup_tables_t);
2516 strcpy(table->name, name_buf);
2517
2518 HASH_INSERT(xtrabackup_tables_t, name_hash, tables_hash,
2519 ut_fold_string(table->name), table);
2520
2521 msg("xtrabackup: table '%s' is registered to the "
2522 "list.\n", table->name);
2523 }
2524 }
2525}
2526
2527static
2528void
2529xb_filters_free()
2530{
2531 if (xtrabackup_tables) {
2532 /* free regexp */
2533 int i;
2534
2535 for (i = 0; i < tables_regex_num; i++) {
2536 xb_regfree(&tables_regex[i]);
2537 }
2538 ut_free(tables_regex);
2539 }
2540
2541 if (xtrabackup_tables_file) {
2542 ulint i;
2543
2544 /* free the hash elements */
2545 for (i = 0; i < hash_get_n_cells(tables_hash); i++) {
2546 xtrabackup_tables_t* table;
2547
2548 table = HASH_GET_FIRST(tables_hash, i);
2549
2550 while (table) {
2551 xtrabackup_tables_t* prev_table = table;
2552
2553 table = HASH_GET_NEXT(name_hash, prev_table);
2554
2555 HASH_DELETE(xtrabackup_tables_t, name_hash, tables_hash,
2556 ut_fold_string(prev_table->name), prev_table);
2557 free(prev_table);
2558 }
2559 }
2560
2561 /* free tables_hash */
2562 hash_table_free(tables_hash);
2563 }
2564>>>>>>> MERGE-SOURCE
2342}2565}
23432566
2344static void2567static void
@@ -2451,6 +2674,8 @@
2451 os_sync_mutex = NULL;2674 os_sync_mutex = NULL;
2452 srv_general_init();2675 srv_general_init();
24532676
2677 xb_filters_init();
2678
2454 {2679 {
2455 ibool log_file_created;2680 ibool log_file_created;
2456 ibool log_created = FALSE;2681 ibool log_created = FALSE;
@@ -2781,6 +3006,11 @@
27813006
2782 msg("xtrabackup: Transaction log of lsn (%llu) to (%llu) was copied.\n",3007 msg("xtrabackup: Transaction log of lsn (%llu) to (%llu) was copied.\n",
2783 checkpoint_lsn_start, log_copy_scanned_lsn);3008 checkpoint_lsn_start, log_copy_scanned_lsn);
3009<<<<<<< TREE
3010=======
3011
3012 xb_filters_free();
3013>>>>>>> MERGE-SOURCE
27843014
2785 xb_data_files_close();3015 xb_data_files_close();
2786}3016}
@@ -3066,6 +3296,8 @@
3066 if(innodb_init())3296 if(innodb_init())
3067 exit(EXIT_FAILURE);3297 exit(EXIT_FAILURE);
30683298
3299 xb_filters_init();
3300
3069 fprintf(stdout, "\n\n<INDEX STATISTICS>\n");3301 fprintf(stdout, "\n\n<INDEX STATISTICS>\n");
30703302
3071 /* gather stats */3303 /* gather stats */
@@ -3140,43 +3372,8 @@
3140 mem_free(table_name);3372 mem_free(table_name);
31413373
31423374
3143 if (xtrabackup_tables) {3375 if (table && check_if_skip_table(table->name, ""))
3144 char *p;3376 goto skip;
3145 int regres = REG_NOMATCH;
3146 int i;
3147
3148 p = strstr(table->name, SRV_PATH_SEPARATOR_STR);
3149
3150 if (p)
3151 *p = '.';
3152
3153 for (i = 0; i < tables_regex_num; i++) {
3154 regres = xb_regexec(&tables_regex[i],
3155 table->name, 1,
3156 tables_regmatch, 0);
3157 if (regres != REG_NOMATCH)
3158 break;
3159 }
3160
3161 if (p)
3162 *p = SRV_PATH_SEPARATOR;
3163
3164 if ( regres == REG_NOMATCH )
3165 goto skip;
3166 }
3167
3168 if (xtrabackup_tables_file) {
3169 xtrabackup_tables_t* xtable;
3170
3171 XB_HASH_SEARCH(name_hash, tables_hash,
3172 ut_fold_string(table->name),
3173 xtable,
3174 ut_ad(xtable->name),
3175 !strcmp(xtable->name, table->name));
3176
3177 if (!xtable)
3178 goto skip;
3179 }
31803377
31813378
3182 if (table == NULL) {3379 if (table == NULL) {
@@ -3272,6 +3469,8 @@
3272end:3469end:
3273 putc('\n', stdout);3470 putc('\n', stdout);
32743471
3472 xb_filters_free();
3473
3275 /* shutdown InnoDB */3474 /* shutdown InnoDB */
3276 if(innodb_end())3475 if(innodb_end())
3277 exit(EXIT_FAILURE);3476 exit(EXIT_FAILURE);
@@ -4695,91 +4894,6 @@
4695 my_load_path(xtrabackup_real_target_dir, xtrabackup_target_dir, NULL);4894 my_load_path(xtrabackup_real_target_dir, xtrabackup_target_dir, NULL);
4696 xtrabackup_target_dir= xtrabackup_real_target_dir;4895 xtrabackup_target_dir= xtrabackup_real_target_dir;
46974896
4698 if (xtrabackup_tables) {
4699 /* init regexp */
4700 char *p, *next;
4701 int i;
4702 char errbuf[100];
4703
4704 tables_regex_num = 1;
4705
4706 p = xtrabackup_tables;
4707 while ((p = strchr(p, ',')) != NULL) {
4708 p++;
4709 tables_regex_num++;
4710 }
4711
4712 tables_regex = ut_malloc(sizeof(xb_regex_t) * tables_regex_num);
4713
4714 p = xtrabackup_tables;
4715 for (i=0; i < tables_regex_num; i++) {
4716 next = strchr(p, ',');
4717 ut_a(next || i == tables_regex_num - 1);
4718
4719 next++;
4720 if (i != tables_regex_num - 1)
4721 *(next - 1) = '\0';
4722
4723 xb_regerror(xb_regcomp(&tables_regex[i], p,
4724 REG_EXTENDED),
4725 &tables_regex[i], errbuf, sizeof(errbuf));
4726 msg("xtrabackup: tables regcomp(%s): %s\n", p, errbuf);
4727
4728 if (i != tables_regex_num - 1)
4729 *(next - 1) = ',';
4730 p = next;
4731 }
4732 }
4733
4734 if (xtrabackup_tables_file) {
4735 char name_buf[NAME_LEN*2+2];
4736 FILE *fp;
4737
4738 name_buf[NAME_LEN*2+1] = '\0';
4739
4740 /* init tables_hash */
4741 tables_hash = hash_create(1000);
4742
4743 /* read and store the filenames */
4744 fp = fopen(xtrabackup_tables_file,"r");
4745 if (!fp) {
4746 msg("xtrabackup: cannot open %s\n",
4747 xtrabackup_tables_file);
4748 exit(EXIT_FAILURE);
4749 }
4750 for (;;) {
4751 xtrabackup_tables_t* table;
4752 char* p = name_buf;
4753
4754 if ( fgets(name_buf, NAME_LEN*2+1, fp) == 0 ) {
4755 break;
4756 }
4757
4758 while (*p != '\0') {
4759 if (*p == '.') {
4760 *p = '/';
4761 }
4762 p++;
4763 }
4764 p = strchr(name_buf, '\n');
4765 if (p)
4766 {
4767 *p = '\0';
4768 }
4769
4770 table = malloc(sizeof(xtrabackup_tables_t) + strlen(name_buf) + 1);
4771 memset(table, '\0', sizeof(xtrabackup_tables_t) + strlen(name_buf) + 1);
4772 table->name = ((char*)table) + sizeof(xtrabackup_tables_t);
4773 strcpy(table->name, name_buf);
4774
4775 HASH_INSERT(xtrabackup_tables_t, name_hash, tables_hash,
4776 ut_fold_string(table->name), table);
4777
4778 msg("xtrabackup: table '%s' is registered to the "
4779 "list.\n", table->name);
4780 }
4781 }
4782
4783#ifdef XTRADB_BASED4897#ifdef XTRADB_BASED
4784 /* temporary setting of enough size */4898 /* temporary setting of enough size */
4785 srv_page_size_shift = UNIV_PAGE_SIZE_SHIFT_MAX;4899 srv_page_size_shift = UNIV_PAGE_SIZE_SHIFT_MAX;
@@ -4933,40 +5047,6 @@
4933 if (xtrabackup_prepare)5047 if (xtrabackup_prepare)
4934 xtrabackup_prepare_func();5048 xtrabackup_prepare_func();
49355049
4936 if (xtrabackup_tables) {
4937 /* free regexp */
4938 int i;
4939
4940 for (i = 0; i < tables_regex_num; i++) {
4941 xb_regfree(&tables_regex[i]);
4942 }
4943 ut_free(tables_regex);
4944 }
4945
4946 if (xtrabackup_tables_file) {
4947 ulint i;
4948
4949 /* free the hash elements */
4950 for (i = 0; i < hash_get_n_cells(tables_hash); i++) {
4951 xtrabackup_tables_t* table;
4952
4953 table = HASH_GET_FIRST(tables_hash, i);
4954
4955 while (table) {
4956 xtrabackup_tables_t* prev_table = table;
4957
4958 table = HASH_GET_NEXT(name_hash, prev_table);
4959
4960 HASH_DELETE(xtrabackup_tables_t, name_hash, tables_hash,
4961 ut_fold_string(prev_table->name), prev_table);
4962 free(prev_table);
4963 }
4964 }
4965
4966 /* free tables_hash */
4967 hash_table_free(tables_hash);
4968 }
4969
4970 xb_regex_end();5050 xb_regex_end();
49715051
4972 exit(EXIT_SUCCESS);5052 exit(EXIT_SUCCESS);
49735053
=== added file 'test/inc/ib_part.sh'
--- test/inc/ib_part.sh 1970-01-01 00:00:00 +0000
+++ test/inc/ib_part.sh 2012-12-07 11:29:22 +0000
@@ -0,0 +1,92 @@
1
2
3function check_partitioning()
4{
5 $MYSQL $MYSQL_ARGS -Ns -e "show variables like 'have_partitioning'"
6}
7
8function require_partitioning()
9{
10 PARTITION_CHECK=`check_partitioning`
11
12 if [ -z "$PARTITION_CHECK" ]; then
13 echo "Requires Partitioning." > $SKIPPED_REASON
14 exit $SKIPPED_EXIT_CODE
15 fi
16}
17
18function ib_part_schema()
19{
20 topdir=$1
21 engine=$2
22
23 cat <<EOF
24CREATE TABLE test (
25 a int(11) DEFAULT NULL
26) ENGINE=$engine DEFAULT CHARSET=latin1
27PARTITION BY RANGE (a)
28(PARTITION p0 VALUES LESS THAN (100) ENGINE = $engine,
29 PARTITION P1 VALUES LESS THAN (200) ENGINE = $engine,
30 PARTITION p2 VALUES LESS THAN (300)
31 DATA DIRECTORY = '$topdir/ext' INDEX DIRECTORY = '$topdir/ext'
32 ENGINE = $engine,
33 PARTITION p3 VALUES LESS THAN (400)
34 DATA DIRECTORY = '$topdir/ext' INDEX DIRECTORY = '$topdir/ext'
35 ENGINE = $engine,
36 PARTITION p4 VALUES LESS THAN MAXVALUE ENGINE = $engine);
37EOF
38}
39
40function ib_part_data()
41{
42 echo 'INSERT INTO test VALUES (1), (101), (201), (301), (401);';
43}
44
45function ib_part_init()
46{
47 topdir=$1
48 engine=$2
49
50 if [ -d $topdir/ext ] ; then
51 rm -rf $topdir/ext
52 fi
53 mkdir -p $topdir/ext
54
55 ib_part_schema $topdir $engine | run_cmd $MYSQL $MYSQL_ARGS test
56 ib_part_data $topdir $engine | run_cmd $MYSQL $MYSQL_ARGS test
57}
58
59function ib_part_restore()
60{
61 topdir=$1
62 mysql_datadir=$2
63
64 # Remove database
65 rm -rf $mysql_datadir/test/*
66 rm -rf $topdir/ext/*
67 vlog "Original database removed"
68
69 # Restore database from backup
70 cp -rv $topdir/backup/test/* $mysql_datadir/test
71 vlog "database restored from backup"
72
73}
74
75function ib_part_assert_checksum()
76{
77 checksum_a=$1
78
79 vlog "Checking checksums"
80 checksum_b=`checksum_table test test`
81
82 vlog "Checksums are $checksum_a and $checksum_b"
83
84 if [ "$checksum_a" != "$checksum_b" ]
85 then
86 vlog "Checksums are not equal"
87 exit -1
88 fi
89
90 vlog "Checksums are OK"
91
92}
093
=== added file 'test/t/ib_part_databases.sh'
--- test/t/ib_part_databases.sh 1970-01-01 00:00:00 +0000
+++ test/t/ib_part_databases.sh 2012-12-07 11:29:22 +0000
@@ -0,0 +1,39 @@
1########################################################################
2# Bug #711166: Partitioned tables are not correctly handled by the
3# --databases and --tables-file options of innobackupex,
4# and by the --tables option of xtrabackup.
5# Testcase covers using --databases option with MyISAM
6# database
7########################################################################
8
9. inc/common.sh
10. inc/ib_part.sh
11
12start_server
13
14require_partitioning
15
16# Create MyISAM partitioned table with some partitions in
17# different location
18ib_part_init $topdir MyISAM
19
20# Saving the checksum of original table
21checksum_a=`checksum_table test test`
22
23# Take a backup
24cat >$topdir/databases_file <<EOF
25test.test
26EOF
27innobackupex --no-timestamp --databases=$topdir/databases_file $topdir/backup
28innobackupex --apply-log $topdir/backup
29vlog "Backup taken"
30
31stop_server
32
33# Restore partial backup
34ib_part_restore $topdir $mysql_datadir
35
36start_server
37
38# compare checksum
39ib_part_assert_checksum $checksum_a
040
=== added file 'test/t/ib_part_include.sh'
--- test/t/ib_part_include.sh 1970-01-01 00:00:00 +0000
+++ test/t/ib_part_include.sh 2012-12-07 11:29:22 +0000
@@ -0,0 +1,47 @@
1########################################################################
2# Bug #711166: Partitioned tables are not correctly handled by the
3# --databases and --tables-file options of innobackupex,
4# and by the --tables option of xtrabackup.
5# Testcase covers using --include option with InnoDB
6# database
7########################################################################
8
9. inc/common.sh
10. inc/ib_part.sh
11
12start_server --innodb_file_per_table
13
14require_partitioning
15
16# Create InnoDB partitioned table
17ib_part_init $topdir InnoDB
18
19# Saving the checksum of original table
20checksum_a=`checksum_table test test`
21
22# Take a backup
23# Only backup of test.test table will be taken
24cat >$topdir/tables <<EOF
25test.test
26EOF
27innobackupex --no-timestamp --include='test.test$' $topdir/backup
28innobackupex --apply-log $topdir/backup
29vlog "Backup taken"
30
31# also test xtrabackup --stats work with --tables-file
32COUNT=`xtrabackup --stats --tables='test.test$' --datadir=$topdir/backup 2>&1 \
33 | grep table: | awk '{print $2}' | sort -u | wc -l`
34
35if [ $COUNT != 5 ] ; then
36 vlog "xtrabackup --stats does not work"
37 exit -1
38fi
39
40stop_server
41
42# Restore partial backup
43ib_part_restore $topdir $mysql_datadir
44
45start_server
46
47ib_part_assert_checksum $checksum_a
048
=== added file 'test/t/ib_part_include_stream.sh'
--- test/t/ib_part_include_stream.sh 1970-01-01 00:00:00 +0000
+++ test/t/ib_part_include_stream.sh 2012-12-07 11:29:22 +0000
@@ -0,0 +1,39 @@
1########################################################################
2# Bug #711166: Partitioned tables are not correctly handled by the
3# --databases and --tables-file options of innobackupex,
4# and by the --tables option of xtrabackup.
5# Testcase covers using --include option with InnoDB
6# database and --stream mode
7########################################################################
8
9. inc/common.sh
10. inc/ib_part.sh
11
12start_server --innodb_file_per_table
13
14require_partitioning
15
16# Create MyISAM partitioned table
17ib_part_init $topdir MyISAM
18
19# Saving the checksum of original table
20checksum_a=`checksum_table test test`
21
22# Take a backup
23mkdir -p $topdir/backup
24innobackupex --stream=tar --include='test.test$' $topdir/backup > $topdir/backup/backup.tar
25$TAR ixvf $topdir/backup/backup.tar -C $topdir/backup
26$TAR cvhf $topdir/backup/backup11.tar $mysql_datadir/test/*
27
28innobackupex --apply-log $topdir/backup
29
30vlog "Backup taken"
31
32stop_server
33
34# Restore partial backup
35ib_part_restore $topdir $mysql_datadir
36
37start_server
38
39ib_part_assert_checksum $checksum_a
040
=== added file 'test/t/ib_part_tf_innodb.sh'
--- test/t/ib_part_tf_innodb.sh 1970-01-01 00:00:00 +0000
+++ test/t/ib_part_tf_innodb.sh 2012-12-07 11:29:22 +0000
@@ -0,0 +1,46 @@
1########################################################################
2# Bug #711166: Partitioned tables are not correctly handled by the
3# --databases and --tables-file options of innobackupex,
4# and by the --tables option of xtrabackup.
5# Testcase covers using --tables-file option with InnoDB
6# database
7########################################################################
8
9. inc/common.sh
10. inc/ib_part.sh
11
12start_server --innodb_file_per_table
13
14require_partitioning
15
16# Create InnoDB partitioned table
17ib_part_init $topdir InnoDB
18
19# Saving the checksum of original table
20checksum_a=`checksum_table test test`
21
22# Take a backup
23# Only backup of test.test table will be taken
24cat >$topdir/tables <<EOF
25test.test
26EOF
27innobackupex --no-timestamp --tables-file=$topdir/tables $topdir/backup
28innobackupex --apply-log $topdir/backup
29vlog "Backup taken"
30
31COUNT=`xtrabackup --stats --tables-file=$topdir/tables --datadir=$topdir/backup 2>&1 \
32 | grep table: | awk '{print $2}' | sort -u | wc -l`
33
34if [ $COUNT != 5 ] ; then
35 vlog "xtrabackup --stats does not work"
36 exit -1
37fi
38
39stop_server
40
41# Restore partial backup
42ib_part_restore $topdir $mysql_datadir
43
44start_server
45
46ib_part_assert_checksum $checksum_a
047
=== added file 'test/t/ib_part_tf_innodb_stream.sh'
--- test/t/ib_part_tf_innodb_stream.sh 1970-01-01 00:00:00 +0000
+++ test/t/ib_part_tf_innodb_stream.sh 2012-12-07 11:29:22 +0000
@@ -0,0 +1,40 @@
1########################################################################
2# Bug #711166: Partitioned tables are not correctly handled by the
3# --databases and --tables-file options of innobackupex,
4# and by the --tables option of xtrabackup.
5# Testcase covers using --tables-file option with InnoDB
6# database and --stream mode
7########################################################################
8
9. inc/common.sh
10. inc/ib_part.sh
11
12start_server --innodb_file_per_table
13
14require_partitioning
15
16# Create InnoDB partitioned table
17ib_part_init $topdir InnoDB
18
19# Saving the checksum of original table
20checksum_a=`checksum_table test test`
21
22# Take a backup
23# Only backup of test.test table will be taken
24cat >$topdir/tables <<EOF
25test.test
26EOF
27mkdir -p $topdir/backup
28innobackupex --stream=tar --no-timestamp --tables-file=$topdir/tables $topdir/backup > $topdir/backup/backup.tar
29$TAR ixvf $topdir/backup/backup.tar -C $topdir/backup
30innobackupex --apply-log $topdir/backup
31vlog "Backup taken"
32
33stop_server
34
35# Restore partial backup
36ib_part_restore $topdir $mysql_datadir
37
38start_server
39
40ib_part_assert_checksum $checksum_a
041
=== added file 'test/t/ib_part_tf_myisam.sh'
--- test/t/ib_part_tf_myisam.sh 1970-01-01 00:00:00 +0000
+++ test/t/ib_part_tf_myisam.sh 2012-12-07 11:29:22 +0000
@@ -0,0 +1,39 @@
1########################################################################
2# Bug #711166: Partitioned tables are not correctly handled by the
3# --databases and --tables-file options of innobackupex,
4# and by the --tables option of xtrabackup.
5# Testcase covers using --tables-file option with MyISAM
6# database
7########################################################################
8
9. inc/common.sh
10. inc/ib_part.sh
11
12start_server
13
14require_partitioning
15
16# Create MyISAM partitioned table with some partitions in
17# different location
18ib_part_init $topdir MyISAM
19
20# Saving the checksum of original table
21checksum_a=`checksum_table test test`
22
23# Take a backup
24# Only backup of test.test table will be taken
25cat >$topdir/tables <<EOF
26test.test
27EOF
28innobackupex --no-timestamp --tables-file=$topdir/tables $topdir/backup
29innobackupex --apply-log $topdir/backup
30vlog "Backup taken"
31
32stop_server
33
34# Restore partial backup
35ib_part_restore $topdir $mysql_datadir
36
37start_server
38
39ib_part_assert_checksum $checksum_a

Subscribers

People subscribed via source and target branches