Merge lp:~akopytov/percona-xtrabackup/support-separate-undo-tablespaces-2.0 into lp:percona-xtrabackup/2.0

Proposed by Alexey Kopytov
Status: Merged
Approved by: Alexey Kopytov
Approved revision: no longer in the source branch.
Merged at revision: 533
Proposed branch: lp:~akopytov/percona-xtrabackup/support-separate-undo-tablespaces-2.0
Merge into: lp:percona-xtrabackup/2.0
Diff against target: 1224 lines (+475/-131)
19 files modified
innobackupex (+32/-3)
patches/innodb56.patch (+192/-38)
src/xtrabackup.cc (+52/-7)
test/inc/common.sh (+47/-27)
test/t/bug1062684.sh (+11/-4)
test/t/bug483827.sh (+1/-4)
test/t/bug606981.sh (+9/-5)
test/t/bug740489.sh (+22/-14)
test/t/bug759225.sh (+6/-4)
test/t/bug870119.sh (+6/-3)
test/t/bug891496.sh (+6/-8)
test/t/bug976945.sh (+4/-2)
test/t/bug977101.sh (+3/-4)
test/t/ib_doublewrite.sh (+6/-3)
test/t/ib_slave_info.sh (+2/-2)
test/t/undo_tablespaces.sh (+75/-0)
test/t/xb_basic.sh (+0/-1)
test/t/xb_version.sh (+0/-1)
test/testrun.sh (+1/-1)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/support-separate-undo-tablespaces-2.0
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) Needs Information
Alexey Kopytov (community) Approve
Review via email: mp+159911@code.launchpad.net

Description of the change

  Implementation of
  https://blueprints.launchpad.net/percona-xtrabackup/+spec/support-separate-undo-tablespace

  In order to backup separate undo tablespaces they must be added in the
  fil_system list of tablespaces on the backup stage. This is implemented
  in srv_undo_tablespaces_init(), which needs some modifications for
  XtraBackup. First, create_new_db is always FALSE in XtraBackup. We also
  need another argument to check if we can read the number of currently
  used undo tablespaces from the trx header. We can't do that on the
  backup stage, so we just do what srv_undo_tablespaces_init() would do in
  'create_new_db == TRUE' mode, i.e. just assume the number of available
  undo tablespaces is the number of used tablespaces.

  We also have to restore undo tablespaces on --copy-back (unlike
  e.g. separate doublewrite tablespace in PS). The reasons are that:

  1) the server would refuse to start if the number of available undo
  tablespaces is less than the number of configured ones.

  2) we can prepare the backup with --redo-only (i.e. let the server
  rollback uncommitted transactions)

  There were also some tweaks to the test suite required to create a test
  case. Previously my.cnf was only used by xtrabackup, but not the server
  itself (one had to pass arguments to start_server and then add the same
  arguments to my.cnf for xtrabackup to "see" them). Now my.cnf is used by
  both server and xtrabackup, and it is possible to add custom entries to
  my.cnf using the MYSQLD_EXTRA_MY_CNF_OPTS variable.

  This patch also fixes bug #1169971: "Lost InnoDB messages in
  xtrabackup_56".

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

To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) wrote :

Approving, since the 2.1 MP has been approved.

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

Alexey Kopytov <email address hidden> writes:
> Review: Approve
>
> Approving, since the 2.1 MP has been approved.

Yep. that's called "flakey conference internet leading to making it hard
to approve things"

--
Stewart Smith

Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

The ib_logf() patch to fix bug 1169971 patches away the "InnoDB: " prefix for the output diagnostics. Was this intended?

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

Hi Laurynas,

On Wed, 24 Apr 2013 17:11:26 -0000, Laurynas Biveinis wrote:
> Review: Needs Information
>
> The ib_logf() patch to fix bug 1169971 patches away the "InnoDB: " prefix for the output diagnostics. Was this intended?
>

