Merge lp:~akopytov/percona-xtrabackup/parallel-table-rebuild into lp:percona-xtrabackup/2.1
- parallel-table-rebuild
- Merge into 2.1
Status: | Merged |
---|---|
Approved by: | Laurynas Biveinis |
Approved revision: | no longer in the source branch. |
Merged at revision: | 593 |
Proposed branch: | lp:~akopytov/percona-xtrabackup/parallel-table-rebuild |
Merge into: | lp:percona-xtrabackup/2.1 |
Diff against target: |
549 lines (+257/-68) 7 files modified
doc/source/xtrabackup_bin/compact_backups.rst (+26/-12) innobackupex (+10/-4) src/compact.cc (+168/-49) src/xtrabackup.cc (+9/-1) src/xtrabackup.h (+2/-0) test/t/compact.sh (+29/-0) utils/build.sh (+13/-2) |
To merge this branch: | bzr merge lp:~akopytov/percona-xtrabackup/parallel-table-rebuild |
Related bugs: | |
Related blueprints: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Laurynas Biveinis (community) | Approve | ||
Review via email: mp+162305@code.launchpad.net |
Commit message
Description of the change
Implementation of
https:/
Add a new option to innobackupex/
with the default value 1. The option specifies the number of threads
started by XtraBackup when rebuilding secondary indexes on --apply-log
--rebuild-
tablespace at a time.
UNIV_LIST_DEBUG had to be removed from debug flags for non-5.6 build
configurations, as the UNIV_LIST_DEBUG implementation of
UT_
http://
Stewart Smith (stewart) wrote : | # |
Alexey Kopytov (akopytov) wrote : | # |
I was planning to implement that originally, but then changed my mind. Table rebuild is mostly I/O bound, so defaulting to _SC_NPROCESSORS
It should rather depend on storage specs, but I'm not aware of any magic to get reasonable defaults for I/O bound threads.
Laurynas Biveinis (laurynas-biveinis) : | # |
Preview Diff
1 | === modified file 'doc/source/xtrabackup_bin/compact_backups.rst' |
2 | --- doc/source/xtrabackup_bin/compact_backups.rst 2013-02-04 14:09:53 +0000 |
3 | +++ doc/source/xtrabackup_bin/compact_backups.rst 2013-05-03 07:35:34 +0000 |
4 | @@ -47,18 +47,32 @@ |
5 | |
6 | Output, beside the standard |innobackupex| output, should contain the information about indexes being rebuilt, like: :: |
7 | |
8 | - 130201 10:40:20 InnoDB: Waiting for the background threads to start |
9 | - Rebuilding indexes for table sbtest/sbtest1 (space id: 10) |
10 | - Found index k_1 |
11 | - Dropping 1 index(es). |
12 | - Rebuilding 1 index(es). |
13 | - Rebuilding indexes for table sbtest/sbtest2 (space id: 11) |
14 | - Found index k_1 |
15 | - Found index c |
16 | - Found index k |
17 | - Found index c_2 |
18 | - Dropping 4 index(es). |
19 | - Rebuilding 4 index(es). |
20 | + [01] Checking if there are indexes to rebuild in table sakila/city (space id: 9) |
21 | + [01] Found index idx_fk_country_id |
22 | + [01] Rebuilding 1 index(es). |
23 | + [01] Checking if there are indexes to rebuild in table sakila/country (space id: 10) |
24 | + [01] Checking if there are indexes to rebuild in table sakila/customer (space id: 11) |
25 | + [01] Found index idx_fk_store_id |
26 | + [01] Found index idx_fk_address_id |
27 | + [01] Found index idx_last_name |
28 | + [01] Rebuilding 3 index(es). |
29 | + |
30 | +Additionally, you can use the :option:`--rebuild-threads` option to process tables in multiple threads when rebuilding indexes, e.g.: :: |
31 | + |
32 | + $ xtrabackup --prepare --rebuild-indexes --rebuild-threads=16 /data/backups/ |
33 | + |
34 | +In this case |XtraBackup| will create 16 worker threads with each thread rebuilding indexes for one table at a time. It will also show thread IDs for each message :: |
35 | + |
36 | + Starting 16 threads to rebuild indexes. |
37 | + |
38 | + [09] Checking if there are indexes to rebuild in table sakila/city (space id: 9) |
39 | + [09] Found index idx_fk_country_id |
40 | + [10] Checking if there are indexes to rebuild in table sakila/country (space id: 10) |
41 | + [11] Checking if there are indexes to rebuild in table sakila/customer (space id: 11) |
42 | + [11] Found index idx_fk_store_id |
43 | + [11] Found index idx_fk_address_id |
44 | + [11] Found index idx_last_name |
45 | + [11] Rebuilding 3 index(es). |
46 | |
47 | Since |XtraBackup| has no information when applying an incremental backup to a compact full one, on whether there will be more incremental backups applied to it later or not, rebuilding indexes needs to be explicitly requested by a user whenever a full backup with some incremental backups merged is ready to be restored. Rebuilding indexes unconditionally on every incremental backup merge is not an option, since it is an expensive operation. |
48 | |
49 | |
50 | === modified file 'innobackupex' |
51 | --- innobackupex 2013-04-28 18:35:33 +0000 |
52 | +++ innobackupex 2013-05-03 07:35:34 +0000 |
53 | @@ -137,6 +137,7 @@ |
54 | |
55 | my $option_compact = ''; |
56 | my $option_rebuild_indexes = ''; |
57 | +my $option_rebuild_threads = 0; |
58 | |
59 | my %mysql; |
60 | my $option_backup = ''; |
61 | @@ -987,6 +988,9 @@ |
62 | if ($option_rebuild_indexes) { |
63 | $cmdline = $cmdline . " --rebuild-indexes" |
64 | } |
65 | + if ($option_rebuild_threads) { |
66 | + $cmdline = $cmdline . " --rebuild-threads=$option_rebuild_threads" |
67 | + } |
68 | |
69 | $now = current_time(); |
70 | print STDERR "\n$now $prefix Starting ibbackup with command: $cmdline\n\n"; |
71 | @@ -1225,9 +1229,6 @@ |
72 | if ($option_compact) { |
73 | $options = $options . " --compact"; |
74 | } |
75 | - if ($option_rebuild_indexes) { |
76 | - $options = $options . " --rebuild-indexes"; |
77 | - } |
78 | |
79 | $cmdline = "$option_ibbackup_binary $options"; |
80 | |
81 | @@ -1965,7 +1966,8 @@ |
82 | 'safe-slave-backup' => \$option_safe_slave_backup, |
83 | 'safe-slave-backup-timeout=i' => \$option_safe_slave_backup_timeout, |
84 | 'compact' => \$option_compact, |
85 | - 'rebuild-indexes' => \$option_rebuild_indexes |
86 | + 'rebuild-indexes' => \$option_rebuild_indexes, |
87 | + 'rebuild-threads=i' => \$option_rebuild_threads |
88 | ); |
89 | |
90 | if (!$rcode) { |
91 | @@ -3146,6 +3148,10 @@ |
92 | |
93 | This option only has effect when used together with the --apply-log option and is passed directly to xtrabackup. When used, makes xtrabackup rebuild all secondary indexes after applying the log. This option is normally used to prepare compact backups. See the XtraBackup manual for more information. |
94 | |
95 | +=item --rebuild-threads |
96 | + |
97 | +This option only has effect when used together with the --apply-log and --rebuild-indexes option and is passed directly to xtrabackup. When used, xtrabackup processes tablespaces in parallel with the specified number of threads when rebuilding indexes. See the XtraBackup manual for more information. |
98 | + |
99 | =item --redo-only |
100 | |
101 | This option should be used when preparing the base full backup and when merging all incrementals except the last one. This option is passed directly to xtrabackup's --apply-log-only option. This forces xtrabackup to skip the "rollback" phase and do a "redo" only. This is necessary if the backup will have incremental changes applied to it later. See the xtrabackup documentation for details. |
102 | |
103 | === modified file 'src/compact.cc' |
104 | --- src/compact.cc 2013-04-23 07:44:24 +0000 |
105 | +++ src/compact.cc 2013-05-03 07:35:34 +0000 |
106 | @@ -42,16 +42,29 @@ |
107 | #define XB_TMPFILE_SUFFIX ".tmp" |
108 | |
109 | /* Page range */ |
110 | -typedef struct { |
111 | +struct page_range_t { |
112 | ulint from; /*!< range start */ |
113 | ulint to; /*!< range end */ |
114 | -} page_range_t; |
115 | +}; |
116 | |
117 | /* Cursor in a page map file */ |
118 | -typedef struct { |
119 | +struct page_map_cursor_t { |
120 | File fd; /*!< file descriptor */ |
121 | IO_CACHE cache; /*!< IO_CACHE associated with fd */ |
122 | -} page_map_cursor_t; |
123 | +}; |
124 | + |
125 | +/* Table descriptor for the index rebuild operation */ |
126 | +struct index_rebuild_table_t { |
127 | + char* name; /* table name */ |
128 | + ulint space_id; /* space ID */ |
129 | + UT_LIST_NODE_T(index_rebuild_table_t) list; /* list node */ |
130 | +}; |
131 | + |
132 | +/* Thread descriptor for the index rebuild operation */ |
133 | +struct index_rebuild_thread_t { |
134 | + ulint num; /* thread number */ |
135 | + pthread_t id; /* thread ID */ |
136 | +}; |
137 | |
138 | /* Empty page use to replace skipped pages in the data files */ |
139 | static byte empty_page[UNIV_PAGE_SIZE_MAX]; |
140 | @@ -60,6 +73,12 @@ |
141 | sizeof(compacted_page_magic) - 1; |
142 | static const ulint compacted_page_magic_offset = FIL_PAGE_DATA; |
143 | |
144 | +/* Mutex protecting table_list */ |
145 | +static pthread_mutex_t table_list_mutex; |
146 | +/* List of tablespaces to process by the index rebuild operation */ |
147 | +static UT_LIST_BASE_NODE_T(index_rebuild_table_t) table_list; |
148 | + |
149 | + |
150 | /************************************************************************ |
151 | Compact page filter. */ |
152 | static my_bool wf_compact_init(xb_write_filt_ctxt_t *ctxt, char *dst_name, |
153 | @@ -711,9 +730,10 @@ |
154 | static |
155 | void |
156 | xb_rebuild_indexes_for_table( |
157 | -/*=======================*/ |
158 | - dict_table_t* table, /*!< in: table */ |
159 | - trx_t* trx) /*!< in: transaction handle */ |
160 | +/*=========================*/ |
161 | + dict_table_t* table, /*!< in: table */ |
162 | + trx_t* trx, /*!< in: transaction handle */ |
163 | + ulint thread_n) /*!< in: thread number */ |
164 | { |
165 | dict_index_t* index; |
166 | dict_index_t** indexes; |
167 | @@ -726,7 +746,7 @@ |
168 | ulint* add_key_nums; |
169 | #endif |
170 | |
171 | - ut_ad(mutex_own(&(dict_sys->mutex))); |
172 | + ut_ad(!mutex_own(&(dict_sys->mutex))); |
173 | ut_ad(table); |
174 | |
175 | ut_a(UT_LIST_GET_LEN(table->indexes) > 0); |
176 | @@ -752,11 +772,11 @@ |
177 | index = dict_table_get_first_index(table); |
178 | ut_a(dict_index_is_clust(index)); |
179 | |
180 | - msg(" Dropping %lu index(es).\n", n_indexes); |
181 | + row_mysql_lock_data_dictionary(trx); |
182 | |
183 | for (i = 0; (index = dict_table_get_next_index(index)); i++) { |
184 | |
185 | - msg(" Found index %s\n", index->name); |
186 | + msg("[%02lu] Found index %s\n", thread_n, index->name); |
187 | |
188 | /* Pretend that it's the current trx that created this index. |
189 | Required to avoid 5.6+ debug assertions. */ |
190 | @@ -805,7 +825,7 @@ |
191 | row_merge_drop_indexes(trx, table, indexes, n_indexes); |
192 | #endif |
193 | |
194 | - msg(" Rebuilding %lu index(es).\n", n_indexes); |
195 | + msg("[%02lu] Rebuilding %lu index(es).\n", thread_n, n_indexes); |
196 | |
197 | error = row_merge_lock_table(trx, table, LOCK_X); |
198 | xb_a(error == DB_SUCCESS); |
199 | @@ -818,6 +838,16 @@ |
200 | #endif |
201 | } |
202 | |
203 | + /* Commit trx to release latches on system tables */ |
204 | + trx_commit_for_mysql(trx); |
205 | + trx_start_for_ddl(trx, TRX_DICT_OP_INDEX); |
206 | + |
207 | + row_mysql_unlock_data_dictionary(trx); |
208 | + |
209 | + /* Reacquire table lock for row_merge_build_indexes() */ |
210 | + error = row_merge_lock_table(trx, table, LOCK_X); |
211 | + xb_a(error == DB_SUCCESS); |
212 | + |
213 | #if MYSQL_VERSION_ID >= 50600 |
214 | error = row_merge_build_indexes(trx, table, table, FALSE, indexes, |
215 | add_key_nums, n_indexes, &dummy_table, |
216 | @@ -835,6 +865,77 @@ |
217 | trx_start_for_ddl(trx, TRX_DICT_OP_INDEX); |
218 | } |
219 | |
220 | +/************************************************************************** |
221 | +Worker thread function for index rebuild. */ |
222 | +static |
223 | +void * |
224 | +xb_rebuild_indexes_thread_func( |
225 | +/*===========================*/ |
226 | + void* arg) /* thread context */ |
227 | +{ |
228 | + dict_table_t* table; |
229 | + index_rebuild_table_t* rebuild_table; |
230 | + index_rebuild_thread_t* thread; |
231 | + trx_t* trx; |
232 | + |
233 | + thread = (index_rebuild_thread_t *) arg; |
234 | + |
235 | + trx = trx_allocate_for_mysql(); |
236 | + |
237 | + /* Suppress foreign key checks, as we are going to drop and recreate all |
238 | + secondary keys. */ |
239 | + trx->check_foreigns = FALSE; |
240 | + trx_start_for_ddl(trx, TRX_DICT_OP_INDEX); |
241 | + |
242 | + /* Loop until there are no more tables in tables list */ |
243 | + for (;;) { |
244 | + pthread_mutex_lock(&table_list_mutex); |
245 | + |
246 | + rebuild_table = UT_LIST_GET_FIRST(table_list); |
247 | + |
248 | + if (rebuild_table == NULL) { |
249 | + |
250 | + pthread_mutex_unlock(&table_list_mutex); |
251 | + break; |
252 | + } |
253 | + |
254 | + UT_LIST_REMOVE(list, table_list, rebuild_table); |
255 | + |
256 | + pthread_mutex_unlock(&table_list_mutex); |
257 | + |
258 | + ut_ad(rebuild_table->name); |
259 | + ut_ad(!trx_sys_sys_space(rebuild_table->space_id)); |
260 | + |
261 | + row_mysql_lock_data_dictionary(trx); |
262 | + |
263 | + table = dict_table_get_low(rebuild_table->name); |
264 | + |
265 | + row_mysql_unlock_data_dictionary(trx); |
266 | + |
267 | + ut_a(table != NULL); |
268 | + ut_a(table->space == rebuild_table->space_id); |
269 | + |
270 | + /* Discard change buffer entries for this space */ |
271 | + ibuf_delete_for_discarded_space(rebuild_table->space_id); |
272 | + |
273 | + msg("[%02lu] Checking if there are indexes to rebuild in table " |
274 | + "%s (space id: %lu)\n", |
275 | + thread->num, |
276 | + rebuild_table->name, rebuild_table->space_id); |
277 | + |
278 | + xb_rebuild_indexes_for_table(table, trx, thread->num); |
279 | + |
280 | + mem_free(rebuild_table->name); |
281 | + mem_free(rebuild_table); |
282 | + } |
283 | + |
284 | + trx_commit_for_mysql(trx); |
285 | + |
286 | + trx_free_for_mysql(trx); |
287 | + |
288 | + return(NULL); |
289 | +} |
290 | + |
291 | /****************************************************************************** |
292 | Rebuild all secondary indexes in all tables in separate spaces. Called from |
293 | innobase_start_or_create_for_mysql(). */ |
294 | @@ -842,17 +943,18 @@ |
295 | xb_compact_rebuild_indexes(void) |
296 | /*=============================*/ |
297 | { |
298 | - dict_table_t* sys_tables; |
299 | - dict_index_t* sys_index; |
300 | - btr_pcur_t pcur; |
301 | - const rec_t* rec; |
302 | - mtr_t mtr; |
303 | - const byte* field; |
304 | - ulint len; |
305 | - ulint space_id; |
306 | - char* name; |
307 | - dict_table_t* table; |
308 | - trx_t* trx; |
309 | + dict_table_t* sys_tables; |
310 | + dict_index_t* sys_index; |
311 | + btr_pcur_t pcur; |
312 | + const rec_t* rec; |
313 | + mtr_t mtr; |
314 | + const byte* field; |
315 | + ulint len; |
316 | + ulint space_id; |
317 | + trx_t* trx; |
318 | + index_rebuild_table_t* rebuild_table; |
319 | + index_rebuild_thread_t* threads; |
320 | + ulint i; |
321 | |
322 | #if MYSQL_VERSION_ID >= 50600 |
323 | /* Set up the dummy table for the index rebuild error reporting */ |
324 | @@ -860,15 +962,12 @@ |
325 | dummy_table.s = &dummy_table_share; |
326 | #endif |
327 | |
328 | - /* Iterate all tables that are not in the system tablespace. */ |
329 | + /* Iterate all tables that are not in the system tablespace and add them |
330 | + to the list of tables to be rebuilt later. */ |
331 | |
332 | trx = trx_allocate_for_mysql(); |
333 | trx_start_for_ddl(trx, TRX_DICT_OP_INDEX); |
334 | |
335 | - /* Suppress foreign key checks, as we are going to drop and recreate all |
336 | - secondary keys. */ |
337 | - trx->check_foreigns = FALSE; |
338 | - |
339 | row_mysql_lock_data_dictionary(trx); |
340 | |
341 | /* Enlarge the fatal lock wait timeout during index rebuild |
342 | @@ -881,6 +980,9 @@ |
343 | sys_index = UT_LIST_GET_FIRST(sys_tables->indexes); |
344 | ut_a(!dict_table_is_comp(sys_tables)); |
345 | |
346 | + pthread_mutex_init(&table_list_mutex, NULL); |
347 | + UT_LIST_INIT(table_list); |
348 | + |
349 | xb_btr_pcur_open_at_index_side(TRUE, sys_index, BTR_SEARCH_LEAF, &pcur, |
350 | TRUE, 0, &mtr); |
351 | for (;;) { |
352 | @@ -910,28 +1012,13 @@ |
353 | } |
354 | |
355 | field = rec_get_nth_field_old(rec, 0, &len); |
356 | - name = mem_strdupl((char*) field, len); |
357 | - |
358 | - btr_pcur_store_position(&pcur, &mtr); |
359 | - |
360 | - mtr_commit(&mtr); |
361 | - |
362 | - table = dict_table_get_low(name); |
363 | - ut_a(table != NULL); |
364 | - |
365 | - /* Discard change buffer entries for this space */ |
366 | - ibuf_delete_for_discarded_space(space_id); |
367 | - |
368 | - msg("Rebuilding indexes for table %s (space id: %lu)\n", name, |
369 | - space_id); |
370 | - |
371 | - xb_rebuild_indexes_for_table(table, trx); |
372 | - |
373 | - mem_free(name); |
374 | - |
375 | - mtr_start(&mtr); |
376 | - |
377 | - btr_pcur_restore_position(BTR_SEARCH_LEAF, &pcur, &mtr); |
378 | + |
379 | + rebuild_table = static_cast<index_rebuild_table_t *> |
380 | + (mem_alloc(sizeof(*rebuild_table))); |
381 | + rebuild_table->name = mem_strdupl((char*) field, len); |
382 | + rebuild_table->space_id = space_id; |
383 | + |
384 | + UT_LIST_ADD_LAST(list, table_list, rebuild_table); |
385 | } |
386 | |
387 | btr_pcur_close(&pcur); |
388 | @@ -942,4 +1029,36 @@ |
389 | trx_commit_for_mysql(trx); |
390 | |
391 | trx_free_for_mysql(trx); |
392 | + |
393 | + /* Start worker threads for the index rebuild operation */ |
394 | + ut_ad(xtrabackup_rebuild_threads > 0); |
395 | + |
396 | + if (xtrabackup_rebuild_threads > 1) { |
397 | + msg("Starting %lu threads to rebuild indexes.\n", |
398 | + xtrabackup_rebuild_threads); |
399 | + } |
400 | + |
401 | + threads = (index_rebuild_thread_t *) |
402 | + mem_alloc(sizeof(*threads) * |
403 | + xtrabackup_rebuild_threads); |
404 | + |
405 | + for (i = 0; i < xtrabackup_rebuild_threads; i++) { |
406 | + |
407 | + threads[i].num = i+1; |
408 | + if (pthread_create(&threads[i].id, NULL, |
409 | + xb_rebuild_indexes_thread_func, |
410 | + &threads[i])) { |
411 | + |
412 | + msg("error: pthread_create() failed: errno = %d\n", |
413 | + errno); |
414 | + ut_a(0); |
415 | + } |
416 | + } |
417 | + |
418 | + /* Wait for worker threads to finish */ |
419 | + for (i = 0; i < xtrabackup_rebuild_threads; i++) { |
420 | + pthread_join(threads[i].id, NULL); |
421 | + } |
422 | + |
423 | + mem_free(threads); |
424 | } |
425 | |
426 | === modified file 'src/xtrabackup.cc' |
427 | --- src/xtrabackup.cc 2013-04-29 05:46:15 +0000 |
428 | +++ src/xtrabackup.cc 2013-05-03 07:35:34 +0000 |
429 | @@ -163,7 +163,6 @@ |
430 | {array_elements(xtrabackup_encrypt_algo_names)-1,"", |
431 | xtrabackup_encrypt_algo_names, NULL}; |
432 | |
433 | - |
434 | ibool xtrabackup_encrypt = FALSE; |
435 | ulong xtrabackup_encrypt_algo; |
436 | char *xtrabackup_encrypt_key = NULL; |
437 | @@ -171,6 +170,8 @@ |
438 | uint xtrabackup_encrypt_threads; |
439 | ulonglong xtrabackup_encrypt_chunk_size = 0; |
440 | |
441 | +ulint xtrabackup_rebuild_threads = 1; |
442 | + |
443 | /* sleep interval beetween log copy iterations in log copying thread |
444 | in milliseconds (default is 1 second) */ |
445 | int xtrabackup_log_copy_interval = 1000; |
446 | @@ -449,6 +450,7 @@ |
447 | OPT_XTRA_DEBUG_SYNC, |
448 | OPT_XTRA_COMPACT, |
449 | OPT_XTRA_REBUILD_INDEXES, |
450 | + OPT_XTRA_REBUILD_THREADS, |
451 | #if MYSQL_VERSION_ID >= 50600 |
452 | OPT_INNODB_CHECKSUM_ALGORITHM, |
453 | OPT_INNODB_UNDO_DIRECTORY, |
454 | @@ -828,6 +830,12 @@ |
455 | (G_PTR*) &xtrabackup_rebuild_indexes, (G_PTR*) &xtrabackup_rebuild_indexes, |
456 | 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, |
457 | |
458 | + {"rebuild_threads", OPT_XTRA_REBUILD_INDEXES, |
459 | + "Use this number of threads to rebuild indexes in a compact backup. " |
460 | + "Only has effect with --prepare and --rebuild-indexes.", |
461 | + (G_PTR*) &xtrabackup_rebuild_threads, (G_PTR*) &xtrabackup_rebuild_threads, |
462 | + 0, GET_UINT, REQUIRED_ARG, 1, 1, UINT_MAX, 0, 0, 0}, |
463 | + |
464 | #if MYSQL_VERSION_ID >= 50600 |
465 | {"innodb_checksum_algorithm", OPT_INNODB_CHECKSUM_ALGORITHM, |
466 | "The algorithm InnoDB uses for page checksumming. [CRC32, STRICT_CRC32, " |
467 | |
468 | === modified file 'src/xtrabackup.h' |
469 | --- src/xtrabackup.h 2013-04-16 10:35:58 +0000 |
470 | +++ src/xtrabackup.h 2013-05-03 07:35:34 +0000 |
471 | @@ -52,6 +52,8 @@ |
472 | |
473 | extern xb_page_bitmap *changed_page_bitmap; |
474 | |
475 | +extern ulint xtrabackup_rebuild_threads; |
476 | + |
477 | void xtrabackup_io_throttling(void); |
478 | my_bool xb_write_delta_metadata(const char *filename, |
479 | const xb_delta_info_t *info); |
480 | |
481 | === modified file 'test/t/compact.sh' |
482 | --- test/t/compact.sh 2013-01-14 11:02:59 +0000 |
483 | +++ test/t/compact.sh 2013-05-03 07:35:34 +0000 |
484 | @@ -32,3 +32,32 @@ |
485 | |
486 | verify_db_state sakila |
487 | |
488 | +########################################################################## |
489 | +# Test --rebuild-threads |
490 | +########################################################################## |
491 | + |
492 | +rm -rf $backup_dir |
493 | + |
494 | +innobackupex --no-timestamp --compact $backup_dir |
495 | +vlog "Backup created in directory $backup_dir" |
496 | + |
497 | +record_db_state sakila |
498 | + |
499 | +stop_server |
500 | + |
501 | +# Remove datadir |
502 | +rm -r $mysql_datadir |
503 | + |
504 | +# Restore sakila |
505 | + |
506 | +innobackupex --apply-log --rebuild-indexes --rebuild-threads=16 $backup_dir |
507 | + |
508 | +grep -q "Starting 16 threads to rebuild indexes" $OUTFILE |
509 | + |
510 | +vlog "Restoring MySQL datadir" |
511 | +mkdir -p $mysql_datadir |
512 | +innobackupex --copy-back $backup_dir |
513 | + |
514 | +start_server |
515 | + |
516 | +verify_db_state sakila |
517 | |
518 | === modified file 'utils/build.sh' (properties changed: -x to +x) |
519 | --- utils/build.sh 2013-04-30 07:47:49 +0000 |
520 | +++ utils/build.sh 2013-05-03 07:35:34 +0000 |
521 | @@ -43,7 +43,13 @@ |
522 | -DUNIV_DEBUG_THREAD_CREATION -DUNIV_DEBUG_LOCK_VALIDATE -DUNIV_DEBUG_PRINT \ |
523 | -DUNIV_DEBUG_FILE_ACCESS -DUNIV_SEARCH_DEBUG -DUNIV_LOG_LSN_DEBUG \ |
524 | -DUNIV_ZIP_DEBUG -DUNIV_AHI_DEBUG -DUNIV_SQL_DEBUG -DUNIV_AIO_DEBUG \ |
525 | --DUNIV_LRU_DEBUG -DUNIV_BUF_DEBUG -DUNIV_HASH_DEBUG -DUNIV_LIST_DEBUG -DUNIV_IBUF_DEBUG" |
526 | +-DUNIV_LRU_DEBUG -DUNIV_BUF_DEBUG -DUNIV_HASH_DEBUG -DUNIV_IBUF_DEBUG" |
527 | + |
528 | + if [ "$type" = "innodb56" ] |
529 | + then |
530 | + innodb_extra_debug="$innodb_extra_debug -DUNIV_LIST_DEBUG" |
531 | + fi |
532 | + |
533 | CFLAGS="$CFLAGS -g -O0 $innodb_extra_debug -DSAFE_MUTEX -DSAFEMALLOC" |
534 | CXXFLAGS="$CXXFLAGS -g -O0 $innodb_extra_debug -DSAFE_MUTEX -DSAFEMALLOC" |
535 | extra_config_51="--with-debug=full" |
536 | @@ -181,7 +187,12 @@ |
537 | export LIBS="$LIBS -lrt" |
538 | fi |
539 | $MAKE_CMD MYSQL_ROOT_DIR=$server_dir clean |
540 | - echo "$MAKE_CMD MYSQL_ROOT_DIR=$server_dir XTRABACKUP_VERSION=$XTRABACKUP_VERSION $xtrabackup_target" > build.sh |
541 | + cat > build.sh <<EOF |
542 | +export CFLAGS="$CFLAGS" |
543 | +export CXXFLAGS="$CXXFLAGS" |
544 | +$MAKE_CMD MYSQL_ROOT_DIR=$server_dir \ |
545 | + XTRABACKUP_VERSION=$XTRABACKUP_VERSION $xtrabackup_target |
546 | +EOF |
547 | chmod +x build.sh |
548 | $MAKE_CMD MYSQL_ROOT_DIR=$server_dir XTRABACKUP_VERSION=$XTRABACKUP_VERSION $xtrabackup_target |
549 | cd $top_dir |
Alexey Kopytov <email address hidden> writes: xtrabackup called --rebuild-threads
> Add a new option to innobackupex/
> with the default value 1. The option specifies the number of threads
> started by XtraBackup when rebuilding secondary indexes on --apply-log
> --rebuild-indexes. Each thread rebuilds indexes for a single .ibd
> tablespace at a time.
Why not default to sysconf( _SC_NPROCESSORS _ONLN) ?
I'm trying to think if this would ever be a really bad idea...
--
Stewart Smith