Merge lp:~akopytov/percona-xtrabackup/support-innodb-log-checksum-algorithm-2.1 into lp:percona-xtrabackup/2.1
- support-innodb-log-checksum-algorithm-2.1
- Merge into 2.1
Status: | Merged |
---|---|
Approved by: | Alexey Kopytov |
Approved revision: | no longer in the source branch. |
Merged at revision: | 692 |
Proposed branch: | lp:~akopytov/percona-xtrabackup/support-innodb-log-checksum-algorithm-2.1 |
Merge into: | lp:percona-xtrabackup/2.1 |
Prerequisite: | lp:~akopytov/percona-xtrabackup/innodb_checksum_algorithm-2.1 |
Diff against target: |
2918 lines (+1284/-952) 5 files modified
innobackupex (+1/-0) patches/innodb56.patch (+1218/-941) src/xtrabackup.cc (+12/-0) test/bootstrap.sh (+2/-11) test/t/innodb_log_checksum_algorithm.sh (+51/-0) |
To merge this branch: | bzr merge lp:~akopytov/percona-xtrabackup/support-innodb-log-checksum-algorithm-2.1 |
Related bugs: | |
Related blueprints: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Laurynas Biveinis (community) | Needs Fixing | ||
Review via email: mp+194493@code.launchpad.net |
Commit message
Description of the change
Implementation of
https:/
Also updated links in bootstrap.sh so Jenkins tests are executed against
Percona Server 5.6.14-62.0 and MySQL 5.6.14.
http://
Laurynas Biveinis (laurynas-biveinis) wrote : | # |
Alexey Kopytov (akopytov) wrote : | # |
Hi Laurynas,
On Mon, 11 Nov 2013 16:40:42 -0000, Laurynas Biveinis wrote:
> Review: Needs Fixing
>
> Alexey -
>
> The MP is mostly OK, except that log_block_
>
Good catch! I'll fix #1250148 and update the XB MP.
Thanks.
Preview Diff
1 | === modified file 'innobackupex' |
2 | --- innobackupex 2013-11-11 15:15:50 +0000 |
3 | +++ innobackupex 2013-11-12 08:58:01 +0000 |
4 | @@ -3570,6 +3570,7 @@ |
5 | |
6 | my @option_names = ( |
7 | "innodb_checksum_algorithm", |
8 | + "innodb_log_checksum_algorithm", |
9 | "innodb_data_file_path", |
10 | "innodb_log_files_in_group", |
11 | "innodb_log_file_size", |
12 | |
13 | === modified file 'patches/innodb56.patch' |
14 | --- patches/innodb56.patch 2013-08-26 06:59:09 +0000 |
15 | +++ patches/innodb56.patch 2013-11-12 08:58:01 +0000 |
16 | @@ -1,3 +1,52 @@ |
17 | +--- a/configure.cmake |
18 | ++++ b/configure.cmake |
19 | +@@ -979,14 +979,6 @@ |
20 | + ENDIF() |
21 | + |
22 | + CHECK_C_SOURCE_COMPILES(" |
23 | +- int main(int argc, char **argv) |
24 | +- { |
25 | +- extern char *__bss_start; |
26 | +- return __bss_start ? 1 : 0; |
27 | +- }" |
28 | +-HAVE_BSS_START) |
29 | +- |
30 | +-CHECK_C_SOURCE_COMPILES(" |
31 | + int main() |
32 | + { |
33 | + extern void __attribute__((weak)) foo(void); |
34 | +--- a/mysys/my_thr_init.c |
35 | ++++ b/mysys/my_thr_init.c |
36 | +@@ -462,8 +462,12 @@ |
37 | + |
38 | + extern void **my_thread_var_dbug() |
39 | + { |
40 | +- struct st_my_thread_var *tmp= |
41 | +- my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys); |
42 | ++ struct st_my_thread_var *tmp; |
43 | ++ |
44 | ++ if (!my_thread_global_init_done) |
45 | ++ return NULL; |
46 | ++ |
47 | ++ tmp= my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys); |
48 | + return tmp && tmp->init ? &tmp->dbug : 0; |
49 | + } |
50 | + #endif /* DBUG_OFF */ |
51 | +--- a/storage/innobase/CMakeLists.txt |
52 | ++++ b/storage/innobase/CMakeLists.txt |
53 | +@@ -44,8 +44,10 @@ |
54 | + # SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") |
55 | + ENDIF() |
56 | + |
57 | +-# Enable InnoDB's UNIV_DEBUG and UNIV_SYNC_DEBUG in debug builds |
58 | +-SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DUNIV_DEBUG -DUNIV_SYNC_DEBUG") |
59 | ++# In XtraBackup do not enable UNIV_SYNC_DEBUG when UNIV_DEBUG is enabled |
60 | ++# due to extreme slowness on compact backup testcases |
61 | ++## Enable InnoDB's UNIV_DEBUG and UNIV_SYNC_DEBUG in debug builds |
62 | ++#SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DUNIV_DEBUG -DUNIV_SYNC_DEBUG") |
63 | + |
64 | + # Add -Wconversion if compiling with GCC |
65 | + ## As of Mar 15 2011 this flag causes 3573+ warnings. If you are reading this |
66 | --- a/storage/innobase/btr/btr0btr.cc |
67 | +++ b/storage/innobase/btr/btr0btr.cc |
68 | @@ -700,7 +700,7 @@ |
69 | @@ -191,7 +240,46 @@ |
70 | fil_node_complete_io(node, fil_system, OS_FILE_READ); |
71 | } |
72 | |
73 | -@@ -2109,7 +2133,7 @@ |
74 | +@@ -1956,12 +1980,6 @@ |
75 | + contain sensible data */ |
76 | + ulint* flags, /*!< out: tablespace flags */ |
77 | + ulint* space_id, /*!< out: tablespace ID */ |
78 | +-#ifdef UNIV_LOG_ARCHIVE |
79 | +- ulint* min_arch_log_no, /*!< out: min of archived |
80 | +- log numbers in data files */ |
81 | +- ulint* max_arch_log_no, /*!< out: max of archived |
82 | +- log numbers in data files */ |
83 | +-#endif /* UNIV_LOG_ARCHIVE */ |
84 | + lsn_t* min_flushed_lsn, /*!< out: min of flushed |
85 | + lsn values in data files */ |
86 | + lsn_t* max_flushed_lsn) /*!< out: max of flushed |
87 | +@@ -1990,10 +2008,6 @@ |
88 | + if (!one_read_already) { |
89 | + *min_flushed_lsn = flushed_lsn; |
90 | + *max_flushed_lsn = flushed_lsn; |
91 | +-#ifdef UNIV_LOG_ARCHIVE |
92 | +- *min_arch_log_no = arch_log_no; |
93 | +- *max_arch_log_no = arch_log_no; |
94 | +-#endif /* UNIV_LOG_ARCHIVE */ |
95 | + return; |
96 | + } |
97 | + |
98 | +@@ -2003,14 +2017,6 @@ |
99 | + if (*max_flushed_lsn < flushed_lsn) { |
100 | + *max_flushed_lsn = flushed_lsn; |
101 | + } |
102 | +-#ifdef UNIV_LOG_ARCHIVE |
103 | +- if (*min_arch_log_no > arch_log_no) { |
104 | +- *min_arch_log_no = arch_log_no; |
105 | +- } |
106 | +- if (*max_arch_log_no < arch_log_no) { |
107 | +- *max_arch_log_no = arch_log_no; |
108 | +- } |
109 | +-#endif /* UNIV_LOG_ARCHIVE */ |
110 | + } |
111 | + |
112 | + /*================ SINGLE-TABLE TABLESPACES ==========================*/ |
113 | +@@ -2109,7 +2115,7 @@ |
114 | mem_free(path); |
115 | } |
116 | |
117 | @@ -200,7 +288,7 @@ |
118 | /********************************************************//** |
119 | Writes a log record about an .ibd file create/rename/delete. */ |
120 | static |
121 | -@@ -2343,7 +2367,7 @@ |
122 | +@@ -2343,7 +2349,7 @@ |
123 | space_id, name, path, flags, |
124 | DICT_TF2_USE_TABLESPACE, |
125 | FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) { |
126 | @@ -209,7 +297,7 @@ |
127 | } |
128 | } |
129 | |
130 | -@@ -2702,7 +2726,7 @@ |
131 | +@@ -2702,7 +2708,7 @@ |
132 | } |
133 | |
134 | if (err == DB_SUCCESS) { |
135 | @@ -218,7 +306,7 @@ |
136 | /* Write a log record about the deletion of the .ibd |
137 | file, so that ibbackup can replay it in the |
138 | --apply-log phase. We use a dummy mtr and the familiar |
139 | -@@ -3057,7 +3081,7 @@ |
140 | +@@ -3057,7 +3063,7 @@ |
141 | |
142 | mutex_exit(&fil_system->mutex); |
143 | |
144 | @@ -227,7 +315,7 @@ |
145 | if (success && !recv_recovery_on) { |
146 | mtr_t mtr; |
147 | |
148 | -@@ -3441,7 +3465,7 @@ |
149 | +@@ -3441,7 +3447,7 @@ |
150 | goto error_exit_1; |
151 | } |
152 | |
153 | @@ -236,8 +324,13 @@ |
154 | { |
155 | mtr_t mtr; |
156 | ulint mlog_file_flag = 0; |
157 | -@@ -3519,6 +3543,97 @@ |
158 | - #endif /* UNIV_LOG_ARCHIVE */ |
159 | +@@ -3514,11 +3520,99 @@ |
160 | + lsn_t lsn; /*!< Flushed LSN from header page */ |
161 | + ulint id; /*!< Space ID */ |
162 | + ulint flags; /*!< Tablespace flags */ |
163 | +-#ifdef UNIV_LOG_ARCHIVE |
164 | +- ulint arch_log_no; /*!< latest archived log file number */ |
165 | +-#endif /* UNIV_LOG_ARCHIVE */ |
166 | }; |
167 | |
168 | +static |
169 | @@ -334,7 +427,7 @@ |
170 | /********************************************************************//** |
171 | Tries to open a single-table tablespace and optionally checks that the |
172 | space id in it is correct. If this does not succeed, print an error message |
173 | -@@ -3584,6 +3699,9 @@ |
174 | +@@ -3584,6 +3678,9 @@ |
175 | in the default location. If it is remote, it should not be here. */ |
176 | def.filepath = fil_make_ibd_name(tablename, false); |
177 | |
178 | @@ -344,7 +437,7 @@ |
179 | /* The path_in was read from SYS_DATAFILES. */ |
180 | if (path_in) { |
181 | if (strcmp(def.filepath, path_in)) { |
182 | -@@ -3631,6 +3749,7 @@ |
183 | +@@ -3631,6 +3728,7 @@ |
184 | tablespaces_found++; |
185 | } |
186 | } |
187 | @@ -352,7 +445,37 @@ |
188 | |
189 | /* Always look for a file at the default location. */ |
190 | ut_a(def.filepath); |
191 | -@@ -3727,11 +3846,15 @@ |
192 | +@@ -3652,9 +3750,6 @@ |
193 | + if (def.success) { |
194 | + fil_read_first_page( |
195 | + def.file, FALSE, &def.flags, &def.id, |
196 | +-#ifdef UNIV_LOG_ARCHIVE |
197 | +- &space_arch_log_no, &space_arch_log_no, |
198 | +-#endif /* UNIV_LOG_ARCHIVE */ |
199 | + &def.lsn, &def.lsn); |
200 | + |
201 | + /* Validate this single-table-tablespace with SYS_TABLES, |
202 | +@@ -3676,9 +3771,6 @@ |
203 | + if (remote.success) { |
204 | + fil_read_first_page( |
205 | + remote.file, FALSE, &remote.flags, &remote.id, |
206 | +-#ifdef UNIV_LOG_ARCHIVE |
207 | +- &remote.arch_log_no, &remote.arch_log_no, |
208 | +-#endif /* UNIV_LOG_ARCHIVE */ |
209 | + &remote.lsn, &remote.lsn); |
210 | + |
211 | + /* Validate this single-table-tablespace with SYS_TABLES, |
212 | +@@ -3701,9 +3793,6 @@ |
213 | + if (dict.success) { |
214 | + fil_read_first_page( |
215 | + dict.file, FALSE, &dict.flags, &dict.id, |
216 | +-#ifdef UNIV_LOG_ARCHIVE |
217 | +- &dict.arch_log_no, &dict.arch_log_no, |
218 | +-#endif /* UNIV_LOG_ARCHIVE */ |
219 | + &dict.lsn, &dict.lsn); |
220 | + |
221 | + /* Validate this single-table-tablespace with SYS_TABLES, |
222 | +@@ -3727,11 +3816,15 @@ |
223 | /* The following call prints an error message */ |
224 | os_file_get_last_error(true); |
225 | |
226 | @@ -369,7 +492,17 @@ |
227 | |
228 | err = DB_CORRUPTION; |
229 | |
230 | -@@ -3989,6 +4112,9 @@ |
231 | +@@ -3931,9 +4024,6 @@ |
232 | + { |
233 | + fil_read_first_page( |
234 | + fsp->file, FALSE, &fsp->flags, &fsp->id, |
235 | +-#ifdef UNIV_LOG_ARCHIVE |
236 | +- &fsp->arch_log_no, &fsp->arch_log_no, |
237 | +-#endif /* UNIV_LOG_ARCHIVE */ |
238 | + &fsp->lsn, &fsp->lsn); |
239 | + |
240 | + if (fsp->id == ULINT_UNDEFINED || fsp->id == 0) { |
241 | +@@ -3989,6 +4079,9 @@ |
242 | #ifdef UNIV_HOTBACKUP |
243 | fil_space_t* space; |
244 | #endif |
245 | @@ -379,7 +512,7 @@ |
246 | |
247 | memset(&def, 0, sizeof(def)); |
248 | memset(&remote, 0, sizeof(remote)); |
249 | -@@ -4033,6 +4159,9 @@ |
250 | +@@ -4033,6 +4126,9 @@ |
251 | # endif /* !UNIV_HOTBACKUP */ |
252 | #endif |
253 | |
254 | @@ -389,7 +522,7 @@ |
255 | /* Check for a link file which locates a remote tablespace. */ |
256 | remote.success = fil_open_linked_file( |
257 | tablename, &remote.filepath, &remote.file); |
258 | -@@ -4043,8 +4172,20 @@ |
259 | +@@ -4043,8 +4139,20 @@ |
260 | if (!remote.success) { |
261 | os_file_close(remote.file); |
262 | mem_free(remote.filepath); |
263 | @@ -410,7 +543,7 @@ |
264 | |
265 | |
266 | /* Try to open the tablespace in the datadir. */ |
267 | -@@ -4057,6 +4198,17 @@ |
268 | +@@ -4057,6 +4165,17 @@ |
269 | fil_validate_single_table_tablespace(tablename, &def); |
270 | if (!def.success) { |
271 | os_file_close(def.file); |
272 | @@ -428,7 +561,7 @@ |
273 | } |
274 | } |
275 | |
276 | -@@ -4129,7 +4281,7 @@ |
277 | +@@ -4129,7 +4248,7 @@ |
278 | /* At this point, only one tablespace is open */ |
279 | ut_a(def.success == !remote.success); |
280 | |
281 | @@ -437,7 +570,7 @@ |
282 | |
283 | /* Get and test the file size. */ |
284 | size = os_file_get_size(fsp->file); |
285 | -@@ -4148,9 +4300,9 @@ |
286 | +@@ -4148,9 +4267,9 @@ |
287 | |
288 | /* Every .ibd file is created >= 4 pages in size. Smaller files |
289 | cannot be ok. */ |
290 | @@ -449,7 +582,7 @@ |
291 | ib_logf(IB_LOG_LEVEL_ERROR, |
292 | "The size of single-table tablespace file %s " |
293 | "is only " UINT64PF ", should be at least %lu!", |
294 | -@@ -4231,7 +4383,7 @@ |
295 | +@@ -4231,7 +4350,7 @@ |
296 | } |
297 | mutex_exit(&fil_system->mutex); |
298 | #endif /* UNIV_HOTBACKUP */ |
299 | @@ -458,7 +591,7 @@ |
300 | tablename, fsp->id, fsp->flags, FIL_TABLESPACE); |
301 | |
302 | if (!file_space_create_success) { |
303 | -@@ -4258,13 +4410,55 @@ |
304 | +@@ -4258,13 +4377,55 @@ |
305 | } |
306 | |
307 | func_exit: |
308 | @@ -518,7 +651,7 @@ |
309 | mem_free(tablename); |
310 | if (remote.success) { |
311 | mem_free(remote.filepath); |
312 | -@@ -4278,7 +4472,7 @@ |
313 | +@@ -4278,7 +4439,7 @@ |
314 | idea is to read as much good data as we can and jump over bad data. |
315 | @return 0 if ok, -1 if error even after the retries, 1 if at the end |
316 | of the directory */ |
317 | @@ -527,7 +660,7 @@ |
318 | int |
319 | fil_file_readdir_next_file( |
320 | /*=======================*/ |
321 | -@@ -4318,7 +4512,7 @@ |
322 | +@@ -4318,7 +4479,7 @@ |
323 | @return DB_SUCCESS or error number */ |
324 | UNIV_INTERN |
325 | dberr_t |
326 | @@ -536,7 +669,7 @@ |
327 | /*===================================*/ |
328 | { |
329 | int ret; |
330 | -@@ -4374,7 +4568,9 @@ |
331 | +@@ -4374,7 +4535,9 @@ |
332 | "%s/%s", fil_path_to_mysql_datadir, dbinfo.name); |
333 | srv_normalize_path_for_win(dbpath); |
334 | |
335 | @@ -547,7 +680,7 @@ |
336 | |
337 | if (dbdir != NULL) { |
338 | |
339 | -@@ -4395,9 +4591,15 @@ |
340 | +@@ -4395,9 +4558,15 @@ |
341 | && (0 == strcmp(fileinfo.name |
342 | + strlen(fileinfo.name) - 4, |
343 | ".ibd") |
344 | @@ -565,7 +698,7 @@ |
345 | /* The name ends in .ibd or .isl; |
346 | try opening the file */ |
347 | fil_load_single_table_tablespace( |
348 | -@@ -4553,6 +4755,7 @@ |
349 | +@@ -4553,6 +4722,7 @@ |
350 | { |
351 | fil_space_t* fnamespace; |
352 | fil_space_t* space; |
353 | @@ -573,7 +706,7 @@ |
354 | |
355 | ut_ad(fil_system); |
356 | |
357 | -@@ -4630,6 +4833,10 @@ |
358 | +@@ -4630,6 +4800,10 @@ |
359 | if (fnamespace == NULL) { |
360 | if (print_error_if_does_not_exist) { |
361 | fil_report_missing_tablespace(name, id); |
362 | @@ -584,7 +717,7 @@ |
363 | } |
364 | } else { |
365 | ut_print_timestamp(stderr); |
366 | -@@ -4653,6 +4860,10 @@ |
367 | +@@ -4653,6 +4827,10 @@ |
368 | |
369 | mutex_exit(&fil_system->mutex); |
370 | |
371 | @@ -595,7 +728,7 @@ |
372 | return(FALSE); |
373 | } |
374 | |
375 | -@@ -4743,6 +4954,7 @@ |
376 | +@@ -4743,6 +4921,7 @@ |
377 | ulint page_size; |
378 | ulint pages_added; |
379 | ibool success; |
380 | @@ -603,7 +736,7 @@ |
381 | |
382 | ut_ad(!srv_read_only_mode); |
383 | |
384 | -@@ -4787,13 +4999,17 @@ |
385 | +@@ -4787,13 +4966,17 @@ |
386 | goto retry; |
387 | } |
388 | |
389 | @@ -622,7 +755,7 @@ |
390 | start_page_no = space->size; |
391 | file_start_page_no = space->size - node->size; |
392 | |
393 | -@@ -5039,7 +5255,7 @@ |
394 | +@@ -5039,7 +5222,7 @@ |
395 | off the LRU list if it is in the LRU list. The caller must hold the fil_sys |
396 | mutex. */ |
397 | static |
398 | @@ -631,7 +764,7 @@ |
399 | fil_node_prepare_for_io( |
400 | /*====================*/ |
401 | fil_node_t* node, /*!< in: file node */ |
402 | -@@ -5059,9 +5275,12 @@ |
403 | +@@ -5059,9 +5242,12 @@ |
404 | } |
405 | |
406 | if (node->open == FALSE) { |
407 | @@ -645,7 +778,7 @@ |
408 | } |
409 | |
410 | if (node->n_pending == 0 && fil_space_belongs_in_lru(space)) { |
411 | -@@ -5073,6 +5292,8 @@ |
412 | +@@ -5073,6 +5259,8 @@ |
413 | } |
414 | |
415 | node->n_pending++; |
416 | @@ -654,7 +787,7 @@ |
417 | } |
418 | |
419 | /********************************************************************//** |
420 | -@@ -5274,6 +5495,16 @@ |
421 | +@@ -5274,6 +5462,16 @@ |
422 | |
423 | ut_ad(mode != OS_AIO_IBUF || space->purpose == FIL_TABLESPACE); |
424 | |
425 | @@ -671,7 +804,7 @@ |
426 | node = UT_LIST_GET_FIRST(space->chain); |
427 | |
428 | for (;;) { |
429 | -@@ -5305,7 +5536,11 @@ |
430 | +@@ -5305,7 +5503,11 @@ |
431 | } |
432 | |
433 | /* Open file if closed */ |
434 | @@ -684,7 +817,7 @@ |
435 | |
436 | /* Check that at least the start offset is within the bounds of a |
437 | single-table tablespace, including rollback tablespaces. */ |
438 | -@@ -6179,6 +6414,7 @@ |
439 | +@@ -6179,6 +6381,7 @@ |
440 | return(err); |
441 | } |
442 | |
443 | @@ -692,14 +825,35 @@ |
444 | /****************************************************************//** |
445 | Generate redo logs for swapping two .ibd files */ |
446 | UNIV_INTERN |
447 | -@@ -6205,3 +6441,4 @@ |
448 | +@@ -6205,3 +6408,4 @@ |
449 | 0, 0, new_name, old_name, mtr); |
450 | } |
451 | } |
452 | +#endif |
453 | --- a/storage/innobase/handler/ha_innodb.cc |
454 | +++ b/storage/innobase/handler/ha_innodb.cc |
455 | -@@ -1548,7 +1548,7 @@ |
456 | +@@ -208,7 +208,8 @@ |
457 | + NULL |
458 | + }; |
459 | + |
460 | +-/** Possible values for system variable "innodb_checksum_algorithm". */ |
461 | ++/** Possible values for system variables "innodb_checksum_algorithm" and |
462 | ++"innodb_log_checksum_algorithm". */ |
463 | + static const char* innodb_checksum_algorithm_names[] = { |
464 | + "crc32", |
465 | + "strict_crc32", |
466 | +@@ -219,8 +220,8 @@ |
467 | + NullS |
468 | + }; |
469 | + |
470 | +-/** Used to define an enumerate type of the system variable |
471 | +-innodb_checksum_algorithm. */ |
472 | ++/** Used to define an enumerate type of the system variables |
473 | ++innodb_checksum_algorithm and innodb_log_checksum_algorithm. */ |
474 | + static TYPELIB innodb_checksum_algorithm_typelib = { |
475 | + array_elements(innodb_checksum_algorithm_names) - 1, |
476 | + "innodb_checksum_algorithm_typelib", |
477 | +@@ -1548,7 +1549,7 @@ |
478 | ut_ad(*mbminlen < DATA_MBMAX); |
479 | ut_ad(*mbmaxlen < DATA_MBMAX); |
480 | } else { |
481 | @@ -708,7 +862,70 @@ |
482 | |
483 | if (thd && thd_sql_command(thd) == SQLCOM_DROP_TABLE) { |
484 | |
485 | -@@ -2459,43 +2459,19 @@ |
486 | +@@ -2099,6 +2100,62 @@ |
487 | + return(trx->state != TRX_STATE_NOT_STARTED); |
488 | + } |
489 | + |
490 | ++/****************************************************************//** |
491 | ++Update log_checksum_algorithm_ptr with a pointer to the function corresponding |
492 | ++to a given checksum algorithm. */ |
493 | ++UNIV_INTERN |
494 | ++void |
495 | ++innodb_log_checksum_func_update( |
496 | ++/*============================*/ |
497 | ++ ulint algorithm) /*!< in: algorithm */ |
498 | ++{ |
499 | ++ switch (algorithm) { |
500 | ++ case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB: |
501 | ++ case SRV_CHECKSUM_ALGORITHM_INNODB: |
502 | ++ log_checksum_algorithm_ptr=log_block_calc_checksum_innodb; |
503 | ++ break; |
504 | ++ case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32: |
505 | ++ case SRV_CHECKSUM_ALGORITHM_CRC32: |
506 | ++ log_checksum_algorithm_ptr=log_block_calc_checksum_crc32; |
507 | ++ break; |
508 | ++ case SRV_CHECKSUM_ALGORITHM_STRICT_NONE: |
509 | ++ case SRV_CHECKSUM_ALGORITHM_NONE: |
510 | ++ log_checksum_algorithm_ptr=log_block_calc_checksum_none; |
511 | ++ break; |
512 | ++ default: |
513 | ++ ut_a(0); |
514 | ++ } |
515 | ++} |
516 | ++ |
517 | ++/****************************************************************//** |
518 | ++On update hook for the innodb_log_checksum_algorithm variable. */ |
519 | ++static |
520 | ++void |
521 | ++innodb_log_checksum_algorithm_update( |
522 | ++/*=================================*/ |
523 | ++ THD* thd, /*!< in: thread handle */ |
524 | ++ struct st_mysql_sys_var* var, /*!< in: pointer to |
525 | ++ system variable */ |
526 | ++ void* var_ptr,/*!< out: where the |
527 | ++ formal string goes */ |
528 | ++ const void* save) /*!< in: immediate result |
529 | ++ from check function */ |
530 | ++{ |
531 | ++ srv_checksum_algorithm_t algorithm; |
532 | ++ |
533 | ++ algorithm = (srv_checksum_algorithm_t) |
534 | ++ (*static_cast<const ulong*>(save)); |
535 | ++ |
536 | ++ /* Make sure we are the only log user */ |
537 | ++ mutex_enter(&log_sys->mutex); |
538 | ++ |
539 | ++ innodb_log_checksum_func_update(algorithm); |
540 | ++ |
541 | ++ srv_log_checksum_algorithm = algorithm; |
542 | ++ |
543 | ++ mutex_exit(&log_sys->mutex); |
544 | ++} |
545 | ++ |
546 | + /*********************************************************************//** |
547 | + Copy table flags from MySQL's HA_CREATE_INFO into an InnoDB table object. |
548 | + Those flags are stored in .frm file and end up in the MySQL table object, |
549 | +@@ -2459,43 +2516,19 @@ |
550 | ulint buflen, /*!< in: length of buf, in bytes */ |
551 | const char* id, /*!< in: identifier to convert */ |
552 | ulint idlen, /*!< in: length of id, in bytes */ |
553 | @@ -757,7 +974,74 @@ |
554 | if (UNIV_UNLIKELY(idlen > buflen)) { |
555 | idlen = buflen; |
556 | } |
557 | -@@ -16774,45 +16750,24 @@ |
558 | +@@ -2883,12 +2916,9 @@ |
559 | + } |
560 | + |
561 | + #ifdef UNIV_LOG_ARCHIVE |
562 | +- /* Since innodb_log_arch_dir has no relevance under MySQL, |
563 | +- starting from 4.0.6 we always set it the same as |
564 | +- innodb_log_group_home_dir: */ |
565 | +- |
566 | +- innobase_log_arch_dir = innobase_log_group_home_dir; |
567 | +- |
568 | ++ if (!innobase_log_arch_dir) { |
569 | ++ innobase_log_arch_dir = srv_log_group_home_dir; |
570 | ++ } |
571 | + srv_arch_dir = innobase_log_arch_dir; |
572 | + #endif /* UNIG_LOG_ARCHIVE */ |
573 | + |
574 | +@@ -3136,6 +3166,8 @@ |
575 | + srv_checksum_algorithm = SRV_CHECKSUM_ALGORITHM_NONE; |
576 | + } |
577 | + |
578 | ++ innodb_log_checksum_func_update(srv_log_checksum_algorithm); |
579 | ++ |
580 | + #ifdef HAVE_LARGE_PAGES |
581 | + if ((os_use_large_pages = (ibool) my_use_large_pages)) { |
582 | + os_large_page_size = (ulint) opt_large_page_size; |
583 | +@@ -15432,6 +15464,33 @@ |
584 | + NULL, NULL, SRV_CHECKSUM_ALGORITHM_INNODB, |
585 | + &innodb_checksum_algorithm_typelib); |
586 | + |
587 | ++ |
588 | ++static MYSQL_SYSVAR_ENUM(log_checksum_algorithm, srv_log_checksum_algorithm, |
589 | ++ PLUGIN_VAR_RQCMDARG, |
590 | ++ "The algorithm InnoDB uses for log block checksums. Possible values are " |
591 | ++ "CRC32 (hardware accelerated if the CPU supports it) " |
592 | ++ "write crc32, allow any of the other checksums to match when reading; " |
593 | ++ "STRICT_CRC32 " |
594 | ++ "write crc32, do not allow other algorithms to match when reading; " |
595 | ++ "INNODB " |
596 | ++ "write a software calculated checksum, allow any other checksums " |
597 | ++ "to match when reading; " |
598 | ++ "STRICT_INNODB " |
599 | ++ "write a software calculated checksum, do not allow other algorithms " |
600 | ++ "to match when reading; " |
601 | ++ "NONE " |
602 | ++ "write a constant magic number, do not do any checksum verification " |
603 | ++ "when reading (same as innodb_checksums=OFF); " |
604 | ++ "STRICT_NONE " |
605 | ++ "write a constant magic number, do not allow values other than that " |
606 | ++ "magic number when reading; " |
607 | ++ "Logs created when this option is set to crc32/strict_crc32/none/strict_none " |
608 | ++ "will not be readable by any MySQL version or Percona Server versions that do" |
609 | ++ "not support this feature", |
610 | ++ NULL, innodb_log_checksum_algorithm_update, SRV_CHECKSUM_ALGORITHM_INNODB, |
611 | ++ &innodb_checksum_algorithm_typelib); |
612 | ++ |
613 | ++ |
614 | + static MYSQL_SYSVAR_BOOL(checksums, innobase_use_checksums, |
615 | + PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY, |
616 | + "DEPRECATED. Use innodb_checksum_algorithm=NONE instead of setting " |
617 | +@@ -16199,6 +16258,7 @@ |
618 | + MYSQL_SYSVAR(lru_scan_depth), |
619 | + MYSQL_SYSVAR(flush_neighbors), |
620 | + MYSQL_SYSVAR(checksum_algorithm), |
621 | ++ MYSQL_SYSVAR(log_checksum_algorithm), |
622 | + MYSQL_SYSVAR(checksums), |
623 | + MYSQL_SYSVAR(commit_concurrency), |
624 | + MYSQL_SYSVAR(concurrency_tickets), |
625 | +@@ -16774,45 +16834,24 @@ |
626 | void |
627 | ib_logf( |
628 | /*====*/ |
629 | @@ -811,669 +1095,6 @@ |
630 | |
631 | if (level == IB_LOG_LEVEL_FATAL) { |
632 | ut_error; |
633 | ---- a/storage/innobase/include/fil0fil.h |
634 | -+++ b/storage/innobase/include/fil0fil.h |
635 | -@@ -163,6 +163,9 @@ |
636 | - #define FIL_LOG 502 /*!< redo log */ |
637 | - /* @} */ |
638 | - |
639 | -+/** Determine if (i) is a user tablespace id or not. */ |
640 | -+#define fil_is_user_tablespace_id(i) ((i) > srv_undo_tablespaces_open) |
641 | -+ |
642 | - /** The number of fsyncs done to the log */ |
643 | - extern ulint fil_n_log_flushes; |
644 | - |
645 | -@@ -608,7 +611,7 @@ |
646 | - @return DB_SUCCESS or error number */ |
647 | - UNIV_INTERN |
648 | - dberr_t |
649 | --fil_load_single_table_tablespaces(void); |
650 | -+fil_load_single_table_tablespaces(ibool (*pred)(const char*, const char*)); |
651 | - /*===================================*/ |
652 | - /*******************************************************************//** |
653 | - Returns TRUE if a single-table tablespace does not exist in the memory cache, |
654 | ---- a/storage/innobase/include/srv0srv.h |
655 | -+++ b/storage/innobase/include/srv0srv.h |
656 | -@@ -353,6 +353,11 @@ |
657 | - extern ulong srv_max_purge_lag_delay; |
658 | - |
659 | - extern ulong srv_replication_delay; |
660 | -+ |
661 | -+extern ibool srv_apply_log_only; |
662 | -+ |
663 | -+extern ibool srv_backup_mode; |
664 | -+ |
665 | - /*-------------------------------------------*/ |
666 | - |
667 | - extern ibool srv_print_innodb_monitor; |
668 | ---- a/storage/innobase/log/log0recv.cc |
669 | -+++ b/storage/innobase/log/log0recv.cc |
670 | -@@ -43,20 +43,21 @@ |
671 | - #include "trx0undo.h" |
672 | - #include "trx0rec.h" |
673 | - #include "fil0fil.h" |
674 | --#ifndef UNIV_HOTBACKUP |
675 | -+//#ifndef UNIV_HOTBACKUP |
676 | - # include "buf0rea.h" |
677 | - # include "srv0srv.h" |
678 | - # include "srv0start.h" |
679 | - # include "trx0roll.h" |
680 | - # include "row0merge.h" |
681 | - # include "sync0sync.h" |
682 | --#else /* !UNIV_HOTBACKUP */ |
683 | -+//#else /* !UNIV_HOTBACKUP */ |
684 | -+#include "xb0xb.h" |
685 | - |
686 | - /** This is set to FALSE if the backup was originally taken with the |
687 | - ibbackup --include regexp option: then we do not want to create tables in |
688 | - directories which were not included */ |
689 | - UNIV_INTERN ibool recv_replay_file_ops = TRUE; |
690 | --#endif /* !UNIV_HOTBACKUP */ |
691 | -+//#endif /* !UNIV_HOTBACKUP */ |
692 | - |
693 | - /** Log records are stored in the hash table in chunks at most of this size; |
694 | - this must be less than UNIV_PAGE_SIZE as it is stored in the buffer pool */ |
695 | -@@ -399,7 +400,7 @@ |
696 | - /* Set appropriate value of recv_n_pool_free_frames. */ |
697 | - if (buf_pool_get_curr_size() >= (10 * 1024 * 1024)) { |
698 | - /* Buffer pool of size greater than 10 MB. */ |
699 | -- recv_n_pool_free_frames = 512; |
700 | -+ recv_n_pool_free_frames = 1024; |
701 | - } |
702 | - |
703 | - recv_sys->buf = static_cast<byte*>(ut_malloc(RECV_PARSING_BUF_SIZE)); |
704 | -@@ -703,7 +704,7 @@ |
705 | - /***********************************************************************//** |
706 | - Checks the consistency of the checkpoint info |
707 | - @return TRUE if ok */ |
708 | --static |
709 | -+UNIV_INTERN |
710 | - ibool |
711 | - recv_check_cp_is_consistent( |
712 | - /*========================*/ |
713 | -@@ -733,7 +734,7 @@ |
714 | - /********************************************************//** |
715 | - Looks for the maximum consistent checkpoint from the log groups. |
716 | - @return error code or DB_SUCCESS */ |
717 | --static __attribute__((nonnull, warn_unused_result)) |
718 | -+UNIV_INTERN __attribute__((nonnull, warn_unused_result)) |
719 | - dberr_t |
720 | - recv_find_max_checkpoint( |
721 | - /*=====================*/ |
722 | -@@ -893,7 +894,7 @@ |
723 | - InnoDB-3.23.52 where the checksum field contains the log block number. |
724 | - @return TRUE if ok, or if the log block may be in the format of InnoDB |
725 | - version predating 3.23.52 */ |
726 | --static |
727 | -+UNIV_INTERN |
728 | - ibool |
729 | - log_block_checksum_is_ok_or_old_format( |
730 | - /*===================================*/ |
731 | -@@ -1588,6 +1589,8 @@ |
732 | - buf_block_get_page_no(block)); |
733 | - |
734 | - if ((recv_addr == NULL) |
735 | -+ /* Fix for http://bugs.mysql.com/bug.php?id=44140 */ |
736 | -+ || (recv_addr->state == RECV_BEING_READ && !just_read_in) |
737 | - || (recv_addr->state == RECV_BEING_PROCESSED) |
738 | - || (recv_addr->state == RECV_PROCESSED)) { |
739 | - |
740 | -@@ -1677,9 +1680,17 @@ |
741 | - if (page_zip) { |
742 | - memset(FIL_PAGE_LSN + page_zip->data, 0, 8); |
743 | - } |
744 | -+ |
745 | -+ if (!block->page.is_compacted |
746 | -+ && block->page.is_compacted) { |
747 | -+ |
748 | -+ ut_ad(srv_compact_backup); |
749 | -+ |
750 | -+ block->page.is_compacted = FALSE; |
751 | -+ } |
752 | - } |
753 | - |
754 | -- if (recv->start_lsn >= page_lsn) { |
755 | -+ if (!block->page.is_compacted && recv->start_lsn >= page_lsn) { |
756 | - |
757 | - lsn_t end_lsn; |
758 | - |
759 | -@@ -1868,6 +1879,18 @@ |
760 | - ulint zip_size = fil_space_get_zip_size(space); |
761 | - ulint page_no = recv_addr->page_no; |
762 | - |
763 | -+ /* By now we have replayed all DDL log records from the |
764 | -+ current batch. Check if the space ID is still valid in |
765 | -+ the entry being processed, and ignore it if it is not.*/ |
766 | -+ if (fil_tablespace_deleted_or_being_deleted_in_mem(space, -1)) { |
767 | -+ |
768 | -+ ut_a(recv_sys->n_addrs); |
769 | -+ |
770 | -+ recv_addr->state = RECV_PROCESSED; |
771 | -+ recv_sys->n_addrs--; |
772 | -+ |
773 | -+ continue; |
774 | -+ } |
775 | - if (recv_addr->state == RECV_NOT_PROCESSED) { |
776 | - if (!has_printed) { |
777 | - ib_logf(IB_LOG_LEVEL_INFO, |
778 | -@@ -2413,7 +2436,7 @@ |
779 | - || type == MLOG_FILE_RENAME |
780 | - || type == MLOG_FILE_DELETE) { |
781 | - ut_a(space); |
782 | --#ifdef UNIV_HOTBACKUP |
783 | -+//#ifdef UNIV_HOTBACKUP |
784 | - if (recv_replay_file_ops) { |
785 | - |
786 | - /* In ibbackup --apply-log, replay an .ibd file |
787 | -@@ -2436,7 +2459,7 @@ |
788 | - ut_error; |
789 | - } |
790 | - } |
791 | --#endif |
792 | -+//#endif |
793 | - /* In normal mysqld crash recovery we do not try to |
794 | - replay file operations */ |
795 | - #ifdef UNIV_LOG_LSN_DEBUG |
796 | -@@ -2863,8 +2886,14 @@ |
797 | - |
798 | - fprintf(stderr, |
799 | - "InnoDB: Doing recovery: scanned up to" |
800 | -- " log sequence number " LSN_PF "\n", |
801 | -- *group_scanned_lsn); |
802 | -+ " log sequence number " LSN_PF " (%lu%%)\n", |
803 | -+ *group_scanned_lsn, |
804 | -+ (ulong) ((*group_scanned_lsn |
805 | -+ - recv_sys->parse_start_lsn) |
806 | -+ / (8 * log_group_get_capacity( |
807 | -+ UT_LIST_GET_FIRST( |
808 | -+ log_sys->log_groups)) |
809 | -+ / 900))); |
810 | - } |
811 | - } |
812 | - |
813 | -@@ -2964,7 +2993,7 @@ |
814 | - ib_logf(IB_LOG_LEVEL_INFO, |
815 | - "Reading tablespace information from the .ibd files..."); |
816 | - |
817 | -- fil_load_single_table_tablespaces(); |
818 | -+ fil_load_single_table_tablespaces(NULL); |
819 | - |
820 | - /* If we are using the doublewrite method, we will |
821 | - check if there are half-written pages in data files, |
822 | -@@ -3003,6 +3032,7 @@ |
823 | - log_group_t* group; |
824 | - log_group_t* max_cp_group; |
825 | - ulint max_cp_field; |
826 | -+ ulint log_hdr_log_block_size; |
827 | - lsn_t checkpoint_lsn; |
828 | - ib_uint64_t checkpoint_no; |
829 | - lsn_t group_scanned_lsn = 0; |
830 | -@@ -3108,6 +3138,21 @@ |
831 | - log_hdr_buf, max_cp_group); |
832 | - } |
833 | - |
834 | -+ log_hdr_log_block_size |
835 | -+ = mach_read_from_4(log_hdr_buf + LOG_FILE_OS_FILE_LOG_BLOCK_SIZE); |
836 | -+ if (log_hdr_log_block_size == 0) { |
837 | -+ /* 0 means default value */ |
838 | -+ log_hdr_log_block_size = 512; |
839 | -+ } |
840 | -+ if (UNIV_UNLIKELY(log_hdr_log_block_size != srv_log_block_size)) { |
841 | -+ fprintf(stderr, |
842 | -+ "InnoDB: Error: The block size of ib_logfile (" ULINTPF |
843 | -+ ") is not equal to innodb_log_block_size.\n" |
844 | -+ "InnoDB: Error: Suggestion - Recreate log files.\n", |
845 | -+ log_hdr_log_block_size); |
846 | -+ return(DB_ERROR); |
847 | -+ } |
848 | -+ |
849 | - #ifdef UNIV_LOG_ARCHIVE |
850 | - group = UT_LIST_GET_FIRST(log_sys->log_groups); |
851 | - |
852 | -@@ -3456,7 +3501,8 @@ |
853 | - that the data dictionary tables will be free of any locks. |
854 | - The data dictionary latch should guarantee that there is at |
855 | - most one data dictionary transaction active at a time. */ |
856 | -- if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO) { |
857 | -+ if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO |
858 | -+ && !srv_apply_log_only) { |
859 | - trx_rollback_or_clean_recovered(FALSE); |
860 | - } |
861 | - } |
862 | ---- a/storage/innobase/os/os0file.cc |
863 | -+++ b/storage/innobase/os/os0file.cc |
864 | -@@ -699,7 +699,7 @@ |
865 | - } |
866 | - |
867 | - #undef USE_FILE_LOCK |
868 | --#define USE_FILE_LOCK |
869 | -+//#define USE_FILE_LOCK |
870 | - #if defined(UNIV_HOTBACKUP) || defined(__WIN__) |
871 | - /* InnoDB Hot Backup does not lock the data files. |
872 | - * On Windows, mandatory locking is used. |
873 | ---- a/storage/innobase/srv/srv0srv.cc |
874 | -+++ b/storage/innobase/srv/srv0srv.cc |
875 | -@@ -239,6 +239,10 @@ |
876 | - |
877 | - /* Switch to enable random read ahead. */ |
878 | - UNIV_INTERN my_bool srv_random_read_ahead = FALSE; |
879 | -+ |
880 | -+/* The log block size */ |
881 | -+UNIV_INTERN ulint srv_log_block_size = 0; |
882 | -+ |
883 | - /* User settable value of the number of pages that must be present |
884 | - in the buffer cache and accessed sequentially for InnoDB to trigger a |
885 | - readahead request. */ |
886 | -@@ -349,6 +353,10 @@ |
887 | - |
888 | - UNIV_INTERN ulong srv_replication_delay = 0; |
889 | - |
890 | -+UNIV_INTERN ibool srv_apply_log_only = FALSE; |
891 | -+ |
892 | -+UNIV_INTERN ibool srv_backup_mode = FALSE; |
893 | -+ |
894 | - /*-------------------------------------------*/ |
895 | - UNIV_INTERN ulong srv_n_spin_wait_rounds = 30; |
896 | - UNIV_INTERN ulong srv_spin_wait_delay = 6; |
897 | -@@ -1814,7 +1822,8 @@ |
898 | - if (ret == SRV_NONE |
899 | - && srv_shutdown_state != SRV_SHUTDOWN_NONE |
900 | - && trx_purge_state() != PURGE_STATE_DISABLED |
901 | -- && trx_purge_state() != PURGE_STATE_EXIT) { |
902 | -+ && trx_purge_state() != PURGE_STATE_EXIT |
903 | -+ && trx_purge_state() != PURGE_STATE_INIT) { |
904 | - |
905 | - ret = SRV_PURGE; |
906 | - } |
907 | ---- a/storage/innobase/srv/srv0start.cc |
908 | -+++ b/storage/innobase/srv/srv0start.cc |
909 | -@@ -63,6 +63,7 @@ |
910 | - #include "ibuf0ibuf.h" |
911 | - #include "srv0start.h" |
912 | - #include "srv0srv.h" |
913 | -+#include "xb0xb.h" |
914 | - #ifndef UNIV_HOTBACKUP |
915 | - # include "trx0rseg.h" |
916 | - # include "os0proc.h" |
917 | -@@ -121,7 +122,7 @@ |
918 | - UNIV_INTERN enum srv_shutdown_state srv_shutdown_state = SRV_SHUTDOWN_NONE; |
919 | - |
920 | - /** Files comprising the system tablespace */ |
921 | --static os_file_t files[1000]; |
922 | -+os_file_t files[1000]; |
923 | - |
924 | - /** io_handler_thread parameters for thread identification */ |
925 | - static ulint n[SRV_MAX_N_IO_THREADS + 6]; |
926 | -@@ -731,7 +732,7 @@ |
927 | - /*********************************************************************//** |
928 | - Creates or opens database data files and closes them. |
929 | - @return DB_SUCCESS or error code */ |
930 | --static __attribute__((nonnull, warn_unused_result)) |
931 | -+UNIV_INTERN __attribute__((nonnull, warn_unused_result)) |
932 | - dberr_t |
933 | - open_or_create_data_files( |
934 | - /*======================*/ |
935 | -@@ -1204,12 +1205,16 @@ |
936 | - /******************************************************************** |
937 | - Opens the configured number of undo tablespaces. |
938 | - @return DB_SUCCESS or error code */ |
939 | --static |
940 | -+UNIV_INTERN |
941 | - dberr_t |
942 | - srv_undo_tablespaces_init( |
943 | - /*======================*/ |
944 | - ibool create_new_db, /*!< in: TRUE if new db being |
945 | - created */ |
946 | -+ ibool backup_mode, /*!< in: TRUE disables reading |
947 | -+ the system tablespace (used in |
948 | -+ XtraBackup), FALSE is passed on |
949 | -+ recovery. */ |
950 | - const ulint n_conf_tablespaces, /*!< in: configured undo |
951 | - tablespaces */ |
952 | - ulint* n_opened) /*!< out: number of UNDO |
953 | -@@ -1225,6 +1230,7 @@ |
954 | - *n_opened = 0; |
955 | - |
956 | - ut_a(n_conf_tablespaces <= TRX_SYS_N_RSEGS); |
957 | -+ ut_a(!create_new_db || !backup_mode); |
958 | - |
959 | - memset(undo_tablespace_ids, 0x0, sizeof(undo_tablespace_ids)); |
960 | - |
961 | -@@ -1258,12 +1264,13 @@ |
962 | - } |
963 | - } |
964 | - |
965 | -- /* Get the tablespace ids of all the undo segments excluding |
966 | -- the system tablespace (0). If we are creating a new instance then |
967 | -+ /* Get the tablespace ids of all the undo segments excluding the system |
968 | -+ tablespace (0). If we are creating a new instance then |
969 | - we build the undo_tablespace_ids ourselves since they don't |
970 | -- already exist. */ |
971 | -+ already exist. If we are in the backup mode, don't read the trx header, |
972 | -+ we just need to add all available undo tablespaces to fil_system. */ |
973 | - |
974 | -- if (!create_new_db) { |
975 | -+ if (!create_new_db && !backup_mode) { |
976 | - n_undo_tablespaces = trx_rseg_get_n_undo_tablespaces( |
977 | - undo_tablespace_ids); |
978 | - } else { |
979 | -@@ -1369,7 +1376,7 @@ |
980 | - ib_logf(IB_LOG_LEVEL_INFO, "Opened %lu undo tablespaces", |
981 | - n_undo_tablespaces); |
982 | - |
983 | -- if (n_conf_tablespaces == 0) { |
984 | -+ if (n_conf_tablespaces == 0 && !backup_mode) { |
985 | - ib_logf(IB_LOG_LEVEL_WARN, |
986 | - "Using the system tablespace for all UNDO " |
987 | - "logging because innodb_undo_tablespaces=0"); |
988 | -@@ -2065,11 +2072,13 @@ |
989 | - max_flushed_lsn = min_flushed_lsn |
990 | - = log_get_lsn(); |
991 | - goto files_checked; |
992 | -+#if 0 |
993 | - } else if (i < 2) { |
994 | - /* must have at least 2 log files */ |
995 | - ib_logf(IB_LOG_LEVEL_ERROR, |
996 | - "Only one log file found."); |
997 | - return(err); |
998 | -+#endif |
999 | - } |
1000 | - |
1001 | - /* opened all files */ |
1002 | -@@ -2162,6 +2171,7 @@ |
1003 | - |
1004 | - err = srv_undo_tablespaces_init( |
1005 | - create_new_db, |
1006 | -+ FALSE, |
1007 | - srv_undo_tablespaces, |
1008 | - &srv_undo_tablespaces_open); |
1009 | - |
1010 | -@@ -2326,6 +2336,10 @@ |
1011 | - |
1012 | - recv_recovery_from_checkpoint_finish(); |
1013 | - |
1014 | -+ if (srv_apply_log_only) { |
1015 | -+ goto skip_processes; |
1016 | -+ } |
1017 | -+ |
1018 | - if (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) { |
1019 | - /* The following call is necessary for the insert |
1020 | - buffer to work with multiple tablespaces. We must |
1021 | -@@ -2439,7 +2453,9 @@ |
1022 | - value. Important to note that we can do it ONLY after |
1023 | - we have finished the recovery process so that the |
1024 | - image of TRX_SYS_PAGE_NO is not stale. */ |
1025 | -- trx_sys_file_format_tag_init(); |
1026 | -+ if (!srv_read_only_mode) { |
1027 | -+ trx_sys_file_format_tag_init(); |
1028 | -+ } |
1029 | - } |
1030 | - |
1031 | - if (!create_new_db && sum_of_new_sizes > 0) { |
1032 | -@@ -2647,6 +2663,7 @@ |
1033 | - && srv_auto_extend_last_data_file |
1034 | - && sum_of_data_file_sizes < tablespace_size_in_header) { |
1035 | - |
1036 | -+#ifdef UNDEFINED |
1037 | - ut_print_timestamp(stderr); |
1038 | - fprintf(stderr, |
1039 | - " InnoDB: Error: tablespace size stored in header" |
1040 | -@@ -2683,6 +2700,7 @@ |
1041 | - |
1042 | - return(DB_ERROR); |
1043 | - } |
1044 | -+#endif |
1045 | - } |
1046 | - |
1047 | - /* Check that os_fast_mutexes work as expected */ |
1048 | -@@ -2707,6 +2725,10 @@ |
1049 | - |
1050 | - os_fast_mutex_free(&srv_os_test_mutex); |
1051 | - |
1052 | -+ if (srv_rebuild_indexes) { |
1053 | -+ xb_compact_rebuild_indexes(); |
1054 | -+ } |
1055 | -+ |
1056 | - if (srv_print_verbose_log) { |
1057 | - ib_logf(IB_LOG_LEVEL_INFO, |
1058 | - "%s started; log sequence number " LSN_PF "", |
1059 | -@@ -2739,6 +2761,7 @@ |
1060 | - fts_optimize_init(); |
1061 | - } |
1062 | - |
1063 | -+skip_processes: |
1064 | - srv_was_started = TRUE; |
1065 | - |
1066 | - return(DB_SUCCESS); |
1067 | -@@ -2794,7 +2817,7 @@ |
1068 | - return(DB_SUCCESS); |
1069 | - } |
1070 | - |
1071 | -- if (!srv_read_only_mode) { |
1072 | -+ if (!srv_read_only_mode && !srv_apply_log_only) { |
1073 | - /* Shutdown the FTS optimize sub system. */ |
1074 | - fts_optimize_start_shutdown(); |
1075 | - |
1076 | ---- a/storage/innobase/trx/trx0rseg.cc |
1077 | -+++ b/storage/innobase/trx/trx0rseg.cc |
1078 | -@@ -121,9 +121,11 @@ |
1079 | - |
1080 | - mutex_free(&rseg->mutex); |
1081 | - |
1082 | -+ if (!srv_apply_log_only) { |
1083 | - /* There can't be any active transactions. */ |
1084 | - ut_a(UT_LIST_GET_LEN(rseg->update_undo_list) == 0); |
1085 | - ut_a(UT_LIST_GET_LEN(rseg->insert_undo_list) == 0); |
1086 | -+ } |
1087 | - |
1088 | - for (undo = UT_LIST_GET_FIRST(rseg->update_undo_cached); |
1089 | - undo != NULL; |
1090 | ---- a/storage/innobase/trx/trx0sys.cc |
1091 | -+++ b/storage/innobase/trx/trx0sys.cc |
1092 | -@@ -1191,12 +1191,14 @@ |
1093 | - |
1094 | - ut_a(UT_LIST_GET_LEN(trx_sys->ro_trx_list) == 0); |
1095 | - |
1096 | -+ if (!srv_apply_log_only) { |
1097 | - /* Only prepared transactions may be left in the system. Free them. */ |
1098 | - ut_a(UT_LIST_GET_LEN(trx_sys->rw_trx_list) == trx_sys->n_prepared_trx); |
1099 | - |
1100 | - while ((trx = UT_LIST_GET_FIRST(trx_sys->rw_trx_list)) != NULL) { |
1101 | - trx_free_prepared(trx); |
1102 | - } |
1103 | -+ } |
1104 | - |
1105 | - /* There can't be any active transactions. */ |
1106 | - for (i = 0; i < TRX_SYS_N_RSEGS; ++i) { |
1107 | -@@ -1223,10 +1225,12 @@ |
1108 | - UT_LIST_REMOVE(view_list, trx_sys->view_list, prev_view); |
1109 | - } |
1110 | - |
1111 | -+ if (!srv_apply_log_only) { |
1112 | - ut_a(UT_LIST_GET_LEN(trx_sys->view_list) == 0); |
1113 | - ut_a(UT_LIST_GET_LEN(trx_sys->ro_trx_list) == 0); |
1114 | - ut_a(UT_LIST_GET_LEN(trx_sys->rw_trx_list) == 0); |
1115 | - ut_a(UT_LIST_GET_LEN(trx_sys->mysql_trx_list) == 0); |
1116 | -+ } |
1117 | - |
1118 | - mutex_exit(&trx_sys->mutex); |
1119 | - |
1120 | -@@ -1247,6 +1251,10 @@ |
1121 | - { |
1122 | - ulint total_trx = 0; |
1123 | - |
1124 | -+ if (srv_apply_log_only) { |
1125 | -+ return(0); |
1126 | -+ } |
1127 | -+ |
1128 | - mutex_enter(&trx_sys->mutex); |
1129 | - |
1130 | - total_trx = UT_LIST_GET_LEN(trx_sys->rw_trx_list) |
1131 | ---- a/storage/innobase/trx/trx0trx.cc |
1132 | -+++ b/storage/innobase/trx/trx0trx.cc |
1133 | -@@ -2084,7 +2084,8 @@ |
1134 | - scenario where some undo generated by a transaction, |
1135 | - has XA stuff, and other undo, generated by the same |
1136 | - transaction, doesn't. */ |
1137 | -- trx->support_xa = thd_supports_xa(trx->mysql_thd); |
1138 | -+ trx->support_xa = trx->mysql_thd |
1139 | -+ ? thd_supports_xa(trx->mysql_thd) : FALSE; |
1140 | - |
1141 | - trx_start_low(trx); |
1142 | - /* fall through */ |
1143 | ---- a/storage/innobase/CMakeLists.txt |
1144 | -+++ b/storage/innobase/CMakeLists.txt |
1145 | -@@ -44,8 +44,10 @@ |
1146 | - # SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") |
1147 | - ENDIF() |
1148 | - |
1149 | --# Enable InnoDB's UNIV_DEBUG and UNIV_SYNC_DEBUG in debug builds |
1150 | --SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DUNIV_DEBUG -DUNIV_SYNC_DEBUG") |
1151 | -+# In XtraBackup do not enable UNIV_SYNC_DEBUG when UNIV_DEBUG is enabled |
1152 | -+# due to extreme slowness on compact backup testcases |
1153 | -+## Enable InnoDB's UNIV_DEBUG and UNIV_SYNC_DEBUG in debug builds |
1154 | -+#SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DUNIV_DEBUG -DUNIV_SYNC_DEBUG") |
1155 | - |
1156 | - # Add -Wconversion if compiling with GCC |
1157 | - ## As of Mar 15 2011 this flag causes 3573+ warnings. If you are reading this |
1158 | ---- a/storage/innobase/sync/sync0arr.cc |
1159 | -+++ b/storage/innobase/sync/sync0arr.cc |
1160 | -@@ -42,6 +42,7 @@ |
1161 | - #include "lock0lock.h" |
1162 | - #include "srv0srv.h" |
1163 | - #include "ha_prototypes.h" |
1164 | -+#include "xb0xb.h" |
1165 | - |
1166 | - /* |
1167 | - WAIT ARRAY |
1168 | -@@ -899,6 +900,13 @@ |
1169 | - ibool fatal = FALSE; |
1170 | - double longest_diff = 0; |
1171 | - |
1172 | -+ if (srv_rebuild_indexes) { |
1173 | -+ |
1174 | -+ /* Avoid long semaphore waits when rebuilding indexes */ |
1175 | -+ |
1176 | -+ return(FALSE); |
1177 | -+ } |
1178 | -+ |
1179 | - /* For huge tables, skip the check during CHECK TABLE etc... */ |
1180 | - if (fatal_timeout > SRV_SEMAPHORE_WAIT_EXTENSION) { |
1181 | - return(FALSE); |
1182 | ---- a/storage/innobase/include/buf0buf.h |
1183 | -+++ b/storage/innobase/include/buf0buf.h |
1184 | -@@ -1580,6 +1580,8 @@ |
1185 | - or buf_block_t::mutex. */ |
1186 | - # endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */ |
1187 | - #endif /* !UNIV_HOTBACKUP */ |
1188 | -+ ibool is_compacted; /*!< TRUE if page was skipped in |
1189 | -+ compact backups */ |
1190 | - }; |
1191 | - |
1192 | - /** The buffer control block structure */ |
1193 | ---- a/storage/innobase/mem/mem0dbg.cc |
1194 | -+++ b/storage/innobase/mem/mem0dbg.cc |
1195 | -@@ -278,18 +278,10 @@ |
1196 | - byte* buf, /*!< in: pointer to buffer */ |
1197 | - ulint n) /*!< in: length of buffer */ |
1198 | - { |
1199 | -- byte* ptr; |
1200 | -- |
1201 | - UNIV_MEM_ASSERT_W(buf, n); |
1202 | - |
1203 | -- for (ptr = buf; ptr < buf + n; ptr++) { |
1204 | -- |
1205 | -- if (ut_rnd_gen_ibool()) { |
1206 | -- *ptr = 0xBA; |
1207 | -- } else { |
1208 | -- *ptr = 0xBE; |
1209 | -- } |
1210 | -- } |
1211 | -+ /* Fix https://bugs.launchpad.net/percona-xtrabackup/+bug/1158154 */ |
1212 | -+ memset(buf, 0xBA, n); |
1213 | - |
1214 | - UNIV_MEM_INVALID(buf, n); |
1215 | - } |
1216 | -@@ -304,17 +296,10 @@ |
1217 | - byte* buf, /*!< in: pointer to buffer */ |
1218 | - ulint n) /*!< in: length of buffer */ |
1219 | - { |
1220 | -- byte* ptr; |
1221 | -- |
1222 | - UNIV_MEM_ASSERT_W(buf, n); |
1223 | - |
1224 | -- for (ptr = buf; ptr < buf + n; ptr++) { |
1225 | -- if (ut_rnd_gen_ibool()) { |
1226 | -- *ptr = 0xDE; |
1227 | -- } else { |
1228 | -- *ptr = 0xAD; |
1229 | -- } |
1230 | -- } |
1231 | -+ /* Fix https://bugs.launchpad.net/percona-xtrabackup/+bug/1158154 */ |
1232 | -+ memset(buf, 0xDE, n); |
1233 | - |
1234 | - UNIV_MEM_FREE(buf, n); |
1235 | - } |
1236 | ---- a/storage/innobase/include/srv0start.h |
1237 | -+++ b/storage/innobase/include/srv0start.h |
1238 | -@@ -68,6 +68,23 @@ |
1239 | - srv_add_path_separator_if_needed( |
1240 | - /*=============================*/ |
1241 | - char* str); /*!< in: null-terminated character string */ |
1242 | -+/******************************************************************** |
1243 | -+Opens the configured number of undo tablespaces. |
1244 | -+@return DB_SUCCESS or error code */ |
1245 | -+UNIV_INTERN |
1246 | -+dberr_t |
1247 | -+srv_undo_tablespaces_init( |
1248 | -+/*======================*/ |
1249 | -+ ibool create_new_db, /*!< in: TRUE if new db being |
1250 | -+ created */ |
1251 | -+ ibool backup_mode, /*!< in: TRUE disables reading |
1252 | -+ the system tablespace (used in |
1253 | -+ XtraBackup), FALSE is passed on |
1254 | -+ recovery. */ |
1255 | -+ const ulint n_conf_tablespaces, /*!< in: configured undo |
1256 | -+ tablespaces */ |
1257 | -+ ulint* n_opened); /*!< out: number of UNDO |
1258 | -+ tablespaces successfully */ |
1259 | - #ifndef UNIV_HOTBACKUP |
1260 | - /****************************************************************//** |
1261 | - Starts Innobase and creates a new database if database files |
1262 | ---- a/configure.cmake |
1263 | -+++ b/configure.cmake |
1264 | -@@ -979,14 +979,6 @@ |
1265 | - ENDIF() |
1266 | - |
1267 | - CHECK_C_SOURCE_COMPILES(" |
1268 | -- int main(int argc, char **argv) |
1269 | -- { |
1270 | -- extern char *__bss_start; |
1271 | -- return __bss_start ? 1 : 0; |
1272 | -- }" |
1273 | --HAVE_BSS_START) |
1274 | -- |
1275 | --CHECK_C_SOURCE_COMPILES(" |
1276 | - int main() |
1277 | - { |
1278 | - extern void __attribute__((weak)) foo(void); |
1279 | ---- a/mysys/my_thr_init.c |
1280 | -+++ b/mysys/my_thr_init.c |
1281 | -@@ -462,8 +462,12 @@ |
1282 | - |
1283 | - extern void **my_thread_var_dbug() |
1284 | - { |
1285 | -- struct st_my_thread_var *tmp= |
1286 | -- my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys); |
1287 | -+ struct st_my_thread_var *tmp; |
1288 | -+ |
1289 | -+ if (!my_thread_global_init_done) |
1290 | -+ return NULL; |
1291 | -+ |
1292 | -+ tmp= my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys); |
1293 | - return tmp && tmp->init ? &tmp->dbug : 0; |
1294 | - } |
1295 | - #endif /* DBUG_OFF */ |
1296 | --- a/storage/innobase/handler/handler0alter.cc |
1297 | +++ b/storage/innobase/handler/handler0alter.cc |
1298 | @@ -5434,6 +5434,7 @@ |
1299 | @@ -1492,192 +1113,30 @@ |
1300 | DBUG_INJECT_CRASH("ib_commit_inplace_crash", |
1301 | crash_inject_count++); |
1302 | } |
1303 | ---- a/storage/innobase/page/page0cur.cc |
1304 | -+++ b/storage/innobase/page/page0cur.cc |
1305 | -@@ -1207,6 +1207,8 @@ |
1306 | - == index->id || mtr->inside_ibuf || recv_recovery_is_on()); |
1307 | - |
1308 | - ut_ad(!page_cur_is_after_last(cursor)); |
1309 | --#ifdef UNIV_ZIP_DEBUG |
1310 | -+#if 0 |
1311 | -+ /* Disabled to speedup compact_compressed test for debug XtraBackup |
1312 | -+ builds, see LP bug #1213036. */ |
1313 | - ut_a(page_zip_validate(page_zip, page, index)); |
1314 | - #endif /* UNIV_ZIP_DEBUG */ |
1315 | - |
1316 | ---- a/storage/innobase/include/log0log.h |
1317 | -+++ b/storage/innobase/include/log0log.h |
1318 | -@@ -681,6 +681,9 @@ |
1319 | - when mysqld is first time started |
1320 | - on the restored database, it can |
1321 | - print helpful info for the user */ |
1322 | -+#define LOG_FILE_OS_FILE_LOG_BLOCK_SIZE 64 |
1323 | -+ /* extend to record log_block_size |
1324 | -+ of XtraDB. 0 means default 512 */ |
1325 | - #define LOG_FILE_ARCH_COMPLETED OS_FILE_LOG_BLOCK_SIZE |
1326 | - /* this 4-byte field is TRUE when |
1327 | - the writing of an archived log file |
1328 | ---- a/storage/innobase/include/os0file.h |
1329 | -+++ b/storage/innobase/include/os0file.h |
1330 | -@@ -99,7 +99,7 @@ |
1331 | - if this fails for a log block, then it is equivalent to a media failure in the |
1332 | - log. */ |
1333 | - |
1334 | --#define OS_FILE_LOG_BLOCK_SIZE 512 |
1335 | -+#define OS_FILE_LOG_BLOCK_SIZE srv_log_block_size |
1336 | - |
1337 | - /** Options for os_file_create_func @{ */ |
1338 | - enum os_file_create_t { |
1339 | -@@ -202,6 +202,10 @@ |
1340 | - extern ulint os_n_file_writes; |
1341 | - extern ulint os_n_fsyncs; |
1342 | - |
1343 | -+#define OS_MIN_LOG_BLOCK_SIZE 512 |
1344 | -+ |
1345 | -+extern ulint srv_log_block_size; |
1346 | -+ |
1347 | - #ifdef UNIV_PFS_IO |
1348 | - /* Keys to register InnoDB I/O with performance schema */ |
1349 | - extern mysql_pfs_key_t innodb_file_data_key; |
1350 | ---- a/storage/innobase/log/log0log.cc |
1351 | -+++ b/storage/innobase/log/log0log.cc |
1352 | -@@ -1144,6 +1144,11 @@ |
1353 | - /* Wipe over possible label of ibbackup --restore */ |
1354 | - memcpy(buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP, " ", 4); |
1355 | - |
1356 | -+ if (srv_log_block_size > 512) { |
1357 | -+ mach_write_to_4(buf + LOG_FILE_OS_FILE_LOG_BLOCK_SIZE, |
1358 | -+ srv_log_block_size); |
1359 | -+ } |
1360 | -+ |
1361 | - dest_offset = nth_file * group->file_size; |
1362 | - |
1363 | - #ifdef UNIV_DEBUG |
1364 | -@@ -1759,9 +1764,7 @@ |
1365 | - |
1366 | - ut_ad(!srv_read_only_mode); |
1367 | - ut_ad(mutex_own(&(log_sys->mutex))); |
1368 | --#if LOG_CHECKPOINT_SIZE > OS_FILE_LOG_BLOCK_SIZE |
1369 | --# error "LOG_CHECKPOINT_SIZE > OS_FILE_LOG_BLOCK_SIZE" |
1370 | --#endif |
1371 | -+ ut_ad(LOG_CHECKPOINT_SIZE <= OS_FILE_LOG_BLOCK_SIZE); |
1372 | - |
1373 | - buf = group->checkpoint_buf; |
1374 | - |
1375 | ---- a/storage/innobase/fil/fil0fil.cc |
1376 | -+++ b/storage/innobase/fil/fil0fil.cc |
1377 | -@@ -1980,12 +1980,6 @@ |
1378 | - contain sensible data */ |
1379 | - ulint* flags, /*!< out: tablespace flags */ |
1380 | - ulint* space_id, /*!< out: tablespace ID */ |
1381 | --#ifdef UNIV_LOG_ARCHIVE |
1382 | -- ulint* min_arch_log_no, /*!< out: min of archived |
1383 | -- log numbers in data files */ |
1384 | -- ulint* max_arch_log_no, /*!< out: max of archived |
1385 | -- log numbers in data files */ |
1386 | --#endif /* UNIV_LOG_ARCHIVE */ |
1387 | - lsn_t* min_flushed_lsn, /*!< out: min of flushed |
1388 | - lsn values in data files */ |
1389 | - lsn_t* max_flushed_lsn) /*!< out: max of flushed |
1390 | -@@ -2014,10 +2008,6 @@ |
1391 | - if (!one_read_already) { |
1392 | - *min_flushed_lsn = flushed_lsn; |
1393 | - *max_flushed_lsn = flushed_lsn; |
1394 | --#ifdef UNIV_LOG_ARCHIVE |
1395 | -- *min_arch_log_no = arch_log_no; |
1396 | -- *max_arch_log_no = arch_log_no; |
1397 | --#endif /* UNIV_LOG_ARCHIVE */ |
1398 | - return; |
1399 | - } |
1400 | - |
1401 | -@@ -2027,14 +2017,6 @@ |
1402 | - if (*max_flushed_lsn < flushed_lsn) { |
1403 | - *max_flushed_lsn = flushed_lsn; |
1404 | - } |
1405 | --#ifdef UNIV_LOG_ARCHIVE |
1406 | -- if (*min_arch_log_no > arch_log_no) { |
1407 | -- *min_arch_log_no = arch_log_no; |
1408 | -- } |
1409 | -- if (*max_arch_log_no < arch_log_no) { |
1410 | -- *max_arch_log_no = arch_log_no; |
1411 | -- } |
1412 | --#endif /* UNIV_LOG_ARCHIVE */ |
1413 | - } |
1414 | - |
1415 | - /*================ SINGLE-TABLE TABLESPACES ==========================*/ |
1416 | -@@ -3538,9 +3520,6 @@ |
1417 | - lsn_t lsn; /*!< Flushed LSN from header page */ |
1418 | - ulint id; /*!< Space ID */ |
1419 | - ulint flags; /*!< Tablespace flags */ |
1420 | --#ifdef UNIV_LOG_ARCHIVE |
1421 | -- ulint arch_log_no; /*!< latest archived log file number */ |
1422 | --#endif /* UNIV_LOG_ARCHIVE */ |
1423 | +--- a/storage/innobase/include/buf0buf.h |
1424 | ++++ b/storage/innobase/include/buf0buf.h |
1425 | +@@ -1580,6 +1580,8 @@ |
1426 | + or buf_block_t::mutex. */ |
1427 | + # endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */ |
1428 | + #endif /* !UNIV_HOTBACKUP */ |
1429 | ++ ibool is_compacted; /*!< TRUE if page was skipped in |
1430 | ++ compact backups */ |
1431 | }; |
1432 | |
1433 | - static |
1434 | -@@ -3771,9 +3750,6 @@ |
1435 | - if (def.success) { |
1436 | - fil_read_first_page( |
1437 | - def.file, FALSE, &def.flags, &def.id, |
1438 | --#ifdef UNIV_LOG_ARCHIVE |
1439 | -- &space_arch_log_no, &space_arch_log_no, |
1440 | --#endif /* UNIV_LOG_ARCHIVE */ |
1441 | - &def.lsn, &def.lsn); |
1442 | - |
1443 | - /* Validate this single-table-tablespace with SYS_TABLES, |
1444 | -@@ -3795,9 +3771,6 @@ |
1445 | - if (remote.success) { |
1446 | - fil_read_first_page( |
1447 | - remote.file, FALSE, &remote.flags, &remote.id, |
1448 | --#ifdef UNIV_LOG_ARCHIVE |
1449 | -- &remote.arch_log_no, &remote.arch_log_no, |
1450 | --#endif /* UNIV_LOG_ARCHIVE */ |
1451 | - &remote.lsn, &remote.lsn); |
1452 | - |
1453 | - /* Validate this single-table-tablespace with SYS_TABLES, |
1454 | -@@ -3820,9 +3793,6 @@ |
1455 | - if (dict.success) { |
1456 | - fil_read_first_page( |
1457 | - dict.file, FALSE, &dict.flags, &dict.id, |
1458 | --#ifdef UNIV_LOG_ARCHIVE |
1459 | -- &dict.arch_log_no, &dict.arch_log_no, |
1460 | --#endif /* UNIV_LOG_ARCHIVE */ |
1461 | - &dict.lsn, &dict.lsn); |
1462 | - |
1463 | - /* Validate this single-table-tablespace with SYS_TABLES, |
1464 | -@@ -4054,9 +4024,6 @@ |
1465 | - { |
1466 | - fil_read_first_page( |
1467 | - fsp->file, FALSE, &fsp->flags, &fsp->id, |
1468 | --#ifdef UNIV_LOG_ARCHIVE |
1469 | -- &fsp->arch_log_no, &fsp->arch_log_no, |
1470 | --#endif /* UNIV_LOG_ARCHIVE */ |
1471 | - &fsp->lsn, &fsp->lsn); |
1472 | - |
1473 | - if (fsp->id == ULINT_UNDEFINED || fsp->id == 0) { |
1474 | - |
1475 | ---- a/storage/innobase/handler/ha_innodb.cc |
1476 | -+++ b/storage/innobase/handler/ha_innodb.cc |
1477 | -@@ -2859,12 +2859,9 @@ |
1478 | - } |
1479 | - |
1480 | - #ifdef UNIV_LOG_ARCHIVE |
1481 | -- /* Since innodb_log_arch_dir has no relevance under MySQL, |
1482 | -- starting from 4.0.6 we always set it the same as |
1483 | -- innodb_log_group_home_dir: */ |
1484 | -- |
1485 | -- innobase_log_arch_dir = innobase_log_group_home_dir; |
1486 | -- |
1487 | -+ if (!innobase_log_arch_dir) { |
1488 | -+ innobase_log_arch_dir = srv_log_group_home_dir; |
1489 | -+ } |
1490 | - srv_arch_dir = innobase_log_arch_dir; |
1491 | - #endif /* UNIG_LOG_ARCHIVE */ |
1492 | - |
1493 | - |
1494 | + /** The buffer control block structure */ |
1495 | --- a/storage/innobase/include/fil0fil.h |
1496 | +++ b/storage/innobase/include/fil0fil.h |
1497 | -@@ -374,12 +374,6 @@ |
1498 | +@@ -163,6 +163,9 @@ |
1499 | + #define FIL_LOG 502 /*!< redo log */ |
1500 | + /* @} */ |
1501 | + |
1502 | ++/** Determine if (i) is a user tablespace id or not. */ |
1503 | ++#define fil_is_user_tablespace_id(i) ((i) > srv_undo_tablespaces_open) |
1504 | ++ |
1505 | + /** The number of fsyncs done to the log */ |
1506 | + extern ulint fil_n_log_flushes; |
1507 | + |
1508 | +@@ -371,12 +374,6 @@ |
1509 | contain sensible data */ |
1510 | ulint* flags, /*!< out: tablespace flags */ |
1511 | ulint* space_id, /*!< out: tablespace ID */ |
1512 | @@ -1690,10 +1149,34 @@ |
1513 | lsn_t* min_flushed_lsn, /*!< out: min of flushed |
1514 | lsn values in data files */ |
1515 | lsn_t* max_flushed_lsn); /*!< out: max of flushed |
1516 | - |
1517 | +@@ -608,7 +605,7 @@ |
1518 | + @return DB_SUCCESS or error number */ |
1519 | + UNIV_INTERN |
1520 | + dberr_t |
1521 | +-fil_load_single_table_tablespaces(void); |
1522 | ++fil_load_single_table_tablespaces(ibool (*pred)(const char*, const char*)); |
1523 | + /*===================================*/ |
1524 | + /*******************************************************************//** |
1525 | + Returns TRUE if a single-table tablespace does not exist in the memory cache, |
1526 | --- a/storage/innobase/include/log0log.h |
1527 | +++ b/storage/innobase/include/log0log.h |
1528 | -@@ -70,6 +70,10 @@ |
1529 | +@@ -62,6 +62,15 @@ |
1530 | + # define log_do_write TRUE |
1531 | + #endif /* UNIV_DEBUG */ |
1532 | + |
1533 | ++/** Magic value to use instead of log checksums when they are disabled */ |
1534 | ++#define LOG_NO_CHECKSUM_MAGIC 0xDEADBEEFUL |
1535 | ++ |
1536 | ++typedef ulint (*log_checksum_func_t)(const byte* log_block); |
1537 | ++ |
1538 | ++/** Pointer to the log checksum calculation function. Protected with |
1539 | ++log_sys->mutex. */ |
1540 | ++extern log_checksum_func_t log_checksum_algorithm_ptr; |
1541 | ++ |
1542 | + /** Wait modes for log_write_up_to @{ */ |
1543 | + #define LOG_NO_WAIT 91 |
1544 | + #define LOG_WAIT_ONE_GROUP 92 |
1545 | +@@ -70,6 +79,10 @@ |
1546 | /** Maximum number of log groups in log_group_t::checkpoint_buf */ |
1547 | #define LOG_MAX_N_GROUPS 32 |
1548 | |
1549 | @@ -1704,7 +1187,7 @@ |
1550 | /*******************************************************************//** |
1551 | Calculates where in log files we find a specified lsn. |
1552 | @return log file number */ |
1553 | -@@ -340,8 +344,18 @@ |
1554 | +@@ -340,8 +353,18 @@ |
1555 | log_archived_file_name_gen( |
1556 | /*=======================*/ |
1557 | char* buf, /*!< in: buffer where to write */ |
1558 | @@ -1724,7 +1207,17 @@ |
1559 | #else /* !UNIV_HOTBACKUP */ |
1560 | /******************************************************//** |
1561 | Writes info to a buffer of a log group when log files are created in |
1562 | -@@ -739,19 +753,19 @@ |
1563 | +@@ -681,6 +704,9 @@ |
1564 | + when mysqld is first time started |
1565 | + on the restored database, it can |
1566 | + print helpful info for the user */ |
1567 | ++#define LOG_FILE_OS_FILE_LOG_BLOCK_SIZE 64 |
1568 | ++ /* extend to record log_block_size |
1569 | ++ of XtraDB. 0 means default 512 */ |
1570 | + #define LOG_FILE_ARCH_COMPLETED OS_FILE_LOG_BLOCK_SIZE |
1571 | + /* this 4-byte field is TRUE when |
1572 | + the writing of an archived log file |
1573 | +@@ -736,19 +762,19 @@ |
1574 | ulint archive_space_id;/*!< file space which |
1575 | implements the log group |
1576 | archive */ |
1577 | @@ -1748,7 +1241,75 @@ |
1578 | #endif /* UNIV_LOG_ARCHIVE */ |
1579 | /*-----------------------------*/ |
1580 | lsn_t scanned_lsn; /*!< used only in recovery: recovery scan |
1581 | - |
1582 | +--- a/storage/innobase/include/log0log.ic |
1583 | ++++ b/storage/innobase/include/log0log.ic |
1584 | +@@ -27,6 +27,8 @@ |
1585 | + #include "mach0data.h" |
1586 | + #include "mtr0mtr.h" |
1587 | + #include "srv0mon.h" |
1588 | ++#include "srv0srv.h" |
1589 | ++#include "ut0crc32.h" |
1590 | + |
1591 | + #ifdef UNIV_LOG_DEBUG |
1592 | + /******************************************************//** |
1593 | +@@ -199,7 +201,7 @@ |
1594 | + } |
1595 | + |
1596 | + /************************************************************//** |
1597 | +-Calculates the checksum for a log block. |
1598 | ++Calculates the checksum for a log block using the current algorithm. |
1599 | + @return checksum */ |
1600 | + UNIV_INLINE |
1601 | + ulint |
1602 | +@@ -207,6 +209,17 @@ |
1603 | + /*====================*/ |
1604 | + const byte* block) /*!< in: log block */ |
1605 | + { |
1606 | ++ return(log_checksum_algorithm_ptr(block)); |
1607 | ++} |
1608 | ++/************************************************************//** |
1609 | ++Calculates the checksum for a log block using the default InnoDB algorithm. |
1610 | ++@return checksum */ |
1611 | ++UNIV_INLINE |
1612 | ++ulint |
1613 | ++log_block_calc_checksum_innodb( |
1614 | ++/*===========================*/ |
1615 | ++ const byte* block) /*!< in: log block */ |
1616 | ++{ |
1617 | + ulint sum; |
1618 | + ulint sh; |
1619 | + ulint i; |
1620 | +@@ -229,6 +242,30 @@ |
1621 | + } |
1622 | + |
1623 | + /************************************************************//** |
1624 | ++Calculates the checksum for a log block using the CRC32 algorithm. |
1625 | ++@return checksum */ |
1626 | ++UNIV_INLINE |
1627 | ++ulint |
1628 | ++log_block_calc_checksum_crc32( |
1629 | ++/*==========================*/ |
1630 | ++ const byte* block) /*!< in: log block */ |
1631 | ++{ |
1632 | ++ return(ut_crc32(block, OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_TRL_SIZE)); |
1633 | ++} |
1634 | ++ |
1635 | ++/************************************************************//** |
1636 | ++Calculates the checksum for a log block using the "no-op" algorithm. |
1637 | ++@return checksum */ |
1638 | ++UNIV_INLINE |
1639 | ++ulint |
1640 | ++log_block_calc_checksum_none( |
1641 | ++/*=========================*/ |
1642 | ++ const byte* block) /*!< in: log block */ |
1643 | ++{ |
1644 | ++ return(LOG_NO_CHECKSUM_MAGIC); |
1645 | ++} |
1646 | ++ |
1647 | ++/************************************************************//** |
1648 | + Gets a log block checksum field value. |
1649 | + @return checksum */ |
1650 | + UNIV_INLINE |
1651 | --- a/storage/innobase/include/log0recv.h |
1652 | +++ b/storage/innobase/include/log0recv.h |
1653 | @@ -297,18 +297,13 @@ |
1654 | @@ -1772,7 +1333,70 @@ |
1655 | /********************************************************//** |
1656 | Completes recovery from archive. */ |
1657 | UNIV_INTERN |
1658 | - |
1659 | +--- a/storage/innobase/include/os0file.h |
1660 | ++++ b/storage/innobase/include/os0file.h |
1661 | +@@ -99,7 +99,7 @@ |
1662 | + if this fails for a log block, then it is equivalent to a media failure in the |
1663 | + log. */ |
1664 | + |
1665 | +-#define OS_FILE_LOG_BLOCK_SIZE 512 |
1666 | ++#define OS_FILE_LOG_BLOCK_SIZE srv_log_block_size |
1667 | + |
1668 | + /** Options for os_file_create_func @{ */ |
1669 | + enum os_file_create_t { |
1670 | +@@ -202,6 +202,10 @@ |
1671 | + extern ulint os_n_file_writes; |
1672 | + extern ulint os_n_fsyncs; |
1673 | + |
1674 | ++#define OS_MIN_LOG_BLOCK_SIZE 512 |
1675 | ++ |
1676 | ++extern ulint srv_log_block_size; |
1677 | ++ |
1678 | + #ifdef UNIV_PFS_IO |
1679 | + /* Keys to register InnoDB I/O with performance schema */ |
1680 | + extern mysql_pfs_key_t innodb_file_data_key; |
1681 | +--- a/storage/innobase/include/srv0srv.h |
1682 | ++++ b/storage/innobase/include/srv0srv.h |
1683 | +@@ -353,6 +353,13 @@ |
1684 | + extern ulong srv_max_purge_lag_delay; |
1685 | + |
1686 | + extern ulong srv_replication_delay; |
1687 | ++ |
1688 | ++extern ulint srv_log_checksum_algorithm; |
1689 | ++ |
1690 | ++extern ibool srv_apply_log_only; |
1691 | ++ |
1692 | ++extern ibool srv_backup_mode; |
1693 | ++ |
1694 | + /*-------------------------------------------*/ |
1695 | + |
1696 | + extern ibool srv_print_innodb_monitor; |
1697 | +--- a/storage/innobase/include/srv0start.h |
1698 | ++++ b/storage/innobase/include/srv0start.h |
1699 | +@@ -68,6 +68,23 @@ |
1700 | + srv_add_path_separator_if_needed( |
1701 | + /*=============================*/ |
1702 | + char* str); /*!< in: null-terminated character string */ |
1703 | ++/******************************************************************** |
1704 | ++Opens the configured number of undo tablespaces. |
1705 | ++@return DB_SUCCESS or error code */ |
1706 | ++UNIV_INTERN |
1707 | ++dberr_t |
1708 | ++srv_undo_tablespaces_init( |
1709 | ++/*======================*/ |
1710 | ++ ibool create_new_db, /*!< in: TRUE if new db being |
1711 | ++ created */ |
1712 | ++ ibool backup_mode, /*!< in: TRUE disables reading |
1713 | ++ the system tablespace (used in |
1714 | ++ XtraBackup), FALSE is passed on |
1715 | ++ recovery. */ |
1716 | ++ const ulint n_conf_tablespaces, /*!< in: configured undo |
1717 | ++ tablespaces */ |
1718 | ++ ulint* n_opened); /*!< out: number of UNDO |
1719 | ++ tablespaces successfully */ |
1720 | + #ifndef UNIV_HOTBACKUP |
1721 | + /****************************************************************//** |
1722 | + Starts Innobase and creates a new database if database files |
1723 | --- a/storage/innobase/include/univ.i |
1724 | +++ b/storage/innobase/include/univ.i |
1725 | @@ -46,6 +46,9 @@ |
1726 | @@ -1785,10 +1409,20 @@ |
1727 | /* The following is the InnoDB version as shown in |
1728 | SELECT plugin_version FROM information_schema.plugins; |
1729 | calculated in make_version_string() in sql/sql_show.cc like this: |
1730 | - |
1731 | --- a/storage/innobase/log/log0log.cc |
1732 | +++ b/storage/innobase/log/log0log.cc |
1733 | -@@ -896,10 +896,10 @@ |
1734 | +@@ -79,6 +79,10 @@ |
1735 | + /* Global log system variable */ |
1736 | + UNIV_INTERN log_t* log_sys = NULL; |
1737 | + |
1738 | ++/** Pointer to the log checksum calculation function */ |
1739 | ++UNIV_INTERN log_checksum_func_t log_checksum_algorithm_ptr = |
1740 | ++ log_block_calc_checksum_innodb; |
1741 | ++ |
1742 | + #ifdef UNIV_PFS_RWLOCK |
1743 | + UNIV_INTERN mysql_pfs_key_t checkpoint_lock_key; |
1744 | + # ifdef UNIV_LOG_ARCHIVE |
1745 | +@@ -896,10 +900,10 @@ |
1746 | mem_zalloc(sizeof(byte**) * n_files)); |
1747 | |
1748 | #ifdef UNIV_LOG_ARCHIVE |
1749 | @@ -1801,7 +1435,7 @@ |
1750 | mem_zalloc(sizeof(byte*) * n_files)); |
1751 | #endif /* UNIV_LOG_ARCHIVE */ |
1752 | |
1753 | -@@ -924,7 +924,7 @@ |
1754 | +@@ -924,7 +928,7 @@ |
1755 | #ifdef UNIV_LOG_ARCHIVE |
1756 | group->archive_space_id = archive_space_id; |
1757 | |
1758 | @@ -1810,7 +1444,30 @@ |
1759 | group->archived_offset = 0; |
1760 | #endif /* UNIV_LOG_ARCHIVE */ |
1761 | |
1762 | -@@ -2228,7 +2228,7 @@ |
1763 | +@@ -1144,6 +1148,11 @@ |
1764 | + /* Wipe over possible label of ibbackup --restore */ |
1765 | + memcpy(buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP, " ", 4); |
1766 | + |
1767 | ++ if (srv_log_block_size > 512) { |
1768 | ++ mach_write_to_4(buf + LOG_FILE_OS_FILE_LOG_BLOCK_SIZE, |
1769 | ++ srv_log_block_size); |
1770 | ++ } |
1771 | ++ |
1772 | + dest_offset = nth_file * group->file_size; |
1773 | + |
1774 | + #ifdef UNIV_DEBUG |
1775 | +@@ -1759,9 +1768,7 @@ |
1776 | + |
1777 | + ut_ad(!srv_read_only_mode); |
1778 | + ut_ad(mutex_own(&(log_sys->mutex))); |
1779 | +-#if LOG_CHECKPOINT_SIZE > OS_FILE_LOG_BLOCK_SIZE |
1780 | +-# error "LOG_CHECKPOINT_SIZE > OS_FILE_LOG_BLOCK_SIZE" |
1781 | +-#endif |
1782 | ++ ut_ad(LOG_CHECKPOINT_SIZE <= OS_FILE_LOG_BLOCK_SIZE); |
1783 | + |
1784 | + buf = group->checkpoint_buf; |
1785 | + |
1786 | +@@ -2225,7 +2232,7 @@ |
1787 | fil_io(OS_FILE_READ | OS_FILE_LOG, sync, group->space_id, 0, |
1788 | (ulint) (source_offset / UNIV_PAGE_SIZE), |
1789 | (ulint) (source_offset % UNIV_PAGE_SIZE), |
1790 | @@ -1819,7 +1476,7 @@ |
1791 | |
1792 | start_lsn += len; |
1793 | buf += len; |
1794 | -@@ -2247,12 +2247,68 @@ |
1795 | +@@ -2244,12 +2251,68 @@ |
1796 | log_archived_file_name_gen( |
1797 | /*=======================*/ |
1798 | char* buf, /*!< in: buffer where to write */ |
1799 | @@ -1828,10 +1485,9 @@ |
1800 | /*!< in: group id; |
1801 | currently we only archive the first group */ |
1802 | - ulint file_no)/*!< in: file number */ |
1803 | --{ |
1804 | ++ lsn_t file_no)/*!< in: file number */ |
1805 | + { |
1806 | - sprintf(buf, "%sib_arch_log_%010lu", srv_arch_dir, (ulong) file_no); |
1807 | -+ lsn_t file_no)/*!< in: file number */ |
1808 | -+{ |
1809 | + ulint dirnamelen; |
1810 | + |
1811 | + dirnamelen = strlen(srv_arch_dir); |
1812 | @@ -1891,7 +1547,7 @@ |
1813 | } |
1814 | |
1815 | /******************************************************//** |
1816 | -@@ -2290,6 +2346,7 @@ |
1817 | +@@ -2287,6 +2350,7 @@ |
1818 | MONITOR_INC(MONITOR_LOG_IO); |
1819 | |
1820 | fil_io(OS_FILE_WRITE | OS_FILE_LOG, TRUE, group->archive_space_id, |
1821 | @@ -1899,7 +1555,7 @@ |
1822 | dest_offset / UNIV_PAGE_SIZE, |
1823 | dest_offset % UNIV_PAGE_SIZE, |
1824 | 2 * OS_FILE_LOG_BLOCK_SIZE, |
1825 | -@@ -2325,6 +2382,7 @@ |
1826 | +@@ -2322,6 +2386,7 @@ |
1827 | MONITOR_INC(MONITOR_LOG_IO); |
1828 | |
1829 | fil_io(OS_FILE_WRITE | OS_FILE_LOG, TRUE, group->archive_space_id, |
1830 | @@ -1907,7 +1563,7 @@ |
1831 | dest_offset / UNIV_PAGE_SIZE, |
1832 | dest_offset % UNIV_PAGE_SIZE, |
1833 | OS_FILE_LOG_BLOCK_SIZE, |
1834 | -@@ -2379,7 +2437,7 @@ |
1835 | +@@ -2376,7 +2441,7 @@ |
1836 | open_mode = OS_FILE_OPEN; |
1837 | } |
1838 | |
1839 | @@ -1916,7 +1572,7 @@ |
1840 | group->archived_file_no + n_files); |
1841 | |
1842 | file_handle = os_file_create(innodb_file_log_key, |
1843 | -@@ -2454,6 +2512,7 @@ |
1844 | +@@ -2451,6 +2516,7 @@ |
1845 | MONITOR_INC(MONITOR_LOG_IO); |
1846 | |
1847 | fil_io(OS_FILE_WRITE | OS_FILE_LOG, FALSE, group->archive_space_id, |
1848 | @@ -1924,7 +1580,7 @@ |
1849 | (ulint) (next_offset / UNIV_PAGE_SIZE), |
1850 | (ulint) (next_offset % UNIV_PAGE_SIZE), |
1851 | ut_calc_align(len, OS_FILE_LOG_BLOCK_SIZE), buf, |
1852 | -@@ -2825,7 +2884,6 @@ |
1853 | +@@ -2822,7 +2888,6 @@ |
1854 | trunc_len); |
1855 | if (increment_file_count) { |
1856 | group->archived_offset = 0; |
1857 | @@ -1932,7 +1588,7 @@ |
1858 | } |
1859 | |
1860 | #ifdef UNIV_DEBUG |
1861 | -@@ -3090,7 +3148,6 @@ |
1862 | +@@ -3087,7 +3152,6 @@ |
1863 | /*=======================================*/ |
1864 | { |
1865 | lsn_t lsn; |
1866 | @@ -1940,7 +1596,7 @@ |
1867 | ulint count = 0; |
1868 | ulint total_trx; |
1869 | ulint pending_io; |
1870 | -@@ -3307,15 +3364,7 @@ |
1871 | +@@ -3304,15 +3368,7 @@ |
1872 | goto loop; |
1873 | } |
1874 | |
1875 | @@ -1956,7 +1612,7 @@ |
1876 | |
1877 | log_archive_close_groups(TRUE); |
1878 | #endif /* UNIV_LOG_ARCHIVE */ |
1879 | -@@ -3374,7 +3423,16 @@ |
1880 | +@@ -3371,7 +3427,16 @@ |
1881 | srv_shutdown_lsn = lsn; |
1882 | |
1883 | if (!srv_read_only_mode) { |
1884 | @@ -1974,7 +1630,7 @@ |
1885 | |
1886 | fil_flush_file_spaces(FIL_TABLESPACE); |
1887 | } |
1888 | -@@ -3597,7 +3655,7 @@ |
1889 | +@@ -3594,7 +3659,7 @@ |
1890 | |
1891 | #ifdef UNIV_LOG_ARCHIVE |
1892 | rw_lock_free(&log_sys->archive_lock); |
1893 | @@ -1983,24 +1639,217 @@ |
1894 | #endif /* UNIV_LOG_ARCHIVE */ |
1895 | |
1896 | #ifdef UNIV_LOG_DEBUG |
1897 | - |
1898 | --- a/storage/innobase/log/log0recv.cc |
1899 | +++ b/storage/innobase/log/log0recv.cc |
1900 | -@@ -53,6 +53,13 @@ |
1901 | - //#else /* !UNIV_HOTBACKUP */ |
1902 | - #include "xb0xb.h" |
1903 | - |
1904 | +@@ -43,20 +43,28 @@ |
1905 | + #include "trx0undo.h" |
1906 | + #include "trx0rec.h" |
1907 | + #include "fil0fil.h" |
1908 | +-#ifndef UNIV_HOTBACKUP |
1909 | ++//#ifndef UNIV_HOTBACKUP |
1910 | + # include "buf0rea.h" |
1911 | + # include "srv0srv.h" |
1912 | + # include "srv0start.h" |
1913 | + # include "trx0roll.h" |
1914 | + # include "row0merge.h" |
1915 | + # include "sync0sync.h" |
1916 | +-#else /* !UNIV_HOTBACKUP */ |
1917 | ++//#else /* !UNIV_HOTBACKUP */ |
1918 | ++#include "xb0xb.h" |
1919 | ++ |
1920 | +/** The size of archived log file */ |
1921 | +extern ib_uint64_t xtrabackup_arch_file_size; |
1922 | +/** The minimal LSN of found archived log files */ |
1923 | +extern ib_uint64_t xtrabackup_arch_first_file_lsn; |
1924 | +/** The maximum LSN of found archived log files */ |
1925 | +extern ib_uint64_t xtrabackup_arch_last_file_lsn; |
1926 | -+ |
1927 | + |
1928 | /** This is set to FALSE if the backup was originally taken with the |
1929 | ibbackup --include regexp option: then we do not want to create tables in |
1930 | directories which were not included */ |
1931 | -@@ -2866,7 +2873,10 @@ |
1932 | + UNIV_INTERN ibool recv_replay_file_ops = TRUE; |
1933 | +-#endif /* !UNIV_HOTBACKUP */ |
1934 | ++//#endif /* !UNIV_HOTBACKUP */ |
1935 | + |
1936 | + /** Log records are stored in the hash table in chunks at most of this size; |
1937 | + this must be less than UNIV_PAGE_SIZE as it is stored in the buffer pool */ |
1938 | +@@ -399,7 +407,7 @@ |
1939 | + /* Set appropriate value of recv_n_pool_free_frames. */ |
1940 | + if (buf_pool_get_curr_size() >= (10 * 1024 * 1024)) { |
1941 | + /* Buffer pool of size greater than 10 MB. */ |
1942 | +- recv_n_pool_free_frames = 512; |
1943 | ++ recv_n_pool_free_frames = 1024; |
1944 | + } |
1945 | + |
1946 | + recv_sys->buf = static_cast<byte*>(ut_malloc(RECV_PARSING_BUF_SIZE)); |
1947 | +@@ -703,7 +711,7 @@ |
1948 | + /***********************************************************************//** |
1949 | + Checks the consistency of the checkpoint info |
1950 | + @return TRUE if ok */ |
1951 | +-static |
1952 | ++UNIV_INTERN |
1953 | + ibool |
1954 | + recv_check_cp_is_consistent( |
1955 | + /*========================*/ |
1956 | +@@ -733,7 +741,7 @@ |
1957 | + /********************************************************//** |
1958 | + Looks for the maximum consistent checkpoint from the log groups. |
1959 | + @return error code or DB_SUCCESS */ |
1960 | +-static __attribute__((nonnull, warn_unused_result)) |
1961 | ++UNIV_INTERN __attribute__((nonnull, warn_unused_result)) |
1962 | + dberr_t |
1963 | + recv_find_max_checkpoint( |
1964 | + /*=====================*/ |
1965 | +@@ -893,7 +901,7 @@ |
1966 | + InnoDB-3.23.52 where the checksum field contains the log block number. |
1967 | + @return TRUE if ok, or if the log block may be in the format of InnoDB |
1968 | + version predating 3.23.52 */ |
1969 | +-static |
1970 | ++UNIV_INTERN |
1971 | + ibool |
1972 | + log_block_checksum_is_ok_or_old_format( |
1973 | + /*===================================*/ |
1974 | +@@ -902,12 +910,72 @@ |
1975 | + #ifdef UNIV_LOG_DEBUG |
1976 | + return(TRUE); |
1977 | + #endif /* UNIV_LOG_DEBUG */ |
1978 | +- if (log_block_calc_checksum(block) == log_block_get_checksum(block)) { |
1979 | ++ |
1980 | ++ ulint block_checksum = log_block_get_checksum(block); |
1981 | ++ |
1982 | ++ if (UNIV_LIKELY(srv_log_checksum_algorithm == |
1983 | ++ SRV_CHECKSUM_ALGORITHM_NONE || |
1984 | ++ log_block_calc_checksum(block) == block_checksum)) { |
1985 | ++ |
1986 | ++ return(TRUE); |
1987 | ++ } |
1988 | ++ |
1989 | ++ if (srv_log_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_STRICT_CRC32 || |
1990 | ++ srv_log_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_STRICT_INNODB || |
1991 | ++ srv_log_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_STRICT_NONE) { |
1992 | ++ |
1993 | ++ const char* algo = NULL; |
1994 | ++ |
1995 | ++ ib_logf(IB_LOG_LEVEL_ERROR, |
1996 | ++ "log block checksum mismatch: expected " ULINTPF ", " |
1997 | ++ "calculated checksum " ULINTPF, |
1998 | ++ block_checksum, |
1999 | ++ log_block_calc_checksum(block)); |
2000 | ++ |
2001 | ++ if (block_checksum == LOG_NO_CHECKSUM_MAGIC) { |
2002 | ++ |
2003 | ++ algo = "none"; |
2004 | ++ } else if (block_checksum == |
2005 | ++ log_block_calc_checksum_crc32(block)) { |
2006 | ++ |
2007 | ++ algo = "crc32"; |
2008 | ++ } else if (block_checksum == |
2009 | ++ log_block_calc_checksum_innodb(block)) { |
2010 | ++ |
2011 | ++ algo = "innodb"; |
2012 | ++ } |
2013 | ++ |
2014 | ++ if (algo) { |
2015 | ++ |
2016 | ++ const char* current_algo; |
2017 | ++ |
2018 | ++ current_algo = buf_checksum_algorithm_name( |
2019 | ++ (srv_checksum_algorithm_t) |
2020 | ++ srv_log_checksum_algorithm); |
2021 | ++ |
2022 | ++ ib_logf(IB_LOG_LEVEL_ERROR, |
2023 | ++ "current InnoDB log checksum type: %s, " |
2024 | ++ "detected log checksum type: %s", |
2025 | ++ current_algo, |
2026 | ++ algo); |
2027 | ++ } |
2028 | ++ |
2029 | ++ ib_logf(IB_LOG_LEVEL_FATAL, |
2030 | ++ "STRICT method was specified for innodb_log_checksum, " |
2031 | ++ "so we intentionally assert here."); |
2032 | ++ } |
2033 | ++ |
2034 | ++ ut_ad(srv_log_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_CRC32 || |
2035 | ++ srv_log_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_INNODB); |
2036 | ++ |
2037 | ++ if (block_checksum == LOG_NO_CHECKSUM_MAGIC || |
2038 | ++ block_checksum == log_block_calc_checksum_crc32(block) || |
2039 | ++ block_checksum == log_block_calc_checksum_innodb(block)) { |
2040 | + |
2041 | + return(TRUE); |
2042 | + } |
2043 | + |
2044 | +- if (log_block_get_hdr_no(block) == log_block_get_checksum(block)) { |
2045 | ++ if (log_block_get_hdr_no(block) == block_checksum) { |
2046 | + |
2047 | + /* We assume the log block is in the format of |
2048 | + InnoDB version < 3.23.52 and the block is ok */ |
2049 | +@@ -1588,6 +1656,8 @@ |
2050 | + buf_block_get_page_no(block)); |
2051 | + |
2052 | + if ((recv_addr == NULL) |
2053 | ++ /* Fix for http://bugs.mysql.com/bug.php?id=44140 */ |
2054 | ++ || (recv_addr->state == RECV_BEING_READ && !just_read_in) |
2055 | + || (recv_addr->state == RECV_BEING_PROCESSED) |
2056 | + || (recv_addr->state == RECV_PROCESSED)) { |
2057 | + |
2058 | +@@ -1677,9 +1747,17 @@ |
2059 | + if (page_zip) { |
2060 | + memset(FIL_PAGE_LSN + page_zip->data, 0, 8); |
2061 | + } |
2062 | ++ |
2063 | ++ if (!block->page.is_compacted |
2064 | ++ && block->page.is_compacted) { |
2065 | ++ |
2066 | ++ ut_ad(srv_compact_backup); |
2067 | ++ |
2068 | ++ block->page.is_compacted = FALSE; |
2069 | ++ } |
2070 | + } |
2071 | + |
2072 | +- if (recv->start_lsn >= page_lsn) { |
2073 | ++ if (!block->page.is_compacted && recv->start_lsn >= page_lsn) { |
2074 | + |
2075 | + lsn_t end_lsn; |
2076 | + |
2077 | +@@ -1868,6 +1946,18 @@ |
2078 | + ulint zip_size = fil_space_get_zip_size(space); |
2079 | + ulint page_no = recv_addr->page_no; |
2080 | + |
2081 | ++ /* By now we have replayed all DDL log records from the |
2082 | ++ current batch. Check if the space ID is still valid in |
2083 | ++ the entry being processed, and ignore it if it is not.*/ |
2084 | ++ if (fil_tablespace_deleted_or_being_deleted_in_mem(space, -1)) { |
2085 | ++ |
2086 | ++ ut_a(recv_sys->n_addrs); |
2087 | ++ |
2088 | ++ recv_addr->state = RECV_PROCESSED; |
2089 | ++ recv_sys->n_addrs--; |
2090 | ++ |
2091 | ++ continue; |
2092 | ++ } |
2093 | + if (recv_addr->state == RECV_NOT_PROCESSED) { |
2094 | + if (!has_printed) { |
2095 | + ib_logf(IB_LOG_LEVEL_INFO, |
2096 | +@@ -2413,7 +2503,7 @@ |
2097 | + || type == MLOG_FILE_RENAME |
2098 | + || type == MLOG_FILE_DELETE) { |
2099 | + ut_a(space); |
2100 | +-#ifdef UNIV_HOTBACKUP |
2101 | ++//#ifdef UNIV_HOTBACKUP |
2102 | + if (recv_replay_file_ops) { |
2103 | + |
2104 | + /* In ibbackup --apply-log, replay an .ibd file |
2105 | +@@ -2436,7 +2526,7 @@ |
2106 | + ut_error; |
2107 | + } |
2108 | + } |
2109 | +-#endif |
2110 | ++//#endif |
2111 | + /* In normal mysqld crash recovery we do not try to |
2112 | + replay file operations */ |
2113 | + #ifdef UNIV_LOG_LSN_DEBUG |
2114 | +@@ -2843,7 +2933,10 @@ |
2115 | = log_block_get_checkpoint_no(log_block); |
2116 | } |
2117 | |
2118 | @@ -2012,7 +1861,60 @@ |
2119 | /* Log data for this group ends here */ |
2120 | |
2121 | finished = TRUE; |
2122 | -@@ -3157,10 +3167,14 @@ |
2123 | +@@ -2863,8 +2956,14 @@ |
2124 | + |
2125 | + fprintf(stderr, |
2126 | + "InnoDB: Doing recovery: scanned up to" |
2127 | +- " log sequence number " LSN_PF "\n", |
2128 | +- *group_scanned_lsn); |
2129 | ++ " log sequence number " LSN_PF " (%lu%%)\n", |
2130 | ++ *group_scanned_lsn, |
2131 | ++ (ulong) ((*group_scanned_lsn |
2132 | ++ - recv_sys->parse_start_lsn) |
2133 | ++ / (8 * log_group_get_capacity( |
2134 | ++ UT_LIST_GET_FIRST( |
2135 | ++ log_sys->log_groups)) |
2136 | ++ / 900))); |
2137 | + } |
2138 | + } |
2139 | + |
2140 | +@@ -2964,7 +3063,7 @@ |
2141 | + ib_logf(IB_LOG_LEVEL_INFO, |
2142 | + "Reading tablespace information from the .ibd files..."); |
2143 | + |
2144 | +- fil_load_single_table_tablespaces(); |
2145 | ++ fil_load_single_table_tablespaces(NULL); |
2146 | + |
2147 | + /* If we are using the doublewrite method, we will |
2148 | + check if there are half-written pages in data files, |
2149 | +@@ -3003,6 +3102,7 @@ |
2150 | + log_group_t* group; |
2151 | + log_group_t* max_cp_group; |
2152 | + ulint max_cp_field; |
2153 | ++ ulint log_hdr_log_block_size; |
2154 | + lsn_t checkpoint_lsn; |
2155 | + ib_uint64_t checkpoint_no; |
2156 | + lsn_t group_scanned_lsn = 0; |
2157 | +@@ -3108,14 +3208,33 @@ |
2158 | + log_hdr_buf, max_cp_group); |
2159 | + } |
2160 | + |
2161 | ++ log_hdr_log_block_size |
2162 | ++ = mach_read_from_4(log_hdr_buf + LOG_FILE_OS_FILE_LOG_BLOCK_SIZE); |
2163 | ++ if (log_hdr_log_block_size == 0) { |
2164 | ++ /* 0 means default value */ |
2165 | ++ log_hdr_log_block_size = 512; |
2166 | ++ } |
2167 | ++ if (UNIV_UNLIKELY(log_hdr_log_block_size != srv_log_block_size)) { |
2168 | ++ fprintf(stderr, |
2169 | ++ "InnoDB: Error: The block size of ib_logfile (" ULINTPF |
2170 | ++ ") is not equal to innodb_log_block_size.\n" |
2171 | ++ "InnoDB: Error: Suggestion - Recreate log files.\n", |
2172 | ++ log_hdr_log_block_size); |
2173 | ++ return(DB_ERROR); |
2174 | ++ } |
2175 | ++ |
2176 | + #ifdef UNIV_LOG_ARCHIVE |
2177 | group = UT_LIST_GET_FIRST(log_sys->log_groups); |
2178 | |
2179 | while (group) { |
2180 | @@ -2028,7 +1930,17 @@ |
2181 | group = UT_LIST_GET_NEXT(log_groups, group); |
2182 | } |
2183 | #endif /* UNIV_LOG_ARCHIVE */ |
2184 | -@@ -3731,23 +3745,23 @@ |
2185 | +@@ -3456,7 +3575,8 @@ |
2186 | + that the data dictionary tables will be free of any locks. |
2187 | + The data dictionary latch should guarantee that there is at |
2188 | + most one data dictionary transaction active at a time. */ |
2189 | +- if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO) { |
2190 | ++ if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO |
2191 | ++ && !srv_apply_log_only) { |
2192 | + trx_rollback_or_clean_recovered(FALSE); |
2193 | + } |
2194 | + } |
2195 | +@@ -3685,23 +3805,23 @@ |
2196 | ulint len; |
2197 | ibool ret; |
2198 | byte* buf; |
2199 | @@ -2057,7 +1969,7 @@ |
2200 | |
2201 | if (ret == FALSE) { |
2202 | ask_again: |
2203 | -@@ -3792,20 +3806,19 @@ |
2204 | +@@ -3746,20 +3866,19 @@ |
2205 | |
2206 | /* Add the archive file as a node to the space */ |
2207 | |
2208 | @@ -2084,7 +1996,7 @@ |
2209 | != group->archived_file_no) { |
2210 | fprintf(stderr, |
2211 | "InnoDB: Archive file header inconsistent %s\n", name); |
2212 | -@@ -3834,6 +3847,20 @@ |
2213 | +@@ -3788,6 +3907,20 @@ |
2214 | return(TRUE); |
2215 | } |
2216 | |
2217 | @@ -2105,7 +2017,7 @@ |
2218 | recv_sys->scanned_lsn = start_lsn; |
2219 | } |
2220 | |
2221 | -@@ -3846,7 +3873,7 @@ |
2222 | +@@ -3800,7 +3933,7 @@ |
2223 | return(TRUE); |
2224 | } |
2225 | |
2226 | @@ -2114,7 +2026,7 @@ |
2227 | |
2228 | for (;;) { |
2229 | len = RECV_SCAN_SIZE; |
2230 | -@@ -3872,7 +3899,7 @@ |
2231 | +@@ -3826,7 +3959,7 @@ |
2232 | #endif /* UNIV_DEBUG */ |
2233 | |
2234 | fil_io(OS_FILE_READ | OS_FILE_LOG, TRUE, |
2235 | @@ -2123,7 +2035,7 @@ |
2236 | read_offset % UNIV_PAGE_SIZE, len, buf, NULL); |
2237 | |
2238 | ret = recv_scan_log_recs( |
2239 | -@@ -3887,10 +3914,12 @@ |
2240 | +@@ -3841,10 +3974,12 @@ |
2241 | } |
2242 | |
2243 | if (ret) { |
2244 | @@ -2140,7 +2052,7 @@ |
2245 | return(TRUE); |
2246 | } |
2247 | |
2248 | -@@ -3907,26 +3936,19 @@ |
2249 | +@@ -3861,26 +3996,19 @@ |
2250 | Recovers from archived log files, and also from log files, if they exist. |
2251 | @return error code or DB_SUCCESS */ |
2252 | UNIV_INTERN |
2253 | @@ -2170,7 +2082,7 @@ |
2254 | |
2255 | recv_sys_create(); |
2256 | recv_sys_init(buf_pool_get_curr_size()); |
2257 | -@@ -3956,7 +3978,7 @@ |
2258 | +@@ -3910,7 +4038,7 @@ |
2259 | return(DB_ERROR); |
2260 | } |
2261 | |
2262 | @@ -2179,7 +2091,7 @@ |
2263 | |
2264 | recv_sys->parse_start_lsn = min_flushed_lsn; |
2265 | |
2266 | -@@ -3970,7 +3992,8 @@ |
2267 | +@@ -3924,7 +4052,8 @@ |
2268 | |
2269 | mutex_enter(&(log_sys->mutex)); |
2270 | |
2271 | @@ -2189,7 +2101,7 @@ |
2272 | ret = log_group_recover_from_archive_file(group); |
2273 | |
2274 | /* Close and truncate a possible processed archive file |
2275 | -@@ -3983,9 +4006,9 @@ |
2276 | +@@ -3937,9 +4066,9 @@ |
2277 | trunc_len); |
2278 | } |
2279 | |
2280 | @@ -2201,7 +2113,7 @@ |
2281 | if (recv_sys->recovered_lsn < limit_lsn) { |
2282 | |
2283 | if (!recv_sys->scanned_lsn) { |
2284 | -@@ -4006,12 +4029,12 @@ |
2285 | +@@ -3960,12 +4089,12 @@ |
2286 | |
2287 | mutex_enter(&(log_sys->mutex)); |
2288 | } |
2289 | @@ -2216,10 +2128,130 @@ |
2290 | } |
2291 | |
2292 | mutex_exit(&(log_sys->mutex)); |
2293 | - |
2294 | +--- a/storage/innobase/mem/mem0dbg.cc |
2295 | ++++ b/storage/innobase/mem/mem0dbg.cc |
2296 | +@@ -278,18 +278,10 @@ |
2297 | + byte* buf, /*!< in: pointer to buffer */ |
2298 | + ulint n) /*!< in: length of buffer */ |
2299 | + { |
2300 | +- byte* ptr; |
2301 | +- |
2302 | + UNIV_MEM_ASSERT_W(buf, n); |
2303 | + |
2304 | +- for (ptr = buf; ptr < buf + n; ptr++) { |
2305 | +- |
2306 | +- if (ut_rnd_gen_ibool()) { |
2307 | +- *ptr = 0xBA; |
2308 | +- } else { |
2309 | +- *ptr = 0xBE; |
2310 | +- } |
2311 | +- } |
2312 | ++ /* Fix https://bugs.launchpad.net/percona-xtrabackup/+bug/1158154 */ |
2313 | ++ memset(buf, 0xBA, n); |
2314 | + |
2315 | + UNIV_MEM_INVALID(buf, n); |
2316 | + } |
2317 | +@@ -304,17 +296,10 @@ |
2318 | + byte* buf, /*!< in: pointer to buffer */ |
2319 | + ulint n) /*!< in: length of buffer */ |
2320 | + { |
2321 | +- byte* ptr; |
2322 | +- |
2323 | + UNIV_MEM_ASSERT_W(buf, n); |
2324 | + |
2325 | +- for (ptr = buf; ptr < buf + n; ptr++) { |
2326 | +- if (ut_rnd_gen_ibool()) { |
2327 | +- *ptr = 0xDE; |
2328 | +- } else { |
2329 | +- *ptr = 0xAD; |
2330 | +- } |
2331 | +- } |
2332 | ++ /* Fix https://bugs.launchpad.net/percona-xtrabackup/+bug/1158154 */ |
2333 | ++ memset(buf, 0xDE, n); |
2334 | + |
2335 | + UNIV_MEM_FREE(buf, n); |
2336 | + } |
2337 | +--- a/storage/innobase/os/os0file.cc |
2338 | ++++ b/storage/innobase/os/os0file.cc |
2339 | +@@ -699,7 +699,7 @@ |
2340 | + } |
2341 | + |
2342 | + #undef USE_FILE_LOCK |
2343 | +-#define USE_FILE_LOCK |
2344 | ++//#define USE_FILE_LOCK |
2345 | + #if defined(UNIV_HOTBACKUP) || defined(__WIN__) |
2346 | + /* InnoDB Hot Backup does not lock the data files. |
2347 | + * On Windows, mandatory locking is used. |
2348 | +--- a/storage/innobase/page/page0cur.cc |
2349 | ++++ b/storage/innobase/page/page0cur.cc |
2350 | +@@ -1207,7 +1207,9 @@ |
2351 | + == index->id || mtr->inside_ibuf || recv_recovery_is_on()); |
2352 | + |
2353 | + ut_ad(!page_cur_is_after_last(cursor)); |
2354 | +-#ifdef UNIV_ZIP_DEBUG |
2355 | ++#if 0 |
2356 | ++ /* Disabled to speedup compact_compressed test for debug XtraBackup |
2357 | ++ builds, see LP bug #1213036. */ |
2358 | + ut_a(page_zip_validate(page_zip, page, index)); |
2359 | + #endif /* UNIV_ZIP_DEBUG */ |
2360 | + |
2361 | +--- a/storage/innobase/srv/srv0srv.cc |
2362 | ++++ b/storage/innobase/srv/srv0srv.cc |
2363 | +@@ -239,6 +239,10 @@ |
2364 | + |
2365 | + /* Switch to enable random read ahead. */ |
2366 | + UNIV_INTERN my_bool srv_random_read_ahead = FALSE; |
2367 | ++ |
2368 | ++/* The log block size */ |
2369 | ++UNIV_INTERN ulint srv_log_block_size = 0; |
2370 | ++ |
2371 | + /* User settable value of the number of pages that must be present |
2372 | + in the buffer cache and accessed sequentially for InnoDB to trigger a |
2373 | + readahead request. */ |
2374 | +@@ -349,6 +353,13 @@ |
2375 | + |
2376 | + UNIV_INTERN ulong srv_replication_delay = 0; |
2377 | + |
2378 | ++UNIV_INTERN ibool srv_apply_log_only = FALSE; |
2379 | ++ |
2380 | ++UNIV_INTERN ibool srv_backup_mode = FALSE; |
2381 | ++ |
2382 | ++UNIV_INTERN ulint srv_log_checksum_algorithm = |
2383 | ++ SRV_CHECKSUM_ALGORITHM_INNODB; |
2384 | ++ |
2385 | + /*-------------------------------------------*/ |
2386 | + UNIV_INTERN ulong srv_n_spin_wait_rounds = 30; |
2387 | + UNIV_INTERN ulong srv_spin_wait_delay = 6; |
2388 | +@@ -1814,7 +1825,8 @@ |
2389 | + if (ret == SRV_NONE |
2390 | + && srv_shutdown_state != SRV_SHUTDOWN_NONE |
2391 | + && trx_purge_state() != PURGE_STATE_DISABLED |
2392 | +- && trx_purge_state() != PURGE_STATE_EXIT) { |
2393 | ++ && trx_purge_state() != PURGE_STATE_EXIT |
2394 | ++ && trx_purge_state() != PURGE_STATE_INIT) { |
2395 | + |
2396 | + ret = SRV_PURGE; |
2397 | + } |
2398 | --- a/storage/innobase/srv/srv0start.cc |
2399 | +++ b/storage/innobase/srv/srv0start.cc |
2400 | -@@ -641,6 +641,12 @@ |
2401 | +@@ -63,6 +63,7 @@ |
2402 | + #include "ibuf0ibuf.h" |
2403 | + #include "srv0start.h" |
2404 | + #include "srv0srv.h" |
2405 | ++#include "xb0xb.h" |
2406 | + #ifndef UNIV_HOTBACKUP |
2407 | + # include "trx0rseg.h" |
2408 | + # include "os0proc.h" |
2409 | +@@ -121,7 +122,7 @@ |
2410 | + UNIV_INTERN enum srv_shutdown_state srv_shutdown_state = SRV_SHUTDOWN_NONE; |
2411 | + |
2412 | + /** Files comprising the system tablespace */ |
2413 | +-static os_file_t files[1000]; |
2414 | ++os_file_t files[1000]; |
2415 | + |
2416 | + /** io_handler_thread parameters for thread identification */ |
2417 | + static ulint n[SRV_MAX_N_IO_THREADS + 6]; |
2418 | +@@ -640,6 +641,12 @@ |
2419 | } |
2420 | } |
2421 | |
2422 | @@ -2232,7 +2264,7 @@ |
2423 | log_group_init(0, srv_n_log_files, |
2424 | srv_log_file_size * UNIV_PAGE_SIZE, |
2425 | SRV_LOG_SPACE_FIRST_ID, |
2426 | -@@ -651,7 +657,12 @@ |
2427 | +@@ -650,7 +657,12 @@ |
2428 | /* Create a log checkpoint. */ |
2429 | mutex_enter(&log_sys->mutex); |
2430 | ut_d(recv_no_log_write = FALSE); |
2431 | @@ -2246,7 +2278,14 @@ |
2432 | mutex_exit(&log_sys->mutex); |
2433 | |
2434 | return(DB_SUCCESS); |
2435 | -@@ -738,12 +749,6 @@ |
2436 | +@@ -731,18 +743,12 @@ |
2437 | + /*********************************************************************//** |
2438 | + Creates or opens database data files and closes them. |
2439 | + @return DB_SUCCESS or error code */ |
2440 | +-static __attribute__((nonnull, warn_unused_result)) |
2441 | ++UNIV_INTERN __attribute__((nonnull, warn_unused_result)) |
2442 | + dberr_t |
2443 | + open_or_create_data_files( |
2444 | /*======================*/ |
2445 | ibool* create_new_db, /*!< out: TRUE if new database should be |
2446 | created */ |
2447 | @@ -2259,7 +2298,7 @@ |
2448 | lsn_t* min_flushed_lsn,/*!< out: min of flushed lsn |
2449 | values in data files */ |
2450 | lsn_t* max_flushed_lsn,/*!< out: max of flushed lsn |
2451 | -@@ -964,9 +969,6 @@ |
2452 | +@@ -963,9 +969,6 @@ |
2453 | skip_size_check: |
2454 | fil_read_first_page( |
2455 | files[i], one_opened, &flags, &space, |
2456 | @@ -2269,7 +2308,60 @@ |
2457 | min_flushed_lsn, max_flushed_lsn); |
2458 | |
2459 | /* The first file of the system tablespace must |
2460 | -@@ -1450,8 +1452,8 @@ |
2461 | +@@ -1204,12 +1207,16 @@ |
2462 | + /******************************************************************** |
2463 | + Opens the configured number of undo tablespaces. |
2464 | + @return DB_SUCCESS or error code */ |
2465 | +-static |
2466 | ++UNIV_INTERN |
2467 | + dberr_t |
2468 | + srv_undo_tablespaces_init( |
2469 | + /*======================*/ |
2470 | + ibool create_new_db, /*!< in: TRUE if new db being |
2471 | + created */ |
2472 | ++ ibool backup_mode, /*!< in: TRUE disables reading |
2473 | ++ the system tablespace (used in |
2474 | ++ XtraBackup), FALSE is passed on |
2475 | ++ recovery. */ |
2476 | + const ulint n_conf_tablespaces, /*!< in: configured undo |
2477 | + tablespaces */ |
2478 | + ulint* n_opened) /*!< out: number of UNDO |
2479 | +@@ -1225,6 +1232,7 @@ |
2480 | + *n_opened = 0; |
2481 | + |
2482 | + ut_a(n_conf_tablespaces <= TRX_SYS_N_RSEGS); |
2483 | ++ ut_a(!create_new_db || !backup_mode); |
2484 | + |
2485 | + memset(undo_tablespace_ids, 0x0, sizeof(undo_tablespace_ids)); |
2486 | + |
2487 | +@@ -1258,12 +1266,13 @@ |
2488 | + } |
2489 | + } |
2490 | + |
2491 | +- /* Get the tablespace ids of all the undo segments excluding |
2492 | +- the system tablespace (0). If we are creating a new instance then |
2493 | ++ /* Get the tablespace ids of all the undo segments excluding the system |
2494 | ++ tablespace (0). If we are creating a new instance then |
2495 | + we build the undo_tablespace_ids ourselves since they don't |
2496 | +- already exist. */ |
2497 | ++ already exist. If we are in the backup mode, don't read the trx header, |
2498 | ++ we just need to add all available undo tablespaces to fil_system. */ |
2499 | + |
2500 | +- if (!create_new_db) { |
2501 | ++ if (!create_new_db && !backup_mode) { |
2502 | + n_undo_tablespaces = trx_rseg_get_n_undo_tablespaces( |
2503 | + undo_tablespace_ids); |
2504 | + } else { |
2505 | +@@ -1369,7 +1378,7 @@ |
2506 | + ib_logf(IB_LOG_LEVEL_INFO, "Opened %lu undo tablespaces", |
2507 | + n_undo_tablespaces); |
2508 | + |
2509 | +- if (n_conf_tablespaces == 0) { |
2510 | ++ if (n_conf_tablespaces == 0 && !backup_mode) { |
2511 | + ib_logf(IB_LOG_LEVEL_WARN, |
2512 | + "Using the system tablespace for all UNDO " |
2513 | + "logging because innodb_undo_tablespaces=0"); |
2514 | +@@ -1443,8 +1452,8 @@ |
2515 | lsn_t min_flushed_lsn; |
2516 | lsn_t max_flushed_lsn; |
2517 | #ifdef UNIV_LOG_ARCHIVE |
2518 | @@ -2280,7 +2372,7 @@ |
2519 | #endif /* UNIV_LOG_ARCHIVE */ |
2520 | ulint sum_of_new_sizes; |
2521 | ulint sum_of_data_file_sizes; |
2522 | -@@ -1890,17 +1892,6 @@ |
2523 | +@@ -1883,17 +1892,6 @@ |
2524 | os_thread_create(io_handler_thread, n + i, thread_ids + i); |
2525 | } |
2526 | |
2527 | @@ -2298,7 +2390,7 @@ |
2528 | if (srv_n_log_files * srv_log_file_size * UNIV_PAGE_SIZE |
2529 | >= 512ULL * 1024ULL * 1024ULL * 1024ULL) { |
2530 | /* log_block_convert_lsn_to_no() limits the returned block |
2531 | -@@ -1959,9 +1950,6 @@ |
2532 | +@@ -1952,9 +1950,6 @@ |
2533 | } |
2534 | |
2535 | err = open_or_create_data_files(&create_new_db, |
2536 | @@ -2308,7 +2400,7 @@ |
2537 | &min_flushed_lsn, &max_flushed_lsn, |
2538 | &sum_of_new_sizes); |
2539 | if (err == DB_FAIL) { |
2540 | -@@ -1989,7 +1977,6 @@ |
2541 | +@@ -1982,7 +1977,6 @@ |
2542 | |
2543 | #ifdef UNIV_LOG_ARCHIVE |
2544 | srv_normalize_path_for_win(srv_arch_dir); |
2545 | @@ -2316,7 +2408,7 @@ |
2546 | #endif /* UNIV_LOG_ARCHIVE */ |
2547 | |
2548 | dirnamelen = strlen(srv_log_group_home_dir); |
2549 | -@@ -2068,9 +2055,15 @@ |
2550 | +@@ -2061,15 +2055,23 @@ |
2551 | max_flushed_lsn, logfile0); |
2552 | |
2553 | /* Suppress the message about |
2554 | @@ -2333,9 +2425,25 @@ |
2555 | + } |
2556 | + |
2557 | goto files_checked; |
2558 | - #if 0 |
2559 | ++#if 0 |
2560 | } else if (i < 2) { |
2561 | -@@ -2244,10 +2237,13 @@ |
2562 | + /* must have at least 2 log files */ |
2563 | + ib_logf(IB_LOG_LEVEL_ERROR, |
2564 | + "Only one log file found."); |
2565 | + return(err); |
2566 | ++#endif |
2567 | + } |
2568 | + |
2569 | + /* opened all files */ |
2570 | +@@ -2162,6 +2164,7 @@ |
2571 | + |
2572 | + err = srv_undo_tablespaces_init( |
2573 | + create_new_db, |
2574 | ++ FALSE, |
2575 | + srv_undo_tablespaces, |
2576 | + &srv_undo_tablespaces_open); |
2577 | + |
2578 | +@@ -2234,10 +2237,13 @@ |
2579 | |
2580 | ib_logf(IB_LOG_LEVEL_INFO, |
2581 | " Starting archive recovery from a backup..."); |
2582 | @@ -2351,7 +2459,7 @@ |
2583 | if (err != DB_SUCCESS) { |
2584 | |
2585 | return(DB_ERROR); |
2586 | -@@ -2271,6 +2267,11 @@ |
2587 | +@@ -2261,6 +2267,11 @@ |
2588 | srv_startup_is_before_trx_rollback_phase = FALSE; |
2589 | |
2590 | recv_recovery_from_archive_finish(); |
2591 | @@ -2363,7 +2471,29 @@ |
2592 | #endif /* UNIV_LOG_ARCHIVE */ |
2593 | } else { |
2594 | |
2595 | -@@ -2478,6 +2479,8 @@ |
2596 | +@@ -2326,6 +2337,10 @@ |
2597 | + |
2598 | + recv_recovery_from_checkpoint_finish(); |
2599 | + |
2600 | ++ if (srv_apply_log_only) { |
2601 | ++ goto skip_processes; |
2602 | ++ } |
2603 | ++ |
2604 | + if (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) { |
2605 | + /* The following call is necessary for the insert |
2606 | + buffer to work with multiple tablespaces. We must |
2607 | +@@ -2439,7 +2454,9 @@ |
2608 | + value. Important to note that we can do it ONLY after |
2609 | + we have finished the recovery process so that the |
2610 | + image of TRX_SYS_PAGE_NO is not stale. */ |
2611 | +- trx_sys_file_format_tag_init(); |
2612 | ++ if (!srv_read_only_mode) { |
2613 | ++ trx_sys_file_format_tag_init(); |
2614 | ++ } |
2615 | + } |
2616 | + |
2617 | + if (!create_new_db && sum_of_new_sizes > 0) { |
2618 | +@@ -2462,6 +2479,8 @@ |
2619 | if (!srv_log_archive_on) { |
2620 | ut_a(DB_SUCCESS == log_archive_noarchivelog()); |
2621 | } else { |
2622 | @@ -2372,10 +2502,91 @@ |
2623 | mutex_enter(&(log_sys->mutex)); |
2624 | |
2625 | start_archive = FALSE; |
2626 | - |
2627 | +@@ -2647,6 +2666,7 @@ |
2628 | + && srv_auto_extend_last_data_file |
2629 | + && sum_of_data_file_sizes < tablespace_size_in_header) { |
2630 | + |
2631 | ++#ifdef UNDEFINED |
2632 | + ut_print_timestamp(stderr); |
2633 | + fprintf(stderr, |
2634 | + " InnoDB: Error: tablespace size stored in header" |
2635 | +@@ -2683,6 +2703,7 @@ |
2636 | + |
2637 | + return(DB_ERROR); |
2638 | + } |
2639 | ++#endif |
2640 | + } |
2641 | + |
2642 | + /* Check that os_fast_mutexes work as expected */ |
2643 | +@@ -2707,6 +2728,10 @@ |
2644 | + |
2645 | + os_fast_mutex_free(&srv_os_test_mutex); |
2646 | + |
2647 | ++ if (srv_rebuild_indexes) { |
2648 | ++ xb_compact_rebuild_indexes(); |
2649 | ++ } |
2650 | ++ |
2651 | + if (srv_print_verbose_log) { |
2652 | + ib_logf(IB_LOG_LEVEL_INFO, |
2653 | + "%s started; log sequence number " LSN_PF "", |
2654 | +@@ -2739,6 +2764,7 @@ |
2655 | + fts_optimize_init(); |
2656 | + } |
2657 | + |
2658 | ++skip_processes: |
2659 | + srv_was_started = TRUE; |
2660 | + |
2661 | + return(DB_SUCCESS); |
2662 | +@@ -2794,7 +2820,7 @@ |
2663 | + return(DB_SUCCESS); |
2664 | + } |
2665 | + |
2666 | +- if (!srv_read_only_mode) { |
2667 | ++ if (!srv_read_only_mode && !srv_apply_log_only) { |
2668 | + /* Shutdown the FTS optimize sub system. */ |
2669 | + fts_optimize_start_shutdown(); |
2670 | + |
2671 | +--- a/storage/innobase/sync/sync0arr.cc |
2672 | ++++ b/storage/innobase/sync/sync0arr.cc |
2673 | +@@ -42,6 +42,7 @@ |
2674 | + #include "lock0lock.h" |
2675 | + #include "srv0srv.h" |
2676 | + #include "ha_prototypes.h" |
2677 | ++#include "xb0xb.h" |
2678 | + |
2679 | + /* |
2680 | + WAIT ARRAY |
2681 | +@@ -899,6 +900,13 @@ |
2682 | + ibool fatal = FALSE; |
2683 | + double longest_diff = 0; |
2684 | + |
2685 | ++ if (srv_rebuild_indexes) { |
2686 | ++ |
2687 | ++ /* Avoid long semaphore waits when rebuilding indexes */ |
2688 | ++ |
2689 | ++ return(FALSE); |
2690 | ++ } |
2691 | ++ |
2692 | + /* For huge tables, skip the check during CHECK TABLE etc... */ |
2693 | + if (fatal_timeout > SRV_SEMAPHORE_WAIT_EXTENSION) { |
2694 | + return(FALSE); |
2695 | +--- a/storage/innobase/trx/trx0rseg.cc |
2696 | ++++ b/storage/innobase/trx/trx0rseg.cc |
2697 | +@@ -121,9 +121,11 @@ |
2698 | + |
2699 | + mutex_free(&rseg->mutex); |
2700 | + |
2701 | ++ if (!srv_apply_log_only) { |
2702 | + /* There can't be any active transactions. */ |
2703 | + ut_a(UT_LIST_GET_LEN(rseg->update_undo_list) == 0); |
2704 | + ut_a(UT_LIST_GET_LEN(rseg->insert_undo_list) == 0); |
2705 | ++ } |
2706 | + |
2707 | + for (undo = UT_LIST_GET_FIRST(rseg->update_undo_cached); |
2708 | + undo != NULL; |
2709 | --- a/storage/innobase/trx/trx0sys.cc |
2710 | +++ b/storage/innobase/trx/trx0sys.cc |
2711 | -@@ -1185,7 +1185,8 @@ |
2712 | +@@ -1185,18 +1185,21 @@ |
2713 | trx_purge_sys_close(); |
2714 | |
2715 | /* Free the double write data structures. */ |
2716 | @@ -2385,4 +2596,70 @@ |
2717 | |
2718 | mutex_enter(&trx_sys->mutex); |
2719 | |
2720 | - |
2721 | + ut_a(UT_LIST_GET_LEN(trx_sys->ro_trx_list) == 0); |
2722 | + |
2723 | ++ if (!srv_apply_log_only) { |
2724 | + /* Only prepared transactions may be left in the system. Free them. */ |
2725 | + ut_a(UT_LIST_GET_LEN(trx_sys->rw_trx_list) == trx_sys->n_prepared_trx); |
2726 | + |
2727 | + while ((trx = UT_LIST_GET_FIRST(trx_sys->rw_trx_list)) != NULL) { |
2728 | + trx_free_prepared(trx); |
2729 | + } |
2730 | ++ } |
2731 | + |
2732 | + /* There can't be any active transactions. */ |
2733 | + for (i = 0; i < TRX_SYS_N_RSEGS; ++i) { |
2734 | +@@ -1223,10 +1226,12 @@ |
2735 | + UT_LIST_REMOVE(view_list, trx_sys->view_list, prev_view); |
2736 | + } |
2737 | + |
2738 | ++ if (!srv_apply_log_only) { |
2739 | + ut_a(UT_LIST_GET_LEN(trx_sys->view_list) == 0); |
2740 | + ut_a(UT_LIST_GET_LEN(trx_sys->ro_trx_list) == 0); |
2741 | + ut_a(UT_LIST_GET_LEN(trx_sys->rw_trx_list) == 0); |
2742 | + ut_a(UT_LIST_GET_LEN(trx_sys->mysql_trx_list) == 0); |
2743 | ++ } |
2744 | + |
2745 | + mutex_exit(&trx_sys->mutex); |
2746 | + |
2747 | +@@ -1247,6 +1252,10 @@ |
2748 | + { |
2749 | + ulint total_trx = 0; |
2750 | + |
2751 | ++ if (srv_apply_log_only) { |
2752 | ++ return(0); |
2753 | ++ } |
2754 | ++ |
2755 | + mutex_enter(&trx_sys->mutex); |
2756 | + |
2757 | + total_trx = UT_LIST_GET_LEN(trx_sys->rw_trx_list) |
2758 | +--- a/storage/innobase/trx/trx0trx.cc |
2759 | ++++ b/storage/innobase/trx/trx0trx.cc |
2760 | +@@ -2084,7 +2084,8 @@ |
2761 | + scenario where some undo generated by a transaction, |
2762 | + has XA stuff, and other undo, generated by the same |
2763 | + transaction, doesn't. */ |
2764 | +- trx->support_xa = thd_supports_xa(trx->mysql_thd); |
2765 | ++ trx->support_xa = trx->mysql_thd |
2766 | ++ ? thd_supports_xa(trx->mysql_thd) : FALSE; |
2767 | + |
2768 | + trx_start_low(trx); |
2769 | + /* fall through */ |
2770 | +--- a/storage/innobase/include/ha_prototypes.h |
2771 | ++++ b/storage/innobase/include/ha_prototypes.h |
2772 | +@@ -41,6 +41,15 @@ |
2773 | + class Field; |
2774 | + struct fts_string_t; |
2775 | + |
2776 | ++/****************************************************************//** |
2777 | ++Update log_checksum_algorithm_ptr with a pointer to the function corresponding |
2778 | ++to a given checksum algorithm. */ |
2779 | ++UNIV_INTERN |
2780 | ++void |
2781 | ++innodb_log_checksum_func_update( |
2782 | ++/*============================*/ |
2783 | ++ ulint algorithm); /*!< in: algorithm */ |
2784 | ++ |
2785 | + /*********************************************************************//** |
2786 | + Wrapper around MySQL's copy_and_convert function. |
2787 | + @return number of bytes copied to 'to' */ |
2788 | |
2789 | === modified file 'src/xtrabackup.cc' |
2790 | --- src/xtrabackup.cc 2013-11-05 09:58:25 +0000 |
2791 | +++ src/xtrabackup.cc 2013-11-12 08:58:01 +0000 |
2792 | @@ -475,6 +475,7 @@ |
2793 | OPT_INNODB_CHECKSUM_ALGORITHM, |
2794 | OPT_INNODB_UNDO_DIRECTORY, |
2795 | OPT_UNDO_TABLESPACES, |
2796 | + OPT_INNODB_LOG_CHECKSUM_ALGORITHM, |
2797 | #endif |
2798 | OPT_XTRA_INCREMENTAL_FORCE_SCAN, |
2799 | OPT_DEFAULTS_GROUP |
2800 | @@ -870,6 +871,11 @@ |
2801 | "INNODB, STRICT_INNODB, NONE, STRICT_NONE]", &srv_checksum_algorithm, |
2802 | &srv_checksum_algorithm, &innodb_checksum_algorithm_typelib, GET_ENUM, |
2803 | REQUIRED_ARG, SRV_CHECKSUM_ALGORITHM_INNODB, 0, 0, 0, 0, 0}, |
2804 | + {"innodb_log_checksum_algorithm", OPT_INNODB_LOG_CHECKSUM_ALGORITHM, |
2805 | + "The algorithm InnoDB uses for log checksumming. [CRC32, STRICT_CRC32, " |
2806 | + "INNODB, STRICT_INNODB, NONE, STRICT_NONE]", &srv_log_checksum_algorithm, |
2807 | + &srv_log_checksum_algorithm, &innodb_checksum_algorithm_typelib, GET_ENUM, |
2808 | + REQUIRED_ARG, SRV_CHECKSUM_ALGORITHM_INNODB, 0, 0, 0, 0, 0}, |
2809 | {"innodb_undo_directory", OPT_INNODB_UNDO_DIRECTORY, |
2810 | "Directory where undo tablespace files live, this path can be absolute.", |
2811 | (G_PTR*) &srv_undo_dir, (G_PTR*) &srv_undo_dir, |
2812 | @@ -1401,6 +1407,9 @@ |
2813 | srv_track_changed_pages = FALSE; |
2814 | #endif |
2815 | |
2816 | +#if MYSQL_VERSION_ID >= 50600 |
2817 | + innodb_log_checksum_func_update(srv_log_checksum_algorithm); |
2818 | +#endif |
2819 | return(FALSE); |
2820 | |
2821 | error: |
2822 | @@ -5943,6 +5952,9 @@ |
2823 | printf("innodb_checksum_algorithm = %s\n", |
2824 | innodb_checksum_algorithm_names[srv_checksum_algorithm] |
2825 | ); |
2826 | + printf("innodb_log_checksum_algorithm = %s\n", |
2827 | + innodb_checksum_algorithm_names[srv_log_checksum_algorithm] |
2828 | + ); |
2829 | #endif |
2830 | printf("innodb_buffer_pool_filename = \"%s\"\n", |
2831 | innobase_buffer_pool_filename ? |
2832 | |
2833 | === modified file 'test/bootstrap.sh' |
2834 | --- test/bootstrap.sh 2013-07-25 15:04:49 +0000 |
2835 | +++ test/bootstrap.sh 2013-11-12 08:58:01 +0000 |
2836 | @@ -52,7 +52,7 @@ |
2837 | |
2838 | innodb56) |
2839 | url="http://s3.amazonaws.com/percona.com/downloads/community" |
2840 | - tarball="mysql-5.6.11-linux-glibc2.5-$arch.tar.gz" |
2841 | + tarball="mysql-5.6.14-linux-glibc2.5-$arch.tar.gz" |
2842 | ;; |
2843 | |
2844 | xtradb51) |
2845 | @@ -94,16 +94,7 @@ |
2846 | tarball="Percona-Server-5.6.10-alpha60.2-318.Linux.$arch.tar.gz" |
2847 | else |
2848 | url="http://s3.amazonaws.com/percona.com/downloads/community" |
2849 | - # PS 5.6.11-rc60.3 tarballs have different revnos for i686 and |
2850 | - # x86_64 |
2851 | - case "$arch" in |
2852 | - i686) |
2853 | - tarball="Percona-Server-5.6.11-rc60.3-376.Linux.i686.tar.gz" |
2854 | - ;; |
2855 | - *) |
2856 | - tarball="Percona-Server-5.6.11-rc60.3-375.Linux.x86_64.tar.gz" |
2857 | - ;; |
2858 | - esac |
2859 | + tarball="Percona-Server-5.6.14-rel62.0-483.Linux.$arch.tar.gz" |
2860 | fi |
2861 | ;; |
2862 | |
2863 | |
2864 | === added file 'test/t/innodb_log_checksum_algorithm.sh' |
2865 | --- test/t/innodb_log_checksum_algorithm.sh 1970-01-01 00:00:00 +0000 |
2866 | +++ test/t/innodb_log_checksum_algorithm.sh 2013-11-12 08:58:01 +0000 |
2867 | @@ -0,0 +1,51 @@ |
2868 | +######################################################################## |
2869 | +# Test for innodb_log_checksum_algorithm feature in Percona Server 5.6 |
2870 | +######################################################################## |
2871 | + |
2872 | +require_xtradb |
2873 | +require_server_version_higher_than 5.6.13 |
2874 | + |
2875 | +function test_with_algorithm() |
2876 | +{ |
2877 | + vlog "################################################" |
2878 | + vlog "Testing with innodb_log_checksum_algorithm=$1" |
2879 | + vlog "################################################" |
2880 | + |
2881 | + MYSQLD_EXTRA_MY_CNF_OPTS=" |
2882 | +innodb_log_checksum_algorithm=$1 |
2883 | +" |
2884 | + start_server |
2885 | + |
2886 | + # Workaround for LP bug #1247586 |
2887 | + $MYSQL $MYSQL_ARGS -e "SET GLOBAL innodb_log_checksum_algorithm=$1" |
2888 | + |
2889 | + load_sakila |
2890 | + |
2891 | + innobackupex --no-timestamp $topdir/backup |
2892 | + |
2893 | + egrep '^innodb_log_checksum_algorithm='$1'$' $topdir/backup/backup-my.cnf |
2894 | + |
2895 | + record_db_state sakila |
2896 | + |
2897 | + stop_server |
2898 | + |
2899 | + rm -rf $MYSQLD_DATADIR/* |
2900 | + |
2901 | + innobackupex --apply-log --defaults-file=$topdir/backup/backup-my.cnf \ |
2902 | + $topdir/backup |
2903 | + |
2904 | + innobackupex --copy-back $topdir/backup |
2905 | + |
2906 | + start_server |
2907 | + |
2908 | + verify_db_state sakila |
2909 | + |
2910 | + stop_server |
2911 | + |
2912 | + rm -rf $topdir/backup |
2913 | + rm -rf $MYSQLD_DATADIR |
2914 | +} |
2915 | + |
2916 | +test_with_algorithm strict_none |
2917 | +test_with_algorithm strict_crc32 |
2918 | +test_with_algorithm strict_innodb |
Alexey -
The MP is mostly OK, except that log_block_ checksum_ is_ok_or_ old_format( ) in Percona Server is affected by bug 1250148 (... uses page not log block checksum algorithm) due to typos s/srv_log_ checksum_ algorithm/ srv_checksum_ algorithm, and this MP would copy this bug to XtraBackup as well. I'd avoid this.
Also, good job on sorting and cleaning up innodb56.patch chunks. I'd have preferred the clean patch regeneration and the log block checksum changes in two separate commits for easier review, but no big deal.
Updated MP with 1250148 is pre-approved. If you prefer to address 1250148 separately for some reason, just set this one to approved then.