Merge lp:~akopytov/percona-xtrabackup/bug1055547-2.0 into lp:percona-xtrabackup/2.0

Proposed by Alexey Kopytov
Status: Merged
Approved by: Sergei Glushchenko
Approved revision: no longer in the source branch.
Merged at revision: 514
Proposed branch: lp:~akopytov/percona-xtrabackup/bug1055547-2.0
Merge into: lp:percona-xtrabackup/2.0
Diff against target: 39 lines (+7/-6)
1 file modified
src/xtrabackup.cc (+7/-6)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/bug1055547-2.0
Reviewer Review Type Date Requested Status
Sergei Glushchenko (community) g2 Approve
Review via email: mp+152247@code.launchpad.net

Description of the change

Bug #1055547: xtrabackup as SST fails when innodb_flush_method is
                  O_DIRECT

    XtraBackup sometimes calls os_file_read() / os_file_write() calls on the
    log file to read/update log file header. The problem was that those
    calls honor the innodb_flush_method value and thus may do O_DIRECT I/O,
    which has strict alignment rules on both I/O operations themselves and
    user-space buffers, i.e. they must be aligned on the filesystem block
    size. I/O operations could never become a problem, because we always
    read/write from/to the start of the file. However, user-space buffers
    used for those operations were aligned to LOG_FILE_HDR_SIZE (2048 bytes),
    which is not necessarily greater than the FS block size.

    Fixed by making sure buffers are aligned to UNIV_PAGE_SIZE_MAX (16
    KB). Which may be redundant, since it is unlikely that FS block sizes >
    4 KB are ever used or even supported. However, that constant is used to
    be on the safe side and similar to other buffers alignment.

http://jenkins.percona.com/view/XtraBackup/job/percona-xtrabackup-2.0-param/365/

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

Approve

review: Approve (g2)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/xtrabackup.cc'
2--- src/xtrabackup.cc 2013-03-01 06:54:51 +0000
3+++ src/xtrabackup.cc 2013-03-07 17:54:38 +0000
4@@ -4652,9 +4652,9 @@
5 datafiles_iter_t *it;
6
7 log_hdr_buf_ = static_cast<byte *>
8- (ut_malloc(LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE));
9+ (ut_malloc(LOG_FILE_HDR_SIZE + UNIV_PAGE_SIZE_MAX));
10 log_hdr_buf = static_cast<byte *>
11- (ut_align(log_hdr_buf_, OS_FILE_LOG_BLOCK_SIZE));
12+ (ut_align(log_hdr_buf_, UNIV_PAGE_SIZE_MAX));
13
14 /* get current checkpoint_lsn */
15 /* Look for the latest checkpoint from any of the log groups */
16@@ -5588,9 +5588,9 @@
17 }
18
19 log_buf_ = static_cast<byte *>
20- (ut_malloc(LOG_FILE_HDR_SIZE * 2));
21+ (ut_malloc(LOG_FILE_HDR_SIZE + UNIV_PAGE_SIZE_MAX));
22 log_buf = static_cast<byte *>
23- (ut_align(log_buf_, LOG_FILE_HDR_SIZE));
24+ (ut_align(log_buf_, UNIV_PAGE_SIZE_MAX));
25
26 success = os_file_read(src_file, log_buf, 0, 0, LOG_FILE_HDR_SIZE);
27 if (!success) {
28@@ -6514,8 +6514,9 @@
29
30 xb_file_set_nocache(src_file, src_path, "OPEN");
31
32- log_buf_ = static_cast<byte *>(ut_malloc(LOG_FILE_HDR_SIZE * 2));
33- log_buf = static_cast<byte *>(ut_align(log_buf_, LOG_FILE_HDR_SIZE));
34+ log_buf_ = static_cast<byte *>(ut_malloc(LOG_FILE_HDR_SIZE +
35+ UNIV_PAGE_SIZE_MAX));
36+ log_buf = static_cast<byte *>(ut_align(log_buf_, UNIV_PAGE_SIZE_MAX));
37
38 success = os_file_read(src_file, log_buf, 0, 0, LOG_FILE_HDR_SIZE);
39 if (!success) {

Subscribers

People subscribed via source and target branches