No, it was not. I'm not even sure we need it, but will create a followup
MP. Thanks.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'innobackupex'
2--- innobackupex 2013-04-03 07:04:25 +0000
3+++ innobackupex 2013-04-22 11:03:29 +0000
4@@ -715,12 +715,15 @@
5 get_option(\%config, $option_defaults_group, 'innodb_data_file_path');
6 my $orig_iblog_dir =
7 get_option(\%config, $option_defaults_group, 'innodb_log_group_home_dir');
8+ my $orig_undo_dir = $orig_ibdata_dir;
9 my $iblog_files = 'ib_logfile.*';
10+ my $ibundo_files = 'undo[0-9]{3}';
11 my $excluded_files =
12 '\.\.?|backup-my\.cnf|xtrabackup_logfile|' .
13- 'xtrabackup_binary|xtrabackup_binlog_info|xtrabackup_checkpoints|' .
14+ 'xtrabackup_binary|xtrabackup_binlog_info|xtrabackup_checkpoints|' .
15 '.*\.qp|' .
16- $iblog_files;
17+ $iblog_files . '|'.
18+ $ibundo_files;
19 my $compressed_data_file = '.*\.ibz$';
20 my $file;
21 my $backup_innodb_data_file_path;
22@@ -732,6 +735,10 @@
23 $excluded_files = $excluded_files . '|' . $doublewrite_file;
24 }
25
26+ if (has_option(\%config, $option_defaults_group, 'innodb_undo_directory')) {
27+ $orig_undo_dir = get_option(\%config, $option_defaults_group,
28+ 'innodb_undo_directory');
29+ }
30 # check whether files should be copied or moved to dest directory
31 my $move_or_copy_file = $move_flag ? \&move_file : \&copy_file;
32 my $move_or_copy_dir = $move_flag ?
33@@ -743,6 +750,10 @@
34 if_directory_exists_and_empty($orig_datadir, "Original data");
35 if_directory_exists_and_empty($orig_ibdata_dir, "Original InnoDB data");
36 if_directory_exists_and_empty($orig_iblog_dir, "Original InnoDB log");
37+ if ($orig_undo_dir) {
38+ if_directory_exists_and_empty($orig_undo_dir,
39+ "Original undo directory");
40+ }
41
42 # check that the original options file and the backup options file have
43 # the same value for "innodb_data_file_path" option
44@@ -801,6 +812,22 @@
45 &$move_or_copy_file($src_name, $dst_name);
46 }
47
48+ # copy InnoDB undo tablespaces to innodb_undo_directory (if specified), or
49+ # to the InnoDB data directory
50+ print STDERR "\n$prefix Starting to $operation InnoDB undo tablespaces\n";
51+ print STDERR "$prefix in '$backup_dir'\n";
52+ print STDERR "$prefix back to '$orig_undo_dir'\n";
53+ opendir(DIR, $backup_dir)
54+ || Die "Can't open directory '$backup_dir': $!\n";
55+ while (defined($file = readdir(DIR))) {
56+ if ($file =~ /^$ibundo_files$/ && -f "$backup_dir/$file") {
57+ $src_name = escape_path("$backup_dir/$file");
58+ $dst_name = escape_path("$orig_undo_dir");
59+ &$move_or_copy_file($src_name, $dst_name);
60+ }
61+ }
62+ closedir(DIR);
63+
64 # copy InnoDB log files to original InnoDB log directory
65 opendir(DIR, $backup_dir)
66 || Die "Can't open directory '$backup_dir': $!\n";
67@@ -1810,7 +1837,9 @@
68 "innodb_log_file_size",
69 "innodb_fast_checksum",
70 "innodb_page_size",
71- "innodb_log_block_size"
72+ "innodb_log_block_size",
73+ "innodb_undo_directory",
74+ "innodb_undo_tablespaces"
75 );
76
77 my $options_dump = "# This MySQL options file was generated by $innobackup_script.\n\n" .
78
79=== modified file 'patches/innodb56.patch'
80--- patches/innodb56.patch 2013-04-09 13:44:38 +0000
81+++ patches/innodb56.patch 2013-04-22 11:03:29 +0000
82@@ -47,16 +47,19 @@
83 #include "trx0sys.h"
84 #include "row0mysql.h"
85 #ifndef UNIV_HOTBACKUP
86-@@ -311,7 +313,7 @@
87+@@ -311,10 +313,7 @@
88
89 /** The tablespace memory cache. This variable is NULL before the module is
90 initialized. */
91 -static fil_system_t* fil_system = NULL;
92+-
93+-/** Determine if (i) is a user tablespace id or not. */
94+-# define fil_is_user_tablespace_id(i) ((i) > srv_undo_tablespaces_open)
95 +fil_system_t* fil_system = NULL;
96
97- /** Determine if (i) is a user tablespace id or not. */
98- # define fil_is_user_tablespace_id(i) ((i) > srv_undo_tablespaces_open)
99-@@ -376,7 +378,7 @@
100+ /** Determine if user has explicitly disabled fsync(). */
101+ #ifndef __WIN__
102+@@ -376,7 +375,7 @@
103 off the LRU list if it is in the LRU list. The caller must hold the fil_sys
104 mutex. */
105 static
106@@ -65,7 +68,7 @@
107 fil_node_prepare_for_io(
108 /*====================*/
109 fil_node_t* node, /*!< in: file node */
110-@@ -691,7 +693,7 @@
111+@@ -691,7 +690,7 @@
112 Opens a file of a node of a tablespace. The caller must own the fil_system
113 mutex. */
114 static
115@@ -74,7 +77,7 @@
116 fil_node_open_file(
117 /*===============*/
118 fil_node_t* node, /*!< in: file node */
119-@@ -725,6 +727,18 @@
120+@@ -725,6 +724,18 @@
121 OS_FILE_READ_ONLY, &success);
122 if (!success) {
123 /* The following call prints an error message */
124@@ -93,7 +96,7 @@
125 os_file_get_last_error(true);
126
127 ut_print_timestamp(stderr);
128-@@ -783,12 +797,17 @@
129+@@ -783,12 +794,17 @@
130
131 if (UNIV_UNLIKELY(space_id != space->id)) {
132 fprintf(stderr,
133@@ -114,7 +117,7 @@
134 }
135
136 if (UNIV_UNLIKELY(space_id == ULINT_UNDEFINED
137-@@ -825,8 +844,9 @@
138+@@ -825,8 +841,9 @@
139 }
140
141 if (size_bytes >= 1024 * 1024) {
142@@ -126,7 +129,7 @@
143 }
144
145 if (!fsp_flags_is_compressed(flags)) {
146-@@ -879,6 +899,8 @@
147+@@ -879,6 +896,8 @@
148 /* Put the node to the LRU list */
149 UT_LIST_ADD_FIRST(LRU, system->LRU, node);
150 }
151@@ -135,7 +138,7 @@
152 }
153
154 /**********************************************************************//**
155-@@ -1491,7 +1513,12 @@
156+@@ -1491,7 +1510,12 @@
157 the file yet; the following calls will open it and update the
158 size fields */
159
160@@ -149,7 +152,7 @@
161 fil_node_complete_io(node, fil_system, OS_FILE_READ);
162 }
163
164-@@ -2095,7 +2122,7 @@
165+@@ -2095,7 +2119,7 @@
166 mem_free(path);
167 }
168
169@@ -158,7 +161,7 @@
170 /********************************************************//**
171 Writes a log record about an .ibd file create/rename/delete. */
172 static
173-@@ -2329,7 +2356,7 @@
174+@@ -2329,7 +2353,7 @@
175 space_id, name, path, flags,
176 DICT_TF2_USE_TABLESPACE,
177 FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) {
178@@ -167,7 +170,7 @@
179 }
180 }
181
182-@@ -2687,7 +2714,7 @@
183+@@ -2687,7 +2711,7 @@
184 }
185
186 if (err == DB_SUCCESS) {
187@@ -176,7 +179,7 @@
188 /* Write a log record about the deletion of the .ibd
189 file, so that ibbackup can replay it in the
190 --apply-log phase. We use a dummy mtr and the familiar
191-@@ -3042,7 +3069,7 @@
192+@@ -3042,7 +3066,7 @@
193
194 mutex_exit(&fil_system->mutex);
195
196@@ -185,7 +188,7 @@
197 if (success && !recv_recovery_on) {
198 mtr_t mtr;
199
200-@@ -3426,7 +3453,7 @@
201+@@ -3426,7 +3450,7 @@
202 goto error_exit_1;
203 }
204
205@@ -194,7 +197,7 @@
206 {
207 mtr_t mtr;
208 ulint mlog_file_flag = 0;
209-@@ -3504,6 +3531,97 @@
210+@@ -3504,6 +3528,97 @@
211 #endif /* UNIV_LOG_ARCHIVE */
212 };
213
214@@ -292,7 +295,7 @@
215 /********************************************************************//**
216 Tries to open a single-table tablespace and optionally checks that the
217 space id in it is correct. If this does not succeed, print an error message
218-@@ -3712,11 +3830,15 @@
219+@@ -3712,11 +3827,15 @@
220 /* The following call prints an error message */
221 os_file_get_last_error(true);
222
223@@ -309,7 +312,7 @@
224
225 err = DB_CORRUPTION;
226
227-@@ -4135,7 +4257,7 @@
228+@@ -4135,7 +4254,7 @@
229 cannot be ok. */
230 ulong minimum_size = FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE;
231 if (size < minimum_size) {
232@@ -318,7 +321,7 @@
233 ib_logf(IB_LOG_LEVEL_ERROR,
234 "The size of single-table tablespace file %s "
235 "is only " UINT64PF ", should be at least %lu!",
236-@@ -4263,7 +4385,7 @@
237+@@ -4263,7 +4382,7 @@
238 idea is to read as much good data as we can and jump over bad data.
239 @return 0 if ok, -1 if error even after the retries, 1 if at the end
240 of the directory */
241@@ -327,7 +330,7 @@
242 int
243 fil_file_readdir_next_file(
244 /*=======================*/
245-@@ -4359,7 +4481,9 @@
246+@@ -4359,7 +4478,9 @@
247 "%s/%s", fil_path_to_mysql_datadir, dbinfo.name);
248 srv_normalize_path_for_win(dbpath);
249
250@@ -338,7 +341,7 @@
251
252 if (dbdir != NULL) {
253
254-@@ -4538,6 +4662,7 @@
255+@@ -4538,6 +4659,7 @@
256 {
257 fil_space_t* fnamespace;
258 fil_space_t* space;
259@@ -346,7 +349,7 @@
260
261 ut_ad(fil_system);
262
263-@@ -4615,6 +4740,10 @@
264+@@ -4615,6 +4737,10 @@
265 if (fnamespace == NULL) {
266 if (print_error_if_does_not_exist) {
267 fil_report_missing_tablespace(name, id);
268@@ -357,7 +360,7 @@
269 }
270 } else {
271 ut_print_timestamp(stderr);
272-@@ -4638,6 +4767,10 @@
273+@@ -4638,6 +4764,10 @@
274
275 mutex_exit(&fil_system->mutex);
276
277@@ -368,7 +371,7 @@
278 return(FALSE);
279 }
280
281-@@ -4728,6 +4861,7 @@
282+@@ -4728,6 +4858,7 @@
283 ulint page_size;
284 ulint pages_added;
285 ibool success;
286@@ -376,7 +379,7 @@
287
288 ut_ad(!srv_read_only_mode);
289
290-@@ -4772,13 +4906,17 @@
291+@@ -4772,13 +4903,17 @@
292 goto retry;
293 }
294
295@@ -395,7 +398,7 @@
296 start_page_no = space->size;
297 file_start_page_no = space->size - node->size;
298
299-@@ -5024,7 +5162,7 @@
300+@@ -5024,7 +5159,7 @@
301 off the LRU list if it is in the LRU list. The caller must hold the fil_sys
302 mutex. */
303 static
304@@ -404,7 +407,7 @@
305 fil_node_prepare_for_io(
306 /*====================*/
307 fil_node_t* node, /*!< in: file node */
308-@@ -5044,9 +5182,12 @@
309+@@ -5044,9 +5179,12 @@
310 }
311
312 if (node->open == FALSE) {
313@@ -418,7 +421,7 @@
314 }
315
316 if (node->n_pending == 0 && fil_space_belongs_in_lru(space)) {
317-@@ -5058,6 +5199,8 @@
318+@@ -5058,6 +5196,8 @@
319 }
320
321 node->n_pending++;
322@@ -427,7 +430,7 @@
323 }
324
325 /********************************************************************//**
326-@@ -5259,6 +5402,16 @@
327+@@ -5259,6 +5399,16 @@
328
329 ut_ad(mode != OS_AIO_IBUF || space->purpose == FIL_TABLESPACE);
330
331@@ -444,7 +447,7 @@
332 node = UT_LIST_GET_FIRST(space->chain);
333
334 for (;;) {
335-@@ -5290,7 +5443,11 @@
336+@@ -5290,7 +5440,11 @@
337 }
338
339 /* Open file if closed */
340@@ -457,7 +460,7 @@
341
342 /* Check that at least the start offset is within the bounds of a
343 single-table tablespace, including rollback tablespaces. */
344-@@ -6164,6 +6321,7 @@
345+@@ -6164,6 +6318,7 @@
346 return(err);
347 }
348
349@@ -465,7 +468,7 @@
350 /****************************************************************//**
351 Generate redo logs for swapping two .ibd files */
352 UNIV_INTERN
353-@@ -6187,4 +6345,4 @@
354+@@ -6187,4 +6342,4 @@
355 0, 0, new_name, old_name, &mtr);
356 mtr_commit(&mtr);
357 }
358@@ -482,6 +485,58 @@
359
360 if (thd && thd_sql_command(thd) == SQLCOM_DROP_TABLE) {
361
362+@@ -16642,45 +16642,21 @@
363+ void
364+ ib_logf(
365+ /*====*/
366+- ib_log_level_t level, /*!< in: warning level */
367++ ib_log_level_t level __attribute__((unused)),
368++ /*!< in: warning level */
369+ const char* format, /*!< printf format */
370+ ...) /*!< Args */
371+ {
372+- char* str;
373+ va_list args;
374+
375+ va_start(args, format);
376+
377+-#ifdef __WIN__
378+- int size = _vscprintf(format, args) + 1;
379+- str = static_cast<char*>(malloc(size));
380+- str[size - 1] = 0x0;
381+- vsnprintf(str, size, format, args);
382+-#elif HAVE_VASPRINTF
383+- (void) vasprintf(&str, format, args);
384+-#else
385+- /* Use a fixed length string. */
386+- str = static_cast<char*>(malloc(BUFSIZ));
387+- my_vsnprintf(str, BUFSIZ, format, args);
388+-#endif /* __WIN__ */
389+-
390+- switch(level) {
391+- case IB_LOG_LEVEL_INFO:
392+- sql_print_information("InnoDB: %s", str);
393+- break;
394+- case IB_LOG_LEVEL_WARN:
395+- sql_print_warning("InnoDB: %s", str);
396+- break;
397+- case IB_LOG_LEVEL_ERROR:
398+- sql_print_error("InnoDB: %s", str);
399+- break;
400+- case IB_LOG_LEVEL_FATAL:
401+- sql_print_error("InnoDB: %s", str);
402+- break;
403+- }
404++ /* Don't use server logger for XtraBackup, just print to stderr. */
405++ vfprintf(stderr, format, args);
406+
407+ va_end(args);
408+- free(str);
409++
410++ fputc('\n', stderr);
411+
412+ if (level == IB_LOG_LEVEL_FATAL) {
413+ ut_error;
414 --- a/storage/innobase/include/srv0srv.h
415 +++ b/storage/innobase/include/srv0srv.h
416 @@ -353,6 +353,9 @@
417@@ -676,7 +731,60 @@
418 dberr_t
419 open_or_create_data_files(
420 /*======================*/
421-@@ -2065,11 +2065,13 @@
422+@@ -1204,12 +1204,16 @@
423+ /********************************************************************
424+ Opens the configured number of undo tablespaces.
425+ @return DB_SUCCESS or error code */
426+-static
427++UNIV_INTERN
428+ dberr_t
429+ srv_undo_tablespaces_init(
430+ /*======================*/
431+ ibool create_new_db, /*!< in: TRUE if new db being
432+ created */
433++ ibool backup_mode, /*!< in: TRUE disables reading
434++ the system tablespace (used in
435++ XtraBackup), FALSE is passed on
436++ recovery. */
437+ const ulint n_conf_tablespaces, /*!< in: configured undo
438+ tablespaces */
439+ ulint* n_opened) /*!< out: number of UNDO
440+@@ -1225,6 +1229,7 @@
441+ *n_opened = 0;
442+
443+ ut_a(n_conf_tablespaces <= TRX_SYS_N_RSEGS);
444++ ut_a(!create_new_db || !backup_mode);
445+
446+ memset(undo_tablespace_ids, 0x0, sizeof(undo_tablespace_ids));
447+
448+@@ -1258,12 +1263,13 @@
449+ }
450+ }
451+
452+- /* Get the tablespace ids of all the undo segments excluding
453+- the system tablespace (0). If we are creating a new instance then
454++ /* Get the tablespace ids of all the undo segments excluding the system
455++ tablespace (0). If we are creating a new instance then
456+ we build the undo_tablespace_ids ourselves since they don't
457+- already exist. */
458++ already exist. If we are in the backup mode, don't read the trx header,
459++ we just need to add all available undo tablespaces to fil_system. */
460+
461+- if (!create_new_db) {
462++ if (!create_new_db && !backup_mode) {
463+ n_undo_tablespaces = trx_rseg_get_n_undo_tablespaces(
464+ undo_tablespace_ids);
465+ } else {
466+@@ -1369,7 +1375,7 @@
467+ ib_logf(IB_LOG_LEVEL_INFO, "Opened %lu undo tablespaces",
468+ n_undo_tablespaces);
469+
470+- if (n_conf_tablespaces == 0) {
471++ if (n_conf_tablespaces == 0 && !backup_mode) {
472+ ib_logf(IB_LOG_LEVEL_WARN,
473+ "Using the system tablespace for all UNDO "
474+ "logging because innodb_undo_tablespaces=0");
475+@@ -2065,11 +2071,13 @@
476 max_flushed_lsn = min_flushed_lsn
477 = log_get_lsn();
478 goto files_checked;
479@@ -690,7 +798,15 @@
480 }
481
482 /* opened all files */
483-@@ -2326,6 +2328,10 @@
484+@@ -2162,6 +2170,7 @@
485+
486+ err = srv_undo_tablespaces_init(
487+ create_new_db,
488++ FALSE,
489+ srv_undo_tablespaces,
490+ &srv_undo_tablespaces_open);
491+
492+@@ -2326,6 +2335,10 @@
493
494 recv_recovery_from_checkpoint_finish();
495
496@@ -701,7 +817,7 @@
497 if (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) {
498 /* The following call is necessary for the insert
499 buffer to work with multiple tablespaces. We must
500-@@ -2647,6 +2653,7 @@
501+@@ -2647,6 +2660,7 @@
502 && srv_auto_extend_last_data_file
503 && sum_of_data_file_sizes < tablespace_size_in_header) {
504
505@@ -709,7 +825,7 @@
506 ut_print_timestamp(stderr);
507 fprintf(stderr,
508 " InnoDB: Error: tablespace size stored in header"
509-@@ -2683,6 +2690,7 @@
510+@@ -2683,6 +2697,7 @@
511
512 return(DB_ERROR);
513 }
514@@ -717,7 +833,7 @@
515 }
516
517 /* Check that os_fast_mutexes work as expected */
518-@@ -2739,6 +2747,7 @@
519+@@ -2739,6 +2754,7 @@
520 fts_optimize_init();
521 }
522
523@@ -725,7 +841,7 @@
524 srv_was_started = TRUE;
525
526 return(DB_SUCCESS);
527-@@ -2794,7 +2803,7 @@
528+@@ -2794,7 +2810,7 @@
529 return(DB_SUCCESS);
530 }
531
532@@ -844,3 +960,41 @@
533
534 UNIV_MEM_FREE(buf, n);
535 }
536+--- a/storage/innobase/include/fil0fil.h
537++++ b/storage/innobase/include/fil0fil.h
538+@@ -163,6 +163,9 @@
539+ #define FIL_LOG 502 /*!< redo log */
540+ /* @} */
541+
542++/** Determine if (i) is a user tablespace id or not. */
543++#define fil_is_user_tablespace_id(i) ((i) > srv_undo_tablespaces_open)
544++
545+ /** The number of fsyncs done to the log */
546+ extern ulint fil_n_log_flushes;
547+
548+--- a/storage/innobase/include/srv0start.h
549++++ b/storage/innobase/include/srv0start.h
550+@@ -77,6 +77,23 @@
551+ srv_add_path_separator_if_needed(
552+ /*=============================*/
553+ char* str); /*!< in: null-terminated character string */
554++/********************************************************************
555++Opens the configured number of undo tablespaces.
556++@return DB_SUCCESS or error code */
557++UNIV_INTERN
558++dberr_t
559++srv_undo_tablespaces_init(
560++/*======================*/
561++ ibool create_new_db, /*!< in: TRUE if new db being
562++ created */
563++ ibool backup_mode, /*!< in: TRUE disables reading
564++ the system tablespace (used in
565++ XtraBackup), FALSE is passed on
566++ recovery. */
567++ const ulint n_conf_tablespaces, /*!< in: configured undo
568++ tablespaces */
569++ ulint* n_opened); /*!< out: number of UNDO
570++ tablespaces successfully */
571+ #ifndef UNIV_HOTBACKUP
572+ /****************************************************************//**
573+ Starts Innobase and creates a new database if database files
574
575=== modified file 'src/xtrabackup.cc'
576--- src/xtrabackup.cc 2013-04-17 07:50:37 +0000
577+++ src/xtrabackup.cc 2013-04-22 11:03:29 +0000
578@@ -1643,6 +1643,7 @@
579 OPT_XTRA_DEBUG_SYNC,
580 #if MYSQL_VERSION_ID >= 50600
581 OPT_INNODB_CHECKSUM_ALGORITHM,
582+ OPT_INNODB_UNDO_DIRECTORY,
583 OPT_UNDO_TABLESPACES,
584 #endif
585 OPT_DEFAULTS_GROUP
586@@ -1962,14 +1963,17 @@
587 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
588 #endif
589 #if MYSQL_VERSION_ID >= 50600
590- {"checksum-algorithm", OPT_INNODB_CHECKSUM_ALGORITHM,
591+ {"innodb_checksum_algorithm", OPT_INNODB_CHECKSUM_ALGORITHM,
592 "The algorithm InnoDB uses for page checksumming. [CRC32, STRICT_CRC32, "
593 "INNODB, STRICT_INNODB, NONE, STRICT_NONE]", &srv_checksum_algorithm,
594 &srv_checksum_algorithm, &innodb_checksum_algorithm_typelib, GET_ENUM,
595 REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
596- {"undo-tablespaces", OPT_UNDO_TABLESPACES,
597- "Number of undo tablespaces to use. NON-ZERO VALUES ARE NOT "
598- "CURRENTLY SUPPORTED",
599+ {"innodb_undo_directory", OPT_INNODB_UNDO_DIRECTORY,
600+ "Directory where undo tablespace files live, this path can be absolute.",
601+ (G_PTR*) &srv_undo_dir, (G_PTR*) &srv_undo_dir,
602+ 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
603+ {"innodb_undo_tablespaces", OPT_UNDO_TABLESPACES,
604+ "Number of undo tablespaces to use.",
605 (G_PTR*)&srv_undo_tablespaces, (G_PTR*)&srv_undo_tablespaces,
606 0, GET_ULONG, REQUIRED_ARG, 0, 0, 126, 0, 1, 0},
607 #endif
608@@ -3152,7 +3156,7 @@
609 srv_log_file_size = (ulint) innobase_log_file_size;
610 msg("xtrabackup: innodb_log_files_in_group = %ld\n",
611 srv_n_log_files);
612- msg("xtrabackup: innodb_log_file_size = %ld\n",
613+ msg("xtrabackup: innodb_log_file_size = %lld\n",
614 srv_log_file_size);
615
616 #ifdef UNIV_LOG_ARCHIVE
617@@ -3308,6 +3312,18 @@
618 #endif
619 #endif /* MYSQL_VERSION_ID */
620
621+#if MYSQL_VERSION_ID >= 50600
622+ /* Assign the default value to srv_undo_dir if it's not specified, as
623+ my_getopt does not support default values for string options. We also
624+ ignore the option and override innodb_undo_directory on --prepare,
625+ because separate undo tablespaces are copied to the root backup
626+ directory. */
627+
628+ if (!srv_undo_dir || !xtrabackup_backup) {
629+ srv_undo_dir = (char *) ".";
630+ }
631+#endif
632+
633 return(FALSE);
634
635 error:
636@@ -3747,7 +3763,11 @@
637 }
638
639 #ifndef XTRADB_BASED
640-#define trx_sys_sys_space(id) (id == 0)
641+# if MYSQL_VERSION_ID >= 50600
642+# define trx_sys_sys_space(id) (!fil_is_user_tablespace_id(id))
643+# else
644+# define trx_sys_sys_space(id) (id == 0)
645+# endif
646 #endif
647
648 /****************************************************************//**
649@@ -4691,7 +4711,24 @@
650 return(DB_ERROR);
651 }
652
653- return(fil_load_single_table_tablespaces());
654+ err = fil_load_single_table_tablespaces();
655+ if (err != DB_SUCCESS) {
656+ return(err);
657+ }
658+
659+#if MYSQL_VERSION_ID >= 50600
660+ /* Add separate undo tablespaces to fil_system */
661+
662+ err = srv_undo_tablespaces_init(FALSE,
663+ TRUE,
664+ srv_undo_tablespaces,
665+ &srv_undo_tablespaces_open);
666+ if (err != DB_SUCCESS) {
667+ return(err);
668+ }
669+#endif
670+
671+ return(DB_SUCCESS);
672 }
673
674 /*********************************************************************//**
675@@ -7895,6 +7932,14 @@
676 printf("innodb_file_per_table = %d\n",
677 (int) innobase_file_per_table);
678 #endif
679+#if MYSQL_VERSION_ID >= 50600
680+ if (srv_undo_dir) {
681+
682+ printf("innodb_undo_directory = \"%s\"\n",
683+ srv_undo_dir);
684+ }
685+ printf("innodb_undo_tablespaces = %lu\n", srv_undo_tablespaces);
686+#endif
687 exit(EXIT_SUCCESS);
688 }
689
690
691=== modified file 'test/inc/common.sh'
692--- test/inc/common.sh 2013-03-08 04:37:16 +0000
693+++ test/inc/common.sh 2013-04-22 11:03:29 +0000
694@@ -27,25 +27,12 @@
695 exit 1
696 }
697
698-function init_mysql_dir()
699+function call_mysql_install_db()
700 {
701- if [ ! -d "$MYSQLD_VARDIR" ]
702- then
703- vlog "Creating server root directory: $MYSQLD_VARDIR"
704- mkdir "$MYSQLD_VARDIR"
705- fi
706- if [ ! -d "$MYSQLD_TMPDIR" ]
707- then
708- vlog "Creating server temporary directory: $MYSQLD_TMPDIR"
709- mkdir "$MYSQLD_TMPDIR"
710- fi
711- if [ ! -d "$MYSQLD_DATADIR" ]
712- then
713- vlog "Creating server data directory: $MYSQLD_DATADIR"
714- mkdir -p "$MYSQLD_DATADIR"
715 vlog "Calling mysql_install_db"
716- $MYSQL_INSTALL_DB --no-defaults --basedir=$MYSQL_BASEDIR --datadir="$MYSQLD_DATADIR" --tmpdir="$MYSQLD_TMPDIR" ${MYSQLD_EXTRA_ARGS}
717- fi
718+ cd $MYSQL_BASEDIR
719+ $MYSQL_INSTALL_DB --defaults-file=${MYSQLD_VARDIR}/my.cnf ${MYSQLD_EXTRA_ARGS}
720+ cd -
721 }
722
723 ########################################################################
724@@ -230,20 +217,15 @@
725 MYSQLD_PORT="${SRV_MYSQLD_PORT[$id]}"
726 MYSQLD_SOCKET="${SRV_MYSQLD_SOCKET[$id]}"
727
728- MYSQL_ARGS="--no-defaults --socket=${MYSQLD_SOCKET} --user=root"
729- MYSQLD_ARGS="--no-defaults --basedir=${MYSQL_BASEDIR} \
730---socket=${MYSQLD_SOCKET} --port=${MYSQLD_PORT} --server-id=$id \
731---datadir=${MYSQLD_DATADIR} --tmpdir=${MYSQLD_TMPDIR} --log-bin=mysql-bin \
732---relay-log=mysql-relay-bin --pid-file=${MYSQLD_PIDFILE} ${MYSQLD_EXTRA_ARGS}"
733+ MYSQL_ARGS="--defaults-file=$MYSQLD_VARDIR/my.cnf "
734+ MYSQLD_ARGS="--defaults-file=$MYSQLD_VARDIR/my.cnf ${MYSQLD_EXTRA_ARGS}"
735 if [ "`whoami`" = "root" ]
736 then
737 MYSQLD_ARGS="$MYSQLD_ARGS --user=root"
738 fi
739
740- export MYSQL_HOME=$MYSQLD_VARDIR
741-
742- IB_ARGS="--user=root --socket=${MYSQLD_SOCKET} --ibbackup=$XB_BIN"
743- XB_ARGS="--no-defaults"
744+ IB_ARGS="--defaults-file=$MYSQLD_VARDIR/my.cnf --ibbackup=$XB_BIN"
745+ XB_ARGS="--defaults-file=$MYSQLD_VARDIR/my.cnf"
746
747 # Some aliases for compatibility, as tests use the following names
748 topdir="$MYSQLD_VARDIR"
749@@ -265,14 +247,48 @@
750 init_server_variables $id
751 switch_server $id
752
753- init_mysql_dir
754+ if [ ! -d "$MYSQLD_VARDIR" ]
755+ then
756+ vlog "Creating server root directory: $MYSQLD_VARDIR"
757+ mkdir "$MYSQLD_VARDIR"
758+ fi
759+ if [ ! -d "$MYSQLD_TMPDIR" ]
760+ then
761+ vlog "Creating server temporary directory: $MYSQLD_TMPDIR"
762+ mkdir "$MYSQLD_TMPDIR"
763+ fi
764+
765+ # Create the configuration file used by mysql_install_db, the server
766+ # and the xtrabackup binary
767 cat > ${MYSQLD_VARDIR}/my.cnf <<EOF
768 [mysqld]
769+socket=${MYSQLD_SOCKET}
770+port=${MYSQLD_PORT}
771+server-id=$id
772+basedir=${MYSQL_BASEDIR}
773 datadir=${MYSQLD_DATADIR}
774 tmpdir=${MYSQLD_TMPDIR}
775+log-bin=mysql-bin
776+relay-log=mysql-relay-bin
777+pid-file=${MYSQLD_PIDFILE}
778+replicate-ignore-db=mysql
779+${MYSQLD_EXTRA_MY_CNF_OPTS:-}
780+
781+[client]
782+socket=${MYSQLD_SOCKET}
783+user=root
784 EOF
785
786+ # Create datadir and call mysql_install_db if it doesn't exist
787+ if [ ! -d "$MYSQLD_DATADIR" ]
788+ then
789+ vlog "Creating server data directory: $MYSQLD_DATADIR"
790+ mkdir -p "$MYSQLD_DATADIR"
791+ call_mysql_install_db
792+ fi
793+
794 # Start the server
795+ echo "Starting ${MYSQLD} ${MYSQLD_ARGS} $* "
796 ${MYSQLD} ${MYSQLD_ARGS} $* &
797 if ! mysql_ping
798 then
799@@ -301,6 +317,10 @@
800 vlog "Server PID file '${MYSQLD_PIDFILE}' doesn't exist!"
801 fi
802
803+ # Reset XB_ARGS so we can call xtrabackup in tests even without starting the
804+ # server
805+ XB_ARGS="--no-defaults"
806+
807 # unlock the port number
808 free_reserved_port $MYSQLD_PORT
809
810
811=== modified file 'test/t/bug1062684.sh'
812--- test/t/bug1062684.sh 2013-03-08 04:37:16 +0000
813+++ test/t/bug1062684.sh 2013-04-22 11:03:29 +0000
814@@ -1,11 +1,18 @@
815-MYSQLD_EXTRA_ARGS=--innodb-data-file-path="ibdata1:${DEFAULT_IBDATA_SIZE};ibdata2:5M:autoextend"
816+################################################################################
817+# Bug #1062684: Applying incremental backup using xtrabackup 2.0.3 fails when
818+# innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend is
819+# set in [mysqld]
820+################################################################################
821+
822 . inc/common.sh
823
824-start_server --innodb-data-file-path="ibdata1:${DEFAULT_IBDATA_SIZE};ibdata2:5M:autoextend"
825+MYSQLD_EXTRA_MY_CNF_OPTS="
826+innodb-data-file-path=ibdata1:${DEFAULT_IBDATA_SIZE};ibdata2:5M:autoextend
827+"
828+
829+start_server
830 load_dbase_schema incremental_sample
831
832-echo "innodb-data-file-path=ibdata1:${DEFAULT_IBDATA_SIZE};ibdata2:5M:autoextend" >>$topdir/my.cnf
833-
834 # Adding initial rows
835 vlog "Adding initial rows to database..."
836 ${MYSQL} ${MYSQL_ARGS} -e "insert into test values (1, 1);" incremental_sample
837
838=== modified file 'test/t/bug483827.sh'
839--- test/t/bug483827.sh 2012-06-05 12:35:33 +0000
840+++ test/t/bug483827.sh 2013-04-22 11:03:29 +0000
841@@ -18,10 +18,7 @@
842 modify_args
843
844 # make my_multi.cnf
845-echo "
846-[mysqld1]
847-datadir=${mysql_datadir}
848-tmpdir=$mysql_tmpdir" > $topdir/my_multi.cnf
849+sed -e 's/\[mysqld\]/[mysqld1]/' $topdir/my.cnf > $topdir/my_multi.cnf
850
851 # Backup
852 innobackupex --no-timestamp --defaults-group=mysqld1 $backup_dir
853
854=== modified file 'test/t/bug606981.sh'
855--- test/t/bug606981.sh 2012-06-19 06:00:44 +0000
856+++ test/t/bug606981.sh 2013-04-22 11:03:29 +0000
857@@ -6,12 +6,16 @@
858 exit $SKIPPED_EXIT_CODE
859 fi
860
861-start_server --innodb_file_per_table
862+MYSQLD_EXTRA_MY_CNF_OPTS="
863+innodb_file_per_table=1
864+innodb_flush_method=O_DIRECT
865+"
866+
867+start_server
868
869 load_sakila
870
871 # Take backup
872-echo "innodb_flush_method=O_DIRECT" >> $topdir/my.cnf
873 mkdir -p $topdir/backup
874 innobackupex --stream=tar $topdir/backup > $topdir/backup/out.tar
875 stop_server
876@@ -30,11 +34,11 @@
877 backup_dir=$topdir/backup
878 cd $backup_dir
879 $TAR -ixvf out.tar
880-cd - >/dev/null 2>&1
881-innobackupex --apply-log --defaults-file=$topdir/my.cnf $backup_dir
882+cd - >/dev/null 2>&1
883+innobackupex --apply-log $backup_dir
884 vlog "Restoring MySQL datadir"
885 mkdir -p $mysql_datadir
886-innobackupex --copy-back --defaults-file=$topdir/my.cnf $backup_dir
887+innobackupex --copy-back $backup_dir
888
889 start_server
890 # Check sakila
891
892=== modified file 'test/t/bug740489.sh'
893--- test/t/bug740489.sh 2013-01-07 19:14:19 +0000
894+++ test/t/bug740489.sh 2013-04-22 11:03:29 +0000
895@@ -6,26 +6,34 @@
896 start_server --innodb_file_per_table
897 load_sakila
898
899-run_cmd ${MYSQL} ${MYSQL_ARGS} -e "UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root'; FLUSH PRIVILEGES;"
900-
901-defaults_extra_file=${TEST_BASEDIR}/740489.cnf
902-
903-echo "[client]" > $defaults_extra_file
904-echo "user=root" >> $defaults_extra_file
905-echo "password=password" >> $defaults_extra_file
906-
907-mkdir -p $topdir/backup
908-cat ${MYSQLD_VARDIR}/my.cnf
909-run_cmd $IB_BIN --defaults-extra-file=$defaults_extra_file --socket=${MYSQLD_SOCKET} --ibbackup=$XB_BIN $topdir/backup
910-backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | awk -F\' '{ print $2}'`
911+run_cmd ${MYSQL} ${MYSQL_ARGS} <<EOF
912+SET PASSWORD FOR 'root'@'localhost' = PASSWORD('password');
913+EOF
914+
915+defaults_extra_file=$topdir/740489.cnf
916+
917+cat > $defaults_extra_file <<EOF
918+[mysqld]
919+datadir=${MYSQLD_DATADIR}
920+
921+[client]
922+user=root
923+password=password
924+EOF
925+
926+backup_dir=$topdir/backup
927+run_cmd $IB_BIN \
928+ --defaults-extra-file=$defaults_extra_file --socket=${MYSQLD_SOCKET} \
929+ --ibbackup=$XB_BIN --no-timestamp $backup_dir
930 vlog "Backup created in directory $backup_dir"
931
932-run_cmd ${MYSQL} ${MYSQL_ARGS} --password=password -e "UPDATE mysql.user SET Password=PASSWORD('') WHERE User='root'; FLUSH PRIVILEGES;"
933+run_cmd ${MYSQL} ${MYSQL_ARGS} --password=password <<EOF
934+SET PASSWORD FOR 'root'@'localhost' = PASSWORD('');
935+EOF
936
937 stop_server
938 # Remove datadir
939 rm -r $mysql_datadir
940-#init_mysql_dir
941 # Restore sakila
942 vlog "Applying log"
943 vlog "###########"
944
945=== modified file 'test/t/bug759225.sh'
946--- test/t/bug759225.sh 2012-06-19 06:00:44 +0000
947+++ test/t/bug759225.sh 2013-04-22 11:03:29 +0000
948@@ -16,11 +16,13 @@
949 exit $SKIPPED_EXIT_CODE
950 fi
951
952+MYSQLD_EXTRA_MY_CNF_OPTS="
953+innodb_flush_method=ALL_O_DIRECT
954+"
955 start_server
956 load_sakila
957
958 # Take backup
959-echo "innodb_flush_method=ALL_O_DIRECT" >> $topdir/my.cnf
960 mkdir -p $topdir/backup
961 innobackupex --stream=tar $topdir/backup > $topdir/backup/out.tar
962 stop_server
963@@ -39,11 +41,11 @@
964 backup_dir=$topdir/backup
965 cd $backup_dir
966 $TAR -ixvf out.tar
967-cd - >/dev/null 2>&1
968-innobackupex --apply-log --defaults-file=$topdir/my.cnf $backup_dir
969+cd - >/dev/null 2>&1
970+innobackupex --apply-log $backup_dir
971 vlog "Restoring MySQL datadir"
972 mkdir -p $mysql_datadir
973-innobackupex --copy-back --defaults-file=$topdir/my.cnf $backup_dir
974+innobackupex --copy-back $backup_dir
975
976 start_server
977 # Check sakila
978
979=== modified file 'test/t/bug870119.sh'
980--- test/t/bug870119.sh 2013-03-05 13:07:11 +0000
981+++ test/t/bug870119.sh 2013-04-22 11:03:29 +0000
982@@ -4,10 +4,13 @@
983
984 . inc/common.sh
985
986-start_server --innodb_file_per_table
987-
988 # Set the minimum value for innodb_open_files to be used by xtrabackup
989-echo "innodb_open_files=10" >>$topdir/my.cnf
990+MYSQLD_EXTRA_MY_CNF_OPTS="
991+innodb_file_per_table=1
992+innodb_open_files=10
993+"
994+
995+start_server
996
997 load_dbase_schema sakila
998 load_dbase_data sakila
999
1000=== modified file 'test/t/bug891496.sh'
1001--- test/t/bug891496.sh 2013-03-08 04:37:16 +0000
1002+++ test/t/bug891496.sh 2013-04-22 11:03:29 +0000
1003@@ -5,13 +5,11 @@
1004
1005 . inc/common.sh
1006
1007-innodb_data_file_path="ibdata1:3M;ibdata2:10M:autoextend"
1008-
1009-start_server --innodb_data_file_path=$innodb_data_file_path
1010-
1011-cat >> $topdir/my.cnf <<EOF
1012-innodb_data_file_path=$innodb_data_file_path
1013-EOF
1014+MYSQLD_EXTRA_MY_CNF_OPTS="
1015+innodb_data_file_path=ibdata1:3M;ibdata2:10M:autoextend
1016+"
1017+
1018+start_server
1019
1020 load_dbase_schema sakila
1021 load_dbase_data sakila
1022@@ -40,6 +38,6 @@
1023 vlog "###########"
1024 innobackupex --copy-back $backup_dir
1025
1026-start_server --innodb_data_file_path=$innodb_data_file_path
1027+start_server
1028 # Check sakila
1029 run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT count(*) from actor" sakila
1030
1031=== modified file 'test/t/bug976945.sh'
1032--- test/t/bug976945.sh 2012-06-18 03:38:41 +0000
1033+++ test/t/bug976945.sh 2013-04-22 11:03:29 +0000
1034@@ -8,8 +8,10 @@
1035 exit $SKIPPED_EXIT_CODE
1036 fi
1037
1038-start_server --innodb_log_block_size=4096
1039-echo innodb_log_block_size=4096 >> ${MYSQLD_VARDIR}/my.cnf
1040+MYSQLD_EXTRA_MY_CNF_OPTS="
1041+innodb_log_block_size=4096
1042+"
1043+start_server
1044 load_sakila
1045
1046 # Full backup
1047
1048=== modified file 'test/t/bug977101.sh'
1049--- test/t/bug977101.sh 2012-06-08 18:46:19 +0000
1050+++ test/t/bug977101.sh 2013-04-22 11:03:29 +0000
1051@@ -17,15 +17,14 @@
1052
1053 # Check that binlog info is correct with --safe-slave-backup
1054 innobackupex --no-timestamp --safe-slave-backup $topdir/backup
1055-egrep -q '^mysql-bin.000001[[:space:]]+[0-9]+[[:space:]]+$' \
1056+egrep -q '^mysql-bin.[0-9]+[[:space:]]+[0-9]+[[:space:]]+$' \
1057 $topdir/backup/xtrabackup_binlog_info
1058
1059 # Check that both binlog info and slave info are correct with
1060 # --safe-slave-backup
1061 rm -rf $topdir/backup
1062 innobackupex --no-timestamp --slave-info --safe-slave-backup $topdir/backup
1063-egrep -q '^mysql-bin.000001[[:space:]]+[0-9]+[[:space:]]+$' \
1064+egrep -q '^mysql-bin.[0-9]+[[:space:]]+[0-9]+[[:space:]]+$' \
1065 $topdir/backup/xtrabackup_binlog_info
1066-egrep -q '^CHANGE MASTER TO MASTER_LOG_FILE='\''mysql-bin.000001'\'', MASTER_LOG_POS=[0-9]+$' \
1067+egrep -q '^CHANGE MASTER TO MASTER_LOG_FILE='\''mysql-bin.[0-9]+'\'', MASTER_LOG_POS=[0-9]+$' \
1068 $topdir/backup/xtrabackup_slave_info
1069-
1070
1071=== modified file 'test/t/ib_doublewrite.sh'
1072--- test/t/ib_doublewrite.sh 2012-11-15 15:27:58 +0000
1073+++ test/t/ib_doublewrite.sh 2013-04-22 11:03:29 +0000
1074@@ -15,7 +15,12 @@
1075 fi
1076
1077 DBLWR=dblwr.ibd
1078-start_server --innodb_file_per_table --innodb_doublewrite_file=${DBLWR}
1079+
1080+MYSQLD_EXTRA_MY_CNF_OPTS="
1081+innodb_file_per_table=1
1082+innodb_doublewrite_file=$DBLWR
1083+"
1084+start_server
1085 load_dbase_schema incremental_sample
1086
1087 # Workaround for bug #1072695
1088@@ -25,8 +30,6 @@
1089 run_cmd $IB_BIN $IB_ARGS_NO_DEFAULTS_FILE $*
1090 }
1091
1092-echo "innodb_doublewrite_file=${DBLWR}" >>$topdir/my.cnf
1093-
1094 # Adding initial rows
1095 vlog "Adding initial rows to database..."
1096 ${MYSQL} ${MYSQL_ARGS} -e "insert into test values (1, 1);" incremental_sample
1097
1098=== modified file 'test/t/ib_slave_info.sh'
1099--- test/t/ib_slave_info.sh 2012-06-05 12:35:33 +0000
1100+++ test/t/ib_slave_info.sh 2013-04-22 11:03:29 +0000
1101@@ -30,7 +30,7 @@
1102 $topdir/backup
1103
1104 innobackupex --no-timestamp --slave-info $topdir/backup
1105-egrep -q '^mysql-bin.000001[[:space:]]+[0-9]+[[:space:]]+$' \
1106+egrep -q '^mysql-bin.[0-9]+[[:space:]]+[0-9]+[[:space:]]+$' \
1107 $topdir/backup/xtrabackup_binlog_info
1108-egrep -q '^CHANGE MASTER TO MASTER_LOG_FILE='\''mysql-bin.000001'\'', MASTER_LOG_POS=[0-9]+$' \
1109+egrep -q '^CHANGE MASTER TO MASTER_LOG_FILE='\''mysql-bin.[0-9]+'\'', MASTER_LOG_POS=[0-9]+$' \
1110 $topdir/backup/xtrabackup_slave_info
1111
1112=== added file 'test/t/undo_tablespaces.sh'
1113--- test/t/undo_tablespaces.sh 1970-01-01 00:00:00 +0000
1114+++ test/t/undo_tablespaces.sh 2013-04-22 11:03:29 +0000
1115@@ -0,0 +1,75 @@
1116+########################################################################
1117+# Test support for separate UNDO tablespace
1118+########################################################################
1119+
1120+. inc/common.sh
1121+
1122+if [ ${MYSQL_VERSION:0:3} != "5.6" ]
1123+then
1124+ echo "Requires a 5.6 server" > $SKIPPED_REASON
1125+ exit $SKIPPED_EXIT_CODE
1126+fi
1127+
1128+################################################################################
1129+# Start an uncommitted transaction pause "indefinitely" to keep the connection
1130+# open
1131+################################################################################
1132+function start_uncomitted_transaction()
1133+{
1134+ run_cmd $MYSQL $MYSQL_ARGS sakila <<EOF
1135+START TRANSACTION;
1136+DELETE FROM payment;
1137+SELECT SLEEP(10000);
1138+EOF
1139+}
1140+
1141+undo_directory=$TEST_BASEDIR/var1/undo_dir
1142+
1143+MYSQLD_EXTRA_MY_CNF_OPTS="
1144+innodb_file_per_table=1
1145+innodb_undo_directory=$undo_directory
1146+innodb_undo_tablespaces=4
1147+"
1148+
1149+start_server
1150+load_sakila
1151+
1152+checksum1=`checksum_table sakila payment`
1153+test -n "$checksum1" || die "Failed to checksum table sakila.payment"
1154+
1155+# Start a transaction, modify some data and keep it uncommitted for the backup
1156+# stage. InnoDB avoids using the rollback segment in the system tablespace, if
1157+# separate undo tablespaces are used, so the test would fail if we did not
1158+# handle separate undo tablespaces correctly.
1159+start_uncomitted_transaction &
1160+job_master=$!
1161+
1162+innobackupex --no-timestamp $topdir/backup
1163+
1164+kill -SIGKILL $job_master
1165+stop_server
1166+
1167+rm -rf $MYSQLD_DATADIR/*
1168+rm -rf $undo_directory/*
1169+
1170+innobackupex --apply-log $topdir/backup
1171+
1172+innobackupex --copy-back $topdir/backup
1173+
1174+
1175+
1176+start_server
1177+
1178+# Check that the uncommitted transaction has been rolled back
1179+
1180+checksum2=`checksum_table sakila payment`
1181+test -n "$checksum2" || die "Failed to checksum table sakila.payment"
1182+
1183+vlog "Old checksum: $checksum1"
1184+vlog "New checksum: $checksum2"
1185+
1186+if [ "$checksum1" != "$checksum2" ]
1187+then
1188+ vlog "Checksums do not match"
1189+ exit -1
1190+fi
1191
1192=== modified file 'test/t/xb_basic.sh'
1193--- test/t/xb_basic.sh 2012-10-15 16:14:59 +0000
1194+++ test/t/xb_basic.sh 2013-04-22 11:03:29 +0000
1195@@ -13,7 +13,6 @@
1196 stop_server
1197 # Remove datadir
1198 rm -r $mysql_datadir
1199-#init_mysql_dir
1200 # Restore sakila
1201 vlog "Applying log"
1202 vlog "###########"
1203
1204=== modified file 'test/t/xb_version.sh'
1205--- test/t/xb_version.sh 2011-06-14 14:34:23 +0000
1206+++ test/t/xb_version.sh 2013-04-22 11:03:29 +0000
1207@@ -1,4 +1,3 @@
1208 . inc/common.sh
1209
1210 xtrabackup --version
1211-
1212
1213=== modified file 'test/testrun.sh'
1214--- test/testrun.sh 2013-03-13 05:05:16 +0000
1215+++ test/testrun.sh 2013-04-22 11:03:29 +0000
1216@@ -176,7 +176,7 @@
1217 then
1218 INNODB_FLAVOR="XtraDB"
1219 else
1220- INNODB_FLAVOR="innoDB"
1221+ INNODB_FLAVOR="InnoDB"
1222 fi
1223
1224 if [ "$XB_BUILD" = "autodetect" ]

Subscribers

People subscribed via source and target branches