Commit ef9517eb authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-27268 Failed InnoDB initialization leaves garbage files behind

create_log_files(): Check log_set_capacity() before modifying
or creating any log files.

innobase_start_or_create_for_mysql(): If create_log_files()
fails and we were initializing a new database, delete the
system tablespace files before exiting.
parent 8bb55633
......@@ -14,7 +14,6 @@ WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND 1 /File .path.to.non-existent.*ib_logfile101: 'create' returned OS error \d+/ in mysqld.1.err
# Remove ibdata1 & ibdata2
# Successfully let InnoDB create tablespaces
SELECT COUNT(*) `1` FROM INFORMATION_SCHEMA.ENGINES
WHERE engine='innodb'
......
......@@ -67,9 +67,6 @@ eval $check_no_innodb;
let SEARCH_PATTERN=File .path.to.non-existent.*ib_logfile101: 'create' returned OS error \d+;
--source include/search_pattern_in_file.inc
--echo # Remove ibdata1 & ibdata2
--remove_file $bugdir/ibdata1
--remove_file $bugdir/ibdata2
--list_files $bugdir
--echo # Successfully let InnoDB create tablespaces
......
......@@ -3,7 +3,7 @@
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 2020, MariaDB Corporation.
Copyright (c) 2013, 2021, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
......@@ -426,6 +426,10 @@ create_log_files(
return(DB_READ_ONLY);
}
if (!log_set_capacity(srv_log_file_size_requested)) {
return(DB_ERROR);
}
/* Crashing after deleting the first file should be
recoverable. The buffer pool was clean, and we can simply
create all log files from the scratch. */
......@@ -482,9 +486,6 @@ create_log_files(
}
log_init(srv_n_log_files);
if (!log_set_capacity(srv_log_file_size_requested)) {
return(DB_ERROR);
}
fil_open_log_and_system_tablespace_files();
......@@ -1936,6 +1937,12 @@ innobase_start_or_create_for_mysql()
logfilename, dirnamelen, flushed_lsn, logfile0);
if (err != DB_SUCCESS) {
for (Tablespace::const_iterator
i = srv_sys_space.begin();
i != srv_sys_space.end(); i++) {
os_file_delete(innodb_data_file_key,
i->filepath());
}
return(srv_init_abort(err));
}
} else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment