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.
This commit is contained in:
Marko Mäkelä 2025-01-13 10:41:40 +02:00
parent 4fc3a44bab
commit aa35f62f1c
4 changed files with 22 additions and 3 deletions

View file

@ -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'

View file

@ -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';

View file

@ -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

View file

@ -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();