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

Proposed by Sergei Glushchenko
Status: Merged
Approved by: Laurynas Biveinis
Approved revision: no longer in the source branch.
Merged at revision: 431
Proposed branch: lp:~sergei.glushchenko/percona-xtrabackup/xb21-bug1038127
Merge into: lp:percona-xtrabackup/2.1
Diff against target: 125 lines (+70/-8)
2 files modified
src/xtrabackup.c (+29/-8)
test/t/bug1038127.sh (+41/-0)
To merge this branch: bzr merge lp:~sergei.glushchenko/percona-xtrabackup/xb21-bug1038127
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) Approve
Review via email: mp+122661@code.launchpad.net

Description of the change

Merge fix for bug 1038127 from 2.0

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

please hold until jenkins build passed

Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote :
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

The commit is missing the --fixes=lp:123 option.
s/compatable/compatible for the testcase header - applies for 2.0 fix too, not sure if we want to fix this now.

No need for another Jenkins run for these changes.

review: Needs Fixing
Revision history for this message
Alexey Kopytov (akopytov) wrote :

The --fixes-lp:123 is not required as long as the branch is associated with the bug. It's OK to do it manually.

Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote :

Typo in comment been fixed

Revision history for this message
Laurynas Biveinis (laurynas-biveinis) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/xtrabackup.c'
--- src/xtrabackup.c 2012-08-03 05:14:45 +0000
+++ src/xtrabackup.c 2012-09-05 08:37:22 +0000
@@ -1499,10 +1499,14 @@
1499static my_bool1499static my_bool
1500xb_read_delta_metadata(const char *filepath, xb_delta_info_t *info)1500xb_read_delta_metadata(const char *filepath, xb_delta_info_t *info)
1501{1501{
1502 FILE *fp;1502 FILE* fp;
1503 my_bool r= TRUE;1503 char key[51];
1504 char value[51];
1505 my_bool r = TRUE;
15041506
1505 memset(info, 0, sizeof(xb_delta_info_t));1507 /* set defaults */
1508 info->page_size = ULINT_UNDEFINED;
1509 info->space_id = ULINT_UNDEFINED;
15061510
1507 fp = fopen(filepath, "r");1511 fp = fopen(filepath, "r");
1508 if (!fp) {1512 if (!fp) {
@@ -1510,12 +1514,28 @@
1510 return(TRUE);1514 return(TRUE);
1511 }1515 }
15121516
1513 if (fscanf(fp, "page_size = %lu\nspace_id = %lu\n",1517 while (!feof(fp)) {
1514 &info->page_size, &info->space_id) != 2)1518 if (fscanf(fp, "%50s = %50s\n", key, value) == 2) {
1515 r= FALSE;1519 if (strcmp(key, "page_size") == 0) {
1520 info->page_size = strtoul(value, NULL, 10);
1521 } else if (strcmp(key, "space_id") == 0) {
1522 info->space_id = strtoul(value, NULL, 10);
1523 }
1524 }
1525 }
15161526
1517 fclose(fp);1527 fclose(fp);
15181528
1529 if (info->page_size == ULINT_UNDEFINED) {
1530 msg("xtrabackup: page_size is required in %s\n", filepath);
1531 r = FALSE;
1532 }
1533 if (info->space_id == ULINT_UNDEFINED) {
1534 msg("xtrabackup: Warning: This backup was taken with XtraBackup 2.0.1 "
1535 "or earlier, some DDL operations between full and incremental "
1536 "backups may be handled incorrectly\n");
1537 }
1538
1519 return(r);1539 return(r);
1520}1540}
15211541
@@ -3836,7 +3856,7 @@
3836 os_file_t file = 0;3856 os_file_t file = 0;
3837 ulint tablespace_flags;3857 ulint tablespace_flags;
38383858
3839 ut_a(dbname || space_id == 0);3859 ut_a(dbname != NULL || space_id == 0 || space_id == ULINT_UNDEFINED);
38403860
3841 *success = FALSE;3861 *success = FALSE;
38423862
@@ -3870,7 +3890,7 @@
3870 mutex_exit(&fil_system->mutex);3890 mutex_exit(&fil_system->mutex);
38713891
3872 if (fil_space != NULL) {3892 if (fil_space != NULL) {
3873 if (fil_space->id == space_id) {3893 if (fil_space->id == space_id || space_id == ULINT_UNDEFINED) {
3874 /* we found matching space */3894 /* we found matching space */
3875 goto found;3895 goto found;
3876 } else {3896 } else {
@@ -3894,6 +3914,7 @@
3894 }3914 }
38953915
3896 mutex_enter(&fil_system->mutex);3916 mutex_enter(&fil_system->mutex);
3917 ut_a(space_id != ULINT_UNDEFINED);
3897 fil_space = xb_space_get_by_id(space_id);3918 fil_space = xb_space_get_by_id(space_id);
3898 mutex_exit(&fil_system->mutex);3919 mutex_exit(&fil_system->mutex);
3899 if (fil_space != NULL) {3920 if (fil_space != NULL) {
39003921
=== added file 'test/t/bug1038127.sh'
--- test/t/bug1038127.sh 1970-01-01 00:00:00 +0000
+++ test/t/bug1038127.sh 2012-09-05 08:37:22 +0000
@@ -0,0 +1,41 @@
1############################################################################
2# Bug #1038127: XtraBackup 2.0.2 is not backwards compatible
3# if no space_id found in .meta file, applying delta
4# to full backup failing
5############################################################################
6
7. inc/common.sh
8
9start_server --innodb_file_per_table
10
11run_cmd $MYSQL $MYSQL_ARGS test <<EOF
12CREATE TABLE t1(a INT) ENGINE=InnoDB;
13INSERT INTO t1 VALUES (1), (2), (3);
14EOF
15
16# Full backup
17# backup root directory
18vlog "Starting backup"
19innobackupex --no-timestamp $topdir/full
20
21vlog "Creating incremental backup"
22
23innobackupex --incremental --no-timestamp \
24 --incremental-basedir=$topdir/full $topdir/inc
25
26# remove space_id = something line from .meta file
27sed -ie '/space_id/ d' $topdir/inc/test/t1.ibd.meta
28
29vlog "Preparing backup"
30
31innobackupex --apply-log --redo-only $topdir/full
32vlog "Log applied to full backup"
33
34innobackupex --apply-log --redo-only --incremental-dir=$topdir/inc \
35 $topdir/full
36vlog "Delta applied to full backup"
37
38innobackupex --apply-log $topdir/full
39vlog "Data prepared for restore"
40
41grep -q "This backup was taken with XtraBackup 2.0.1" $OUTFILE

Subscribers

People subscribed via source and target branches