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

Proposed by Sergei Glushchenko
Status: Merged
Approved by: Alexey Kopytov
Approved revision: no longer in the source branch.
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) Approve
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.
Revision history for this message
Alexey Kopytov (akopytov) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'storage/innobase/include/log0log.h'
--- storage/innobase/include/log0log.h 2014-09-15 08:52:36 +0000
+++ storage/innobase/include/log0log.h 2015-01-06 16:38:15 +0000
@@ -749,6 +749,8 @@
749 lsn_t lsn; /*!< lsn used to fix coordinates within749 lsn_t lsn; /*!< lsn used to fix coordinates within
750 the log group */750 the log group */
751 lsn_t lsn_offset; /*!< the offset of the above lsn */751 lsn_t lsn_offset; /*!< the offset of the above lsn */
752 lsn_t lsn_offset_alt; /*!< alternative lsn offset for PS 5.5
753 with large log files */
752 ulint n_pending_writes;/*!< number of currently pending flush754 ulint n_pending_writes;/*!< number of currently pending flush
753 writes for this log group */755 writes for this log group */
754 byte** file_header_bufs_ptr;/*!< unaligned buffers */756 byte** file_header_bufs_ptr;/*!< unaligned buffers */
755757
=== modified file 'storage/innobase/log/log0recv.cc'
--- storage/innobase/log/log0recv.cc 2014-12-28 13:11:05 +0000
+++ storage/innobase/log/log0recv.cc 2015-01-06 16:38:15 +0000
@@ -800,8 +800,16 @@
800 buf + LOG_CHECKPOINT_LSN);800 buf + LOG_CHECKPOINT_LSN);
801 group->lsn_offset = mach_read_from_4(801 group->lsn_offset = mach_read_from_4(
802 buf + LOG_CHECKPOINT_OFFSET_LOW32);802 buf + LOG_CHECKPOINT_OFFSET_LOW32);
803 group->lsn_offset |= ((lsn_t) mach_read_from_4(803 group->lsn_offset_alt = group->lsn_offset;
804 buf + LOG_CHECKPOINT_OFFSET_HIGH32)) << 32;804 if (group->file_size * group->n_files >
805 4294967296ULL /* 4GiB */) {
806 group->lsn_offset |= ((lsn_t) mach_read_from_4(
807 buf + LOG_CHECKPOINT_OFFSET_HIGH32))
808 << 32;
809 group->lsn_offset_alt =
810 ((lsn_t) mach_read_from_8(
811 buf + LOG_CHECKPOINT_ARCHIVED_LSN));
812 }
805 checkpoint_no = mach_read_from_8(813 checkpoint_no = mach_read_from_8(
806 buf + LOG_CHECKPOINT_NO);814 buf + LOG_CHECKPOINT_NO);
807815
808816
=== modified file 'storage/innobase/xtrabackup/src/xtrabackup.cc'
--- storage/innobase/xtrabackup/src/xtrabackup.cc 2014-12-22 11:27:03 +0000
+++ storage/innobase/xtrabackup/src/xtrabackup.cc 2015-01-06 16:38:15 +0000
@@ -2062,7 +2062,7 @@
2062}2062}
20632063
2064static my_bool2064static my_bool
2065xtrabackup_copy_logfile(lsn_t from_lsn, my_bool is_last)2065xtrabackup_copy_logfile(lsn_t from_lsn, my_bool is_last, my_bool is_first)
2066{2066{
2067 /* definition from recv_recovery_from_checkpoint_start() */2067 /* definition from recv_recovery_from_checkpoint_start() */
2068 log_group_t* group;2068 log_group_t* group;
@@ -2095,6 +2095,7 @@
20952095
2096 mutex_enter(&log_sys->mutex);2096 mutex_enter(&log_sys->mutex);
20972097
2098retry_read:
2098 log_group_read_log_seg(LOG_RECOVER, log_sys->buf,2099 log_group_read_log_seg(LOG_RECOVER, log_sys->buf,
2099 group, start_lsn, end_lsn);2100 group, start_lsn, end_lsn);
21002101
@@ -2124,6 +2125,15 @@
2124 blocks_in_group = log_block_convert_lsn_to_no(2125 blocks_in_group = log_block_convert_lsn_to_no(
2125 log_group_get_capacity(group)) - 1;2126 log_group_get_capacity(group)) - 1;
21262127
2128 /* Can be just wrong lsn_offset. Is it PS 5.5 with large
2129 log files? */
2130 if (is_first &&
2131 group->lsn_offset != group->lsn_offset_alt) {
2132 group->lsn_offset = group->lsn_offset_alt;
2133 is_first = FALSE;
2134 goto retry_read;
2135 }
2136
2127 if (no < scanned_no ||2137 if (no < scanned_no ||
2128 /* Log block numbers wrap around at 0x3FFFFFFF */2138 /* Log block numbers wrap around at 0x3FFFFFFF */
2129 ((scanned_no | 0x40000000UL) - no) %2139 ((scanned_no | 0x40000000UL) - no) %
@@ -2302,7 +2312,7 @@
2302 0);2312 0);
2303 if (log_copying) {2313 if (log_copying) {
2304 if(xtrabackup_copy_logfile(log_copy_scanned_lsn,2314 if(xtrabackup_copy_logfile(log_copy_scanned_lsn,
2305 FALSE)) {2315 FALSE, FALSE)) {
23062316
2307 exit(EXIT_FAILURE);2317 exit(EXIT_FAILURE);
2308 }2318 }
@@ -2310,7 +2320,7 @@
2310 }2320 }
23112321
2312 /* last copying */2322 /* last copying */
2313 if(xtrabackup_copy_logfile(log_copy_scanned_lsn, TRUE)) {2323 if(xtrabackup_copy_logfile(log_copy_scanned_lsn, TRUE, FALSE)) {
23142324
2315 exit(EXIT_FAILURE);2325 exit(EXIT_FAILURE);
2316 }2326 }
@@ -3554,7 +3564,7 @@
35543564
35553565
3556 /* copy log file by current position */3566 /* copy log file by current position */
3557 if(xtrabackup_copy_logfile(checkpoint_lsn_start, FALSE))3567 if(xtrabackup_copy_logfile(checkpoint_lsn_start, FALSE, TRUE))
3558 exit(EXIT_FAILURE);3568 exit(EXIT_FAILURE);
35593569
35603570

Subscribers

People subscribed via source and target branches