Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ connection default;
SELECT * FROM t0 LIMIT 0 LOCK IN SHARE MODE;
a
DROP TABLE t0,t1;
#
# MDEV-38942 i_s_dict_fill_sys_tables() aborts when reading
# INNODB_SYS_TABLES after innodb_force_recovery
#
40 changes: 40 additions & 0 deletions mysql-test/suite/innodb/t/innodb_force_recovery_rollback.test
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
--source include/have_innodb.inc
--source include/have_sequence.inc
--source include/maybe_debug.inc

# We will kill and restart the server.
--source include/not_embedded.inc
Expand Down Expand Up @@ -33,3 +34,42 @@ connection default;
# The LIMIT 0 works around MDEV-22889 InnoDB occasionally breaks ACID
SELECT * FROM t0 LIMIT 0 LOCK IN SHARE MODE;
DROP TABLE t0,t1;

--echo #
--echo # MDEV-38942 i_s_dict_fill_sys_tables() aborts when reading
--echo # INNODB_SYS_TABLES after innodb_force_recovery
--echo #

if ($have_debug)
{
--disable_query_log
--disable_result_log
--let $restart_noprint=2

connect (con1,localhost,root,,,);
SET DEBUG_SYNC='create_table_inserted SIGNAL created WAIT_FOR ever';
send CREATE TABLE t1 (a INT) ENGINE=InnoDB;

connection default;
SET DEBUG_SYNC='now WAIT_FOR created';
SET GLOBAL innodb_log_checkpoint_now=ON;

--let $restart_parameters= --innodb-force-recovery=4
--let $shutdown_timeout=0
--source include/restart_mysqld.inc
--let $restart_parameters=
--let $shutdown_timeout=
--disable_result_log
--disable_query_log

disconnect con1;
connection default;
SELECT name FROM information_schema.INNODB_SYS_TABLES WHERE name LIKE 'test/%';

--source include/restart_mysqld.inc
--disable_query_log

--let $restart_noprint=
--enable_result_log
--enable_query_log
}
3 changes: 2 additions & 1 deletion storage/innobase/dict/dict0load.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2176,7 +2176,8 @@ Do not load any columns or indexes.
@param[in] rec SYS_TABLES record
@param[out,own] table table, or nullptr
@return error message
@retval nullptr on success */
@retval nullptr on success, or if the record is not visible, in
which case *table will be nullptr */
const char *dict_load_table_low(mtr_t *mtr, bool uncommitted,
const rec_t *rec, dict_table_t **table)
{
Expand Down
14 changes: 6 additions & 8 deletions storage/innobase/handler/i_s.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4556,20 +4556,18 @@ i_s_sys_tables_fill_table(
mtr.commit();
dict_sys.unlock();

if (!err_msg) {
if (err_msg) {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_CANT_FIND_SYSTEM_REC, "%s",
err_msg);
} else if (table_rec) {
err = i_s_dict_fill_sys_tables(
thd, table_rec, tables->table);
if (err) {
err = i_s_sys_error_handling(err, thd);
if (table_rec) {
dict_mem_table_free(table_rec);
}
dict_mem_table_free(table_rec);
goto func_exit;
}
} else {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_CANT_FIND_SYSTEM_REC, "%s",
err_msg);
}

if (table_rec) {
Expand Down
2 changes: 2 additions & 0 deletions storage/innobase/row/row0mysql.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2080,6 +2080,8 @@ row_create_table_for_mysql(

que_run_threads(thr);

DEBUG_SYNC_C("create_table_inserted");

dberr_t err = trx->error_state;

if (err != DB_SUCCESS) {
Expand Down
Loading