summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2022-12-02 11:54:35 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2022-12-02 15:48:37 +0530
commitdd20a43c6cb59a2ba69124cf51e22e08ca16f858 (patch)
treee3e43f6707a53666cf19078b5d9e92b58efae00e
parent7487c313bc1d6ce1a525002745105bd076f4fcba (diff)
downloadmariadb-git-dd20a43c6cb59a2ba69124cf51e22e08ca16f858.tar.gz
MDEV-30114 Incremental prepare fails when innodb_undo_tablespaces > 0
- Mariabackup fails to open the undo tablespaces while applying delta files to the corresponding data file. Mariabackup opens the undo tablespaces first time in srv_undo_tablespaces_init() and does tries to open the undo tablespaces in xtrabackup_apply_deltas() with conflicting mode and leads to the failure. - Mariabackup should close the undo tablespaces before applying the incremental delta files.
-rw-r--r--extra/mariabackup/xtrabackup.cc20
-rw-r--r--mysql-test/suite/mariabackup/apply-log-only-incr.test1
-rw-r--r--mysql-test/suite/mariabackup/incremental_backup.test1
-rw-r--r--mysql-test/suite/mariabackup/incremental_compressed.test1
-rw-r--r--mysql-test/suite/mariabackup/incremental_ddl_before_backup.test1
-rw-r--r--mysql-test/suite/mariabackup/incremental_ddl_during_backup.test1
-rw-r--r--mysql-test/suite/mariabackup/incremental_encrypted.test1
-rw-r--r--mysql-test/suite/mariabackup/incremental_newdb_while_backup.test1
-rw-r--r--mysql-test/suite/mariabackup/log_page_corruption.test1
-rw-r--r--mysql-test/suite/mariabackup/unsupported_redo.test1
-rw-r--r--mysql-test/suite/mariabackup/xb_partition.test1
11 files changed, 30 insertions, 0 deletions
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index 3f7dec5ceda..d41321e9bb9 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -3799,6 +3799,21 @@ func_exit:
return error;
}
+/** Close all undo tablespaces while applying incremental delta */
+static void xb_close_undo_tablespaces()
+{
+ if (srv_undo_space_id_start == 0)
+ return;
+ for (ulint space_id= srv_undo_space_id_start;
+ space_id < srv_undo_space_id_start + srv_undo_tablespaces_open;
+ space_id++)
+ {
+ fil_space_t *space= fil_space_get(space_id);
+ ut_ad(space);
+ space->close();
+ }
+}
+
/****************************************************************************
Populates the tablespace memory cache by scanning for and opening data files.
@returns DB_SUCCESS or error code.*/
@@ -3861,6 +3876,11 @@ xb_load_tablespaces()
if (err != DB_SUCCESS) {
return(err);
}
+
+ if (srv_operation == SRV_OPERATION_RESTORE_DELTA) {
+ xb_close_undo_tablespaces();
+ }
+
DBUG_MARIABACKUP_EVENT("after_load_tablespaces", 0);
return(DB_SUCCESS);
}
diff --git a/mysql-test/suite/mariabackup/apply-log-only-incr.test b/mysql-test/suite/mariabackup/apply-log-only-incr.test
index c2d23c88a3e..b110d12540e 100644
--- a/mysql-test/suite/mariabackup/apply-log-only-incr.test
+++ b/mysql-test/suite/mariabackup/apply-log-only-incr.test
@@ -1,4 +1,5 @@
--source include/have_innodb.inc
+--source include/innodb_undo_tablespaces.inc
call mtr.add_suppression("InnoDB: New log files created");
diff --git a/mysql-test/suite/mariabackup/incremental_backup.test b/mysql-test/suite/mariabackup/incremental_backup.test
index ddcdae4637a..7f4bdc8bff0 100644
--- a/mysql-test/suite/mariabackup/incremental_backup.test
+++ b/mysql-test/suite/mariabackup/incremental_backup.test
@@ -1,5 +1,6 @@
--source include/have_aria.inc
--source include/innodb_page_size.inc
+--source include/innodb_undo_tablespaces.inc
# see suite.pm "check for exact values, in case the default changes to be small everywhere"
if (`select @@max_binlog_stmt_cache_size = 4294963200 and @@innodb_page_size = 65536`) {
diff --git a/mysql-test/suite/mariabackup/incremental_compressed.test b/mysql-test/suite/mariabackup/incremental_compressed.test
index 32607d57174..15aff909a43 100644
--- a/mysql-test/suite/mariabackup/incremental_compressed.test
+++ b/mysql-test/suite/mariabackup/incremental_compressed.test
@@ -1,5 +1,6 @@
--source include/have_innodb.inc
--source include/have_partition.inc
+--source include/innodb_undo_tablespaces.inc
let $basedir=$MYSQLTEST_VARDIR/tmp/backup;
let $incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1;
diff --git a/mysql-test/suite/mariabackup/incremental_ddl_before_backup.test b/mysql-test/suite/mariabackup/incremental_ddl_before_backup.test
index f243ac1acd9..6d34166d7b5 100644
--- a/mysql-test/suite/mariabackup/incremental_ddl_before_backup.test
+++ b/mysql-test/suite/mariabackup/incremental_ddl_before_backup.test
@@ -1,4 +1,5 @@
--source include/have_debug.inc
+--source include/innodb_undo_tablespaces.inc
call mtr.add_suppression("InnoDB: New log files created");
diff --git a/mysql-test/suite/mariabackup/incremental_ddl_during_backup.test b/mysql-test/suite/mariabackup/incremental_ddl_during_backup.test
index ebdb2137523..d90ee1566a8 100644
--- a/mysql-test/suite/mariabackup/incremental_ddl_during_backup.test
+++ b/mysql-test/suite/mariabackup/incremental_ddl_during_backup.test
@@ -1,4 +1,5 @@
--source include/have_debug.inc
+--source include/innodb_undo_tablespaces.inc
call mtr.add_suppression("InnoDB: New log files created");
diff --git a/mysql-test/suite/mariabackup/incremental_encrypted.test b/mysql-test/suite/mariabackup/incremental_encrypted.test
index e618ac4f79e..d5570f20006 100644
--- a/mysql-test/suite/mariabackup/incremental_encrypted.test
+++ b/mysql-test/suite/mariabackup/incremental_encrypted.test
@@ -1,4 +1,5 @@
--source include/innodb_page_size.inc
+--source include/innodb_undo_tablespaces.inc
if (!$EXAMPLE_KEY_MANAGEMENT_SO)
{
diff --git a/mysql-test/suite/mariabackup/incremental_newdb_while_backup.test b/mysql-test/suite/mariabackup/incremental_newdb_while_backup.test
index c4695edb845..6bd69712ed7 100644
--- a/mysql-test/suite/mariabackup/incremental_newdb_while_backup.test
+++ b/mysql-test/suite/mariabackup/incremental_newdb_while_backup.test
@@ -1,5 +1,6 @@
--source include/have_innodb.inc
--source include/have_debug.inc
+--source include/innodb_undo_tablespaces.inc
call mtr.add_suppression("InnoDB: New log files created");
diff --git a/mysql-test/suite/mariabackup/log_page_corruption.test b/mysql-test/suite/mariabackup/log_page_corruption.test
index e14735fd024..0bffb406b7e 100644
--- a/mysql-test/suite/mariabackup/log_page_corruption.test
+++ b/mysql-test/suite/mariabackup/log_page_corruption.test
@@ -1,5 +1,6 @@
--source include/have_debug.inc
--source include/no_valgrind_without_big.inc
+--source include/innodb_undo_tablespaces.inc
--echo ########
--echo # Test for generating "innodb_corrupted_pages" file during full and
diff --git a/mysql-test/suite/mariabackup/unsupported_redo.test b/mysql-test/suite/mariabackup/unsupported_redo.test
index b9456751b9c..3dd5fd0db47 100644
--- a/mysql-test/suite/mariabackup/unsupported_redo.test
+++ b/mysql-test/suite/mariabackup/unsupported_redo.test
@@ -1,4 +1,5 @@
--source include/have_innodb.inc
+--source include/innodb_undo_tablespaces.inc
call mtr.add_suppression("InnoDB: New log files created");
call mtr.add_suppression("InnoDB: Operating system error number .* in a file operation");
call mtr.add_suppression("InnoDB: The error means the system cannot find the path specified");
diff --git a/mysql-test/suite/mariabackup/xb_partition.test b/mysql-test/suite/mariabackup/xb_partition.test
index 3d027b67fc1..1c8eeaa19e6 100644
--- a/mysql-test/suite/mariabackup/xb_partition.test
+++ b/mysql-test/suite/mariabackup/xb_partition.test
@@ -1,5 +1,6 @@
#--source include/innodb_page_size.inc
--source include/have_partition.inc
+--source include/innodb_undo_tablespaces.inc
CREATE TABLE t1(a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1), (2), (3);