Merge lp:~sergei.glushchenko/percona-xtrabackup/2.2-BT48819-xb-bug1403237 into lp:percona-xtrabackup/2.2

Proposed by Sergei Glushchenko on 2015-01-06
Status: Merged
Approved by: Alexey Kopytov on 2015-01-07
Approved revision: 5058
Merged at revision: 5058
Proposed branch: lp:~sergei.glushchenko/percona-xtrabackup/2.2-BT48819-xb-bug1403237
Merge into: lp:percona-xtrabackup/2.2
Diff against target: 97 lines (+26/-6)
3 files modified
storage/innobase/include/log0log.h (+2/-0)
storage/innobase/log/log0recv.cc (+10/-2)
storage/innobase/xtrabackup/src/xtrabackup.cc (+14/-4)
To merge this branch: bzr merge lp:~sergei.glushchenko/percona-xtrabackup/2.2-BT48819-xb-bug1403237
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) 2015-01-06 Approve on 2015-01-07
Review via email: mp+245670@code.launchpad.net

Description of the change

http://jenkins.percona.com/view/PXB%202.2/job/percona-xtrabackup-2.2-param/276/

    Bug 1403237: apply-log Failed with small xtrabackup_logfile

    The root cause is that last checkpoint lsn offset in log group is
    stored at different offsets in ibdata1 for Percona Server 5.5 and
    MySQL 5.6 when total size of log files is greater than 4G.

    This fix is to try both variants of the offset when starting log
    copying, one of them has to work.

No changes needed when it comes to creating empty log files upon prepare as checkpoint LSN offset will be close to LOG_FILE_HDR_SIZE and both PS 5.1/5.5 and MySQL 5.6 will recognize it correctly.

No changes needed when we create temporary log file because only xtrabackup read it and it must be of same format as MySQL 5.6. We don't recommend to prepare backup with the same version of xtrabackup which used for taking backup.

Revision IDS in branch and jenkins build are not the same, but only thing changed is commit message.

To post a comment you must log in.
Alexey Kopytov (akopytov) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'storage/innobase/include/log0log.h'
2--- storage/innobase/include/log0log.h 2014-09-15 08:52:36 +0000
3+++ storage/innobase/include/log0log.h 2015-01-06 16:38:15 +0000
4@@ -749,6 +749,8 @@
5 lsn_t lsn; /*!< lsn used to fix coordinates within
6 the log group */
7 lsn_t lsn_offset; /*!< the offset of the above lsn */
8+ lsn_t lsn_offset_alt; /*!< alternative lsn offset for PS 5.5
9+ with large log files */
10 ulint n_pending_writes;/*!< number of currently pending flush
11 writes for this log group */
12 byte** file_header_bufs_ptr;/*!< unaligned buffers */
13
14=== modified file 'storage/innobase/log/log0recv.cc'
15--- storage/innobase/log/log0recv.cc 2014-12-28 13:11:05 +0000
16+++ storage/innobase/log/log0recv.cc 2015-01-06 16:38:15 +0000
17@@ -800,8 +800,16 @@
18 buf + LOG_CHECKPOINT_LSN);
19 group->lsn_offset = mach_read_from_4(
20 buf + LOG_CHECKPOINT_OFFSET_LOW32);
21- group->lsn_offset |= ((lsn_t) mach_read_from_4(
22- buf + LOG_CHECKPOINT_OFFSET_HIGH32)) << 32;
23+ group->lsn_offset_alt = group->lsn_offset;
24+ if (group->file_size * group->n_files >
25+ 4294967296ULL /* 4GiB */) {
26+ group->lsn_offset |= ((lsn_t) mach_read_from_4(
27+ buf + LOG_CHECKPOINT_OFFSET_HIGH32))
28+ << 32;
29+ group->lsn_offset_alt =
30+ ((lsn_t) mach_read_from_8(
31+ buf + LOG_CHECKPOINT_ARCHIVED_LSN));
32+ }
33 checkpoint_no = mach_read_from_8(
34 buf + LOG_CHECKPOINT_NO);
35
36
37=== modified file 'storage/innobase/xtrabackup/src/xtrabackup.cc'
38--- storage/innobase/xtrabackup/src/xtrabackup.cc 2014-12-22 11:27:03 +0000
39+++ storage/innobase/xtrabackup/src/xtrabackup.cc 2015-01-06 16:38:15 +0000
40@@ -2062,7 +2062,7 @@
41 }
42
43 static my_bool
44-xtrabackup_copy_logfile(lsn_t from_lsn, my_bool is_last)
45+xtrabackup_copy_logfile(lsn_t from_lsn, my_bool is_last, my_bool is_first)
46 {
47 /* definition from recv_recovery_from_checkpoint_start() */
48 log_group_t* group;
49@@ -2095,6 +2095,7 @@
50
51 mutex_enter(&log_sys->mutex);
52
53+retry_read:
54 log_group_read_log_seg(LOG_RECOVER, log_sys->buf,
55 group, start_lsn, end_lsn);
56
57@@ -2124,6 +2125,15 @@
58 blocks_in_group = log_block_convert_lsn_to_no(
59 log_group_get_capacity(group)) - 1;
60
61+ /* Can be just wrong lsn_offset. Is it PS 5.5 with large
62+ log files? */
63+ if (is_first &&
64+ group->lsn_offset != group->lsn_offset_alt) {
65+ group->lsn_offset = group->lsn_offset_alt;
66+ is_first = FALSE;
67+ goto retry_read;
68+ }
69+
70 if (no < scanned_no ||
71 /* Log block numbers wrap around at 0x3FFFFFFF */
72 ((scanned_no | 0x40000000UL) - no) %
73@@ -2302,7 +2312,7 @@
74 0);
75 if (log_copying) {
76 if(xtrabackup_copy_logfile(log_copy_scanned_lsn,
77- FALSE)) {
78+ FALSE, FALSE)) {
79
80 exit(EXIT_FAILURE);
81 }
82@@ -2310,7 +2320,7 @@
83 }
84
85 /* last copying */
86- if(xtrabackup_copy_logfile(log_copy_scanned_lsn, TRUE)) {
87+ if(xtrabackup_copy_logfile(log_copy_scanned_lsn, TRUE, FALSE)) {
88
89 exit(EXIT_FAILURE);
90 }
91@@ -3554,7 +3564,7 @@
92
93
94 /* copy log file by current position */
95- if(xtrabackup_copy_logfile(checkpoint_lsn_start, FALSE))
96+ if(xtrabackup_copy_logfile(checkpoint_lsn_start, FALSE, TRUE))
97 exit(EXIT_FAILURE);
98
99

Subscribers

People subscribed via source and target branches