[MDEV-14836] Assertion `m_status == DA_ERROR' failed in Diagnostics_area::sql_errno upon query from I_S with LIMIT ROWS EXAMINED Created: 2017-12-31  Updated: 2020-12-10  Resolved: 2020-08-04

Status: Closed
Project: MariaDB Server
Component/s: Admin statements
Affects Version/s: 10.2, 10.3, 10.4, 10.5
Fix Version/s: 10.2.35, 10.3.26, 10.4.16, 10.5.7

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

Attachments: HTML File threads    
Issue Links:
Problem/Incident
causes MDEV-23445 LIMIT ROWS EXAMINED throws error in D... Closed
Relates
relates to MDEV-17729 Assertion `! is_set() || m_can_overwr... Closed
relates to MDEV-22266 Diagnostics_area::sql_errno() const: ... Closed
relates to MDEV-19840 Assertion `m_status == DA_ERROR' fail... Open
relates to MDEV-24179 Assertion `m_status == DA_ERROR || m_... Closed

 Description   

--source include/have_innodb.inc
 
SELECT * FROM INFORMATION_SCHEMA.`COLUMNS` LIMIT ROWS EXAMINED 10;

10.2 debug 36c01167200

mysqld: /data/src/10.2/sql/sql_error.h:728: uint Diagnostics_area::sql_errno() const: Assertion `m_status == DA_ERROR' failed.
180413 13:17:52 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f5bab788ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x00005649121e4658 in Diagnostics_area::sql_errno (this=0x7f5b5c005c90) at /data/src/10.2/sql/sql_error.h:728
#9  0x0000564912344b06 in fill_schema_table_by_open (thd=0x7f5b5c000b00, is_show_fields_or_keys=false, table=0x7f5b5c14a688, schema_table=0x564913642100 <schema_tables+320>, orig_db_name=0x7f5b5c03ac40, orig_table_name=0x7f5b5c092a48, open_tables_state_backup=0x7f5ba43f37f0, can_deadlock=false) at /data/src/10.2/sql/sql_show.cc:4383
#10 0x000056491234626d in get_all_tables (thd=0x7f5b5c000b00, tables=0x7f5b5c0128a8, cond=0x0) at /data/src/10.2/sql/sql_show.cc:5001
#11 0x000056491235641e in get_schema_tables_result (join=0x7f5b5c014998, executed_place=PROCESSED_BY_JOIN_EXEC) at /data/src/10.2/sql/sql_show.cc:8350
#12 0x00005649122f3d8b in JOIN::exec_inner (this=0x7f5b5c014998) at /data/src/10.2/sql/sql_select.cc:3530
#13 0x00005649122f3444 in JOIN::exec (this=0x7f5b5c014998) at /data/src/10.2/sql/sql_select.cc:3361
#14 0x00005649122f460f in mysql_select (thd=0x7f5b5c000b00, tables=0x7f5b5c0128a8, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2684619520, result=0x7f5b5c014978, unit=0x7f5b5c0046a8, select_lex=0x7f5b5c004de0) at /data/src/10.2/sql/sql_select.cc:3761
#15 0x00005649122e8c56 in handle_select (thd=0x7f5b5c000b00, lex=0x7f5b5c0045e0, result=0x7f5b5c014978, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:376
#16 0x00005649122b4a12 in execute_sqlcom_select (thd=0x7f5b5c000b00, all_tables=0x7f5b5c0128a8) at /data/src/10.2/sql/sql_parse.cc:6472
#17 0x00005649122aaa99 in mysql_execute_command (thd=0x7f5b5c000b00) at /data/src/10.2/sql/sql_parse.cc:3483
#18 0x00005649122b845a in mysql_parse (thd=0x7f5b5c000b00, rawbuf=0x7f5b5c012640 "SELECT * FROM INFORMATION_SCHEMA.`COLUMNS` LIMIT ROWS EXAMINED 10", length=65, parser_state=0x7f5ba43f5200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7918
#19 0x00005649122a632b in dispatch_command (command=COM_QUERY, thd=0x7f5b5c000b00, packet=0x7f5b5c008951 "SELECT * FROM INFORMATION_SCHEMA.`COLUMNS` LIMIT ROWS EXAMINED 10", packet_length=65, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1820
#20 0x00005649122a4c8e in do_command (thd=0x7f5b5c000b00) at /data/src/10.2/sql/sql_parse.cc:1374
#21 0x00005649123f3602 in do_handle_one_connection (connect=0x5649152c5e90) at /data/src/10.2/sql/sql_connect.cc:1335
#22 0x00005649123f338f in handle_one_connection (arg=0x5649152c5e90) at /data/src/10.2/sql/sql_connect.cc:1241
#23 0x000056491281357a in pfs_spawn_thread (arg=0x5649152297d0) at /data/src/10.2/storage/perfschema/pfs.cc:1862
#24 0x00007f5bad45f494 in start_thread (arg=0x7f5ba43f6700) at pthread_create.c:333
#25 0x00007f5bab84593f in clone () from /lib/x86_64-linux-gnu/libc.so.6

Non-debug build produces a number of strange warnings:

10.2 non-debug d18a66147c

Warnings:
Warning	1105	
Warning	1105	
Warning	1105	
...
Warning	1105	

Reproducible on 10.2, 10.3. Not reproducible on 10.1.



 Comments   
Comment by Rucha Deodhar [ 2020-07-16 ]

Patch: https://github.com/MariaDB/server/commit/0dd0bbe54e11260e67fd17e0280a29a93d22e624

Comment by Rucha Deodhar [ 2020-07-26 ]

The rows may not be displayed when we have LIMIT ROWS EXAMINED because:
The rows are counted by the server at the time of insert, read, delete and modify. Since here we first fill the rows of Information_schema tables, limit_rows_examined_cnt is incremented and we reach the limit before any result set rows can be computed.
If there is any select (and not only in case of INFORMATION_SCHEMA) which internally uses temporary table and LIMIT ROWS EXAMINED is reached when writing into temporary table, then the select doesn't return rows.

Comment by Rucha Deodhar [ 2020-07-27 ]

Patch: https://github.com/MariaDB/server/commit/cf72e969094ef8bde3cb88bc0575abd9a7f4a910

Comment by Sergei Golubchik [ 2020-07-30 ]

ok to push

Generated at Thu Feb 08 08:16:39 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.