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

Proposed by Alexey Kopytov
Status: Merged
Approved by: Stewart Smith
Approved revision: no longer in the source branch.
Merged at revision: 548
Proposed branch: lp:~akopytov/percona-xtrabackup/support-separate-undo-tablespaces-2.1
Merge into: lp:percona-xtrabackup/2.1
Diff against target: 1232 lines (+478/-135)
19 files modified
innobackupex (+32/-3)
patches/innodb56.patch (+193/-39)
src/innodb_int.h (+5/-2)
src/xtrabackup.cc (+47/-6)
test/inc/common.sh (+48/-28)
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/-5)
test/t/ib_doublewrite.sh (+7/-4)
test/t/ib_slave_info.sh (+2/-2)
test/t/undo_tablespaces.sh (+75/-0)
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.1
Reviewer Review Type Date Requested Status
Stewart Smith (community) Approve
Laurynas Biveinis Pending
Review via email: mp+159912@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.1-param/263/

To post a comment you must log in.
Revision history for this message
Stewart Smith (stewart) :
review: Approve

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

Subscribers

People subscribed via source and target branches

to all changes: