Merge lp:~akopytov/percona-xtrabackup/bug1261877-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: 718
Proposed branch: lp:~akopytov/percona-xtrabackup/bug1261877-2.1
Merge into: lp:percona-xtrabackup/2.1
Diff against target: 932 lines (+210/-95)
3 files modified
patches/innodb56.patch (+209/-91)
src/xtrabackup.cc (+1/-1)
test/t/bug759225.sh (+0/-3)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/bug1261877-2.1
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Approve
Review via email: mp+202144@code.launchpad.net

Description of the change

    Bug #1261877: xtrabackup_56 2.1.4 ro4 MySQL server 5.6.11 dont
                  recognisies flush_method = ALL_O_DIRECT

    Added innodb_flush_method=ALL_O_DIRECT support to
    xtrabackup_56. Modified test for bug #759225 to cover XtraDB 5.6 as
    well.

http://jenkins.percona.com/view/PXB%202.1/job/percona-xtrabackup-2.1-param/528/

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
1=== modified file 'patches/innodb56.patch'
2--- patches/innodb56.patch 2014-01-16 12:39:35 +0000
3+++ patches/innodb56.patch 2014-01-17 17:24:35 +0000
4@@ -118,7 +118,7 @@
5 #include "trx0sys.h"
6 #include "row0mysql.h"
7 #ifndef UNIV_HOTBACKUP
8-@@ -313,10 +315,7 @@
9+@@ -313,17 +315,15 @@
10
11 /** The tablespace memory cache. This variable is NULL before the module is
12 initialized. */
13@@ -130,7 +130,19 @@
14
15 /** Determine if user has explicitly disabled fsync(). */
16 #ifndef __WIN__
17-@@ -791,6 +790,7 @@
18+-# define fil_buffering_disabled(s) \
19+- ((s)->purpose == FIL_TABLESPACE \
20+- && srv_unix_file_flush_method \
21+- == SRV_UNIX_O_DIRECT_NO_FSYNC)
22++# define fil_buffering_disabled(s) \
23++ (((s)->purpose == FIL_TABLESPACE \
24++ && srv_unix_file_flush_method == SRV_UNIX_O_DIRECT_NO_FSYNC)\
25++ || ((s)->purpose == FIL_LOG \
26++ && srv_unix_file_flush_method == SRV_UNIX_ALL_O_DIRECT))
27+ #else /* __WIN__ */
28+ # define fil_buffering_disabled(s) (0)
29+ #endif /* __WIN__ */
30+@@ -791,6 +791,7 @@
31 "InnoDB: Error: tablespace id is %lu"
32 " in the data dictionary\n"
33 "InnoDB: but in file %s it is %lu!\n",
34@@ -138,7 +150,7 @@
35 space->id, node->name, space_id);
36
37 ut_error;
38-@@ -830,8 +830,9 @@
39+@@ -830,8 +831,9 @@
40 }
41
42 if (size_bytes >= 1024 * 1024) {
43@@ -150,7 +162,7 @@
44 }
45
46 if (!fsp_flags_is_compressed(flags)) {
47-@@ -2031,12 +2032,6 @@
48+@@ -2031,12 +2033,6 @@
49 contain sensible data */
50 ulint* flags, /*!< out: tablespace flags */
51 ulint* space_id, /*!< out: tablespace ID */
52@@ -163,7 +175,7 @@
53 lsn_t* min_flushed_lsn, /*!< out: min of flushed
54 lsn values in data files */
55 lsn_t* max_flushed_lsn) /*!< out: max of flushed
56-@@ -2061,7 +2056,7 @@
57+@@ -2061,7 +2057,7 @@
58
59 flushed_lsn = mach_read_from_8(page + FIL_PAGE_FILE_FLUSH_LSN);
60
61@@ -172,7 +184,7 @@
62 check_msg = fil_check_first_page(page);
63 }
64
65-@@ -2074,10 +2069,6 @@
66+@@ -2074,10 +2070,6 @@
67 if (!one_read_already) {
68 *min_flushed_lsn = flushed_lsn;
69 *max_flushed_lsn = flushed_lsn;
70@@ -183,7 +195,7 @@
71 return(NULL);
72 }
73
74-@@ -2087,14 +2078,6 @@
75+@@ -2087,14 +2079,6 @@
76 if (*max_flushed_lsn < flushed_lsn) {
77 *max_flushed_lsn = flushed_lsn;
78 }
79@@ -198,7 +210,7 @@
80
81 return(NULL);
82 }
83-@@ -2195,7 +2178,7 @@
84+@@ -2195,7 +2179,7 @@
85 mem_free(path);
86 }
87
88@@ -207,7 +219,7 @@
89 /********************************************************//**
90 Writes a log record about an .ibd file create/rename/delete. */
91 static
92-@@ -2429,7 +2412,7 @@
93+@@ -2429,7 +2413,7 @@
94 space_id, name, path, flags,
95 DICT_TF2_USE_TABLESPACE,
96 FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) {
97@@ -216,7 +228,7 @@
98 }
99 }
100
101-@@ -2788,7 +2771,7 @@
102+@@ -2788,7 +2772,7 @@
103 }
104
105 if (err == DB_SUCCESS) {
106@@ -225,7 +237,7 @@
107 /* Write a log record about the deletion of the .ibd
108 file, so that ibbackup can replay it in the
109 --apply-log phase. We use a dummy mtr and the familiar
110-@@ -3143,7 +3126,7 @@
111+@@ -3143,7 +3127,7 @@
112
113 mutex_exit(&fil_system->mutex);
114
115@@ -234,7 +246,7 @@
116 if (success && !recv_recovery_on) {
117 mtr_t mtr;
118
119-@@ -3527,7 +3510,7 @@
120+@@ -3527,7 +3511,7 @@
121 goto error_exit_1;
122 }
123
124@@ -243,7 +255,7 @@
125 {
126 mtr_t mtr;
127 ulint mlog_file_flag = 0;
128-@@ -3614,11 +3597,99 @@
129+@@ -3614,11 +3598,99 @@
130 lsn_t lsn; /*!< Flushed LSN from header page */
131 ulint id; /*!< Space ID */
132 ulint flags; /*!< Tablespace flags */
133@@ -346,7 +358,7 @@
134 /********************************************************************//**
135 Tries to open a single-table tablespace and optionally checks that the
136 space id in it is correct. If this does not succeed, print an error message
137-@@ -3684,6 +3755,9 @@
138+@@ -3684,6 +3756,9 @@
139 in the default location. If it is remote, it should not be here. */
140 def.filepath = fil_make_ibd_name(tablename, false);
141
142@@ -356,7 +368,7 @@
143 /* The path_in was read from SYS_DATAFILES. */
144 if (path_in) {
145 if (strcmp(def.filepath, path_in)) {
146-@@ -3731,6 +3805,7 @@
147+@@ -3731,6 +3806,7 @@
148 tablespaces_found++;
149 }
150 }
151@@ -364,7 +376,7 @@
152
153 /* Always look for a file at the default location. */
154 ut_a(def.filepath);
155-@@ -3752,9 +3827,6 @@
156+@@ -3752,9 +3828,6 @@
157 if (def.success) {
158 def.check_msg = fil_read_first_page(
159 def.file, FALSE, &def.flags, &def.id,
160@@ -374,7 +386,7 @@
161 &def.lsn, &def.lsn);
162 def.valid = !def.check_msg;
163
164-@@ -3777,9 +3849,6 @@
165+@@ -3777,9 +3850,6 @@
166 if (remote.success) {
167 remote.check_msg = fil_read_first_page(
168 remote.file, FALSE, &remote.flags, &remote.id,
169@@ -384,7 +396,7 @@
170 &remote.lsn, &remote.lsn);
171 remote.valid = !remote.check_msg;
172
173-@@ -3803,9 +3872,6 @@
174+@@ -3803,9 +3873,6 @@
175 if (dict.success) {
176 dict.check_msg = fil_read_first_page(
177 dict.file, FALSE, &dict.flags, &dict.id,
178@@ -394,7 +406,7 @@
179 &dict.lsn, &dict.lsn);
180 dict.valid = !dict.check_msg;
181
182-@@ -3830,11 +3896,15 @@
183+@@ -3830,11 +3897,15 @@
184 /* The following call prints an error message */
185 os_file_get_last_error(true);
186
187@@ -411,7 +423,7 @@
188
189 err = DB_CORRUPTION;
190
191-@@ -4034,9 +4104,6 @@
192+@@ -4034,9 +4105,6 @@
193 {
194 if (const char* check_msg = fil_read_first_page(
195 fsp->file, FALSE, &fsp->flags, &fsp->id,
196@@ -421,7 +433,7 @@
197 &fsp->lsn, &fsp->lsn)) {
198 ib_logf(IB_LOG_LEVEL_ERROR,
199 "%s in tablespace %s (table %s)",
200-@@ -4098,6 +4165,9 @@
201+@@ -4098,6 +4166,9 @@
202 #ifdef UNIV_HOTBACKUP
203 fil_space_t* space;
204 #endif
205@@ -431,7 +443,7 @@
206
207 memset(&def, 0, sizeof(def));
208 memset(&remote, 0, sizeof(remote));
209-@@ -4142,6 +4212,9 @@
210+@@ -4142,6 +4213,9 @@
211 # endif /* !UNIV_HOTBACKUP */
212 #endif
213
214@@ -441,7 +453,7 @@
215 /* Check for a link file which locates a remote tablespace. */
216 remote.success = fil_open_linked_file(
217 tablename, &remote.filepath, &remote.file);
218-@@ -4152,8 +4225,20 @@
219+@@ -4152,8 +4226,20 @@
220 if (!remote.success) {
221 os_file_close(remote.file);
222 mem_free(remote.filepath);
223@@ -462,7 +474,7 @@
224
225
226 /* Try to open the tablespace in the datadir. */
227-@@ -4166,6 +4251,17 @@
228+@@ -4166,6 +4252,17 @@
229 fil_validate_single_table_tablespace(tablename, &def);
230 if (!def.success) {
231 os_file_close(def.file);
232@@ -480,7 +492,7 @@
233 }
234 }
235
236-@@ -4250,7 +4346,7 @@
237+@@ -4250,7 +4347,7 @@
238 /* At this point, only one tablespace is open */
239 ut_a(def.success == !remote.success);
240
241@@ -489,7 +501,7 @@
242
243 /* Get and test the file size. */
244 size = os_file_get_size(fsp->file);
245-@@ -4269,9 +4365,9 @@
246+@@ -4269,9 +4366,9 @@
247
248 /* Every .ibd file is created >= 4 pages in size. Smaller files
249 cannot be ok. */
250@@ -501,7 +513,7 @@
251 ib_logf(IB_LOG_LEVEL_ERROR,
252 "The size of single-table tablespace file %s "
253 "is only " UINT64PF ", should be at least %lu!",
254-@@ -4352,7 +4448,7 @@
255+@@ -4352,7 +4449,7 @@
256 }
257 mutex_exit(&fil_system->mutex);
258 #endif /* UNIV_HOTBACKUP */
259@@ -510,7 +522,7 @@
260 tablename, fsp->id, fsp->flags, FIL_TABLESPACE);
261
262 if (!file_space_create_success) {
263-@@ -4379,13 +4475,55 @@
264+@@ -4379,13 +4476,55 @@
265 }
266
267 func_exit:
268@@ -570,7 +582,7 @@
269 mem_free(tablename);
270 if (remote.success) {
271 mem_free(remote.filepath);
272-@@ -4399,7 +4537,7 @@
273+@@ -4399,7 +4538,7 @@
274 idea is to read as much good data as we can and jump over bad data.
275 @return 0 if ok, -1 if error even after the retries, 1 if at the end
276 of the directory */
277@@ -579,7 +591,7 @@
278 int
279 fil_file_readdir_next_file(
280 /*=======================*/
281-@@ -4439,7 +4577,7 @@
282+@@ -4439,7 +4578,7 @@
283 @return DB_SUCCESS or error number */
284 UNIV_INTERN
285 dberr_t
286@@ -588,7 +600,7 @@
287 /*===================================*/
288 {
289 int ret;
290-@@ -4495,7 +4633,9 @@
291+@@ -4495,7 +4634,9 @@
292 "%s/%s", fil_path_to_mysql_datadir, dbinfo.name);
293 srv_normalize_path_for_win(dbpath);
294
295@@ -599,7 +611,7 @@
296
297 if (dbdir != NULL) {
298
299-@@ -4516,9 +4656,15 @@
300+@@ -4516,9 +4657,15 @@
301 && (0 == strcmp(fileinfo.name
302 + strlen(fileinfo.name) - 4,
303 ".ibd")
304@@ -617,7 +629,7 @@
305 /* The name ends in .ibd or .isl;
306 try opening the file */
307 fil_load_single_table_tablespace(
308-@@ -4674,6 +4820,7 @@
309+@@ -4674,6 +4821,7 @@
310 {
311 fil_space_t* fnamespace;
312 fil_space_t* space;
313@@ -625,7 +637,7 @@
314
315 ut_ad(fil_system);
316
317-@@ -4751,6 +4898,10 @@
318+@@ -4751,6 +4899,10 @@
319 if (fnamespace == NULL) {
320 if (print_error_if_does_not_exist) {
321 fil_report_missing_tablespace(name, id);
322@@ -636,7 +648,7 @@
323 }
324 } else {
325 ut_print_timestamp(stderr);
326-@@ -4774,6 +4925,10 @@
327+@@ -4774,6 +4926,10 @@
328
329 mutex_exit(&fil_system->mutex);
330
331@@ -647,7 +659,7 @@
332 return(FALSE);
333 }
334
335-@@ -5407,6 +5562,16 @@
336+@@ -5407,6 +5563,16 @@
337
338 ut_ad(mode != OS_AIO_IBUF || space->purpose == FIL_TABLESPACE);
339
340@@ -664,7 +676,7 @@
341 node = UT_LIST_GET_FIRST(space->chain);
342
343 for (;;) {
344-@@ -6334,6 +6499,7 @@
345+@@ -6334,6 +6500,7 @@
346 return(err);
347 }
348
349@@ -672,7 +684,7 @@
350 /****************************************************************//**
351 Generate redo logs for swapping two .ibd files */
352 UNIV_INTERN
353-@@ -6360,3 +6526,4 @@
354+@@ -6360,3 +6527,4 @@
355 0, 0, new_name, old_name, mtr);
356 }
357 }
358@@ -1215,6 +1227,25 @@
359 /*-------------------------------------------*/
360
361 extern ibool srv_print_innodb_monitor;
362+@@ -496,13 +503,17 @@
363+ the reason for which is that some FS
364+ do not flush meta-data when
365+ unbuffered IO happens */
366+- SRV_UNIX_O_DIRECT_NO_FSYNC
367++ SRV_UNIX_O_DIRECT_NO_FSYNC,
368+ /*!< do not use fsync() when using
369+ direct IO i.e.: it can be set to avoid
370+ the fsync() call that we make when
371+ using SRV_UNIX_O_DIRECT. However, in
372+ this case user/DBA should be sure about
373+ the integrity of the meta-data */
374++ SRV_UNIX_ALL_O_DIRECT /*!< similar to O_DIRECT, invokes
375++ os_file_set_nocache() on data and log files.
376++ This implies using non-buffered IO but still
377++ using fsync for data but not log files. */
378+ };
379+
380+ /** Alternatives for file i/o in Windows */
381 --- a/storage/innobase/include/srv0start.h
382 +++ b/storage/innobase/include/srv0start.h
383 @@ -68,6 +68,23 @@
384@@ -1288,7 +1319,23 @@
385 group->archived_offset = 0;
386 #endif /* UNIV_LOG_ARCHIVE */
387
388-@@ -1251,6 +1255,11 @@
389+@@ -1179,6 +1183,7 @@
390+ group = (log_group_t*)((ulint) group - 1);
391+
392+ if (srv_unix_file_flush_method != SRV_UNIX_O_DSYNC
393++ && srv_unix_file_flush_method != SRV_UNIX_ALL_O_DIRECT
394+ && srv_unix_file_flush_method != SRV_UNIX_NOSYNC) {
395+
396+ fil_flush(group->space_id);
397+@@ -1200,6 +1205,7 @@
398+ logs and cannot end up here! */
399+
400+ if (srv_unix_file_flush_method != SRV_UNIX_O_DSYNC
401++ && srv_unix_file_flush_method != SRV_UNIX_ALL_O_DIRECT
402+ && srv_unix_file_flush_method != SRV_UNIX_NOSYNC
403+ && srv_flush_log_at_trx_commit != 2) {
404+
405+@@ -1251,6 +1257,11 @@
406 /* Wipe over possible label of ibbackup --restore */
407 memcpy(buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP, " ", 4);
408
409@@ -1300,7 +1347,22 @@
410 dest_offset = nth_file * group->file_size;
411
412 #ifdef UNIV_DEBUG
413-@@ -1856,7 +1865,6 @@
414+@@ -1596,9 +1607,11 @@
415+
416+ mutex_exit(&(log_sys->mutex));
417+
418+- if (srv_unix_file_flush_method == SRV_UNIX_O_DSYNC) {
419+- /* O_DSYNC means the OS did not buffer the log file at all:
420+- so we have also flushed to disk what we have written */
421++ if (srv_unix_file_flush_method == SRV_UNIX_O_DSYNC ||
422++ srv_unix_file_flush_method != SRV_UNIX_ALL_O_DIRECT) {
423++ /* O_DSYNC or SRV_UNIX_ALL_O_DIRECT means the OS did not buffer
424++ the log file at all: so we have also flushed to disk what we
425++ have written */
426+
427+ log_sys->flushed_to_disk_lsn = log_sys->write_lsn;
428+
429+@@ -1856,7 +1869,6 @@
430 log_group_t* group2;
431 #ifdef UNIV_LOG_ARCHIVE
432 ib_uint64_t archived_lsn;
433@@ -1308,7 +1370,7 @@
434 #endif /* UNIV_LOG_ARCHIVE */
435 lsn_t lsn_offset;
436 ulint write_offset;
437-@@ -1866,9 +1874,7 @@
438+@@ -1866,9 +1878,7 @@
439
440 ut_ad(!srv_read_only_mode);
441 ut_ad(mutex_own(&(log_sys->mutex)));
442@@ -1319,7 +1381,7 @@
443
444 buf = group->checkpoint_buf;
445
446-@@ -1889,11 +1895,6 @@
447+@@ -1889,11 +1899,6 @@
448 archived_lsn = LSN_MAX;
449 } else {
450 archived_lsn = log_sys->archived_lsn;
451@@ -1331,7 +1393,17 @@
452 }
453
454 mach_write_to_8(buf + LOG_CHECKPOINT_ARCHIVED_LSN, archived_lsn);
455-@@ -2332,7 +2333,7 @@
456+@@ -2089,7 +2094,8 @@
457+ recv_apply_hashed_log_recs(TRUE);
458+ }
459+
460+- if (srv_unix_file_flush_method != SRV_UNIX_NOSYNC) {
461++ if (srv_unix_file_flush_method != SRV_UNIX_NOSYNC
462++ && srv_unix_file_flush_method != SRV_UNIX_ALL_O_DIRECT) {
463+ fil_flush_file_spaces(FIL_TABLESPACE);
464+ }
465+
466+@@ -2332,7 +2338,7 @@
467 fil_io(OS_FILE_READ | OS_FILE_LOG, sync, group->space_id, 0,
468 (ulint) (source_offset / UNIV_PAGE_SIZE),
469 (ulint) (source_offset % UNIV_PAGE_SIZE),
470@@ -1340,7 +1412,7 @@
471
472 start_lsn += len;
473 buf += len;
474-@@ -2351,12 +2352,68 @@
475+@@ -2351,12 +2357,68 @@
476 log_archived_file_name_gen(
477 /*=======================*/
478 char* buf, /*!< in: buffer where to write */
479@@ -1411,7 +1483,7 @@
480 }
481
482 /******************************************************//**
483-@@ -2394,6 +2451,7 @@
484+@@ -2394,6 +2456,7 @@
485 MONITOR_INC(MONITOR_LOG_IO);
486
487 fil_io(OS_FILE_WRITE | OS_FILE_LOG, true, group->archive_space_id,
488@@ -1419,7 +1491,7 @@
489 dest_offset / UNIV_PAGE_SIZE,
490 dest_offset % UNIV_PAGE_SIZE,
491 2 * OS_FILE_LOG_BLOCK_SIZE,
492-@@ -2429,6 +2487,7 @@
493+@@ -2429,6 +2492,7 @@
494 MONITOR_INC(MONITOR_LOG_IO);
495
496 fil_io(OS_FILE_WRITE | OS_FILE_LOG, true, group->archive_space_id,
497@@ -1427,7 +1499,7 @@
498 dest_offset / UNIV_PAGE_SIZE,
499 dest_offset % UNIV_PAGE_SIZE,
500 OS_FILE_LOG_BLOCK_SIZE,
501-@@ -2483,7 +2542,7 @@
502+@@ -2483,7 +2547,7 @@
503 open_mode = OS_FILE_OPEN;
504 }
505
506@@ -1436,7 +1508,7 @@
507 group->archived_file_no + n_files);
508
509 file_handle = os_file_create(innodb_file_log_key,
510-@@ -2521,8 +2580,8 @@
511+@@ -2521,8 +2585,8 @@
512
513 /* Add the archive file as a node to the space */
514
515@@ -1447,7 +1519,7 @@
516
517 if (next_offset % group->file_size == 0) {
518 log_group_archive_file_header_write(
519-@@ -2558,6 +2617,7 @@
520+@@ -2558,6 +2622,7 @@
521 MONITOR_INC(MONITOR_LOG_IO);
522
523 fil_io(OS_FILE_WRITE | OS_FILE_LOG, false, group->archive_space_id,
524@@ -1455,7 +1527,7 @@
525 (ulint) (next_offset / UNIV_PAGE_SIZE),
526 (ulint) (next_offset % UNIV_PAGE_SIZE),
527 ut_calc_align(len, OS_FILE_LOG_BLOCK_SIZE), buf,
528-@@ -2929,7 +2989,6 @@
529+@@ -2929,7 +2994,6 @@
530 trunc_len);
531 if (increment_file_count) {
532 group->archived_offset = 0;
533@@ -1463,7 +1535,7 @@
534 }
535
536 #ifdef UNIV_DEBUG
537-@@ -3194,7 +3253,6 @@
538+@@ -3194,7 +3258,6 @@
539 /*=======================================*/
540 {
541 lsn_t lsn;
542@@ -1471,7 +1543,7 @@
543 ulint count = 0;
544 ulint total_trx;
545 ulint pending_io;
546-@@ -3411,15 +3469,7 @@
547+@@ -3411,15 +3474,7 @@
548 goto loop;
549 }
550
551@@ -1487,7 +1559,7 @@
552
553 log_archive_close_groups(TRUE);
554 #endif /* UNIV_LOG_ARCHIVE */
555-@@ -3478,7 +3528,16 @@
556+@@ -3478,7 +3533,16 @@
557 srv_shutdown_lsn = lsn;
558
559 if (!srv_read_only_mode) {
560@@ -1505,7 +1577,7 @@
561
562 fil_flush_file_spaces(FIL_TABLESPACE);
563 }
564-@@ -3701,7 +3760,7 @@
565+@@ -3701,7 +3765,7 @@
566
567 #ifdef UNIV_LOG_ARCHIVE
568 rw_lock_free(&log_sys->archive_lock);
569@@ -1595,11 +1667,10 @@
570 + if (UNIV_LIKELY(srv_log_checksum_algorithm ==
571 + SRV_CHECKSUM_ALGORITHM_NONE ||
572 + log_block_calc_checksum(block) == block_checksum)) {
573-
574- return(TRUE);
575- }
576-
577-- if (log_block_get_hdr_no(block) == log_block_get_checksum(block)) {
578++
579++ return(TRUE);
580++ }
581++
582 + if (srv_log_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_STRICT_CRC32 ||
583 + srv_log_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_STRICT_INNODB ||
584 + srv_log_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_STRICT_NONE) {
585@@ -1651,10 +1722,11 @@
586 + if (block_checksum == LOG_NO_CHECKSUM_MAGIC ||
587 + block_checksum == log_block_calc_checksum_crc32(block) ||
588 + block_checksum == log_block_calc_checksum_innodb(block)) {
589-+
590-+ return(TRUE);
591-+ }
592-+
593+
594+ return(TRUE);
595+ }
596+
597+- if (log_block_get_hdr_no(block) == log_block_get_checksum(block)) {
598 + if (log_block_get_hdr_no(block) == block_checksum) {
599
600 /* We assume the log block is in the format of
601@@ -1771,7 +1843,22 @@
602 lsn_t checkpoint_lsn;
603 ib_uint64_t checkpoint_no;
604 lsn_t group_scanned_lsn = 0;
605-@@ -3102,14 +3203,33 @@
606+@@ -3006,9 +3107,13 @@
607+ lsn_t archived_lsn;
608+ #endif /* UNIV_LOG_ARCHIVE */
609+ byte* buf;
610+- byte log_hdr_buf[LOG_FILE_HDR_SIZE];
611++ byte* log_hdr_buf;
612++ byte log_hdr_buf_base[LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE];
613+ dberr_t err;
614+
615++ log_hdr_buf = static_cast<byte *>
616++ (ut_align(log_hdr_buf_base, OS_FILE_LOG_BLOCK_SIZE));
617++
618+ #ifdef UNIV_LOG_ARCHIVE
619+ ut_ad(type != LOG_CHECKPOINT || limit_lsn == LSN_MAX);
620+ /** TRUE when recovering from a checkpoint */
621+@@ -3102,14 +3207,33 @@
622 log_hdr_buf, max_cp_group);
623 }
624
625@@ -1806,7 +1893,7 @@
626 group = UT_LIST_GET_NEXT(log_groups, group);
627 }
628 #endif /* UNIV_LOG_ARCHIVE */
629-@@ -3435,7 +3555,8 @@
630+@@ -3435,7 +3559,8 @@
631 that the data dictionary tables will be free of any locks.
632 The data dictionary latch should guarantee that there is at
633 most one data dictionary transaction active at a time. */
634@@ -1816,7 +1903,7 @@
635 trx_rollback_or_clean_recovered(FALSE);
636 }
637 }
638-@@ -3664,23 +3785,23 @@
639+@@ -3664,23 +3789,23 @@
640 ulint len;
641 ibool ret;
642 byte* buf;
643@@ -1845,7 +1932,7 @@
644
645 if (ret == FALSE) {
646 ask_again:
647-@@ -3725,20 +3846,19 @@
648+@@ -3725,20 +3850,19 @@
649
650 /* Add the archive file as a node to the space */
651
652@@ -1872,7 +1959,7 @@
653 != group->archived_file_no) {
654 fprintf(stderr,
655 "InnoDB: Archive file header inconsistent %s\n", name);
656-@@ -3767,6 +3887,20 @@
657+@@ -3767,6 +3891,20 @@
658 return(TRUE);
659 }
660
661@@ -1893,7 +1980,7 @@
662 recv_sys->scanned_lsn = start_lsn;
663 }
664
665-@@ -3779,7 +3913,7 @@
666+@@ -3779,7 +3917,7 @@
667 return(TRUE);
668 }
669
670@@ -1902,7 +1989,7 @@
671
672 for (;;) {
673 len = RECV_SCAN_SIZE;
674-@@ -3799,13 +3933,13 @@
675+@@ -3799,13 +3937,13 @@
676 fprintf(stderr,
677 "InnoDB: Archive read starting at"
678 " lsn %llu, len %lu from file %s\n",
679@@ -1918,7 +2005,7 @@
680 read_offset % UNIV_PAGE_SIZE, len, buf, NULL);
681
682 ret = recv_scan_log_recs(
683-@@ -3820,10 +3954,12 @@
684+@@ -3820,10 +3958,12 @@
685 }
686
687 if (ret) {
688@@ -1935,7 +2022,7 @@
689 return(TRUE);
690 }
691
692-@@ -3840,26 +3976,18 @@
693+@@ -3840,26 +3980,18 @@
694 Recovers from archived log files, and also from log files, if they exist.
695 @return error code or DB_SUCCESS */
696 UNIV_INTERN
697@@ -1964,7 +2051,7 @@
698
699 recv_sys_create();
700 recv_sys_init(buf_pool_get_curr_size());
701-@@ -3889,7 +4017,7 @@
702+@@ -3889,7 +4021,7 @@
703 return(DB_ERROR);
704 }
705
706@@ -1973,7 +2060,7 @@
707
708 recv_sys->parse_start_lsn = min_flushed_lsn;
709
710-@@ -3903,7 +4031,8 @@
711+@@ -3903,7 +4035,8 @@
712
713 mutex_enter(&(log_sys->mutex));
714
715@@ -1983,7 +2070,7 @@
716 ret = log_group_recover_from_archive_file(group);
717
718 /* Close and truncate a possible processed archive file
719-@@ -3916,9 +4045,9 @@
720+@@ -3916,9 +4049,9 @@
721 trunc_len);
722 }
723
724@@ -1995,7 +2082,7 @@
725 if (recv_sys->recovered_lsn < limit_lsn) {
726
727 if (!recv_sys->scanned_lsn) {
728-@@ -3939,12 +4068,12 @@
729+@@ -3939,12 +4072,12 @@
730
731 mutex_enter(&(log_sys->mutex));
732 }
733@@ -2064,6 +2151,27 @@
734 #if defined(UNIV_HOTBACKUP) || defined(__WIN__)
735 /* InnoDB Hot Backup does not lock the data files.
736 * On Windows, mandatory locking is used.
737+@@ -1750,8 +1750,6 @@
738+
739+ } while (retry);
740+
741+- /* We disable OS caching (O_DIRECT) only on data files */
742+-
743+ if (!srv_read_only_mode
744+ && *success
745+ && type != OS_LOG_FILE
746+@@ -1759,6 +1757,11 @@
747+ || srv_unix_file_flush_method == SRV_UNIX_O_DIRECT_NO_FSYNC)) {
748+
749+ os_file_set_nocache(file, name, mode_str);
750++ } else if (!srv_read_only_mode
751++ && *success
752++ && srv_unix_file_flush_method == SRV_UNIX_ALL_O_DIRECT) {
753++
754++ os_file_set_nocache(file, name, mode_str);
755+ }
756+
757+ #ifdef USE_FILE_LOCK
758 --- a/storage/innobase/page/page0cur.cc
759 +++ b/storage/innobase/page/page0cur.cc
760 @@ -1207,7 +1207,9 @@
761@@ -2254,7 +2362,17 @@
762 #endif /* UNIV_LOG_ARCHIVE */
763 ulint sum_of_new_sizes;
764 ulint sum_of_data_file_sizes;
765-@@ -1931,17 +1940,6 @@
766+@@ -1699,6 +1708,9 @@
767+ } else if (0 == ut_strcmp(srv_file_flush_method_str, "O_DIRECT")) {
768+ srv_unix_file_flush_method = SRV_UNIX_O_DIRECT;
769+
770++ } else if (0 == ut_strcmp(srv_file_flush_method_str, "ALL_O_DIRECT")) {
771++ srv_unix_file_flush_method = SRV_UNIX_ALL_O_DIRECT;
772++
773+ } else if (0 == ut_strcmp(srv_file_flush_method_str, "O_DIRECT_NO_FSYNC")) {
774+ srv_unix_file_flush_method = SRV_UNIX_O_DIRECT_NO_FSYNC;
775+
776+@@ -1931,17 +1943,6 @@
777 os_thread_create(io_handler_thread, n + i, thread_ids + i);
778 }
779
780@@ -2272,7 +2390,7 @@
781 if (srv_n_log_files * srv_log_file_size * UNIV_PAGE_SIZE
782 >= 512ULL * 1024ULL * 1024ULL * 1024ULL) {
783 /* log_block_convert_lsn_to_no() limits the returned block
784-@@ -2000,9 +1998,6 @@
785+@@ -2000,9 +2001,6 @@
786 }
787
788 err = open_or_create_data_files(&create_new_db,
789@@ -2282,7 +2400,7 @@
790 &min_flushed_lsn, &max_flushed_lsn,
791 &sum_of_new_sizes);
792 if (err == DB_FAIL) {
793-@@ -2030,7 +2025,6 @@
794+@@ -2030,7 +2028,6 @@
795
796 #ifdef UNIV_LOG_ARCHIVE
797 srv_normalize_path_for_win(srv_arch_dir);
798@@ -2290,7 +2408,7 @@
799 #endif /* UNIV_LOG_ARCHIVE */
800
801 dirnamelen = strlen(srv_log_group_home_dir);
802-@@ -2110,15 +2104,23 @@
803+@@ -2110,15 +2107,23 @@
804 max_flushed_lsn, logfile0);
805
806 /* Suppress the message about
807@@ -2317,7 +2435,7 @@
808 }
809
810 /* opened all files */
811-@@ -2211,6 +2213,7 @@
812+@@ -2211,6 +2216,7 @@
813
814 err = srv_undo_tablespaces_init(
815 create_new_db,
816@@ -2325,7 +2443,7 @@
817 srv_undo_tablespaces,
818 &srv_undo_tablespaces_open);
819
820-@@ -2284,10 +2287,13 @@
821+@@ -2284,10 +2290,13 @@
822
823 ib_logf(IB_LOG_LEVEL_INFO,
824 " Starting archive recovery from a backup...");
825@@ -2341,7 +2459,7 @@
826 if (err != DB_SUCCESS) {
827
828 return(DB_ERROR);
829-@@ -2312,6 +2318,11 @@
830+@@ -2312,6 +2321,11 @@
831 srv_startup_is_before_trx_rollback_phase = FALSE;
832
833 recv_recovery_from_archive_finish();
834@@ -2353,7 +2471,7 @@
835 #endif /* UNIV_LOG_ARCHIVE */
836 } else {
837
838-@@ -2378,6 +2389,10 @@
839+@@ -2378,6 +2392,10 @@
840
841 recv_recovery_from_checkpoint_finish();
842
843@@ -2364,7 +2482,7 @@
844 if (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) {
845 /* The following call is necessary for the insert
846 buffer to work with multiple tablespaces. We must
847-@@ -2500,7 +2515,9 @@
848+@@ -2500,7 +2518,9 @@
849 value. Important to note that we can do it ONLY after
850 we have finished the recovery process so that the
851 image of TRX_SYS_PAGE_NO is not stale. */
852@@ -2375,7 +2493,7 @@
853 }
854
855 if (!create_new_db && sum_of_new_sizes > 0) {
856-@@ -2523,6 +2540,8 @@
857+@@ -2523,6 +2543,8 @@
858 if (!srv_log_archive_on) {
859 ut_a(DB_SUCCESS == log_archive_noarchivelog());
860 } else {
861@@ -2384,7 +2502,7 @@
862 mutex_enter(&(log_sys->mutex));
863
864 start_archive = FALSE;
865-@@ -2714,6 +2733,7 @@
866+@@ -2714,6 +2736,7 @@
867 && srv_auto_extend_last_data_file
868 && sum_of_data_file_sizes < tablespace_size_in_header) {
869
870@@ -2392,7 +2510,7 @@
871 ut_print_timestamp(stderr);
872 fprintf(stderr,
873 " InnoDB: Error: tablespace size stored in header"
874-@@ -2750,6 +2770,7 @@
875+@@ -2750,6 +2773,7 @@
876
877 return(DB_ERROR);
878 }
879@@ -2400,7 +2518,7 @@
880 }
881
882 /* Check that os_fast_mutexes work as expected */
883-@@ -2774,6 +2795,10 @@
884+@@ -2774,6 +2798,10 @@
885
886 os_fast_mutex_free(&srv_os_test_mutex);
887
888@@ -2411,7 +2529,7 @@
889 if (srv_print_verbose_log) {
890 ib_logf(IB_LOG_LEVEL_INFO,
891 "%s started; log sequence number " LSN_PF "",
892-@@ -2806,6 +2831,7 @@
893+@@ -2806,6 +2834,7 @@
894 fts_optimize_init();
895 }
896
897@@ -2419,7 +2537,7 @@
898 srv_was_started = TRUE;
899
900 return(DB_SUCCESS);
901-@@ -2861,7 +2887,7 @@
902+@@ -2861,7 +2890,7 @@
903 return(DB_SUCCESS);
904 }
905
906
907=== modified file 'src/xtrabackup.cc'
908--- src/xtrabackup.cc 2014-01-10 11:13:00 +0000
909+++ src/xtrabackup.cc 2014-01-17 17:24:35 +0000
910@@ -3013,7 +3013,7 @@
911
912 } else if (0 == ut_strcmp(srv_file_flush_method_str, "nosync")) {
913 srv_unix_file_flush_method = SRV_UNIX_NOSYNC;
914-#ifdef XTRADB_BASED
915+#if defined(XTRADB_BASED) || MYSQL_VERSION_ID > 50600
916 } else if (0 == ut_strcmp(srv_file_flush_method_str, "ALL_O_DIRECT")) {
917 srv_unix_file_flush_method = SRV_UNIX_ALL_O_DIRECT;
918 msg("xtrabackup: using ALL_O_DIRECT\n");
919
920=== modified file 'test/t/bug759225.sh'
921--- test/t/bug759225.sh 2013-07-25 15:04:49 +0000
922+++ test/t/bug759225.sh 2014-01-17 17:24:35 +0000
923@@ -12,9 +12,6 @@
924
925 require_xtradb
926
927-# ALL_O_DIRECT is not supported in XtraDB 5.6 ATM.
928-require_server_version_lower_than 5.6.1
929-
930 MYSQLD_EXTRA_MY_CNF_OPTS="
931 innodb_flush_method=ALL_O_DIRECT
932 "

Subscribers

People subscribed via source and target branches

to all changes: