MDEV-33373 part 2: Unexpected ER_FILE_NOT_FOUND upon reading from logging table after crash recovery

CSV engine shoud set my_errno if use it.
This commit is contained in:
Sergei Golubchik 2024-09-19 18:57:37 +02:00 committed by Oleksandr Byelkin
parent 20f57a8529
commit b88f1267e4
3 changed files with 44 additions and 2 deletions

View file

@ -0,0 +1,17 @@
#
# MDEV-33373: Unexpected ER_FILE_NOT_FOUND upon reading from logging
# table after crash recovery
#
call mtr.add_suppression("Table 'general_log' is marked as crashed and should be repaired");
SET GLOBAL log_output="TABLE";
CREATE TABLE t (a INT);
# restart
DROP TABLE t;
SELECT count(*) FROM mysql.general_log;
count(*)
5
Warnings:
Error 1194 Table 'general_log' is marked as crashed and should be repaired
#
# End of 10.5 tests
#

View file

@ -0,0 +1,25 @@
--source include/not_embedded.inc
--source include/have_csv.inc
--echo #
--echo # MDEV-33373: Unexpected ER_FILE_NOT_FOUND upon reading from logging
--echo # table after crash recovery
--echo #
call mtr.add_suppression("Table 'general_log' is marked as crashed and should be repaired");
--disable_ps_protocol
SET GLOBAL log_output="TABLE";
CREATE TABLE t (a INT);
--disable_ps_protocol
--let $shutdown_timeout= 0
--source include/restart_mysqld.inc
DROP TABLE t;
--disable_ps_protocol
SELECT count(*) FROM mysql.general_log;
--enable_ps_protocol
--echo #
--echo # End of 10.5 tests
--echo #

View file

@ -333,7 +333,7 @@ static int read_meta_file(File meta_file, ha_rows *rows)
/* check crashed bit and magic number */
if ((meta_buffer[0] != (uchar)TINA_CHECK_HEADER) ||
((bool)(*ptr)== TRUE))
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
DBUG_RETURN(my_errno= HA_ERR_CRASHED_ON_USAGE);
mysql_file_sync(meta_file, MYF(MY_WME));
@ -974,7 +974,7 @@ int ha_tina::open(const char *name, int mode, uint open_options)
if (share->crashed && !(open_options & HA_OPEN_FOR_REPAIR))
{
free_share(share);
DBUG_RETURN(my_errno ? my_errno : HA_ERR_CRASHED_ON_USAGE);
DBUG_RETURN(my_errno);
}
local_data_file_version= share->data_file_version;