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.
parent 7487c313
......@@ -3799,6 +3799,21 @@ static dberr_t xb_assign_undo_space_start()
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);
}
......
--source include/have_innodb.inc
--source include/innodb_undo_tablespaces.inc
call mtr.add_suppression("InnoDB: New log files created");
......
--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`) {
......
--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;
......
--source include/have_debug.inc
--source include/innodb_undo_tablespaces.inc
call mtr.add_suppression("InnoDB: New log files created");
......
--source include/have_debug.inc
--source include/innodb_undo_tablespaces.inc
call mtr.add_suppression("InnoDB: New log files created");
......
--source include/innodb_page_size.inc
--source include/innodb_undo_tablespaces.inc
if (!$EXAMPLE_KEY_MANAGEMENT_SO)
{
......
--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");
......
--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
......
--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");
......
#--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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment