Skip to content

Commit

Permalink
MDEV-30114 Incremental prepare fails when innodb_undo_tablespaces > 0
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
Thirunarayanan committed Dec 2, 2022
1 parent 7487c31 commit dd20a43
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 0 deletions.
20 changes: 20 additions & 0 deletions extra/mariabackup/xtrabackup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.*/
Expand Down Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions mysql-test/suite/mariabackup/apply-log-only-incr.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
--source include/have_innodb.inc
--source include/innodb_undo_tablespaces.inc

call mtr.add_suppression("InnoDB: New log files created");

Expand Down
1 change: 1 addition & 0 deletions mysql-test/suite/mariabackup/incremental_backup.test
Original file line number Diff line number Diff line change
@@ -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`) {
Expand Down
1 change: 1 addition & 0 deletions mysql-test/suite/mariabackup/incremental_compressed.test
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
--source include/have_debug.inc
--source include/innodb_undo_tablespaces.inc

call mtr.add_suppression("InnoDB: New log files created");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
--source include/have_debug.inc
--source include/innodb_undo_tablespaces.inc

call mtr.add_suppression("InnoDB: New log files created");

Expand Down
1 change: 1 addition & 0 deletions mysql-test/suite/mariabackup/incremental_encrypted.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
--source include/innodb_page_size.inc
--source include/innodb_undo_tablespaces.inc

if (!$EXAMPLE_KEY_MANAGEMENT_SO)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -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");

Expand Down
1 change: 1 addition & 0 deletions mysql-test/suite/mariabackup/log_page_corruption.test
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions mysql-test/suite/mariabackup/unsupported_redo.test
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
1 change: 1 addition & 0 deletions mysql-test/suite/mariabackup/xb_partition.test
Original file line number Diff line number Diff line change
@@ -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);
Expand Down

0 comments on commit dd20a43

Please sign in to comment.