summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2021-04-20 10:35:12 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2021-04-30 21:14:21 +0530
commitb2e9728fdc36bbfe001cc25bba4cf9e73e95024c (patch)
tree7de298b4ba00410d9faff59a17efb6e85f638f7d
parente95e0957edde947ac47f59ae6583db56307718bc (diff)
downloadmariadb-git-bb-10.6-MDEV-24626_1.tar.gz
MDEV-24626 Remove synchronous write of page0 and flushing filebb-10.6-MDEV-24626_1
during file creation Mariabackup copies the zero filled ibd file in backup_fix_ddl() as the extension of .new file. Mariabackup test case does page flushing when it deals with DDL operation during backup operation.
-rw-r--r--extra/mariabackup/fil_cur.cc5
-rw-r--r--extra/mariabackup/xtrabackup.cc66
-rw-r--r--mysql-test/suite/innodb/disabled.def1
-rw-r--r--mysql-test/suite/mariabackup/big_innodb_log.result1
-rw-r--r--mysql-test/suite/mariabackup/big_innodb_log.test1
-rw-r--r--mysql-test/suite/mariabackup/drop_table_during_backup.result1
-rw-r--r--mysql-test/suite/mariabackup/drop_table_during_backup.test2
-rw-r--r--mysql-test/suite/mariabackup/incremental_ddl_during_backup.result1
-rw-r--r--mysql-test/suite/mariabackup/incremental_ddl_during_backup.test2
-rw-r--r--mysql-test/suite/mariabackup/lock_ddl_per_table.result1
-rw-r--r--mysql-test/suite/mariabackup/lock_ddl_per_table.test4
-rw-r--r--mysql-test/suite/mariabackup/partial.result4
-rw-r--r--mysql-test/suite/mariabackup/partial.test1
-rw-r--r--mysql-test/suite/mariabackup/partial_exclude.result2
-rw-r--r--mysql-test/suite/mariabackup/partial_exclude.test1
-rw-r--r--mysql-test/suite/mariabackup/recreate_table_during_backup.result1
-rw-r--r--mysql-test/suite/mariabackup/recreate_table_during_backup.test1
-rw-r--r--mysql-test/suite/mariabackup/rename_during_backup.result1
-rw-r--r--mysql-test/suite/mariabackup/rename_during_backup.test2
-rw-r--r--mysql-test/suite/mariabackup/rename_during_mdl_lock.result1
-rw-r--r--mysql-test/suite/mariabackup/rename_during_mdl_lock.test1
-rw-r--r--mysql-test/suite/mariabackup/unsupported_redo.result4
-rw-r--r--mysql-test/suite/mariabackup/unsupported_redo.test1
-rw-r--r--storage/innobase/include/fil0fil.h13
-rw-r--r--storage/innobase/log/log0recv.cc10
25 files changed, 99 insertions, 29 deletions
diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc
index 99aeb45ccd1..1b526072ed6 100644
--- a/extra/mariabackup/fil_cur.cc
+++ b/extra/mariabackup/fil_cur.cc
@@ -374,6 +374,7 @@ xb_fil_cur_result_t xb_fil_cur_read(xb_fil_cur_t* cursor,
ib_int64_t offset;
ib_int64_t to_read;
const ulint page_size = cursor->page_size;
+ bool defer = false;
xb_ad(!cursor->is_system() || page_size == srv_page_size);
cursor->read_filter->get_next_batch(&cursor->read_filter_ctxt,
@@ -428,13 +429,15 @@ read_retry:
ret = XB_FIL_CUR_ERROR;
goto func_exit;
}
+
+ defer = space->is_deferred();
/* check pages for corruption and re-read if necessary. i.e. in case of
partially written pages */
for (page = cursor->buf, i = 0; i < npages;
page += page_size, i++) {
unsigned page_no = cursor->buf_page_no + i;
- if (page_is_corrupted(page, page_no, cursor, space)){
+ if (!defer && page_is_corrupted(page, page_no, cursor, space)) {
retry_count--;
if (retry_count == 0) {
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index 8894544be10..74ba7b7604a 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -510,7 +510,8 @@ bool CorruptedPages::empty() const
}
static void xb_load_single_table_tablespace(const std::string &space_name,
- bool set_size);
+ bool set_size,
+ ulint defer_space_id=0);
static void xb_data_files_close();
static fil_space_t* fil_space_get_by_name(const char* name);
@@ -587,7 +588,8 @@ xtrabackup_add_datasink(ds_ctxt_t *ds)
typedef void (*process_single_tablespace_func_t)(const char *dirname,
const char *filname,
bool is_remote,
- bool skip_node_page0);
+ bool skip_node_page0,
+ ulint defer_space_id);
static dberr_t enumerate_ibd_files(process_single_tablespace_func_t callback);
/* ======== Datafiles iterator ======== */
@@ -1680,7 +1682,8 @@ debug_sync_point(const char *name)
static std::set<std::string> tables_for_export;
static void append_export_table(const char *dbname, const char *tablename,
- bool is_remote, bool skip_node_page0)
+ bool is_remote, bool skip_node_page0,
+ ulint defer_space_id)
{
if(dbname && tablename && !is_remote)
{
@@ -2719,7 +2722,6 @@ xb_get_copy_action(const char *dflt)
return(action);
}
-
/** Copy innodb data file to the specified destination.
@param[in] node file node of a tablespace
@@ -3275,11 +3277,14 @@ xb_fil_io_init()
node page0 will be read, and it's size and free pages limit
will be set from page 0, what is neccessary for checking and fixing corrupted
pages.
+@param[in] defer_space_id use the space id to create space object
+when there is deferred tablespace
*/
static void xb_load_single_table_tablespace(const char *dirname,
const char *filname,
bool is_remote,
- bool skip_node_page0)
+ bool skip_node_page0,
+ ulint defer_space_id)
{
ut_ad(srv_operation == SRV_OPERATION_BACKUP
|| srv_operation == SRV_OPERATION_RESTORE_DELTA
@@ -3302,6 +3307,7 @@ static void xb_load_single_table_tablespace(const char *dirname,
lsn_t flush_lsn;
dberr_t err;
fil_space_t *space;
+ bool defer = false;
name = static_cast<char*>(ut_malloc_nokey(pathlen));
@@ -3334,6 +3340,22 @@ static void xb_load_single_table_tablespace(const char *dirname,
for (int i = 0; i < 10; i++) {
err = file->validate_first_page(&flush_lsn);
+
+ if (file->is_defer()) {
+
+ if (defer_space_id) {
+ defer = true;
+ file->set_space_id(defer_space_id);
+ file->set_flags(FSP_FLAGS_PAGE_SSIZE());
+ err = DB_SUCCESS;
+ break;
+ }
+
+ delete file;
+ ut_free(name);
+ return;
+ }
+
if (err != DB_CORRUPTION) {
break;
}
@@ -3349,9 +3371,11 @@ static void xb_load_single_table_tablespace(const char *dirname,
FIL_TYPE_TABLESPACE, NULL/* TODO: crypt_data */);
ut_a(space != NULL);
- space->add(file->filepath(),
- skip_node_page0 ? file->detach() : pfs_os_file_t(),
- 0, false, false);
+ fil_node_t* node= space->add(
+ file->filepath(),
+ skip_node_page0 ? file->detach() : pfs_os_file_t(),
+ 0, false, false);
+ node->set_deferred(defer);
mysql_mutex_lock(&fil_system.mutex);
space->read_page0();
mysql_mutex_unlock(&fil_system.mutex);
@@ -3372,7 +3396,8 @@ static void xb_load_single_table_tablespace(const char *dirname,
}
static void xb_load_single_table_tablespace(const std::string &space_name,
- bool skip_node_page0)
+ bool skip_node_page0,
+ ulint defer_space_id)
{
std::string name(space_name);
bool is_remote= access((name + ".ibd").c_str(), R_OK) != 0;
@@ -3390,7 +3415,7 @@ static void xb_load_single_table_tablespace(const std::string &space_name,
*p= 0;
const char *tablename= p + 1;
xb_load_single_table_tablespace(dbname, tablename, is_remote,
- skip_node_page0);
+ skip_node_page0, defer_space_id);
}
/** Scan the database directories under the MySQL datadir, looking for
@@ -3434,7 +3459,7 @@ static dberr_t enumerate_ibd_files(process_single_tablespace_func_t callback)
bool is_ibd = !is_isl && ends_with(dbinfo.name,".ibd");
if (is_isl || is_ibd) {
- (*callback)(NULL, dbinfo.name, is_isl, false);
+ (*callback)(NULL, dbinfo.name, is_isl, false, 0);
}
}
@@ -3490,7 +3515,7 @@ static dberr_t enumerate_ibd_files(process_single_tablespace_func_t callback)
if (strlen(fileinfo.name) > 4) {
bool is_isl= false;
if (ends_with(fileinfo.name, ".ibd") || ((is_isl = ends_with(fileinfo.name, ".isl"))))
- (*callback)(dbinfo.name, fileinfo.name, is_isl, false);
+ (*callback)(dbinfo.name, fileinfo.name, is_isl, false, 0);
}
}
@@ -4550,7 +4575,6 @@ fail_before_log_copying_thread_start:
return(true);
}
-
/**
This function handles DDL changes at the end of backup, under protection of
FTWRL. This ensures consistent backup in presence of DDL.
@@ -4571,9 +4595,9 @@ FTWRL. This ensures consistent backup in presence of DDL.
*/
void backup_fix_ddl(CorruptedPages &corrupted_pages)
{
- std::set<std::string> new_tables;
std::set<std::string> dropped_tables;
std::map<std::string, std::string> renamed_tables;
+ space_id_to_name_t new_tables;
/* Disable further DDL on backed up tables (only needed for --no-lock).*/
pthread_mutex_lock(&backup_mutex);
@@ -4623,7 +4647,7 @@ void backup_fix_ddl(CorruptedPages &corrupted_pages)
if (ddl_tracker.drops.find(id) == ddl_tracker.drops.end()) {
dropped_tables.erase(name);
- new_tables.insert(name);
+ new_tables[id] = name;
if (opt_log_innodb_page_corruption)
corrupted_pages.drop_space(id);
}
@@ -4665,12 +4689,15 @@ void backup_fix_ddl(CorruptedPages &corrupted_pages)
}
DBUG_EXECUTE_IF("check_mdl_lock_works", DBUG_ASSERT(new_tables.size() == 0););
- for (std::set<std::string>::iterator iter = new_tables.begin();
- iter != new_tables.end(); iter++) {
- const char *space_name = iter->c_str();
+
+ for(space_id_to_name_t::iterator iter = new_tables.begin();
+ iter != new_tables.end(); iter++) {
+ const char *space_name = iter->second.c_str();
if (check_if_skip_table(space_name))
continue;
- xb_load_single_table_tablespace(*iter, false);
+
+ xb_load_single_table_tablespace(
+ iter->second, false, iter->first);
}
datafiles_iter_t it2;
@@ -4681,6 +4708,7 @@ void backup_fix_ddl(CorruptedPages &corrupted_pages)
std::string dest_name= filename_to_spacename(
node->name, strlen(node->name));
dest_name.append(".new");
+
xtrabackup_copy_datafile(node, 0, dest_name.c_str(), wf_write_through,
corrupted_pages);
}
diff --git a/mysql-test/suite/innodb/disabled.def b/mysql-test/suite/innodb/disabled.def
index 35c941f8af7..adc9aa27fc1 100644
--- a/mysql-test/suite/innodb/disabled.def
+++ b/mysql-test/suite/innodb/disabled.def
@@ -11,3 +11,4 @@
##############################################################################
create-index-debug : MDEV-13680 InnoDB may crash when btr_page_alloc() fails
+log_file_name : MDEV-24626 Remove synchronous write of page0 and flushing file during file creation
diff --git a/mysql-test/suite/mariabackup/big_innodb_log.result b/mysql-test/suite/mariabackup/big_innodb_log.result
index 7bd5d20049d..b9b6b6afce3 100644
--- a/mysql-test/suite/mariabackup/big_innodb_log.result
+++ b/mysql-test/suite/mariabackup/big_innodb_log.result
@@ -12,6 +12,7 @@ INSERT INTO t VALUES
(0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
(0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
(0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
+set global innodb_log_checkpoint_now = 1;
# xtrabackup backup, execute the following query after test.t is copied:
# BEGIN NOT ATOMIC INSERT INTO test.t SELECT * FROM test.t; UPDATE test.t SET i = 10 WHERE i = 0; DELETE FROM test.t WHERE i = 1; END
SELECT count(*) FROM t WHERE i = 0;
diff --git a/mysql-test/suite/mariabackup/big_innodb_log.test b/mysql-test/suite/mariabackup/big_innodb_log.test
index 4a87ecb18fe..247e7179c42 100644
--- a/mysql-test/suite/mariabackup/big_innodb_log.test
+++ b/mysql-test/suite/mariabackup/big_innodb_log.test
@@ -32,6 +32,7 @@ INSERT INTO t VALUES
(0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
(0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
+set global innodb_log_checkpoint_now = 1;
--let after_copy_test_t=BEGIN NOT ATOMIC INSERT INTO test.t SELECT * FROM test.t; UPDATE test.t SET i = 10 WHERE i = 0; DELETE FROM test.t WHERE i = 1; END
--echo # xtrabackup backup, execute the following query after test.t is copied:
diff --git a/mysql-test/suite/mariabackup/drop_table_during_backup.result b/mysql-test/suite/mariabackup/drop_table_during_backup.result
index a0fa9db5b94..dfcde706ba8 100644
--- a/mysql-test/suite/mariabackup/drop_table_during_backup.result
+++ b/mysql-test/suite/mariabackup/drop_table_during_backup.result
@@ -3,6 +3,7 @@ CREATE TABLE t2 (i int) ENGINE=INNODB;
CREATE TABLE t3 (i int) ENGINE=INNODB;
CREATE TABLE t4 (i int) ENGINE=INNODB;
CREATE TABLE t5 (i int) ENGINE=INNODB;
+set global innodb_log_checkpoint_now=1;
# xtrabackup prepare
# shutdown server
# remove datadir
diff --git a/mysql-test/suite/mariabackup/drop_table_during_backup.test b/mysql-test/suite/mariabackup/drop_table_during_backup.test
index e3a81b77b71..2ac82945ffe 100644
--- a/mysql-test/suite/mariabackup/drop_table_during_backup.test
+++ b/mysql-test/suite/mariabackup/drop_table_during_backup.test
@@ -6,6 +6,8 @@ CREATE TABLE t3 (i int) ENGINE=INNODB;
CREATE TABLE t4 (i int) ENGINE=INNODB;
CREATE TABLE t5 (i int) ENGINE=INNODB;
+set global innodb_log_checkpoint_now=1;
+
--let before_copy_test_t1=DROP TABLE test.t1
--let after_copy_test_t2=DROP TABLE test.t2;
# MDEV-18185, drop + rename combination
diff --git a/mysql-test/suite/mariabackup/incremental_ddl_during_backup.result b/mysql-test/suite/mariabackup/incremental_ddl_during_backup.result
index 33a3b0001a1..ab5f237b2a9 100644
--- a/mysql-test/suite/mariabackup/incremental_ddl_during_backup.result
+++ b/mysql-test/suite/mariabackup/incremental_ddl_during_backup.result
@@ -3,6 +3,7 @@ CREATE TABLE t1(i INT PRIMARY KEY) ENGINE INNODB;
CREATE TABLE t2(i INT PRIMARY KEY) ENGINE INNODB;
CREATE TABLE t3(i INT) ENGINE INNODB;
CREATE TABLE t10(i INT PRIMARY KEY) ENGINE INNODB;
+set global innodb_log_checkpoint_now = 1;
# Create full backup , modify table, then create incremental/differential backup
INSERT into t1 values(1);
# Prepare full backup, apply incremental one
diff --git a/mysql-test/suite/mariabackup/incremental_ddl_during_backup.test b/mysql-test/suite/mariabackup/incremental_ddl_during_backup.test
index ebdb2137523..d7ba15c28ae 100644
--- a/mysql-test/suite/mariabackup/incremental_ddl_during_backup.test
+++ b/mysql-test/suite/mariabackup/incremental_ddl_during_backup.test
@@ -10,6 +10,8 @@ CREATE TABLE t2(i INT PRIMARY KEY) ENGINE INNODB;
CREATE TABLE t3(i INT) ENGINE INNODB;
CREATE TABLE t10(i INT PRIMARY KEY) ENGINE INNODB;
+set global innodb_log_checkpoint_now = 1;
+
echo # Create full backup , modify table, then create incremental/differential backup;
--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir;
diff --git a/mysql-test/suite/mariabackup/lock_ddl_per_table.result b/mysql-test/suite/mariabackup/lock_ddl_per_table.result
index 434b6852530..c1b28e46071 100644
--- a/mysql-test/suite/mariabackup/lock_ddl_per_table.result
+++ b/mysql-test/suite/mariabackup/lock_ddl_per_table.result
@@ -7,5 +7,6 @@ PARTITION p1 VALUES LESS THAN (1995),
PARTITION p2 VALUES LESS THAN (2000),
PARTITION p3 VALUES LESS THAN (2005)
) ;
+set global innodb_log_checkpoint_now = 1;
DROP TABLE t;
DROP TABLE `bobby``tables`;
diff --git a/mysql-test/suite/mariabackup/lock_ddl_per_table.test b/mysql-test/suite/mariabackup/lock_ddl_per_table.test
index 2689508e554..18c207718b5 100644
--- a/mysql-test/suite/mariabackup/lock_ddl_per_table.test
+++ b/mysql-test/suite/mariabackup/lock_ddl_per_table.test
@@ -13,9 +13,11 @@ CREATE TABLE `bobby``tables` (id INT, name VARCHAR(50), purchased DATE) ENGINE I
PARTITION p3 VALUES LESS THAN (2005)
) ;
+set global innodb_log_checkpoint_now = 1;
+
--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --lock-ddl-per-table=1 --dbug=+d,check_mdl_lock_works;
--enable_result_log
DROP TABLE t;
DROP TABLE `bobby``tables`;
-rmdir $targetdir; \ No newline at end of file
+rmdir $targetdir;
diff --git a/mysql-test/suite/mariabackup/partial.result b/mysql-test/suite/mariabackup/partial.result
index 8ccc8f6a6c7..981bef4e40c 100644
--- a/mysql-test/suite/mariabackup/partial.result
+++ b/mysql-test/suite/mariabackup/partial.result
@@ -4,8 +4,8 @@ CREATE TABLE t21(i INT) ENGINE INNODB;
INSERT INTO t21 VALUES(1);
CREATE TABLE t2(i int) ENGINE INNODB;
# xtrabackup backup
-t1.ibd
-t21.ibd
+t1.new
+t21.new
# xtrabackup prepare
t1.cfg
t21.cfg
diff --git a/mysql-test/suite/mariabackup/partial.test b/mysql-test/suite/mariabackup/partial.test
index 53388b1947f..d0d07daf2ea 100644
--- a/mysql-test/suite/mariabackup/partial.test
+++ b/mysql-test/suite/mariabackup/partial.test
@@ -17,6 +17,7 @@ let targetdir=$MYSQLTEST_VARDIR/tmp/backup;
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup "--tables=test.*1" --target-dir=$targetdir;
--enable_result_log
list_files $targetdir/test *.ibd;
+list_files $targetdir/test *.new;
# Inject a junk .ibd file into backup dir to
# see if prepare does not choke on it.
diff --git a/mysql-test/suite/mariabackup/partial_exclude.result b/mysql-test/suite/mariabackup/partial_exclude.result
index 628613040e0..a31197b9e9d 100644
--- a/mysql-test/suite/mariabackup/partial_exclude.result
+++ b/mysql-test/suite/mariabackup/partial_exclude.result
@@ -9,7 +9,7 @@ USE db2;
CREATE TABLE t1(i INT) ENGINE INNODB;
USE test;
# xtrabackup backup
-t1.ibd
+t1.new
DROP TABLE t1;
DROP TABLE t2;
DROP DATABASE db2;
diff --git a/mysql-test/suite/mariabackup/partial_exclude.test b/mysql-test/suite/mariabackup/partial_exclude.test
index 99d14e58231..3642a2c6f46 100644
--- a/mysql-test/suite/mariabackup/partial_exclude.test
+++ b/mysql-test/suite/mariabackup/partial_exclude.test
@@ -27,6 +27,7 @@ exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup "--tables-ex
--enable_result_log
# check that only t1 table is in backup (t2 is excluded)
+list_files $targetdir/test *.new;
list_files $targetdir/test *.ibd;
# check that db2 database is not in the backup (excluded)
--error 1
diff --git a/mysql-test/suite/mariabackup/recreate_table_during_backup.result b/mysql-test/suite/mariabackup/recreate_table_during_backup.result
index 821f9301ab6..3e01312cd3f 100644
--- a/mysql-test/suite/mariabackup/recreate_table_during_backup.result
+++ b/mysql-test/suite/mariabackup/recreate_table_during_backup.result
@@ -2,6 +2,7 @@ CREATE TABLE t1(i int) ENGINE=INNODB;
CREATE TABLE t2(i int) ENGINE=INNODB;
CREATE TABLE t3(a CHAR(36)) ENGINE INNODB;
INSERT INTO t3 SELECT UUID() FROM seq_1_to_1000;
+set global innodb_log_checkpoint_now=1;
# xtrabackup backup
# xtrabackup prepare
# shutdown server
diff --git a/mysql-test/suite/mariabackup/recreate_table_during_backup.test b/mysql-test/suite/mariabackup/recreate_table_during_backup.test
index c3c9cf5aeef..1feb2c5c8b3 100644
--- a/mysql-test/suite/mariabackup/recreate_table_during_backup.test
+++ b/mysql-test/suite/mariabackup/recreate_table_during_backup.test
@@ -7,6 +7,7 @@ CREATE TABLE t2(i int) ENGINE=INNODB;
CREATE TABLE t3(a CHAR(36)) ENGINE INNODB;
INSERT INTO t3 SELECT UUID() FROM seq_1_to_1000;
+set global innodb_log_checkpoint_now=1;
# this will table and populate it, after backup has list of tables to be copied
--let before_copy_test_t1=BEGIN NOT ATOMIC DROP TABLE test.t1;CREATE TABLE test.t1 ENGINE=INNODB SELECT UUID() from test.seq_1_to_100; END
--let after_copy_test_t2=BEGIN NOT ATOMIC DROP TABLE test.t2;CREATE TABLE test.t2 ENGINE=INNODB SELECT UUID() from test.seq_1_to_1000; END
diff --git a/mysql-test/suite/mariabackup/rename_during_backup.result b/mysql-test/suite/mariabackup/rename_during_backup.result
index ba1dbec0e1b..e071b6b2e21 100644
--- a/mysql-test/suite/mariabackup/rename_during_backup.result
+++ b/mysql-test/suite/mariabackup/rename_during_backup.result
@@ -14,6 +14,7 @@ CREATE TABLE a1(a1 int) ENGINE INNODB;
INSERT INTO a1 VALUES(1);
CREATE TABLE b1(b1 CHAR(2)) ENGINE INNODB;
INSERT INTO b1 VALUES('b1');
+set global innodb_log_checkpoint_now = 1;
# xtrabackup prepare
# shutdown server
# remove datadir
diff --git a/mysql-test/suite/mariabackup/rename_during_backup.test b/mysql-test/suite/mariabackup/rename_during_backup.test
index 238a8b1985c..d8e40b28941 100644
--- a/mysql-test/suite/mariabackup/rename_during_backup.test
+++ b/mysql-test/suite/mariabackup/rename_during_backup.test
@@ -24,6 +24,8 @@ INSERT INTO a1 VALUES(1);
CREATE TABLE b1(b1 CHAR(2)) ENGINE INNODB;
INSERT INTO b1 VALUES('b1');
+set global innodb_log_checkpoint_now = 1;
+
# Test renames before of after copying tablespaces
--let before_copy_test_t1=RENAME TABLE test.t1 TO test.t1_renamed
--let after_copy_test_t2=RENAME TABLE test.t2 TO test.t2_renamed
diff --git a/mysql-test/suite/mariabackup/rename_during_mdl_lock.result b/mysql-test/suite/mariabackup/rename_during_mdl_lock.result
index 607460f4f05..074de33bb2f 100644
--- a/mysql-test/suite/mariabackup/rename_during_mdl_lock.result
+++ b/mysql-test/suite/mariabackup/rename_during_mdl_lock.result
@@ -1,4 +1,5 @@
CREATE TABLE t1(i int) ENGINE INNODB;
+set global innodb_log_checkpoint_now = 1;
# xtrabackup prepare
# shutdown server
# remove datadir
diff --git a/mysql-test/suite/mariabackup/rename_during_mdl_lock.test b/mysql-test/suite/mariabackup/rename_during_mdl_lock.test
index 6d22e0db4a7..212b7aabd69 100644
--- a/mysql-test/suite/mariabackup/rename_during_mdl_lock.test
+++ b/mysql-test/suite/mariabackup/rename_during_mdl_lock.test
@@ -2,6 +2,7 @@
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
mkdir $targetdir;
CREATE TABLE t1(i int) ENGINE INNODB;
+set global innodb_log_checkpoint_now = 1;
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --lock-ddl-per-table --dbug=+d,rename_during_mdl_lock_table;
echo # xtrabackup prepare;
diff --git a/mysql-test/suite/mariabackup/unsupported_redo.result b/mysql-test/suite/mariabackup/unsupported_redo.result
index fbad89be0ac..703ba6029a1 100644
--- a/mysql-test/suite/mariabackup/unsupported_redo.result
+++ b/mysql-test/suite/mariabackup/unsupported_redo.result
@@ -23,8 +23,8 @@ CREATE TABLE t2(i int) ENGINE INNODB;
ALTER TABLE t21 FORCE, ALGORITHM=INPLACE;
# Create partial backup (excluding table t21), Ignore the
# unsupported redo log for the table t21.
-t1.ibd
-t2.ibd
+t1.new
+t2.new
# Prepare the full backup
t1.ibd
t2.ibd
diff --git a/mysql-test/suite/mariabackup/unsupported_redo.test b/mysql-test/suite/mariabackup/unsupported_redo.test
index b9456751b9c..22787b7ca88 100644
--- a/mysql-test/suite/mariabackup/unsupported_redo.test
+++ b/mysql-test/suite/mariabackup/unsupported_redo.test
@@ -61,6 +61,7 @@ ALTER TABLE t21 FORCE, ALGORITHM=INPLACE;
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup "--tables-exclude=test.t21" --target-dir=$targetdir;
--enable_result_log
--list_files $targetdir/test *.ibd
+--list_files $targetdir/test *.new
--echo # Prepare the full backup
--disable_result_log
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index d266df50dda..67650583774 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -507,6 +507,8 @@ public:
/** @return whether the storage device is rotational (HDD, not SSD) */
inline bool is_rotational() const;
+ inline bool is_deferred() const;
+
/** Open each file. Never invoked on .ibd files.
@param create_new_db whether to skip the call to fil_node_t::read_page0()
@return whether all files were opened */
@@ -1129,7 +1131,7 @@ struct fil_node_t final
void set_deferred(bool val) { deferred= val; }
/** @retval whether the tablespace is deferred */
- bool is_deferred() { return deferred; }
+ bool is_deferred() const { return deferred; }
private:
/** Does stuff common for close() and detach() */
@@ -1155,6 +1157,15 @@ inline bool fil_space_t::is_rotational() const
return false;
}
+inline bool fil_space_t::is_deferred() const
+{
+ for (const fil_node_t *node= UT_LIST_GET_FIRST(chain); node;
+ node= UT_LIST_GET_NEXT(chain, node))
+ if (node->is_deferred())
+ return true;
+ return false;
+}
+
/** Common InnoDB file extensions */
enum ib_extention {
NO_EXT = 0,
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index 2dc2a2984a9..8bad9aceea4 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -608,9 +608,13 @@ private:
public:
bool add(uint32_t space, std::string f_name, lsn_t lsn)
{
- const defer_t defer= {lsn, f_name};
+ char *fil_path= fil_make_filepath(
+ NULL, {f_name.c_str(), strlen(f_name.c_str())},
+ IBD, false);
+ const defer_t defer= {lsn, fil_path};
std::pair<defer_map::iterator, bool> p= defers.insert(
defer_map::value_type(space, defer));
+ ut_free(fil_path);
if (p.second) return true;
if (p.first->second.lsn > defer.lsn) return false;
p.first->second= defer;
@@ -630,6 +634,8 @@ public:
return nullptr;
}
+ void clear() { defers.clear(); }
+
dberr_t reinit_all();
};
@@ -1120,7 +1126,7 @@ void recv_sys_t::close()
recv_spaces.clear();
renamed_spaces.clear();
mlog_init.clear();
-
+ deferred_spaces.clear();
close_files();
}