Merge lp:~akopytov/percona-xtrabackup/bug1190779-2.1 into lp:percona-xtrabackup/2.1

Proposed by Alexey Kopytov
Status: Merged
Approved by: Alexey Kopytov
Approved revision: no longer in the source branch.
Merged at revision: 643
Proposed branch: lp:~akopytov/percona-xtrabackup/bug1190779-2.1
Merge into: lp:percona-xtrabackup/2.1
Diff against target: 192 lines (+17/-53)
1 file modified
src/xtrabackup.cc (+17/-53)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/bug1190779-2.1
Reviewer Review Type Date Requested Status
George Ormond Lorch III Pending
Review via email: mp+173933@code.launchpad.net

Description of the change

    Bug #1190779: lp:1055547 repeatable on XFS

    The problem was in an length-unaligned I/O request issued while
    manipulating xtrabackup_logfile with O_DIRECT enabled.

    We don't actually need O_DIRECT in those cases, so the fix was to
    disable O_DIRECT.. The patch also removes userspace buffer alignment
    code and implements other minor cleanups.

To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) wrote :
Revision history for this message
George Ormond Lorch III (gl-az) wrote :

Same comment as 2.0 branch/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-07-10 12:29:40 +0000
3+++ src/xtrabackup.cc 2013-07-10 12:47:54 +0000
4@@ -3824,8 +3824,7 @@
5 ibool success;
6
7 ulint field;
8- byte* log_buf;
9- byte* log_buf_ = NULL;
10+ byte log_buf[UNIV_PAGE_SIZE_MAX * 128]; /* 2 MB */
11
12 ib_int64_t file_size;
13
14@@ -3879,11 +3878,6 @@
15 goto error;
16 }
17
18- log_buf_ = static_cast<byte *>
19- (ut_malloc(LOG_FILE_HDR_SIZE + UNIV_PAGE_SIZE_MAX));
20- log_buf = static_cast<byte *>
21- (ut_align(log_buf_, UNIV_PAGE_SIZE_MAX));
22-
23 success = xb_os_file_read(src_file, log_buf, 0,
24 LOG_FILE_HDR_SIZE);
25 if (!success) {
26@@ -3895,9 +3889,6 @@
27 msg(" xtrabackup: 'ib_logfile0' seems to be "
28 "'xtrabackup_logfile'. will retry.\n");
29
30- ut_free(log_buf_);
31- log_buf_ = NULL;
32-
33 os_file_close(src_file);
34 src_file = XB_FILE_UNDEFINED;
35
36@@ -3913,26 +3904,16 @@
37 msg(" xtrabackup: Fatal error: cannot find %s.\n",
38 src_path);
39
40- ut_free(log_buf_);
41- log_buf_ = NULL;
42-
43 os_file_close(src_file);
44 src_file = XB_FILE_UNDEFINED;
45
46 goto error;
47 }
48
49- posix_fadvise(src_file, 0, 0, POSIX_FADV_SEQUENTIAL);
50- posix_fadvise(src_file, 0, 0, POSIX_FADV_DONTNEED);
51-
52- xb_file_set_nocache(src_file, src_path, "OPEN");
53-
54 file_size = os_file_get_size(src_file);
55
56
57 /* TODO: We should skip the following modifies, if it is not the first time. */
58- log_buf_ = static_cast<byte *>(ut_malloc(UNIV_PAGE_SIZE * 129));
59- log_buf = static_cast<byte *>(ut_align(log_buf_, UNIV_PAGE_SIZE));
60
61 /* read log file header */
62 success = xb_os_file_read(src_file, log_buf, 0, LOG_FILE_HDR_SIZE);
63@@ -4027,15 +4008,15 @@
64 goto error;
65 }
66
67- /* expand file size (9/8) and align to UNIV_PAGE_SIZE */
68+ /* expand file size (9/8) and align to UNIV_PAGE_SIZE_MAX */
69
70- if (file_size % UNIV_PAGE_SIZE) {
71- memset(log_buf, 0, UNIV_PAGE_SIZE);
72+ if (file_size % UNIV_PAGE_SIZE_MAX) {
73+ memset(log_buf, 0, UNIV_PAGE_SIZE_MAX);
74 success = xb_os_file_write(src_path, src_file, log_buf,
75 file_size,
76- UNIV_PAGE_SIZE
77+ UNIV_PAGE_SIZE_MAX
78 - (ulint) (file_size
79- % UNIV_PAGE_SIZE));
80+ % UNIV_PAGE_SIZE_MAX));
81 if (!success) {
82 goto error;
83 }
84@@ -4047,40 +4028,41 @@
85 {
86 ulint expand;
87
88- memset(log_buf, 0, UNIV_PAGE_SIZE * 128);
89- expand = (ulint) (file_size / UNIV_PAGE_SIZE / 8);
90+ memset(log_buf, 0, UNIV_PAGE_SIZE_MAX * 128);
91+ expand = (ulint) (file_size / UNIV_PAGE_SIZE_MAX / 8);
92
93 for (; expand > 128; expand -= 128) {
94 success = xb_os_file_write(src_path, src_file, log_buf,
95 file_size,
96- UNIV_PAGE_SIZE * 128);
97+ UNIV_PAGE_SIZE_MAX * 128);
98 if (!success) {
99 goto error;
100 }
101- file_size += UNIV_PAGE_SIZE * 128;
102+ file_size += UNIV_PAGE_SIZE_MAX * 128;
103 }
104
105 if (expand) {
106 success = xb_os_file_write(src_path, src_file, log_buf,
107 file_size,
108- expand * UNIV_PAGE_SIZE);
109+ expand * UNIV_PAGE_SIZE_MAX);
110 if (!success) {
111 goto error;
112 }
113- file_size += UNIV_PAGE_SIZE * expand;
114+ file_size += UNIV_PAGE_SIZE_MAX * expand;
115 }
116 }
117
118 /* make larger than 2MB */
119 if (file_size < 2*1024*1024L) {
120- memset(log_buf, 0, UNIV_PAGE_SIZE);
121+ memset(log_buf, 0, UNIV_PAGE_SIZE_MAX);
122 while (file_size < 2*1024*1024L) {
123 success = xb_os_file_write(src_path, src_file, log_buf,
124- file_size, UNIV_PAGE_SIZE);
125+ file_size,
126+ UNIV_PAGE_SIZE_MAX);
127 if (!success) {
128 goto error;
129 }
130- file_size += UNIV_PAGE_SIZE;
131+ file_size += UNIV_PAGE_SIZE_MAX;
132 }
133 file_size = os_file_get_size(src_file);
134 }
135@@ -4105,21 +4087,16 @@
136 }
137 xtrabackup_logfile_is_renamed = TRUE;
138
139- ut_free(log_buf_);
140-
141 return(FALSE);
142
143 skip_modify:
144 os_file_close(src_file);
145 src_file = XB_FILE_UNDEFINED;
146- ut_free(log_buf_);
147 return(FALSE);
148
149 error:
150 if (src_file != XB_FILE_UNDEFINED)
151 os_file_close(src_file);
152- if (log_buf_)
153- ut_free(log_buf_);
154 msg("xtrabackup: Error: xtrabackup_init_temp_log() failed.\n");
155 return(TRUE); /*ERROR*/
156 }
157@@ -4721,10 +4698,7 @@
158 char src_path[FN_REFLEN];
159 char dst_path[FN_REFLEN];
160 ibool success;
161-
162- byte* log_buf;
163- byte* log_buf_ = NULL;
164-
165+ byte log_buf[UNIV_PAGE_SIZE_MAX];
166
167 if (!xtrabackup_logfile_is_renamed)
168 return(FALSE);
169@@ -4760,14 +4734,6 @@
170 goto error;
171 }
172
173- posix_fadvise(src_file, 0, 0, POSIX_FADV_DONTNEED);
174-
175- xb_file_set_nocache(src_file, src_path, "OPEN");
176-
177- log_buf_ = static_cast<byte *>(ut_malloc(LOG_FILE_HDR_SIZE +
178- UNIV_PAGE_SIZE_MAX));
179- log_buf = static_cast<byte *>(ut_align(log_buf_, UNIV_PAGE_SIZE_MAX));
180-
181 success = xb_os_file_read(src_file, log_buf, 0, LOG_FILE_HDR_SIZE);
182 if (!success) {
183 goto error;
184@@ -4788,8 +4754,6 @@
185 error:
186 if (src_file != XB_FILE_UNDEFINED)
187 os_file_close(src_file);
188- if (log_buf_)
189- ut_free(log_buf_);
190 msg("xtrabackup: Error: xtrabackup_close_temp_log() failed.\n");
191 return(TRUE); /*ERROR*/
192 }

Subscribers

People subscribed via source and target branches

to all changes: