[MDEV-22117] Assertion `table->file->stats.records > 0 || error' failed for Aria table | SIGABRT in join_read_const_table Created: 2020-04-02  Updated: 2023-04-27

Status: Confirmed
Project: MariaDB Server
Component/s: Storage Engine - Aria
Affects Version/s: 10.1, 10.2, 10.3, 10.4, 10.5, 10.6
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Major
Reporter: Roel Van de Paar Assignee: Michael Widenius
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
PartOf
is part of MDEV-15878 Assertion `table->file->stats.records... Confirmed

 Description   

# mysqld options required for replay:  --sql_mode=
USE test;
CREATE TABLE t (c INT) ENGINE=Aria;
INSERT INTO t VALUES (0);
REPAIR TABLE t QUICK USE_FRM ;
INSERT INTO t SELECT * FROM t;

Leads to:

mysqld: /data/git/10.4_dbg/sql/sql_select.cc:20793: int join_read_const_table(THD*, JOIN_TAB*, POSITION*): Assertion `table->file->stats.records > 0 || error' failed.

Core was generated by `/data/MD140320-mariadb-10.4.13-linux-x86_64-dbg/bin/mysqld --no-defaults --core'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
    at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
[Current thread is 1 (Thread 0x7f2ec8535700 (LWP 14058))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x000056091deba1ed in my_write_core (sig=sig@entry=6) at /data/git/10.4_dbg/mysys/stacktrace.c:481
#2  0x000056091d648e7c in handle_fatal_signal (sig=6) at /data/git/10.4_dbg/sql/signal_handler.cc:343
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#5  0x00007f2ec69f6801 in __GI_abort () at abort.c:79
#6  0x00007f2ec69e639a in __assert_fail_base (fmt=0x7f2ec6b6d7d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x56091df9abe0 "table->file->stats.records > 0 || error", file=file@entry=0x56091df99fe8 "/data/git/10.4_dbg/sql/sql_select.cc", line=line@entry=20793, function=function@entry=0x56091df990e0 <join_read_const_table(THD*, st_join_table*, st_position*)::__PRETTY_FUNCTION__> "int join_read_const_table(THD*, JOIN_TAB*, POSITION*)") at assert.c:92
#7  0x00007f2ec69e6412 in __GI___assert_fail (assertion=assertion@entry=0x56091df9abe0 "table->file->stats.records > 0 || error", file=file@entry=0x56091df99fe8 "/data/git/10.4_dbg/sql/sql_select.cc", line=line@entry=20793, function=function@entry=0x56091df990e0 <join_read_const_table(THD*, st_join_table*, st_position*)::__PRETTY_FUNCTION__> "int join_read_const_table(THD*, JOIN_TAB*, POSITION*)") at assert.c:101
#8  0x000056091d3df0fe in join_read_const_table (thd=0x7f2e82015070, tab=tab@entry=0x7f2e8206f758, pos=pos@entry=0x7f2e8206fd08) at /data/git/10.4_dbg/sql/sql_select.cc:20793
#9  0x000056091d3f532f in make_join_statistics (keyuse_array=0x7f2e8206f198, tables_list=..., join=0x7f2e8206eea8) at /data/git/10.4_dbg/sql/sql_select.cc:5086
#10 JOIN::optimize_inner (this=this@entry=0x7f2e8206eea8) at /data/git/10.4_dbg/sql/sql_select.cc:2254
#11 0x000056091d3f7138 in JOIN::optimize (this=this@entry=0x7f2e8206eea8) at /data/git/10.4_dbg/sql/sql_select.cc:1601
#12 0x000056091d3f9f3c in mysql_select (thd=thd@entry=0x7f2e82015070, tables=<optimized out>, wild_num=1, fields=..., conds=0x0, og_num=<optimized out>, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=3489925888, result=0x7f2e8206edf8, unit=0x7f2e82018f98, select_lex=0x7f2e8206d838) at /data/git/10.4_dbg/sql/sql_select.cc:4655
#13 0x000056091d3fa2b4 in handle_select (thd=thd@entry=0x7f2e82015070, lex=lex@entry=0x7f2e82018ed8, result=result@entry=0x7f2e8206edf8, setup_tables_done_option=setup_tables_done_option@entry=1073741824) at /data/git/10.4_dbg/sql/sql_select.cc:410
#14 0x000056091d381f82 in mysql_execute_command (thd=thd@entry=0x7f2e82015070) at /data/git/10.4_dbg/sql/sql_parse.cc:4642
#15 0x000056091d389848 in mysql_parse (thd=thd@entry=0x7f2e82015070, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7f2ec85338c0, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/git/10.4_dbg/sql/sql_parse.cc:7900
#16 0x000056091d38c4ea in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f2e82015070, packet=packet@entry=0x7f2e82057071 "INSERT INTO t SELECT * FROM t", packet_length=packet_length@entry=29, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/git/10.4_dbg/sql/sql_parse.cc:1841
#17 0x000056091d39047c in do_command (thd=0x7f2e82015070) at /data/git/10.4_dbg/sql/sql_parse.cc:1359
#18 0x000056091d4bad42 in do_handle_one_connection (connect=connect@entry=0x7f2ec5c35790) at /data/git/10.4_dbg/sql/sql_connect.cc:1412
#19 0x000056091d4bae62 in handle_one_connection (arg=0x7f2ec5c35790) at /data/git/10.4_dbg/sql/sql_connect.cc:1316
#20 0x00007f2ec76d96db in start_thread (arg=0x7f2ec8535700) at pthread_create.c:463
#21 0x00007f2ec6ad788f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.1.45 (dbg), 10.2.32 (dbg), 10.3.23 (dbg), 10.4.13 (dbg), 10.5.2 (dbg)

Bug confirmed not present in:
MariaDB: 10.1.45 (opt), 10.2.32 (opt), 10.3.23 (opt), 10.4.13 (opt), 10.5.2 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)



 Comments   
Comment by Elena Stepanova [ 2020-04-02 ]

The failure looks identical to MDEV-15878, but the test case is better. It is also important if it really crashes on a non-debug build, as the one from MDEV-15878 apparently didn't.

Comment by Roel Van de Paar [ 2020-04-02 ]

Only on debug builds. Two bugs linked. Thank you

Generated at Thu Feb 08 09:12:19 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.