Merge lp:~akopytov/percona-xtrabackup/bug1079700-2.0 into lp:percona-xtrabackup/2.0
- bug1079700-2.0
- Merge into 2.0
Status: | Merged |
---|---|
Approved by: | Laurynas Biveinis |
Approved revision: | no longer in the source branch. |
Merged at revision: | 560 |
Proposed branch: | lp:~akopytov/percona-xtrabackup/bug1079700-2.0 |
Merge into: | lp:percona-xtrabackup/2.0 |
Diff against target: |
2342 lines (+854/-211) 11 files modified
patches/innodb51.patch (+116/-22) patches/innodb51_builtin.patch (+123/-21) patches/innodb55.patch (+118/-22) patches/innodb56.patch (+102/-26) patches/xtradb51.patch (+118/-25) patches/xtradb55.patch (+106/-23) src/xtrabackup.cc (+105/-39) test/inc/common.sh (+19/-0) test/t/ddl.sh (+37/-31) test/testrun.sh (+3/-1) utils/build.sh (+7/-1) |
To merge this branch: | bzr merge lp:~akopytov/percona-xtrabackup/bug1079700-2.0 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Laurynas Biveinis (community) | Approve | ||
Review via email: mp+162926@code.launchpad.net |
Commit message
Description of the change
Bug #1079700: Issues with renaming/rotating tables during the backup
stage
The problem was in the way XtraBackup handled DDL on individual
tablespaces on the backup stage. It first created a list of tablespaces
to copy which is represented by fil_system, but when starting the actual
tablespace copy operation later, it opened tablespace files by name. If
a tablespace file could not be opened, XtraBackup assumed the tablespace
got removed after the fil_system list was created and ignored the
tablespaces. This naturally only worked for cases when the tablespace
got dropped. A renamed tablespace would be missing in the resulting
backup, and tablespace rotations resulted in a missing tablespace and a
duplicate copy of another tablespace participating in rotation.
The idea of the fix is to make sure that once a tablespace is added to
fil_system, the underlying file is copied to backup with the same name
and space ID, regardless of what operations have been performed on the
tablespace/file during the backup procedure.
The only way to achieve that is to reuse file handles created when
opening tablespaces and adding them to fil_system, i.e. never attempt to
access tablespaces by name and rely on the fact the an open file handle
will always point to the same inode, even if the file is unlink()ed or
rename()d along the way. In other words, exclude the case when we are
going to copy a tablespace, but the file does not exist already.
This requires changes to fil_load_
the file handle after adding a space/node to fil_system, but keep the
node open and assign the handle to node->handle. We could use
fil_node_
and open the tablespace file by name, which would still leave some room
for a race condition during the time when fil_system is populated. This
also requires XtraBackup to close the node correctly basically to comply
with various invariants enforced by fil_validate() in debug builds. This
part is implemented in XtraBackup in xb_fil_
We also want to reuse file handles in fil_load_
only at the backup stage. Historically, XtraBackup patches used
recv_recovery_on to detect whether we are currently in the 'backup' or
'recovery' mode. That doesn't always work reliably. For example, we may
initialize fil_system before we start recovery to apply an incremental
backup. So recovery is still not started, but we are not in the backup
mode either. To circumvent that, the patch introduces another global
variable srv_backup_mode which is set by XtraBackup only in
xtrabackup_
support in innodb56.patch to use srv_backup_mode instead of
recv_recovery_on.
Another change necessitated by the patch is ignoring deleted tablespaces
on recovery, which has been implemented in XB patches to
recv_apply_
recovery and the underlying file is deleted, possible updates to the
same tablespace done before deleting the tablespace are left in the redo
log. They will be ignored by the recovery code. This can never cause any
problems for server, because file creation/removal is done immediately,
so on recovery InnoDB detects missing tablespace files and does not the
corresponding log records to the hash table (see the first lines in
recv_add_
underlying file will be present when recovery starts, but then get
deleted when MLOG_FILE_DELETE is replayed, i.e. after all log records
from the current batch have been added to the hash table. As a result,
log records corresponding to the deleted tablespace are ignore, but are
still left in the hash table, so recv_apply_
forever waiting for recv_sys->n_addrs to become zero. This was also
possible with XtraBackup before this fix, i.e. when a tablespace is
removed after it has been copied by XtraBackup. This fix just makes this
condition more likely to occur, as we always copy all tablespaces rather
than ignore those removed before the copy operation is tarted.
To fix the above case, we also check for deleted tablespaces in
recv_apply_
tablespaces are marked as processed and recv_sys->n_addrs is decremented
accordingly to not leave spurious unprocessed log records in the hash
table.
Finally, now that we reuse fil_system file handles again, bug #870119
needs another fix. I.e. the number of open file handles grows to the
number of tablespaces we want to copy, so we want to prevent InnoDB LRU
policies from kicking in and closing/reusing file handles. There are
multiple ways to achieve that. Patching InnoDB code to disable
fil_system LRU and file closing policies in InnoDB appeared to be too
risky. The easiest one is to set the allowed number of open InnoDB files
to some vary large value unconditionally (i.e. override
innodb_open_files with the maximum possible value, LONG_MAX). InnoDB
does not allocate any resource for each srv_max_
increment. It's just the maximum possible LRU list length, so this
change does not incur any additional resource consumption.
This revision also extends bug722638.sh (since there's 95% overlap
between that one and the test case for this bug), and renames
bug722638.sh to ddl.sh to better reflect the contents. It also backports
record_db_state() / verify_db_state() from the 2.1 test suite, because
messing with individual table checksums and checksum_table looks rather
cumbersome with a higher number of tables in the test.
http://
Laurynas Biveinis (laurynas-biveinis) wrote : | # |
Alexey Kopytov (akopytov) wrote : | # |
Hi Laurynas,
On Wed, 08 May 2013 14:48:26 -0000, Laurynas Biveinis wrote:
> Review: Needs Information
>
> - The MLOG_FILE_DELETE bits need reconcilation and/or explanation
> on why the already existing hashed log rec handling in the
> patches for buf_page_read_low() is not enough. Maybe it's
> possible to tweak buf_page_read_low() patch instead of adding
> more patches to log0recv.c? Please see
> http://
> https:/
> which I have closed as Invalid due to this MP.
>
The explanation is that you did not port the patch for bug #43948 to
innodb56.patch. Now that I have patched recv_apply_
the fix for bug 43948 in PS and innodb51.
But since the goal is to get rid of all those patches, they will be
"reconciled" naturally.
> - Will the following work:
> - XtraBackup creates a list of tablespaces;
> - CREATE TABLE foo is issued (optionally maybe even CREATE
> DATABASE first);
> - XtraBackup proceeds with backup;
> - Incremental backup is taken. Will it contain foo? It is
> possible that some of the foo writes will be captured in the
> full backup redo log backup.
> I guess this question boils down to "is fil_system snapshot
> taking atomic with the rest of backup state." CREATE TABLE
> specifically because other scenarios seem to be covered by this
> fix. I am not implying that I suspect it will or will not, I
> don't know and am curious.
>
fil_op_
MLOG_FILE_CREATE and the tablespace already exists. So if the tablespace
makes it into fil_system at the backup stage, XtraBackup will ignore
MLOG_FILE_CREATE. Otherwise it will replay it. Not sure what difference
a subsequent incremental backup would make.
> - This might be outside the scope of the current fix, but since
> you are backporting the mysqldump backup verifier, I am
> mentioning it here. If there's a bug/blueprint open for this,
> please point me there: mysqldump verification probably would miss
> secondary index tree corruptions, wouldn't it?
>
Both mysqldump and CHECKSUM TABLE verification are identical for InnoDB.
CHECKSUM TABLE basically does "SELECT * FROM table" internally and
calculates checksums for all values in all rows. So corruption in
secondary index pages will also go unnoticed.
> - What are the s/AM_CONFIG_
> Some bug fixed? If yes, is there a # ref?
>
It is a backport of the fix for bug #1164958 to older PS/MySQL 5.1 versions.
> - Likewise for configure.cmake patch bits?
>
Likewise, backports of the fix for
http://
> - I recall seeing utils/build.sh patch elsewhere, yet there is
> only one unmerged revision in this MP. Is this intended?
>
That was for 2.1.
Laurynas Biveinis (laurynas-biveinis) wrote : | # |
Hi Alexey -
> > - The MLOG_FILE_DELETE bits need reconcilation and/or explanation
> > http://
>
> The explanation is that you did not port the patch for bug #43948 to
> innodb56.patch. Now that I have patched recv_apply_
> the fix for bug 43948 in PS and innodb51.
Yes, I was wondering about other than innodb56.patch patches. The fact that I didn't patch innodb56.patch is/was https:/
> > - This might be outside the scope of the current fix, but since
> > you are backporting the mysqldump backup verifier, I am
> > mentioning it here. If there's a bug/blueprint open for this,
> > please point me there: mysqldump verification probably would miss
> > secondary index tree corruptions, wouldn't it?
> >
>
> Both mysqldump and CHECKSUM TABLE verification are identical for InnoDB.
> CHECKSUM TABLE basically does "SELECT * FROM table" internally and
> calculates checksums for all values in all rows. So corruption in
> secondary index pages will also go unnoticed.
I didn't mention CHECKSUM TABLE anywhere in my comment for this very reason. So do we want to do something re. secondary index tree verifications?
Preview Diff
1 | === modified file 'patches/innodb51.patch' | |||
2 | --- patches/innodb51.patch 2013-04-16 14:29:50 +0000 | |||
3 | +++ patches/innodb51.patch 2013-05-08 05:16:27 +0000 | |||
4 | @@ -444,7 +444,60 @@ | |||
5 | 444 | if (size < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) { | 444 | if (size < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) { |
6 | 445 | fprintf(stderr, | 445 | fprintf(stderr, |
7 | 446 | "InnoDB: Error: the size of single-table tablespace" | 446 | "InnoDB: Error: the size of single-table tablespace" |
9 | 447 | @@ -3425,7 +3530,7 @@ | 447 | @@ -3414,7 +3519,51 @@ |
10 | 448 | |||
11 | 449 | fil_node_create(filepath, 0, space_id, FALSE); | ||
12 | 450 | func_exit: | ||
13 | 451 | - os_file_close(file); | ||
14 | 452 | + /* We reuse file handles on the backup stage in XtraBackup to avoid | ||
15 | 453 | + inconsistencies between the file name and the actual tablespace contents | ||
16 | 454 | + if a DDL occurs between a fil_load_single_table_tablespaces() call and | ||
17 | 455 | + the actual copy operation. */ | ||
18 | 456 | + if (srv_backup_mode) { | ||
19 | 457 | + | ||
20 | 458 | + fil_node_t* node; | ||
21 | 459 | + fil_space_t* space; | ||
22 | 460 | + | ||
23 | 461 | + mutex_enter(&fil_system->mutex); | ||
24 | 462 | + | ||
25 | 463 | + space = fil_space_get_by_id(space_id); | ||
26 | 464 | + | ||
27 | 465 | + if (space) { | ||
28 | 466 | + node = UT_LIST_GET_LAST(space->chain); | ||
29 | 467 | + | ||
30 | 468 | + /* The handle will be closed by xtrabackup in | ||
31 | 469 | + xtrabackup_copy_datafile(). We set node->open to TRUE to | ||
32 | 470 | + make sure no one calls fil_node_open_file() | ||
33 | 471 | + (i.e. attempts to reopen the tablespace by name) during | ||
34 | 472 | + the backup stage. */ | ||
35 | 473 | + | ||
36 | 474 | + node->open = TRUE; | ||
37 | 475 | + node->handle = file; | ||
38 | 476 | + | ||
39 | 477 | + /* The following is copied from fil_node_open_file() to | ||
40 | 478 | + pass fil_system validity checks. We cannot use | ||
41 | 479 | + fil_node_open_file() directly, as that would re-open the | ||
42 | 480 | + file by name and create another file handle. */ | ||
43 | 481 | + | ||
44 | 482 | + fil_system->n_open++; | ||
45 | 483 | + | ||
46 | 484 | + if (space->purpose == FIL_TABLESPACE && | ||
47 | 485 | + space->id != 0) { | ||
48 | 486 | + | ||
49 | 487 | + /* Put the node to the LRU list */ | ||
50 | 488 | + UT_LIST_ADD_FIRST(LRU, fil_system->LRU, node); | ||
51 | 489 | + } | ||
52 | 490 | + } | ||
53 | 491 | + | ||
54 | 492 | + mutex_exit(&fil_system->mutex); | ||
55 | 493 | + } else { | ||
56 | 494 | + | ||
57 | 495 | + os_file_close(file); | ||
58 | 496 | + } | ||
59 | 497 | ut_free(buf2); | ||
60 | 498 | mem_free(filepath); | ||
61 | 499 | } | ||
62 | 500 | @@ -3425,7 +3574,7 @@ | ||
63 | 448 | idea is to read as much good data as we can and jump over bad data. | 501 | idea is to read as much good data as we can and jump over bad data. |
64 | 449 | @return 0 if ok, -1 if error even after the retries, 1 if at the end | 502 | @return 0 if ok, -1 if error even after the retries, 1 if at the end |
65 | 450 | of the directory */ | 503 | of the directory */ |
66 | @@ -453,7 +506,7 @@ | |||
67 | 453 | int | 506 | int |
68 | 454 | fil_file_readdir_next_file( | 507 | fil_file_readdir_next_file( |
69 | 455 | /*=======================*/ | 508 | /*=======================*/ |
71 | 456 | @@ -3469,7 +3574,7 @@ | 509 | @@ -3469,7 +3618,7 @@ |
72 | 457 | @return DB_SUCCESS or error number */ | 510 | @return DB_SUCCESS or error number */ |
73 | 458 | UNIV_INTERN | 511 | UNIV_INTERN |
74 | 459 | ulint | 512 | ulint |
75 | @@ -462,7 +515,7 @@ | |||
76 | 462 | /*===================================*/ | 515 | /*===================================*/ |
77 | 463 | { | 516 | { |
78 | 464 | int ret; | 517 | int ret; |
80 | 465 | @@ -3525,7 +3630,9 @@ | 518 | @@ -3525,7 +3674,9 @@ |
81 | 466 | dbinfo.name); | 519 | dbinfo.name); |
82 | 467 | srv_normalize_path_for_win(dbpath); | 520 | srv_normalize_path_for_win(dbpath); |
83 | 468 | 521 | ||
84 | @@ -473,7 +526,7 @@ | |||
85 | 473 | 526 | ||
86 | 474 | if (dbdir != NULL) { | 527 | if (dbdir != NULL) { |
87 | 475 | /* printf("Opened dir %s\n", dbinfo.name); */ | 528 | /* printf("Opened dir %s\n", dbinfo.name); */ |
89 | 476 | @@ -3551,8 +3658,11 @@ | 529 | @@ -3551,8 +3702,11 @@ |
90 | 477 | ".ibd")) { | 530 | ".ibd")) { |
91 | 478 | /* The name ends in .ibd; try opening | 531 | /* The name ends in .ibd; try opening |
92 | 479 | the file */ | 532 | the file */ |
93 | @@ -486,7 +539,7 @@ | |||
94 | 486 | } | 539 | } |
95 | 487 | next_file_item: | 540 | next_file_item: |
96 | 488 | ret = fil_file_readdir_next_file(&err, | 541 | ret = fil_file_readdir_next_file(&err, |
98 | 489 | @@ -3724,15 +3834,97 @@ | 542 | @@ -3724,15 +3878,97 @@ |
99 | 490 | "InnoDB: in InnoDB data dictionary" | 543 | "InnoDB: in InnoDB data dictionary" |
100 | 491 | " has tablespace id %lu,\n" | 544 | " has tablespace id %lu,\n" |
101 | 492 | "InnoDB: but tablespace with that id" | 545 | "InnoDB: but tablespace with that id" |
102 | @@ -592,7 +645,7 @@ | |||
103 | 592 | } else { | 645 | } else { |
104 | 593 | ut_print_timestamp(stderr); | 646 | ut_print_timestamp(stderr); |
105 | 594 | fputs(" InnoDB: Error: table ", stderr); | 647 | fputs(" InnoDB: Error: table ", stderr); |
107 | 595 | @@ -4121,7 +4313,7 @@ | 648 | @@ -4121,7 +4357,7 @@ |
108 | 596 | off the LRU list if it is in the LRU list. The caller must hold the fil_sys | 649 | off the LRU list if it is in the LRU list. The caller must hold the fil_sys |
109 | 597 | mutex. */ | 650 | mutex. */ |
110 | 598 | static | 651 | static |
111 | @@ -601,7 +654,7 @@ | |||
112 | 601 | fil_node_prepare_for_io( | 654 | fil_node_prepare_for_io( |
113 | 602 | /*====================*/ | 655 | /*====================*/ |
114 | 603 | fil_node_t* node, /*!< in: file node */ | 656 | fil_node_t* node, /*!< in: file node */ |
116 | 604 | @@ -4141,10 +4333,13 @@ | 657 | @@ -4141,10 +4377,13 @@ |
117 | 605 | } | 658 | } |
118 | 606 | 659 | ||
119 | 607 | if (node->open == FALSE) { | 660 | if (node->open == FALSE) { |
120 | @@ -616,7 +669,7 @@ | |||
121 | 616 | } | 669 | } |
122 | 617 | 670 | ||
123 | 618 | if (node->n_pending == 0 && space->purpose == FIL_TABLESPACE | 671 | if (node->n_pending == 0 && space->purpose == FIL_TABLESPACE |
125 | 619 | @@ -4157,6 +4352,8 @@ | 672 | @@ -4157,6 +4396,8 @@ |
126 | 620 | } | 673 | } |
127 | 621 | 674 | ||
128 | 622 | node->n_pending++; | 675 | node->n_pending++; |
129 | @@ -625,7 +678,7 @@ | |||
130 | 625 | } | 678 | } |
131 | 626 | 679 | ||
132 | 627 | /********************************************************************//** | 680 | /********************************************************************//** |
134 | 628 | @@ -4292,7 +4489,9 @@ | 681 | @@ -4292,7 +4533,9 @@ |
135 | 629 | ut_ad(recv_no_ibuf_operations || (type == OS_FILE_WRITE) | 682 | ut_ad(recv_no_ibuf_operations || (type == OS_FILE_WRITE) |
136 | 630 | || !ibuf_bitmap_page(zip_size, block_offset) | 683 | || !ibuf_bitmap_page(zip_size, block_offset) |
137 | 631 | || sync || is_log); | 684 | || sync || is_log); |
138 | @@ -636,7 +689,7 @@ | |||
139 | 636 | || ibuf_page(space_id, zip_size, block_offset, NULL)); | 689 | || ibuf_page(space_id, zip_size, block_offset, NULL)); |
140 | 637 | # endif /* UNIV_LOG_DEBUG */ | 690 | # endif /* UNIV_LOG_DEBUG */ |
141 | 638 | if (sync) { | 691 | if (sync) { |
143 | 639 | @@ -4341,6 +4540,16 @@ | 692 | @@ -4341,6 +4584,16 @@ |
144 | 640 | 693 | ||
145 | 641 | ut_ad((mode != OS_AIO_IBUF) || (space->purpose == FIL_TABLESPACE)); | 694 | ut_ad((mode != OS_AIO_IBUF) || (space->purpose == FIL_TABLESPACE)); |
146 | 642 | 695 | ||
147 | @@ -710,7 +763,7 @@ | |||
148 | 710 | 763 | ||
149 | 711 | --- a/storage/innodb_plugin/include/srv0srv.h | 764 | --- a/storage/innodb_plugin/include/srv0srv.h |
150 | 712 | +++ b/storage/innodb_plugin/include/srv0srv.h | 765 | +++ b/storage/innodb_plugin/include/srv0srv.h |
152 | 713 | @@ -202,6 +202,10 @@ | 766 | @@ -202,6 +202,11 @@ |
153 | 714 | extern ulong srv_max_purge_lag; | 767 | extern ulong srv_max_purge_lag; |
154 | 715 | 768 | ||
155 | 716 | extern ulong srv_replication_delay; | 769 | extern ulong srv_replication_delay; |
156 | @@ -718,6 +771,7 @@ | |||
157 | 718 | +extern ibool srv_read_only; | 771 | +extern ibool srv_read_only; |
158 | 719 | +extern ibool srv_fake_write; | 772 | +extern ibool srv_fake_write; |
159 | 720 | +extern ibool srv_apply_log_only; | 773 | +extern ibool srv_apply_log_only; |
160 | 774 | +extern ibool srv_backup_mode; | ||
161 | 721 | /*-------------------------------------------*/ | 775 | /*-------------------------------------------*/ |
162 | 722 | 776 | ||
163 | 723 | extern ulint srv_n_rows_inserted; | 777 | extern ulint srv_n_rows_inserted; |
164 | @@ -912,7 +966,35 @@ | |||
165 | 912 | || (recv_addr->state == RECV_BEING_PROCESSED) | 966 | || (recv_addr->state == RECV_BEING_PROCESSED) |
166 | 913 | || (recv_addr->state == RECV_PROCESSED)) { | 967 | || (recv_addr->state == RECV_PROCESSED)) { |
167 | 914 | 968 | ||
169 | 915 | @@ -2297,7 +2298,7 @@ | 969 | @@ -1762,6 +1763,18 @@ |
170 | 970 | ulint zip_size = fil_space_get_zip_size(space); | ||
171 | 971 | ulint page_no = recv_addr->page_no; | ||
172 | 972 | |||
173 | 973 | + /* By now we have replayed all DDL log records from the | ||
174 | 974 | + current batch. Check if the space ID is still valid in | ||
175 | 975 | + the entry being processed, and ignore it if it is not.*/ | ||
176 | 976 | + if (fil_tablespace_deleted_or_being_deleted_in_mem(space, -1)) { | ||
177 | 977 | + | ||
178 | 978 | + ut_a(recv_sys->n_addrs); | ||
179 | 979 | + | ||
180 | 980 | + recv_addr->state = RECV_PROCESSED; | ||
181 | 981 | + recv_sys->n_addrs--; | ||
182 | 982 | + | ||
183 | 983 | + goto next; | ||
184 | 984 | + } | ||
185 | 985 | if (recv_addr->state == RECV_NOT_PROCESSED) { | ||
186 | 986 | if (!has_printed) { | ||
187 | 987 | ut_print_timestamp(stderr); | ||
188 | 988 | @@ -1795,7 +1808,7 @@ | ||
189 | 989 | |||
190 | 990 | mutex_enter(&(recv_sys->mutex)); | ||
191 | 991 | } | ||
192 | 992 | - | ||
193 | 993 | +next: | ||
194 | 994 | recv_addr = HASH_GET_NEXT(addr_hash, recv_addr); | ||
195 | 995 | } | ||
196 | 996 | |||
197 | 997 | @@ -2297,7 +2310,7 @@ | ||
198 | 916 | || type == MLOG_FILE_RENAME | 998 | || type == MLOG_FILE_RENAME |
199 | 917 | || type == MLOG_FILE_DELETE) { | 999 | || type == MLOG_FILE_DELETE) { |
200 | 918 | ut_a(space); | 1000 | ut_a(space); |
201 | @@ -921,7 +1003,7 @@ | |||
202 | 921 | if (recv_replay_file_ops) { | 1003 | if (recv_replay_file_ops) { |
203 | 922 | 1004 | ||
204 | 923 | /* In ibbackup --apply-log, replay an .ibd file | 1005 | /* In ibbackup --apply-log, replay an .ibd file |
206 | 924 | @@ -2320,7 +2321,7 @@ | 1006 | @@ -2320,7 +2333,7 @@ |
207 | 925 | ut_error; | 1007 | ut_error; |
208 | 926 | } | 1008 | } |
209 | 927 | } | 1009 | } |
210 | @@ -930,7 +1012,7 @@ | |||
211 | 930 | /* In normal mysqld crash recovery we do not try to | 1012 | /* In normal mysqld crash recovery we do not try to |
212 | 931 | replay file operations */ | 1013 | replay file operations */ |
213 | 932 | #ifdef UNIV_LOG_LSN_DEBUG | 1014 | #ifdef UNIV_LOG_LSN_DEBUG |
215 | 933 | @@ -2737,8 +2738,11 @@ | 1015 | @@ -2737,8 +2750,11 @@ |
216 | 934 | 1016 | ||
217 | 935 | fprintf(stderr, | 1017 | fprintf(stderr, |
218 | 936 | "InnoDB: Doing recovery: scanned up to" | 1018 | "InnoDB: Doing recovery: scanned up to" |
219 | @@ -944,7 +1026,7 @@ | |||
220 | 944 | } | 1026 | } |
221 | 945 | } | 1027 | } |
222 | 946 | 1028 | ||
224 | 947 | @@ -2841,7 +2845,7 @@ | 1029 | @@ -2841,7 +2857,7 @@ |
225 | 948 | "InnoDB: Reading tablespace information" | 1030 | "InnoDB: Reading tablespace information" |
226 | 949 | " from the .ibd files...\n"); | 1031 | " from the .ibd files...\n"); |
227 | 950 | 1032 | ||
228 | @@ -953,7 +1035,7 @@ | |||
229 | 953 | 1035 | ||
230 | 954 | /* If we are using the doublewrite method, we will | 1036 | /* If we are using the doublewrite method, we will |
231 | 955 | check if there are half-written pages in data files, | 1037 | check if there are half-written pages in data files, |
233 | 956 | @@ -2850,12 +2854,14 @@ | 1038 | @@ -2850,12 +2866,14 @@ |
234 | 957 | 1039 | ||
235 | 958 | if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) { | 1040 | if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) { |
236 | 959 | 1041 | ||
237 | @@ -969,7 +1051,7 @@ | |||
238 | 969 | } | 1051 | } |
239 | 970 | } | 1052 | } |
240 | 971 | 1053 | ||
242 | 972 | @@ -3005,6 +3011,7 @@ | 1054 | @@ -3005,6 +3023,7 @@ |
243 | 973 | recv_sys->recovered_lsn = checkpoint_lsn; | 1055 | recv_sys->recovered_lsn = checkpoint_lsn; |
244 | 974 | 1056 | ||
245 | 975 | srv_start_lsn = checkpoint_lsn; | 1057 | srv_start_lsn = checkpoint_lsn; |
246 | @@ -977,7 +1059,7 @@ | |||
247 | 977 | } | 1059 | } |
248 | 978 | 1060 | ||
249 | 979 | contiguous_lsn = ut_uint64_align_down(recv_sys->scanned_lsn, | 1061 | contiguous_lsn = ut_uint64_align_down(recv_sys->scanned_lsn, |
251 | 980 | @@ -3286,6 +3293,7 @@ | 1062 | @@ -3286,6 +3305,7 @@ |
252 | 981 | that the data dictionary tables will be free of any locks. | 1063 | that the data dictionary tables will be free of any locks. |
253 | 982 | The data dictionary latch should guarantee that there is at | 1064 | The data dictionary latch should guarantee that there is at |
254 | 983 | most one data dictionary transaction active at a time. */ | 1065 | most one data dictionary transaction active at a time. */ |
255 | @@ -1102,17 +1184,18 @@ | |||
256 | 1102 | secondary index entries for merge sort */ | 1184 | secondary index entries for merge sort */ |
257 | 1103 | --- a/storage/innodb_plugin/srv/srv0srv.c | 1185 | --- a/storage/innodb_plugin/srv/srv0srv.c |
258 | 1104 | +++ b/storage/innodb_plugin/srv/srv0srv.c | 1186 | +++ b/storage/innodb_plugin/srv/srv0srv.c |
260 | 1105 | @@ -374,6 +374,9 @@ | 1187 | @@ -374,6 +374,10 @@ |
261 | 1106 | 1188 | ||
262 | 1107 | UNIV_INTERN ulong srv_replication_delay = 0; | 1189 | UNIV_INTERN ulong srv_replication_delay = 0; |
263 | 1108 | 1190 | ||
264 | 1109 | +UNIV_INTERN ibool srv_read_only = FALSE; | 1191 | +UNIV_INTERN ibool srv_read_only = FALSE; |
265 | 1110 | +UNIV_INTERN ibool srv_fake_write = FALSE; | 1192 | +UNIV_INTERN ibool srv_fake_write = FALSE; |
266 | 1111 | +UNIV_INTERN ibool srv_apply_log_only = FALSE; | 1193 | +UNIV_INTERN ibool srv_apply_log_only = FALSE; |
267 | 1194 | +UNIV_INTERN ibool srv_backup_mode = FALSE; | ||
268 | 1112 | /*-------------------------------------------*/ | 1195 | /*-------------------------------------------*/ |
269 | 1113 | UNIV_INTERN ulong srv_n_spin_wait_rounds = 30; | 1196 | UNIV_INTERN ulong srv_n_spin_wait_rounds = 30; |
270 | 1114 | UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500; | 1197 | UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500; |
272 | 1115 | @@ -1002,7 +1005,7 @@ | 1198 | @@ -1002,7 +1006,7 @@ |
273 | 1116 | } | 1199 | } |
274 | 1117 | 1200 | ||
275 | 1118 | /* Initialize some INFORMATION SCHEMA internal structures */ | 1201 | /* Initialize some INFORMATION SCHEMA internal structures */ |
276 | @@ -1121,7 +1204,7 @@ | |||
277 | 1121 | } | 1204 | } |
278 | 1122 | 1205 | ||
279 | 1123 | /*********************************************************************//** | 1206 | /*********************************************************************//** |
281 | 1124 | @@ -1013,6 +1016,7 @@ | 1207 | @@ -1013,6 +1017,7 @@ |
282 | 1125 | /*==========*/ | 1208 | /*==========*/ |
283 | 1126 | { | 1209 | { |
284 | 1127 | os_fast_mutex_free(&srv_conc_mutex); | 1210 | os_fast_mutex_free(&srv_conc_mutex); |
285 | @@ -1129,7 +1212,7 @@ | |||
286 | 1129 | mem_free(srv_conc_slots); | 1212 | mem_free(srv_conc_slots); |
287 | 1130 | srv_conc_slots = NULL; | 1213 | srv_conc_slots = NULL; |
288 | 1131 | 1214 | ||
290 | 1132 | @@ -1026,6 +1030,7 @@ | 1215 | @@ -1026,6 +1031,7 @@ |
291 | 1133 | srv_mysql_table = NULL; | 1216 | srv_mysql_table = NULL; |
292 | 1134 | 1217 | ||
293 | 1135 | trx_i_s_cache_free(trx_i_s_cache); | 1218 | trx_i_s_cache_free(trx_i_s_cache); |
294 | @@ -1347,3 +1430,14 @@ | |||
295 | 1347 | 1430 | ||
296 | 1348 | UNIV_MEM_FREE(buf, n); | 1431 | UNIV_MEM_FREE(buf, n); |
297 | 1349 | } | 1432 | } |
298 | 1433 | --- a/configure.in | ||
299 | 1434 | +++ b/configure.in | ||
300 | 1435 | @@ -22,7 +22,7 @@ | ||
301 | 1436 | AM_INIT_AUTOMAKE([1.9 tar-ustar]) | ||
302 | 1437 | AC_PROG_LIBTOOL | ||
303 | 1438 | |||
304 | 1439 | -AM_CONFIG_HEADER([include/config.h]) | ||
305 | 1440 | +AC_CONFIG_HEADERS([include/config.h]) | ||
306 | 1441 | |||
307 | 1442 | # Request support for automake silent-rules if available. | ||
308 | 1443 | # Default to verbose output. One can use the configure-time | ||
309 | 1350 | 1444 | ||
310 | === modified file 'patches/innodb51_builtin.patch' | |||
311 | --- patches/innodb51_builtin.patch 2013-04-16 14:29:50 +0000 | |||
312 | +++ patches/innodb51_builtin.patch 2013-05-08 05:16:27 +0000 | |||
313 | @@ -231,6 +231,15 @@ | |||
314 | 231 | } | 231 | } |
315 | 232 | 232 | ||
316 | 233 | /************************************************************************** | 233 | /************************************************************************** |
317 | 234 | @@ -1227,7 +1247,7 @@ | ||
318 | 235 | return(TRUE); | ||
319 | 236 | } | ||
320 | 237 | |||
321 | 238 | -#ifdef UNIV_HOTBACKUP | ||
322 | 239 | +#if 1 | ||
323 | 240 | /*********************************************************************** | ||
324 | 241 | Returns the tablespace object for a given id, or NULL if not found from the | ||
325 | 242 | tablespace memory cache. */ | ||
326 | 234 | @@ -1288,7 +1308,12 @@ | 243 | @@ -1288,7 +1308,12 @@ |
327 | 235 | the file yet; the following calls will open it and update the | 244 | the file yet; the following calls will open it and update the |
328 | 236 | size fields */ | 245 | size fields */ |
329 | @@ -410,7 +419,60 @@ | |||
330 | 410 | if (size < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) { | 419 | if (size < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) { |
331 | 411 | fprintf(stderr, | 420 | fprintf(stderr, |
332 | 412 | "InnoDB: Error: the size of single-table tablespace" | 421 | "InnoDB: Error: the size of single-table tablespace" |
334 | 413 | @@ -3152,7 +3256,7 @@ | 422 | @@ -3143,7 +3247,51 @@ |
335 | 423 | |||
336 | 424 | fil_node_create(filepath, 0, space_id, FALSE); | ||
337 | 425 | func_exit: | ||
338 | 426 | - os_file_close(file); | ||
339 | 427 | + /* We reuse file handles on the backup stage in XtraBackup to avoid | ||
340 | 428 | + inconsistencies between the file name and the actual tablespace contents | ||
341 | 429 | + if a DDL occurs between a fil_load_single_table_tablespaces() call and | ||
342 | 430 | + the actual copy operation. */ | ||
343 | 431 | + if (srv_backup_mode) { | ||
344 | 432 | + | ||
345 | 433 | + fil_node_t* node; | ||
346 | 434 | + fil_space_t* space; | ||
347 | 435 | + | ||
348 | 436 | + mutex_enter(&fil_system->mutex); | ||
349 | 437 | + | ||
350 | 438 | + space = fil_get_space_for_id_low(space_id); | ||
351 | 439 | + | ||
352 | 440 | + if (space) { | ||
353 | 441 | + node = UT_LIST_GET_LAST(space->chain); | ||
354 | 442 | + | ||
355 | 443 | + /* The handle will be closed by xtrabackup in | ||
356 | 444 | + xtrabackup_copy_datafile(). We set node->open to TRUE to | ||
357 | 445 | + make sure no one calls fil_node_open_file() | ||
358 | 446 | + (i.e. attempts to reopen the tablespace by name) during | ||
359 | 447 | + the backup stage. */ | ||
360 | 448 | + | ||
361 | 449 | + node->open = TRUE; | ||
362 | 450 | + node->handle = file; | ||
363 | 451 | + | ||
364 | 452 | + /* The following is copied from fil_node_open_file() to | ||
365 | 453 | + pass fil_system validity checks. We cannot use | ||
366 | 454 | + fil_node_open_file() directly, as that would re-open the | ||
367 | 455 | + file by name and create another file handle. */ | ||
368 | 456 | + | ||
369 | 457 | + fil_system->n_open++; | ||
370 | 458 | + | ||
371 | 459 | + if (space->purpose == FIL_TABLESPACE && | ||
372 | 460 | + space->id != 0) { | ||
373 | 461 | + | ||
374 | 462 | + /* Put the node to the LRU list */ | ||
375 | 463 | + UT_LIST_ADD_FIRST(LRU, fil_system->LRU, node); | ||
376 | 464 | + } | ||
377 | 465 | + } | ||
378 | 466 | + | ||
379 | 467 | + mutex_exit(&fil_system->mutex); | ||
380 | 468 | + } else { | ||
381 | 469 | + | ||
382 | 470 | + os_file_close(file); | ||
383 | 471 | + } | ||
384 | 472 | ut_free(buf2); | ||
385 | 473 | mem_free(filepath); | ||
386 | 474 | } | ||
387 | 475 | @@ -3152,7 +3300,7 @@ | ||
388 | 414 | A fault-tolerant function that tries to read the next file name in the | 476 | A fault-tolerant function that tries to read the next file name in the |
389 | 415 | directory. We retry 100 times if os_file_readdir_next_file() returns -1. The | 477 | directory. We retry 100 times if os_file_readdir_next_file() returns -1. The |
390 | 416 | idea is to read as much good data as we can and jump over bad data. */ | 478 | idea is to read as much good data as we can and jump over bad data. */ |
391 | @@ -419,7 +481,7 @@ | |||
392 | 419 | int | 481 | int |
393 | 420 | fil_file_readdir_next_file( | 482 | fil_file_readdir_next_file( |
394 | 421 | /*=======================*/ | 483 | /*=======================*/ |
396 | 422 | @@ -3197,7 +3301,7 @@ | 484 | @@ -3197,7 +3345,7 @@ |
397 | 423 | space id is != 0. */ | 485 | space id is != 0. */ |
398 | 424 | 486 | ||
399 | 425 | ulint | 487 | ulint |
400 | @@ -428,7 +490,7 @@ | |||
401 | 428 | /*===================================*/ | 490 | /*===================================*/ |
402 | 429 | /* out: DB_SUCCESS or error number */ | 491 | /* out: DB_SUCCESS or error number */ |
403 | 430 | { | 492 | { |
405 | 431 | @@ -3254,7 +3358,9 @@ | 493 | @@ -3254,7 +3402,9 @@ |
406 | 432 | dbinfo.name); | 494 | dbinfo.name); |
407 | 433 | srv_normalize_path_for_win(dbpath); | 495 | srv_normalize_path_for_win(dbpath); |
408 | 434 | 496 | ||
409 | @@ -439,7 +501,7 @@ | |||
410 | 439 | 501 | ||
411 | 440 | if (dbdir != NULL) { | 502 | if (dbdir != NULL) { |
412 | 441 | /* printf("Opened dir %s\n", dbinfo.name); */ | 503 | /* printf("Opened dir %s\n", dbinfo.name); */ |
414 | 442 | @@ -3280,8 +3386,11 @@ | 504 | @@ -3280,8 +3430,11 @@ |
415 | 443 | ".ibd")) { | 505 | ".ibd")) { |
416 | 444 | /* The name ends in .ibd; try opening | 506 | /* The name ends in .ibd; try opening |
417 | 445 | the file */ | 507 | the file */ |
418 | @@ -452,7 +514,7 @@ | |||
419 | 452 | } | 514 | } |
420 | 453 | next_file_item: | 515 | next_file_item: |
421 | 454 | ret = fil_file_readdir_next_file(&err, | 516 | ret = fil_file_readdir_next_file(&err, |
423 | 455 | @@ -3500,15 +3609,100 @@ | 517 | @@ -3500,15 +3653,100 @@ |
424 | 456 | "InnoDB: in InnoDB data dictionary" | 518 | "InnoDB: in InnoDB data dictionary" |
425 | 457 | " has tablespace id %lu,\n" | 519 | " has tablespace id %lu,\n" |
426 | 458 | "InnoDB: but tablespace with that id" | 520 | "InnoDB: but tablespace with that id" |
427 | @@ -561,7 +623,7 @@ | |||
428 | 561 | } else { | 623 | } else { |
429 | 562 | ut_print_timestamp(stderr); | 624 | ut_print_timestamp(stderr); |
430 | 563 | fputs(" InnoDB: Error: table ", stderr); | 625 | fputs(" InnoDB: Error: table ", stderr); |
432 | 564 | @@ -3901,7 +4095,7 @@ | 626 | @@ -3901,7 +4139,7 @@ |
433 | 565 | off the LRU list if it is in the LRU list. The caller must hold the fil_sys | 627 | off the LRU list if it is in the LRU list. The caller must hold the fil_sys |
434 | 566 | mutex. */ | 628 | mutex. */ |
435 | 567 | static | 629 | static |
436 | @@ -570,7 +632,7 @@ | |||
437 | 570 | fil_node_prepare_for_io( | 632 | fil_node_prepare_for_io( |
438 | 571 | /*====================*/ | 633 | /*====================*/ |
439 | 572 | fil_node_t* node, /* in: file node */ | 634 | fil_node_t* node, /* in: file node */ |
441 | 573 | @@ -3921,10 +4115,14 @@ | 635 | @@ -3921,10 +4159,14 @@ |
442 | 574 | } | 636 | } |
443 | 575 | 637 | ||
444 | 576 | if (node->open == FALSE) { | 638 | if (node->open == FALSE) { |
445 | @@ -586,7 +648,7 @@ | |||
446 | 586 | } | 648 | } |
447 | 587 | 649 | ||
448 | 588 | if (node->n_pending == 0 && space->purpose == FIL_TABLESPACE | 650 | if (node->n_pending == 0 && space->purpose == FIL_TABLESPACE |
450 | 589 | @@ -3937,6 +4135,8 @@ | 651 | @@ -3937,6 +4179,8 @@ |
451 | 590 | } | 652 | } |
452 | 591 | 653 | ||
453 | 592 | node->n_pending++; | 654 | node->n_pending++; |
454 | @@ -595,7 +657,7 @@ | |||
455 | 595 | } | 657 | } |
456 | 596 | 658 | ||
457 | 597 | /************************************************************************ | 659 | /************************************************************************ |
459 | 598 | @@ -4067,7 +4267,9 @@ | 660 | @@ -4067,7 +4311,9 @@ |
460 | 599 | ut_ad(recv_no_ibuf_operations || (type == OS_FILE_WRITE) | 661 | ut_ad(recv_no_ibuf_operations || (type == OS_FILE_WRITE) |
461 | 600 | || !ibuf_bitmap_page(block_offset) || sync || is_log); | 662 | || !ibuf_bitmap_page(block_offset) || sync || is_log); |
462 | 601 | #ifdef UNIV_SYNC_DEBUG | 663 | #ifdef UNIV_SYNC_DEBUG |
463 | @@ -606,7 +668,7 @@ | |||
464 | 606 | || ibuf_page(space_id, block_offset)); | 668 | || ibuf_page(space_id, block_offset)); |
465 | 607 | #endif | 669 | #endif |
466 | 608 | #endif | 670 | #endif |
468 | 609 | @@ -4112,6 +4314,16 @@ | 671 | @@ -4112,6 +4358,16 @@ |
469 | 610 | 672 | ||
470 | 611 | ut_ad((mode != OS_AIO_IBUF) || (space->purpose == FIL_TABLESPACE)); | 673 | ut_ad((mode != OS_AIO_IBUF) || (space->purpose == FIL_TABLESPACE)); |
471 | 612 | 674 | ||
472 | @@ -746,7 +808,7 @@ | |||
473 | 746 | extern ulint srv_pool_size; | 808 | extern ulint srv_pool_size; |
474 | 747 | extern ulint srv_awe_window_size; | 809 | extern ulint srv_awe_window_size; |
475 | 748 | extern ulint srv_mem_pool_size; | 810 | extern ulint srv_mem_pool_size; |
477 | 749 | @@ -138,6 +141,10 @@ | 811 | @@ -138,6 +141,11 @@ |
478 | 750 | extern ulong srv_max_purge_lag; | 812 | extern ulong srv_max_purge_lag; |
479 | 751 | extern ibool srv_use_awe; | 813 | extern ibool srv_use_awe; |
480 | 752 | extern ibool srv_use_adaptive_hash_indexes; | 814 | extern ibool srv_use_adaptive_hash_indexes; |
481 | @@ -754,6 +816,7 @@ | |||
482 | 754 | +extern ibool srv_read_only; | 816 | +extern ibool srv_read_only; |
483 | 755 | +extern ibool srv_fake_write; | 817 | +extern ibool srv_fake_write; |
484 | 756 | +extern ibool srv_apply_log_only; | 818 | +extern ibool srv_apply_log_only; |
485 | 819 | +extern ibool srv_backup_mode; | ||
486 | 757 | /*-------------------------------------------*/ | 820 | /*-------------------------------------------*/ |
487 | 758 | 821 | ||
488 | 759 | extern ulint srv_n_rows_inserted; | 822 | extern ulint srv_n_rows_inserted; |
489 | @@ -956,7 +1019,34 @@ | |||
490 | 956 | || (recv_addr->state == RECV_BEING_PROCESSED) | 1019 | || (recv_addr->state == RECV_BEING_PROCESSED) |
491 | 957 | || (recv_addr->state == RECV_PROCESSED)) { | 1020 | || (recv_addr->state == RECV_PROCESSED)) { |
492 | 958 | 1021 | ||
494 | 959 | @@ -1926,7 +1927,7 @@ | 1022 | @@ -1429,6 +1430,18 @@ |
495 | 1023 | space = recv_addr->space; | ||
496 | 1024 | page_no = recv_addr->page_no; | ||
497 | 1025 | |||
498 | 1026 | + /* By now we have replayed all DDL log records from the | ||
499 | 1027 | + current batch. Check if the space ID is still valid in | ||
500 | 1028 | + the entry being processed, and ignore it if it is not.*/ | ||
501 | 1029 | + if (fil_tablespace_deleted_or_being_deleted_in_mem(space, -1)) { | ||
502 | 1030 | + | ||
503 | 1031 | + ut_a(recv_sys->n_addrs); | ||
504 | 1032 | + | ||
505 | 1033 | + recv_addr->state = RECV_PROCESSED; | ||
506 | 1034 | + recv_sys->n_addrs--; | ||
507 | 1035 | + | ||
508 | 1036 | + goto next; | ||
509 | 1037 | + } | ||
510 | 1038 | if (recv_addr->state == RECV_NOT_PROCESSED) { | ||
511 | 1039 | if (!has_printed) { | ||
512 | 1040 | ut_print_timestamp(stderr); | ||
513 | 1041 | @@ -1463,6 +1476,7 @@ | ||
514 | 1042 | mutex_enter(&(recv_sys->mutex)); | ||
515 | 1043 | } | ||
516 | 1044 | |||
517 | 1045 | +next: | ||
518 | 1046 | recv_addr = HASH_GET_NEXT(addr_hash, recv_addr); | ||
519 | 1047 | } | ||
520 | 1048 | |||
521 | 1049 | @@ -1926,7 +1940,7 @@ | ||
522 | 960 | } else if (store_to_hash && (type == MLOG_FILE_CREATE | 1050 | } else if (store_to_hash && (type == MLOG_FILE_CREATE |
523 | 961 | || type == MLOG_FILE_RENAME | 1051 | || type == MLOG_FILE_RENAME |
524 | 962 | || type == MLOG_FILE_DELETE)) { | 1052 | || type == MLOG_FILE_DELETE)) { |
525 | @@ -965,7 +1055,7 @@ | |||
526 | 965 | if (recv_replay_file_ops) { | 1055 | if (recv_replay_file_ops) { |
527 | 966 | 1056 | ||
528 | 967 | /* In ibbackup --apply-log, replay an .ibd file | 1057 | /* In ibbackup --apply-log, replay an .ibd file |
530 | 968 | @@ -1949,7 +1950,7 @@ | 1058 | @@ -1949,7 +1963,7 @@ |
531 | 969 | ut_a(0); | 1059 | ut_a(0); |
532 | 970 | } | 1060 | } |
533 | 971 | } | 1061 | } |
534 | @@ -974,7 +1064,7 @@ | |||
535 | 974 | /* In normal mysqld crash recovery we do not try to | 1064 | /* In normal mysqld crash recovery we do not try to |
536 | 975 | replay file operations */ | 1065 | replay file operations */ |
537 | 976 | } else if (store_to_hash) { | 1066 | } else if (store_to_hash) { |
539 | 977 | @@ -2360,9 +2361,12 @@ | 1067 | @@ -2360,9 +2374,12 @@ |
540 | 978 | 1068 | ||
541 | 979 | fprintf(stderr, | 1069 | fprintf(stderr, |
542 | 980 | "InnoDB: Doing recovery: scanned up to" | 1070 | "InnoDB: Doing recovery: scanned up to" |
543 | @@ -989,7 +1079,7 @@ | |||
544 | 989 | } | 1079 | } |
545 | 990 | } | 1080 | } |
546 | 991 | 1081 | ||
548 | 992 | @@ -2462,7 +2466,7 @@ | 1082 | @@ -2462,7 +2479,7 @@ |
549 | 993 | "InnoDB: Reading tablespace information" | 1083 | "InnoDB: Reading tablespace information" |
550 | 994 | " from the .ibd files...\n"); | 1084 | " from the .ibd files...\n"); |
551 | 995 | 1085 | ||
552 | @@ -998,7 +1088,7 @@ | |||
553 | 998 | 1088 | ||
554 | 999 | /* If we are using the doublewrite method, we will | 1089 | /* If we are using the doublewrite method, we will |
555 | 1000 | check if there are half-written pages in data files, | 1090 | check if there are half-written pages in data files, |
557 | 1001 | @@ -2471,12 +2475,14 @@ | 1091 | @@ -2471,12 +2488,14 @@ |
558 | 1002 | 1092 | ||
559 | 1003 | if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) { | 1093 | if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) { |
560 | 1004 | 1094 | ||
561 | @@ -1014,7 +1104,7 @@ | |||
562 | 1014 | } | 1104 | } |
563 | 1015 | } | 1105 | } |
564 | 1016 | 1106 | ||
566 | 1017 | @@ -2611,6 +2617,7 @@ | 1107 | @@ -2611,6 +2630,7 @@ |
567 | 1018 | recv_sys->recovered_lsn = checkpoint_lsn; | 1108 | recv_sys->recovered_lsn = checkpoint_lsn; |
568 | 1019 | 1109 | ||
569 | 1020 | srv_start_lsn = checkpoint_lsn; | 1110 | srv_start_lsn = checkpoint_lsn; |
570 | @@ -1022,7 +1112,7 @@ | |||
571 | 1022 | } | 1112 | } |
572 | 1023 | 1113 | ||
573 | 1024 | contiguous_lsn = ut_dulint_align_down(recv_sys->scanned_lsn, | 1114 | contiguous_lsn = ut_dulint_align_down(recv_sys->scanned_lsn, |
575 | 1025 | @@ -2910,6 +2917,7 @@ | 1115 | @@ -2910,6 +2930,7 @@ |
576 | 1026 | /* Switch latching order checks on in sync0sync.c */ | 1116 | /* Switch latching order checks on in sync0sync.c */ |
577 | 1027 | sync_order_checks_on = TRUE; | 1117 | sync_order_checks_on = TRUE; |
578 | 1028 | #endif | 1118 | #endif |
579 | @@ -1030,7 +1120,7 @@ | |||
580 | 1030 | if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO) { | 1120 | if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO) { |
581 | 1031 | /* Rollback the uncommitted transactions which have no user | 1121 | /* Rollback the uncommitted transactions which have no user |
582 | 1032 | session */ | 1122 | session */ |
584 | 1033 | @@ -2917,6 +2925,7 @@ | 1123 | @@ -2917,6 +2938,7 @@ |
585 | 1034 | os_thread_create(trx_rollback_or_clean_all_without_sess, | 1124 | os_thread_create(trx_rollback_or_clean_all_without_sess, |
586 | 1035 | (void *)&i, NULL); | 1125 | (void *)&i, NULL); |
587 | 1036 | } | 1126 | } |
588 | @@ -1346,17 +1436,18 @@ | |||
589 | 1346 | ulint srv_pool_size = ULINT_MAX; /* size in pages; MySQL inits | 1436 | ulint srv_pool_size = ULINT_MAX; /* size in pages; MySQL inits |
590 | 1347 | this to size in kilobytes but | 1437 | this to size in kilobytes but |
591 | 1348 | we normalize this to pages in | 1438 | we normalize this to pages in |
593 | 1349 | @@ -363,6 +367,9 @@ | 1439 | @@ -363,6 +367,10 @@ |
594 | 1350 | ibool srv_use_awe = FALSE; | 1440 | ibool srv_use_awe = FALSE; |
595 | 1351 | ibool srv_use_adaptive_hash_indexes = TRUE; | 1441 | ibool srv_use_adaptive_hash_indexes = TRUE; |
596 | 1352 | 1442 | ||
597 | 1353 | +ibool srv_read_only = FALSE; | 1443 | +ibool srv_read_only = FALSE; |
598 | 1354 | +ibool srv_fake_write = FALSE; | 1444 | +ibool srv_fake_write = FALSE; |
599 | 1355 | +ibool srv_apply_log_only = FALSE; | 1445 | +ibool srv_apply_log_only = FALSE; |
600 | 1446 | +ibool srv_backup_mode = FALSE; | ||
601 | 1356 | /*-------------------------------------------*/ | 1447 | /*-------------------------------------------*/ |
602 | 1357 | ulong srv_n_spin_wait_rounds = 20; | 1448 | ulong srv_n_spin_wait_rounds = 20; |
603 | 1358 | ulong srv_n_free_tickets_to_enter = 500; | 1449 | ulong srv_n_free_tickets_to_enter = 500; |
605 | 1359 | @@ -985,6 +992,7 @@ | 1450 | @@ -985,6 +993,7 @@ |
606 | 1360 | srv_general_init(void) | 1451 | srv_general_init(void) |
607 | 1361 | /*==================*/ | 1452 | /*==================*/ |
608 | 1362 | { | 1453 | { |
609 | @@ -1605,3 +1696,14 @@ | |||
610 | 1605 | 1696 | ||
611 | 1606 | if (rec_len != UNIV_SQL_NULL) { | 1697 | if (rec_len != UNIV_SQL_NULL) { |
612 | 1607 | n_not_null[i]++; | 1698 | n_not_null[i]++; |
613 | 1699 | --- a/configure.in | ||
614 | 1700 | +++ b/configure.in | ||
615 | 1701 | @@ -22,7 +22,7 @@ | ||
616 | 1702 | AM_INIT_AUTOMAKE([1.9 tar-ustar]) | ||
617 | 1703 | AC_PROG_LIBTOOL | ||
618 | 1704 | |||
619 | 1705 | -AM_CONFIG_HEADER([include/config.h]) | ||
620 | 1706 | +AC_CONFIG_HEADERS([include/config.h]) | ||
621 | 1707 | |||
622 | 1708 | # Request support for automake silent-rules if available. | ||
623 | 1709 | # Default to verbose output. One can use the configure-time | ||
624 | 1608 | 1710 | ||
625 | === modified file 'patches/innodb55.patch' | |||
626 | --- patches/innodb55.patch 2013-04-16 14:29:50 +0000 | |||
627 | +++ patches/innodb55.patch 2013-05-08 05:16:27 +0000 | |||
628 | @@ -433,7 +433,60 @@ | |||
629 | 433 | if (size < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) { | 433 | if (size < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) { |
630 | 434 | fprintf(stderr, | 434 | fprintf(stderr, |
631 | 435 | "InnoDB: Error: the size of single-table tablespace" | 435 | "InnoDB: Error: the size of single-table tablespace" |
633 | 436 | @@ -3476,7 +3581,7 @@ | 436 | @@ -3465,7 +3570,51 @@ |
634 | 437 | |||
635 | 438 | fil_node_create(filepath, 0, space_id, FALSE); | ||
636 | 439 | func_exit: | ||
637 | 440 | - os_file_close(file); | ||
638 | 441 | + /* We reuse file handles on the backup stage in XtraBackup to avoid | ||
639 | 442 | + inconsistencies between the file name and the actual tablespace contents | ||
640 | 443 | + if a DDL occurs between a fil_load_single_table_tablespaces() call and | ||
641 | 444 | + the actual copy operation. */ | ||
642 | 445 | + if (srv_backup_mode) { | ||
643 | 446 | + | ||
644 | 447 | + fil_node_t* node; | ||
645 | 448 | + fil_space_t* space; | ||
646 | 449 | + | ||
647 | 450 | + mutex_enter(&fil_system->mutex); | ||
648 | 451 | + | ||
649 | 452 | + space = fil_space_get_by_id(space_id); | ||
650 | 453 | + | ||
651 | 454 | + if (space) { | ||
652 | 455 | + node = UT_LIST_GET_LAST(space->chain); | ||
653 | 456 | + | ||
654 | 457 | + /* The handle will be closed by xtrabackup in | ||
655 | 458 | + xtrabackup_copy_datafile(). We set node->open to TRUE to | ||
656 | 459 | + make sure no one calls fil_node_open_file() | ||
657 | 460 | + (i.e. attempts to reopen the tablespace by name) during | ||
658 | 461 | + the backup stage. */ | ||
659 | 462 | + | ||
660 | 463 | + node->open = TRUE; | ||
661 | 464 | + node->handle = file; | ||
662 | 465 | + | ||
663 | 466 | + /* The following is copied from fil_node_open_file() to | ||
664 | 467 | + pass fil_system validity checks. We cannot use | ||
665 | 468 | + fil_node_open_file() directly, as that would re-open the | ||
666 | 469 | + file by name and create another file handle. */ | ||
667 | 470 | + | ||
668 | 471 | + fil_system->n_open++; | ||
669 | 472 | + | ||
670 | 473 | + if (space->purpose == FIL_TABLESPACE && | ||
671 | 474 | + space->id != 0) { | ||
672 | 475 | + | ||
673 | 476 | + /* Put the node to the LRU list */ | ||
674 | 477 | + UT_LIST_ADD_FIRST(LRU, fil_system->LRU, node); | ||
675 | 478 | + } | ||
676 | 479 | + } | ||
677 | 480 | + | ||
678 | 481 | + mutex_exit(&fil_system->mutex); | ||
679 | 482 | + } else { | ||
680 | 483 | + | ||
681 | 484 | + os_file_close(file); | ||
682 | 485 | + } | ||
683 | 486 | ut_free(buf2); | ||
684 | 487 | mem_free(filepath); | ||
685 | 488 | } | ||
686 | 489 | @@ -3476,7 +3625,7 @@ | ||
687 | 437 | idea is to read as much good data as we can and jump over bad data. | 490 | idea is to read as much good data as we can and jump over bad data. |
688 | 438 | @return 0 if ok, -1 if error even after the retries, 1 if at the end | 491 | @return 0 if ok, -1 if error even after the retries, 1 if at the end |
689 | 439 | of the directory */ | 492 | of the directory */ |
690 | @@ -442,7 +495,7 @@ | |||
691 | 442 | int | 495 | int |
692 | 443 | fil_file_readdir_next_file( | 496 | fil_file_readdir_next_file( |
693 | 444 | /*=======================*/ | 497 | /*=======================*/ |
695 | 445 | @@ -3520,7 +3625,7 @@ | 498 | @@ -3520,7 +3669,7 @@ |
696 | 446 | @return DB_SUCCESS or error number */ | 499 | @return DB_SUCCESS or error number */ |
697 | 447 | UNIV_INTERN | 500 | UNIV_INTERN |
698 | 448 | ulint | 501 | ulint |
699 | @@ -451,7 +504,7 @@ | |||
700 | 451 | /*===================================*/ | 504 | /*===================================*/ |
701 | 452 | { | 505 | { |
702 | 453 | int ret; | 506 | int ret; |
704 | 454 | @@ -3576,7 +3681,9 @@ | 507 | @@ -3576,7 +3725,9 @@ |
705 | 455 | dbinfo.name); | 508 | dbinfo.name); |
706 | 456 | srv_normalize_path_for_win(dbpath); | 509 | srv_normalize_path_for_win(dbpath); |
707 | 457 | 510 | ||
708 | @@ -462,7 +515,7 @@ | |||
709 | 462 | 515 | ||
710 | 463 | if (dbdir != NULL) { | 516 | if (dbdir != NULL) { |
711 | 464 | /* printf("Opened dir %s\n", dbinfo.name); */ | 517 | /* printf("Opened dir %s\n", dbinfo.name); */ |
713 | 465 | @@ -3602,8 +3709,11 @@ | 518 | @@ -3602,8 +3753,11 @@ |
714 | 466 | ".ibd")) { | 519 | ".ibd")) { |
715 | 467 | /* The name ends in .ibd; try opening | 520 | /* The name ends in .ibd; try opening |
716 | 468 | the file */ | 521 | the file */ |
717 | @@ -475,7 +528,7 @@ | |||
718 | 475 | } | 528 | } |
719 | 476 | next_file_item: | 529 | next_file_item: |
720 | 477 | ret = fil_file_readdir_next_file(&err, | 530 | ret = fil_file_readdir_next_file(&err, |
722 | 478 | @@ -3775,15 +3885,97 @@ | 531 | @@ -3775,15 +3929,97 @@ |
723 | 479 | "InnoDB: in InnoDB data dictionary" | 532 | "InnoDB: in InnoDB data dictionary" |
724 | 480 | " has tablespace id %lu,\n" | 533 | " has tablespace id %lu,\n" |
725 | 481 | "InnoDB: but tablespace with that id" | 534 | "InnoDB: but tablespace with that id" |
726 | @@ -581,7 +634,7 @@ | |||
727 | 581 | } else { | 634 | } else { |
728 | 582 | ut_print_timestamp(stderr); | 635 | ut_print_timestamp(stderr); |
729 | 583 | fputs(" InnoDB: Error: table ", stderr); | 636 | fputs(" InnoDB: Error: table ", stderr); |
731 | 584 | @@ -4172,7 +4364,7 @@ | 637 | @@ -4172,7 +4408,7 @@ |
732 | 585 | off the LRU list if it is in the LRU list. The caller must hold the fil_sys | 638 | off the LRU list if it is in the LRU list. The caller must hold the fil_sys |
733 | 586 | mutex. */ | 639 | mutex. */ |
734 | 587 | static | 640 | static |
735 | @@ -590,7 +643,7 @@ | |||
736 | 590 | fil_node_prepare_for_io( | 643 | fil_node_prepare_for_io( |
737 | 591 | /*====================*/ | 644 | /*====================*/ |
738 | 592 | fil_node_t* node, /*!< in: file node */ | 645 | fil_node_t* node, /*!< in: file node */ |
740 | 593 | @@ -4192,10 +4384,13 @@ | 646 | @@ -4192,10 +4428,13 @@ |
741 | 594 | } | 647 | } |
742 | 595 | 648 | ||
743 | 596 | if (node->open == FALSE) { | 649 | if (node->open == FALSE) { |
744 | @@ -605,7 +658,7 @@ | |||
745 | 605 | } | 658 | } |
746 | 606 | 659 | ||
747 | 607 | if (node->n_pending == 0 && space->purpose == FIL_TABLESPACE | 660 | if (node->n_pending == 0 && space->purpose == FIL_TABLESPACE |
749 | 608 | @@ -4208,6 +4403,8 @@ | 661 | @@ -4208,6 +4447,8 @@ |
750 | 609 | } | 662 | } |
751 | 610 | 663 | ||
752 | 611 | node->n_pending++; | 664 | node->n_pending++; |
753 | @@ -614,7 +667,7 @@ | |||
754 | 614 | } | 667 | } |
755 | 615 | 668 | ||
756 | 616 | /********************************************************************//** | 669 | /********************************************************************//** |
758 | 617 | @@ -4390,6 +4587,16 @@ | 670 | @@ -4390,6 +4631,16 @@ |
759 | 618 | 671 | ||
760 | 619 | ut_ad((mode != OS_AIO_IBUF) || (space->purpose == FIL_TABLESPACE)); | 672 | ut_ad((mode != OS_AIO_IBUF) || (space->purpose == FIL_TABLESPACE)); |
761 | 620 | 673 | ||
762 | @@ -666,7 +719,7 @@ | |||
763 | 666 | Returns TRUE if a single-table tablespace does not exist in the memory cache, | 719 | Returns TRUE if a single-table tablespace does not exist in the memory cache, |
764 | 667 | --- a/storage/innobase/include/srv0srv.h | 720 | --- a/storage/innobase/include/srv0srv.h |
765 | 668 | +++ b/storage/innobase/include/srv0srv.h | 721 | +++ b/storage/innobase/include/srv0srv.h |
767 | 669 | @@ -218,6 +218,10 @@ | 722 | @@ -218,6 +218,11 @@ |
768 | 670 | extern ulong srv_max_purge_lag; | 723 | extern ulong srv_max_purge_lag; |
769 | 671 | 724 | ||
770 | 672 | extern ulong srv_replication_delay; | 725 | extern ulong srv_replication_delay; |
771 | @@ -674,6 +727,7 @@ | |||
772 | 674 | +extern ibool srv_read_only; | 727 | +extern ibool srv_read_only; |
773 | 675 | +extern ibool srv_fake_write; | 728 | +extern ibool srv_fake_write; |
774 | 676 | +extern ibool srv_apply_log_only; | 729 | +extern ibool srv_apply_log_only; |
775 | 730 | +extern ibool srv_backup_mode; | ||
776 | 677 | /*-------------------------------------------*/ | 731 | /*-------------------------------------------*/ |
777 | 678 | 732 | ||
778 | 679 | extern ulint srv_n_rows_inserted; | 733 | extern ulint srv_n_rows_inserted; |
779 | @@ -824,7 +878,35 @@ | |||
780 | 824 | || (recv_addr->state == RECV_BEING_PROCESSED) | 878 | || (recv_addr->state == RECV_BEING_PROCESSED) |
781 | 825 | || (recv_addr->state == RECV_PROCESSED)) { | 879 | || (recv_addr->state == RECV_PROCESSED)) { |
782 | 826 | 880 | ||
784 | 827 | @@ -2308,7 +2309,7 @@ | 881 | @@ -1774,6 +1775,18 @@ |
785 | 882 | ulint zip_size = fil_space_get_zip_size(space); | ||
786 | 883 | ulint page_no = recv_addr->page_no; | ||
787 | 884 | |||
788 | 885 | + /* By now we have replayed all DDL log records from the | ||
789 | 886 | + current batch. Check if the space ID is still valid in | ||
790 | 887 | + the entry being processed, and ignore it if it is not.*/ | ||
791 | 888 | + if (fil_tablespace_deleted_or_being_deleted_in_mem(space, -1)) { | ||
792 | 889 | + | ||
793 | 890 | + ut_a(recv_sys->n_addrs); | ||
794 | 891 | + | ||
795 | 892 | + recv_addr->state = RECV_PROCESSED; | ||
796 | 893 | + recv_sys->n_addrs--; | ||
797 | 894 | + | ||
798 | 895 | + goto next; | ||
799 | 896 | + } | ||
800 | 897 | if (recv_addr->state == RECV_NOT_PROCESSED) { | ||
801 | 898 | if (!has_printed) { | ||
802 | 899 | ut_print_timestamp(stderr); | ||
803 | 900 | @@ -1807,7 +1820,7 @@ | ||
804 | 901 | |||
805 | 902 | mutex_enter(&(recv_sys->mutex)); | ||
806 | 903 | } | ||
807 | 904 | - | ||
808 | 905 | +next: | ||
809 | 906 | recv_addr = HASH_GET_NEXT(addr_hash, recv_addr); | ||
810 | 907 | } | ||
811 | 908 | |||
812 | 909 | @@ -2308,7 +2321,7 @@ | ||
813 | 828 | || type == MLOG_FILE_RENAME | 910 | || type == MLOG_FILE_RENAME |
814 | 829 | || type == MLOG_FILE_DELETE) { | 911 | || type == MLOG_FILE_DELETE) { |
815 | 830 | ut_a(space); | 912 | ut_a(space); |
816 | @@ -833,7 +915,7 @@ | |||
817 | 833 | if (recv_replay_file_ops) { | 915 | if (recv_replay_file_ops) { |
818 | 834 | 916 | ||
819 | 835 | /* In ibbackup --apply-log, replay an .ibd file | 917 | /* In ibbackup --apply-log, replay an .ibd file |
821 | 836 | @@ -2331,7 +2332,7 @@ | 918 | @@ -2331,7 +2344,7 @@ |
822 | 837 | ut_error; | 919 | ut_error; |
823 | 838 | } | 920 | } |
824 | 839 | } | 921 | } |
825 | @@ -842,7 +924,7 @@ | |||
826 | 842 | /* In normal mysqld crash recovery we do not try to | 924 | /* In normal mysqld crash recovery we do not try to |
827 | 843 | replay file operations */ | 925 | replay file operations */ |
828 | 844 | #ifdef UNIV_LOG_LSN_DEBUG | 926 | #ifdef UNIV_LOG_LSN_DEBUG |
830 | 845 | @@ -2748,8 +2749,11 @@ | 927 | @@ -2748,8 +2761,11 @@ |
831 | 846 | 928 | ||
832 | 847 | fprintf(stderr, | 929 | fprintf(stderr, |
833 | 848 | "InnoDB: Doing recovery: scanned up to" | 930 | "InnoDB: Doing recovery: scanned up to" |
834 | @@ -856,7 +938,7 @@ | |||
835 | 856 | } | 938 | } |
836 | 857 | } | 939 | } |
837 | 858 | 940 | ||
839 | 859 | @@ -2854,7 +2858,7 @@ | 941 | @@ -2854,7 +2870,7 @@ |
840 | 860 | "InnoDB: Reading tablespace information" | 942 | "InnoDB: Reading tablespace information" |
841 | 861 | " from the .ibd files...\n"); | 943 | " from the .ibd files...\n"); |
842 | 862 | 944 | ||
843 | @@ -865,7 +947,7 @@ | |||
844 | 865 | 947 | ||
845 | 866 | /* If we are using the doublewrite method, we will | 948 | /* If we are using the doublewrite method, we will |
846 | 867 | check if there are half-written pages in data files, | 949 | check if there are half-written pages in data files, |
848 | 868 | @@ -2863,12 +2867,14 @@ | 950 | @@ -2863,12 +2879,14 @@ |
849 | 869 | 951 | ||
850 | 870 | if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) { | 952 | if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) { |
851 | 871 | 953 | ||
852 | @@ -881,7 +963,7 @@ | |||
853 | 881 | } | 963 | } |
854 | 882 | } | 964 | } |
855 | 883 | 965 | ||
857 | 884 | @@ -3018,6 +3024,7 @@ | 966 | @@ -3018,6 +3036,7 @@ |
858 | 885 | recv_sys->recovered_lsn = checkpoint_lsn; | 967 | recv_sys->recovered_lsn = checkpoint_lsn; |
859 | 886 | 968 | ||
860 | 887 | srv_start_lsn = checkpoint_lsn; | 969 | srv_start_lsn = checkpoint_lsn; |
861 | @@ -889,7 +971,7 @@ | |||
862 | 889 | } | 971 | } |
863 | 890 | 972 | ||
864 | 891 | contiguous_lsn = ut_uint64_align_down(recv_sys->scanned_lsn, | 973 | contiguous_lsn = ut_uint64_align_down(recv_sys->scanned_lsn, |
866 | 892 | @@ -3299,6 +3306,7 @@ | 974 | @@ -3299,6 +3318,7 @@ |
867 | 893 | that the data dictionary tables will be free of any locks. | 975 | that the data dictionary tables will be free of any locks. |
868 | 894 | The data dictionary latch should guarantee that there is at | 976 | The data dictionary latch should guarantee that there is at |
869 | 895 | most one data dictionary transaction active at a time. */ | 977 | most one data dictionary transaction active at a time. */ |
870 | @@ -1011,17 +1093,18 @@ | |||
871 | 1011 | secondary index entries for merge sort */ | 1093 | secondary index entries for merge sort */ |
872 | 1012 | --- a/storage/innobase/srv/srv0srv.c | 1094 | --- a/storage/innobase/srv/srv0srv.c |
873 | 1013 | +++ b/storage/innobase/srv/srv0srv.c | 1095 | +++ b/storage/innobase/srv/srv0srv.c |
875 | 1014 | @@ -399,6 +399,9 @@ | 1096 | @@ -399,6 +399,10 @@ |
876 | 1015 | 1097 | ||
877 | 1016 | UNIV_INTERN ulong srv_replication_delay = 0; | 1098 | UNIV_INTERN ulong srv_replication_delay = 0; |
878 | 1017 | 1099 | ||
879 | 1018 | +UNIV_INTERN ibool srv_read_only = FALSE; | 1100 | +UNIV_INTERN ibool srv_read_only = FALSE; |
880 | 1019 | +UNIV_INTERN ibool srv_fake_write = FALSE; | 1101 | +UNIV_INTERN ibool srv_fake_write = FALSE; |
881 | 1020 | +UNIV_INTERN ibool srv_apply_log_only = FALSE; | 1102 | +UNIV_INTERN ibool srv_apply_log_only = FALSE; |
882 | 1103 | +UNIV_INTERN ibool srv_backup_mode = FALSE; | ||
883 | 1021 | /*-------------------------------------------*/ | 1104 | /*-------------------------------------------*/ |
884 | 1022 | UNIV_INTERN ulong srv_n_spin_wait_rounds = 30; | 1105 | UNIV_INTERN ulong srv_n_spin_wait_rounds = 30; |
885 | 1023 | UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500; | 1106 | UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500; |
887 | 1024 | @@ -1078,7 +1081,7 @@ | 1107 | @@ -1078,7 +1082,7 @@ |
888 | 1025 | } | 1108 | } |
889 | 1026 | 1109 | ||
890 | 1027 | /* Initialize some INFORMATION SCHEMA internal structures */ | 1110 | /* Initialize some INFORMATION SCHEMA internal structures */ |
891 | @@ -1030,7 +1113,7 @@ | |||
892 | 1030 | } | 1113 | } |
893 | 1031 | 1114 | ||
894 | 1032 | /*********************************************************************//** | 1115 | /*********************************************************************//** |
896 | 1033 | @@ -1089,6 +1092,7 @@ | 1116 | @@ -1089,6 +1093,7 @@ |
897 | 1034 | /*==========*/ | 1117 | /*==========*/ |
898 | 1035 | { | 1118 | { |
899 | 1036 | os_fast_mutex_free(&srv_conc_mutex); | 1119 | os_fast_mutex_free(&srv_conc_mutex); |
900 | @@ -1038,7 +1121,7 @@ | |||
901 | 1038 | mem_free(srv_conc_slots); | 1121 | mem_free(srv_conc_slots); |
902 | 1039 | srv_conc_slots = NULL; | 1122 | srv_conc_slots = NULL; |
903 | 1040 | 1123 | ||
905 | 1041 | @@ -1102,6 +1106,7 @@ | 1124 | @@ -1102,6 +1107,7 @@ |
906 | 1042 | srv_mysql_table = NULL; | 1125 | srv_mysql_table = NULL; |
907 | 1043 | 1126 | ||
908 | 1044 | trx_i_s_cache_free(trx_i_s_cache); | 1127 | trx_i_s_cache_free(trx_i_s_cache); |
909 | @@ -1046,7 +1129,7 @@ | |||
910 | 1046 | } | 1129 | } |
911 | 1047 | 1130 | ||
912 | 1048 | /*********************************************************************//** | 1131 | /*********************************************************************//** |
914 | 1049 | @@ -1717,7 +1722,7 @@ | 1132 | @@ -1717,7 +1723,7 @@ |
915 | 1050 | } | 1133 | } |
916 | 1051 | 1134 | ||
917 | 1052 | /* Record the lock wait time for this thread */ | 1135 | /* Record the lock wait time for this thread */ |
918 | @@ -1264,3 +1347,16 @@ | |||
919 | 1264 | 1347 | ||
920 | 1265 | UNIV_MEM_FREE(buf, n); | 1348 | UNIV_MEM_FREE(buf, n); |
921 | 1266 | } | 1349 | } |
922 | 1350 | --- a/configure.cmake | ||
923 | 1351 | +++ b/configure.cmake | ||
924 | 1352 | @@ -149,7 +149,9 @@ | ||
925 | 1353 | SET(CMAKE_REQUIRED_LIBRARIES | ||
926 | 1354 | ${LIBM} ${LIBNSL} ${LIBBIND} ${LIBCRYPT} ${LIBSOCKET} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT} ${LIBRT}) | ||
927 | 1355 | |||
928 | 1356 | - LIST(REMOVE_DUPLICATES CMAKE_REQUIRED_LIBRARIES) | ||
929 | 1357 | + IF(CMAKE_REQUIRED_LIBRARIES) | ||
930 | 1358 | + LIST(REMOVE_DUPLICATES CMAKE_REQUIRED_LIBRARIES) | ||
931 | 1359 | + ENDIF() | ||
932 | 1360 | LINK_LIBRARIES(${CMAKE_THREAD_LIBS_INIT}) | ||
933 | 1361 | |||
934 | 1362 | OPTION(WITH_LIBWRAP "Compile with tcp wrappers support" OFF) | ||
935 | 1267 | 1363 | ||
936 | === modified file 'patches/innodb56.patch' | |||
937 | --- patches/innodb56.patch 2013-05-03 14:12:58 +0000 | |||
938 | +++ patches/innodb56.patch 2013-05-08 05:16:27 +0000 | |||
939 | @@ -336,7 +336,7 @@ | |||
940 | 336 | 336 | ||
941 | 337 | + /* Ignore .isl files on XtraBackup recovery. All tablespaces must be | 337 | + /* Ignore .isl files on XtraBackup recovery. All tablespaces must be |
942 | 338 | + local. */ | 338 | + local. */ |
944 | 339 | + if (!recv_recovery_on) { | 339 | + if (srv_backup_mode) { |
945 | 340 | /* Check for a link file which locates a remote tablespace. */ | 340 | /* Check for a link file which locates a remote tablespace. */ |
946 | 341 | remote.success = fil_open_linked_file( | 341 | remote.success = fil_open_linked_file( |
947 | 342 | tablename, &remote.filepath, &remote.file); | 342 | tablename, &remote.filepath, &remote.file); |
948 | @@ -357,7 +357,60 @@ | |||
949 | 357 | ib_logf(IB_LOG_LEVEL_ERROR, | 357 | ib_logf(IB_LOG_LEVEL_ERROR, |
950 | 358 | "The size of single-table tablespace file %s " | 358 | "The size of single-table tablespace file %s " |
951 | 359 | "is only " UINT64PF ", should be at least %lu!", | 359 | "is only " UINT64PF ", should be at least %lu!", |
953 | 360 | @@ -4263,7 +4390,7 @@ | 360 | @@ -4243,7 +4370,51 @@ |
954 | 361 | } | ||
955 | 362 | |||
956 | 363 | func_exit: | ||
957 | 364 | - os_file_close(fsp->file); | ||
958 | 365 | + /* We reuse file handles on the backup stage in XtraBackup to avoid | ||
959 | 366 | + inconsistencies between the file name and the actual tablespace contents | ||
960 | 367 | + if a DDL occurs between a fil_load_single_table_tablespaces() call and | ||
961 | 368 | + the actual copy operation. */ | ||
962 | 369 | + if (srv_backup_mode) { | ||
963 | 370 | + | ||
964 | 371 | + fil_node_t* node; | ||
965 | 372 | + fil_space_t* space; | ||
966 | 373 | + | ||
967 | 374 | + mutex_enter(&fil_system->mutex); | ||
968 | 375 | + | ||
969 | 376 | + space = fil_space_get_by_id(fsp->id); | ||
970 | 377 | + | ||
971 | 378 | + if (space) { | ||
972 | 379 | + node = UT_LIST_GET_LAST(space->chain); | ||
973 | 380 | + | ||
974 | 381 | + /* The handle will be closed by xtrabackup in | ||
975 | 382 | + xtrabackup_copy_datafile(). We set node->open to TRUE to | ||
976 | 383 | + make sure no one calls fil_node_open_file() | ||
977 | 384 | + (i.e. attempts to reopen the tablespace by name) during | ||
978 | 385 | + the backup stage. */ | ||
979 | 386 | + | ||
980 | 387 | + node->open = TRUE; | ||
981 | 388 | + node->handle = fsp->file; | ||
982 | 389 | + | ||
983 | 390 | + /* The following is copied from fil_node_open_file() to | ||
984 | 391 | + pass fil_system validaty checks. We cannot use | ||
985 | 392 | + fil_node_open_file() directly, as that would re-open the | ||
986 | 393 | + file by name and create another file handle. */ | ||
987 | 394 | + | ||
988 | 395 | + fil_system->n_open++; | ||
989 | 396 | + fil_n_file_opened++; | ||
990 | 397 | + | ||
991 | 398 | + if (fil_space_belongs_in_lru(space)) { | ||
992 | 399 | + | ||
993 | 400 | + /* Put the node to the LRU list */ | ||
994 | 401 | + UT_LIST_ADD_FIRST(LRU, fil_system->LRU, node); | ||
995 | 402 | + } | ||
996 | 403 | + } | ||
997 | 404 | + | ||
998 | 405 | + mutex_exit(&fil_system->mutex); | ||
999 | 406 | + } else { | ||
1000 | 407 | + | ||
1001 | 408 | + os_file_close(fsp->file); | ||
1002 | 409 | + } | ||
1003 | 410 | |||
1004 | 411 | #ifdef UNIV_HOTBACKUP | ||
1005 | 412 | func_exit_after_close: | ||
1006 | 413 | @@ -4263,7 +4434,7 @@ | ||
1007 | 361 | idea is to read as much good data as we can and jump over bad data. | 414 | idea is to read as much good data as we can and jump over bad data. |
1008 | 362 | @return 0 if ok, -1 if error even after the retries, 1 if at the end | 415 | @return 0 if ok, -1 if error even after the retries, 1 if at the end |
1009 | 363 | of the directory */ | 416 | of the directory */ |
1010 | @@ -366,7 +419,7 @@ | |||
1011 | 366 | int | 419 | int |
1012 | 367 | fil_file_readdir_next_file( | 420 | fil_file_readdir_next_file( |
1013 | 368 | /*=======================*/ | 421 | /*=======================*/ |
1015 | 369 | @@ -4303,7 +4430,7 @@ | 422 | @@ -4303,7 +4474,7 @@ |
1016 | 370 | @return DB_SUCCESS or error number */ | 423 | @return DB_SUCCESS or error number */ |
1017 | 371 | UNIV_INTERN | 424 | UNIV_INTERN |
1018 | 372 | dberr_t | 425 | dberr_t |
1019 | @@ -375,7 +428,7 @@ | |||
1020 | 375 | /*===================================*/ | 428 | /*===================================*/ |
1021 | 376 | { | 429 | { |
1022 | 377 | int ret; | 430 | int ret; |
1024 | 378 | @@ -4359,7 +4486,9 @@ | 431 | @@ -4359,7 +4530,9 @@ |
1025 | 379 | "%s/%s", fil_path_to_mysql_datadir, dbinfo.name); | 432 | "%s/%s", fil_path_to_mysql_datadir, dbinfo.name); |
1026 | 380 | srv_normalize_path_for_win(dbpath); | 433 | srv_normalize_path_for_win(dbpath); |
1027 | 381 | 434 | ||
1028 | @@ -386,7 +439,7 @@ | |||
1029 | 386 | 439 | ||
1030 | 387 | if (dbdir != NULL) { | 440 | if (dbdir != NULL) { |
1031 | 388 | 441 | ||
1033 | 389 | @@ -4380,9 +4509,15 @@ | 442 | @@ -4380,9 +4553,15 @@ |
1034 | 390 | && (0 == strcmp(fileinfo.name | 443 | && (0 == strcmp(fileinfo.name |
1035 | 391 | + strlen(fileinfo.name) - 4, | 444 | + strlen(fileinfo.name) - 4, |
1036 | 392 | ".ibd") | 445 | ".ibd") |
1037 | @@ -394,7 +447,7 @@ | |||
1038 | 394 | + /* Ignore .isl files on XtraBackup | 447 | + /* Ignore .isl files on XtraBackup |
1039 | 395 | + recovery, all tablespaces must be | 448 | + recovery, all tablespaces must be |
1040 | 396 | + local. */ | 449 | + local. */ |
1042 | 397 | + || (!recv_recovery_on && | 450 | + || (srv_backup_mode && |
1043 | 398 | + 0 == strcmp(fileinfo.name | 451 | + 0 == strcmp(fileinfo.name |
1044 | 399 | + strlen(fileinfo.name) - 4, | 452 | + strlen(fileinfo.name) - 4, |
1045 | 400 | - ".isl"))) { | 453 | - ".isl"))) { |
1046 | @@ -404,7 +457,7 @@ | |||
1047 | 404 | /* The name ends in .ibd or .isl; | 457 | /* The name ends in .ibd or .isl; |
1048 | 405 | try opening the file */ | 458 | try opening the file */ |
1049 | 406 | fil_load_single_table_tablespace( | 459 | fil_load_single_table_tablespace( |
1051 | 407 | @@ -4538,6 +4673,7 @@ | 460 | @@ -4538,6 +4717,7 @@ |
1052 | 408 | { | 461 | { |
1053 | 409 | fil_space_t* fnamespace; | 462 | fil_space_t* fnamespace; |
1054 | 410 | fil_space_t* space; | 463 | fil_space_t* space; |
1055 | @@ -412,7 +465,7 @@ | |||
1056 | 412 | 465 | ||
1057 | 413 | ut_ad(fil_system); | 466 | ut_ad(fil_system); |
1058 | 414 | 467 | ||
1060 | 415 | @@ -4615,6 +4751,10 @@ | 468 | @@ -4615,6 +4795,10 @@ |
1061 | 416 | if (fnamespace == NULL) { | 469 | if (fnamespace == NULL) { |
1062 | 417 | if (print_error_if_does_not_exist) { | 470 | if (print_error_if_does_not_exist) { |
1063 | 418 | fil_report_missing_tablespace(name, id); | 471 | fil_report_missing_tablespace(name, id); |
1064 | @@ -423,7 +476,7 @@ | |||
1065 | 423 | } | 476 | } |
1066 | 424 | } else { | 477 | } else { |
1067 | 425 | ut_print_timestamp(stderr); | 478 | ut_print_timestamp(stderr); |
1069 | 426 | @@ -4638,6 +4778,10 @@ | 479 | @@ -4638,6 +4822,10 @@ |
1070 | 427 | 480 | ||
1071 | 428 | mutex_exit(&fil_system->mutex); | 481 | mutex_exit(&fil_system->mutex); |
1072 | 429 | 482 | ||
1073 | @@ -434,7 +487,7 @@ | |||
1074 | 434 | return(FALSE); | 487 | return(FALSE); |
1075 | 435 | } | 488 | } |
1076 | 436 | 489 | ||
1078 | 437 | @@ -4728,6 +4872,7 @@ | 490 | @@ -4728,6 +4916,7 @@ |
1079 | 438 | ulint page_size; | 491 | ulint page_size; |
1080 | 439 | ulint pages_added; | 492 | ulint pages_added; |
1081 | 440 | ibool success; | 493 | ibool success; |
1082 | @@ -442,7 +495,7 @@ | |||
1083 | 442 | 495 | ||
1084 | 443 | ut_ad(!srv_read_only_mode); | 496 | ut_ad(!srv_read_only_mode); |
1085 | 444 | 497 | ||
1087 | 445 | @@ -4772,13 +4917,17 @@ | 498 | @@ -4772,13 +4961,17 @@ |
1088 | 446 | goto retry; | 499 | goto retry; |
1089 | 447 | } | 500 | } |
1090 | 448 | 501 | ||
1091 | @@ -461,7 +514,7 @@ | |||
1092 | 461 | start_page_no = space->size; | 514 | start_page_no = space->size; |
1093 | 462 | file_start_page_no = space->size - node->size; | 515 | file_start_page_no = space->size - node->size; |
1094 | 463 | 516 | ||
1096 | 464 | @@ -5024,7 +5173,7 @@ | 517 | @@ -5024,7 +5217,7 @@ |
1097 | 465 | off the LRU list if it is in the LRU list. The caller must hold the fil_sys | 518 | off the LRU list if it is in the LRU list. The caller must hold the fil_sys |
1098 | 466 | mutex. */ | 519 | mutex. */ |
1099 | 467 | static | 520 | static |
1100 | @@ -470,7 +523,7 @@ | |||
1101 | 470 | fil_node_prepare_for_io( | 523 | fil_node_prepare_for_io( |
1102 | 471 | /*====================*/ | 524 | /*====================*/ |
1103 | 472 | fil_node_t* node, /*!< in: file node */ | 525 | fil_node_t* node, /*!< in: file node */ |
1105 | 473 | @@ -5044,9 +5193,12 @@ | 526 | @@ -5044,9 +5237,12 @@ |
1106 | 474 | } | 527 | } |
1107 | 475 | 528 | ||
1108 | 476 | if (node->open == FALSE) { | 529 | if (node->open == FALSE) { |
1109 | @@ -484,7 +537,7 @@ | |||
1110 | 484 | } | 537 | } |
1111 | 485 | 538 | ||
1112 | 486 | if (node->n_pending == 0 && fil_space_belongs_in_lru(space)) { | 539 | if (node->n_pending == 0 && fil_space_belongs_in_lru(space)) { |
1114 | 487 | @@ -5058,6 +5210,8 @@ | 540 | @@ -5058,6 +5254,8 @@ |
1115 | 488 | } | 541 | } |
1116 | 489 | 542 | ||
1117 | 490 | node->n_pending++; | 543 | node->n_pending++; |
1118 | @@ -493,7 +546,7 @@ | |||
1119 | 493 | } | 546 | } |
1120 | 494 | 547 | ||
1121 | 495 | /********************************************************************//** | 548 | /********************************************************************//** |
1123 | 496 | @@ -5259,6 +5413,16 @@ | 549 | @@ -5259,6 +5457,16 @@ |
1124 | 497 | 550 | ||
1125 | 498 | ut_ad(mode != OS_AIO_IBUF || space->purpose == FIL_TABLESPACE); | 551 | ut_ad(mode != OS_AIO_IBUF || space->purpose == FIL_TABLESPACE); |
1126 | 499 | 552 | ||
1127 | @@ -510,7 +563,7 @@ | |||
1128 | 510 | node = UT_LIST_GET_FIRST(space->chain); | 563 | node = UT_LIST_GET_FIRST(space->chain); |
1129 | 511 | 564 | ||
1130 | 512 | for (;;) { | 565 | for (;;) { |
1132 | 513 | @@ -5290,7 +5454,11 @@ | 566 | @@ -5290,7 +5498,11 @@ |
1133 | 514 | } | 567 | } |
1134 | 515 | 568 | ||
1135 | 516 | /* Open file if closed */ | 569 | /* Open file if closed */ |
1136 | @@ -523,7 +576,7 @@ | |||
1137 | 523 | 576 | ||
1138 | 524 | /* Check that at least the start offset is within the bounds of a | 577 | /* Check that at least the start offset is within the bounds of a |
1139 | 525 | single-table tablespace, including rollback tablespaces. */ | 578 | single-table tablespace, including rollback tablespaces. */ |
1141 | 526 | @@ -6164,6 +6332,7 @@ | 579 | @@ -6164,6 +6376,7 @@ |
1142 | 527 | return(err); | 580 | return(err); |
1143 | 528 | } | 581 | } |
1144 | 529 | 582 | ||
1145 | @@ -531,7 +584,7 @@ | |||
1146 | 531 | /****************************************************************//** | 584 | /****************************************************************//** |
1147 | 532 | Generate redo logs for swapping two .ibd files */ | 585 | Generate redo logs for swapping two .ibd files */ |
1148 | 533 | UNIV_INTERN | 586 | UNIV_INTERN |
1150 | 534 | @@ -6187,4 +6356,4 @@ | 587 | @@ -6187,4 +6400,4 @@ |
1151 | 535 | 0, 0, new_name, old_name, &mtr); | 588 | 0, 0, new_name, old_name, &mtr); |
1152 | 536 | mtr_commit(&mtr); | 589 | mtr_commit(&mtr); |
1153 | 537 | } | 590 | } |
1154 | @@ -674,13 +727,15 @@ | |||
1155 | 674 | Returns TRUE if a single-table tablespace does not exist in the memory cache, | 727 | Returns TRUE if a single-table tablespace does not exist in the memory cache, |
1156 | 675 | --- a/storage/innobase/include/srv0srv.h | 728 | --- a/storage/innobase/include/srv0srv.h |
1157 | 676 | +++ b/storage/innobase/include/srv0srv.h | 729 | +++ b/storage/innobase/include/srv0srv.h |
1159 | 677 | @@ -353,6 +353,9 @@ | 730 | @@ -353,6 +353,11 @@ |
1160 | 678 | extern ulong srv_max_purge_lag_delay; | 731 | extern ulong srv_max_purge_lag_delay; |
1161 | 679 | 732 | ||
1162 | 680 | extern ulong srv_replication_delay; | 733 | extern ulong srv_replication_delay; |
1163 | 681 | + | 734 | + |
1164 | 682 | +extern ibool srv_apply_log_only; | 735 | +extern ibool srv_apply_log_only; |
1165 | 683 | + | 736 | + |
1166 | 737 | +extern ibool srv_backup_mode; | ||
1167 | 738 | + | ||
1168 | 684 | /*-------------------------------------------*/ | 739 | /*-------------------------------------------*/ |
1169 | 685 | 740 | ||
1170 | 686 | extern ibool srv_print_innodb_monitor; | 741 | extern ibool srv_print_innodb_monitor; |
1171 | @@ -755,7 +810,26 @@ | |||
1172 | 755 | || (recv_addr->state == RECV_BEING_PROCESSED) | 810 | || (recv_addr->state == RECV_BEING_PROCESSED) |
1173 | 756 | || (recv_addr->state == RECV_PROCESSED)) { | 811 | || (recv_addr->state == RECV_PROCESSED)) { |
1174 | 757 | 812 | ||
1176 | 758 | @@ -2413,7 +2415,7 @@ | 813 | @@ -1868,6 +1870,18 @@ |
1177 | 814 | ulint zip_size = fil_space_get_zip_size(space); | ||
1178 | 815 | ulint page_no = recv_addr->page_no; | ||
1179 | 816 | |||
1180 | 817 | + /* By now we have replayed all DDL log records from the | ||
1181 | 818 | + current batch. Check if the space ID is still valid in | ||
1182 | 819 | + the entry being processed, and ignore it if it is not.*/ | ||
1183 | 820 | + if (fil_tablespace_deleted_or_being_deleted_in_mem(space, -1)) { | ||
1184 | 821 | + | ||
1185 | 822 | + ut_a(recv_sys->n_addrs); | ||
1186 | 823 | + | ||
1187 | 824 | + recv_addr->state = RECV_PROCESSED; | ||
1188 | 825 | + recv_sys->n_addrs--; | ||
1189 | 826 | + | ||
1190 | 827 | + continue; | ||
1191 | 828 | + } | ||
1192 | 829 | if (recv_addr->state == RECV_NOT_PROCESSED) { | ||
1193 | 830 | if (!has_printed) { | ||
1194 | 831 | ib_logf(IB_LOG_LEVEL_INFO, | ||
1195 | 832 | @@ -2413,7 +2427,7 @@ | ||
1196 | 759 | || type == MLOG_FILE_RENAME | 833 | || type == MLOG_FILE_RENAME |
1197 | 760 | || type == MLOG_FILE_DELETE) { | 834 | || type == MLOG_FILE_DELETE) { |
1198 | 761 | ut_a(space); | 835 | ut_a(space); |
1199 | @@ -764,7 +838,7 @@ | |||
1200 | 764 | if (recv_replay_file_ops) { | 838 | if (recv_replay_file_ops) { |
1201 | 765 | 839 | ||
1202 | 766 | /* In ibbackup --apply-log, replay an .ibd file | 840 | /* In ibbackup --apply-log, replay an .ibd file |
1204 | 767 | @@ -2436,7 +2438,7 @@ | 841 | @@ -2436,7 +2450,7 @@ |
1205 | 768 | ut_error; | 842 | ut_error; |
1206 | 769 | } | 843 | } |
1207 | 770 | } | 844 | } |
1208 | @@ -773,7 +847,7 @@ | |||
1209 | 773 | /* In normal mysqld crash recovery we do not try to | 847 | /* In normal mysqld crash recovery we do not try to |
1210 | 774 | replay file operations */ | 848 | replay file operations */ |
1211 | 775 | #ifdef UNIV_LOG_LSN_DEBUG | 849 | #ifdef UNIV_LOG_LSN_DEBUG |
1213 | 776 | @@ -2863,8 +2865,14 @@ | 850 | @@ -2863,8 +2877,14 @@ |
1214 | 777 | 851 | ||
1215 | 778 | fprintf(stderr, | 852 | fprintf(stderr, |
1216 | 779 | "InnoDB: Doing recovery: scanned up to" | 853 | "InnoDB: Doing recovery: scanned up to" |
1217 | @@ -790,7 +864,7 @@ | |||
1218 | 790 | } | 864 | } |
1219 | 791 | } | 865 | } |
1220 | 792 | 866 | ||
1222 | 793 | @@ -2964,7 +2972,7 @@ | 867 | @@ -2964,7 +2984,7 @@ |
1223 | 794 | ib_logf(IB_LOG_LEVEL_INFO, | 868 | ib_logf(IB_LOG_LEVEL_INFO, |
1224 | 795 | "Reading tablespace information from the .ibd files..."); | 869 | "Reading tablespace information from the .ibd files..."); |
1225 | 796 | 870 | ||
1226 | @@ -799,7 +873,7 @@ | |||
1227 | 799 | 873 | ||
1228 | 800 | /* If we are using the doublewrite method, we will | 874 | /* If we are using the doublewrite method, we will |
1229 | 801 | check if there are half-written pages in data files, | 875 | check if there are half-written pages in data files, |
1231 | 802 | @@ -3456,7 +3464,8 @@ | 876 | @@ -3456,7 +3476,8 @@ |
1232 | 803 | that the data dictionary tables will be free of any locks. | 877 | that the data dictionary tables will be free of any locks. |
1233 | 804 | The data dictionary latch should guarantee that there is at | 878 | The data dictionary latch should guarantee that there is at |
1234 | 805 | most one data dictionary transaction active at a time. */ | 879 | most one data dictionary transaction active at a time. */ |
1235 | @@ -836,16 +910,18 @@ | |||
1236 | 836 | tested with following crash point */ | 910 | tested with following crash point */ |
1237 | 837 | --- a/storage/innobase/srv/srv0srv.cc | 911 | --- a/storage/innobase/srv/srv0srv.cc |
1238 | 838 | +++ b/storage/innobase/srv/srv0srv.cc | 912 | +++ b/storage/innobase/srv/srv0srv.cc |
1240 | 839 | @@ -349,6 +349,8 @@ | 913 | @@ -349,6 +349,10 @@ |
1241 | 840 | 914 | ||
1242 | 841 | UNIV_INTERN ulong srv_replication_delay = 0; | 915 | UNIV_INTERN ulong srv_replication_delay = 0; |
1243 | 842 | 916 | ||
1244 | 843 | +UNIV_INTERN ibool srv_apply_log_only = FALSE; | 917 | +UNIV_INTERN ibool srv_apply_log_only = FALSE; |
1245 | 844 | + | 918 | + |
1246 | 919 | +UNIV_INTERN ibool srv_backup_mode = FALSE; | ||
1247 | 920 | + | ||
1248 | 845 | /*-------------------------------------------*/ | 921 | /*-------------------------------------------*/ |
1249 | 846 | UNIV_INTERN ulong srv_n_spin_wait_rounds = 30; | 922 | UNIV_INTERN ulong srv_n_spin_wait_rounds = 30; |
1250 | 847 | UNIV_INTERN ulong srv_spin_wait_delay = 6; | 923 | UNIV_INTERN ulong srv_spin_wait_delay = 6; |
1252 | 848 | @@ -1808,7 +1810,8 @@ | 924 | @@ -1808,7 +1812,8 @@ |
1253 | 849 | if (ret == SRV_NONE | 925 | if (ret == SRV_NONE |
1254 | 850 | && srv_shutdown_state != SRV_SHUTDOWN_NONE | 926 | && srv_shutdown_state != SRV_SHUTDOWN_NONE |
1255 | 851 | && trx_purge_state() != PURGE_STATE_DISABLED | 927 | && trx_purge_state() != PURGE_STATE_DISABLED |
1256 | 852 | 928 | ||
1257 | === modified file 'patches/xtradb51.patch' | |||
1258 | --- patches/xtradb51.patch 2013-04-16 14:29:50 +0000 | |||
1259 | +++ patches/xtradb51.patch 2013-05-08 05:16:27 +0000 | |||
1260 | @@ -326,7 +326,60 @@ | |||
1261 | 326 | if (size < FIL_IBD_FILE_INITIAL_SIZE * (lint)UNIV_PAGE_SIZE) { | 326 | if (size < FIL_IBD_FILE_INITIAL_SIZE * (lint)UNIV_PAGE_SIZE) { |
1262 | 327 | fprintf(stderr, | 327 | fprintf(stderr, |
1263 | 328 | "InnoDB: Error: the size of single-table tablespace" | 328 | "InnoDB: Error: the size of single-table tablespace" |
1265 | 329 | @@ -4247,7 +4349,7 @@ | 329 | @@ -4236,7 +4338,51 @@ |
1266 | 330 | |||
1267 | 331 | fil_node_create(filepath, 0, space_id, FALSE); | ||
1268 | 332 | func_exit: | ||
1269 | 333 | - os_file_close(file); | ||
1270 | 334 | + /* We reuse file handles on the backup stage in XtraBackup to avoid | ||
1271 | 335 | + inconsistencies between the file name and the actual tablespace contents | ||
1272 | 336 | + if a DDL occurs between a fil_load_single_table_tablespaces() call and | ||
1273 | 337 | + the actual copy operation. */ | ||
1274 | 338 | + if (srv_backup_mode) { | ||
1275 | 339 | + | ||
1276 | 340 | + fil_node_t* node; | ||
1277 | 341 | + fil_space_t* space; | ||
1278 | 342 | + | ||
1279 | 343 | + mutex_enter(&fil_system->mutex); | ||
1280 | 344 | + | ||
1281 | 345 | + space = fil_space_get_by_id(space_id); | ||
1282 | 346 | + | ||
1283 | 347 | + if (space) { | ||
1284 | 348 | + node = UT_LIST_GET_LAST(space->chain); | ||
1285 | 349 | + | ||
1286 | 350 | + /* The handle will be closed by xtrabackup in | ||
1287 | 351 | + xtrabackup_copy_datafile(). We set node->open to TRUE to | ||
1288 | 352 | + make sure no one calls fil_node_open_file() | ||
1289 | 353 | + (i.e. attempts to reopen the tablespace by name) during | ||
1290 | 354 | + the backup stage. */ | ||
1291 | 355 | + | ||
1292 | 356 | + node->open = TRUE; | ||
1293 | 357 | + node->handle = file; | ||
1294 | 358 | + | ||
1295 | 359 | + /* The following is copied from fil_node_open_file() to | ||
1296 | 360 | + pass fil_system validity checks. We cannot use | ||
1297 | 361 | + fil_node_open_file() directly, as that would re-open the | ||
1298 | 362 | + file by name and create another file handle. */ | ||
1299 | 363 | + | ||
1300 | 364 | + fil_system->n_open++; | ||
1301 | 365 | + | ||
1302 | 366 | + if (space->purpose == FIL_TABLESPACE && | ||
1303 | 367 | + space->id != 0) { | ||
1304 | 368 | + | ||
1305 | 369 | + /* Put the node to the LRU list */ | ||
1306 | 370 | + UT_LIST_ADD_FIRST(LRU, fil_system->LRU, node); | ||
1307 | 371 | + } | ||
1308 | 372 | + } | ||
1309 | 373 | + | ||
1310 | 374 | + mutex_exit(&fil_system->mutex); | ||
1311 | 375 | + } else { | ||
1312 | 376 | + | ||
1313 | 377 | + os_file_close(file); | ||
1314 | 378 | + } | ||
1315 | 379 | ut_free(buf2); | ||
1316 | 380 | mem_free(filepath); | ||
1317 | 381 | } | ||
1318 | 382 | @@ -4247,7 +4393,7 @@ | ||
1319 | 330 | idea is to read as much good data as we can and jump over bad data. | 383 | idea is to read as much good data as we can and jump over bad data. |
1320 | 331 | @return 0 if ok, -1 if error even after the retries, 1 if at the end | 384 | @return 0 if ok, -1 if error even after the retries, 1 if at the end |
1321 | 332 | of the directory */ | 385 | of the directory */ |
1322 | @@ -335,7 +388,7 @@ | |||
1323 | 335 | int | 388 | int |
1324 | 336 | fil_file_readdir_next_file( | 389 | fil_file_readdir_next_file( |
1325 | 337 | /*=======================*/ | 390 | /*=======================*/ |
1327 | 338 | @@ -4291,7 +4393,7 @@ | 391 | @@ -4291,7 +4437,7 @@ |
1328 | 339 | @return DB_SUCCESS or error number */ | 392 | @return DB_SUCCESS or error number */ |
1329 | 340 | UNIV_INTERN | 393 | UNIV_INTERN |
1330 | 341 | ulint | 394 | ulint |
1331 | @@ -344,7 +397,7 @@ | |||
1332 | 344 | /*===================================*/ | 397 | /*===================================*/ |
1333 | 345 | { | 398 | { |
1334 | 346 | int ret; | 399 | int ret; |
1336 | 347 | @@ -4347,7 +4449,9 @@ | 400 | @@ -4347,7 +4493,9 @@ |
1337 | 348 | dbinfo.name); | 401 | dbinfo.name); |
1338 | 349 | srv_normalize_path_for_win(dbpath); | 402 | srv_normalize_path_for_win(dbpath); |
1339 | 350 | 403 | ||
1340 | @@ -355,7 +408,7 @@ | |||
1341 | 355 | 408 | ||
1342 | 356 | if (dbdir != NULL) { | 409 | if (dbdir != NULL) { |
1343 | 357 | /* printf("Opened dir %s\n", dbinfo.name); */ | 410 | /* printf("Opened dir %s\n", dbinfo.name); */ |
1345 | 358 | @@ -4373,8 +4477,11 @@ | 411 | @@ -4373,8 +4521,11 @@ |
1346 | 359 | ".ibd")) { | 412 | ".ibd")) { |
1347 | 360 | /* The name ends in .ibd; try opening | 413 | /* The name ends in .ibd; try opening |
1348 | 361 | the file */ | 414 | the file */ |
1349 | @@ -368,7 +421,7 @@ | |||
1350 | 368 | } | 421 | } |
1351 | 369 | next_file_item: | 422 | next_file_item: |
1352 | 370 | ret = fil_file_readdir_next_file(&err, | 423 | ret = fil_file_readdir_next_file(&err, |
1354 | 371 | @@ -4546,15 +4653,97 @@ | 424 | @@ -4546,15 +4697,97 @@ |
1355 | 372 | "InnoDB: in InnoDB data dictionary" | 425 | "InnoDB: in InnoDB data dictionary" |
1356 | 373 | " has tablespace id %lu,\n" | 426 | " has tablespace id %lu,\n" |
1357 | 374 | "InnoDB: but tablespace with that id" | 427 | "InnoDB: but tablespace with that id" |
1358 | @@ -474,7 +527,7 @@ | |||
1359 | 474 | } else { | 527 | } else { |
1360 | 475 | ut_print_timestamp(stderr); | 528 | ut_print_timestamp(stderr); |
1361 | 476 | fputs(" InnoDB: Error: table ", stderr); | 529 | fputs(" InnoDB: Error: table ", stderr); |
1363 | 477 | @@ -4953,7 +5142,7 @@ | 530 | @@ -4953,7 +5186,7 @@ |
1364 | 478 | off the LRU list if it is in the LRU list. The caller must hold the fil_sys | 531 | off the LRU list if it is in the LRU list. The caller must hold the fil_sys |
1365 | 479 | mutex. */ | 532 | mutex. */ |
1366 | 480 | static | 533 | static |
1367 | @@ -483,7 +536,7 @@ | |||
1368 | 483 | fil_node_prepare_for_io( | 536 | fil_node_prepare_for_io( |
1369 | 484 | /*====================*/ | 537 | /*====================*/ |
1370 | 485 | fil_node_t* node, /*!< in: file node */ | 538 | fil_node_t* node, /*!< in: file node */ |
1372 | 486 | @@ -4973,10 +5162,13 @@ | 539 | @@ -4973,10 +5206,13 @@ |
1373 | 487 | } | 540 | } |
1374 | 488 | 541 | ||
1375 | 489 | if (node->open == FALSE) { | 542 | if (node->open == FALSE) { |
1376 | @@ -498,7 +551,7 @@ | |||
1377 | 498 | } | 551 | } |
1378 | 499 | 552 | ||
1379 | 500 | if (node->n_pending == 0 && space->purpose == FIL_TABLESPACE | 553 | if (node->n_pending == 0 && space->purpose == FIL_TABLESPACE |
1381 | 501 | @@ -4989,6 +5181,8 @@ | 554 | @@ -4989,6 +5225,8 @@ |
1382 | 502 | } | 555 | } |
1383 | 503 | 556 | ||
1384 | 504 | node->n_pending++; | 557 | node->n_pending++; |
1385 | @@ -507,7 +560,7 @@ | |||
1386 | 507 | } | 560 | } |
1387 | 508 | 561 | ||
1388 | 509 | /********************************************************************//** | 562 | /********************************************************************//** |
1390 | 510 | @@ -5125,7 +5319,9 @@ | 563 | @@ -5125,7 +5363,9 @@ |
1391 | 511 | ut_ad(recv_no_ibuf_operations || (type == OS_FILE_WRITE) | 564 | ut_ad(recv_no_ibuf_operations || (type == OS_FILE_WRITE) |
1392 | 512 | || !ibuf_bitmap_page(zip_size, block_offset) | 565 | || !ibuf_bitmap_page(zip_size, block_offset) |
1393 | 513 | || sync || is_log); | 566 | || sync || is_log); |
1394 | @@ -518,7 +571,7 @@ | |||
1395 | 518 | || ibuf_page(space_id, zip_size, block_offset, NULL)); | 571 | || ibuf_page(space_id, zip_size, block_offset, NULL)); |
1396 | 519 | # endif /* UNIV_LOG_DEBUG */ | 572 | # endif /* UNIV_LOG_DEBUG */ |
1397 | 520 | if (sync) { | 573 | if (sync) { |
1399 | 521 | @@ -5190,6 +5386,16 @@ | 574 | @@ -5190,6 +5430,16 @@ |
1400 | 522 | 575 | ||
1401 | 523 | ut_ad((mode != OS_AIO_IBUF) || (space->purpose == FIL_TABLESPACE)); | 576 | ut_ad((mode != OS_AIO_IBUF) || (space->purpose == FIL_TABLESPACE)); |
1402 | 524 | 577 | ||
1403 | @@ -650,13 +703,14 @@ | |||
1404 | 650 | return(buf); | 703 | return(buf); |
1405 | 651 | --- a/storage/innodb_plugin/include/srv0srv.h | 704 | --- a/storage/innodb_plugin/include/srv0srv.h |
1406 | 652 | +++ b/storage/innodb_plugin/include/srv0srv.h | 705 | +++ b/storage/innodb_plugin/include/srv0srv.h |
1408 | 653 | @@ -226,6 +226,10 @@ | 706 | @@ -226,6 +226,11 @@ |
1409 | 654 | 707 | ||
1410 | 655 | extern ulong srv_replication_delay; | 708 | extern ulong srv_replication_delay; |
1411 | 656 | 709 | ||
1412 | 657 | +extern ibool srv_read_only; | 710 | +extern ibool srv_read_only; |
1413 | 658 | +extern ibool srv_fake_write; | 711 | +extern ibool srv_fake_write; |
1414 | 659 | +extern ibool srv_apply_log_only; | 712 | +extern ibool srv_apply_log_only; |
1415 | 713 | +extern ibool srv_backup_mode; | ||
1416 | 660 | + | 714 | + |
1417 | 661 | extern long long srv_ibuf_max_size; | 715 | extern long long srv_ibuf_max_size; |
1418 | 662 | extern ulint srv_ibuf_active_contract; | 716 | extern ulint srv_ibuf_active_contract; |
1419 | @@ -826,7 +880,35 @@ | |||
1420 | 826 | ibool | 880 | ibool |
1421 | 827 | log_block_checksum_is_ok_or_old_format( | 881 | log_block_checksum_is_ok_or_old_format( |
1422 | 828 | /*===================================*/ | 882 | /*===================================*/ |
1424 | 829 | @@ -2369,7 +2369,7 @@ | 883 | @@ -1830,6 +1830,18 @@ |
1425 | 884 | ulint zip_size = fil_space_get_zip_size(space); | ||
1426 | 885 | ulint page_no = recv_addr->page_no; | ||
1427 | 886 | |||
1428 | 887 | + /* By now we have replayed all DDL log records from the | ||
1429 | 888 | + current batch. Check if the space ID is still valid in | ||
1430 | 889 | + the entry being processed, and ignore it if it is not.*/ | ||
1431 | 890 | + if (fil_tablespace_deleted_or_being_deleted_in_mem(space, -1)) { | ||
1432 | 891 | + | ||
1433 | 892 | + ut_a(recv_sys->n_addrs); | ||
1434 | 893 | + | ||
1435 | 894 | + recv_addr->state = RECV_PROCESSED; | ||
1436 | 895 | + recv_sys->n_addrs--; | ||
1437 | 896 | + | ||
1438 | 897 | + goto next; | ||
1439 | 898 | + } | ||
1440 | 899 | if (recv_addr->state == RECV_NOT_PROCESSED) { | ||
1441 | 900 | if (!has_printed) { | ||
1442 | 901 | ut_print_timestamp(stderr); | ||
1443 | 902 | @@ -1863,7 +1875,7 @@ | ||
1444 | 903 | |||
1445 | 904 | mutex_enter(&(recv_sys->mutex)); | ||
1446 | 905 | } | ||
1447 | 906 | - | ||
1448 | 907 | +next: | ||
1449 | 908 | recv_addr = HASH_GET_NEXT(addr_hash, recv_addr); | ||
1450 | 909 | } | ||
1451 | 910 | |||
1452 | 911 | @@ -2369,7 +2381,7 @@ | ||
1453 | 830 | || type == MLOG_FILE_RENAME | 912 | || type == MLOG_FILE_RENAME |
1454 | 831 | || type == MLOG_FILE_DELETE) { | 913 | || type == MLOG_FILE_DELETE) { |
1455 | 832 | ut_a(space); | 914 | ut_a(space); |
1456 | @@ -835,7 +917,7 @@ | |||
1457 | 835 | if (recv_replay_file_ops) { | 917 | if (recv_replay_file_ops) { |
1458 | 836 | 918 | ||
1459 | 837 | /* In ibbackup --apply-log, replay an .ibd file | 919 | /* In ibbackup --apply-log, replay an .ibd file |
1461 | 838 | @@ -2392,7 +2392,7 @@ | 920 | @@ -2392,7 +2404,7 @@ |
1462 | 839 | ut_error; | 921 | ut_error; |
1463 | 840 | } | 922 | } |
1464 | 841 | } | 923 | } |
1465 | @@ -844,7 +926,7 @@ | |||
1466 | 844 | /* In normal mysqld crash recovery we do not try to | 926 | /* In normal mysqld crash recovery we do not try to |
1467 | 845 | replay file operations */ | 927 | replay file operations */ |
1468 | 846 | #ifdef UNIV_LOG_LSN_DEBUG | 928 | #ifdef UNIV_LOG_LSN_DEBUG |
1470 | 847 | @@ -2809,8 +2809,11 @@ | 929 | @@ -2809,8 +2821,11 @@ |
1471 | 848 | 930 | ||
1472 | 849 | fprintf(stderr, | 931 | fprintf(stderr, |
1473 | 850 | "InnoDB: Doing recovery: scanned up to" | 932 | "InnoDB: Doing recovery: scanned up to" |
1474 | @@ -858,7 +940,7 @@ | |||
1475 | 858 | } | 940 | } |
1476 | 859 | } | 941 | } |
1477 | 860 | 942 | ||
1479 | 861 | @@ -2913,7 +2916,7 @@ | 943 | @@ -2913,7 +2928,7 @@ |
1480 | 862 | "InnoDB: Reading tablespace information" | 944 | "InnoDB: Reading tablespace information" |
1481 | 863 | " from the .ibd files...\n"); | 945 | " from the .ibd files...\n"); |
1482 | 864 | 946 | ||
1483 | @@ -867,7 +949,7 @@ | |||
1484 | 867 | 949 | ||
1485 | 868 | /* If we are using the doublewrite method, we will | 950 | /* If we are using the doublewrite method, we will |
1486 | 869 | check if there are half-written pages in data files, | 951 | check if there are half-written pages in data files, |
1488 | 870 | @@ -2922,12 +2925,14 @@ | 952 | @@ -2922,12 +2937,14 @@ |
1489 | 871 | 953 | ||
1490 | 872 | if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) { | 954 | if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) { |
1491 | 873 | 955 | ||
1492 | @@ -883,7 +965,7 @@ | |||
1493 | 883 | } | 965 | } |
1494 | 884 | } | 966 | } |
1495 | 885 | 967 | ||
1497 | 886 | @@ -3095,6 +3100,7 @@ | 968 | @@ -3095,6 +3112,7 @@ |
1498 | 887 | recv_sys->recovered_lsn = checkpoint_lsn; | 969 | recv_sys->recovered_lsn = checkpoint_lsn; |
1499 | 888 | 970 | ||
1500 | 889 | srv_start_lsn = checkpoint_lsn; | 971 | srv_start_lsn = checkpoint_lsn; |
1501 | @@ -891,7 +973,7 @@ | |||
1502 | 891 | } | 973 | } |
1503 | 892 | 974 | ||
1504 | 893 | contiguous_lsn = ut_uint64_align_down(recv_sys->scanned_lsn, | 975 | contiguous_lsn = ut_uint64_align_down(recv_sys->scanned_lsn, |
1506 | 894 | @@ -3453,6 +3459,7 @@ | 976 | @@ -3453,6 +3471,7 @@ |
1507 | 895 | that the data dictionary tables will be free of any locks. | 977 | that the data dictionary tables will be free of any locks. |
1508 | 896 | The data dictionary latch should guarantee that there is at | 978 | The data dictionary latch should guarantee that there is at |
1509 | 897 | most one data dictionary transaction active at a time. */ | 979 | most one data dictionary transaction active at a time. */ |
1510 | @@ -1026,18 +1108,19 @@ | |||
1511 | 1026 | /* prototypes for new functions added to ha_innodb.cc */ | 1108 | /* prototypes for new functions added to ha_innodb.cc */ |
1512 | 1027 | ibool innobase_get_slow_log(); | 1109 | ibool innobase_get_slow_log(); |
1513 | 1028 | 1110 | ||
1515 | 1029 | @@ -415,6 +410,10 @@ | 1111 | @@ -415,6 +410,11 @@ |
1516 | 1030 | 1112 | ||
1517 | 1031 | UNIV_INTERN ulong srv_replication_delay = 0; | 1113 | UNIV_INTERN ulong srv_replication_delay = 0; |
1518 | 1032 | 1114 | ||
1519 | 1033 | +UNIV_INTERN ibool srv_read_only = FALSE; | 1115 | +UNIV_INTERN ibool srv_read_only = FALSE; |
1520 | 1034 | +UNIV_INTERN ibool srv_fake_write = FALSE; | 1116 | +UNIV_INTERN ibool srv_fake_write = FALSE; |
1521 | 1035 | +UNIV_INTERN ibool srv_apply_log_only = FALSE; | 1117 | +UNIV_INTERN ibool srv_apply_log_only = FALSE; |
1522 | 1118 | +UNIV_INTERN ibool srv_backup_mode = FALSE; | ||
1523 | 1036 | + | 1119 | + |
1524 | 1037 | UNIV_INTERN long long srv_ibuf_max_size = 0; | 1120 | UNIV_INTERN long long srv_ibuf_max_size = 0; |
1525 | 1038 | UNIV_INTERN ulint srv_ibuf_active_contract = 0; /* 0:disable 1:enable */ | 1121 | UNIV_INTERN ulint srv_ibuf_active_contract = 0; /* 0:disable 1:enable */ |
1526 | 1039 | UNIV_INTERN ulint srv_ibuf_accel_rate = 100; | 1122 | UNIV_INTERN ulint srv_ibuf_accel_rate = 100; |
1528 | 1040 | @@ -1065,7 +1064,7 @@ | 1123 | @@ -1065,7 +1065,7 @@ |
1529 | 1041 | } | 1124 | } |
1530 | 1042 | 1125 | ||
1531 | 1043 | /* Initialize some INFORMATION SCHEMA internal structures */ | 1126 | /* Initialize some INFORMATION SCHEMA internal structures */ |
1532 | @@ -1046,7 +1129,7 @@ | |||
1533 | 1046 | } | 1129 | } |
1534 | 1047 | 1130 | ||
1535 | 1048 | /*********************************************************************//** | 1131 | /*********************************************************************//** |
1537 | 1049 | @@ -1076,6 +1075,7 @@ | 1132 | @@ -1076,6 +1076,7 @@ |
1538 | 1050 | /*==========*/ | 1133 | /*==========*/ |
1539 | 1051 | { | 1134 | { |
1540 | 1052 | os_fast_mutex_free(&srv_conc_mutex); | 1135 | os_fast_mutex_free(&srv_conc_mutex); |
1541 | @@ -1054,7 +1137,7 @@ | |||
1542 | 1054 | mem_free(srv_conc_slots); | 1137 | mem_free(srv_conc_slots); |
1543 | 1055 | srv_conc_slots = NULL; | 1138 | srv_conc_slots = NULL; |
1544 | 1056 | 1139 | ||
1546 | 1057 | @@ -1089,6 +1089,7 @@ | 1140 | @@ -1089,6 +1090,7 @@ |
1547 | 1058 | srv_mysql_table = NULL; | 1141 | srv_mysql_table = NULL; |
1548 | 1059 | 1142 | ||
1549 | 1060 | trx_i_s_cache_free(trx_i_s_cache); | 1143 | trx_i_s_cache_free(trx_i_s_cache); |
1550 | @@ -1062,7 +1145,7 @@ | |||
1551 | 1062 | } | 1145 | } |
1552 | 1063 | 1146 | ||
1553 | 1064 | /*********************************************************************//** | 1147 | /*********************************************************************//** |
1555 | 1065 | @@ -2570,36 +2571,6 @@ | 1148 | @@ -2570,36 +2572,6 @@ |
1556 | 1066 | old_sema = sema; | 1149 | old_sema = sema; |
1557 | 1067 | } | 1150 | } |
1558 | 1068 | 1151 | ||
1559 | @@ -1143,7 +1226,6 @@ | |||
1560 | 1143 | 1226 | ||
1561 | 1144 | if (srv_auto_extend_last_data_file | 1227 | if (srv_auto_extend_last_data_file |
1562 | 1145 | && sum_of_data_file_sizes < tablespace_size_in_header) { | 1228 | && sum_of_data_file_sizes < tablespace_size_in_header) { |
1563 | 1146 | - | ||
1564 | 1147 | + /* extend table space size aligning with header */ | 1229 | + /* extend table space size aligning with header */ |
1565 | 1148 | + ulint actual_size; | 1230 | + ulint actual_size; |
1566 | 1149 | + fil_extend_space_to_desired_size(&actual_size, 0, tablespace_size_in_header); | 1231 | + fil_extend_space_to_desired_size(&actual_size, 0, tablespace_size_in_header); |
1567 | @@ -1154,7 +1236,7 @@ | |||
1568 | 1154 | + (ulong) actual_size, | 1236 | + (ulong) actual_size, |
1569 | 1155 | + (ulong) tablespace_size_in_header); | 1237 | + (ulong) tablespace_size_in_header); |
1570 | 1156 | + } | 1238 | + } |
1572 | 1157 | + | 1239 | |
1573 | 1158 | +#ifdef UNDEFINED | 1240 | +#ifdef UNDEFINED |
1574 | 1159 | fprintf(stderr, | 1241 | fprintf(stderr, |
1575 | 1160 | "InnoDB: Error: tablespace size stored in header" | 1242 | "InnoDB: Error: tablespace size stored in header" |
1576 | @@ -1431,3 +1513,14 @@ | |||
1577 | 1431 | 1513 | ||
1578 | 1432 | UNIV_MEM_FREE(buf, n); | 1514 | UNIV_MEM_FREE(buf, n); |
1579 | 1433 | } | 1515 | } |
1580 | 1516 | --- a/configure.in | ||
1581 | 1517 | +++ b/configure.in | ||
1582 | 1518 | @@ -22,7 +22,7 @@ | ||
1583 | 1519 | AM_INIT_AUTOMAKE([1.9 tar-ustar]) | ||
1584 | 1520 | AC_PROG_LIBTOOL | ||
1585 | 1521 | |||
1586 | 1522 | -AM_CONFIG_HEADER([include/config.h]) | ||
1587 | 1523 | +AC_CONFIG_HEADERS([include/config.h]) | ||
1588 | 1524 | |||
1589 | 1525 | # Request support for automake silent-rules if available. | ||
1590 | 1526 | # Default to verbose output. One can use the configure-time | ||
1591 | 1434 | 1527 | ||
1592 | === modified file 'patches/xtradb55.patch' | |||
1593 | --- patches/xtradb55.patch 2013-04-16 14:29:50 +0000 | |||
1594 | +++ patches/xtradb55.patch 2013-05-08 05:16:27 +0000 | |||
1595 | @@ -325,7 +325,60 @@ | |||
1596 | 325 | if (size < FIL_IBD_FILE_INITIAL_SIZE * (lint)UNIV_PAGE_SIZE) { | 325 | if (size < FIL_IBD_FILE_INITIAL_SIZE * (lint)UNIV_PAGE_SIZE) { |
1597 | 326 | fprintf(stderr, | 326 | fprintf(stderr, |
1598 | 327 | "InnoDB: Error: the size of single-table tablespace" | 327 | "InnoDB: Error: the size of single-table tablespace" |
1600 | 328 | @@ -4299,7 +4402,7 @@ | 328 | @@ -4288,7 +4391,51 @@ |
1601 | 329 | |||
1602 | 330 | fil_node_create(filepath, 0, space_id, FALSE); | ||
1603 | 331 | func_exit: | ||
1604 | 332 | - os_file_close(file); | ||
1605 | 333 | + /* We reuse file handles on the backup stage in XtraBackup to avoid | ||
1606 | 334 | + inconsistencies between the file name and the actual tablespace contents | ||
1607 | 335 | + if a DDL occurs between a fil_load_single_table_tablespaces() call and | ||
1608 | 336 | + the actual copy operation. */ | ||
1609 | 337 | + if (srv_backup_mode) { | ||
1610 | 338 | + | ||
1611 | 339 | + fil_node_t* node; | ||
1612 | 340 | + fil_space_t* space; | ||
1613 | 341 | + | ||
1614 | 342 | + mutex_enter(&fil_system->mutex); | ||
1615 | 343 | + | ||
1616 | 344 | + space = fil_space_get_by_id(space_id); | ||
1617 | 345 | + | ||
1618 | 346 | + if (space) { | ||
1619 | 347 | + node = UT_LIST_GET_LAST(space->chain); | ||
1620 | 348 | + | ||
1621 | 349 | + /* The handle will be closed by xtrabackup in | ||
1622 | 350 | + xtrabackup_copy_datafile(). We set node->open to TRUE to | ||
1623 | 351 | + make sure no one calls fil_node_open_file() | ||
1624 | 352 | + (i.e. attempts to reopen the tablespace by name) during | ||
1625 | 353 | + the backup stage. */ | ||
1626 | 354 | + | ||
1627 | 355 | + node->open = TRUE; | ||
1628 | 356 | + node->handle = file; | ||
1629 | 357 | + | ||
1630 | 358 | + /* The following is copied from fil_node_open_file() to | ||
1631 | 359 | + pass fil_system validity checks. We cannot use | ||
1632 | 360 | + fil_node_open_file() directly, as that would re-open the | ||
1633 | 361 | + file by name and create another file handle. */ | ||
1634 | 362 | + | ||
1635 | 363 | + fil_system->n_open++; | ||
1636 | 364 | + | ||
1637 | 365 | + if (space->purpose == FIL_TABLESPACE && | ||
1638 | 366 | + space->id != 0) { | ||
1639 | 367 | + | ||
1640 | 368 | + /* Put the node to the LRU list */ | ||
1641 | 369 | + UT_LIST_ADD_FIRST(LRU, fil_system->LRU, node); | ||
1642 | 370 | + } | ||
1643 | 371 | + } | ||
1644 | 372 | + | ||
1645 | 373 | + mutex_exit(&fil_system->mutex); | ||
1646 | 374 | + } else { | ||
1647 | 375 | + | ||
1648 | 376 | + os_file_close(file); | ||
1649 | 377 | + } | ||
1650 | 378 | ut_free(buf2); | ||
1651 | 379 | mem_free(filepath); | ||
1652 | 380 | } | ||
1653 | 381 | @@ -4299,7 +4446,7 @@ | ||
1654 | 329 | idea is to read as much good data as we can and jump over bad data. | 382 | idea is to read as much good data as we can and jump over bad data. |
1655 | 330 | @return 0 if ok, -1 if error even after the retries, 1 if at the end | 383 | @return 0 if ok, -1 if error even after the retries, 1 if at the end |
1656 | 331 | of the directory */ | 384 | of the directory */ |
1657 | @@ -334,7 +387,7 @@ | |||
1658 | 334 | int | 387 | int |
1659 | 335 | fil_file_readdir_next_file( | 388 | fil_file_readdir_next_file( |
1660 | 336 | /*=======================*/ | 389 | /*=======================*/ |
1662 | 337 | @@ -4343,7 +4446,7 @@ | 390 | @@ -4343,7 +4490,7 @@ |
1663 | 338 | @return DB_SUCCESS or error number */ | 391 | @return DB_SUCCESS or error number */ |
1664 | 339 | UNIV_INTERN | 392 | UNIV_INTERN |
1665 | 340 | ulint | 393 | ulint |
1666 | @@ -343,7 +396,7 @@ | |||
1667 | 343 | /*===================================*/ | 396 | /*===================================*/ |
1668 | 344 | { | 397 | { |
1669 | 345 | int ret; | 398 | int ret; |
1671 | 346 | @@ -4399,7 +4502,9 @@ | 399 | @@ -4399,7 +4546,9 @@ |
1672 | 347 | dbinfo.name); | 400 | dbinfo.name); |
1673 | 348 | srv_normalize_path_for_win(dbpath); | 401 | srv_normalize_path_for_win(dbpath); |
1674 | 349 | 402 | ||
1675 | @@ -354,7 +407,7 @@ | |||
1676 | 354 | 407 | ||
1677 | 355 | if (dbdir != NULL) { | 408 | if (dbdir != NULL) { |
1678 | 356 | /* printf("Opened dir %s\n", dbinfo.name); */ | 409 | /* printf("Opened dir %s\n", dbinfo.name); */ |
1680 | 357 | @@ -4425,8 +4530,11 @@ | 410 | @@ -4425,8 +4574,11 @@ |
1681 | 358 | ".ibd")) { | 411 | ".ibd")) { |
1682 | 359 | /* The name ends in .ibd; try opening | 412 | /* The name ends in .ibd; try opening |
1683 | 360 | the file */ | 413 | the file */ |
1684 | @@ -367,7 +420,7 @@ | |||
1685 | 367 | } | 420 | } |
1686 | 368 | next_file_item: | 421 | next_file_item: |
1687 | 369 | ret = fil_file_readdir_next_file(&err, | 422 | ret = fil_file_readdir_next_file(&err, |
1689 | 370 | @@ -4598,15 +4706,97 @@ | 423 | @@ -4598,15 +4750,97 @@ |
1690 | 371 | "InnoDB: in InnoDB data dictionary" | 424 | "InnoDB: in InnoDB data dictionary" |
1691 | 372 | " has tablespace id %lu,\n" | 425 | " has tablespace id %lu,\n" |
1692 | 373 | "InnoDB: but tablespace with that id" | 426 | "InnoDB: but tablespace with that id" |
1693 | @@ -473,7 +526,7 @@ | |||
1694 | 473 | } else { | 526 | } else { |
1695 | 474 | ut_print_timestamp(stderr); | 527 | ut_print_timestamp(stderr); |
1696 | 475 | fputs(" InnoDB: Error: table ", stderr); | 528 | fputs(" InnoDB: Error: table ", stderr); |
1698 | 476 | @@ -5005,7 +5195,7 @@ | 529 | @@ -5005,7 +5239,7 @@ |
1699 | 477 | off the LRU list if it is in the LRU list. The caller must hold the fil_sys | 530 | off the LRU list if it is in the LRU list. The caller must hold the fil_sys |
1700 | 478 | mutex. */ | 531 | mutex. */ |
1701 | 479 | static | 532 | static |
1702 | @@ -482,7 +535,7 @@ | |||
1703 | 482 | fil_node_prepare_for_io( | 535 | fil_node_prepare_for_io( |
1704 | 483 | /*====================*/ | 536 | /*====================*/ |
1705 | 484 | fil_node_t* node, /*!< in: file node */ | 537 | fil_node_t* node, /*!< in: file node */ |
1707 | 485 | @@ -5025,10 +5215,13 @@ | 538 | @@ -5025,10 +5259,13 @@ |
1708 | 486 | } | 539 | } |
1709 | 487 | 540 | ||
1710 | 488 | if (node->open == FALSE) { | 541 | if (node->open == FALSE) { |
1711 | @@ -497,7 +550,7 @@ | |||
1712 | 497 | } | 550 | } |
1713 | 498 | 551 | ||
1714 | 499 | if (node->n_pending == 0 && space->purpose == FIL_TABLESPACE | 552 | if (node->n_pending == 0 && space->purpose == FIL_TABLESPACE |
1716 | 500 | @@ -5041,6 +5234,8 @@ | 553 | @@ -5041,6 +5278,8 @@ |
1717 | 501 | } | 554 | } |
1718 | 502 | 555 | ||
1719 | 503 | node->n_pending++; | 556 | node->n_pending++; |
1720 | @@ -506,7 +559,7 @@ | |||
1721 | 506 | } | 559 | } |
1722 | 507 | 560 | ||
1723 | 508 | /********************************************************************//** | 561 | /********************************************************************//** |
1725 | 509 | @@ -5240,6 +5435,16 @@ | 562 | @@ -5240,6 +5479,16 @@ |
1726 | 510 | 563 | ||
1727 | 511 | ut_ad((mode != OS_AIO_IBUF) || (space->purpose == FIL_TABLESPACE)); | 564 | ut_ad((mode != OS_AIO_IBUF) || (space->purpose == FIL_TABLESPACE)); |
1728 | 512 | 565 | ||
1729 | @@ -660,7 +713,7 @@ | |||
1730 | 660 | extern char srv_adaptive_flushing; | 713 | extern char srv_adaptive_flushing; |
1731 | 661 | 714 | ||
1732 | 662 | 715 | ||
1734 | 663 | @@ -247,6 +246,10 @@ | 716 | @@ -247,6 +246,11 @@ |
1735 | 664 | extern ulint srv_dict_size_limit; | 717 | extern ulint srv_dict_size_limit; |
1736 | 665 | 718 | ||
1737 | 666 | extern ulint srv_lazy_drop_table; | 719 | extern ulint srv_lazy_drop_table; |
1738 | @@ -668,6 +721,7 @@ | |||
1739 | 668 | +extern ibool srv_read_only; | 721 | +extern ibool srv_read_only; |
1740 | 669 | +extern ibool srv_fake_write; | 722 | +extern ibool srv_fake_write; |
1741 | 670 | +extern ibool srv_apply_log_only; | 723 | +extern ibool srv_apply_log_only; |
1742 | 724 | +extern ibool srv_backup_mode; | ||
1743 | 671 | /*-------------------------------------------*/ | 725 | /*-------------------------------------------*/ |
1744 | 672 | 726 | ||
1745 | 673 | extern ulint srv_n_rows_inserted; | 727 | extern ulint srv_n_rows_inserted; |
1746 | @@ -790,7 +844,35 @@ | |||
1747 | 790 | ibool | 844 | ibool |
1748 | 791 | log_block_checksum_is_ok_or_old_format( | 845 | log_block_checksum_is_ok_or_old_format( |
1749 | 792 | /*===================================*/ | 846 | /*===================================*/ |
1751 | 793 | @@ -2380,7 +2380,7 @@ | 847 | @@ -1842,6 +1842,18 @@ |
1752 | 848 | ulint zip_size = fil_space_get_zip_size(space); | ||
1753 | 849 | ulint page_no = recv_addr->page_no; | ||
1754 | 850 | |||
1755 | 851 | + /* By now we have replayed all DDL log records from the | ||
1756 | 852 | + current batch. Check if the space ID is still valid in | ||
1757 | 853 | + the entry being processed, and ignore it if it is not.*/ | ||
1758 | 854 | + if (fil_tablespace_deleted_or_being_deleted_in_mem(space, -1)) { | ||
1759 | 855 | + | ||
1760 | 856 | + ut_a(recv_sys->n_addrs); | ||
1761 | 857 | + | ||
1762 | 858 | + recv_addr->state = RECV_PROCESSED; | ||
1763 | 859 | + recv_sys->n_addrs--; | ||
1764 | 860 | + | ||
1765 | 861 | + goto next; | ||
1766 | 862 | + } | ||
1767 | 863 | if (recv_addr->state == RECV_NOT_PROCESSED) { | ||
1768 | 864 | if (!has_printed) { | ||
1769 | 865 | ut_print_timestamp(stderr); | ||
1770 | 866 | @@ -1875,7 +1887,7 @@ | ||
1771 | 867 | |||
1772 | 868 | mutex_enter(&(recv_sys->mutex)); | ||
1773 | 869 | } | ||
1774 | 870 | - | ||
1775 | 871 | +next: | ||
1776 | 872 | recv_addr = HASH_GET_NEXT(addr_hash, recv_addr); | ||
1777 | 873 | } | ||
1778 | 874 | |||
1779 | 875 | @@ -2380,7 +2392,7 @@ | ||
1780 | 794 | || type == MLOG_FILE_RENAME | 876 | || type == MLOG_FILE_RENAME |
1781 | 795 | || type == MLOG_FILE_DELETE) { | 877 | || type == MLOG_FILE_DELETE) { |
1782 | 796 | ut_a(space); | 878 | ut_a(space); |
1783 | @@ -799,7 +881,7 @@ | |||
1784 | 799 | if (recv_replay_file_ops) { | 881 | if (recv_replay_file_ops) { |
1785 | 800 | 882 | ||
1786 | 801 | /* In ibbackup --apply-log, replay an .ibd file | 883 | /* In ibbackup --apply-log, replay an .ibd file |
1788 | 802 | @@ -2403,7 +2403,7 @@ | 884 | @@ -2403,7 +2415,7 @@ |
1789 | 803 | ut_error; | 885 | ut_error; |
1790 | 804 | } | 886 | } |
1791 | 805 | } | 887 | } |
1792 | @@ -808,7 +890,7 @@ | |||
1793 | 808 | /* In normal mysqld crash recovery we do not try to | 890 | /* In normal mysqld crash recovery we do not try to |
1794 | 809 | replay file operations */ | 891 | replay file operations */ |
1795 | 810 | #ifdef UNIV_LOG_LSN_DEBUG | 892 | #ifdef UNIV_LOG_LSN_DEBUG |
1797 | 811 | @@ -2820,8 +2820,11 @@ | 893 | @@ -2820,8 +2832,11 @@ |
1798 | 812 | 894 | ||
1799 | 813 | fprintf(stderr, | 895 | fprintf(stderr, |
1800 | 814 | "InnoDB: Doing recovery: scanned up to" | 896 | "InnoDB: Doing recovery: scanned up to" |
1801 | @@ -822,7 +904,7 @@ | |||
1802 | 822 | } | 904 | } |
1803 | 823 | } | 905 | } |
1804 | 824 | 906 | ||
1806 | 825 | @@ -2926,7 +2929,7 @@ | 907 | @@ -2926,7 +2941,7 @@ |
1807 | 826 | "InnoDB: Reading tablespace information" | 908 | "InnoDB: Reading tablespace information" |
1808 | 827 | " from the .ibd files...\n"); | 909 | " from the .ibd files...\n"); |
1809 | 828 | 910 | ||
1810 | @@ -831,7 +913,7 @@ | |||
1811 | 831 | 913 | ||
1812 | 832 | /* If we are using the doublewrite method, we will | 914 | /* If we are using the doublewrite method, we will |
1813 | 833 | check if there are half-written pages in data files, | 915 | check if there are half-written pages in data files, |
1815 | 834 | @@ -2935,12 +2938,14 @@ | 916 | @@ -2935,12 +2950,14 @@ |
1816 | 835 | 917 | ||
1817 | 836 | if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) { | 918 | if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) { |
1818 | 837 | 919 | ||
1819 | @@ -847,7 +929,7 @@ | |||
1820 | 847 | } | 929 | } |
1821 | 848 | } | 930 | } |
1822 | 849 | 931 | ||
1824 | 850 | @@ -3109,6 +3114,7 @@ | 932 | @@ -3109,6 +3126,7 @@ |
1825 | 851 | recv_sys->recovered_lsn = checkpoint_lsn; | 933 | recv_sys->recovered_lsn = checkpoint_lsn; |
1826 | 852 | 934 | ||
1827 | 853 | srv_start_lsn = checkpoint_lsn; | 935 | srv_start_lsn = checkpoint_lsn; |
1828 | @@ -855,7 +937,7 @@ | |||
1829 | 855 | } | 937 | } |
1830 | 856 | 938 | ||
1831 | 857 | contiguous_lsn = ut_uint64_align_down(recv_sys->scanned_lsn, | 939 | contiguous_lsn = ut_uint64_align_down(recv_sys->scanned_lsn, |
1833 | 858 | @@ -3474,6 +3480,7 @@ | 940 | @@ -3474,6 +3492,7 @@ |
1834 | 859 | that the data dictionary tables will be free of any locks. | 941 | that the data dictionary tables will be free of any locks. |
1835 | 860 | The data dictionary latch should guarantee that there is at | 942 | The data dictionary latch should guarantee that there is at |
1836 | 861 | most one data dictionary transaction active at a time. */ | 943 | most one data dictionary transaction active at a time. */ |
1837 | @@ -1017,7 +1099,7 @@ | |||
1838 | 1017 | 1099 | ||
1839 | 1018 | /* Try to flush dirty pages so as to avoid IO bursts at | 1100 | /* Try to flush dirty pages so as to avoid IO bursts at |
1840 | 1019 | the checkpoints. */ | 1101 | the checkpoints. */ |
1842 | 1020 | @@ -457,6 +451,10 @@ | 1102 | @@ -457,6 +451,11 @@ |
1843 | 1021 | UNIV_INTERN ulint srv_dict_size_limit = 0; | 1103 | UNIV_INTERN ulint srv_dict_size_limit = 0; |
1844 | 1022 | 1104 | ||
1845 | 1023 | UNIV_INTERN ulint srv_lazy_drop_table = 0; | 1105 | UNIV_INTERN ulint srv_lazy_drop_table = 0; |
1846 | @@ -1025,10 +1107,11 @@ | |||
1847 | 1025 | +UNIV_INTERN ibool srv_read_only = FALSE; | 1107 | +UNIV_INTERN ibool srv_read_only = FALSE; |
1848 | 1026 | +UNIV_INTERN ibool srv_fake_write = FALSE; | 1108 | +UNIV_INTERN ibool srv_fake_write = FALSE; |
1849 | 1027 | +UNIV_INTERN ibool srv_apply_log_only = FALSE; | 1109 | +UNIV_INTERN ibool srv_apply_log_only = FALSE; |
1850 | 1110 | +UNIV_INTERN ibool srv_backup_mode = FALSE; | ||
1851 | 1028 | /*-------------------------------------------*/ | 1111 | /*-------------------------------------------*/ |
1852 | 1029 | UNIV_INTERN ulong srv_n_spin_wait_rounds = 30; | 1112 | UNIV_INTERN ulong srv_n_spin_wait_rounds = 30; |
1853 | 1030 | UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500; | 1113 | UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500; |
1855 | 1031 | @@ -1137,7 +1135,7 @@ | 1114 | @@ -1137,7 +1136,7 @@ |
1856 | 1032 | } | 1115 | } |
1857 | 1033 | 1116 | ||
1858 | 1034 | /* Initialize some INFORMATION SCHEMA internal structures */ | 1117 | /* Initialize some INFORMATION SCHEMA internal structures */ |
1859 | @@ -1037,7 +1120,7 @@ | |||
1860 | 1037 | } | 1120 | } |
1861 | 1038 | 1121 | ||
1862 | 1039 | /*********************************************************************//** | 1122 | /*********************************************************************//** |
1864 | 1040 | @@ -1148,6 +1146,7 @@ | 1123 | @@ -1148,6 +1147,7 @@ |
1865 | 1041 | /*==========*/ | 1124 | /*==========*/ |
1866 | 1042 | { | 1125 | { |
1867 | 1043 | os_fast_mutex_free(&srv_conc_mutex); | 1126 | os_fast_mutex_free(&srv_conc_mutex); |
1868 | @@ -1045,7 +1128,7 @@ | |||
1869 | 1045 | mem_free(srv_conc_slots); | 1128 | mem_free(srv_conc_slots); |
1870 | 1046 | srv_conc_slots = NULL; | 1129 | srv_conc_slots = NULL; |
1871 | 1047 | 1130 | ||
1873 | 1048 | @@ -1161,6 +1160,7 @@ | 1131 | @@ -1161,6 +1161,7 @@ |
1874 | 1049 | srv_mysql_table = NULL; | 1132 | srv_mysql_table = NULL; |
1875 | 1050 | 1133 | ||
1876 | 1051 | trx_i_s_cache_free(trx_i_s_cache); | 1134 | trx_i_s_cache_free(trx_i_s_cache); |
1877 | @@ -1053,7 +1136,7 @@ | |||
1878 | 1053 | } | 1136 | } |
1879 | 1054 | 1137 | ||
1880 | 1055 | /*********************************************************************//** | 1138 | /*********************************************************************//** |
1882 | 1056 | @@ -1886,7 +1886,7 @@ | 1139 | @@ -1886,7 +1887,7 @@ |
1883 | 1057 | } | 1140 | } |
1884 | 1058 | 1141 | ||
1885 | 1059 | /* Record the lock wait time for this thread */ | 1142 | /* Record the lock wait time for this thread */ |
1886 | @@ -1062,7 +1145,7 @@ | |||
1887 | 1062 | } | 1145 | } |
1888 | 1063 | 1146 | ||
1889 | 1064 | if (trx->was_chosen_as_deadlock_victim) { | 1147 | if (trx->was_chosen_as_deadlock_victim) { |
1891 | 1065 | @@ -2842,36 +2842,6 @@ | 1148 | @@ -2842,36 +2843,6 @@ |
1892 | 1066 | old_sema = sema; | 1149 | old_sema = sema; |
1893 | 1067 | } | 1150 | } |
1894 | 1068 | 1151 | ||
1895 | 1069 | 1152 | ||
1896 | === modified file 'src/xtrabackup.cc' | |||
1897 | --- src/xtrabackup.cc 2013-05-03 14:12:58 +0000 | |||
1898 | +++ src/xtrabackup.cc 2013-05-08 05:16:27 +0000 | |||
1899 | @@ -4035,6 +4035,55 @@ | |||
1900 | 4035 | 4035 | ||
1901 | 4036 | } | 4036 | } |
1902 | 4037 | 4037 | ||
1903 | 4038 | /**********************************************************************//** | ||
1904 | 4039 | Closes a file. */ | ||
1905 | 4040 | static | ||
1906 | 4041 | void | ||
1907 | 4042 | xb_fil_node_close_file( | ||
1908 | 4043 | /*===================*/ | ||
1909 | 4044 | fil_node_t* node) /*!< in: file node */ | ||
1910 | 4045 | { | ||
1911 | 4046 | ibool ret; | ||
1912 | 4047 | |||
1913 | 4048 | mutex_enter(&fil_system->mutex); | ||
1914 | 4049 | |||
1915 | 4050 | ut_ad(node); | ||
1916 | 4051 | ut_a(node->n_pending == 0); | ||
1917 | 4052 | ut_a(node->n_pending_flushes == 0); | ||
1918 | 4053 | #if MYSQL_VERSION_ID >= 50600 | ||
1919 | 4054 | ut_a(!node->being_extended); | ||
1920 | 4055 | #endif | ||
1921 | 4056 | |||
1922 | 4057 | if (!node->open) { | ||
1923 | 4058 | |||
1924 | 4059 | mutex_exit(&fil_system->mutex); | ||
1925 | 4060 | |||
1926 | 4061 | return; | ||
1927 | 4062 | } | ||
1928 | 4063 | |||
1929 | 4064 | ret = os_file_close(node->handle); | ||
1930 | 4065 | ut_a(ret); | ||
1931 | 4066 | |||
1932 | 4067 | node->open = FALSE; | ||
1933 | 4068 | |||
1934 | 4069 | ut_a(fil_system->n_open > 0); | ||
1935 | 4070 | fil_system->n_open--; | ||
1936 | 4071 | #if MYSQL_VERSION_ID >= 50600 | ||
1937 | 4072 | fil_n_file_opened--; | ||
1938 | 4073 | #endif | ||
1939 | 4074 | |||
1940 | 4075 | if (node->space->purpose == FIL_TABLESPACE && | ||
1941 | 4076 | !trx_sys_sys_space(node->space->id)) { | ||
1942 | 4077 | |||
1943 | 4078 | ut_a(UT_LIST_GET_LEN(fil_system->LRU) > 0); | ||
1944 | 4079 | |||
1945 | 4080 | /* The node is in the LRU list, remove it */ | ||
1946 | 4081 | UT_LIST_REMOVE(LRU, fil_system->LRU, node); | ||
1947 | 4082 | } | ||
1948 | 4083 | |||
1949 | 4084 | mutex_exit(&fil_system->mutex); | ||
1950 | 4085 | } | ||
1951 | 4086 | |||
1952 | 4038 | /* TODO: We may tune the behavior (e.g. by fil_aio)*/ | 4087 | /* TODO: We may tune the behavior (e.g. by fil_aio)*/ |
1953 | 4039 | #define COPY_CHUNK 64 | 4088 | #define COPY_CHUNK 64 |
1954 | 4040 | 4089 | ||
1955 | @@ -4042,7 +4091,6 @@ | |||
1956 | 4042 | my_bool | 4091 | my_bool |
1957 | 4043 | xtrabackup_copy_datafile(fil_node_t* node, uint thread_n, ds_ctxt_t *ds_ctxt) | 4092 | xtrabackup_copy_datafile(fil_node_t* node, uint thread_n, ds_ctxt_t *ds_ctxt) |
1958 | 4044 | { | 4093 | { |
1959 | 4045 | os_file_t src_file = XB_FILE_UNDEFINED; | ||
1960 | 4046 | MY_STAT src_stat; | 4094 | MY_STAT src_stat; |
1961 | 4047 | char dst_name[FN_REFLEN]; | 4095 | char dst_name[FN_REFLEN]; |
1962 | 4048 | char meta_name[FN_REFLEN]; | 4096 | char meta_name[FN_REFLEN]; |
1963 | @@ -4093,34 +4141,47 @@ | |||
1964 | 4093 | strncpy(dst_name, xb_get_relative_path(node_path, is_system), | 4141 | strncpy(dst_name, xb_get_relative_path(node_path, is_system), |
1965 | 4094 | sizeof(dst_name)); | 4142 | sizeof(dst_name)); |
1966 | 4095 | 4143 | ||
1982 | 4096 | /* open src_file*/ | 4144 | /* We should already have a tablespace handle created by |
1983 | 4097 | src_file = xb_file_create_no_error_handling(node_path, | 4145 | fil_load_single_table_tablespace() unless it is a system tablespace. */ |
1984 | 4098 | OS_FILE_OPEN, | 4146 | if (is_system) { |
1985 | 4099 | OS_FILE_READ_ONLY, | 4147 | |
1986 | 4100 | &success); | 4148 | node->handle = |
1987 | 4101 | if (!success) { | 4149 | xb_file_create_no_error_handling(node_path, |
1988 | 4102 | /* The following call prints an error message */ | 4150 | OS_FILE_OPEN, |
1989 | 4103 | os_file_get_last_error(TRUE); | 4151 | OS_FILE_READ_ONLY, |
1990 | 4104 | 4152 | &success); | |
1991 | 4105 | msg("[%02u] xtrabackup: Warning: cannot open %s\n" | 4153 | if (!success) { |
1992 | 4106 | "[%02u] xtrabackup: Warning: We assume the " | 4154 | |
1993 | 4107 | "table was dropped or renamed during " | 4155 | msg("[%02u] xtrabackup: error: cannot open " |
1994 | 4108 | "xtrabackup execution and ignore the file.\n", | 4156 | "system tablespace %s\n", thread_n, node_path); |
1995 | 4109 | thread_n, node_path, thread_n); | 4157 | goto error; |
1996 | 4110 | goto skip; | 4158 | } |
1997 | 4159 | |||
1998 | 4160 | mutex_enter(&fil_system->mutex); | ||
1999 | 4161 | |||
2000 | 4162 | node->open = TRUE; | ||
2001 | 4163 | |||
2002 | 4164 | fil_system->n_open++; | ||
2003 | 4165 | #if MYSQL_VERSION_ID >= 50600 | ||
2004 | 4166 | fil_n_file_opened++; | ||
2005 | 4167 | #endif | ||
2006 | 4168 | |||
2007 | 4169 | mutex_exit(&fil_system->mutex); | ||
2008 | 4111 | } | 4170 | } |
2009 | 4112 | 4171 | ||
2011 | 4113 | xb_file_set_nocache(src_file, node_path, "OPEN"); | 4172 | ut_ad(node->open); |
2012 | 4173 | |||
2013 | 4174 | xb_file_set_nocache(node->handle, node_path, "OPEN"); | ||
2014 | 4114 | 4175 | ||
2015 | 4115 | #ifdef USE_POSIX_FADVISE | 4176 | #ifdef USE_POSIX_FADVISE |
2017 | 4116 | posix_fadvise(src_file, 0, 0, POSIX_FADV_SEQUENTIAL); | 4177 | posix_fadvise(node->handle, 0, 0, POSIX_FADV_SEQUENTIAL); |
2018 | 4117 | #endif | 4178 | #endif |
2019 | 4118 | 4179 | ||
2020 | 4119 | #ifndef INNODB_VERSION_SHORT | 4180 | #ifndef INNODB_VERSION_SHORT |
2021 | 4120 | page_size = UNIV_PAGE_SIZE; | 4181 | page_size = UNIV_PAGE_SIZE; |
2022 | 4121 | page_size_shift = UNIV_PAGE_SIZE_SHIFT; | 4182 | page_size_shift = UNIV_PAGE_SIZE_SHIFT; |
2023 | 4122 | #else | 4183 | #else |
2025 | 4123 | info.zip_size = xb_get_zip_size(src_file); | 4184 | info.zip_size = xb_get_zip_size(node->handle); |
2026 | 4124 | if (info.zip_size == ULINT_UNDEFINED) { | 4185 | if (info.zip_size == ULINT_UNDEFINED) { |
2027 | 4125 | goto skip; | 4186 | goto skip; |
2028 | 4126 | } else if (info.zip_size) { | 4187 | } else if (info.zip_size) { |
2029 | @@ -4164,10 +4225,10 @@ | |||
2030 | 4164 | } else | 4225 | } else |
2031 | 4165 | info.page_size = 0; | 4226 | info.page_size = 0; |
2032 | 4166 | 4227 | ||
2034 | 4167 | if (my_stat(node_path, &src_stat, MYF(MY_WME)) == NULL) { | 4228 | if (my_fstat(node->handle, &src_stat, MYF(MY_WME))) { |
2035 | 4168 | msg("[%02u] xtrabackup: Warning: cannot stat %s\n", | 4229 | msg("[%02u] xtrabackup: Warning: cannot stat %s\n", |
2036 | 4169 | thread_n, node_path); | 4230 | thread_n, node_path); |
2038 | 4170 | goto skip; | 4231 | goto error; |
2039 | 4171 | } | 4232 | } |
2040 | 4172 | dstfile = ds->open(ds_ctxt, dst_name, &src_stat); | 4233 | dstfile = ds->open(ds_ctxt, dst_name, &src_stat); |
2041 | 4173 | if (dstfile == NULL) { | 4234 | if (dstfile == NULL) { |
2042 | @@ -4197,7 +4258,7 @@ | |||
2043 | 4197 | * page_size + UNIV_PAGE_SIZE)); | 4258 | * page_size + UNIV_PAGE_SIZE)); |
2044 | 4198 | page = static_cast<byte *>(ut_align(buf2, UNIV_PAGE_SIZE)); | 4259 | page = static_cast<byte *>(ut_align(buf2, UNIV_PAGE_SIZE)); |
2045 | 4199 | 4260 | ||
2047 | 4200 | success = xb_os_file_read(src_file, page, 0, UNIV_PAGE_SIZE); | 4261 | success = xb_os_file_read(node->handle, page, 0, UNIV_PAGE_SIZE); |
2048 | 4201 | if (!success) { | 4262 | if (!success) { |
2049 | 4202 | goto error; | 4263 | goto error; |
2050 | 4203 | } | 4264 | } |
2051 | @@ -4218,13 +4279,13 @@ | |||
2052 | 4218 | read_retry: | 4279 | read_retry: |
2053 | 4219 | xtrabackup_io_throttling(); | 4280 | xtrabackup_io_throttling(); |
2054 | 4220 | 4281 | ||
2056 | 4221 | success = xb_os_file_read(src_file, page, offset, chunk); | 4282 | success = xb_os_file_read(node->handle, page, offset, chunk); |
2057 | 4222 | if (!success) { | 4283 | if (!success) { |
2058 | 4223 | goto error; | 4284 | goto error; |
2059 | 4224 | } | 4285 | } |
2060 | 4225 | 4286 | ||
2061 | 4226 | #ifdef USE_POSIX_FADVISE | 4287 | #ifdef USE_POSIX_FADVISE |
2063 | 4227 | posix_fadvise(src_file, 0, 0, POSIX_FADV_DONTNEED); | 4288 | posix_fadvise(node->handle, 0, 0, POSIX_FADV_DONTNEED); |
2064 | 4228 | #endif | 4289 | #endif |
2065 | 4229 | 4290 | ||
2066 | 4230 | /* check corruption and retry */ | 4291 | /* check corruption and retry */ |
2067 | @@ -4349,17 +4410,17 @@ | |||
2068 | 4349 | 4410 | ||
2069 | 4350 | /* close */ | 4411 | /* close */ |
2070 | 4351 | msg("[%02u] ...done\n", thread_n); | 4412 | msg("[%02u] ...done\n", thread_n); |
2074 | 4352 | if (!node->open) { | 4413 | |
2075 | 4353 | os_file_close(src_file); | 4414 | xb_fil_node_close_file(node); |
2076 | 4354 | } | 4415 | |
2077 | 4355 | ds->close(dstfile); | 4416 | ds->close(dstfile); |
2078 | 4356 | if (incremental_buffer_base) | 4417 | if (incremental_buffer_base) |
2079 | 4357 | ut_free(incremental_buffer_base); | 4418 | ut_free(incremental_buffer_base); |
2080 | 4358 | ut_free(buf2); | 4419 | ut_free(buf2); |
2081 | 4359 | return(FALSE); | 4420 | return(FALSE); |
2082 | 4360 | error: | 4421 | error: |
2085 | 4361 | if (src_file != XB_FILE_UNDEFINED && !node->open) | 4422 | xb_fil_node_close_file(node); |
2086 | 4362 | os_file_close(src_file); | 4423 | |
2087 | 4363 | if (dstfile != NULL) | 4424 | if (dstfile != NULL) |
2088 | 4364 | ds->close(dstfile); | 4425 | ds->close(dstfile); |
2089 | 4365 | if (incremental_buffer_base) | 4426 | if (incremental_buffer_base) |
2090 | @@ -4371,8 +4432,8 @@ | |||
2091 | 4371 | return(TRUE); /*ERROR*/ | 4432 | return(TRUE); /*ERROR*/ |
2092 | 4372 | 4433 | ||
2093 | 4373 | skip: | 4434 | skip: |
2096 | 4374 | if (src_file != XB_FILE_UNDEFINED && !node->open) | 4435 | xb_fil_node_close_file(node); |
2097 | 4375 | os_file_close(src_file); | 4436 | |
2098 | 4376 | if (dstfile != NULL) | 4437 | if (dstfile != NULL) |
2099 | 4377 | ds->close(dstfile); | 4438 | ds->close(dstfile); |
2100 | 4378 | if (incremental_buffer_base) | 4439 | if (incremental_buffer_base) |
2101 | @@ -4789,7 +4850,7 @@ | |||
2102 | 4789 | srv_n_file_io_threads, | 4850 | srv_n_file_io_threads, |
2103 | 4790 | SRV_MAX_N_PENDING_SYNC_IOS); | 4851 | SRV_MAX_N_PENDING_SYNC_IOS); |
2104 | 4791 | 4852 | ||
2106 | 4792 | fil_init(srv_max_n_open_files); | 4853 | fil_init(LONG_MAX); |
2107 | 4793 | #else | 4854 | #else |
2108 | 4794 | #if MYSQL_VERSION_ID >= 50600 | 4855 | #if MYSQL_VERSION_ID >= 50600 |
2109 | 4795 | srv_n_file_io_threads = srv_n_read_io_threads; | 4856 | srv_n_file_io_threads = srv_n_read_io_threads; |
2110 | @@ -4803,8 +4864,7 @@ | |||
2111 | 4803 | srv_n_write_io_threads, | 4864 | srv_n_write_io_threads, |
2112 | 4804 | SRV_MAX_N_PENDING_SYNC_IOS); | 4865 | SRV_MAX_N_PENDING_SYNC_IOS); |
2113 | 4805 | 4866 | ||
2116 | 4806 | fil_init(srv_file_per_table ? 50000 : 5000, | 4867 | fil_init(srv_file_per_table ? 50000 : 5000, LONG_MAX); |
2115 | 4807 | srv_max_n_open_files); | ||
2117 | 4808 | #endif | 4868 | #endif |
2118 | 4809 | 4869 | ||
2119 | 4810 | fsp_init(); | 4870 | fsp_init(); |
2120 | @@ -4848,11 +4908,6 @@ | |||
2121 | 4848 | return(DB_ERROR); | 4908 | return(DB_ERROR); |
2122 | 4849 | } | 4909 | } |
2123 | 4850 | 4910 | ||
2124 | 4851 | err = fil_load_single_table_tablespaces(xb_check_if_open_tablespace); | ||
2125 | 4852 | if (err != DB_SUCCESS) { | ||
2126 | 4853 | return(err); | ||
2127 | 4854 | } | ||
2128 | 4855 | |||
2129 | 4856 | #if MYSQL_VERSION_ID >= 50600 | 4911 | #if MYSQL_VERSION_ID >= 50600 |
2130 | 4857 | /* Add separate undo tablespaces to fil_system */ | 4912 | /* Add separate undo tablespaces to fil_system */ |
2131 | 4858 | 4913 | ||
2132 | @@ -4865,6 +4920,15 @@ | |||
2133 | 4865 | } | 4920 | } |
2134 | 4866 | #endif | 4921 | #endif |
2135 | 4867 | 4922 | ||
2136 | 4923 | /* It is important to call fil_load_single_table_tablespace() after | ||
2137 | 4924 | srv_undo_tablespaces_init(), because fil_is_user_tablespace_id() * | ||
2138 | 4925 | relies on srv_undo_tablespaces_open to be properly initialized */ | ||
2139 | 4926 | |||
2140 | 4927 | err = fil_load_single_table_tablespaces(xb_check_if_open_tablespace); | ||
2141 | 4928 | if (err != DB_SUCCESS) { | ||
2142 | 4929 | return(err); | ||
2143 | 4930 | } | ||
2144 | 4931 | |||
2145 | 4868 | return(DB_SUCCESS); | 4932 | return(DB_SUCCESS); |
2146 | 4869 | } | 4933 | } |
2147 | 4870 | 4934 | ||
2148 | @@ -5278,6 +5342,8 @@ | |||
2149 | 5278 | srv_read_only = TRUE; | 5342 | srv_read_only = TRUE; |
2150 | 5279 | #endif | 5343 | #endif |
2151 | 5280 | 5344 | ||
2152 | 5345 | srv_backup_mode = TRUE; | ||
2153 | 5346 | |||
2154 | 5281 | /* initialize components */ | 5347 | /* initialize components */ |
2155 | 5282 | if(innodb_init_param()) | 5348 | if(innodb_init_param()) |
2156 | 5283 | exit(EXIT_FAILURE); | 5349 | exit(EXIT_FAILURE); |
2157 | 5284 | 5350 | ||
2158 | === modified file 'test/inc/common.sh' | |||
2159 | --- test/inc/common.sh 2013-05-01 20:09:28 +0000 | |||
2160 | +++ test/inc/common.sh 2013-05-08 05:16:27 +0000 | |||
2161 | @@ -442,6 +442,25 @@ | |||
2162 | 442 | $MYSQL $MYSQL_ARGS -Ns -e "CHECKSUM TABLE $2 EXTENDED" $1 | awk {'print $2'} | 442 | $MYSQL $MYSQL_ARGS -Ns -e "CHECKSUM TABLE $2 EXTENDED" $1 | awk {'print $2'} |
2163 | 443 | } | 443 | } |
2164 | 444 | 444 | ||
2165 | 445 | ########################################################################## | ||
2166 | 446 | # Dumps a given database using mysqldump # | ||
2167 | 447 | ########################################################################## | ||
2168 | 448 | function record_db_state() | ||
2169 | 449 | { | ||
2170 | 450 | $MYSQLDUMP $MYSQL_ARGS -t --compact $1 >"$topdir/tmp/$1_old.sql" | ||
2171 | 451 | } | ||
2172 | 452 | |||
2173 | 453 | |||
2174 | 454 | ########################################################################## | ||
2175 | 455 | # Compares the current dump of a given database with a state previously # | ||
2176 | 456 | # captured with record_db_state(). # | ||
2177 | 457 | ########################################################################## | ||
2178 | 458 | function verify_db_state() | ||
2179 | 459 | { | ||
2180 | 460 | $MYSQLDUMP $MYSQL_ARGS -t --compact $1 >"$topdir/tmp/$1_new.sql" | ||
2181 | 461 | diff -u "$topdir/tmp/$1_old.sql" "$topdir/tmp/$1_new.sql" | ||
2182 | 462 | } | ||
2183 | 463 | |||
2184 | 445 | ######################################################################## | 464 | ######################################################################## |
2185 | 446 | # Workarounds for a bug in grep 2.10 when grep -q file > file would | 465 | # Workarounds for a bug in grep 2.10 when grep -q file > file would |
2186 | 447 | # result in a failure. | 466 | # result in a failure. |
2187 | 448 | 467 | ||
2188 | === renamed file 'test/t/bug722638.sh' => 'test/t/ddl.sh' | |||
2189 | --- test/t/bug722638.sh 2012-06-04 18:29:48 +0000 | |||
2190 | +++ test/t/ddl.sh 2013-05-08 05:16:27 +0000 | |||
2191 | @@ -1,7 +1,9 @@ | |||
2194 | 1 | ######################################################################## | 1 | ############################################################################ |
2195 | 2 | # Bug #722638: xtrabackup: taking backup while tables are droped and | 2 | # Bug #722638: xtrabackup: taking backup while tables are droped and |
2196 | 3 | # created breaks backup | 3 | # created breaks backup |
2198 | 4 | ######################################################################## | 4 | # |
2199 | 5 | # Bug #1079700: Issues with renaming/rotating tables during the backup stage | ||
2200 | 6 | ############################################################################ | ||
2201 | 5 | 7 | ||
2202 | 6 | . inc/common.sh | 8 | . inc/common.sh |
2203 | 7 | 9 | ||
2204 | @@ -10,7 +12,11 @@ | |||
2205 | 10 | exit $SKIPPED_EXIT_CODE | 12 | exit $SKIPPED_EXIT_CODE |
2206 | 11 | fi | 13 | fi |
2207 | 12 | 14 | ||
2209 | 13 | start_server --innodb_file_per_table | 15 | MYSQLD_EXTRA_MY_CNF_OPTS=" |
2210 | 16 | innodb_file_per_table | ||
2211 | 17 | " | ||
2212 | 18 | |||
2213 | 19 | start_server | ||
2214 | 14 | 20 | ||
2215 | 15 | run_cmd $MYSQL $MYSQL_ARGS test <<EOF | 21 | run_cmd $MYSQL $MYSQL_ARGS test <<EOF |
2216 | 16 | 22 | ||
2217 | @@ -26,8 +32,19 @@ | |||
2218 | 26 | CREATE TABLE t4_old(a INT) ENGINE=InnoDB; | 32 | CREATE TABLE t4_old(a INT) ENGINE=InnoDB; |
2219 | 27 | INSERT INTO t4_old VALUES (1), (2), (3); | 33 | INSERT INTO t4_old VALUES (1), (2), (3); |
2220 | 28 | 34 | ||
2221 | 35 | CREATE TABLE t5(a INT) ENGINE=InnoDB; | ||
2222 | 36 | INSERT INTO t5 VALUES (1), (2), (3); | ||
2223 | 37 | |||
2224 | 38 | CREATE TABLE t6(c CHAR(1)) ENGINE=InnoDB; | ||
2225 | 39 | INSERT INTO t6 VALUES ('a'), ('b'), ('c'); | ||
2226 | 40 | |||
2227 | 29 | EOF | 41 | EOF |
2228 | 30 | 42 | ||
2229 | 43 | # Make a checkpoint so that original tablespace creation events are not in the | ||
2230 | 44 | # xtrabackup log | ||
2231 | 45 | shutdown_server | ||
2232 | 46 | start_server | ||
2233 | 47 | |||
2234 | 31 | mkdir -p $topdir/backup | 48 | mkdir -p $topdir/backup |
2235 | 32 | 49 | ||
2236 | 33 | # Backup | 50 | # Backup |
2237 | @@ -70,13 +87,18 @@ | |||
2238 | 70 | ALTER TABLE t4_old RENAME t4; | 87 | ALTER TABLE t4_old RENAME t4; |
2239 | 71 | INSERT INTO t4 VALUES (7), (8), (9); | 88 | INSERT INTO t4 VALUES (7), (8), (9); |
2240 | 72 | 89 | ||
2241 | 90 | INSERT INTO t5 VALUES (4), (5), (6); | ||
2242 | 91 | INSERT INTO t6 VALUES ('d'), ('e'), ('f'); | ||
2243 | 92 | |||
2244 | 93 | # Rotate tables t5 and t6 | ||
2245 | 94 | RENAME TABLE t5 TO temp, t6 TO t5, temp TO t6; | ||
2246 | 95 | |||
2247 | 96 | INSERT INTO t5 VALUES ('g'), ('h'), ('i'); | ||
2248 | 97 | INSERT INTO t6 VALUES (7), (8), (9); | ||
2249 | 98 | |||
2250 | 73 | EOF | 99 | EOF |
2251 | 74 | 100 | ||
2257 | 75 | # Calculate checksums | 101 | record_db_state test |
2253 | 76 | checksum_t1=`checksum_table test t1` | ||
2254 | 77 | checksum_t2=`checksum_table test t2` | ||
2255 | 78 | checksum_t3=`checksum_table test t3` | ||
2256 | 79 | checksum_t4=`checksum_table test t4` | ||
2258 | 80 | 102 | ||
2259 | 81 | # Resume xtrabackup | 103 | # Resume xtrabackup |
2260 | 82 | vlog "Resuming xtrabackup" | 104 | vlog "Resuming xtrabackup" |
2261 | @@ -84,6 +106,8 @@ | |||
2262 | 84 | 106 | ||
2263 | 85 | run_cmd wait $job_pid | 107 | run_cmd wait $job_pid |
2264 | 86 | 108 | ||
2265 | 109 | # exit 1 | ||
2266 | 110 | |||
2267 | 87 | # Prepare | 111 | # Prepare |
2268 | 88 | xtrabackup --datadir=$mysql_datadir --prepare --target-dir=$topdir/backup | 112 | xtrabackup --datadir=$mysql_datadir --prepare --target-dir=$topdir/backup |
2269 | 89 | 113 | ||
2270 | @@ -94,25 +118,7 @@ | |||
2271 | 94 | $mysql_datadir/test/*.ibd | 118 | $mysql_datadir/test/*.ibd |
2272 | 95 | cp -r $topdir/backup/* $mysql_datadir | 119 | cp -r $topdir/backup/* $mysql_datadir |
2273 | 96 | 120 | ||
2296 | 97 | start_server --innodb_file_per_table | 121 | start_server |
2297 | 98 | 122 | ||
2298 | 99 | # Verify checksums | 123 | # Verify backup |
2299 | 100 | checksum_t1_new=`checksum_table test t1` | 124 | verify_db_state test |
2278 | 101 | checksum_t2_new=`checksum_table test t2` | ||
2279 | 102 | checksum_t3_new=`checksum_table test t3` | ||
2280 | 103 | checksum_t4_new=`checksum_table test t4` | ||
2281 | 104 | vlog "Checksums (old/new):" | ||
2282 | 105 | vlog "t1: $checksum_t1/$checksum_t1_new" | ||
2283 | 106 | vlog "t2: $checksum_t2/$checksum_t2_new" | ||
2284 | 107 | vlog "t3: $checksum_t3/$checksum_t3_new" | ||
2285 | 108 | vlog "t4: $checksum_t4/$checksum_t4_new" | ||
2286 | 109 | |||
2287 | 110 | if [ "$checksum_t1" = "$checksum_t1_new" -a \ | ||
2288 | 111 | "$checksum_t2" = "$checksum_t2_new" -a \ | ||
2289 | 112 | "$checksum_t3" = "$checksum_t3_new" -a \ | ||
2290 | 113 | "$checksum_t4" = "$checksum_t4_new" ]; then | ||
2291 | 114 | exit 0 | ||
2292 | 115 | fi | ||
2293 | 116 | |||
2294 | 117 | vlog "Checksums do not match" | ||
2295 | 118 | exit -1 | ||
2300 | 119 | 125 | ||
2301 | === modified file 'test/testrun.sh' | |||
2302 | --- test/testrun.sh 2013-04-27 18:46:54 +0000 | |||
2303 | +++ test/testrun.sh 2013-05-08 05:16:27 +0000 | |||
2304 | @@ -70,6 +70,7 @@ | |||
2305 | 70 | find_program MYSQLD mysqld $MYSQL_BASEDIR/bin/ $MYSQL_BASEDIR/libexec | 70 | find_program MYSQLD mysqld $MYSQL_BASEDIR/bin/ $MYSQL_BASEDIR/libexec |
2306 | 71 | find_program MYSQL mysql $MYSQL_BASEDIR/bin | 71 | find_program MYSQL mysql $MYSQL_BASEDIR/bin |
2307 | 72 | find_program MYSQLADMIN mysqladmin $MYSQL_BASEDIR/bin | 72 | find_program MYSQLADMIN mysqladmin $MYSQL_BASEDIR/bin |
2308 | 73 | find_program MYSQLDUMP mysqldump $MYSQL_BASEDIR/bin | ||
2309 | 73 | 74 | ||
2310 | 74 | # Check if we are running from a source tree and, if so, set PATH | 75 | # Check if we are running from a source tree and, if so, set PATH |
2311 | 75 | # appropriately | 76 | # appropriately |
2312 | @@ -85,9 +86,10 @@ | |||
2313 | 85 | else | 86 | else |
2314 | 86 | LD_LIBRARY_PATH=$MYSQL_BASEDIR/lib/mysql:$LD_LIBRARY_PATH | 87 | LD_LIBRARY_PATH=$MYSQL_BASEDIR/lib/mysql:$LD_LIBRARY_PATH |
2315 | 87 | fi | 88 | fi |
2316 | 89 | DYLD_LIBRARY_PATH="$LD_LIBRARY_PATH" | ||
2317 | 88 | 90 | ||
2318 | 89 | export TEST_BASEDIR PORT_BASE TAR MYSQL_BASEDIR MYSQL MYSQLD MYSQLADMIN \ | 91 | export TEST_BASEDIR PORT_BASE TAR MYSQL_BASEDIR MYSQL MYSQLD MYSQLADMIN \ |
2320 | 90 | MYSQL_INSTALL_DB PATH LD_LIBRARY_PATH | 92 | MYSQL_INSTALL_DB PATH LD_LIBRARY_PATH DYLD_LIBRARY_PATH MYSQLDUMP |
2321 | 91 | } | 93 | } |
2322 | 92 | 94 | ||
2323 | 93 | 95 | ||
2324 | 94 | 96 | ||
2325 | === modified file 'utils/build.sh' | |||
2326 | --- utils/build.sh 2013-04-30 07:33:04 +0000 | |||
2327 | +++ utils/build.sh 2013-05-08 05:16:27 +0000 | |||
2328 | @@ -44,7 +44,13 @@ | |||
2329 | 44 | -DUNIV_DEBUG_THREAD_CREATION -DUNIV_DEBUG_LOCK_VALIDATE -DUNIV_DEBUG_PRINT \ | 44 | -DUNIV_DEBUG_THREAD_CREATION -DUNIV_DEBUG_LOCK_VALIDATE -DUNIV_DEBUG_PRINT \ |
2330 | 45 | -DUNIV_DEBUG_FILE_ACCESS -DUNIV_SEARCH_DEBUG -DUNIV_LOG_LSN_DEBUG \ | 45 | -DUNIV_DEBUG_FILE_ACCESS -DUNIV_SEARCH_DEBUG -DUNIV_LOG_LSN_DEBUG \ |
2331 | 46 | -DUNIV_ZIP_DEBUG -DUNIV_AHI_DEBUG -DUNIV_SQL_DEBUG -DUNIV_AIO_DEBUG \ | 46 | -DUNIV_ZIP_DEBUG -DUNIV_AHI_DEBUG -DUNIV_SQL_DEBUG -DUNIV_AIO_DEBUG \ |
2333 | 47 | -DUNIV_LRU_DEBUG -DUNIV_BUF_DEBUG -DUNIV_HASH_DEBUG -DUNIV_LIST_DEBUG -DUNIV_IBUF_DEBUG" | 47 | -DUNIV_LRU_DEBUG -DUNIV_BUF_DEBUG -DUNIV_HASH_DEBUG -DUNIV_IBUF_DEBUG" |
2334 | 48 | |||
2335 | 49 | if [ "$type" = "innodb56" ] | ||
2336 | 50 | then | ||
2337 | 51 | innodb_extra_debug="$innodb_extra_debug -DUNIV_LIST_DEBUG" | ||
2338 | 52 | fi | ||
2339 | 53 | |||
2340 | 48 | export CFLAGS="$CFLAGS -g -O0 $innodb_extra_debug -DSAFE_MUTEX -DSAFEMALLOC" | 54 | export CFLAGS="$CFLAGS -g -O0 $innodb_extra_debug -DSAFE_MUTEX -DSAFEMALLOC" |
2341 | 49 | export CXXFLAGS="$CXXFLAGS -g -O0 $innodb_extra_debug -DSAFE_MUTEX -DSAFEMALLOC" | 55 | export CXXFLAGS="$CXXFLAGS -g -O0 $innodb_extra_debug -DSAFE_MUTEX -DSAFEMALLOC" |
2342 | 50 | extra_config_51="--with-debug=full" | 56 | extra_config_51="--with-debug=full" |
- The MLOG_FILE_DELETE bits need reconcilation and/or explanation bugs.mysql. com/bug. php?id= 43948 and /bugs.launchpad .net/percona- xtrabackup/ +bug/1121072
on why the already existing hashed log rec handling in the
patches for buf_page_read_low() is not enough. Maybe it's
possible to tweak buf_page_read_low() patch instead of adding
more patches to log0recv.c? Please see
http://
https:/
which I have closed as Invalid due to this MP.
- Will the following work:
- XtraBackup creates a list of tablespaces;
- CREATE TABLE foo is issued (optionally maybe even CREATE
DATABASE first);
- XtraBackup proceeds with backup;
- Incremental backup is taken. Will it contain foo? It is
possible that some of the foo writes will be captured in the
full backup redo log backup.
I guess this question boils down to "is fil_system snapshot
taking atomic with the rest of backup state." CREATE TABLE
specifically because other scenarios seem to be covered by this
fix. I am not implying that I suspect it will or will not, I
don't know and am curious.
- This might be outside the scope of the current fix, but since
you are backporting the mysqldump backup verifier, I am
mentioning it here. If there's a bug/blueprint open for this,
please point me there: mysqldump verification probably would miss
secondary index tree corruptions, wouldn't it?
- What are the s/AM_CONFIG_ HEADER/ AC_CONFIG_ HEADERS bits for?
Some bug fixed? If yes, is there a # ref?
- Likewise for configure.cmake patch bits?
- I recall seeing utils/build.sh patch elsewhere, yet there is
only one unmerged revision in this MP. Is this intended?