mysqltest: At line 6: query 'SELECT * FROM mysql.general_log' failed: 1017: Can't find file: './mysql/general_log.CSV' (errno: 2 "No such file or directory")
The table is of course still there and is readable after REPAIR.
With some other combinations of queries and startup options different errors can be produced, ranging between more or less expected, such as "Got error 175 "File too short; Expected more data in file" from storage engine CSV", to confusing ones like "Cannot execute statement in a READ ONLY transaction" if the server is running under tx-read-only. I'm not sure whether they all have the same root cause (other than the expected table corruption upon a crash in the absence of automatic recovery), or they would need to be dealt with separately. So far I'll file the one above, as it is the strangest from those I've seen so far.
Thread 6 "mariadbd" hit Breakpoint 1, my_message_sql (error=1017, str=0x7ffff2ffbed0 "Can't find file: './mysql/general_log.CSV' (errno: 2 \"No such file or directory\")", MyFlags=0) at /home/sanja/maria/git/10.5/sql/mysqld.cc:3111
(gdb) where
#0 my_message_sql (error=1017, str=0x7ffff2ffbed0 "Can't find file: './mysql/general_log.CSV' (errno: 2 \"No such file or directory\")", MyFlags=0) at /home/sanja/maria/git/10.5/sql/mysqld.cc:3111
#1 0x0000555556d74816 in my_error (nr=1017, MyFlags=0) at /home/sanja/maria/git/10.5/mysys/my_error.c:124
#2 0x000055555633646c in handler::print_error (this=0x7fffd4069630, error=2, errflag=0) at /home/sanja/maria/git/10.5/sql/handler.cc:4379
#3 0x00005555560d14b7 in open_table_from_share (thd=0x7fffd4000dc8, share=0x7fffd4062590, alias=0x7fffd40182f0, db_stat=33, prgflag=8, ha_open_flags=18, outparam=0x7fffd4067698, is_create_table=false, partitions_to_open=0x0) at /home/sanja/maria/git/10.5/sql/table.cc:4330
#4 0x0000555555eb730c in open_table (thd=0x7fffd4000dc8, table_list=0x7fffd40182a8, ot_ctx=0x7ffff2ffd5f0) at /home/sanja/maria/git/10.5/sql/sql_base.cc:2024
#5 0x0000555555ebb355 in open_and_process_table (thd=0x7fffd4000dc8, tables=0x7fffd40182a8, counter=0x7ffff2ffd684, flags=0, prelocking_strategy=0x7ffff2ffd708, has_prelocking_list=false, ot_ctx=0x7ffff2ffd5f0) at /home/sanja/maria/git/10.5/sql/sql_base.cc:3819
#6 0x0000555555ebc696 in open_tables (thd=0x7fffd4000dc8, options=..., start=0x7ffff2ffd668, counter=0x7ffff2ffd684, flags=0, prelocking_strategy=0x7ffff2ffd708) at /home/sanja/maria/git/10.5/sql/sql_base.cc:4303
#7 0x0000555555ebe766 in open_and_lock_tables (thd=0x7fffd4000dc8, options=..., tables=0x7fffd40182a8, derived=true, flags=0, prelocking_strategy=0x7ffff2ffd708) at /home/sanja/maria/git/10.5/sql/sql_base.cc:5250
#8 0x0000555555e702ba in open_and_lock_tables (thd=0x7fffd4000dc8, tables=0x7fffd40182a8, derived=true, flags=0) at /home/sanja/maria/git/10.5/sql/sql_base.h:509
#9 0x0000555555f77d1d in execute_sqlcom_select (thd=0x7fffd4000dc8, all_tables=0x7fffd40182a8) at /home/sanja/maria/git/10.5/sql/sql_parse.cc:6359
#10 0x0000555555f6eecf in mysql_execute_command (thd=0x7fffd4000dc8) at /home/sanja/maria/git/10.5/sql/sql_parse.cc:4030
#11 0x0000555555f7d4fd in mysql_parse (thd=0x7fffd4000dc8, rawbuf=0x7fffd4017ba0 "SELECT * FROM mysql.general_log", length=31, parser_state=0x7ffff2ffe370, is_com_multi=false, is_next_command=false) at /home/sanja/maria/git/10.5/sql/sql_parse.cc:8236
#12 0x0000555555f682ee in dispatch_command (command=COM_QUERY, thd=0x7fffd4000dc8, packet=0x7fffd400b759 "SELECT * FROM mysql.general_log", packet_length=31, is_com_multi=false, is_next_command=false) at /home/sanja/maria/git/10.5/sql/sql_parse.cc:1892
#13 0x0000555555f66a7d in do_command (thd=0x7fffd4000dc8) at /home/sanja/maria/git/10.5/sql/sql_parse.cc:1376
#14 0x00005555561344f3 in do_handle_one_connection (connect=0x555558c0dec8, put_in_cache=true) at /home/sanja/maria/git/10.5/sql/sql_connect.cc:1417
#15 0x0000555556134263 in handle_one_connection (arg=0x555558c0dec8) at /home/sanja/maria/git/10.5/sql/sql_connect.cc:1319
#16 0x00005555566dea3a in pfs_spawn_thread (arg=0x555558ba7cc8) at /home/sanja/maria/git/10.5/storage/perfschema/pfs.cc:2201
#17 0x00007ffff789ca94 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:447
#18 0x00007ffff7929c3c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
Oleksandr Byelkin
added a comment -
Thread 6 "mariadbd" hit Breakpoint 1, my_message_sql (error=1017, str=0x7ffff2ffbed0 "Can't find file: './mysql/general_log.CSV' (errno: 2 \"No such file or directory\")", MyFlags=0) at /home/sanja/maria/git/10.5/sql/mysqld.cc:3111
(gdb) where
#0 my_message_sql (error=1017, str=0x7ffff2ffbed0 "Can't find file: './mysql/general_log.CSV' (errno: 2 \"No such file or directory\")", MyFlags=0) at /home/sanja/maria/git/10.5/sql/mysqld.cc:3111
#1 0x0000555556d74816 in my_error (nr=1017, MyFlags=0) at /home/sanja/maria/git/10.5/mysys/my_error.c:124
#2 0x000055555633646c in handler::print_error (this=0x7fffd4069630, error=2, errflag=0) at /home/sanja/maria/git/10.5/sql/handler.cc:4379
#3 0x00005555560d14b7 in open_table_from_share (thd=0x7fffd4000dc8, share=0x7fffd4062590, alias=0x7fffd40182f0, db_stat=33, prgflag=8, ha_open_flags=18, outparam=0x7fffd4067698, is_create_table=false, partitions_to_open=0x0) at /home/sanja/maria/git/10.5/sql/table.cc:4330
#4 0x0000555555eb730c in open_table (thd=0x7fffd4000dc8, table_list=0x7fffd40182a8, ot_ctx=0x7ffff2ffd5f0) at /home/sanja/maria/git/10.5/sql/sql_base.cc:2024
#5 0x0000555555ebb355 in open_and_process_table (thd=0x7fffd4000dc8, tables=0x7fffd40182a8, counter=0x7ffff2ffd684, flags=0, prelocking_strategy=0x7ffff2ffd708, has_prelocking_list=false, ot_ctx=0x7ffff2ffd5f0) at /home/sanja/maria/git/10.5/sql/sql_base.cc:3819
#6 0x0000555555ebc696 in open_tables (thd=0x7fffd4000dc8, options=..., start=0x7ffff2ffd668, counter=0x7ffff2ffd684, flags=0, prelocking_strategy=0x7ffff2ffd708) at /home/sanja/maria/git/10.5/sql/sql_base.cc:4303
#7 0x0000555555ebe766 in open_and_lock_tables (thd=0x7fffd4000dc8, options=..., tables=0x7fffd40182a8, derived=true, flags=0, prelocking_strategy=0x7ffff2ffd708) at /home/sanja/maria/git/10.5/sql/sql_base.cc:5250
#8 0x0000555555e702ba in open_and_lock_tables (thd=0x7fffd4000dc8, tables=0x7fffd40182a8, derived=true, flags=0) at /home/sanja/maria/git/10.5/sql/sql_base.h:509
#9 0x0000555555f77d1d in execute_sqlcom_select (thd=0x7fffd4000dc8, all_tables=0x7fffd40182a8) at /home/sanja/maria/git/10.5/sql/sql_parse.cc:6359
#10 0x0000555555f6eecf in mysql_execute_command (thd=0x7fffd4000dc8) at /home/sanja/maria/git/10.5/sql/sql_parse.cc:4030
#11 0x0000555555f7d4fd in mysql_parse (thd=0x7fffd4000dc8, rawbuf=0x7fffd4017ba0 "SELECT * FROM mysql.general_log", length=31, parser_state=0x7ffff2ffe370, is_com_multi=false, is_next_command=false) at /home/sanja/maria/git/10.5/sql/sql_parse.cc:8236
#12 0x0000555555f682ee in dispatch_command (command=COM_QUERY, thd=0x7fffd4000dc8, packet=0x7fffd400b759 "SELECT * FROM mysql.general_log", packet_length=31, is_com_multi=false, is_next_command=false) at /home/sanja/maria/git/10.5/sql/sql_parse.cc:1892
#13 0x0000555555f66a7d in do_command (thd=0x7fffd4000dc8) at /home/sanja/maria/git/10.5/sql/sql_parse.cc:1376
#14 0x00005555561344f3 in do_handle_one_connection (connect=0x555558c0dec8, put_in_cache=true) at /home/sanja/maria/git/10.5/sql/sql_connect.cc:1417
#15 0x0000555556134263 in handle_one_connection (arg=0x555558c0dec8) at /home/sanja/maria/git/10.5/sql/sql_connect.cc:1319
#16 0x00005555566dea3a in pfs_spawn_thread (arg=0x555558ba7cc8) at /home/sanja/maria/git/10.5/storage/perfschema/pfs.cc:2201
#17 0x00007ffff789ca94 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:447
#18 0x00007ffff7929c3c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
The server was not correctly shutdown in the test case (if let it shotdown, i.e. increase shutdown timeout from 0 to something real, there is no error.
CSV Engineread "crashed" bit and do not want to open the table. So probably error message is misleading.
Oleksandr Byelkin
added a comment - The server was not correctly shutdown in the test case (if let it shotdown, i.e. increase shutdown timeout from 0 to something real, there is no error.
CSV Engineread "crashed" bit and do not want to open the table. So probably error message is misleading.
The server was not correctly shutdown in the test case (if let it shotdown, i.e. increase shutdown timeout from 0 to something real, there is no error.
Yes, because the test implements a crash recovery scenario, as said in the bug summary.
Elena Stepanova
added a comment -
The server was not correctly shutdown in the test case (if let it shotdown, i.e. increase shutdown timeout from 0 to something real, there is no error.
Yes, because the test implements a crash recovery scenario, as said in the bug summary.
1) CSV doing wrong correct way to set my_errno
2) it is better to reset my_errno as we sent resul to the client to avoid it be absolute junk for the next command
Oleksandr Byelkin
added a comment - 1) CSV doing wrong correct way to set my_errno
2) it is better to reset my_errno as we sent resul to the client to avoid it be absolute junk for the next command
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.
commit 02685acbca12008e8d01b6894a99d7f034275220
Author: Oleksandr Byelkin <sanja@mariadb.com>
Date: Thu Sep 19 16:51:05 2024 +0200
MDEV-33373 part 1: Unexpected ER_FILE_NOT_FOUND upon reading from logging table after crash recovery
We have found that my_errno can be "passed" to the next commad in some cases.
It is practically impossible to check/fix all cases of my_errno in the server,
plugins and engines so we will reset it as we reset other errors.
The test case will be fixed by CSV engine fix so will be added with it
(see part2).
Oleksandr Byelkin
added a comment - - edited
commit 7d93e6bc70de8078d7d821c4a727bb353345fdcc (HEAD -> bb-10.5-MDEV-33373, origin/bb-10.5-MDEV-33373)
Author: Sergei Golubchik <serg@mariadb.org>
Date: Thu Sep 19 18:57:37 2024 +0200
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.
commit 02685acbca12008e8d01b6894a99d7f034275220
Author: Oleksandr Byelkin <sanja@mariadb.com>
Date: Thu Sep 19 16:51:05 2024 +0200
MDEV-33373 part 1: Unexpected ER_FILE_NOT_FOUND upon reading from logging table after crash recovery
We have found that my_errno can be "passed" to the next commad in some cases.
It is practically impossible to check/fix all cases of my_errno in the server,
plugins and engines so we will reset it as we reset other errors.
The test case will be fixed by CSV engine fix so will be added with it
(see part2).
Thread 6 "mariadbd" hit Breakpoint 1, my_message_sql (error=1017, str=0x7ffff2ffbed0 "Can't find file: './mysql/general_log.CSV' (errno: 2 \"No such file or directory\")", MyFlags=0) at /home/sanja/maria/git/10.5/sql/mysqld.cc:3111
(gdb) where
#0 my_message_sql (error=1017, str=0x7ffff2ffbed0 "Can't find file: './mysql/general_log.CSV' (errno: 2 \"No such file or directory\")", MyFlags=0) at /home/sanja/maria/git/10.5/sql/mysqld.cc:3111
#1 0x0000555556d74816 in my_error (nr=1017, MyFlags=0) at /home/sanja/maria/git/10.5/mysys/my_error.c:124
#2 0x000055555633646c in handler::print_error (this=0x7fffd4069630, error=2, errflag=0) at /home/sanja/maria/git/10.5/sql/handler.cc:4379
#3 0x00005555560d14b7 in open_table_from_share (thd=0x7fffd4000dc8, share=0x7fffd4062590, alias=0x7fffd40182f0, db_stat=33, prgflag=8, ha_open_flags=18, outparam=0x7fffd4067698, is_create_table=false, partitions_to_open=0x0) at /home/sanja/maria/git/10.5/sql/table.cc:4330
#4 0x0000555555eb730c in open_table (thd=0x7fffd4000dc8, table_list=0x7fffd40182a8, ot_ctx=0x7ffff2ffd5f0) at /home/sanja/maria/git/10.5/sql/sql_base.cc:2024
#5 0x0000555555ebb355 in open_and_process_table (thd=0x7fffd4000dc8, tables=0x7fffd40182a8, counter=0x7ffff2ffd684, flags=0, prelocking_strategy=0x7ffff2ffd708, has_prelocking_list=false, ot_ctx=0x7ffff2ffd5f0) at /home/sanja/maria/git/10.5/sql/sql_base.cc:3819
#6 0x0000555555ebc696 in open_tables (thd=0x7fffd4000dc8, options=..., start=0x7ffff2ffd668, counter=0x7ffff2ffd684, flags=0, prelocking_strategy=0x7ffff2ffd708) at /home/sanja/maria/git/10.5/sql/sql_base.cc:4303
#7 0x0000555555ebe766 in open_and_lock_tables (thd=0x7fffd4000dc8, options=..., tables=0x7fffd40182a8, derived=true, flags=0, prelocking_strategy=0x7ffff2ffd708) at /home/sanja/maria/git/10.5/sql/sql_base.cc:5250
#8 0x0000555555e702ba in open_and_lock_tables (thd=0x7fffd4000dc8, tables=0x7fffd40182a8, derived=true, flags=0) at /home/sanja/maria/git/10.5/sql/sql_base.h:509
#9 0x0000555555f77d1d in execute_sqlcom_select (thd=0x7fffd4000dc8, all_tables=0x7fffd40182a8) at /home/sanja/maria/git/10.5/sql/sql_parse.cc:6359
#10 0x0000555555f6eecf in mysql_execute_command (thd=0x7fffd4000dc8) at /home/sanja/maria/git/10.5/sql/sql_parse.cc:4030
#11 0x0000555555f7d4fd in mysql_parse (thd=0x7fffd4000dc8, rawbuf=0x7fffd4017ba0 "SELECT * FROM mysql.general_log", length=31, parser_state=0x7ffff2ffe370, is_com_multi=false, is_next_command=false) at /home/sanja/maria/git/10.5/sql/sql_parse.cc:8236
#12 0x0000555555f682ee in dispatch_command (command=COM_QUERY, thd=0x7fffd4000dc8, packet=0x7fffd400b759 "SELECT * FROM mysql.general_log", packet_length=31, is_com_multi=false, is_next_command=false) at /home/sanja/maria/git/10.5/sql/sql_parse.cc:1892
#13 0x0000555555f66a7d in do_command (thd=0x7fffd4000dc8) at /home/sanja/maria/git/10.5/sql/sql_parse.cc:1376
#14 0x00005555561344f3 in do_handle_one_connection (connect=0x555558c0dec8, put_in_cache=true) at /home/sanja/maria/git/10.5/sql/sql_connect.cc:1417
#15 0x0000555556134263 in handle_one_connection (arg=0x555558c0dec8) at /home/sanja/maria/git/10.5/sql/sql_connect.cc:1319
#16 0x00005555566dea3a in pfs_spawn_thread (arg=0x555558ba7cc8) at /home/sanja/maria/git/10.5/storage/perfschema/pfs.cc:2201
#17 0x00007ffff789ca94 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:447
#18 0x00007ffff7929c3c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78