474
474
if (size < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) {
476
476
"InnoDB: Error: the size of single-table tablespace"
477
@@ -3425,7 +3530,7 @@
477
@@ -3414,7 +3519,51 @@
479
fil_node_create(filepath, 0, space_id, FALSE);
481
- os_file_close(file);
482
+ /* We reuse file handles on the backup stage in XtraBackup to avoid
483
+ inconsistencies between the file name and the actual tablespace contents
484
+ if a DDL occurs between a fil_load_single_table_tablespaces() call and
485
+ the actual copy operation. */
486
+ if (srv_backup_mode) {
489
+ fil_space_t* space;
491
+ mutex_enter(&fil_system->mutex);
493
+ space = fil_space_get_by_id(space_id);
496
+ node = UT_LIST_GET_LAST(space->chain);
498
+ /* The handle will be closed by xtrabackup in
499
+ xtrabackup_copy_datafile(). We set node->open to TRUE to
500
+ make sure no one calls fil_node_open_file()
501
+ (i.e. attempts to reopen the tablespace by name) during
502
+ the backup stage. */
505
+ node->handle = file;
507
+ /* The following is copied from fil_node_open_file() to
508
+ pass fil_system validity checks. We cannot use
509
+ fil_node_open_file() directly, as that would re-open the
510
+ file by name and create another file handle. */
512
+ fil_system->n_open++;
514
+ if (space->purpose == FIL_TABLESPACE &&
517
+ /* Put the node to the LRU list */
518
+ UT_LIST_ADD_FIRST(LRU, fil_system->LRU, node);
522
+ mutex_exit(&fil_system->mutex);
525
+ os_file_close(file);
530
@@ -3425,7 +3574,7 @@
478
531
idea is to read as much good data as we can and jump over bad data.
479
532
@return 0 if ok, -1 if error even after the retries, 1 if at the end
480
533
of the directory */
518
571
ret = fil_file_readdir_next_file(&err,
519
@@ -3724,15 +3834,97 @@
572
@@ -3724,15 +3878,97 @@
520
573
"InnoDB: in InnoDB data dictionary"
521
574
" has tablespace id %lu,\n"
522
575
"InnoDB: but tablespace with that id"
666
719
|| ibuf_page(space_id, zip_size, block_offset, NULL));
667
720
# endif /* UNIV_LOG_DEBUG */
669
@@ -4341,6 +4540,16 @@
722
@@ -4341,6 +4584,16 @@
671
724
ut_ad((mode != OS_AIO_IBUF) || (space->purpose == FIL_TABLESPACE));
748
801
+extern ibool srv_read_only;
749
802
+extern ibool srv_fake_write;
750
803
+extern ibool srv_apply_log_only;
804
+extern ibool srv_backup_mode;
751
805
/*-------------------------------------------*/
753
807
extern ulint srv_n_rows_inserted;
962
1016
ib_uint64_t end_lsn;
964
@@ -2297,7 +2306,7 @@
1018
@@ -1762,6 +1771,18 @@
1019
ulint zip_size = fil_space_get_zip_size(space);
1020
ulint page_no = recv_addr->page_no;
1022
+ /* By now we have replayed all DDL log records from the
1023
+ current batch. Check if the space ID is still valid in
1024
+ the entry being processed, and ignore it if it is not.*/
1025
+ if (fil_tablespace_deleted_or_being_deleted_in_mem(space, -1)) {
1027
+ ut_a(recv_sys->n_addrs);
1029
+ recv_addr->state = RECV_PROCESSED;
1030
+ recv_sys->n_addrs--;
1034
if (recv_addr->state == RECV_NOT_PROCESSED) {
1036
ut_print_timestamp(stderr);
1037
@@ -1795,7 +1816,7 @@
1039
mutex_enter(&(recv_sys->mutex));
1043
recv_addr = HASH_GET_NEXT(addr_hash, recv_addr);
1046
@@ -2297,7 +2318,7 @@
965
1047
|| type == MLOG_FILE_RENAME
966
1048
|| type == MLOG_FILE_DELETE) {
1028
1110
contiguous_lsn = ut_uint64_align_down(recv_sys->scanned_lsn,
1029
@@ -3286,6 +3301,7 @@
1111
@@ -3286,6 +3313,7 @@
1030
1112
that the data dictionary tables will be free of any locks.
1031
1113
The data dictionary latch should guarantee that there is at
1032
1114
most one data dictionary transaction active at a time. */
1112
1194
--- a/storage/innodb_plugin/srv/srv0srv.c
1113
1195
+++ b/storage/innodb_plugin/srv/srv0srv.c
1196
@@ -374,6 +374,10 @@
1116
1198
UNIV_INTERN ulong srv_replication_delay = 0;
1118
1200
+UNIV_INTERN ibool srv_read_only = FALSE;
1119
1201
+UNIV_INTERN ibool srv_fake_write = FALSE;
1120
1202
+UNIV_INTERN ibool srv_apply_log_only = FALSE;
1203
+UNIV_INTERN ibool srv_backup_mode = FALSE;
1121
1204
/*-------------------------------------------*/
1122
1205
UNIV_INTERN ulong srv_n_spin_wait_rounds = 30;
1123
1206
UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500;
1124
@@ -1002,7 +1005,7 @@
1207
@@ -1002,7 +1006,7 @@
1127
1210
/* Initialize some INFORMATION SCHEMA internal structures */
1411
1494
UNIV_MEM_FREE(buf, n);
1499
AM_INIT_AUTOMAKE([1.9 tar-ustar])
1502
-AM_CONFIG_HEADER([include/config.h])
1503
+AC_CONFIG_HEADERS([include/config.h])
1505
# Request support for automake silent-rules if available.
1506
# Default to verbose output. One can use the configure-time