From c95ba183d2528ea33a04210d9f46dabde36e46e3 Mon Sep 17 00:00:00 2001 From: Sophist <3001893+Sophist-UK@users.noreply.github.com> Date: Thu, 21 Dec 2023 20:08:32 +0000 Subject: [PATCH 1/2] Replace incorrect message `mariadb-safe` with correct `mariadbd-safe` --- scripts/mysql_install_db.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index bfca263478b..3bc4d63b7df 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -657,7 +657,7 @@ then then echo echo "You can start the MariaDB daemon with:" - echo "cd '$basedir' ; $bindir/mariadb-safe --datadir='$ldata'" + echo "cd '$basedir' ; $bindir/mariadbd-safe --datadir='$ldata'" echo echo "You can test the MariaDB daemon with mysql-test-run.pl" echo "cd '$basedir/@INSTALL_MYSQLTESTDIR@' ; perl mariadb-test-run.pl" From 7573fe8b07c52fdd45eac3d4f0f764f1c61ca41e Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Fri, 19 Jan 2024 15:00:13 +0530 Subject: [PATCH 2/2] MDEV-32968 InnoDB fails to restore tablespace first page from doublewrite buffer when page is empty recv_dblwr_t::find_first_page(): Free the allocated memory to read the first 3 pages from tablespace. innodb.doublewrite: Added sleep to ensure page cleaner thread wake up from my_cond_wait --- mysql-test/suite/innodb/t/doublewrite.test | 3 +++ storage/innobase/log/log0recv.cc | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/innodb/t/doublewrite.test b/mysql-test/suite/innodb/t/doublewrite.test index 541e4d23a19..7e38851facb 100644 --- a/mysql-test/suite/innodb/t/doublewrite.test +++ b/mysql-test/suite/innodb/t/doublewrite.test @@ -39,6 +39,9 @@ commit work; SET GLOBAL innodb_fast_shutdown = 0; let $shutdown_timeout=; --source include/restart_mysqld.inc +# Ensure that buf_flush_page_cleaner() has woken up from its +# first my_cond_timedwait() and gone idle. +sleep 1; --source ../include/no_checkpoint_start.inc connect (dml,localhost,root,,); XA START 'x'; diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 52649419ec7..ffe35e9dbc7 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -3871,16 +3871,20 @@ uint32_t recv_dblwr_t::find_first_page(const char *name, pfs_os_file_t file) for (const page_t *page : pages) { uint32_t space_id= page_get_space_id(page); + byte *read_page= nullptr; if (page_get_page_no(page) > 0 || space_id == 0) + { next_page: + aligned_free(read_page); continue; + } uint32_t flags= mach_read_from_4( FSP_HEADER_OFFSET + FSP_SPACE_FLAGS + page); page_id_t page_id(space_id, 0); size_t page_size= fil_space_t::physical_size(flags); if (file_size < 4 * page_size) goto next_page; - byte *read_page= + read_page= static_cast(aligned_malloc(3 * page_size, page_size)); /* Read 3 pages from the file and match the space id with the space id which is stored in @@ -3892,7 +3896,10 @@ next_page: { byte *cur_page= read_page + j * page_size; if (buf_is_zeroes(span(cur_page, page_size))) - return 0; + { + space_id= 0; + goto early_exit; + } if (mach_read_from_4(cur_page + FIL_PAGE_OFFSET) != j + 1 || memcmp(cur_page + FIL_PAGE_SPACE_ID, page + FIL_PAGE_SPACE_ID, 4) || @@ -3900,7 +3907,11 @@ next_page: goto next_page; } if (!restore_first_page(space_id, name, file)) + { +early_exit: + aligned_free(read_page); return space_id; + } break; } }