Merge lp:~laurynas-biveinis/percona-xtrabackup/BT-28340-2.1 into lp:percona-xtrabackup/2.1

Proposed by Laurynas Biveinis
Status: Merged
Approved by: Alexey Kopytov
Approved revision: no longer in the source branch.
Merged at revision: 531
Proposed branch: lp:~laurynas-biveinis/percona-xtrabackup/BT-28340-2.1
Merge into: lp:percona-xtrabackup/2.1
Diff against target: 3963 lines (+2134/-415)
19 files modified
BUILD.txt (+1/-0)
patches/innodb56.patch (+974/-0)
src/Makefile (+28/-3)
src/compact.cc (+102/-111)
src/ds_encrypt.c (+3/-4)
src/fil_cur.cc (+6/-11)
src/fil_cur.h (+2/-2)
src/innodb_int.cc (+243/-17)
src/innodb_int.h (+473/-41)
src/write_filt.cc (+2/-2)
src/xbcrypt_common.c (+0/-1)
src/xtrabackup.cc (+233/-198)
src/xtrabackup.h (+6/-6)
test/bootstrap.sh (+6/-1)
test/inc/common.sh (+2/-2)
test/t/bug1062684.sh (+4/-3)
test/t/bug891496.sh (+1/-0)
test/testrun.sh (+12/-2)
utils/build.sh (+36/-11)
To merge this branch: bzr merge lp:~laurynas-biveinis/percona-xtrabackup/BT-28340-2.1
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Approve
Stewart Smith (community) Approve
Review via email: mp+154986@code.launchpad.net

Description of the change

Support for building XtraBackup against MySQL 5.6.

BT 28340

http://jenkins.percona.com/job/percona-xtrabackup-2.1-param/233/

Merge build against MySQL 5.6 support from 2.0.

Additional changes for 2.1:

- Port compact backups support to 5.6. Remove
  dict_sys_table_get_flags() function, fixing bug 1156195
  (dict_sys_tables_get_flags() in compact.cc redundant). Commit the
  transaction after each rebuilt table and remove the temporary data
  dictionary unlocks.

- New functions in the InnoDB compatibility/internals layer
  xb_parse_log_group_home_dirs(), xb_set_innodb_read_only(),
  xb_adjust_fatal_semaphore_wait_threshold(), and
  xb_dict_index_field_to_index_field(). Define trx_start_for_ddl()
  and ut_crc32_init() as no-op macros for 5.5-.

- Decouple ds_encrypt.c and xbcrypt_common.c from InnoDB by removing
  univ.i includes and replacing ut_a with xb_a.

- Link xbcrypt with the C++ compiler.

To post a comment you must log in.
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

The original goal was to contain the MYSQL_VERSION_ID checks to innodb_int.[hc], but I didn't succeed with it. In the case of compact backups it would require creating some "compact backup rebuilder context" in innodb_int and then calling some functions in predefined sequence, which didn't seem worth the hassle.

Revision history for this message
Stewart Smith (stewart) wrote :

(preliminary review) looks good. Far better than existing 2.1 innodb56 support :)

We should wait for Alexey to review before merging, also as mine was not too in depth.

review: Approve
Revision history for this message
Alexey Kopytov (akopytov) wrote :

