Merge lp:~sergei.glushchenko/percona-xtrabackup/2.1-xb-bug1222062 into lp:percona-xtrabackup/2.1

Proposed by Sergei Glushchenko on 2014-09-07
Status: Merged
Approved by: Alexey Kopytov on 2014-09-10
Approved revision: 760
Merged at revision: 764
Proposed branch: lp:~sergei.glushchenko/percona-xtrabackup/2.1-xb-bug1222062
Merge into: lp:percona-xtrabackup/2.1
Diff against target: 631 lines (+109/-41)
13 files modified
doc/source/innobackupex/innobackupex_option_reference.rst (+4/-0)
doc/source/xtrabackup_bin/xbk_option_reference.rst (+4/-0)
innobackupex.pl (+11/-1)
patches/innodb51.patch (+10/-8)
patches/innodb55.patch (+9/-7)
patches/innodb56.patch (+7/-5)
patches/xtradb51.patch (+9/-7)
patches/xtradb55.patch (+10/-8)
src/fil_cur.cc (+1/-1)
src/xtrabackup.cc (+14/-1)
test/inc/common.sh (+4/-1)
test/run.sh (+15/-2)
test/t/bug1222062.sh (+11/-0)
To merge this branch: bzr merge lp:~sergei.glushchenko/percona-xtrabackup/2.1-xb-bug1222062
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) 2014-09-07 Approve on 2014-09-10
Review via email: mp+233639@code.launchpad.net

Description of the change

Bug 1222062: Add an option to disable opening all tablespaces on backup start

Introduce xtrabackup option --close-file-handlers to close file
handlers when they aren't needed anymore. Introduce new option -x
for run.sh to force xtrabackup options for all tests by putting them
into [xtrabackup] section of my.cnf.

Two jenkins runs with and without --close-file-handlers, ddl.sh fails as expected

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

To post a comment you must log in.
Alexey Kopytov (akopytov) wrote :

Sergei,

- I would call the option just ‘--close-files’, because ‘handlers’ looks
  confusing (and should be ‘handles’ for that matter).
- users are generally not supposed to call xtrabackup directly, but use
  innobackupex instead. Why is there no corresponding innobackupex
  option?
- please add the warning to the built-in help for xtrabackup option
- please also update the docs (with the “use at your own risk” warning )
- the ‘-i’ option to run.sh has been added to usage text, but is not
  actually handled
- XB_EXTRA_ARGS in run.sh is unused
- srv_close_file_handlers should be initialized to FALSE for consistency

review: Needs Fixing
Alexey Kopytov (akopytov) wrote :

In the warning text, I would also explain the consequences briefly, rather than refer users to a bug with a long discussion.

Hi Alexey,

All comments are reasonable. I just want to explain why I haven't implement option for innobackupex. We don't recommend to use this option and normally user will not use it. However, if he need it badly, then he actually nows what he is doing. So there is an option for him to add it into my.cnf. Isn't it enough?

Alexey Kopytov (akopytov) wrote :

Sure, but what if a user hits the open files limit, but still wants to create full backups with mysql.* and other MyISAM tables, buffer pool dumps, etc.?

He can put the option into [xtrabackup] of my.cnf, it will work file. Anyways I already added the corresponding innobackupex option.

760. By Sergei Glushchenko on 2014-09-10

Bug 1222062: Add an option to disable opening all tablespaces on backup start

Add xtrabackup option --close-files to close file handlers when they
aren't needed anymore.

Add corresponding innobackupex option.

Add option -x for run.sh to force xtrabackup options for all tests
by putting them into [xtrabackup] section of my.cnf.

Add option -i for rub.sh to force innobackupex options for all tests
by putting adding them to IB_ARGS.

Alexey Kopytov (akopytov) wrote :

