From aa35f62f1c9b7cba0720d250a86294d686f8eb99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 13 Jan 2025 10:41:40 +0200 Subject: [PATCH] MDEV-35810 Missing error handling in log resizing log_t::resize_start(): If the ib_logfile101 cannot be created, be sure to reset log_sys.resize_lsn. log_t::resize_abort(): In case SET GLOBAL innodb_log_file_size is aborted, delete the ib_logfile101. --- mysql-test/include/mtr_check.sql | 1 + .../suite/innodb/r/log_file_size_online.result | 8 +++++++- mysql-test/suite/innodb/t/log_file_size_online.test | 12 +++++++++++- storage/innobase/log/log0log.cc | 4 +++- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/mysql-test/include/mtr_check.sql b/mysql-test/include/mtr_check.sql index 5d73d1f59f1..360f7b40bb8 100644 --- a/mysql-test/include/mtr_check.sql +++ b/mysql-test/include/mtr_check.sql @@ -31,6 +31,7 @@ BEGIN WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' + AND variable_name != 'INNODB_LOG_FILE_BUFFERING' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' diff --git a/mysql-test/suite/innodb/r/log_file_size_online.result b/mysql-test/suite/innodb/r/log_file_size_online.result index 7b2b23bd776..8dcd9a47b2f 100644 --- a/mysql-test/suite/innodb/r/log_file_size_online.result +++ b/mysql-test/suite/innodb/r/log_file_size_online.result @@ -25,8 +25,14 @@ SET GLOBAL innodb_log_file_buffering=ON; SET GLOBAL innodb_log_file_buffering=@save; SET GLOBAL innodb_log_file_mmap=OFF; Got one of the listed errors -SET GLOBAL innodb_log_file_size=5242880; connect con1,localhost,root; +SET GLOBAL innodb_log_file_size=7340032; +connection default; +KILL QUERY @id; +connection con1; +connection default; +SET GLOBAL innodb_log_file_size=5242880; +connection con1; UPDATE t SET b='' WHERE a<10; connection default; SHOW VARIABLES LIKE 'innodb_log_file_size'; diff --git a/mysql-test/suite/innodb/t/log_file_size_online.test b/mysql-test/suite/innodb/t/log_file_size_online.test index bf9f3510592..fb6722ee8d7 100644 --- a/mysql-test/suite/innodb/t/log_file_size_online.test +++ b/mysql-test/suite/innodb/t/log_file_size_online.test @@ -36,9 +36,19 @@ SET GLOBAL innodb_log_file_buffering=@save; --error ER_INCORRECT_GLOBAL_LOCAL_VAR,ER_UNKNOWN_SYSTEM_VARIABLE SET GLOBAL innodb_log_file_mmap=OFF; +--connect con1,localhost,root +let $ID= `SELECT @id := CONNECTION_ID()`; +send SET GLOBAL innodb_log_file_size=7340032; +--connection default +let $ignore= `SELECT @id := $ID`; +KILL QUERY @id; +--connection con1 +reap; + +--connection default send SET GLOBAL innodb_log_file_size=5242880; ---connect con1,localhost,root +--connection con1 send UPDATE t SET b='' WHERE a<10; --connection default diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index e2f26f0dcad..0e9d4c9ad45 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -663,9 +663,9 @@ log_t::resize_start_status log_t::resize_start(os_offset_t size) noexcept writer_update(); } - resize_lsn.store(start_lsn, std::memory_order_relaxed); status= success ? RESIZE_STARTED : RESIZE_FAILED; } + resize_lsn.store(start_lsn, std::memory_order_relaxed); } log_resize_release(); @@ -715,6 +715,8 @@ void log_t::resize_abort() noexcept resize_buf= nullptr; resize_target= 0; resize_lsn.store(0, std::memory_order_relaxed); + std::string path{get_log_file_path("ib_logfile101")}; + IF_WIN(DeleteFile(path.c_str()), unlink(path.c_str())); } writer_update();