Approved, but it also contains bug #1164979 which I overlooked when reviewing the 2.0 MP.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'BUILD.txt'
2--- BUILD.txt 2012-11-22 09:55:05 +0000
3+++ BUILD.txt 2013-03-22 15:32:33 +0000
4@@ -34,6 +34,7 @@
5 innodb55 5.5 build against InnoDB in MySQL 5.5
6 xtradb51 xtradb build against Percona Server with XtraDB 5.1
7 xtradb55 xtradb55 build against Percona Server with XtraDB 5.5
8+ innodb56 5.6 build against InnoDB in MySQL 5.6
9 ================== ========= =============================================
10
11 Note that the script must be executed from the base directory of Xtrabackup
12
13=== added file 'patches/innodb56.patch'
14--- patches/innodb56.patch 1970-01-01 00:00:00 +0000
15+++ patches/innodb56.patch 2013-03-22 15:32:33 +0000
16@@ -0,0 +1,974 @@
17+--- a/storage/innobase/btr/btr0btr.cc
18++++ b/storage/innobase/btr/btr0btr.cc
19+@@ -700,7 +700,7 @@
20+ /**************************************************************//**
21+ Gets the root node of a tree and x- or s-latches it.
22+ @return root page, x- or s-latched */
23+-static
24++UNIV_INTERN
25+ buf_block_t*
26+ btr_root_block_get(
27+ /*===============*/
28+@@ -1346,7 +1346,7 @@
29+ /************************************************************//**
30+ Returns the child page of a node pointer and x-latches it.
31+ @return child page, x-latched */
32+-static
33++UNIV_INTERN
34+ buf_block_t*
35+ btr_node_ptr_get_child(
36+ /*===================*/
37+--- a/storage/innobase/buf/buf0buf.cc
38++++ b/storage/innobase/buf/buf0buf.cc
39+@@ -53,6 +53,7 @@
40+ #include "page0zip.h"
41+ #include "srv0mon.h"
42+ #include "buf0checksum.h"
43++#include "xb0xb.h"
44+
45+ /*
46+ IMPLEMENTATION OF THE BUFFER POOL
47+@@ -549,9 +550,15 @@
48+ if (checksum_field1 == 0 && checksum_field2 == 0
49+ && mach_read_from_4(read_buf + FIL_PAGE_LSN) == 0) {
50+ /* make sure that the page is really empty */
51++#if 0
52++ /* Do not make sure that the page is really empty as this check
53++ is incompatible with 1st newly-created tablespace pages, which
54++ have FIL_PAGE_FIL_FLUSH_LSN != 0, FIL_PAGE_OR_CHKSUM == 0,
55++ FIL_PAGE_END_LSN_OLD_CHKSUM == 0 */
56+ ut_d(for (ulint i = 0; i < UNIV_PAGE_SIZE; i++) {
57+ ut_a(read_buf[i] == 0); });
58+
59++#endif
60+ return(FALSE);
61+ }
62+
63+@@ -976,6 +983,7 @@
64+ block->page.in_flush_list = FALSE;
65+ block->page.in_free_list = FALSE;
66+ block->page.in_LRU_list = FALSE;
67++ block->page.is_compacted = FALSE;
68+ block->in_unzip_LRU_list = FALSE;
69+ #endif /* UNIV_DEBUG */
70+ #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
71+@@ -3951,6 +3959,13 @@
72+ frame = ((buf_block_t*) bpage)->frame;
73+ }
74+
75++ /* Do not validate, recover and apply change buffer entries to
76++ bogus pages which replace skipped pages in compact backups. */
77++ if (srv_compact_backup && buf_page_is_compacted(frame)) {
78++
79++ bpage->is_compacted = TRUE;
80++ }
81++
82+ /* If this page is not uninitialized and not in the
83+ doublewrite buffer, then the page number and space id
84+ should be the same as in block. */
85+@@ -4068,7 +4083,7 @@
86+ recv_recover_page(TRUE, (buf_block_t*) bpage);
87+ }
88+
89+- if (uncompressed && !recv_no_ibuf_operations) {
90++ if (uncompressed && !recv_no_ibuf_operations && !bpage->is_compacted) {
91+ ibuf_merge_or_delete_for_page(
92+ (buf_block_t*) bpage, bpage->space,
93+ bpage->offset, buf_page_get_zip_size(bpage),
94+--- a/storage/innobase/fil/fil0fil.cc
95++++ b/storage/innobase/fil/fil0fil.cc
96+@@ -43,6 +43,8 @@
97+ #include "dict0dict.h"
98+ #include "page0page.h"
99+ #include "page0zip.h"
100++#include "pars0pars.h"
101++#include "que0que.h"
102+ #include "trx0sys.h"
103+ #include "row0mysql.h"
104+ #ifndef UNIV_HOTBACKUP
105+@@ -311,7 +313,7 @@
106+
107+ /** The tablespace memory cache. This variable is NULL before the module is
108+ initialized. */
109+-static fil_system_t* fil_system = NULL;
110++fil_system_t* fil_system = NULL;
111+
112+ /** Determine if (i) is a user tablespace id or not. */
113+ # define fil_is_user_tablespace_id(i) ((i) > srv_undo_tablespaces_open)
114+@@ -376,7 +378,7 @@
115+ off the LRU list if it is in the LRU list. The caller must hold the fil_sys
116+ mutex. */
117+ static
118+-void
119++ulint
120+ fil_node_prepare_for_io(
121+ /*====================*/
122+ fil_node_t* node, /*!< in: file node */
123+@@ -691,7 +693,7 @@
124+ Opens a file of a node of a tablespace. The caller must own the fil_system
125+ mutex. */
126+ static
127+-void
128++ulint
129+ fil_node_open_file(
130+ /*===============*/
131+ fil_node_t* node, /*!< in: file node */
132+@@ -725,6 +727,18 @@
133+ OS_FILE_READ_ONLY, &success);
134+ if (!success) {
135+ /* The following call prints an error message */
136++ if (os_file_get_last_error(TRUE) == OS_FILE_NOT_FOUND)
137++ {
138++ ut_print_timestamp(stderr);
139++ fprintf(stderr,
140++ " InnoDB: Warning: cannot open %s\n"
141++ "InnoDB: this can happen if the table "
142++ "was removed or renamed during an \n"
143++ "InnoDB: xtrabackup run and is not dangerous.\n",
144++ node->name);
145++ return(OS_FILE_NOT_FOUND);
146++ }
147++
148+ os_file_get_last_error(true);
149+
150+ ut_print_timestamp(stderr);
151+@@ -783,12 +797,17 @@
152+
153+ if (UNIV_UNLIKELY(space_id != space->id)) {
154+ fprintf(stderr,
155+- "InnoDB: Error: tablespace id is %lu"
156++ "InnoDB: Warning: tablespace id is %lu"
157+ " in the data dictionary\n"
158+- "InnoDB: but in file %s it is %lu!\n",
159++ "InnoDB: but in file %s it is %lu!\n"
160++ "InnoDB: this can happen if the table "
161++ "metadata was modified during an xtrabackup "
162++ "run\n"
163++ "InnoDB: and is not dangerous.\n",
164++
165+ space->id, node->name, space_id);
166+
167+- ut_error;
168++ return(OS_FILE_NOT_FOUND);
169+ }
170+
171+ if (UNIV_UNLIKELY(space_id == ULINT_UNDEFINED
172+@@ -825,8 +844,9 @@
173+ }
174+
175+ if (size_bytes >= 1024 * 1024) {
176+- /* Truncate the size to whole megabytes. */
177+- size_bytes = ut_2pow_round(size_bytes, 1024 * 1024);
178++ /* The size should be exact for after applying
179++ .delta */
180++ //size_bytes = ut_2pow_round(size_bytes, 1024 * 1024);
181+ }
182+
183+ if (!fsp_flags_is_compressed(flags)) {
184+@@ -879,6 +899,8 @@
185+ /* Put the node to the LRU list */
186+ UT_LIST_ADD_FIRST(LRU, system->LRU, node);
187+ }
188++
189++ return(0);
190+ }
191+
192+ /**********************************************************************//**
193+@@ -1491,7 +1513,12 @@
194+ the file yet; the following calls will open it and update the
195+ size fields */
196+
197+- fil_node_prepare_for_io(node, fil_system, space);
198++ if (fil_node_prepare_for_io(node, fil_system, space))
199++ {
200++ mutex_exit(&fil_system->mutex);
201++
202++ return(NULL);
203++ }
204+ fil_node_complete_io(node, fil_system, OS_FILE_READ);
205+ }
206+
207+@@ -2095,7 +2122,7 @@
208+ mem_free(path);
209+ }
210+
211+-#ifndef UNIV_HOTBACKUP
212++#if 0
213+ /********************************************************//**
214+ Writes a log record about an .ibd file create/rename/delete. */
215+ static
216+@@ -2329,7 +2356,7 @@
217+ space_id, name, path, flags,
218+ DICT_TF2_USE_TABLESPACE,
219+ FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) {
220+- ut_error;
221++ //ut_error;
222+ }
223+ }
224+
225+@@ -2687,7 +2714,7 @@
226+ }
227+
228+ if (err == DB_SUCCESS) {
229+-#ifndef UNIV_HOTBACKUP
230++#if 0
231+ /* Write a log record about the deletion of the .ibd
232+ file, so that ibbackup can replay it in the
233+ --apply-log phase. We use a dummy mtr and the familiar
234+@@ -3042,7 +3069,7 @@
235+
236+ mutex_exit(&fil_system->mutex);
237+
238+-#ifndef UNIV_HOTBACKUP
239++#if 0
240+ if (success && !recv_recovery_on) {
241+ mtr_t mtr;
242+
243+@@ -3426,7 +3453,7 @@
244+ goto error_exit_1;
245+ }
246+
247+-#ifndef UNIV_HOTBACKUP
248++#if 0
249+ {
250+ mtr_t mtr;
251+ ulint mlog_file_flag = 0;
252+@@ -3504,6 +3531,97 @@
253+ #endif /* UNIV_LOG_ARCHIVE */
254+ };
255+
256++static
257++void
258++fil_remove_invalid_table_from_data_dict(const char *name)
259++{
260++ trx_t* trx;
261++ pars_info_t* info = NULL;
262++
263++ trx = trx_allocate_for_mysql();
264++ trx_start_for_ddl(trx, TRX_DICT_OP_TABLE);
265++
266++ ut_ad(mutex_own(&dict_sys->mutex));
267++
268++ trx->op_info = "removing invalid table from data dictionary";
269++
270++ info = pars_info_create();
271++
272++ pars_info_add_str_literal(info, "table_name", name);
273++
274++ que_eval_sql(info,
275++ "PROCEDURE DROP_TABLE_PROC () IS\n"
276++ "sys_foreign_id CHAR;\n"
277++ "table_id CHAR;\n"
278++ "index_id CHAR;\n"
279++ "foreign_id CHAR;\n"
280++ "found INT;\n"
281++ "BEGIN\n"
282++ "SELECT ID INTO table_id\n"
283++ "FROM SYS_TABLES\n"
284++ "WHERE NAME = :table_name\n"
285++ "LOCK IN SHARE MODE;\n"
286++ "IF (SQL % NOTFOUND) THEN\n"
287++ " RETURN;\n"
288++ "END IF;\n"
289++ "found := 1;\n"
290++ "SELECT ID INTO sys_foreign_id\n"
291++ "FROM SYS_TABLES\n"
292++ "WHERE NAME = 'SYS_FOREIGN'\n"
293++ "LOCK IN SHARE MODE;\n"
294++ "IF (SQL % NOTFOUND) THEN\n"
295++ " found := 0;\n"
296++ "END IF;\n"
297++ "IF (:table_name = 'SYS_FOREIGN') THEN\n"
298++ " found := 0;\n"
299++ "END IF;\n"
300++ "IF (:table_name = 'SYS_FOREIGN_COLS') THEN\n"
301++ " found := 0;\n"
302++ "END IF;\n"
303++ "WHILE found = 1 LOOP\n"
304++ " SELECT ID INTO foreign_id\n"
305++ " FROM SYS_FOREIGN\n"
306++ " WHERE FOR_NAME = :table_name\n"
307++ " AND TO_BINARY(FOR_NAME)\n"
308++ " = TO_BINARY(:table_name)\n"
309++ " LOCK IN SHARE MODE;\n"
310++ " IF (SQL % NOTFOUND) THEN\n"
311++ " found := 0;\n"
312++ " ELSE\n"
313++ " DELETE FROM SYS_FOREIGN_COLS\n"
314++ " WHERE ID = foreign_id;\n"
315++ " DELETE FROM SYS_FOREIGN\n"
316++ " WHERE ID = foreign_id;\n"
317++ " END IF;\n"
318++ "END LOOP;\n"
319++ "found := 1;\n"
320++ "WHILE found = 1 LOOP\n"
321++ " SELECT ID INTO index_id\n"
322++ " FROM SYS_INDEXES\n"
323++ " WHERE TABLE_ID = table_id\n"
324++ " LOCK IN SHARE MODE;\n"
325++ " IF (SQL % NOTFOUND) THEN\n"
326++ " found := 0;\n"
327++ " ELSE\n"
328++ " DELETE FROM SYS_FIELDS\n"
329++ " WHERE INDEX_ID = index_id;\n"
330++ " DELETE FROM SYS_INDEXES\n"
331++ " WHERE ID = index_id\n"
332++ " AND TABLE_ID = table_id;\n"
333++ " END IF;\n"
334++ "END LOOP;\n"
335++ "DELETE FROM SYS_COLUMNS\n"
336++ "WHERE TABLE_ID = table_id;\n"
337++ "DELETE FROM SYS_TABLES\n"
338++ "WHERE ID = table_id;\n"
339++ "END;\n"
340++ , FALSE, trx);
341++
342++ trx_commit_for_mysql(trx);
343++
344++ trx_free_for_mysql(trx);
345++}
346++
347+ /********************************************************************//**
348+ Tries to open a single-table tablespace and optionally checks that the
349+ space id in it is correct. If this does not succeed, print an error message
350+@@ -3712,11 +3830,15 @@
351+ /* The following call prints an error message */
352+ os_file_get_last_error(true);
353+
354+- ib_logf(IB_LOG_LEVEL_ERROR,
355++ ib_logf(IB_LOG_LEVEL_WARN,
356+ "Could not find a valid tablespace file for '%s'. "
357+ "See " REFMAN "innodb-troubleshooting-datadict.html "
358+ "for how to resolve the issue.",
359+ tablename);
360++ ib_logf(IB_LOG_LEVEL_WARN,
361++ "It will be removed from the data dictionary.");
362++
363++ fil_remove_invalid_table_from_data_dict(tablename);
364+
365+ err = DB_CORRUPTION;
366+
367+@@ -4135,7 +4257,7 @@
368+ cannot be ok. */
369+ ulong minimum_size = FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE;
370+ if (size < minimum_size) {
371+-#ifndef UNIV_HOTBACKUP
372++#if 0
373+ ib_logf(IB_LOG_LEVEL_ERROR,
374+ "The size of single-table tablespace file %s "
375+ "is only " UINT64PF ", should be at least %lu!",
376+@@ -4263,7 +4385,7 @@
377+ idea is to read as much good data as we can and jump over bad data.
378+ @return 0 if ok, -1 if error even after the retries, 1 if at the end
379+ of the directory */
380+-static
381++UNIV_INTERN
382+ int
383+ fil_file_readdir_next_file(
384+ /*=======================*/
385+@@ -4359,7 +4481,9 @@
386+ "%s/%s", fil_path_to_mysql_datadir, dbinfo.name);
387+ srv_normalize_path_for_win(dbpath);
388+
389+- dbdir = os_file_opendir(dbpath, FALSE);
390++ /* We want wrong directory permissions to be a fatal error for
391++ XtraBackup. */
392++ dbdir = os_file_opendir(dbpath, TRUE);
393+
394+ if (dbdir != NULL) {
395+
396+@@ -4538,6 +4662,7 @@
397+ {
398+ fil_space_t* fnamespace;
399+ fil_space_t* space;
400++ ibool remove_from_data_dict = FALSE;
401+
402+ ut_ad(fil_system);
403+
404+@@ -4615,6 +4740,10 @@
405+ if (fnamespace == NULL) {
406+ if (print_error_if_does_not_exist) {
407+ fil_report_missing_tablespace(name, id);
408++ ib_logf(IB_LOG_LEVEL_WARN,
409++ "It will be removed from "
410++ "the data dictionary.");
411++ remove_from_data_dict = TRUE;
412+ }
413+ } else {
414+ ut_print_timestamp(stderr);
415+@@ -4638,6 +4767,10 @@
416+
417+ mutex_exit(&fil_system->mutex);
418+
419++ if (remove_from_data_dict) {
420++ fil_remove_invalid_table_from_data_dict(name);
421++ }
422++
423+ return(FALSE);
424+ }
425+
426+@@ -4728,6 +4861,7 @@
427+ ulint page_size;
428+ ulint pages_added;
429+ ibool success;
430++ ulint err = 0;
431+
432+ ut_ad(!srv_read_only_mode);
433+
434+@@ -4772,13 +4906,17 @@
435+ goto retry;
436+ }
437+
438+- fil_node_prepare_for_io(node, fil_system, space);
439++ err = fil_node_prepare_for_io(node, fil_system, space);
440+
441+ /* At this point it is safe to release fil_system mutex. No
442+ other thread can rename, delete or close the file because
443+ we have set the node->being_extended flag. */
444+ mutex_exit(&fil_system->mutex);
445+
446++ if (err) {
447++ return FALSE;
448++ }
449++
450+ start_page_no = space->size;
451+ file_start_page_no = space->size - node->size;
452+
453+@@ -5024,7 +5162,7 @@
454+ off the LRU list if it is in the LRU list. The caller must hold the fil_sys
455+ mutex. */
456+ static
457+-void
458++ulint
459+ fil_node_prepare_for_io(
460+ /*====================*/
461+ fil_node_t* node, /*!< in: file node */
462+@@ -5044,9 +5182,12 @@
463+ }
464+
465+ if (node->open == FALSE) {
466++ ulint err;
467+ /* File is closed: open it */
468+ ut_a(node->n_pending == 0);
469+- fil_node_open_file(node, system, space);
470++ err = fil_node_open_file(node, system, space);
471++ if (err)
472++ return(err);
473+ }
474+
475+ if (node->n_pending == 0 && fil_space_belongs_in_lru(space)) {
476+@@ -5058,6 +5199,8 @@
477+ }
478+
479+ node->n_pending++;
480++
481++ return(0);
482+ }
483+
484+ /********************************************************************//**
485+@@ -5259,6 +5402,16 @@
486+
487+ ut_ad(mode != OS_AIO_IBUF || space->purpose == FIL_TABLESPACE);
488+
489++ if (space->size > 0 && space->size <= block_offset) {
490++ ulint actual_size;
491++
492++ mutex_exit(&fil_system->mutex);
493++ fil_extend_space_to_desired_size(&actual_size, space->id,
494++ block_offset + 1);
495++ mutex_enter(&fil_system->mutex);
496++ /* should retry? but it may safe for xtrabackup for now. */
497++ }
498++
499+ node = UT_LIST_GET_FIRST(space->chain);
500+
501+ for (;;) {
502+@@ -5290,7 +5443,11 @@
503+ }
504+
505+ /* Open file if closed */
506+- fil_node_prepare_for_io(node, fil_system, space);
507++ if (fil_node_prepare_for_io(node, fil_system, space)) {
508++
509++ mutex_exit(&fil_system->mutex);
510++ return(DB_TABLESPACE_DELETED);
511++ }
512+
513+ /* Check that at least the start offset is within the bounds of a
514+ single-table tablespace, including rollback tablespaces. */
515+@@ -6164,6 +6321,7 @@
516+ return(err);
517+ }
518+
519++#if 0
520+ /****************************************************************//**
521+ Generate redo logs for swapping two .ibd files */
522+ UNIV_INTERN
523+@@ -6187,4 +6345,4 @@
524+ 0, 0, new_name, old_name, &mtr);
525+ mtr_commit(&mtr);
526+ }
527+-
528++#endif
529+--- a/storage/innobase/handler/ha_innodb.cc
530++++ b/storage/innobase/handler/ha_innodb.cc
531+@@ -1548,7 +1548,7 @@
532+ ut_ad(*mbminlen < DATA_MBMAX);
533+ ut_ad(*mbmaxlen < DATA_MBMAX);
534+ } else {
535+- THD* thd = current_thd;
536++ THD* thd = NULL;
537+
538+ if (thd && thd_sql_command(thd) == SQLCOM_DROP_TABLE) {
539+
540+--- a/storage/innobase/include/srv0srv.h
541++++ b/storage/innobase/include/srv0srv.h
542+@@ -353,6 +353,9 @@
543+ extern ulong srv_max_purge_lag_delay;
544+
545+ extern ulong srv_replication_delay;
546++
547++extern ibool srv_apply_log_only;
548++
549+ /*-------------------------------------------*/
550+
551+ extern ibool srv_print_innodb_monitor;
552+--- a/storage/innobase/log/log0recv.cc
553++++ b/storage/innobase/log/log0recv.cc
554+@@ -43,20 +43,21 @@
555+ #include "trx0undo.h"
556+ #include "trx0rec.h"
557+ #include "fil0fil.h"
558+-#ifndef UNIV_HOTBACKUP
559++//#ifndef UNIV_HOTBACKUP
560+ # include "buf0rea.h"
561+ # include "srv0srv.h"
562+ # include "srv0start.h"
563+ # include "trx0roll.h"
564+ # include "row0merge.h"
565+ # include "sync0sync.h"
566+-#else /* !UNIV_HOTBACKUP */
567++//#else /* !UNIV_HOTBACKUP */
568++#include "xb0xb.h"
569+
570+ /** This is set to FALSE if the backup was originally taken with the
571+ ibbackup --include regexp option: then we do not want to create tables in
572+ directories which were not included */
573+ UNIV_INTERN ibool recv_replay_file_ops = TRUE;
574+-#endif /* !UNIV_HOTBACKUP */
575++//#endif /* !UNIV_HOTBACKUP */
576+
577+ /** Log records are stored in the hash table in chunks at most of this size;
578+ this must be less than UNIV_PAGE_SIZE as it is stored in the buffer pool */
579+@@ -399,7 +400,7 @@
580+ /* Set appropriate value of recv_n_pool_free_frames. */
581+ if (buf_pool_get_curr_size() >= (10 * 1024 * 1024)) {
582+ /* Buffer pool of size greater than 10 MB. */
583+- recv_n_pool_free_frames = 512;
584++ recv_n_pool_free_frames = 1024;
585+ }
586+
587+ recv_sys->buf = static_cast<byte*>(ut_malloc(RECV_PARSING_BUF_SIZE));
588+@@ -703,7 +704,7 @@
589+ /***********************************************************************//**
590+ Checks the consistency of the checkpoint info
591+ @return TRUE if ok */
592+-static
593++UNIV_INTERN
594+ ibool
595+ recv_check_cp_is_consistent(
596+ /*========================*/
597+@@ -733,7 +734,7 @@
598+ /********************************************************//**
599+ Looks for the maximum consistent checkpoint from the log groups.
600+ @return error code or DB_SUCCESS */
601+-static __attribute__((nonnull, warn_unused_result))
602++UNIV_INTERN __attribute__((nonnull, warn_unused_result))
603+ dberr_t
604+ recv_find_max_checkpoint(
605+ /*=====================*/
606+@@ -893,7 +894,7 @@
607+ InnoDB-3.23.52 where the checksum field contains the log block number.
608+ @return TRUE if ok, or if the log block may be in the format of InnoDB
609+ version predating 3.23.52 */
610+-static
611++UNIV_INTERN
612+ ibool
613+ log_block_checksum_is_ok_or_old_format(
614+ /*===================================*/
615+@@ -1588,6 +1589,8 @@
616+ buf_block_get_page_no(block));
617+
618+ if ((recv_addr == NULL)
619++ /* Fix for http://bugs.mysql.com/bug.php?id=44140 */
620++ || (recv_addr->state == RECV_BEING_READ && !just_read_in)
621+ || (recv_addr->state == RECV_BEING_PROCESSED)
622+ || (recv_addr->state == RECV_PROCESSED)) {
623+
624+@@ -1677,9 +1680,17 @@
625+ if (page_zip) {
626+ memset(FIL_PAGE_LSN + page_zip->data, 0, 8);
627+ }
628++
629++ if (!block->page.is_compacted
630++ && block->page.is_compacted) {
631++
632++ ut_ad(srv_compact_backup);
633++
634++ block->page.is_compacted = FALSE;
635++ }
636+ }
637+
638+- if (recv->start_lsn >= page_lsn) {
639++ if (!block->page.is_compacted && recv->start_lsn >= page_lsn) {
640+
641+ lsn_t end_lsn;
642+
643+@@ -2413,7 +2424,7 @@
644+ || type == MLOG_FILE_RENAME
645+ || type == MLOG_FILE_DELETE) {
646+ ut_a(space);
647+-#ifdef UNIV_HOTBACKUP
648++//#ifdef UNIV_HOTBACKUP
649+ if (recv_replay_file_ops) {
650+
651+ /* In ibbackup --apply-log, replay an .ibd file
652+@@ -2436,7 +2447,7 @@
653+ ut_error;
654+ }
655+ }
656+-#endif
657++//#endif
658+ /* In normal mysqld crash recovery we do not try to
659+ replay file operations */
660+ #ifdef UNIV_LOG_LSN_DEBUG
661+@@ -2863,8 +2874,14 @@
662+
663+ fprintf(stderr,
664+ "InnoDB: Doing recovery: scanned up to"
665+- " log sequence number " LSN_PF "\n",
666+- *group_scanned_lsn);
667++ " log sequence number " LSN_PF " (%lu%%)\n",
668++ *group_scanned_lsn,
669++ (ulong) ((*group_scanned_lsn
670++ - recv_sys->parse_start_lsn)
671++ / (8 * log_group_get_capacity(
672++ UT_LIST_GET_FIRST(
673++ log_sys->log_groups))
674++ / 900)));
675+ }
676+ }
677+
678+@@ -3456,7 +3473,8 @@
679+ that the data dictionary tables will be free of any locks.
680+ The data dictionary latch should guarantee that there is at
681+ most one data dictionary transaction active at a time. */
682+- if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO) {
683++ if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO
684++ && !srv_apply_log_only) {
685+ trx_rollback_or_clean_recovered(FALSE);
686+ }
687+ }
688+--- a/storage/innobase/os/os0file.cc
689++++ b/storage/innobase/os/os0file.cc
690+@@ -699,7 +699,7 @@
691+ }
692+
693+ #undef USE_FILE_LOCK
694+-#define USE_FILE_LOCK
695++//#define USE_FILE_LOCK
696+ #if defined(UNIV_HOTBACKUP) || defined(__WIN__)
697+ /* InnoDB Hot Backup does not lock the data files.
698+ * On Windows, mandatory locking is used.
699+--- a/storage/innobase/row/row0merge.cc
700++++ b/storage/innobase/row/row0merge.cc
701+@@ -3227,9 +3227,11 @@
702+ goto err_exit;
703+ }
704+
705++#if 0
706+ /* Generate the redo logs for file operations */
707+ fil_mtr_rename_log(old_table->space, old_name,
708+ new_table->space, new_table->name, tmp_name);
709++#endif
710+
711+ /* What if the redo logs are flushed to disk here? This is
712+ tested with following crash point */
713+--- a/storage/innobase/srv/srv0srv.cc
714++++ b/storage/innobase/srv/srv0srv.cc
715+@@ -349,6 +349,8 @@
716+
717+ UNIV_INTERN ulong srv_replication_delay = 0;
718+
719++UNIV_INTERN ibool srv_apply_log_only = FALSE;
720++
721+ /*-------------------------------------------*/
722+ UNIV_INTERN ulong srv_n_spin_wait_rounds = 30;
723+ UNIV_INTERN ulong srv_spin_wait_delay = 6;
724+@@ -1808,7 +1810,8 @@
725+ if (ret == SRV_NONE
726+ && srv_shutdown_state != SRV_SHUTDOWN_NONE
727+ && trx_purge_state() != PURGE_STATE_DISABLED
728+- && trx_purge_state() != PURGE_STATE_EXIT) {
729++ && trx_purge_state() != PURGE_STATE_EXIT
730++ && trx_purge_state() != PURGE_STATE_INIT) {
731+
732+ ret = SRV_PURGE;
733+ }
734+--- a/storage/innobase/srv/srv0start.cc
735++++ b/storage/innobase/srv/srv0start.cc
736+@@ -63,6 +63,7 @@
737+ #include "ibuf0ibuf.h"
738+ #include "srv0start.h"
739+ #include "srv0srv.h"
740++#include "xb0xb.h"
741+ #ifndef UNIV_HOTBACKUP
742+ # include "trx0rseg.h"
743+ # include "os0proc.h"
744+@@ -121,7 +122,7 @@
745+ UNIV_INTERN enum srv_shutdown_state srv_shutdown_state = SRV_SHUTDOWN_NONE;
746+
747+ /** Files comprising the system tablespace */
748+-static os_file_t files[1000];
749++os_file_t files[1000];
750+
751+ /** io_handler_thread parameters for thread identification */
752+ static ulint n[SRV_MAX_N_IO_THREADS + 6];
753+@@ -731,7 +732,7 @@
754+ /*********************************************************************//**
755+ Creates or opens database data files and closes them.
756+ @return DB_SUCCESS or error code */
757+-static __attribute__((nonnull, warn_unused_result))
758++UNIV_INTERN __attribute__((nonnull, warn_unused_result))
759+ dberr_t
760+ open_or_create_data_files(
761+ /*======================*/
762+@@ -2065,11 +2066,13 @@
763+ max_flushed_lsn = min_flushed_lsn
764+ = log_get_lsn();
765+ goto files_checked;
766++#if 0
767+ } else if (i < 2) {
768+ /* must have at least 2 log files */
769+ ib_logf(IB_LOG_LEVEL_ERROR,
770+ "Only one log file found.");
771+ return(err);
772++#endif
773+ }
774+
775+ /* opened all files */
776+@@ -2326,6 +2329,10 @@
777+
778+ recv_recovery_from_checkpoint_finish();
779+
780++ if (srv_apply_log_only) {
781++ goto skip_processes;
782++ }
783++
784+ if (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) {
785+ /* The following call is necessary for the insert
786+ buffer to work with multiple tablespaces. We must
787+@@ -2647,6 +2654,7 @@
788+ && srv_auto_extend_last_data_file
789+ && sum_of_data_file_sizes < tablespace_size_in_header) {
790+
791++#ifdef UNDEFINED
792+ ut_print_timestamp(stderr);
793+ fprintf(stderr,
794+ " InnoDB: Error: tablespace size stored in header"
795+@@ -2683,6 +2691,7 @@
796+
797+ return(DB_ERROR);
798+ }
799++#endif
800+ }
801+
802+ /* Check that os_fast_mutexes work as expected */
803+@@ -2707,6 +2716,10 @@
804+
805+ os_fast_mutex_free(&srv_os_test_mutex);
806+
807++ if (srv_rebuild_indexes) {
808++ xb_compact_rebuild_indexes();
809++ }
810++
811+ if (srv_print_verbose_log) {
812+ ib_logf(IB_LOG_LEVEL_INFO,
813+ "%s started; log sequence number " LSN_PF "",
814+@@ -2739,6 +2752,7 @@
815+ fts_optimize_init();
816+ }
817+
818++skip_processes:
819+ srv_was_started = TRUE;
820+
821+ return(DB_SUCCESS);
822+@@ -2794,7 +2808,7 @@
823+ return(DB_SUCCESS);
824+ }
825+
826+- if (!srv_read_only_mode) {
827++ if (!srv_read_only_mode && !srv_apply_log_only) {
828+ /* Shutdown the FTS optimize sub system. */
829+ fts_optimize_start_shutdown();
830+
831+--- a/storage/innobase/trx/trx0rseg.cc
832++++ b/storage/innobase/trx/trx0rseg.cc
833+@@ -121,9 +121,11 @@
834+
835+ mutex_free(&rseg->mutex);
836+
837++ if (!srv_apply_log_only) {
838+ /* There can't be any active transactions. */
839+ ut_a(UT_LIST_GET_LEN(rseg->update_undo_list) == 0);
840+ ut_a(UT_LIST_GET_LEN(rseg->insert_undo_list) == 0);
841++ }
842+
843+ for (undo = UT_LIST_GET_FIRST(rseg->update_undo_cached);
844+ undo != NULL;
845+--- a/storage/innobase/trx/trx0sys.cc
846++++ b/storage/innobase/trx/trx0sys.cc
847+@@ -1191,12 +1191,14 @@
848+
849+ ut_a(UT_LIST_GET_LEN(trx_sys->ro_trx_list) == 0);
850+
851++ if (!srv_apply_log_only) {
852+ /* Only prepared transactions may be left in the system. Free them. */
853+ ut_a(UT_LIST_GET_LEN(trx_sys->rw_trx_list) == trx_sys->n_prepared_trx);
854+
855+ while ((trx = UT_LIST_GET_FIRST(trx_sys->rw_trx_list)) != NULL) {
856+ trx_free_prepared(trx);
857+ }
858++ }
859+
860+ /* There can't be any active transactions. */
861+ for (i = 0; i < TRX_SYS_N_RSEGS; ++i) {
862+@@ -1223,10 +1225,12 @@
863+ UT_LIST_REMOVE(view_list, trx_sys->view_list, prev_view);
864+ }
865+
866++ if (!srv_apply_log_only) {
867+ ut_a(UT_LIST_GET_LEN(trx_sys->view_list) == 0);
868+ ut_a(UT_LIST_GET_LEN(trx_sys->ro_trx_list) == 0);
869+ ut_a(UT_LIST_GET_LEN(trx_sys->rw_trx_list) == 0);
870+ ut_a(UT_LIST_GET_LEN(trx_sys->mysql_trx_list) == 0);
871++ }
872+
873+ mutex_exit(&trx_sys->mutex);
874+
875+@@ -1247,6 +1251,10 @@
876+ {
877+ ulint total_trx = 0;
878+
879++ if (srv_apply_log_only) {
880++ return(0);
881++ }
882++
883+ mutex_enter(&trx_sys->mutex);
884+
885+ total_trx = UT_LIST_GET_LEN(trx_sys->rw_trx_list)
886+--- a/storage/innobase/trx/trx0trx.cc
887++++ b/storage/innobase/trx/trx0trx.cc
888+@@ -2053,7 +2053,8 @@
889+ scenario where some undo generated by a transaction,
890+ has XA stuff, and other undo, generated by the same
891+ transaction, doesn't. */
892+- trx->support_xa = thd_supports_xa(trx->mysql_thd);
893++ trx->support_xa = trx->mysql_thd
894++ ? thd_supports_xa(trx->mysql_thd) : FALSE;
895+
896+ trx_start_low(trx);
897+ /* fall through */
898+--- a/storage/innobase/CMakeLists.txt
899++++ b/storage/innobase/CMakeLists.txt
900+@@ -44,8 +44,10 @@
901+ # SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
902+ ENDIF()
903+
904+-# Enable InnoDB's UNIV_DEBUG and UNIV_SYNC_DEBUG in debug builds
905+-SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DUNIV_DEBUG -DUNIV_SYNC_DEBUG")
906++# In XtraBackup do not enable UNIV_SYNC_DEBUG when UNIV_DEBUG is enabled
907++# due to extreme slowness on compact backup testcases
908++## Enable InnoDB's UNIV_DEBUG and UNIV_SYNC_DEBUG in debug builds
909++#SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DUNIV_DEBUG -DUNIV_SYNC_DEBUG")
910+
911+ # Add -Wconversion if compiling with GCC
912+ ## As of Mar 15 2011 this flag causes 3573+ warnings. If you are reading this
913+--- a/storage/innobase/sync/sync0arr.cc
914++++ b/storage/innobase/sync/sync0arr.cc
915+@@ -42,6 +42,7 @@
916+ #include "lock0lock.h"
917+ #include "srv0srv.h"
918+ #include "ha_prototypes.h"
919++#include "xb0xb.h"
920+
921+ /*
922+ WAIT ARRAY
923+@@ -903,6 +904,13 @@
924+ ibool fatal = FALSE;
925+ double longest_diff = 0;
926+
927++ if (srv_rebuild_indexes) {
928++
929++ /* Avoid long semaphore waits when rebuilding indexes */
930++
931++ return(FALSE);
932++ }
933++
934+ /* For huge tables, skip the check during CHECK TABLE etc... */
935+ if (fatal_timeout > SRV_SEMAPHORE_WAIT_EXTENSION) {
936+ return(FALSE);
937+--- a/storage/innobase/include/buf0buf.h
938++++ b/storage/innobase/include/buf0buf.h
939+@@ -1583,6 +1583,8 @@
940+ or buf_block_t::mutex. */
941+ # endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
942+ #endif /* !UNIV_HOTBACKUP */
943++ ibool is_compacted; /*!< TRUE if page was skipped in
944++ compact backups */
945+ };
946+
947+ /** The buffer control block structure */
948+--- a/storage/innobase/mem/mem0dbg.cc
949++++ b/storage/innobase/mem/mem0dbg.cc
950+@@ -278,18 +278,10 @@
951+ byte* buf, /*!< in: pointer to buffer */
952+ ulint n) /*!< in: length of buffer */
953+ {
954+- byte* ptr;
955+-
956+ UNIV_MEM_ASSERT_W(buf, n);
957+
958+- for (ptr = buf; ptr < buf + n; ptr++) {
959+-
960+- if (ut_rnd_gen_ibool()) {
961+- *ptr = 0xBA;
962+- } else {
963+- *ptr = 0xBE;
964+- }
965+- }
966++ /* Fix https://bugs.launchpad.net/percona-xtrabackup/+bug/1158154 */
967++ memset(buf, 0xBA, n);
968+
969+ UNIV_MEM_INVALID(buf, n);
970+ }
971+@@ -304,17 +296,10 @@
972+ byte* buf, /*!< in: pointer to buffer */
973+ ulint n) /*!< in: length of buffer */
974+ {
975+- byte* ptr;
976+-
977+ UNIV_MEM_ASSERT_W(buf, n);
978+
979+- for (ptr = buf; ptr < buf + n; ptr++) {
980+- if (ut_rnd_gen_ibool()) {
981+- *ptr = 0xDE;
982+- } else {
983+- *ptr = 0xAD;
984+- }
985+- }
986++ /* Fix https://bugs.launchpad.net/percona-xtrabackup/+bug/1158154 */
987++ memset(buf, 0xDE, n);
988+
989+ UNIV_MEM_FREE(buf, n);
990+ }
991
992=== modified file 'src/Makefile'
993--- src/Makefile 2013-03-19 11:53:10 +0000
994+++ src/Makefile 2013-03-22 15:32:33 +0000
995@@ -1,13 +1,14 @@
996 # Makefile to build XtraBackup for Percona Server and different versions of MySQL
997 #
998 # Syntax:
999-# make [5.1|5.5|plugin|xtradb|xtradb55]
1000+# make [5.1|5.5|5.6|plugin|xtradb|xtradb55]
1001 #
1002 # Default is xtradb - to build XtraBackup for Percona Server 5.1
1003 # xtradb55 - Xtrabackup for Percona Server 5.5
1004 # 5.1 - XtraBackup for MySQL versions 5.1.* with builtin InnoDB
1005 # plugin - XtraBackup for MySQL versions 5.1.* with InnoDB plugin
1006 # 5.5 - XtraBackup for MySQL versions 5.5.*
1007+# 5.6 - XtraBackup for MySQL version 5.6
1008
1009 LIBS += -lpthread `libgcrypt-config --libs`
1010 DEFS = -DUNIV_LINUX -DMYSQL_SERVER
1011@@ -41,6 +42,7 @@
1012 xbstream_write.o \
1013 quicklz/quicklz.o
1014 XTRABACKUPCCOBJS = xtrabackup.o innodb_int.o compact.o fil_cur.o write_filt.o
1015+
1016 XBSTREAMOBJS = xbstream.o xbstream_write.o xbstream_read.o
1017
1018 XBCRYPTOBJS = xbcrypt.o xbcrypt_common.o xbcrypt_read.o xbcrypt_write.o
1019@@ -122,6 +124,29 @@
1020 sed -e 's/C_DEFINES = //')
1021 5.5: $(TARGET) xbstream xbcrypt
1022
1023+# XtraBackup for MySQL 5.6
1024+5.6: INC = $(COMMON_INC) $(addprefix -isystem$(MYSQL_ROOT_DIR)/, \
1025+ include sql storage/innobase/include sql)
1026+5.6: INNODBOBJS =
1027+
1028+ifeq "$(wildcard $(MYSQL_ROOT_DIR)/zlib/.libs/libzlt.a)" ""
1029+5.6: LIBZ= -lz
1030+else
1031+5.6: LIBZ= $(MYSQL_ROOT_DIR)/zlib/.libs/libzlt.a
1032+endif
1033+
1034+5.6: MYSQLOBJS = $(MYSQL_ROOT_DIR)/libmysqld/libmysqld.a
1035+ifeq ($(shell uname -s),Linux)
1036+5.6: LIBS += -laio -ldl -lcrypt
1037+endif
1038+5.6: TARGET := xtrabackup_innodb56
1039+# In CMake server builds it is important to build with exactly the same preprocessor flags
1040+# as were used to build InnoDB
1041+5.6: DEFS = $(shell grep CXX_DEFINES \
1042+ $(MYSQL_ROOT_DIR)/storage/innobase/CMakeFiles/innobase.dir/flags.make | \
1043+ sed -e 's/CXX_DEFINES = //')
1044+5.6: $(TARGET) xbstream xbcrypt
1045+
1046 # XtraBackup for XtraDB
1047 xtradb: INC = $(COMMON_INC) $(addprefix -isystem$(MYSQL_ROOT_DIR)/, \
1048 include storage/innodb_plugin/include)
1049@@ -198,13 +223,13 @@
1050 $(CC) $(CFLAGS) $(INC) $(DEFS) -c $< -o $@
1051
1052 xbstream: $(XBSTREAMOBJS) $(MYSQLOBJS) ds_local.o ds_buffer.o ds_stdout.o datasink.o
1053- $(CC) $(CFLAGS) $^ $(INC) $(MYSQLOBJS) $(LIBS) -o $@
1054+ $(CXX) $(CXXFLAGS) $^ $(INC) $(MYSQLOBJS) $(LIBS) -o $@
1055
1056 xbcrypt.o xbcrypt_read.o: %.o: %.c
1057 $(CC) $(CFLAGS) $(INC) $(DEFS) -c $< -o $@
1058
1059 xbcrypt: $(XBCRYPTOBJS) $(MYSQLOBJS)
1060- $(CC) $(CFLAGS) $^ $(INC) $(MYSQLOBJS) $(LIBS) -o $@
1061+ $(CXX) $(CXXFLAGS) $^ $(INC) $(MYSQLOBJS) $(LIBS) -o $@
1062
1063 xtrabackup.o: xtrabackup.cc xb_regex.h write_filt.h fil_cur.h xtrabackup.h compact.h
1064
1065
1066=== modified file 'src/compact.cc'
1067--- src/compact.cc 2013-02-20 10:20:00 +0000
1068+++ src/compact.cc 2013-03-22 15:32:33 +0000
1069@@ -24,6 +24,9 @@
1070
1071 #include <my_base.h>
1072 #include "common.h"
1073+#if MYSQL_VERSION_ID >= 50600
1074+#include "table.h"
1075+#endif
1076 #include "innodb_int.h"
1077 #include "write_filt.h"
1078 #include "fil_cur.h"
1079@@ -649,65 +652,6 @@
1080 compacted_page_magic, compacted_page_magic_size);
1081 }
1082
1083-/********************************************************************//**
1084-Determine the flags of a table described in SYS_TABLES.
1085-@return compressed page size in kilobytes; or 0 if the tablespace is
1086-uncompressed, ULINT_UNDEFINED on error */
1087-static
1088-ulint
1089-dict_sys_tables_get_flags(
1090-/*======================*/
1091- const rec_t* rec) /*!< in: a record of SYS_TABLES */
1092-{
1093- const byte* field;
1094- ulint len;
1095- ulint n_cols;
1096- ulint flags;
1097-
1098- field = rec_get_nth_field_old(rec, 5, &len);
1099- ut_a(len == 4);
1100-
1101- flags = mach_read_from_4(field);
1102-
1103- if (UNIV_LIKELY(flags == DICT_TABLE_ORDINARY)) {
1104- return(0);
1105- }
1106-
1107- field = rec_get_nth_field_old(rec, 4/*N_COLS*/, &len);
1108- n_cols = mach_read_from_4(field);
1109-
1110- if (UNIV_UNLIKELY(!(n_cols & 0x80000000UL))) {
1111- /* New file formats require ROW_FORMAT=COMPACT. */
1112- return(ULINT_UNDEFINED);
1113- }
1114-
1115- switch (flags & (DICT_TF_FORMAT_MASK | DICT_TF_COMPACT)) {
1116- default:
1117- case DICT_TF_FORMAT_51 << DICT_TF_FORMAT_SHIFT:
1118- case DICT_TF_FORMAT_51 << DICT_TF_FORMAT_SHIFT | DICT_TF_COMPACT:
1119- /* flags should be DICT_TABLE_ORDINARY,
1120- or DICT_TF_FORMAT_MASK should be nonzero. */
1121- return(ULINT_UNDEFINED);
1122-
1123- case DICT_TF_FORMAT_ZIP << DICT_TF_FORMAT_SHIFT | DICT_TF_COMPACT:
1124- /* We support this format. */
1125- break;
1126- }
1127-
1128- if (UNIV_UNLIKELY((flags & DICT_TF_ZSSIZE_MASK)
1129- > (DICT_TF_ZSSIZE_MAX << DICT_TF_ZSSIZE_SHIFT))) {
1130- /* Unsupported compressed page size. */
1131- return(ULINT_UNDEFINED);
1132- }
1133-
1134- if (UNIV_UNLIKELY(flags & (~0 << DICT_TF_BITS))) {
1135- /* Some unused bits are set. */
1136- return(ULINT_UNDEFINED);
1137- }
1138-
1139- return(flags);
1140-}
1141-
1142 /*****************************************************************************
1143 Builds an index definition corresponding to an index object. It is roughly
1144 similar to innobase_create_index_def() / innobase_create_index_field_def() and
1145@@ -718,11 +662,11 @@
1146 /*=======================*/
1147 mem_heap_t* heap, /*!< in: heap */
1148 const dict_index_t* index, /*!< in: index */
1149- merge_index_def_t* index_def) /*!< out: index definition */
1150+ index_def_t* index_def) /*!< out: index definition */
1151 {
1152- merge_index_field_t* fields;
1153- ulint n_fields;
1154- ulint i;
1155+ index_field_t* fields;
1156+ ulint n_fields;
1157+ ulint i;
1158
1159 ut_a(index->n_fields);
1160 ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
1161@@ -738,22 +682,30 @@
1162 index_def->name = mem_heap_strdup(heap, index->name);
1163 index_def->ind_type = index->type;
1164
1165- fields = static_cast<merge_index_field_t *>
1166+ fields = static_cast<index_field_t *>
1167 (mem_heap_alloc(heap, n_fields * sizeof(*fields)));
1168
1169 for (i = 0; i < n_fields; i++) {
1170 dict_field_t* field;
1171
1172 field = dict_index_get_nth_field(index, i);
1173+ xb_dict_index_field_to_index_field(heap, field, &fields[i]);
1174
1175- fields[i].field_name = mem_heap_strdup(heap, field->name);
1176- fields[i].prefix_len = field->prefix_len;
1177 }
1178
1179 index_def->fields = fields;
1180 index_def->n_fields = n_fields;
1181 }
1182
1183+#if MYSQL_VERSION_ID >= 50600
1184+/* A dummy autoc_inc sequence for row_merge_build_indexes(). */
1185+static ib_sequence_t null_seq(NULL, 0, 0);
1186+/* A dummy table share and table for row_merge_build_indexes() error reporting.
1187+Assumes that no errors are going to be reported. */
1188+static struct TABLE_SHARE dummy_table_share;
1189+static struct TABLE dummy_table;
1190+#endif
1191+
1192 /********************************************************************//**
1193 Rebuild secondary indexes for a given table. */
1194 static
1195@@ -763,13 +715,16 @@
1196 dict_table_t* table, /*!< in: table */
1197 trx_t* trx) /*!< in: transaction handle */
1198 {
1199- dict_index_t* index;
1200- dict_index_t** indexes;
1201- ulint n_indexes;
1202- merge_index_def_t* index_defs;
1203- ulint i;
1204- mem_heap_t* heap;
1205- ulint error;
1206+ dict_index_t* index;
1207+ dict_index_t** indexes;
1208+ ulint n_indexes;
1209+ index_def_t* index_defs;
1210+ ulint i;
1211+ mem_heap_t* heap;
1212+ ulint error;
1213+#if MYSQL_VERSION_ID >= 50600
1214+ ulint* add_key_nums;
1215+#endif
1216
1217 ut_ad(mutex_own(&(dict_sys->mutex)));
1218 ut_ad(table);
1219@@ -786,42 +741,98 @@
1220
1221 indexes = (dict_index_t**) mem_heap_alloc(heap,
1222 n_indexes * sizeof(*indexes));
1223- index_defs = (merge_index_def_t*) mem_heap_alloc(heap,
1224- n_indexes *
1225+ index_defs = (index_def_t*) mem_heap_alloc(heap, n_indexes *
1226 sizeof(*index_defs));
1227+#if MYSQL_VERSION_ID >= 50600
1228+ add_key_nums = static_cast<ulint *>
1229+ (mem_heap_alloc(heap, n_indexes * sizeof(*add_key_nums)));
1230+#endif
1231
1232 /* Skip the primary key. */
1233 index = dict_table_get_first_index(table);
1234 ut_a(dict_index_is_clust(index));
1235
1236+ msg(" Dropping %lu index(es).\n", n_indexes);
1237+
1238 for (i = 0; (index = dict_table_get_next_index(index)); i++) {
1239
1240 msg(" Found index %s\n", index->name);
1241
1242+ /* Pretend that it's the current trx that created this index.
1243+ Required to avoid 5.6+ debug assertions. */
1244+ index->trx_id = xb_trx_id_to_index_trx_id(trx->id);
1245+
1246+ xb_build_index_def(heap, index, &index_defs[i]);
1247+
1248+#if MYSQL_VERSION_ID >= 50600
1249+ /* In 5.6+, row_merge_drop_indexes() drops all the indexes on
1250+ the table that have the temp index prefix. It does not accept
1251+ an array of indexes to drop as in 5.5-. */
1252+ row_merge_rename_index_to_drop(trx, table->id, index->id);
1253+#else
1254 indexes[i] = index;
1255-
1256- xb_build_index_def(heap, index, &index_defs[i]);
1257+#endif
1258 }
1259
1260 ut_ad(i == n_indexes);
1261
1262- msg(" Dropping %lu index(es).\n", n_indexes);
1263-
1264+#if MYSQL_VERSION_ID >= 50600
1265+ ut_d(table->n_ref_count++);
1266+ row_merge_drop_indexes(trx, table, TRUE);
1267+ ut_d(table->n_ref_count--);
1268+
1269+ index = dict_table_get_first_index(table);
1270+ ut_a(dict_index_is_clust(index));
1271+ index = dict_table_get_next_index(index);
1272+ while (index) {
1273+
1274+ /* In 5.6+, row_merge_drop_indexes() does not remove the
1275+ indexes from the dictionary cache nor from any foreign key
1276+ list. This may cause invalid dereferences as we try to access
1277+ the dropped indexes from other tables as FKs. */
1278+
1279+ dict_index_t* next_index = dict_table_get_next_index(index);
1280+ index->to_be_dropped = 1;
1281+
1282+ /* Patch up any FK referencing this index with NULL */
1283+ dict_foreign_replace_index(table, index, trx);
1284+
1285+ dict_index_remove_from_cache(table, index);
1286+
1287+ index = next_index;
1288+ }
1289+#else
1290 row_merge_drop_indexes(trx, table, indexes, n_indexes);
1291+#endif
1292
1293 msg(" Rebuilding %lu index(es).\n", n_indexes);
1294
1295- row_merge_lock_table(trx, table, LOCK_X);
1296+ error = row_merge_lock_table(trx, table, LOCK_X);
1297+ xb_a(error == DB_SUCCESS);
1298
1299 for (i = 0; i < n_indexes; i++) {
1300- indexes[i] = row_merge_create_index(trx, table, &index_defs[i]);
1301+ indexes[i] = row_merge_create_index(trx, table,
1302+ &index_defs[i]);
1303+#if MYSQL_VERSION_ID >= 50600
1304+ add_key_nums[i] = index_defs[i].key_number;
1305+#endif
1306 }
1307
1308+#if MYSQL_VERSION_ID >= 50600
1309+ error = row_merge_build_indexes(trx, table, table, FALSE, indexes,
1310+ add_key_nums, n_indexes, &dummy_table,
1311+ NULL, NULL, ULINT_UNDEFINED, null_seq);
1312+#else
1313 error = row_merge_build_indexes(trx, table, table, indexes, n_indexes,
1314 NULL);
1315+#endif
1316 ut_a(error == DB_SUCCESS);
1317
1318 mem_heap_free(heap);
1319+
1320+ trx_commit_for_mysql(trx);
1321+
1322+ trx_start_for_ddl(trx, TRX_DICT_OP_INDEX);
1323 }
1324
1325 /******************************************************************************
1326@@ -839,14 +850,20 @@
1327 const byte* field;
1328 ulint len;
1329 ulint space_id;
1330- ulint flags;
1331 char* name;
1332 dict_table_t* table;
1333 trx_t* trx;
1334
1335+#if MYSQL_VERSION_ID >= 50600
1336+ /* Set up the dummy table for the index rebuild error reporting */
1337+ dummy_table_share.fields = 0;
1338+ dummy_table.s = &dummy_table_share;
1339+#endif
1340+
1341 /* Iterate all tables that are not in the system tablespace. */
1342
1343 trx = trx_allocate_for_mysql();
1344+ trx_start_for_ddl(trx, TRX_DICT_OP_INDEX);
1345
1346 /* Suppress foreign key checks, as we are going to drop and recreate all
1347 secondary keys. */
1348@@ -856,9 +873,7 @@
1349
1350 /* Enlarge the fatal lock wait timeout during index rebuild
1351 operation. */
1352- mutex_enter(&kernel_mutex);
1353- srv_fatal_semaphore_wait_threshold += 7200; /* 2 hours */
1354- mutex_exit(&kernel_mutex);
1355+ xb_adjust_fatal_semaphore_wait_threshold(7200); /* 2 hours */
1356
1357 mtr_start(&mtr);
1358
1359@@ -866,8 +881,8 @@
1360 sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
1361 ut_a(!dict_table_is_comp(sys_tables));
1362
1363- btr_pcur_open_at_index_side(TRUE, sys_index, BTR_SEARCH_LEAF, &pcur,
1364- TRUE, &mtr);
1365+ xb_btr_pcur_open_at_index_side(TRUE, sys_index, BTR_SEARCH_LEAF, &pcur,
1366+ TRUE, 0, &mtr);
1367 for (;;) {
1368 btr_pcur_move_to_next_user_rec(&pcur, &mtr);
1369
1370@@ -897,25 +912,6 @@
1371 field = rec_get_nth_field_old(rec, 0, &len);
1372 name = mem_strdupl((char*) field, len);
1373
1374- flags = dict_sys_tables_get_flags(rec);
1375- if (UNIV_UNLIKELY(flags == ULINT_UNDEFINED)) {
1376-
1377- field = rec_get_nth_field_old(rec, 5, &len);
1378- flags = mach_read_from_4(field);
1379-
1380- ut_print_timestamp(stderr);
1381- fputs(" InnoDB: Error: table ", stderr);
1382- ut_print_filename(stderr, name);
1383- fprintf(stderr, "\n"
1384- "InnoDB: in InnoDB data dictionary"
1385- " has unknown type %lx.\n",
1386- (ulong) flags);
1387-
1388- mem_free(name);
1389-
1390- continue;
1391- }
1392-
1393 btr_pcur_store_position(&pcur, &mtr);
1394
1395 mtr_commit(&mtr);
1396@@ -933,11 +929,6 @@
1397
1398 mem_free(name);
1399
1400- /* Temporarily unlock the data dictionary to avoid long
1401- semaphore waits. */
1402- row_mysql_unlock_data_dictionary(trx);
1403- row_mysql_lock_data_dictionary(trx);
1404-
1405 mtr_start(&mtr);
1406
1407 btr_pcur_restore_position(BTR_SEARCH_LEAF, &pcur, &mtr);
1408
1409=== modified file 'src/ds_encrypt.c'
1410--- src/ds_encrypt.c 2013-03-11 19:11:29 +0000
1411+++ src/ds_encrypt.c 2013-03-22 15:32:33 +0000
1412@@ -20,7 +20,6 @@
1413
1414
1415 #include <my_base.h>
1416-#include <univ.i>
1417 #include "common.h"
1418 #include "datasink.h"
1419 #include <gcrypt.h>
1420@@ -169,8 +168,8 @@
1421
1422 /* Set up the iv length */
1423 encrypt_iv_len = gcry_cipher_get_algo_blklen(encrypt_algo);
1424- ut_a(encrypt_iv_len > 0);
1425- ut_a(encrypt_iv_len <= sizeof(encrypt_iv));
1426+ xb_a(encrypt_iv_len > 0);
1427+ xb_a(encrypt_iv_len <= sizeof(encrypt_iv));
1428
1429 /* Now set up the key */
1430 if (xtrabackup_encrypt_key == NULL &&
1431@@ -330,7 +329,7 @@
1432 &thd->data_mutex);
1433 }
1434
1435- ut_a(threads[i].to_len > 0);
1436+ xb_a(threads[i].to_len > 0);
1437
1438 if (xb_crypt_write_chunk(crypt_file->xbcrypt_file,
1439 threads[i].to,
1440
1441=== modified file 'src/fil_cur.cc'
1442--- src/fil_cur.cc 2013-03-05 15:25:00 +0000
1443+++ src/fil_cur.cc 2013-03-22 15:32:33 +0000
1444@@ -156,28 +156,23 @@
1445 {
1446 ibool success;
1447 ulint page_size;
1448- ulint offset_high;
1449- ulint offset_low;
1450 byte* page;
1451 ulint i;
1452 ulint npages;
1453 ulint retry_count;
1454 xb_fil_cur_result_t ret;
1455- IB_INT64 to_read;
1456+ ib_int64_t to_read;
1457
1458 page_size = cursor->page_size;
1459
1460- offset_high = (ulint) (cursor->offset >> 32);
1461- offset_low = (ulint) (cursor->offset & 0xFFFFFFFFUL);
1462-
1463- to_read = (IB_INT64) cursor->statinfo.st_size - cursor->offset;
1464+ to_read = (ib_int64_t) cursor->statinfo.st_size - cursor->offset;
1465
1466 if (to_read == 0LL) {
1467 return(XB_FIL_CUR_EOF);
1468 }
1469
1470- if (to_read > (IB_INT64) cursor->buf_size) {
1471- to_read = (IB_INT64) cursor->buf_size;
1472+ if (to_read > (ib_int64_t) cursor->buf_size) {
1473+ to_read = (ib_int64_t) cursor->buf_size;
1474 }
1475 ut_a(to_read > 0 && to_read <= 0xFFFFFFFFLL);
1476 ut_a(to_read % page_size == 0);
1477@@ -196,8 +191,8 @@
1478 cursor->buf_page_no = (ulint) (cursor->offset >>
1479 cursor->page_size_shift);
1480
1481- success = os_file_read(cursor->file, cursor->buf,
1482- offset_low, offset_high, to_read);
1483+ success = xb_os_file_read(cursor->file, cursor->buf, cursor->offset,
1484+ to_read);
1485 if (!success) {
1486 return(XB_FIL_CUR_ERROR);
1487 }
1488
1489=== modified file 'src/fil_cur.h'
1490--- src/fil_cur.h 2013-01-14 11:02:59 +0000
1491+++ src/fil_cur.h 2013-03-22 15:32:33 +0000
1492@@ -38,7 +38,7 @@
1493 UNIV_PAGE_SIZE for uncompressed ones */
1494 ulint page_size_shift;/*!< bit shift corresponding to
1495 page_size */
1496- IB_INT64 offset; /*!< current file offset in bytes */
1497+ ib_int64_t offset; /*!< current file offset in bytes */
1498 my_bool is_system; /*!< TRUE for system tablespace, FALSE
1499 otherwise */
1500 byte* orig_buf; /*!< read buffer */
1501@@ -48,7 +48,7 @@
1502 after the last cursor read */
1503 ulint buf_npages; /*!< number of pages in buffer after the
1504 last cursor read */
1505- IB_INT64 buf_offset; /*!< file offset of the first page in
1506+ ib_int64_t buf_offset; /*!< file offset of the first page in
1507 buffer */
1508 ulint buf_page_no; /*!< number of the first page in
1509 buffer */
1510
1511=== modified file 'src/innodb_int.cc'
1512--- src/innodb_int.cc 2013-02-20 10:20:00 +0000
1513+++ src/innodb_int.cc 2013-03-22 15:32:33 +0000
1514@@ -31,7 +31,21 @@
1515
1516 extern long innobase_lock_wait_timeout;
1517
1518+#if MYSQL_VERSION_ID < 50600
1519 char *opt_mysql_tmpdir = NULL;
1520+#endif
1521+
1522+#if MYSQL_VERSION_ID >= 50600
1523+const char* xb_dict_prefix = "";
1524+#else
1525+const char* xb_dict_prefix = "./";
1526+#endif
1527+
1528+#if MYSQL_VERSION_ID < 50600
1529+char* innobase_log_group_home_dir = NULL;
1530+#endif
1531+
1532+long innobase_mirrored_log_groups = 1;
1533
1534 /****************************************************************//**
1535 A simple function to open or create a file.
1536@@ -89,12 +103,22 @@
1537 ulint type, /*!< in: OS_DATA_FILE or OS_LOG_FILE */
1538 ibool* success)/*!< out: TRUE if succeed, FALSE if error */
1539 {
1540+ os_file_t result;
1541+#if MYSQL_VERSION_ID >= 50600
1542+ ibool old_srv_read_only_mode = srv_read_only_mode;
1543+
1544+ srv_read_only_mode = FALSE;
1545+#endif
1546 #if MYSQL_VERSION_ID > 50500
1547- return os_file_create(0 /* innodb_file_data_key */,
1548- name, create_mode, purpose, type, success);
1549+ result = os_file_create(0 /* innodb_file_data_key */,
1550+ name, create_mode, purpose, type, success);
1551 #else
1552- return os_file_create(name, create_mode, purpose, type, success);
1553-#endif
1554+ result= os_file_create(name, create_mode, purpose, type, success);
1555+#endif
1556+#if MYSQL_VERSION_ID >= 50600
1557+ srv_read_only_mode = old_srv_read_only_mode;
1558+#endif
1559+ return result;
1560 }
1561
1562 /***********************************************************************//**
1563@@ -215,8 +239,8 @@
1564 return ret;
1565 }
1566
1567- ret = os_file_set_size(path, *file,
1568- FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE, 0);
1569+ ret = xb_os_file_set_size(path, *file,
1570+ FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE);
1571 if (!ret) {
1572 msg("xtrabackup: cannot set size for file %s\n", path);
1573 os_file_close(*file);
1574@@ -233,18 +257,16 @@
1575 fsp_header_init_fields(page, space_id, flags);
1576 mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, space_id);
1577
1578- if (!(flags & DICT_TF_ZSSIZE_MASK)) {
1579+ if (!fsp_flags_is_compressed(flags)) {
1580 buf_flush_init_for_writing(page, NULL, 0);
1581
1582- ret = os_file_write(path, *file, page, 0, 0, UNIV_PAGE_SIZE);
1583+ ret = xb_os_file_write(path, *file, page, 0, UNIV_PAGE_SIZE);
1584 }
1585 else {
1586 page_zip_des_t page_zip;
1587 ulint zip_size;
1588
1589- zip_size = (PAGE_ZIP_MIN_SIZE >> 1)
1590- << ((flags & DICT_TF_ZSSIZE_MASK)
1591- >> DICT_TF_ZSSIZE_SHIFT);
1592+ zip_size = fsp_flags_get_zip_size(flags);
1593 page_zip_set_size(&page_zip, zip_size);
1594 page_zip.data = page + UNIV_PAGE_SIZE;
1595 fprintf(stderr, "zip_size = %lu\n", zip_size);
1596@@ -257,8 +279,8 @@
1597
1598 buf_flush_init_for_writing(page, &page_zip, 0);
1599
1600- ret = os_file_write(path, *file, page_zip.data, 0, 0,
1601- zip_size);
1602+ ret = xb_os_file_write(path, *file, page_zip.data, 0,
1603+ zip_size);
1604 }
1605
1606 ut_free(buf);
1607@@ -298,6 +320,7 @@
1608 srv_lock_table_size = 5 * (srv_buf_pool_size / UNIV_PAGE_SIZE);
1609 }
1610
1611+#if MYSQL_VERSION_ID < 50600
1612
1613 void
1614 innobase_invalidate_query_cache(
1615@@ -650,6 +673,8 @@
1616 return(FALSE);
1617 }
1618
1619+#endif /* MYSQL_VERSION_ID < 50600 */
1620+
1621 #ifdef XTRADB_BASED
1622 trx_t*
1623 innobase_get_trx()
1624@@ -664,6 +689,8 @@
1625 }
1626 #endif
1627
1628+#if MYSQL_VERSION_ID < 50600
1629+
1630 extern "C" {
1631
1632 ibool
1633@@ -848,8 +875,6 @@
1634 return(fd2);
1635 }
1636
1637-} /* extern "C" */
1638-
1639 /* The following is used by row0merge for error reporting. Define a stub so we
1640 can use fast index creation from XtraBackup. */
1641 void
1642@@ -871,7 +896,11 @@
1643 {
1644 }
1645
1646-#if MYSQL_VERSION_ID >= 50507
1647+} /* extern "C" */
1648+
1649+#endif /* MYSQL_VERSION_ID < 50600 */
1650+
1651+#if (MYSQL_VERSION_ID >= 50507) && (MYSQL_VERSION_ID < 50600)
1652 /*
1653 As of MySQL 5.5.7, InnoDB uses thd_wait plugin service.
1654 We have to provide mock functions to avoid linker errors.
1655@@ -892,7 +921,7 @@
1656 return;
1657 }
1658
1659-#endif /* MYSQL_VERSION_ID >= 50507 */
1660+#endif /* (MYSQL_VERSION_ID >= 50507) && (MYSQL_VERSION_ID < 50600) */
1661
1662 #ifdef XTRADB_BASED
1663 /******************************************************************//*******
1664@@ -905,3 +934,200 @@
1665 return(FALSE);
1666 }
1667 #endif /* XTRADB_BASED */
1668+
1669+#if MYSQL_VERSION_ID >= 50600
1670+
1671+/*********************************************************************//**
1672+Creates or opens the log files and closes them.
1673+@return DB_SUCCESS or error code */
1674+ulint
1675+open_or_create_log_file(
1676+/*====================*/
1677+ ibool create_new_db, /*!< in: TRUE if we should create a
1678+ new database */
1679+ ibool* log_file_created, /*!< out: TRUE if new log file
1680+ created */
1681+ ibool log_file_has_been_opened,/*!< in: TRUE if a log file has been
1682+ opened before: then it is an error
1683+ to try to create another log file */
1684+ ulint k, /*!< in: log group number */
1685+ ulint i) /*!< in: log file number in group */
1686+{
1687+ ibool ret;
1688+ os_offset_t size;
1689+ char name[10000];
1690+ ulint dirnamelen;
1691+
1692+ UT_NOT_USED(create_new_db);
1693+ UT_NOT_USED(log_file_has_been_opened);
1694+ UT_NOT_USED(k);
1695+ ut_ad(k == 0);
1696+
1697+ *log_file_created = FALSE;
1698+
1699+ srv_normalize_path_for_win(srv_log_group_home_dir);
1700+
1701+ dirnamelen = strlen(srv_log_group_home_dir);
1702+ ut_a(dirnamelen < (sizeof name) - 10 - sizeof "ib_logfile");
1703+ memcpy(name, srv_log_group_home_dir, dirnamelen);
1704+
1705+ /* Add a path separator if needed. */
1706+ if (dirnamelen && name[dirnamelen - 1] != SRV_PATH_SEPARATOR) {
1707+ name[dirnamelen++] = SRV_PATH_SEPARATOR;
1708+ }
1709+
1710+ sprintf(name + dirnamelen, "%s%lu", "ib_logfile", (ulong) i);
1711+
1712+ files[i] = os_file_create(innodb_file_log_key, name,
1713+ OS_FILE_OPEN, OS_FILE_NORMAL,
1714+ OS_LOG_FILE, &ret);
1715+ if (ret == FALSE) {
1716+ fprintf(stderr, "InnoDB: Error in opening %s\n", name);
1717+
1718+ return(DB_ERROR);
1719+ }
1720+
1721+ size = os_file_get_size(files[i]);
1722+
1723+ if (size != srv_log_file_size * UNIV_PAGE_SIZE) {
1724+
1725+ fprintf(stderr,
1726+ "InnoDB: Error: log file %s is"
1727+ " of different size " UINT64PF " bytes\n"
1728+ "InnoDB: than specified in the .cnf"
1729+ " file " UINT64PF " bytes!\n",
1730+ name, size, srv_log_file_size * UNIV_PAGE_SIZE);
1731+
1732+ return(DB_ERROR);
1733+ }
1734+
1735+ ret = os_file_close(files[i]);
1736+ ut_a(ret);
1737+
1738+ if (i == 0) {
1739+ /* Create in memory the file space object
1740+ which is for this log group */
1741+
1742+ fil_space_create(name,
1743+ 2 * k + SRV_LOG_SPACE_FIRST_ID, 0, FIL_LOG);
1744+ }
1745+
1746+ ut_a(fil_validate());
1747+
1748+ ut_a(fil_node_create(name, srv_log_file_size,
1749+ 2 * k + SRV_LOG_SPACE_FIRST_ID, FALSE));
1750+ if (i == 0) {
1751+ log_group_init(k, srv_n_log_files,
1752+ srv_log_file_size * UNIV_PAGE_SIZE,
1753+ 2 * k + SRV_LOG_SPACE_FIRST_ID,
1754+ SRV_LOG_SPACE_FIRST_ID + 1); /* dummy arch
1755+ space id */
1756+ }
1757+
1758+ return(DB_SUCCESS);
1759+}
1760+
1761+#endif /* MYSQL_VERSION_ID >= 50600 */
1762+
1763+/*****************************************************************//**
1764+Parse, validate, and set the InnoDB variables from
1765+innodb_log_group_home_dir and innodb_mirrored_log_group_groups
1766+options.
1767+
1768+@return TRUE if server variables set OK, FALSE otherwise */
1769+ibool
1770+xb_parse_log_group_home_dirs(void)
1771+/*==============================*/
1772+{
1773+ ibool ret = TRUE;
1774+#if MYSQL_VERSION_ID < 50600
1775+ ret = srv_parse_log_group_home_dirs(INNODB_LOG_DIR);
1776+
1777+ if (ret == FALSE || innobase_mirrored_log_groups != 1) {
1778+
1779+ msg("xtrabackup: syntax error in innodb_log_group_home_dir, "
1780+ "or a wrong number of mirrored log groups\n");
1781+ ret = FALSE;
1782+ }
1783+ srv_n_log_groups = (ulint) innobase_mirrored_log_groups;
1784+#else
1785+ srv_normalize_path_for_win(srv_log_group_home_dir);
1786+
1787+ if (strchr(srv_log_group_home_dir, ';')
1788+ || innobase_mirrored_log_groups != 1) {
1789+
1790+ msg("syntax error in innodb_log_group_home_dir, "
1791+ "or a wrong number of mirrored log groups");
1792+ ret = FALSE;
1793+ }
1794+#endif
1795+ return ret;
1796+}
1797+
1798+/*****************************************************************//**
1799+Set InnoDB to read-only mode. */
1800+void
1801+xb_set_innodb_read_only(void)
1802+/*=========================*/
1803+{
1804+#if MYSQL_VERSION_ID >= 50600
1805+ srv_read_only_mode = TRUE;
1806+#else
1807+ srv_read_only = TRUE;
1808+#endif
1809+}
1810+
1811+/*****************************************************************//**
1812+Adjust srv_fatal_semaphore_wait_threshold in a thread-safe manner. */
1813+void
1814+xb_adjust_fatal_semaphore_wait_threshold(
1815+/*=====================================*/
1816+ ulint delta) /*!<in: threshold adjustment delta in seconds */
1817+{
1818+#if MYSQL_VERSION_ID >= 50600
1819+ os_increment_counter_by_amount(server_mutex,
1820+ srv_fatal_semaphore_wait_threshold,
1821+ delta);
1822+#else
1823+ mutex_enter(&kernel_mutex);
1824+ srv_fatal_semaphore_wait_threshold += delta;
1825+ mutex_exit(&kernel_mutex);
1826+#endif
1827+}
1828+
1829+/*****************************************************************//**
1830+Wrapper around around recv_check_cp_is_consistent() for handling
1831+version differences.
1832+
1833+@return TRUE if checkpoint info in the buffer is OK */
1834+ibool
1835+xb_recv_check_cp_is_consistent(
1836+/*===========================*/
1837+ const byte* buf) /*!<in: buffer containing checkpoint info */
1838+{
1839+#if MYSQL_VERSION_ID >= 50600
1840+ return recv_check_cp_is_consistent(buf);
1841+#else
1842+ return recv_check_cp_is_consistent(const_cast<byte *>(buf));
1843+#endif
1844+}
1845+
1846+/*****************************************************************//**
1847+Initialize a index_field_t variable from a dict_field_t */
1848+void
1849+xb_dict_index_field_to_index_field(
1850+/*===============================*/
1851+ mem_heap_t* heap __attribute__((unused)),/*!< in: heap for
1852+ field name string allocation on
1853+ 5.5 or earlier version. */
1854+ const dict_field_t* dict_index_field, /*!< in: field */
1855+ index_field_t* index_field) /*!< out: field */
1856+{
1857+#if MYSQL_VERSION_ID >= 50600
1858+ index_field->col_no = dict_col_get_no(dict_index_field->col);
1859+#else
1860+ index_field->field_name = mem_heap_strdup(heap,
1861+ dict_index_field->name);
1862+#endif
1863+ index_field->prefix_len = dict_index_field->prefix_len;
1864+}
1865
1866=== modified file 'src/innodb_int.h'
1867--- src/innodb_int.h 2013-02-20 10:20:00 +0000
1868+++ src/innodb_int.h 2013-03-22 15:32:33 +0000
1869@@ -25,11 +25,14 @@
1870 #ifndef INNODB_INT_H
1871 #define INNODB_INT_H
1872
1873+#include <mysql_version.h>
1874 #include <my_base.h>
1875
1876 /* Only include InnoDB headers here, please keep the list sorted */
1877
1878+#if MYSQL_VERSION_ID < 50600
1879 extern "C" {
1880+#endif
1881
1882 #include <univ.i>
1883
1884@@ -43,10 +46,17 @@
1885 #include <dict0crea.h>
1886 #include <dict0dict.h>
1887 #include <dict0load.h>
1888+#if MYSQL_VERSION_ID >= 50600
1889+#include <dict0priv.h>
1890+#include <dict0stats.h>
1891+#endif
1892 #include <fil0fil.h>
1893 #include <fsp0fsp.h>
1894 #include <fsp0types.h>
1895 #include <ha_prototypes.h>
1896+#if MYSQL_VERSION_ID >= 50600
1897+#include <handler0alter.h>
1898+#endif
1899 #include <hash0hash.h>
1900 #include <ibuf0ibuf.h>
1901 #include <lock0lock.h>
1902@@ -54,6 +64,7 @@
1903 #include <log0recv.h>
1904 #include <mtr0mtr.h>
1905 #include <os0file.h>
1906+#include <os0sync.h>
1907 #include <os0thread.h>
1908 #include <page0page.h>
1909 #include <page0zip.h>
1910@@ -70,13 +81,17 @@
1911 #include <trx0sys.h>
1912 #include <trx0trx.h>
1913 #include <trx0xa.h>
1914+#if MYSQL_VERSION_ID >= 50600
1915+#include <ut0crc32.h>
1916+#endif
1917 #include <ut0mem.h>
1918
1919+#if MYSQL_VERSION_ID < 50600
1920 }
1921+#endif
1922
1923-# define IB_INT64 ib_int64_t
1924-# define LSN64 ib_uint64_t
1925 # if (MYSQL_VERSION_ID < 50500)
1926+ /* MySQL and Percona Server 5.1 */
1927 # define MACH_READ_64 mach_read_ull
1928 # define MACH_WRITE_64 mach_write_ull
1929 # define INDEX_ID_T dulint
1930@@ -84,15 +99,107 @@
1931 ((a).high - (b).high) : \
1932 ((a).low - (b).low))
1933 # define OS_MUTEX_CREATE() os_mutex_create(NULL)
1934-# else
1935+# define xb_os_file_write(name, file, buf, offset, n) \
1936+ os_file_write(name, file, buf, \
1937+ (ulint)(offset & 0xFFFFFFFFUL), \
1938+ (ulint)(((ullint)offset) >> 32), \
1939+ n)
1940+# define xb_os_file_read(file, buf, offset, n) \
1941+ os_file_read(file, buf, \
1942+ (ulint)(offset & 0xFFFFFFFFUL), \
1943+ (ulint)(((ullint)offset) >> 32), \
1944+ n)
1945+# define xb_trx_id_to_index_trx_id(trx_id) \
1946+ ((ib_uint64_t) ut_conv_dulint_to_longlong(trx_id))
1947+# else /* MYSQL_VERSION_ID < 50500 */
1948+ /* MySQL and Percona Server 5.5+ */
1949 # define MACH_READ_64 mach_read_from_8
1950 # define MACH_WRITE_64 mach_write_to_8
1951 # define INDEX_ID_T index_id_t
1952 # define INDEX_ID_CMP(a,b) ((a) - (b))
1953 # define OS_MUTEX_CREATE() os_mutex_create()
1954-# endif
1955+# define xb_trx_id_to_index_trx_id(trx_id) (trx_id)
1956+# endif /* MYSQL_VERSION_ID < 50500 */
1957+# if (MYSQL_VERSION_ID >= 50600)
1958+ /* MySQL 5.6+ */
1959+# define PAGE_ZIP_MIN_SIZE_SHIFT 10
1960+# define DICT_TF_ZSSIZE_SHIFT 1
1961+# define DICT_TF_FORMAT_ZIP 1
1962+# define DICT_TF_FORMAT_SHIFT 5
1963+# define xb_os_file_read(file, buf, offset, n) \
1964+ pfs_os_file_read_func(file, buf, offset, n, __FILE__, __LINE__)
1965+# define xb_os_file_write(name, file, buf, offset, n) \
1966+ pfs_os_file_write_func(name, file, buf, offset, \
1967+ n, __FILE__, __LINE__)
1968+# define xb_buf_page_is_corrupted(page, zip_size) \
1969+ buf_page_is_corrupted(TRUE, page, zip_size)
1970+# define xb_btr_pcur_open_at_index_side(from_left, index, latch_mode, pcur, \
1971+ init_pcur, level, mtr) \
1972+ btr_pcur_open_at_index_side(from_left, index, latch_mode, pcur, \
1973+ init_pcur, 0, mtr)
1974+# define xb_os_file_set_size(name, file, size) \
1975+ os_file_set_size(name, file, size)
1976+# define xb_fil_rename_tablespace(old_name_in, id, new_name, new_path) \
1977+ fil_rename_tablespace(old_name_in, id, new_name, new_path)
1978+# define xb_btr_root_block_get(index, mode, mtr) \
1979+ btr_root_block_get(index, mode, mtr)
1980+ typedef ib_mutex_t mutex_t;
1981+# define INNODB_LOG_DIR srv_log_group_home_dir
1982+# define DEFAULT_LOG_FILE_SIZE 48*1024*1024
1983+ /* InnoDB data dictionary API in MySQL 5.5- works on on tables named
1984+ "./database/table.ibd", and in 5.6+ on "database/table". This variable
1985+ handles truncating or leaving the final ".ibd". */
1986+# define XB_DICT_SUFFIX_LEN 4
1987+# define xb_os_event_create(name) os_event_create()
1988+#else /* MYSQL_VERSION_ID >= 50600 */
1989+ /* MySQL and Percona Server 5.1 and 5.5 */
1990 # define xb_buf_page_is_corrupted(page, zip_size) \
1991 buf_page_is_corrupted(page, zip_size)
1992+# define xb_os_event_create(name) os_event_create(name)
1993+# define XB_DICT_SUFFIX_LEN 0
1994+# define INT64PF "%lld"
1995+# define UINT64PF "%llu"
1996+# define LSN_PF UINT64PF
1997+# define DEFAULT_LOG_FILE_SIZE 5*1024*1024
1998+ typedef ulint dberr_t;
1999+ typedef os_mutex_t os_ib_mutex_t;
2000+ typedef ib_uint64_t lsn_t;
2001+ typedef merge_index_def_t index_def_t;
2002+ typedef merge_index_field_t index_field_t;
2003+# define xb_btr_pcur_open_at_index_side(from_left, index, latch_mode, pcur, \
2004+ init_pcur, level, mtr) \
2005+ btr_pcur_open_at_index_side(from_left, index, latch_mode, pcur, \
2006+ init_pcur, mtr)
2007+# define xb_fil_rename_tablespace(old_name_in, id, new_name, new_path) \
2008+ fil_rename_tablespace(old_name_in, id, new_name)
2009+# define xb_btr_root_block_get(index, mode, mtr) \
2010+ btr_root_block_get(index, mtr)
2011+# define UNIV_FORMAT_MAX DICT_TF_FORMAT_51;
2012+# define dict_tf_get_zip_size dict_table_flags_to_zip_size
2013+# define os_file_get_size(file) os_file_get_size_as_iblonglong(file)
2014+# define xb_os_file_set_size(name, file, size) \
2015+ os_file_set_size(name, file, (ulong)(size & 0xFFFFFFFFUL), \
2016+ (ulong)((ullint)size >> 32))
2017+# define fsp_flags_is_compressed(flags) ((flags) & DICT_TF_ZSSIZE_MASK)
2018+# define fsp_flags_get_zip_size(flags) \
2019+ ((PAGE_ZIP_MIN_SIZE >> 1) << (((flags) & DICT_TF_ZSSIZE_MASK) \
2020+ >> DICT_TF_ZSSIZE_SHIFT))
2021+
2022+# define trx_start_for_ddl(trx, op)
2023+# define ut_crc32_init()
2024+
2025+# define LOG_CHECKPOINT_OFFSET_LOW32 LOG_CHECKPOINT_OFFSET
2026+# define INNODB_LOG_DIR innobase_log_group_home_dir
2027+# ifndef XTRADB_BASED
2028+ /* MySQL 5.1 and 5.5 */
2029+# define dict_stats_update_transient(table) \
2030+ dict_update_statistics(table, TRUE)
2031+# else /* XTRADB_BASED */
2032+ /* Percona Server 5.1 and 5.5 */
2033+# define dict_stats_update_transient(table) \
2034+ dict_update_statistics(table, TRUE, FALSE)
2035+# endif /* XTRADB_BASED */
2036+#endif /* MYSQL_VERSION_ID >= 50600 */
2037 # define xb_fil_space_create(name, space_id, zip_size, purpose) \
2038 fil_space_create(name, space_id, zip_size, purpose)
2039 # define ut_dulint_zero 0
2040@@ -103,8 +210,33 @@
2041 # define ut_dulint_align_up(A, B) ((A + B - 1) & ~((ib_int64_t)B - 1))
2042
2043 #ifndef XTRADB_BASED
2044+/* MySQL 5.1 - 5.6 */
2045 #define trx_sys_sys_space(id) (id == 0)
2046-#endif
2047+#endif /* XTRADB_BASED */
2048+
2049+#if (MYSQL_VERSION_ID >= 50500) && (MYSQL_VERSION_ID < 50600)
2050+/* MySQL and Percona Server 5.5 */
2051+#define xb_os_file_write(name, file, buf, offset, n) \
2052+ pfs_os_file_write_func(name, file, buf, \
2053+ (ulint)(offset & 0xFFFFFFFFUL), \
2054+ (ulint)(((ullint)offset) >> 32), \
2055+ n, __FILE__, __LINE__)
2056+#ifdef XTRADB_BASED
2057+/* Percona Server 5.5 only */
2058+#define xb_os_file_read(file, buf, offset, n) \
2059+ pfs_os_file_read_func(file, buf, \
2060+ (ulint)(offset & 0xFFFFFFFFUL), \
2061+ (ulint)(((ullint)offset) >> 32), \
2062+ n, NULL, __FILE__, __LINE__)
2063+#else /* XTRADB_BASED */
2064+/* MySQL 5.5 only */
2065+#define xb_os_file_read(file, buf, offset, n) \
2066+ pfs_os_file_read_func(file, buf, \
2067+ (ulint)(offset & 0xFFFFFFFFUL), \
2068+ (ulint)(((ullint)offset) >> 32), \
2069+ n, __FILE__, __LINE__)
2070+#endif /* XTRADB_BASED */
2071+#endif /* (MYSQL_VERSION_ID >= 50500) && (MYSQL_VERSION_ID < 50600) */
2072
2073 #ifdef __WIN__
2074 #define SRV_PATH_SEPARATOR '\\'
2075@@ -152,6 +284,7 @@
2076 // NOTE: We should check the following definitions fit to the source.
2077 // ##################################################################
2078
2079+#if MYSQL_VERSION_ID < 50600
2080 //Plugin ?
2081 /** File node of a tablespace or the log data space */
2082 struct fil_node_struct {
2083@@ -312,9 +445,187 @@
2084 potential space_id reuse */
2085 };
2086
2087+#else /* MYSQL_VERSION_ID < 50600 */
2088+
2089+/** Tablespace or log data space: let us call them by a common name space */
2090+struct fil_space_t {
2091+ char* name; /*!< space name = the path to the first file in
2092+ it */
2093+ ulint id; /*!< space id */
2094+ ib_int64_t tablespace_version;
2095+ /*!< in DISCARD/IMPORT this timestamp
2096+ is used to check if we should ignore
2097+ an insert buffer merge request for a
2098+ page because it actually was for the
2099+ previous incarnation of the space */
2100+ ibool mark; /*!< this is set to TRUE at database startup if
2101+ the space corresponds to a table in the InnoDB
2102+ data dictionary; so we can print a warning of
2103+ orphaned tablespaces */
2104+ ibool stop_ios;/*!< TRUE if we want to rename the
2105+ .ibd file of tablespace and want to
2106+ stop temporarily posting of new i/o
2107+ requests on the file */
2108+ ibool stop_new_ops;
2109+ /*!< we set this TRUE when we start
2110+ deleting a single-table tablespace.
2111+ When this is set following new ops
2112+ are not allowed:
2113+ * read IO request
2114+ * ibuf merge
2115+ * file flush
2116+ Note that we can still possibly have
2117+ new write operations because we don't
2118+ check this flag when doing flush
2119+ batches. */
2120+ ulint purpose;/*!< FIL_TABLESPACE, FIL_LOG, or
2121+ FIL_ARCH_LOG */
2122+ UT_LIST_BASE_NODE_T(fil_node_t) chain;
2123+ /*!< base node for the file chain */
2124+ ulint size; /*!< space size in pages; 0 if a single-table
2125+ tablespace whose size we do not know yet;
2126+ last incomplete megabytes in data files may be
2127+ ignored if space == 0 */
2128+ ulint flags; /*!< tablespace flags; see
2129+ fsp_flags_is_valid(),
2130+ fsp_flags_get_zip_size() */
2131+ ulint n_reserved_extents;
2132+ /*!< number of reserved free extents for
2133+ ongoing operations like B-tree page split */
2134+ ulint n_pending_flushes; /*!< this is positive when flushing
2135+ the tablespace to disk; dropping of the
2136+ tablespace is forbidden if this is positive */
2137+ ulint n_pending_ops;/*!< this is positive when we
2138+ have pending operations against this
2139+ tablespace. The pending operations can
2140+ be ibuf merges or lock validation code
2141+ trying to read a block.
2142+ Dropping of the tablespace is forbidden
2143+ if this is positive */
2144+ hash_node_t hash; /*!< hash chain node */
2145+ hash_node_t name_hash;/*!< hash chain the name_hash table */
2146+#ifndef UNIV_HOTBACKUP
2147+ rw_lock_t latch; /*!< latch protecting the file space storage
2148+ allocation */
2149+#endif /* !UNIV_HOTBACKUP */
2150+ UT_LIST_NODE_T(fil_space_t) unflushed_spaces;
2151+ /*!< list of spaces with at least one unflushed
2152+ file we have written to */
2153+ bool is_in_unflushed_spaces;
2154+ /*!< true if this space is currently in
2155+ unflushed_spaces */
2156+ UT_LIST_NODE_T(fil_space_t) space_list;
2157+ /*!< list of all spaces */
2158+ ulint magic_n;/*!< FIL_SPACE_MAGIC_N */
2159+};
2160+
2161+/** The tablespace memory cache; also the totality of logs (the log
2162+ data space) is stored here; below we talk about tablespaces, but also
2163+ the ib_logfiles form a 'space' and it is handled here */
2164+struct fil_system_t {
2165+#ifndef UNIV_HOTBACKUP
2166+ ib_mutex_t mutex; /*!< The mutex protecting the cache */
2167+#endif /* !UNIV_HOTBACKUP */
2168+ hash_table_t* spaces; /*!< The hash table of spaces in the
2169+ system; they are hashed on the space
2170+ id */
2171+ hash_table_t* name_hash; /*!< hash table based on the space
2172+ name */
2173+ UT_LIST_BASE_NODE_T(fil_node_t) LRU;
2174+ /*!< base node for the LRU list of the
2175+ most recently used open files with no
2176+ pending i/o's; if we start an i/o on
2177+ the file, we first remove it from this
2178+ list, and return it to the start of
2179+ the list when the i/o ends;
2180+ log files and the system tablespace are
2181+ not put to this list: they are opened
2182+ after the startup, and kept open until
2183+ shutdown */
2184+ UT_LIST_BASE_NODE_T(fil_space_t) unflushed_spaces;
2185+ /*!< base node for the list of those
2186+ tablespaces whose files contain
2187+ unflushed writes; those spaces have
2188+ at least one file node where
2189+ modification_counter > flush_counter */
2190+ ulint n_open; /*!< number of files currently open */
2191+ ulint max_n_open; /*!< n_open is not allowed to exceed
2192+ this */
2193+ ib_int64_t modification_counter;/*!< when we write to a file we
2194+ increment this by one */
2195+ ulint max_assigned_id;/*!< maximum space id in the existing
2196+ tables, or assigned during the time
2197+ mysqld has been up; at an InnoDB
2198+ startup we scan the data dictionary
2199+ and set here the maximum of the
2200+ space id's of the tables there */
2201+ ib_int64_t tablespace_version;
2202+ /*!< a counter which is incremented for
2203+ every space object memory creation;
2204+ every space mem object gets a
2205+ 'timestamp' from this; in DISCARD/
2206+ IMPORT this is used to check if we
2207+ should ignore an insert buffer merge
2208+ request */
2209+ UT_LIST_BASE_NODE_T(fil_space_t) space_list;
2210+ /*!< list of all file spaces */
2211+ ibool space_id_reuse_warned;
2212+ /* !< TRUE if fil_space_create()
2213+ has issued a warning about
2214+ potential space_id reuse */
2215+};
2216+
2217+/** File node of a tablespace or the log data space */
2218+struct fil_node_t {
2219+ fil_space_t* space; /*!< backpointer to the space where this node
2220+ belongs */
2221+ char* name; /*!< path to the file */
2222+ ibool open; /*!< TRUE if file open */
2223+ os_file_t handle; /*!< OS handle to the file, if file open */
2224+ ibool is_raw_disk;/*!< TRUE if the 'file' is actually a raw
2225+ device or a raw disk partition */
2226+ ulint size; /*!< size of the file in database pages, 0 if
2227+ not known yet; the possible last incomplete
2228+ megabyte may be ignored if space == 0 */
2229+ ulint n_pending;
2230+ /*!< count of pending i/o's on this file;
2231+ closing of the file is not allowed if
2232+ this is > 0 */
2233+ ulint n_pending_flushes;
2234+ /*!< count of pending flushes on this file;
2235+ closing of the file is not allowed if
2236+ this is > 0 */
2237+ ibool being_extended;
2238+ /*!< TRUE if the node is currently
2239+ being extended. */
2240+ ib_int64_t modification_counter;/*!< when we write to the file we
2241+ increment this by one */
2242+ ib_int64_t flush_counter;/*!< up to what
2243+ modification_counter value we have
2244+ flushed the modifications to disk */
2245+ UT_LIST_NODE_T(fil_node_t) chain;
2246+ /*!< link field for the file chain */
2247+ UT_LIST_NODE_T(fil_node_t) LRU;
2248+ /*!< link field for the LRU list */
2249+ ulint magic_n;/*!< FIL_NODE_MAGIC_N */
2250+};
2251+
2252+#endif /* MYSQL_VERSION_ID < 50600 */
2253+
2254 extern fil_system_t* fil_system;
2255 extern char *opt_mysql_tmpdir;
2256
2257+/* InnoDB data dictionary API in MySQL 5.5- works on on tables named
2258+"./database/table.ibd", and in 5.6+ on "database/table". This variable
2259+handles the presence or absence of "./". */
2260+extern const char* xb_dict_prefix;
2261+
2262+#if MYSQL_VERSION_ID < 50600
2263+extern char* innobase_log_group_home_dir;
2264+#endif
2265+
2266+extern long innobase_mirrored_log_groups;
2267+
2268 /** Value of fil_space_struct::magic_n */
2269 #define FIL_SPACE_MAGIC_N 89472
2270
2271@@ -324,16 +635,55 @@
2272 struct TABLE;
2273 #endif
2274
2275-extern "C" {
2276-
2277 /* prototypes for static and non-prototyped functions in original */
2278+
2279+#if MYSQL_VERSION_ID < 50600
2280+extern "C" {
2281+#endif
2282+
2283+#if MYSQL_VERSION_ID >= 50600
2284+
2285 buf_block_t*
2286-btr_node_ptr_get_child(
2287-/*===================*/
2288- const rec_t* node_ptr,/*!< in: node pointer */
2289- dict_index_t* index, /*!< in: index */
2290- const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
2291- mtr_t* mtr); /*!< in: mtr */
2292+btr_root_block_get(
2293+/*===============*/
2294+ const dict_index_t* index, /*!< in: index tree */
2295+ ulint mode, /*!< in: either RW_S_LATCH
2296+ or RW_X_LATCH */
2297+ mtr_t* mtr); /*!< in: mtr */
2298+
2299+int
2300+fil_file_readdir_next_file(
2301+/*=======================*/
2302+ dberr_t* err, /*!< out: this is set to DB_ERROR if an error
2303+ was encountered, otherwise not changed */
2304+ const char* dirname,/*!< in: directory name or path */
2305+ os_file_dir_t dir, /*!< in: directory stream */
2306+ os_file_stat_t* info); /*!< in/out: buffer where the
2307+ info is returned */
2308+
2309+ibool
2310+recv_check_cp_is_consistent(
2311+/*========================*/
2312+ const byte* buf); /*!< in: buffer containing checkpoint info */
2313+
2314+dberr_t
2315+open_or_create_data_files(
2316+/*======================*/
2317+ ibool* create_new_db, /*!< out: TRUE if new database should be
2318+ created */
2319+ lsn_t* min_flushed_lsn,/*!< out: min of flushed lsn
2320+ values in data files */
2321+ lsn_t* max_flushed_lsn,/*!< out: max of flushed lsn
2322+ values in data files */
2323+ ulint* sum_of_new_sizes);/*!< out: sum of sizes of the
2324+ new files added */
2325+
2326+ibool
2327+log_block_checksum_is_ok_or_old_format(
2328+/*===================================*/
2329+ const byte* block); /*!< in: pointer to a log block */
2330+
2331+#else /* MYSQL_VERSION_ID >= 50600 */
2332
2333 buf_block_t*
2334 btr_root_block_get(
2335@@ -347,7 +697,7 @@
2336 /* out: 0 if ok, -1 if error even after the
2337 retries, 1 if at the end of the directory */
2338 ulint* err, /* out: this is set to DB_ERROR if an error
2339- was encountered, otherwise not changed */
2340+ was encountered, otherwise not changed */
2341 const char* dirname,/* in: directory name or path */
2342 os_file_dir_t dir, /* in: directory stream */
2343 os_file_stat_t* info); /* in/out: buffer where the info is returned */
2344@@ -359,6 +709,38 @@
2345 byte* buf); /* in: buffer containing checkpoint info */
2346
2347 ulint
2348+open_or_create_data_files(
2349+/*======================*/
2350+ /* out: DB_SUCCESS or error code */
2351+ ibool* create_new_db, /* out: TRUE if new database should be
2352+ created */
2353+#ifdef XTRADB_BASED
2354+ ibool* create_new_doublewrite_file,
2355+#endif
2356+ lsn_t* min_flushed_lsn,/* out: min of flushed lsn values in data
2357+ files */
2358+ lsn_t* max_flushed_lsn,/* out: */
2359+ ulint* sum_of_new_sizes);/* out: sum of sizes of the new files added
2360+ */
2361+
2362+ibool
2363+log_block_checksum_is_ok_or_old_format(
2364+/*===================================*/
2365+ /* out: TRUE if ok, or if the log block may be in the
2366+ format of InnoDB version < 3.23.52 */
2367+ byte* block); /* in: pointer to a log block */
2368+
2369+#endif /* MYSQL_VERSION_ID >= 50600 */
2370+
2371+buf_block_t*
2372+btr_node_ptr_get_child(
2373+/*===================*/
2374+ const rec_t* node_ptr,/*!< in: node pointer */
2375+ dict_index_t* index, /*!< in: index */
2376+ const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
2377+ mtr_t* mtr); /*!< in: mtr */
2378+
2379+ulint
2380 recv_find_max_checkpoint(
2381 /*=====================*/
2382 /* out: error code or DB_SUCCESS */
2383@@ -366,13 +748,6 @@
2384 ulint* max_field); /* out: LOG_CHECKPOINT_1 or
2385 LOG_CHECKPOINT_2 */
2386
2387-ibool
2388-log_block_checksum_is_ok_or_old_format(
2389-/*===================================*/
2390- /* out: TRUE if ok, or if the log block may be in the
2391- format of InnoDB version < 3.23.52 */
2392- byte* block); /* in: pointer to a log block */
2393-
2394 ulint
2395 open_or_create_log_file(
2396 /*====================*/
2397@@ -387,26 +762,6 @@
2398 ulint k, /* in: log group number */
2399 ulint i); /* in: log file number in group */
2400
2401-ulint
2402-open_or_create_data_files(
2403-/*======================*/
2404- /* out: DB_SUCCESS or error code */
2405- ibool* create_new_db, /* out: TRUE if new database should be
2406- created */
2407-#ifdef XTRADB_BASED
2408- ibool* create_new_doublewrite_file,
2409-#endif
2410-#ifdef UNIV_LOG_ARCHIVE
2411- ulint* min_arch_log_no,/* out: min of archived log numbers in data
2412- files */
2413- ulint* max_arch_log_no,/* out: */
2414-#endif /* UNIV_LOG_ARCHIVE */
2415- LSN64* min_flushed_lsn,/* out: min of flushed lsn values in data
2416- files */
2417- LSN64* max_flushed_lsn,/* out: */
2418- ulint* sum_of_new_sizes);/* out: sum of sizes of the new files added
2419- */
2420-
2421 void
2422 os_file_set_nocache(
2423 /*================*/
2424@@ -418,7 +773,9 @@
2425 a file, so this is either "open" or
2426 "create" */
2427
2428+#if MYSQL_VERSION_ID < 50600
2429 } /* extern "C" */
2430+#endif
2431
2432 /****************************************************************//**
2433 A simple function to open or create a file.
2434@@ -535,7 +892,9 @@
2435 xb_normalize_init_values(void);
2436 /*==========================*/
2437
2438+#if MYSQL_VERSION_ID < 50600
2439 extern "C" {
2440+#endif
2441
2442 #if MYSQL_VERSION_ID >= 50500
2443
2444@@ -582,12 +941,16 @@
2445
2446 #endif
2447
2448+#if MYSQL_VERSION_ID < 50600
2449+
2450 void
2451 innobase_invalidate_query_cache(
2452 trx_t* trx,
2453 const char* full_name,
2454 ulint full_name_len);
2455
2456+#endif /* MYSQL_VERSION_ID < 50600 */
2457+
2458 /*****************************************************************//**
2459 Convert a table or index name to the MySQL system_charset_info (UTF-8)
2460 and quote it if needed.
2461@@ -655,6 +1018,75 @@
2462 const dict_index_t* index,
2463 const ulint* offsets);
2464
2465+#if MYSQL_VERSION_ID < 50600
2466 } /* extern "C" */
2467+#endif
2468+
2469+#if MYSQL_VERSION_ID >= 50600
2470+
2471+extern os_file_t files[1000];
2472+
2473+/*********************************************************************//**
2474+Creates or opens the log files and closes them.
2475+@return DB_SUCCESS or error code */
2476+ulint
2477+open_or_create_log_file(
2478+/*====================*/
2479+ ibool create_new_db, /*!< in: TRUE if we should create a
2480+ new database */
2481+ ibool* log_file_created, /*!< out: TRUE if new log file
2482+ created */
2483+ ibool log_file_has_been_opened,/*!< in: TRUE if a log file has been
2484+ opened before: then it is an error
2485+ to try to create another log file */
2486+ ulint k, /*!< in: log group number */
2487+ ulint i); /*!< in: log file number in group */
2488+
2489+#endif
2490+
2491+/*****************************************************************//**
2492+Parse, validate, and set the InnoDB variables from
2493+innodb_log_group_home_dir and innodb_mirrored_log_group_groups
2494+options.
2495+
2496+@return TRUE if server variables set OK, FALSE otherwise */
2497+ibool
2498+xb_parse_log_group_home_dirs(void);
2499+/*===============================*/
2500+
2501+/*****************************************************************//**
2502+Set InnoDB to read-only mode. */
2503+void
2504+xb_set_innodb_read_only(void);
2505+/*==========================*/
2506+
2507+/*****************************************************************//**
2508+Adjust srv_fatal_semaphore_wait_threshold in a thread-safe manner. */
2509+void
2510+xb_adjust_fatal_semaphore_wait_threshold(
2511+/*=====================================*/
2512+ ulint delta);
2513+
2514+/*****************************************************************//**
2515+Wrapper around around recv_check_cp_is_consistent() for handling
2516+version differences.
2517+
2518+@return TRUE if checkpoint info in the buffer is OK */
2519+ibool
2520+xb_recv_check_cp_is_consistent(
2521+/*===========================*/
2522+ const byte* buf); /*!<in: buffer containing checkpoint info */
2523+
2524+/*****************************************************************//**
2525+Initialize a index_field_t variable from a dict_field_t */
2526+void
2527+xb_dict_index_field_to_index_field(
2528+/*===============================*/
2529+ mem_heap_t* heap, /*!< in: heap for
2530+ field name string
2531+ allocation on 5.5 or
2532+ earlier version. */
2533+ const dict_field_t* dict_index_field, /*!< in: field */
2534+ index_field_t* index_field); /*!< out: field */
2535
2536 #endif /* INNODB_INT_H */
2537
2538=== modified file 'src/write_filt.cc'
2539--- src/write_filt.cc 2013-02-20 10:20:00 +0000
2540+++ src/write_filt.cc 2013-03-22 15:32:33 +0000
2541@@ -78,7 +78,7 @@
2542 /* allocate buffer for incremental backup (4096 pages) */
2543 buf_size = (UNIV_PAGE_SIZE_MAX / 4 + 1) * UNIV_PAGE_SIZE_MAX;
2544 cp->delta_buf_base = static_cast<byte *>(ut_malloc(buf_size));
2545- bzero(cp->delta_buf_base, buf_size);
2546+ memset(cp->delta_buf_base, 0, buf_size);
2547 cp->delta_buf = static_cast<byte *>
2548 (ut_align(cp->delta_buf_base, UNIV_PAGE_SIZE_MAX));
2549
2550@@ -134,7 +134,7 @@
2551 }
2552
2553 /* clear buffer */
2554- bzero(cp->delta_buf, page_size / 4 * page_size);
2555+ memset(cp->delta_buf, 0, page_size / 4 * page_size);
2556 /*"xtra"*/
2557 mach_write_to_4(cp->delta_buf, 0x78747261UL);
2558 cp->npages = 1;
2559
2560=== modified file 'src/xbcrypt_common.c'
2561--- src/xbcrypt_common.c 2013-03-11 19:11:29 +0000
2562+++ src/xbcrypt_common.c 2013-03-22 15:32:33 +0000
2563@@ -19,7 +19,6 @@
2564 *******************************************************/
2565
2566 #include <my_base.h>
2567-#include <univ.i>
2568 #include "common.h"
2569 #include "xbcrypt.h"
2570 #include <gcrypt.h>
2571
2572=== modified file 'src/xtrabackup.cc'
2573--- src/xtrabackup.cc 2013-03-19 12:30:53 +0000
2574+++ src/xtrabackup.cc 2013-03-22 15:32:33 +0000
2575@@ -52,6 +52,10 @@
2576 #include <my_base.h>
2577 #include <my_getopt.h>
2578 #include <mysql_com.h>
2579+#if MYSQL_VERSION_ID >= 50600
2580+#include <my_default.h>
2581+#include <mysqld.h>
2582+#endif
2583
2584 #include <fcntl.h>
2585
2586@@ -92,9 +96,9 @@
2587 os_event_t wait_throttle = NULL;
2588
2589 char *xtrabackup_incremental = NULL;
2590-LSN64 incremental_lsn;
2591-LSN64 incremental_to_lsn;
2592-LSN64 incremental_last_lsn;
2593+lsn_t incremental_lsn;
2594+lsn_t incremental_to_lsn;
2595+lsn_t incremental_last_lsn;
2596
2597 char *xtrabackup_incremental_basedir = NULL; /* for --backup */
2598 char *xtrabackup_extra_lsndir = NULL; /* for --backup with --extra-lsndir */
2599@@ -122,9 +126,9 @@
2600 static os_thread_id_t thread_ids[SRV_MAX_N_IO_THREADS + 6];
2601 #endif
2602
2603-LSN64 checkpoint_lsn_start;
2604-LSN64 checkpoint_no_start;
2605-LSN64 log_copy_scanned_lsn;
2606+lsn_t checkpoint_lsn_start;
2607+lsn_t checkpoint_no_start;
2608+lsn_t log_copy_scanned_lsn;
2609 ibool log_copying = TRUE;
2610 ibool log_copying_running = FALSE;
2611 ibool log_copying_succeed = FALSE;
2612@@ -159,17 +163,20 @@
2613 /* === metadata of backup === */
2614 #define XTRABACKUP_METADATA_FILENAME "xtrabackup_checkpoints"
2615 char metadata_type[30] = ""; /*[full-backuped|full-prepared|incremental]*/
2616-ib_uint64_t metadata_from_lsn = 0;
2617-ib_uint64_t metadata_to_lsn = 0;
2618-ib_uint64_t metadata_last_lsn = 0;
2619+lsn_t metadata_from_lsn = 0;
2620+lsn_t metadata_to_lsn = 0;
2621+lsn_t metadata_last_lsn = 0;
2622
2623 #define XB_LOG_FILENAME "xtrabackup_logfile"
2624
2625 ds_file_t *dst_log_file = NULL;
2626
2627 /* === some variables from mysqld === */
2628+#if MYSQL_VERSION_ID < 50600
2629 char mysql_real_data_home[FN_REFLEN] = "./";
2630+MY_TMPDIR mysql_tmpdir_list;
2631 char *mysql_data_home= mysql_real_data_home;
2632+#endif
2633 static char mysql_data_home_buff[2];
2634
2635 const char *defaults_group = "mysqld";
2636@@ -193,7 +200,6 @@
2637 long innobase_lock_wait_timeout = 50;
2638 long innobase_log_buffer_size = 1024*1024L;
2639 long innobase_log_files_in_group = 2;
2640-long innobase_mirrored_log_groups = 1;
2641 long innobase_open_files = 300L;
2642
2643 long innobase_page_size = (1 << 14); /* 16KB */
2644@@ -205,7 +211,7 @@
2645 char* innobase_doublewrite_file = NULL;
2646
2647 longlong innobase_buffer_pool_size = 8*1024*1024L;
2648-longlong innobase_log_file_size = 5*1024*1024L;
2649+longlong innobase_log_file_size = DEFAULT_LOG_FILE_SIZE;
2650
2651 /* The default values for the following char* start-up parameters
2652 are determined in innobase_init below: */
2653@@ -213,7 +219,6 @@
2654 char* innobase_ignored_opt = NULL;
2655 char* innobase_data_home_dir = NULL;
2656 char* innobase_data_file_path = NULL;
2657-char* innobase_log_group_home_dir = NULL;
2658 char* innobase_log_arch_dir = NULL;/* unused */
2659 /* The following has a misleading name: starting from 4.0.5, this also
2660 affects Windows: */
2661@@ -336,7 +341,7 @@
2662 datafiles_iter_t *it;
2663 uint num;
2664 uint *count;
2665- os_mutex_t count_mutex;
2666+ os_ib_mutex_t count_mutex;
2667 os_thread_id_t id;
2668 } data_thread_ctxt_t;
2669
2670@@ -421,10 +426,36 @@
2671 OPT_XTRA_DEBUG_SYNC,
2672 OPT_XTRA_COMPACT,
2673 OPT_XTRA_REBUILD_INDEXES,
2674+#if MYSQL_VERSION_ID >= 50600
2675+ OPT_INNODB_CHECKSUM_ALGORITHM,
2676+ OPT_UNDO_TABLESPACES,
2677+#endif
2678 OPT_DEFAULTS_GROUP
2679 };
2680
2681-static struct my_option my_long_options[] =
2682+#if MYSQL_VERSION_ID >= 50600
2683+/** Possible values for system variable "innodb_checksum_algorithm". */
2684+static const char* innodb_checksum_algorithm_names[] = {
2685+ "crc32",
2686+ "strict_crc32",
2687+ "innodb",
2688+ "strict_innodb",
2689+ "none",
2690+ "strict_none",
2691+ NullS
2692+};
2693+
2694+/** Used to define an enumerate type of the system variable
2695+ innodb_checksum_algorithm. */
2696+static TYPELIB innodb_checksum_algorithm_typelib = {
2697+ array_elements(innodb_checksum_algorithm_names) - 1,
2698+ "innodb_checksum_algorithm_typelib",
2699+ innodb_checksum_algorithm_names,
2700+ NULL
2701+};
2702+#endif
2703+
2704+static struct my_option xb_long_options[] =
2705 {
2706 {"version", 'v', "print xtrabackup version information",
2707 (G_PTR *) &xtrabackup_version, (G_PTR *) &xtrabackup_version, 0, GET_BOOL,
2708@@ -600,7 +631,7 @@
2709 {"innodb_io_capacity", OPT_INNODB_IO_CAPACITY,
2710 "Number of IOPs the server can do. Tunes the background IO rate",
2711 (G_PTR*) &srv_io_capacity, (G_PTR*) &srv_io_capacity,
2712- 0, GET_ULONG, OPT_ARG, 200, 100, ~0L, 0, 0, 0},
2713+ 0, GET_ULONG, OPT_ARG, 200, 100, ~0UL, 0, 0, 0},
2714 /*
2715 {"innodb_fast_shutdown", OPT_INNODB_FAST_SHUTDOWN,
2716 "Speeds up the shutdown process of the InnoDB storage engine. Possible "
2717@@ -666,15 +697,15 @@
2718 {"innodb_log_file_size", OPT_INNODB_LOG_FILE_SIZE,
2719 "Size of each log file in a log group.",
2720 (G_PTR*) &innobase_log_file_size, (G_PTR*) &innobase_log_file_size, 0,
2721- GET_LL, REQUIRED_ARG, 5*1024*1024L, 1*1024*1024L, LONGLONG_MAX, 0,
2722+ GET_LL, REQUIRED_ARG, DEFAULT_LOG_FILE_SIZE, 1*1024*1024L, LONGLONG_MAX, 0,
2723 1024*1024L, 0},
2724 {"innodb_log_files_in_group", OPT_INNODB_LOG_FILES_IN_GROUP,
2725 "Number of log files in the log group. InnoDB writes to the files in a circular fashion. Value 3 is recommended here.",
2726 (G_PTR*) &innobase_log_files_in_group, (G_PTR*) &innobase_log_files_in_group,
2727 0, GET_LONG, REQUIRED_ARG, 2, 2, 100, 0, 1, 0},
2728 {"innodb_log_group_home_dir", OPT_INNODB_LOG_GROUP_HOME_DIR,
2729- "Path to InnoDB log files.", (G_PTR*) &innobase_log_group_home_dir,
2730- (G_PTR*) &innobase_log_group_home_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
2731+ "Path to InnoDB log files.", (G_PTR*) &INNODB_LOG_DIR,
2732+ (G_PTR*) &INNODB_LOG_DIR, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
2733 0, 0},
2734 {"innodb_max_dirty_pages_pct", OPT_INNODB_MAX_DIRTY_PAGES_PCT,
2735 "Percentage of dirty pages allowed in bufferpool.", (G_PTR*) &srv_max_buf_pool_modified_pct,
2736@@ -748,6 +779,19 @@
2737 (G_PTR*) &xtrabackup_rebuild_indexes, (G_PTR*) &xtrabackup_rebuild_indexes,
2738 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
2739
2740+#if MYSQL_VERSION_ID >= 50600
2741+ {"checksum-algorithm", OPT_INNODB_CHECKSUM_ALGORITHM,
2742+ "The algorithm InnoDB uses for page checksumming. [CRC32, STRICT_CRC32, "
2743+ "INNODB, STRICT_INNODB, NONE, STRICT_NONE]", &srv_checksum_algorithm,
2744+ &srv_checksum_algorithm, &innodb_checksum_algorithm_typelib, GET_ENUM,
2745+ REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
2746+ {"undo-tablespaces", OPT_UNDO_TABLESPACES,
2747+ "Number of undo tablespaces to use. NON-ZERO VALUES ARE NOT "
2748+ "CURRENTLY SUPPORTED",
2749+ (G_PTR*)&srv_undo_tablespaces, (G_PTR*)&srv_undo_tablespaces,
2750+ 0, GET_ULONG, REQUIRED_ARG, 0, 0, 126, 0, 1, 0},
2751+#endif
2752+
2753 {"defaults_group", OPT_DEFAULTS_GROUP, "defaults group in config file (default \"mysqld\").",
2754 (G_PTR*) &defaults_group, (G_PTR*) &defaults_group,
2755 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
2756@@ -809,7 +853,7 @@
2757 #endif
2758 }
2759
2760-static const char *load_default_groups[]= { "mysqld","xtrabackup",0,0 };
2761+static const char *xb_load_default_groups[]= { "mysqld", "xtrabackup", 0, 0 };
2762
2763 static void print_version(void)
2764 {
2765@@ -844,9 +888,9 @@
2766 You can download full text of the license on http://www.gnu.org/licenses/gpl-2.0.txt\n");
2767
2768 printf("Usage: [%s [--defaults-file=#] --backup | %s [--defaults-file=#] --prepare] [OPTIONS]\n",my_progname,my_progname);
2769- print_defaults("my",load_default_groups);
2770- my_print_help(my_long_options);
2771- my_print_variables(my_long_options);
2772+ print_defaults("my", xb_load_default_groups);
2773+ my_print_help(xb_long_options);
2774+ my_print_variables(xb_long_options);
2775 }
2776
2777 static my_bool
2778@@ -855,7 +899,7 @@
2779 {
2780 switch(optid) {
2781 case 'h':
2782- strmake(mysql_real_data_home,argument, sizeof(mysql_real_data_home)-1);
2783+ strmake(mysql_real_data_home,argument, FN_REFLEN - 1);
2784 mysql_data_home= mysql_real_data_home;
2785 break;
2786 case OPT_XTRA_TARGET_DIR:
2787@@ -944,7 +988,7 @@
2788 char *default_path;
2789
2790 /* === some variables from mysqld === */
2791- bzero((G_PTR) &mysql_tmpdir_list, sizeof(mysql_tmpdir_list));
2792+ memset((G_PTR) &mysql_tmpdir_list, 0, sizeof(mysql_tmpdir_list));
2793
2794 if (init_tmpdir(&mysql_tmpdir_list, opt_mysql_tmpdir))
2795 exit(EXIT_FAILURE);
2796@@ -1099,48 +1143,32 @@
2797
2798 /* The default dir for log files is the datadir of MySQL */
2799
2800- if (!((xtrabackup_backup || xtrabackup_stats) && innobase_log_group_home_dir)) {
2801- innobase_log_group_home_dir = default_path;
2802+ if (!((xtrabackup_backup || xtrabackup_stats) && INNODB_LOG_DIR)) {
2803+ INNODB_LOG_DIR = default_path;
2804 }
2805 if (xtrabackup_prepare && xtrabackup_incremental_dir) {
2806- innobase_log_group_home_dir = xtrabackup_incremental_dir;
2807+ INNODB_LOG_DIR = xtrabackup_incremental_dir;
2808 }
2809- msg("xtrabackup: innodb_log_group_home_dir = %s\n",
2810- innobase_log_group_home_dir);
2811-
2812-#ifdef UNIV_LOG_ARCHIVE
2813- /* Since innodb_log_arch_dir has no relevance under MySQL,
2814- starting from 4.0.6 we always set it the same as
2815- innodb_log_group_home_dir: */
2816-
2817- innobase_log_arch_dir = innobase_log_group_home_dir;
2818-
2819- srv_arch_dir = innobase_log_arch_dir;
2820-#endif /* UNIG_LOG_ARCHIVE */
2821-
2822- ret = (my_bool)
2823- srv_parse_log_group_home_dirs(innobase_log_group_home_dir);
2824-
2825- if (ret == FALSE || innobase_mirrored_log_groups != 1) {
2826- msg("xtrabackup: syntax error in innodb_log_group_home_dir, "
2827- "or a wrong number of mirrored log groups\n");
2828-
2829- goto mem_free_and_error;
2830+ msg("xtrabackup: innodb_log_group_home_dir = %s\n", INNODB_LOG_DIR);
2831+
2832+ ret = (my_bool) xb_parse_log_group_home_dirs();
2833+ if (ret == FALSE) {
2834+
2835+ goto mem_free_and_error;
2836 }
2837
2838 srv_adaptive_flushing = FALSE;
2839 srv_use_sys_malloc = TRUE;
2840 srv_file_format = 1; /* Barracuda */
2841 #if (MYSQL_VERSION_ID < 50500)
2842- srv_check_file_format_at_startup = DICT_TF_FORMAT_51; /* on */
2843+ srv_check_file_format_at_startup = UNIV_FORMAT_MAX; /* on */
2844 #else
2845- srv_max_file_format_at_startup = DICT_TF_FORMAT_51; /* on */
2846+ srv_max_file_format_at_startup = UNIV_FORMAT_MAX; /* on */
2847 #endif
2848 /* --------------------------------------------------*/
2849
2850 srv_file_flush_method_str = innobase_unix_file_flush_method;
2851
2852- srv_n_log_groups = (ulint) innobase_mirrored_log_groups;
2853 srv_n_log_files = (ulint) innobase_log_files_in_group;
2854 srv_log_file_size = (ulint) innobase_log_file_size;
2855 msg("xtrabackup: innodb_log_files_in_group = %ld\n",
2856@@ -1168,7 +1196,9 @@
2857 srv_force_recovery = (ulint) innobase_force_recovery;
2858
2859 srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite;
2860+#if MYSQL_VERSION_ID < 50600
2861 srv_use_checksums = (ibool) innobase_use_checksums;
2862+#endif
2863
2864 btr_search_enabled = (char) innobase_adaptive_hash_index;
2865
2866@@ -1362,17 +1392,19 @@
2867 r = FALSE;
2868 goto end;
2869 }
2870- if (fscanf(fp, "from_lsn = %llu\n", &metadata_from_lsn)
2871- != 1) {
2872- r = FALSE;
2873- goto end;
2874- }
2875- if (fscanf(fp, "to_lsn = %llu\n", &metadata_to_lsn)
2876- != 1) {
2877- r = FALSE;
2878- goto end;
2879- }
2880- if (fscanf(fp, "last_lsn = %llu\n", &metadata_last_lsn)
2881+ /* Use UINT64PF instead of LSN_PF here, as we have to maintain the file
2882+ format. */
2883+ if (fscanf(fp, "from_lsn = " UINT64PF "\n", &metadata_from_lsn)
2884+ != 1) {
2885+ r = FALSE;
2886+ goto end;
2887+ }
2888+ if (fscanf(fp, "to_lsn = " UINT64PF "\n", &metadata_to_lsn)
2889+ != 1) {
2890+ r = FALSE;
2891+ goto end;
2892+ }
2893+ if (fscanf(fp, "last_lsn = " UINT64PF "\n", &metadata_last_lsn)
2894 != 1) {
2895 metadata_last_lsn = 0;
2896 }
2897@@ -1394,11 +1426,13 @@
2898 void
2899 xtrabackup_print_metadata(char *buf, size_t buf_len)
2900 {
2901+ /* Use UINT64PF instead of LSN_PF here, as we have to maintain the file
2902+ format. */
2903 snprintf(buf, buf_len,
2904 "backup_type = %s\n"
2905- "from_lsn = %llu\n"
2906- "to_lsn = %llu\n"
2907- "last_lsn = %llu\n"
2908+ "from_lsn = " UINT64PF "\n"
2909+ "to_lsn = " UINT64PF "\n"
2910+ "last_lsn = " UINT64PF "\n"
2911 "compact = %d\n",
2912 metadata_type,
2913 metadata_from_lsn,
2914@@ -1686,14 +1720,14 @@
2915 buf = static_cast<byte *>(ut_malloc(2 * UNIV_PAGE_SIZE_MAX));
2916 page = static_cast<byte *>(ut_align(buf, UNIV_PAGE_SIZE_MAX));
2917
2918- success = os_file_read(file, page, 0, 0, UNIV_PAGE_SIZE_MAX);
2919+ success = xb_os_file_read(file, page, 0, UNIV_PAGE_SIZE_MAX);
2920 if (!success) {
2921 goto end;
2922 }
2923
2924 space = mach_read_from_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
2925 zip_size = (space == 0 ) ? 0 :
2926- dict_table_flags_to_zip_size(fsp_header_get_flags(page));
2927+ dict_tf_get_zip_size(fsp_header_get_flags(page));
2928 end:
2929 ut_free(buf);
2930
2931@@ -1839,12 +1873,12 @@
2932 }
2933
2934 static my_bool
2935-xtrabackup_copy_logfile(LSN64 from_lsn, my_bool is_last)
2936+xtrabackup_copy_logfile(lsn_t from_lsn, my_bool is_last)
2937 {
2938 /* definition from recv_recovery_from_checkpoint_start() */
2939 log_group_t* group;
2940- LSN64 group_scanned_lsn;
2941- LSN64 contiguous_lsn;
2942+ lsn_t group_scanned_lsn;
2943+ lsn_t contiguous_lsn;
2944
2945 ut_a(dst_log_file != NULL);
2946
2947@@ -1858,8 +1892,8 @@
2948
2949 while (group) {
2950 ibool finished;
2951- LSN64 start_lsn;
2952- LSN64 end_lsn;
2953+ lsn_t start_lsn;
2954+ lsn_t end_lsn;
2955
2956 /* reference recv_group_scan_log_recs() */
2957 finished = FALSE;
2958@@ -1880,7 +1914,7 @@
2959 /* reference recv_scan_log_recs() */
2960 {
2961 byte* log_block;
2962- LSN64 scanned_lsn;
2963+ lsn_t scanned_lsn;
2964 ulint data_len;
2965
2966 ulint scanned_checkpoint_no = 0;
2967@@ -1928,7 +1962,7 @@
2968 /* Garbage or an incompletely written log block */
2969
2970 msg("xtrabackup: warning: Log block checksum mismatch"
2971- " (block no %lu at lsn %llu): \n"
2972+ " (block no %lu at lsn " LSN_PF "): \n"
2973 "expected %lu, calculated checksum %lu\n",
2974 (ulong) no,
2975 scanned_lsn,
2976@@ -2023,7 +2057,8 @@
2977
2978 group->scanned_lsn = group_scanned_lsn;
2979
2980- msg(">> log scanned up to (%llu)\n", group->scanned_lsn);
2981+ msg(">> log scanned up to (" LSN_PF ")\n",
2982+ group->scanned_lsn);
2983
2984 group = UT_LIST_GET_NEXT(log_groups, group);
2985
2986@@ -2332,12 +2367,16 @@
2987 ibool create_new_doublewrite_file;
2988 #endif
2989 ulint err;
2990- LSN64 min_flushed_lsn;
2991- LSN64 max_flushed_lsn;
2992+ lsn_t min_flushed_lsn;
2993+ lsn_t max_flushed_lsn;
2994 ulint sum_of_new_sizes;
2995
2996+#if MYSQL_VERSION_ID >= 50600
2997+ srv_n_file_io_threads = srv_n_read_io_threads;
2998+#else
2999 srv_n_file_io_threads = 2 + srv_n_read_io_threads +
3000 srv_n_write_io_threads;
3001+#endif
3002
3003 os_aio_init(8 * SRV_N_PENDING_IOS_PER_THREAD,
3004 srv_n_read_io_threads,
3005@@ -2606,10 +2645,10 @@
3006 xtrabackup_backup_func(void)
3007 {
3008 MY_STAT stat_info;
3009- LSN64 latest_cp;
3010+ lsn_t latest_cp;
3011 uint i;
3012 uint count;
3013- os_mutex_t count_mutex;
3014+ os_ib_mutex_t count_mutex;
3015 data_thread_ctxt_t *data_threads;
3016 char suspend_path[FN_REFLEN];
3017 ibool success;
3018@@ -2631,8 +2670,7 @@
3019 mysql_data_home[0]=FN_CURLIB; // all paths are relative from here
3020 mysql_data_home[1]=0;
3021
3022- /* set read only */
3023- srv_read_only = TRUE;
3024+ xb_set_innodb_read_only();
3025
3026 /* initialize components */
3027 if(innodb_init_param())
3028@@ -2711,6 +2749,7 @@
3029
3030 os_sync_mutex = NULL;
3031 srv_general_init();
3032+ ut_crc32_init();
3033
3034 xb_filters_init();
3035
3036@@ -2891,7 +2930,7 @@
3037 os_thread_id_t io_watching_thread_id;
3038
3039 io_ticket = xtrabackup_throttle;
3040- wait_throttle = os_event_create(NULL);
3041+ wait_throttle = xb_os_event_create(NULL);
3042
3043 os_thread_create(io_watching_thread, NULL, &io_watching_thread_id);
3044 }
3045@@ -2996,7 +3035,7 @@
3046 mutex_exit(&log_sys->mutex);
3047
3048 msg("xtrabackup: The latest check point (for incremental): "
3049- "'%llu'\n", latest_cp);
3050+ "'" LSN_PF "'\n", latest_cp);
3051 }
3052 skip_last_cp:
3053 /* stop log_copying_thread */
3054@@ -3051,9 +3090,8 @@
3055 if (wait_throttle)
3056 os_event_free(wait_throttle);
3057
3058- msg("xtrabackup: Transaction log of lsn (%llu) to (%llu) was copied.\n",
3059- checkpoint_lsn_start, log_copy_scanned_lsn);
3060-
3061+ msg("xtrabackup: Transaction log of lsn (" LSN_PF ") to (" LSN_PF
3062+ ") was copied.\n", checkpoint_lsn_start, log_copy_scanned_lsn);
3063 xb_filters_free();
3064
3065 xb_data_files_close();
3066@@ -3098,7 +3136,7 @@
3067 mtr_start(&mtr);
3068
3069 mtr_x_lock(&(index->lock), &mtr);
3070- block = btr_root_block_get(index, &mtr);
3071+ block = xb_btr_root_block_get(index, RW_X_LATCH, &mtr);
3072 page = buf_block_get_frame(block);
3073
3074 space = page_get_space_id(page);
3075@@ -3254,9 +3292,9 @@
3076 }
3077
3078 if (level == 0)
3079- fprintf(stdout, "recs=%lld, ", n_recs);
3080+ fprintf(stdout, "recs=%llu, ", n_recs);
3081
3082- fprintf(stdout, "pages=%lld, data=%lld bytes, data/pages=%lld%%",
3083+ fprintf(stdout, "pages=%llu, data=%llu bytes, data/pages=%lld%%",
3084 n_pages, sum_data,
3085 ((sum_data * 100)/ page_size)/n_pages);
3086
3087@@ -3266,7 +3304,7 @@
3088 /* also scan blob pages*/
3089 fprintf(stdout, " external pages: ");
3090
3091- fprintf(stdout, "pages=%lld, data=%lld bytes, data/pages=%lld%%",
3092+ fprintf(stdout, "pages=%llu, data=%llu bytes, data/pages=%lld%%",
3093 n_pages_extern, sum_data_extern,
3094 ((sum_data_extern * 100)/ page_size)/n_pages_extern);
3095 }
3096@@ -3298,10 +3336,12 @@
3097 mysql_data_home[0]=FN_CURLIB; // all paths are relative from here
3098 mysql_data_home[1]=0;
3099
3100+ xb_set_innodb_read_only();
3101 /* set read only */
3102- srv_read_only = TRUE;
3103+#if MYSQL_VERSION_ID < 50600
3104 srv_fake_write = TRUE;
3105-#if MYSQL_VERSION_ID >= 50500
3106+#endif
3107+#if (MYSQL_VERSION_ID >= 50500) && (MYSQL_VERSION_ID < 50600)
3108 /* AIO is incompatible with srv_read_only/srv_fake_write */
3109 srv_use_native_aio = FALSE;
3110 #endif
3111@@ -3359,9 +3399,7 @@
3112 /* Enlarge the fatal semaphore wait timeout during the InnoDB table
3113 monitor printout */
3114
3115- mutex_enter(&kernel_mutex);
3116- srv_fatal_semaphore_wait_threshold += 72000; /* 20 hours */
3117- mutex_exit(&kernel_mutex);
3118+ xb_adjust_fatal_semaphore_wait_threshold(72000); /* 20 hours */
3119
3120 mutex_enter(&(dict_sys->mutex));
3121
3122@@ -3370,8 +3408,8 @@
3123 sys_tables = dict_table_get_low("SYS_TABLES");
3124 sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
3125
3126- btr_pcur_open_at_index_side(TRUE, sys_index, BTR_SEARCH_LEAF, &pcur,
3127- TRUE, &mtr);
3128+ xb_btr_pcur_open_at_index_side(TRUE, sys_index, BTR_SEARCH_LEAF, &pcur,
3129+ TRUE, 0, &mtr);
3130 loop:
3131 btr_pcur_move_to_next_user_rec(&pcur, &mtr);
3132
3133@@ -3387,10 +3425,7 @@
3134 mutex_exit(&(dict_sys->mutex));
3135
3136 /* Restore the fatal semaphore wait timeout */
3137-
3138- mutex_enter(&kernel_mutex);
3139- srv_fatal_semaphore_wait_threshold -= 72000; /* 20 hours */
3140- mutex_exit(&kernel_mutex);
3141+ xb_adjust_fatal_semaphore_wait_threshold(-72000);
3142
3143 goto end;
3144 }
3145@@ -3435,11 +3470,7 @@
3146 is no index */
3147
3148 if (dict_table_get_first_index(table)) {
3149-#ifdef XTRADB_BASED
3150- dict_update_statistics(table, TRUE, FALSE);
3151-#else
3152- dict_update_statistics(table, TRUE);
3153-#endif
3154+ dict_stats_update_transient(table);
3155 }
3156
3157 //dict_table_print_low(table);
3158@@ -3447,7 +3478,7 @@
3159 index = UT_LIST_GET_FIRST(table->indexes);
3160 while (index != NULL) {
3161 {
3162- IB_INT64 n_vals;
3163+ ib_int64_t n_vals;
3164
3165 if (index->n_user_defined_cols > 0) {
3166 n_vals = index->stat_n_diff_key_vals[
3167@@ -3534,11 +3565,11 @@
3168 byte* log_buf;
3169 byte* log_buf_ = NULL;
3170
3171- IB_INT64 file_size;
3172+ ib_int64_t file_size;
3173
3174- LSN64 max_no;
3175- LSN64 max_lsn;
3176- LSN64 checkpoint_no;
3177+ lsn_t max_no;
3178+ lsn_t max_lsn;
3179+ lsn_t checkpoint_no;
3180
3181 ulint fold;
3182
3183@@ -3589,7 +3620,8 @@
3184 log_buf = static_cast<byte *>
3185 (ut_align(log_buf_, UNIV_PAGE_SIZE_MAX));
3186
3187- success = os_file_read(src_file, log_buf, 0, 0, LOG_FILE_HDR_SIZE);
3188+ success = xb_os_file_read(src_file, log_buf, 0,
3189+ LOG_FILE_HDR_SIZE);
3190 if (!success) {
3191 goto error;
3192 }
3193@@ -3631,7 +3663,7 @@
3194
3195 xb_file_set_nocache(src_file, src_path, "OPEN");
3196
3197- file_size = os_file_get_size_as_iblonglong(src_file);
3198+ file_size = os_file_get_size(src_file);
3199
3200
3201 /* TODO: We should skip the following modifies, if it is not the first time. */
3202@@ -3639,7 +3671,7 @@
3203 log_buf = static_cast<byte *>(ut_align(log_buf_, UNIV_PAGE_SIZE));
3204
3205 /* read log file header */
3206- success = os_file_read(src_file, log_buf, 0, 0, LOG_FILE_HDR_SIZE);
3207+ success = xb_os_file_read(src_file, log_buf, 0, LOG_FILE_HDR_SIZE);
3208 if (!success) {
3209 goto error;
3210 }
3211@@ -3658,7 +3690,8 @@
3212 /* read last checkpoint lsn */
3213 for (field = LOG_CHECKPOINT_1; field <= LOG_CHECKPOINT_2;
3214 field += LOG_CHECKPOINT_2 - LOG_CHECKPOINT_1) {
3215- if (!recv_check_cp_is_consistent(log_buf + field))
3216+ if (!xb_recv_check_cp_is_consistent(const_cast<const byte *>
3217+ (log_buf + field)))
3218 goto not_consistent;
3219
3220 checkpoint_no = MACH_READ_64(log_buf + field + LOG_CHECKPOINT_NO);
3221@@ -3692,7 +3725,8 @@
3222
3223 /* It seems to be needed to overwrite the both checkpoint area. */
3224 MACH_WRITE_64(log_buf + LOG_CHECKPOINT_1 + LOG_CHECKPOINT_LSN, max_lsn);
3225- mach_write_to_4(log_buf + LOG_CHECKPOINT_1 + LOG_CHECKPOINT_OFFSET,
3226+ mach_write_to_4(log_buf + LOG_CHECKPOINT_1
3227+ + LOG_CHECKPOINT_OFFSET_LOW32,
3228 LOG_FILE_HDR_SIZE + (ulint) ut_dulint_minus(max_lsn,
3229 ut_dulint_align_down(max_lsn,OS_FILE_LOG_BLOCK_SIZE)));
3230 #ifdef XTRADB_BASED
3231@@ -3708,9 +3742,10 @@
3232 mach_write_to_4(log_buf + LOG_CHECKPOINT_1 + LOG_CHECKPOINT_CHECKSUM_2, fold);
3233
3234 MACH_WRITE_64(log_buf + LOG_CHECKPOINT_2 + LOG_CHECKPOINT_LSN, max_lsn);
3235- mach_write_to_4(log_buf + LOG_CHECKPOINT_2 + LOG_CHECKPOINT_OFFSET,
3236- LOG_FILE_HDR_SIZE + (ulint) ut_dulint_minus(max_lsn,
3237- ut_dulint_align_down(max_lsn,OS_FILE_LOG_BLOCK_SIZE)));
3238+ mach_write_to_4(log_buf + LOG_CHECKPOINT_2
3239+ + LOG_CHECKPOINT_OFFSET_LOW32,
3240+ LOG_FILE_HDR_SIZE + (ulint) ut_dulint_minus(max_lsn,
3241+ ut_dulint_align_down(max_lsn,OS_FILE_LOG_BLOCK_SIZE)));
3242 #ifdef XTRADB_BASED
3243 MACH_WRITE_64(log_buf + LOG_CHECKPOINT_2 + LOG_CHECKPOINT_ARCHIVED_LSN,
3244 (ib_uint64_t)(LOG_FILE_HDR_SIZE + ut_dulint_minus(max_lsn,
3245@@ -3724,7 +3759,8 @@
3246 mach_write_to_4(log_buf + LOG_CHECKPOINT_2 + LOG_CHECKPOINT_CHECKSUM_2, fold);
3247
3248
3249- success = os_file_write(src_path, src_file, log_buf, 0, 0, LOG_FILE_HDR_SIZE);
3250+ success = xb_os_file_write(src_path, src_file, log_buf, 0,
3251+ LOG_FILE_HDR_SIZE);
3252 if (!success) {
3253 goto error;
3254 }
3255@@ -3733,15 +3769,16 @@
3256
3257 if (file_size % UNIV_PAGE_SIZE) {
3258 memset(log_buf, 0, UNIV_PAGE_SIZE);
3259- success = os_file_write(src_path, src_file, log_buf,
3260- (ulint)(file_size & 0xFFFFFFFFUL),
3261- (ulint)(file_size >> 32),
3262- UNIV_PAGE_SIZE - (ulint) (file_size % UNIV_PAGE_SIZE));
3263+ success = xb_os_file_write(src_path, src_file, log_buf,
3264+ file_size,
3265+ UNIV_PAGE_SIZE
3266+ - (ulint) (file_size
3267+ % UNIV_PAGE_SIZE));
3268 if (!success) {
3269 goto error;
3270 }
3271
3272- file_size = os_file_get_size_as_iblonglong(src_file);
3273+ file_size = os_file_get_size(src_file);
3274 }
3275
3276 /* TODO: We should judge whether the file is already expanded or not... */
3277@@ -3752,10 +3789,9 @@
3278 expand = (ulint) (file_size / UNIV_PAGE_SIZE / 8);
3279
3280 for (; expand > 128; expand -= 128) {
3281- success = os_file_write(src_path, src_file, log_buf,
3282- (ulint)(file_size & 0xFFFFFFFFUL),
3283- (ulint)(file_size >> 32),
3284- UNIV_PAGE_SIZE * 128);
3285+ success = xb_os_file_write(src_path, src_file, log_buf,
3286+ file_size,
3287+ UNIV_PAGE_SIZE * 128);
3288 if (!success) {
3289 goto error;
3290 }
3291@@ -3763,10 +3799,9 @@
3292 }
3293
3294 if (expand) {
3295- success = os_file_write(src_path, src_file, log_buf,
3296- (ulint)(file_size & 0xFFFFFFFFUL),
3297- (ulint)(file_size >> 32),
3298- expand * UNIV_PAGE_SIZE);
3299+ success = xb_os_file_write(src_path, src_file, log_buf,
3300+ file_size,
3301+ expand * UNIV_PAGE_SIZE);
3302 if (!success) {
3303 goto error;
3304 }
3305@@ -3778,26 +3813,24 @@
3306 if (file_size < 2*1024*1024L) {
3307 memset(log_buf, 0, UNIV_PAGE_SIZE);
3308 while (file_size < 2*1024*1024L) {
3309- success = os_file_write(src_path, src_file, log_buf,
3310- (ulint)(file_size & 0xFFFFFFFFUL),
3311- (ulint)(file_size >> 32),
3312- UNIV_PAGE_SIZE);
3313+ success = xb_os_file_write(src_path, src_file, log_buf,
3314+ file_size, UNIV_PAGE_SIZE);
3315 if (!success) {
3316 goto error;
3317 }
3318 file_size += UNIV_PAGE_SIZE;
3319 }
3320- file_size = os_file_get_size_as_iblonglong(src_file);
3321+ file_size = os_file_get_size(src_file);
3322 }
3323
3324- msg("xtrabackup: xtrabackup_logfile detected: size=%lld, "
3325- "start_lsn=(%llu)\n", file_size, max_lsn);
3326+ msg("xtrabackup: xtrabackup_logfile detected: size=" INT64PF ", "
3327+ "start_lsn=(" LSN_PF ")\n", file_size, max_lsn);
3328
3329 os_file_close(src_file);
3330 src_file = XB_FILE_UNDEFINED;
3331
3332 /* fake InnoDB */
3333- innobase_log_group_home_dir = NULL;
3334+ INNODB_LOG_DIR = NULL;
3335 innobase_log_file_size = file_size;
3336 innobase_log_files_in_group = 1;
3337
3338@@ -3888,19 +3921,21 @@
3339 xtrabackup_target_dir, dbname);
3340 srv_normalize_path_for_win(dest_dir);
3341
3342- snprintf(dest_space_name, FN_REFLEN, "./%s/%s",
3343- dbname, name);
3344+ snprintf(dest_space_name, FN_REFLEN, "%s%s/%s",
3345+ xb_dict_prefix, dbname, name);
3346 } else {
3347 snprintf(dest_dir, FN_REFLEN, "%s", xtrabackup_target_dir);
3348 srv_normalize_path_for_win(dest_dir);
3349
3350- snprintf(dest_space_name, FN_REFLEN, "./%s", name);
3351+ snprintf(dest_space_name, FN_REFLEN, "%s%s", xb_dict_prefix,
3352+ name);
3353 }
3354
3355 snprintf(real_name, real_name_len,
3356 "%s/%s",
3357 xtrabackup_target_dir, dest_space_name);
3358 srv_normalize_path_for_win(real_name);
3359+ dest_space_name[strlen(dest_space_name) - XB_DICT_SUFFIX_LEN] = '\0';
3360
3361 /* Create the database directory if it doesn't exist yet */
3362 if (!os_file_create_directory(dest_dir, FALSE)) {
3363@@ -3924,14 +3959,14 @@
3364
3365 char tmpname[FN_REFLEN];
3366
3367- snprintf(tmpname, FN_REFLEN, "./%s/xtrabackup_tmp_#%lu",
3368- dbname, fil_space->id);
3369+ snprintf(tmpname, FN_REFLEN, "%s%s/xtrabackup_tmp_#%lu",
3370+ xb_dict_prefix, dbname, fil_space->id);
3371
3372 msg("xtrabackup: Renaming %s to %s.ibd\n",
3373 fil_space->name, tmpname);
3374
3375- if (!fil_rename_tablespace(NULL,
3376- fil_space->id, tmpname))
3377+ if (!xb_fil_rename_tablespace(NULL, fil_space->id,
3378+ tmpname, NULL))
3379 {
3380 msg("xtrabackup: Cannot rename %s to %s\n",
3381 fil_space->name, tmpname);
3382@@ -3953,13 +3988,17 @@
3383 char tmpname[FN_REFLEN];
3384
3385 strncpy(tmpname, dest_space_name, FN_REFLEN);
3386+#if MYSQL_VERSION_ID < 50600
3387+ /* Need to truncate .ibd before renaming. For MySQL 5.6 it's
3388+ already truncated. */
3389 tmpname[strlen(tmpname) - 4] = 0;
3390+#endif
3391
3392 msg("xtrabackup: Renaming %s to %s\n",
3393 fil_space->name, dest_space_name);
3394
3395- if (!fil_rename_tablespace(NULL,
3396- fil_space->id, tmpname))
3397+ if (!xb_fil_rename_tablespace(NULL, fil_space->id, tmpname,
3398+ NULL))
3399 {
3400 msg("xtrabackup: Cannot rename %s to %s\n",
3401 fil_space->name, dest_space_name);
3402@@ -3989,7 +4028,7 @@
3403 << DICT_TF_ZSSIZE_SHIFT)
3404 | DICT_TF_COMPACT
3405 | (DICT_TF_FORMAT_ZIP << DICT_TF_FORMAT_SHIFT);
3406- ut_a(dict_table_flags_to_zip_size(tablespace_flags)
3407+ ut_a(dict_tf_get_zip_size(tablespace_flags)
3408 == zip_size);
3409 }
3410 *success = xb_space_create_file(real_name, space_id, tablespace_flags,
3411@@ -4126,12 +4165,11 @@
3412
3413 /* read to buffer */
3414 /* first block of block cluster */
3415- success = os_file_read(src_file, incremental_buffer,
3416- ((incremental_buffers * (page_size / 4))
3417- << page_size_shift) & 0xFFFFFFFFUL,
3418- (incremental_buffers * (page_size / 4))
3419- >> (32 - page_size_shift),
3420- page_size);
3421+ success = xb_os_file_read(src_file, incremental_buffer,
3422+ ((incremental_buffers
3423+ * (page_size / 4))
3424+ << page_size_shift),
3425+ page_size);
3426 if (!success) {
3427 goto error;
3428 }
3429@@ -4159,12 +4197,11 @@
3430 ut_a(last_buffer || page_in_buffer == page_size / 4);
3431
3432 /* read whole of the cluster */
3433- success = os_file_read(src_file, incremental_buffer,
3434- ((incremental_buffers * (page_size / 4))
3435- << page_size_shift) & 0xFFFFFFFFUL,
3436- (incremental_buffers * (page_size / 4))
3437- >> (32 - page_size_shift),
3438- page_in_buffer * page_size);
3439+ success = xb_os_file_read(src_file, incremental_buffer,
3440+ ((incremental_buffers
3441+ * (page_size / 4))
3442+ << page_size_shift),
3443+ page_in_buffer * page_size);
3444 if (!success) {
3445 goto error;
3446 }
3447@@ -4185,12 +4222,10 @@
3448 // + FIL_PAGE_LSN)) >= 0)
3449 // continue;
3450
3451- success = os_file_write(dst_path, dst_file,
3452+ success = xb_os_file_write(dst_path, dst_file,
3453 incremental_buffer +
3454 page_in_buffer * page_size,
3455- (offset_on_page << page_size_shift) &
3456- 0xFFFFFFFFUL,
3457- offset_on_page >> (32 - page_size_shift),
3458+ (offset_on_page << page_size_shift),
3459 page_size);
3460 if (!success) {
3461 goto error;
3462@@ -4227,13 +4262,13 @@
3463 ibool
3464 xtrabackup_apply_deltas(my_bool check_newer)
3465 {
3466- int ret;
3467+ ulint ret;
3468 char dbpath[FN_REFLEN];
3469 os_file_dir_t dir;
3470 os_file_dir_t dbdir;
3471 os_file_stat_t dbinfo;
3472 os_file_stat_t fileinfo;
3473- ulint err = DB_SUCCESS;
3474+ dberr_t err = DB_SUCCESS;
3475 static char current_dir[2];
3476
3477 current_dir[0] = FN_CURLIB;
3478@@ -4395,14 +4430,15 @@
3479 UNIV_PAGE_SIZE_MAX));
3480 log_buf = static_cast<byte *>(ut_align(log_buf_, UNIV_PAGE_SIZE_MAX));
3481
3482- success = os_file_read(src_file, log_buf, 0, 0, LOG_FILE_HDR_SIZE);
3483+ success = xb_os_file_read(src_file, log_buf, 0, LOG_FILE_HDR_SIZE);
3484 if (!success) {
3485 goto error;
3486 }
3487
3488 memset(log_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP, ' ', 4);
3489
3490- success = os_file_write(src_path, src_file, log_buf, 0, 0, LOG_FILE_HDR_SIZE);
3491+ success = xb_os_file_write(src_path, src_file, log_buf, 0,
3492+ LOG_FILE_HDR_SIZE);
3493 if (!success) {
3494 goto error;
3495 }
3496@@ -4492,6 +4528,7 @@
3497 sync_init();
3498 os_io_init_simple();
3499 mem_init(srv_mem_pool_size);
3500+ ut_crc32_init();
3501
3502 if(xtrabackup_init_temp_log())
3503 goto error;
3504@@ -4593,7 +4630,7 @@
3505 mtr_s_lock(fil_space_get_latch(space->id, &flags), &mtr);
3506
3507 block = buf_page_get(space->id,
3508- dict_table_flags_to_zip_size(flags),
3509+ dict_tf_get_zip_size(flags),
3510 0, RW_S_LATCH, &mtr);
3511 header = FSP_HEADER_OFFSET + buf_block_get_frame(block);
3512
3513@@ -4682,7 +4719,7 @@
3514 }
3515
3516 /* init exp file */
3517- bzero(page, UNIV_PAGE_SIZE);
3518+ memset(page, 0, UNIV_PAGE_SIZE);
3519 mach_write_to_4(page , 0x78706f72UL);
3520 mach_write_to_4(page + 4, 0x74696e66UL);/*"xportinf"*/
3521 mach_write_to_4(page + 8, n_index);
3522@@ -4699,12 +4736,7 @@
3523 while (index) {
3524 mach_write_to_8(page + n_index * 512, index->id);
3525 mach_write_to_4(page + n_index * 512 + 8,
3526-#if (MYSQL_VERSION_ID < 50100)
3527- index->tree->page
3528-#else /* MYSQL_VERSION_ID < 51000 */
3529- index->page
3530-#endif
3531- );
3532+ index->page);
3533 strncpy((char *) page + n_index * 512 +
3534 12, index->name, 500);
3535
3536@@ -4717,12 +4749,7 @@
3537 (ulint)(index->id &
3538 0xFFFFFFFFUL),
3539 #endif
3540-#if (MYSQL_VERSION_ID < 50100)
3541- index->tree->page
3542-#else /* MYSQL_VERSION_ID < 51000 */
3543- (ulint) index->page
3544-#endif
3545- );
3546+ (ulint) index->page);
3547 index = dict_table_get_next_index(index);
3548 n_index++;
3549
3550@@ -4736,9 +4763,9 @@
3551 os_file_get_last_error(TRUE);
3552 goto next_node;
3553 }
3554- success = os_file_write(info_file_path,
3555- info_file, page,
3556- 0, 0, UNIV_PAGE_SIZE);
3557+ success = xb_os_file_write(info_file_path,
3558+ info_file, page,
3559+ 0, UNIV_PAGE_SIZE);
3560 if (!success) {
3561 os_file_get_last_error(TRUE);
3562 goto next_node;
3563@@ -4773,7 +4800,9 @@
3564
3565 fp = fopen("xtrabackup_binlog_pos_innodb", "w");
3566 if (fp) {
3567- fprintf(fp, "%s\t%llu\n",
3568+ /* Use UINT64PF instead of LSN_PF here, as we have to
3569+ maintain the file format. */
3570+ fprintf(fp, "%s\t" UINT64PF "\n",
3571 trx_sys_mysql_bin_log_name,
3572 trx_sys_mysql_bin_log_pos);
3573 fclose(fp);
3574@@ -4796,10 +4825,10 @@
3575 "xtrabackup: ########################################################\n"
3576 );
3577 if (xtrabackup_incremental) {
3578- msg("xtrabackup: The intended lsn is %llu\n",
3579+ msg("xtrabackup: The intended lsn is " LSN_PF "\n",
3580 incremental_last_lsn);
3581 } else {
3582- msg("xtrabackup: The intended lsn is %llu\n",
3583+ msg("xtrabackup: The intended lsn is " LSN_PF "\n",
3584 metadata_last_lsn);
3585 }
3586 }
3587@@ -4872,6 +4901,11 @@
3588 MY_INIT(argv[0]);
3589 xb_regex_init();
3590
3591+#if MYSQL_VERSION_ID >= 50600
3592+ system_charset_info= &my_charset_utf8_general_ci;
3593+ key_map_full.set_all();
3594+#endif
3595+
3596 /* scan options for group to load defaults from */
3597 {
3598 int i;
3599@@ -4879,11 +4913,11 @@
3600 for (i=1; i < argc; i++) {
3601 optend = strcend(argv[i], '=');
3602 if (strncmp(argv[i], "--defaults-group", optend - argv[i]) == 0) {
3603- load_default_groups[2] = defaults_group = optend + 1;
3604+ xb_load_default_groups[2] = defaults_group = optend + 1;
3605 }
3606 }
3607 }
3608- load_defaults("my",load_default_groups,&argc,&argv);
3609+ load_defaults("my", xb_load_default_groups, &argc, &argv);
3610
3611 /* ignore unsupported options */
3612 {
3613@@ -4894,7 +4928,7 @@
3614 j=1;
3615 for (i=1 ; i < argc ; i++) {
3616 uint count;
3617- struct my_option *opt= (struct my_option *) my_long_options;
3618+ struct my_option *opt= (struct my_option *) xb_long_options;
3619 optend= strcend((argv)[i], '=');
3620 if (!strncmp(argv[i], "--defaults-file", optend - argv[i]))
3621 {
3622@@ -4933,7 +4967,7 @@
3623 argv[argc] = NULL;
3624 }
3625
3626- if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
3627+ if ((ho_error=handle_options(&argc, &argv, xb_long_options, get_one_option)))
3628 exit(ho_error);
3629
3630 if ((!xtrabackup_print_param) && (!xtrabackup_prepare) && (strcmp(mysql_data_home, "./") == 0)) {
3631@@ -5004,7 +5038,8 @@
3632 /* --print-param */
3633 if (xtrabackup_print_param) {
3634 /* === some variables from mysqld === */
3635- bzero((G_PTR) &mysql_tmpdir_list, sizeof(mysql_tmpdir_list));
3636+ memset((G_PTR) &mysql_tmpdir_list, 0,
3637+ sizeof(mysql_tmpdir_list));
3638
3639 if (init_tmpdir(&mysql_tmpdir_list, opt_mysql_tmpdir))
3640 exit(EXIT_FAILURE);
3641@@ -5018,7 +5053,7 @@
3642 printf("innodb_data_file_path = \"%s\"\n",
3643 innobase_data_file_path ? innobase_data_file_path : "ibdata1:10M:autoextend");
3644 printf("innodb_log_group_home_dir = \"%s\"\n",
3645- innobase_log_group_home_dir ? innobase_log_group_home_dir : mysql_data_home);
3646+ INNODB_LOG_DIR ? INNODB_LOG_DIR : mysql_data_home);
3647 printf("innodb_log_files_in_group = %ld\n", innobase_log_files_in_group);
3648 printf("innodb_log_file_size = %lld\n", innobase_log_file_size);
3649 printf("innodb_flush_method = \"%s\"\n",
3650@@ -5039,7 +5074,7 @@
3651
3652 print_version();
3653 if (xtrabackup_incremental) {
3654- msg("incremental backup from %llu is enabled.\n",
3655+ msg("incremental backup from " LSN_PF " is enabled.\n",
3656 incremental_lsn);
3657 }
3658
3659
3660=== modified file 'src/xtrabackup.h'
3661--- src/xtrabackup.h 2013-02-20 10:20:00 +0000
3662+++ src/xtrabackup.h 2013-03-22 15:32:33 +0000
3663@@ -32,15 +32,15 @@
3664
3665 /* ======== Datafiles iterator ======== */
3666 typedef struct {
3667- fil_system_t *system;
3668- fil_space_t *space;
3669- fil_node_t *node;
3670- ibool started;
3671- os_mutex_t mutex;
3672+ fil_system_t *system;
3673+ fil_space_t *space;
3674+ fil_node_t *node;
3675+ ibool started;
3676+ os_ib_mutex_t mutex;
3677 } datafiles_iter_t;
3678
3679 /* value of the --incremental option */
3680-extern LSN64 incremental_lsn;
3681+extern lsn_t incremental_lsn;
3682
3683 extern char *xtrabackup_target_dir;
3684 extern ds_ctxt_t *ds_meta;
3685
3686=== modified file 'test/bootstrap.sh'
3687--- test/bootstrap.sh 2013-03-18 09:30:00 +0000
3688+++ test/bootstrap.sh 2013-03-22 15:32:33 +0000
3689@@ -13,7 +13,7 @@
3690 tests.
3691
3692 If the argument is one of the build targets passed to build.sh
3693-(i.e. innodb51 innodb55 xtradb51 xtradb55) then the
3694+(i.e. innodb51 innodb55 innodb56 xtradb51 xtradb55) then the
3695 appropriate Linux tarball is downloaded from a pre-defined location and
3696 unpacked into the specified installation directory ('./server' by default).
3697
3698@@ -50,6 +50,11 @@
3699 tarball="mysql-5.5.16-linux2.6-$arch.tar.gz"
3700 ;;
3701
3702+ innodb56)
3703+ url="http://s3.amazonaws.com/percona.com/downloads/community"
3704+ tarball="mysql-5.6.10-linux-glibc2.5-$arch.tar.gz"
3705+ ;;
3706+
3707 xtradb51)
3708 url="http://www.percona.com/redir/downloads/Percona-Server-5.1/Percona-Server-5.1.67-14.4/binary/linux/$arch"
3709 tarball="Percona-Server-5.1.67-rel14.4-511.Linux.$arch.tar.gz"
3710
3711=== modified file 'test/inc/common.sh'
3712--- test/inc/common.sh 2013-03-07 11:45:53 +0000
3713+++ test/inc/common.sh 2013-03-22 15:32:33 +0000
3714@@ -44,7 +44,7 @@
3715 vlog "Creating server data directory: $MYSQLD_DATADIR"
3716 mkdir -p "$MYSQLD_DATADIR"
3717 vlog "Calling mysql_install_db"
3718- $MYSQL_INSTALL_DB --no-defaults --basedir=$MYSQL_BASEDIR --datadir="$MYSQLD_DATADIR" --tmpdir="$MYSQLD_TMPDIR"
3719+ $MYSQL_INSTALL_DB --no-defaults --basedir=$MYSQL_BASEDIR --datadir="$MYSQLD_DATADIR" --tmpdir="$MYSQLD_TMPDIR" ${MYSQLD_EXTRA_ARGS}
3720 fi
3721 }
3722
3723@@ -417,7 +417,7 @@
3724 ########################################################################
3725 function checksum_table()
3726 {
3727- $MYSQL $MYSQL_ARGS -Ns -e "CHECKSUM TABLE $2" $1 | awk {'print $2'}
3728+ $MYSQL $MYSQL_ARGS -Ns -e "CHECKSUM TABLE $2 EXTENDED" $1 | awk {'print $2'}
3729 }
3730
3731 ##########################################################################
3732
3733=== modified file 'test/t/bug1062684.sh'
3734--- test/t/bug1062684.sh 2012-11-16 10:40:34 +0000
3735+++ test/t/bug1062684.sh 2013-03-22 15:32:33 +0000
3736@@ -1,9 +1,10 @@
3737+MYSQLD_EXTRA_ARGS=--innodb-data-file-path="ibdata1:${DEFAULT_IBDATA_SIZE};ibdata2:5M:autoextend"
3738 . inc/common.sh
3739
3740-start_server --innodb-data-file-path="ibdata1:10M;ibdata2:5M:autoextend"
3741+start_server --innodb-data-file-path="ibdata1:${DEFAULT_IBDATA_SIZE};ibdata2:5M:autoextend"
3742 load_dbase_schema incremental_sample
3743
3744-echo "innodb-data-file-path=ibdata1:10M;ibdata2:5M:autoextend" >>$topdir/my.cnf
3745+echo "innodb-data-file-path=ibdata1:${DEFAULT_IBDATA_SIZE};ibdata2:5M:autoextend" >>$topdir/my.cnf
3746
3747 # Adding initial rows
3748 vlog "Adding initial rows to database..."
3749@@ -76,7 +77,7 @@
3750 innobackupex --copy-back $full_backup_dir
3751 vlog "Data restored"
3752
3753-start_server --innodb-data-file-path="ibdata1:10M;ibdata2:5M:autoextend"
3754+start_server --innodb-data-file-path="ibdata1:${DEFAULT_IBDATA_SIZE};ibdata2:5M:autoextend"
3755
3756 vlog "Checking checksums"
3757 checksum_test_b=`checksum_table incremental_sample test`
3758
3759=== modified file 'test/t/bug891496.sh'
3760--- test/t/bug891496.sh 2012-10-15 16:14:59 +0000
3761+++ test/t/bug891496.sh 2013-03-22 15:32:33 +0000
3762@@ -1,6 +1,7 @@
3763 ##########################################################################
3764 # Bug #891496: tar4ibd fails on datafiles generated on 5.0 #
3765 ##########################################################################
3766+MYSQLD_EXTRA_ARGS=--innodb-data-file-path="ibdata1:3M;ibdata2:10M:autoextend"
3767
3768 . inc/common.sh
3769
3770
3771=== modified file 'test/testrun.sh'
3772--- test/testrun.sh 2013-03-11 09:29:11 +0000
3773+++ test/testrun.sh 2013-03-22 15:32:33 +0000
3774@@ -129,6 +129,8 @@
3775 ;;
3776 "innodb55" )
3777 XB_BIN="xtrabackup_innodb55";;
3778+ "innodb56" )
3779+ XB_BIN="xtrabackup_innodb56" ;;
3780 "xtradb51" | "mariadb51" | "mariadb52" | "mariadb53")
3781 XB_BIN="xtrabackup";;
3782 "xtradb55" | "mariadb55")
3783@@ -157,6 +159,9 @@
3784 INNODB_VERSION=${INNODB_VERSION#"innodb_version "}
3785 XTRADB_VERSION="`echo $INNODB_VERSION | sed 's/[0-9]\.[0-9]\.[0-9][0-9]*\(-[0-9][0-9]*\.[0-9][0-9]*\)*$/\1/'`"
3786
3787+ # Version-specific defaults
3788+ DEFAULT_IBDATA_SIZE="10M"
3789+
3790 # Determine MySQL flavor
3791 if [[ "$MYSQL_VERSION" =~ "MariaDB" ]]
3792 then
3793@@ -198,8 +203,12 @@
3794 else
3795 XB_BIN="xtrabackup_innodb55"
3796 fi
3797+ elif [ "${MYSQL_VERSION:0:3}" = "5.6" ]
3798+ then
3799+ XB_BIN="xtrabackup_innodb56"
3800+ DEFAULT_IBDATA_SIZE="12M"
3801 else
3802- vlog "Uknown MySQL/InnoDB version: $MYSQL_VERSION/$INNODB_VERSION"
3803+ vlog "Unknown MySQL/InnoDB version: $MYSQL_VERSION/$INNODB_VERSION"
3804 exit -1
3805 fi
3806 fi
3807@@ -224,7 +233,8 @@
3808
3809 export MYSQL_VERSION MYSQL_VERSION_COMMENT MYSQL_FLAVOR \
3810 INNODB_VERSION XTRADB_VERSION INNODB_FLAVOR \
3811- XB_BIN IB_BIN IB_ARGS XB_ARGS MYSQLD_EXTRA_ARGS
3812+ XB_BIN IB_BIN IB_ARGS XB_ARGS MYSQLD_EXTRA_ARGS \
3813+ DEFAULT_IBDATA_SIZE
3814 }
3815
3816 export SKIPPED_EXIT_CODE=200
3817
3818=== modified file 'utils/build.sh'
3819--- utils/build.sh 2013-03-11 19:11:29 +0000
3820+++ utils/build.sh 2013-03-22 15:32:33 +0000
3821@@ -4,6 +4,7 @@
3822
3823 MYSQL_51_VERSION=5.1.59
3824 MYSQL_55_VERSION=5.5.17
3825+MYSQL_56_VERSION=5.6.10
3826 PS_51_VERSION=5.1.59-13.0
3827 PS_55_VERSION=5.5.16-22.0
3828
3829@@ -20,6 +21,9 @@
3830 "5.5" )
3831 type="innodb55"
3832 ;;
3833+"5.6" )
3834+ type="innodb56"
3835+ ;;
3836 "xtradb" )
3837 type="xtradb51"
3838 ;;
3839@@ -40,12 +44,12 @@
3840 CFLAGS="$CFLAGS -g -O0 $innodb_extra_debug -DSAFE_MUTEX -DSAFEMALLOC"
3841 CXXFLAGS="$CXXFLAGS -g -O0 $innodb_extra_debug -DSAFE_MUTEX -DSAFEMALLOC"
3842 extra_config_51="--with-debug=full"
3843- extra_config_55="-DWITH_DEBUG=ON"
3844+ extra_config_55plus="-DWITH_DEBUG=ON -DMYSQL_MAINTAINER_MODE=OFF"
3845 else
3846 CFLAGS="$CFLAGS -g -O3"
3847 CXXFLAGS="$CXXFLAGS -g -O3"
3848 extra_config_51=
3849- extra_config_55=
3850+ extra_config_55plus=
3851 fi
3852
3853 xtrabackup_include_dir="$top_dir/src"
3854@@ -69,6 +73,7 @@
3855 echo "where CODEBASE can be one of the following values or aliases:"
3856 echo " innodb51 | plugin build agsinst InnoDB plugin in MySQL 5.1"
3857 echo " innodb55 | 5.5 build against InnoDB in MySQL 5.5"
3858+ echo " innodb56 | 5.6 build against InnoDB in MySQL 5.6"
3859 echo " xtradb51 | xtradb,mariadb51 build against Percona Server with XtraDB 5.1"
3860 echo " | mariadb52,mariadb53"
3861 echo " xtradb55 | xtradb55,galera55, build against Percona Server with XtraDB 5.5"
3862@@ -123,14 +128,20 @@
3863
3864 function build_server()
3865 {
3866+ local $type=$1
3867 echo "Configuring the server"
3868 cd $server_dir
3869 BUILD/autorun.sh
3870 eval $configure_cmd
3871
3872 echo "Building the server"
3873- make_dirs include zlib strings mysys dbug extra
3874- make_dirs $innodb_dir
3875+ if [ "$type" = "innodb56" ]
3876+ then
3877+ make_dirs libmysqld
3878+ else
3879+ make_dirs include zlib strings mysys dbug extra
3880+ make_dirs $innodb_dir
3881+ fi
3882 cd $top_dir
3883 }
3884
3885@@ -181,6 +192,7 @@
3886 ################################################################################
3887 function build_all()
3888 {
3889+ local type=$1
3890 local mysql_version_short=${mysql_version:0:3}
3891 server_dir=$top_dir/mysql-$mysql_version_short
3892 server_tarball=mysql-$mysql_version.tar.gz
3893@@ -195,7 +207,7 @@
3894 unpack_and_patch $server_tarball $server_patch
3895 mv $top_dir/mysql-$mysql_version $server_dir
3896
3897- build_server
3898+ build_server $type
3899
3900 build_xtrabackup
3901 }
3902@@ -219,7 +231,7 @@
3903 --enable-shared \
3904 --with-extra-charsets=all $extra_config_51"
3905
3906- build_all
3907+ build_all $type
3908 ;;
3909 "innodb55")
3910 mysql_version=$MYSQL_55_VERSION
3911@@ -233,11 +245,24 @@
3912 -DWITH_PARTITION_STORAGE_ENGINE=ON \
3913 -DWITH_ZLIB=bundled \
3914 -DWITH_EXTRA_CHARSETS=all \
3915- -DENABLE_DTRACE=OFF $extra_config_55"
3916+ -DENABLE_DTRACE=OFF $extra_config_55plus"
3917
3918- build_all
3919+ build_all $type
3920 ;;
3921
3922+"innodb56")
3923+ mysql_version=$MYSQL_56_VERSION
3924+ server_patch=innodb56.patch
3925+ innodb_name=innobase
3926+ xtrabackup_target=5.6
3927+ configure_cmd="cmake . \
3928+ -DWITH_INNOBASE_STORAGE_ENGINE=ON \
3929+ -DWITH_ZLIB=bundled \
3930+ -DWITH_EXTRA_CHARSETS=all \
3931+ -DWITH_EMBEDDED_SERVER=1 $extra_config_55plus"
3932+ build_all $type
3933+ ;;
3934+
3935 "xtradb51" | "mariadb51" | "mariadb52" | "mariadb53")
3936 server_dir=$top_dir/Percona-Server
3937 branch_dir=percona-server-5.1-xtrabackup
3938@@ -284,7 +309,7 @@
3939 cd $server_dir
3940 patch -p1 < $top_dir/patches/xtradb51.patch
3941
3942- build_server
3943+ build_server $type
3944
3945 build_xtrabackup
3946
3947@@ -301,7 +326,7 @@
3948 -DWITH_PARTITION_STORAGE_ENGINE=ON \
3949 -DWITH_ZLIB=bundled \
3950 -DWITH_EXTRA_CHARSETS=all \
3951- -DENABLE_DTRACE=OFF $extra_config_55"
3952+ -DENABLE_DTRACE=OFF $extra_config_55plus"
3953 if [ "`uname -s`" = "Linux" ]
3954 then
3955 configure_cmd="LIBS=-lrt $configure_cmd"
3956@@ -338,7 +363,7 @@
3957 cd $server_dir
3958 patch -p1 < $top_dir/patches/xtradb55.patch
3959
3960- build_server
3961+ build_server $type
3962
3963 build_xtrabackup
3964

Subscribers

People subscribed via source and target branches