[MDEV-23316] Wrong result or Assertion `m_status == DA_ERROR' in Diagnostics_area::sql_errno upon querying triggers with low tmp_disk_table_size Created: 2020-07-28  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: Admin statements, Information Schema, Triggers
Affects Version/s: 10.2, 10.3, 10.4, 10.5
Fix Version/s: 10.4, 10.5

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Rucha Deodhar
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-22883 Assertion `!parse_error || lex.sphead... Stalled
relates to MDEV-22266 Diagnostics_area::sql_errno() const: ... Closed

 Description   

Note: The failure looks very similar to MDEV-22266, but since MDEV-22266 is said to be a 10.5-specific regression while this one is reproducible on all versions, I'm filing it separately. Also similar to MDEV-22883, but with different effects, I don't want to flood it with variations as the underlying problems can be different.

--source include/have_partition.inc
 
CREATE TABLE t1 (a INT) PARTITION BY HASH(a);
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1;
CREATE TRIGGER tr2 BEFORE UPDATE ON t1 FOR EACH ROW SET @b = 1;
SET TMP_DISK_TABLE_SIZE= 16384;
SHOW TRIGGERS;
 
# Cleanup
DROP TABLE t1;

10.2 cae4b3f8

mysqld: /data/src/10.2/sql/sql_error.h:727: uint Diagnostics_area::sql_errno() const: Assertion `m_status == DA_ERROR' failed.
200728 15:31:40 [ERROR] mysqld got signal 6 ;
 
#7  0x00007fcc4a670f12 in __GI___assert_fail (assertion=0x561745617fac "m_status == DA_ERROR", file=0x561745617f18 "/data/src/10.2/sql/sql_error.h", line=727, function=0x561745618c20 <Diagnostics_area::sql_errno() const::__PRETTY_FUNCTION__> "uint Diagnostics_area::sql_errno() const") at assert.c:101
#8  0x0000561744add6c8 in Diagnostics_area::sql_errno (this=0x7fcc34005ca0) at /data/src/10.2/sql/sql_error.h:727
#9  0x0000561744c52cfc in fill_schema_table_by_open (thd=0x7fcc34000af0, is_show_fields_or_keys=false, table=0x7fcc340822f8, schema_table=0x561745f56300 <schema_tables+2304>, orig_db_name=0x7fcc34017830, orig_table_name=0x7fcc34017ea8, open_tables_state_backup=0x7fcc449a2c30, can_deadlock=false) at /data/src/10.2/sql/sql_show.cc:4434
#10 0x0000561744c54484 in get_all_tables (thd=0x7fcc34000af0, tables=0x7fcc34013580, cond=0x0) at /data/src/10.2/sql/sql_show.cc:5050
#11 0x0000561744c6497c in get_schema_tables_result (join=0x7fcc34015710, executed_place=PROCESSED_BY_JOIN_EXEC) at /data/src/10.2/sql/sql_show.cc:8461
#12 0x0000561744bfefcb in JOIN::exec_inner (this=0x7fcc34015710) at /data/src/10.2/sql/sql_select.cc:3602
#13 0x0000561744bfe692 in JOIN::exec (this=0x7fcc34015710) at /data/src/10.2/sql/sql_select.cc:3433
#14 0x0000561744bff848 in mysql_select (thd=0x7fcc34000af0, tables=0x7fcc34013580, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2684619520, result=0x7fcc340156f0, unit=0x7fcc340046e8, select_lex=0x7fcc34004e28) at /data/src/10.2/sql/sql_select.cc:3833
#15 0x0000561744bf3a06 in handle_select (thd=0x7fcc34000af0, lex=0x7fcc34004628, result=0x7fcc340156f0, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:361
#16 0x0000561744bbf472 in execute_sqlcom_select (thd=0x7fcc34000af0, all_tables=0x7fcc34013580) at /data/src/10.2/sql/sql_parse.cc:6218
#17 0x0000561744bb5cf3 in mysql_execute_command (thd=0x7fcc34000af0) at /data/src/10.2/sql/sql_parse.cc:3524
#18 0x0000561744bc31a9 in mysql_parse (thd=0x7fcc34000af0, rawbuf=0x7fcc34012458 "SHOW TRIGGERS", length=13, parser_state=0x7fcc449a4610, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7733
#19 0x0000561744bb14d5 in dispatch_command (command=COM_QUERY, thd=0x7fcc34000af0, packet=0x7fcc3408cdb1 "SHOW TRIGGERS", packet_length=13, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1824
#20 0x0000561744baff50 in do_command (thd=0x7fcc34000af0) at /data/src/10.2/sql/sql_parse.cc:1377
#21 0x0000561744d05fb1 in do_handle_one_connection (connect=0x5617487033a0) at /data/src/10.2/sql/sql_connect.cc:1336
#22 0x0000561744d05d1c in handle_one_connection (arg=0x5617487033a0) at /data/src/10.2/sql/sql_connect.cc:1241
#23 0x000056174551c324 in pfs_spawn_thread (arg=0x5617486500b0) at /data/src/10.2/storage/perfschema/pfs.cc:1869
#24 0x00007fcc4c5f94a4 in start_thread (arg=0x7fcc449a5700) at pthread_create.c:456
#25 0x00007fcc4a72dd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

Reproducible on 10.2-10.5.
Non-debug build doesn't crash, but it returns a partial result without any warnings:

10.2 cae4b3f8 non-debug

SHOW TRIGGERS;
Trigger	Event	Table	Statement	Timing	Created	sql_mode	Definer	character_set_client	collation_connection	Database Collation
tr1	INSERT	t1	SET @a = 1	BEFORE	2020-07-28 15:35:25.25	STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTIONroot@localhost	latin1	latin1_swedish_ci	latin1_swedish_ci
DROP TABLE t1;


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