From b18241e059c17d4ad533dac3729302aa0ef60345 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Tue, 29 Nov 2022 16:23:46 +0530 Subject: MDEV-30122 mariabackup.skip_innodb crashes when innodb_undo_tablespaces > 0 - Assign srv_undo_space_id_start when InnoDB opens extra unused InnoDB undo tablespaces in srv_all_undo_tablespaces_open(). Mariabackup can detect the undo tablespaces using srv_undo_space_id_start variable --- mysql-test/suite/mariabackup/skip_innodb.test | 3 ++- storage/innobase/srv/srv0start.cc | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/mariabackup/skip_innodb.test b/mysql-test/suite/mariabackup/skip_innodb.test index 14e4bc007f6..25495b308b0 100644 --- a/mysql-test/suite/mariabackup/skip_innodb.test +++ b/mysql-test/suite/mariabackup/skip_innodb.test @@ -1,3 +1,4 @@ +--source include/innodb_undo_tablespaces.inc let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; CREATE TABLE t(i int); INSERT INTO t VALUES(1); @@ -9,4 +10,4 @@ exec $XTRABACKUP --prepare --target-dir=$targetdir; SELECT * from t; DROP TABLE t; -rmdir $targetdir; \ No newline at end of file +rmdir $targetdir; diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 364775207e0..60b1a06e9ca 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -817,9 +817,11 @@ static dberr_t srv_all_undo_tablespaces_open(bool create_new_undo, { char name[OS_FILE_MAX_PATH]; snprintf(name, sizeof name, "%s/undo%03u", srv_undo_dir, i); - if (!srv_undo_tablespace_open(create_new_undo, name, i)) + uint32_t space_id= srv_undo_tablespace_open(create_new_undo, name, i); + if (!space_id) break; - ++srv_undo_tablespaces_open; + if (0 == srv_undo_tablespaces_open++) + srv_undo_space_id_start= space_id; } return DB_SUCCESS; -- cgit v1.2.1