I'd be very cautious to put such an option to my.cnf. It's too easy to forget and replicate it to another server, for example. Anyway, now the users are free to choose how they want to use it. Thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'doc/source/innobackupex/innobackupex_option_reference.rst'
2--- doc/source/innobackupex/innobackupex_option_reference.rst 2014-05-18 08:23:31 +0000
3+++ doc/source/innobackupex/innobackupex_option_reference.rst 2014-09-10 11:23:06 +0000
4@@ -14,6 +14,10 @@
5
6 Prepare a backup in ``BACKUP-DIR`` by applying the transaction log file named :file:`xtrabackup_logfile` located in the same directory. Also, create new transaction logs. The InnoDB configuration is read from the file :file:`backup-my.cnf` created by |innobackupex| when the backup was made. innobackupex --apply-log uses InnoDB configuration from ``backup-my.cnf`` by default, or from --defaults-file, if specified. InnoDB configuration in this context means server variables that affect data format, i.e. :option:`innodb_page_size`, :option:`innodb_log_block_size`, etc. Location-related variables, like :option:`innodb_log_group_home_dir` or :option:`innodb_data_file_path` are always ignored by --apply-log, so preparing a backup always works with data files from the backup directory, rather than any external ones.
7
8+.. option:: --close-files
9+
10+ Do not keep files opened. This option is passed directly to xtrabackup. When xtrabackup opens tablespace it normally doesn't close its file handle in order to handle the DDL operations correctly. However, if the number of tablespaces is really huge and can not fit into any limit, there is an option to close file handles once they are no longer accessed. Xtrabackup can produce inconsistent backups with this option enabled. Use at your own risk.
11+
12 .. option:: --compact
13
14 Create a compact backup with all secondary index pages omitted. This option is passed directly to xtrabackup. See the :program:`xtrabackup` :doc:`documentation <../xtrabackup_bin/xtrabackup_binary>` for details.
15
16=== modified file 'doc/source/xtrabackup_bin/xbk_option_reference.rst'
17--- doc/source/xtrabackup_bin/xbk_option_reference.rst 2014-05-18 08:23:31 +0000
18+++ doc/source/xtrabackup_bin/xbk_option_reference.rst 2014-09-10 11:23:06 +0000
19@@ -17,6 +17,10 @@
20
21 Make a backup and place it in :option:`--target-dir`. See :doc:`Creating a backup <creating_a_backup>`.
22
23+.. option:: --close-files
24+
25+ Do not keep files opened. When xtrabackup opens tablespace it normally doesn't close its file handle in order to handle the DDL operations correctly. However, if the number of tablespaces is really huge and can not fit into any limit, there is an option to close file handles once they are no longer accessed. Xtrabackup can produce inconsistent backups with this option enabled. Use at your own risk.
26+
27 .. option:: --compact
28
29 Create a compact backup by skipping secondary index pages.
30
31=== modified file 'innobackupex.pl'
32--- innobackupex.pl 2014-09-02 14:54:11 +0000
33+++ innobackupex.pl 2014-09-10 11:23:06 +0000
34@@ -135,6 +135,7 @@
35 my $option_safe_slave_backup = '';
36 my $option_safe_slave_backup_timeout = 300;
37
38+my $option_close_files = '';
39 my $option_compact = '';
40 my $option_rebuild_indexes = '';
41 my $option_rebuild_threads = 0;
42@@ -2802,6 +2803,10 @@
43 $options = $options . " --stream=$option_stream";
44 }
45
46+ if ($option_close_files) {
47+ $options = $options . " --close-files";
48+ }
49+
50 if ($option_compact) {
51 $options = $options . " --compact";
52 }
53@@ -3664,6 +3669,7 @@
54 'parallel=i' => \$option_parallel,
55 'safe-slave-backup' => \$option_safe_slave_backup,
56 'safe-slave-backup-timeout=i' => \$option_safe_slave_backup_timeout,
57+ 'close-files' => \$option_close_files,
58 'compact' => \$option_compact,
59 'rebuild-indexes' => \$option_rebuild_indexes,
60 'rebuild-threads=i' => \$option_rebuild_threads,
61@@ -4802,7 +4808,7 @@
62 [--tmpdir=DIRECTORY] [--tables-file=FILE]
63 [--incremental] [--incremental-basedir]
64 [--incremental-dir] [--incremental-force-scan] [--incremental-lsn]
65- [--compact]
66+ [--close-files] [--compact]
67 BACKUP-ROOT-DIR
68
69 innobackupex --apply-log [--use-memory=B]
70@@ -4874,6 +4880,10 @@
71
72 Prepare a backup in BACKUP-DIR by applying the transaction log file named "xtrabackup_logfile" located in the same directory. Also, create new transaction logs. The InnoDB configuration is read from the file "backup-my.cnf".
73
74+=item --close-files
75+
76+Do not keep files opened. This option is passed directly to xtrabackup. Use at your own risk.
77+
78 =item --compact
79
80 Create a compact backup with all secondary index pages omitted. This option is passed directly to xtrabackup. See xtrabackup documentation for details.
81
82=== modified file 'patches/innodb51.patch'
83--- patches/innodb51.patch 2014-02-23 01:28:49 +0000
84+++ patches/innodb51.patch 2014-09-10 11:23:06 +0000
85@@ -288,7 +288,7 @@
86 }
87
88 fil_system->max_assigned_id = id;
89-@@ -1438,7 +1488,12 @@
90+@@ -1438,7 +1448,12 @@
91 the file yet; the following calls will open it and update the
92 size fields */
93
94@@ -487,7 +487,7 @@
95 + inconsistencies between the file name and the actual tablespace contents
96 + if a DDL occurs between a fil_load_single_table_tablespaces() call and
97 + the actual copy operation. */
98-+ if (srv_backup_mode) {
99++ if (srv_backup_mode && !srv_close_files) {
100 +
101 + fil_node_t* node;
102 + fil_space_t* space;
103@@ -723,7 +723,7 @@
104 || ibuf_page(space_id, zip_size, block_offset, NULL));
105 # endif /* UNIV_LOG_DEBUG */
106 if (sync) {
107-@@ -4361,6 +4697,16 @@
108+@@ -4361,6 +4597,16 @@
109
110 ut_ad((mode != OS_AIO_IBUF) || (space->purpose == FIL_TABLESPACE));
111
112@@ -817,7 +817,7 @@
113
114 --- a/storage/innodb_plugin/include/srv0srv.h
115 +++ b/storage/innodb_plugin/include/srv0srv.h
116-@@ -202,6 +202,11 @@
117+@@ -202,6 +202,12 @@
118 extern ulong srv_max_purge_lag;
119
120 extern ulong srv_replication_delay;
121@@ -826,6 +826,7 @@
122 +extern ibool srv_fake_write;
123 +extern ibool srv_apply_log_only;
124 +extern ibool srv_backup_mode;
125++extern ibool srv_close_files;
126 /*-------------------------------------------*/
127
128 extern ulint srv_n_rows_inserted;
129@@ -1217,7 +1218,7 @@
130
131 --- a/storage/innodb_plugin/srv/srv0srv.c
132 +++ b/storage/innodb_plugin/srv/srv0srv.c
133-@@ -383,6 +383,10 @@
134+@@ -383,6 +383,11 @@
135
136 UNIV_INTERN ulong srv_replication_delay = 0;
137
138@@ -1225,10 +1226,11 @@
139 +UNIV_INTERN ibool srv_fake_write = FALSE;
140 +UNIV_INTERN ibool srv_apply_log_only = FALSE;
141 +UNIV_INTERN ibool srv_backup_mode = FALSE;
142++UNIV_INTERN ibool srv_close_files = FALSE;
143 /*-------------------------------------------*/
144 UNIV_INTERN ulong srv_n_spin_wait_rounds = 30;
145 UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500;
146-@@ -1011,7 +1015,7 @@
147+@@ -1011,7 +1016,7 @@
148 }
149
150 /* Initialize some INFORMATION SCHEMA internal structures */
151@@ -1237,7 +1239,7 @@
152 }
153
154 /*********************************************************************//**
155-@@ -1022,6 +1026,7 @@
156+@@ -1022,6 +1027,7 @@
157 /*==========*/
158 {
159 os_fast_mutex_free(&srv_conc_mutex);
160@@ -1245,7 +1247,7 @@
161 mem_free(srv_conc_slots);
162 srv_conc_slots = NULL;
163
164-@@ -1035,6 +1040,7 @@
165+@@ -1035,6 +1041,7 @@
166 srv_mysql_table = NULL;
167
168 trx_i_s_cache_free(trx_i_s_cache);
169
170=== modified file 'patches/innodb55.patch'
171--- patches/innodb55.patch 2014-02-23 01:28:49 +0000
172+++ patches/innodb55.patch 2014-09-10 11:23:06 +0000
173@@ -487,7 +487,7 @@
174 + inconsistencies between the file name and the actual tablespace contents
175 + if a DDL occurs between a fil_load_single_table_tablespaces() call and
176 + the actual copy operation. */
177-+ if (srv_backup_mode) {
178++ if (srv_backup_mode && !srv_close_files) {
179 +
180 + fil_node_t* node;
181 + fil_space_t* space;
182@@ -784,7 +784,7 @@
183 Returns TRUE if a single-table tablespace does not exist in the memory cache,
184 --- a/storage/innobase/include/srv0srv.h
185 +++ b/storage/innobase/include/srv0srv.h
186-@@ -218,6 +218,11 @@
187+@@ -218,6 +218,12 @@
188 extern ulong srv_max_purge_lag;
189
190 extern ulong srv_replication_delay;
191@@ -793,6 +793,7 @@
192 +extern ibool srv_fake_write;
193 +extern ibool srv_apply_log_only;
194 +extern ibool srv_backup_mode;
195++extern ibool srv_close_files;
196 /*-------------------------------------------*/
197
198 extern ulint srv_n_rows_inserted;
199@@ -1139,7 +1140,7 @@
200 }
201 --- a/storage/innobase/srv/srv0srv.c
202 +++ b/storage/innobase/srv/srv0srv.c
203-@@ -405,6 +405,10 @@
204+@@ -405,6 +405,11 @@
205
206 UNIV_INTERN ulong srv_replication_delay = 0;
207
208@@ -1147,10 +1148,11 @@
209 +UNIV_INTERN ibool srv_fake_write = FALSE;
210 +UNIV_INTERN ibool srv_apply_log_only = FALSE;
211 +UNIV_INTERN ibool srv_backup_mode = FALSE;
212++UNIV_INTERN ibool srv_close_files = FALSE;
213 /*-------------------------------------------*/
214 UNIV_INTERN ulong srv_n_spin_wait_rounds = 30;
215 UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500;
216-@@ -1084,7 +1088,7 @@
217+@@ -1084,7 +1089,7 @@
218 }
219
220 /* Initialize some INFORMATION SCHEMA internal structures */
221@@ -1159,7 +1161,7 @@
222 }
223
224 /*********************************************************************//**
225-@@ -1095,6 +1099,7 @@
226+@@ -1095,6 +1100,7 @@
227 /*==========*/
228 {
229 os_fast_mutex_free(&srv_conc_mutex);
230@@ -1167,7 +1169,7 @@
231 mem_free(srv_conc_slots);
232 srv_conc_slots = NULL;
233
234-@@ -1108,6 +1113,7 @@
235+@@ -1108,6 +1114,7 @@
236 srv_mysql_table = NULL;
237
238 trx_i_s_cache_free(trx_i_s_cache);
239@@ -1175,7 +1177,7 @@
240 }
241
242 /*********************************************************************//**
243-@@ -1728,7 +1734,7 @@
244+@@ -1728,7 +1735,7 @@
245 }
246
247 /* Record the lock wait time for this thread */
248
249=== modified file 'patches/innodb56.patch'
250--- patches/innodb56.patch 2014-08-17 09:44:20 +0000
251+++ patches/innodb56.patch 2014-09-10 11:23:06 +0000
252@@ -567,7 +567,7 @@
253 + inconsistencies between the file name and the actual tablespace contents
254 + if a DDL occurs between a fil_load_single_table_tablespaces() call and
255 + the actual copy operation. */
256-+ if (srv_backup_mode) {
257++ if (srv_backup_mode && !srv_close_files) {
258 +
259 + fil_node_t* node;
260 + fil_space_t* space;
261@@ -1261,7 +1261,7 @@
262 extern mysql_pfs_key_t innodb_file_data_key;
263 --- a/storage/innobase/include/srv0srv.h
264 +++ b/storage/innobase/include/srv0srv.h
265-@@ -353,6 +353,13 @@
266+@@ -353,6 +353,14 @@
267 extern ulong srv_max_purge_lag_delay;
268
269 extern ulong srv_replication_delay;
270@@ -1271,11 +1271,12 @@
271 +extern ibool srv_apply_log_only;
272 +
273 +extern ibool srv_backup_mode;
274++extern ibool srv_close_files;
275 +
276 /*-------------------------------------------*/
277
278 extern my_bool srv_print_innodb_monitor;
279-@@ -496,13 +503,17 @@
280+@@ -496,13 +504,17 @@
281 the reason for which is that some FS
282 do not flush meta-data when
283 unbuffered IO happens */
284@@ -2259,13 +2260,14 @@
285 /* User settable value of the number of pages that must be present
286 in the buffer cache and accessed sequentially for InnoDB to trigger a
287 readahead request. */
288-@@ -349,6 +353,13 @@
289+@@ -349,6 +353,14 @@
290
291 UNIV_INTERN ulong srv_replication_delay = 0;
292
293 +UNIV_INTERN ibool srv_apply_log_only = FALSE;
294 +
295 +UNIV_INTERN ibool srv_backup_mode = FALSE;
296++UNIV_INTERN ibool srv_close_files = TRUE;
297 +
298 +UNIV_INTERN ulint srv_log_checksum_algorithm =
299 + SRV_CHECKSUM_ALGORITHM_INNODB;
300@@ -2273,7 +2275,7 @@
301 /*-------------------------------------------*/
302 UNIV_INTERN ulong srv_n_spin_wait_rounds = 30;
303 UNIV_INTERN ulong srv_spin_wait_delay = 6;
304-@@ -1818,7 +1829,8 @@
305+@@ -1818,7 +1830,8 @@
306 if (ret == SRV_NONE
307 && srv_shutdown_state != SRV_SHUTDOWN_NONE
308 && trx_purge_state() != PURGE_STATE_DISABLED
309
310=== modified file 'patches/xtradb51.patch'
311--- patches/xtradb51.patch 2014-02-23 01:28:49 +0000
312+++ patches/xtradb51.patch 2014-09-10 11:23:06 +0000
313@@ -380,7 +380,7 @@
314 + inconsistencies between the file name and the actual tablespace contents
315 + if a DDL occurs between a fil_load_single_table_tablespaces() call and
316 + the actual copy operation. */
317-+ if (srv_backup_mode) {
318++ if (srv_backup_mode && !srv_close_files) {
319 +
320 + fil_node_t* node;
321 + fil_space_t* space;
322@@ -763,7 +763,7 @@
323 return(buf);
324 --- a/storage/innodb_plugin/include/srv0srv.h
325 +++ b/storage/innodb_plugin/include/srv0srv.h
326-@@ -243,6 +243,11 @@
327+@@ -243,6 +243,12 @@
328
329 extern ulong srv_replication_delay;
330
331@@ -771,6 +771,7 @@
332 +extern ibool srv_fake_write;
333 +extern ibool srv_apply_log_only;
334 +extern ibool srv_backup_mode;
335++extern ibool srv_close_files;
336 +
337 extern long long srv_ibuf_max_size;
338 extern ulint srv_ibuf_active_contract;
339@@ -1140,7 +1141,7 @@
340 /* prototypes for new functions added to ha_innodb.cc */
341 ibool innobase_get_slow_log();
342
343-@@ -438,6 +433,11 @@
344+@@ -438,6 +433,12 @@
345
346 UNIV_INTERN ulong srv_replication_delay = 0;
347
348@@ -1148,11 +1149,12 @@
349 +UNIV_INTERN ibool srv_fake_write = FALSE;
350 +UNIV_INTERN ibool srv_apply_log_only = FALSE;
351 +UNIV_INTERN ibool srv_backup_mode = FALSE;
352++UNIV_INTERN ibool srv_close_files = FALSE;
353 +
354 UNIV_INTERN long long srv_ibuf_max_size = 0;
355 UNIV_INTERN ulint srv_ibuf_active_contract = 0; /* 0:disable 1:enable */
356 UNIV_INTERN ulint srv_ibuf_accel_rate = 100;
357-@@ -1095,7 +1095,7 @@
358+@@ -1095,7 +1096,7 @@
359 }
360
361 /* Initialize some INFORMATION SCHEMA internal structures */
362@@ -1161,7 +1163,7 @@
363 }
364
365 /*********************************************************************//**
366-@@ -1106,6 +1106,7 @@
367+@@ -1106,6 +1107,7 @@
368 /*==========*/
369 {
370 os_fast_mutex_free(&srv_conc_mutex);
371@@ -1169,7 +1171,7 @@
372 mem_free(srv_conc_slots);
373 srv_conc_slots = NULL;
374
375-@@ -1119,6 +1120,7 @@
376+@@ -1119,6 +1121,7 @@
377 srv_mysql_table = NULL;
378
379 trx_i_s_cache_free(trx_i_s_cache);
380@@ -1177,7 +1179,7 @@
381 }
382
383 /*********************************************************************//**
384-@@ -2634,36 +2636,6 @@
385+@@ -2634,36 +2637,6 @@
386 old_sema = sema;
387 }
388
389
390=== modified file 'patches/xtradb55.patch'
391--- patches/xtradb55.patch 2014-02-23 01:28:49 +0000
392+++ patches/xtradb55.patch 2014-09-10 11:23:06 +0000
393@@ -382,7 +382,7 @@
394 + inconsistencies between the file name and the actual tablespace contents
395 + if a DDL occurs between a fil_load_single_table_tablespaces() call and
396 + the actual copy operation. */
397-+ if (srv_backup_mode) {
398++ if (srv_backup_mode && !srv_close_files) {
399 +
400 + fil_node_t* node;
401 + fil_space_t* space;
402@@ -791,7 +791,7 @@
403 extern char srv_adaptive_flushing;
404
405 /* If this flag is TRUE, then we will load the indexes' (and tables') metadata
406-@@ -271,6 +270,11 @@
407+@@ -271,6 +270,12 @@
408 extern ulint srv_expand_import;
409 extern ulint srv_pass_corrupt_table;
410
411@@ -799,6 +799,7 @@
412 +extern ibool srv_fake_write;
413 +extern ibool srv_apply_log_only;
414 +extern ibool srv_backup_mode;
415++extern ibool srv_close_files;
416 +
417 /* Helper macro to support srv_pass_corrupt_table checks. If 'cond' is FALSE,
418 execute 'code' if srv_pass_corrupt_table is non-zero, or trigger a fatal error
419@@ -1193,7 +1194,7 @@
420
421 /* Try to flush dirty pages so as to avoid IO bursts at
422 the checkpoints. */
423-@@ -435,6 +428,11 @@
424+@@ -435,6 +428,12 @@
425 UNIV_INTERN ulint srv_pass_corrupt_table = 0; /* 0:disable 1:enable */
426
427 UNIV_INTERN ulint srv_dict_size_limit = 0;
428@@ -1202,10 +1203,11 @@
429 +UNIV_INTERN ibool srv_fake_write = FALSE;
430 +UNIV_INTERN ibool srv_apply_log_only = FALSE;
431 +UNIV_INTERN ibool srv_backup_mode = FALSE;
432++UNIV_INTERN ibool srv_close_files = FALSE;
433 /*-------------------------------------------*/
434 UNIV_INTERN ulong srv_n_spin_wait_rounds = 30;
435 UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500;
436-@@ -1185,7 +1183,7 @@
437+@@ -1185,7 +1184,7 @@
438 }
439
440 /* Initialize some INFORMATION SCHEMA internal structures */
441@@ -1214,7 +1216,7 @@
442 }
443
444 /*********************************************************************//**
445-@@ -1196,6 +1194,7 @@
446+@@ -1196,6 +1195,7 @@
447 /*==========*/
448 {
449 os_fast_mutex_free(&srv_conc_mutex);
450@@ -1222,7 +1224,7 @@
451 mem_free(srv_conc_slots);
452 srv_conc_slots = NULL;
453
454-@@ -1209,6 +1208,7 @@
455+@@ -1209,6 +1209,7 @@
456 srv_mysql_table = NULL;
457
458 trx_i_s_cache_free(trx_i_s_cache);
459@@ -1230,7 +1232,7 @@
460 }
461
462 /*********************************************************************//**
463-@@ -1952,7 +1952,7 @@
464+@@ -1952,7 +1953,7 @@
465 }
466
467 /* Record the lock wait time for this thread */
468@@ -1239,7 +1241,7 @@
469 }
470
471 if (trx->was_chosen_as_deadlock_victim) {
472-@@ -2975,36 +2975,6 @@
473+@@ -2975,36 +2976,6 @@
474 old_sema = sema;
475 }
476
477
478=== modified file 'src/fil_cur.cc'
479--- src/fil_cur.cc 2014-03-01 13:30:44 +0000
480+++ src/fil_cur.cc 2014-09-10 11:23:06 +0000
481@@ -162,7 +162,7 @@
482 /* In the backup mode we should already have a tablespace handle created
483 by fil_load_single_table_tablespace() unless it is a system
484 tablespace. Otherwise we open the file here. */
485- if (cursor->is_system || !srv_backup_mode) {
486+ if (cursor->is_system || !srv_backup_mode || srv_close_files) {
487 node->handle =
488 xb_file_create_no_error_handling(node->name,
489 OS_FILE_OPEN,
490
491=== modified file 'src/xtrabackup.cc'
492--- src/xtrabackup.cc 2014-09-09 17:22:21 +0000
493+++ src/xtrabackup.cc 2014-09-10 11:23:06 +0000
494@@ -298,6 +298,7 @@
495 lsn_t xtrabackup_arch_last_file_lsn = 0ULL;
496
497 ulong xb_open_files_limit= 0;
498+my_bool xb_close_files= FALSE;
499
500 /* Datasinks */
501 ds_ctxt_t *ds_data = NULL;
502@@ -487,7 +488,8 @@
503 #endif
504 OPT_XTRA_INCREMENTAL_FORCE_SCAN,
505 OPT_DEFAULTS_GROUP,
506- OPT_OPEN_FILES_LIMIT
507+ OPT_OPEN_FILES_LIMIT,
508+ OPT_CLOSE_FILES
509 };
510
511 #if MYSQL_VERSION_ID >= 50600
512@@ -915,6 +917,10 @@
513 (G_PTR*) &xb_open_files_limit, (G_PTR*) &xb_open_files_limit, 0, GET_ULONG,
514 REQUIRED_ARG, 0, 0, UINT_MAX, 0, 1, 0},
515
516+ {"close_files", OPT_CLOSE_FILES, "do not keep files opened. Use at your own "
517+ "risk.", (G_PTR*) &xb_close_files, (G_PTR*) &xb_close_files, 0, GET_BOOL,
518+ NO_ARG, 0, 0, 0, 0, 0, 0},
519+
520 { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
521 };
522
523@@ -3059,6 +3065,13 @@
524 xb_set_innodb_read_only();
525
526 srv_backup_mode = TRUE;
527+ srv_close_files = xb_close_files;
528+
529+ if (srv_close_files)
530+ msg("xtrabackup: warning: close-files specified. Use it "
531+ "at your own risk. If there are DDL operations like table DROP TABLE "
532+ "or RENAME TABLE during the backup, inconsistent backup will be "
533+ "produced.\n");
534
535 /* initialize components */
536 if(innodb_init_param())
537
538=== modified file 'test/inc/common.sh'
539--- test/inc/common.sh 2014-09-10 07:36:39 +0000
540+++ test/inc/common.sh 2014-09-10 11:23:06 +0000
541@@ -240,7 +240,7 @@
542 fi
543
544 IB_ARGS="--defaults-file=$MYSQLD_VARDIR/my.cnf --ibbackup=$XB_BIN \
545---no-version-check"
546+--no-version-check ${IB_EXTRA_OPTS:-}"
547 XB_ARGS="--defaults-file=$MYSQLD_VARDIR/my.cnf"
548
549 # Some aliases for compatibility, as tests use the following names
550@@ -303,6 +303,9 @@
551 [client]
552 socket=${MYSQLD_SOCKET}
553 user=root
554+
555+[xtrabackup]
556+${XB_EXTRA_MY_CNF_OPTS:-}
557 EOF
558
559 # Create datadir and call mysql_install_db if it doesn't exist
560
561=== modified file 'test/run.sh'
562--- test/run.sh 2014-05-12 08:40:00 +0000
563+++ test/run.sh 2014-09-10 11:23:06 +0000
564@@ -51,6 +51,8 @@
565 on the MySQL version.
566 -j N Run tests in N parallel processes.
567 -T seconds Test timeout (default is $TEST_TIMEOUT seconds).
568+-x options Extra options to pass to xtrabackup
569+-i options Extra options to pass to innobackupex
570 EOF
571 }
572
573@@ -263,6 +265,9 @@
574 if gnutar --version > /dev/null 2>&1
575 then
576 TAR=gnutar
577+ elif gtar --version > /dev/null 2>&1
578+ then
579+ TAR=gtar
580 else
581 TAR=tar
582 fi
583@@ -324,7 +329,7 @@
584 MYSQLD_EXTRA_ARGS=
585
586 XB_BIN=""
587- IB_ARGS="--user=root --ibbackup=$XB_BIN"
588+ IB_ARGS="--user=root --ibbackup=$XB_BIN ${IB_EXTRA_OPTS:-}"
589 XB_ARGS="--no-defaults"
590
591 if [ "$XB_BUILD" != "autodetect" ]
592@@ -794,7 +799,7 @@
593 NWORKERS=
594 DEBUG_WORKER=""
595
596-while getopts "fgh?:t:s:d:c:j:T:" options; do
597+while getopts "fgh?:t:s:d:c:j:T:x:i:" options; do
598 case $options in
599 f ) force="yes";;
600 t )
601@@ -831,6 +836,14 @@
602 TEST_TIMEOUT="$OPTARG"
603 ;;
604
605+ x )
606+ XB_EXTRA_MY_CNF_OPTS="$OPTARG"
607+ ;;
608+
609+ i )
610+ IB_EXTRA_OPTS="$OPTARG"
611+ ;;
612+
613 ? ) echo "Use \`$0 -h' for the list of available options."
614 exit -1;;
615 esac
616
617=== added file 'test/t/bug1222062.sh'
618--- test/t/bug1222062.sh 1970-01-01 00:00:00 +0000
619+++ test/t/bug1222062.sh 2014-09-10 11:23:06 +0000
620@@ -0,0 +1,11 @@
621+########################################################################
622+# Bug #1222062: add option --close-files
623+########################################################################
624+
625+start_server
626+
627+mkdir $topdir/backup
628+
629+innobackupex --close-files $topdir/backup
630+
631+grep "xtrabackup: warning: close-files specified" $OUTFILE

Subscribers

People subscribed via source and target branches