[MDEV-25462] Assertion `m_status == DA_ERROR || m_status == DA_OK || m_status == DA_OK_BULK' failed in Diagnostics_area::message from get_schema_tables_record Created: 2021-04-20  Updated: 2021-05-20  Resolved: 2021-05-20

Status: Closed
Project: MariaDB Server
Component/s: Views
Affects Version/s: 10.3, 10.4, 10.5, 10.6
Fix Version/s: 10.2.39, 10.3.30, 10.4.20, 10.5.11

Type: Bug Priority: Critical
Reporter: Roel Van de Paar Assignee: Rucha Deodhar
Resolution: Fixed Votes: 0
Labels: affects-tests, regression


 Description   

Ref MDEV-24179

SET NAMES 'filename';
CREATE VIEW v2 AS SELECT 1;
SHOW TABLE STATUS;

Leads to:

10.6.0 a3e3225cd3b816d47621e749e21a71b6a864a96a (Debug)

mysqld: /test/10.6_dbg/sql/sql_error.h:1022: const char* Diagnostics_area::message() const: Assertion `m_status == DA_ERROR || m_status == DA_OK || m_status == DA_OK_BULK' failed.

10.6.0 a3e3225cd3b816d47621e749e21a71b6a864a96a (Debug)

Core was generated by `/test/MD150421-mariadb-10.6.0-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
Program terminated with signal SIGABRT, Aborted.
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
[Current thread is 1 (Thread 0x15355c162700 (LWP 3540268))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x0000153570c11859 in __GI_abort () at abort.c:79
#2  0x0000153570c11729 in __assert_fail_base (fmt=0x153570da7588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55ed0e82b618 "m_status == DA_ERROR || m_status == DA_OK || m_status == DA_OK_BULK", file=0x55ed0e82b660 "/test/10.6_dbg/sql/sql_error.h", line=1022, function=<optimized out>) at assert.c:92
#3  0x0000153570c22f36 in __GI___assert_fail (assertion=assertion@entry=0x55ed0e82b618 "m_status == DA_ERROR || m_status == DA_OK || m_status == DA_OK_BULK", file=file@entry=0x55ed0e82b660 "/test/10.6_dbg/sql/sql_error.h", line=line@entry=1022, function=function@entry=0x55ed0e82b680 "const char* Diagnostics_area::message() const") at assert.c:101
#4  0x000055ed0dc5d38c in Diagnostics_area::message (this=0x153520006ab8) at /test/10.6_dbg/sql/sql_error.h:1022
#5  get_schema_tables_record (thd=0x153520000db8, tables=0x153520032310, table=0x15352001ebb0, res=<optimized out>, db_name=<optimized out>, table_name=<optimized out>) at /test/10.6_dbg/sql/sql_show.cc:5698
#6  0x000055ed0dc4413f in fill_schema_table_by_open (thd=thd@entry=0x153520000db8, mem_root=mem_root@entry=0x15355c15f2c0, is_show_fields_or_keys=is_show_fields_or_keys@entry=false, table=table@entry=0x15352001ebb0, schema_table=schema_table@entry=0x55ed0f0df920 <schema_tables+2048>, orig_db_name=orig_db_name@entry=0x1535200198e0, orig_table_name=0x153520019a90, open_tables_state_backup=0x15355c15f300, can_deadlock=false) at /test/10.6_dbg/sql/sql_show.cc:4645
#7  0x000055ed0dc6713e in get_all_tables (thd=0x153520000db8, tables=0x153520015c78, cond=<optimized out>) at /test/10.6_dbg/sql/sql_show.cc:5253
#8  0x000055ed0dc687d5 in get_schema_tables_result (join=join@entry=0x153520017178, executed_place=executed_place@entry=PROCESSED_BY_JOIN_EXEC) at /test/10.6_dbg/sql/sql_show.cc:8728
#9  0x000055ed0dc3c7d7 in JOIN::exec_inner (this=this@entry=0x153520017178) at /test/10.6_dbg/sql/sql_select.cc:4470
#10 0x000055ed0dc3d41a in JOIN::exec (this=this@entry=0x153520017178) at /test/10.6_dbg/sql/sql_select.cc:4273
#11 0x000055ed0dc3b4f3 in mysql_select (thd=thd@entry=0x153520000db8, tables=0x153520015c78, fields=@0x1535200058e0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x153520014230, last = 0x153520015c38, elements = 20}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2684619520, result=0x153520017150, unit=0x153520004f90, select_lex=0x153520005790) at /test/10.6_dbg/sql/sql_select.cc:4749
#12 0x000055ed0dc3b7b9 in handle_select (thd=thd@entry=0x153520000db8, lex=lex@entry=0x153520004ec8, result=result@entry=0x153520017150, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.6_dbg/sql/sql_select.cc:419
#13 0x000055ed0dbae8b5 in execute_sqlcom_select (thd=thd@entry=0x153520000db8, all_tables=0x153520015c78) at /test/10.6_dbg/sql/sql_parse.cc:6244
#14 0x000055ed0dbbb77d in mysql_execute_command (thd=thd@entry=0x153520000db8) at /test/10.6_dbg/sql/sql_parse.cc:3940
#15 0x000055ed0dba7a06 in mysql_parse (thd=thd@entry=0x153520000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x15355c161410) at /test/10.6_dbg/sql/sql_parse.cc:8017
#16 0x000055ed0dbb67df in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x153520000db8, packet=packet@entry=0x15352000b369 "SHOW TABLE STATUS", packet_length=packet_length@entry=17, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_class.h:1331
#17 0x000055ed0dbb9bd5 in do_command (thd=0x153520000db8, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_parse.cc:1406
#18 0x000055ed0dd1377c in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55ed10340498, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1410
#19 0x000055ed0dd13d81 in handle_one_connection (arg=arg@entry=0x55ed10340498) at /test/10.6_dbg/sql/sql_connect.cc:1312
#20 0x000055ed0e1c1a03 in pfs_spawn_thread (arg=0x55ed10264aa8) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
#21 0x000015357111f609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#22 0x0000153570d0e293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.3.29 (dbg), 10.4.19 (dbg), 10.5.10 (dbg), 10.6.0 (dbg)

Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.2.38 (dbg), 10.2.38 (opt), 10.3.29 (opt), 10.4.19 (opt), 10.5.10 (opt), 10.6.0 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.33 (dbg), 5.7.33 (opt), 8.0.23 (dbg), 8.0.23 (opt)

Marked this issue as critical (affect_tests) as it likely masks others. Also, 10.2 gives an interesting output:

10.2.38>SHOW TABLE STATUS;
+------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------+-------------+------------+-----------+----------+----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment                                                                                                                                                                                                                                                                                     |
+------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------+-------------+------------+-----------+----------+----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| v2   | NULL   |    NULL | NULL       | NULL |           NULL |        NULL |            NULL |         NULL |      NULL |           NULL | NULL        | NULL        | NULL       | NULL      |     NULL | NULL           | You@0020have@0020an@0020error@0020in@0020your@0020SQL@0020syntax@003b@0020check@0020the@0020manual@0020that@0020corresponds@0020to@0020your@0020MariaDB@0020server@0020version@0020for@0020the@0020right@0020syntax@0020to@0020use@0020near@0020@0027@00601@0060@0027@0020at@0020line@00201 |
+------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------+-------------+------------+-----------+----------+----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set, 1 warning (0.00 sec)
10.2.38>SHOW WARNIGNS;
ERROR 1064 (42000): You@0020have@0020an@0020error@0020in@0020your@0020SQL@0020syntax@003b@0020check@0020the@0020manual@0020that@0020corresponds@0020to@0020your@0020MariaDB@0020server@0020version@0020for@0020the@0020right@0020syntax@0020to@0020use@0020near@0020@0027WARNIGNS@0027@0020at@0020line@00201



 Comments   
Comment by Rucha Deodhar [ 2021-04-24 ]

Output on 10.2 is ok. The first statement changes character set for character_set_client , character_set_connection, character_set_results to 'filename'. If character_set_results is filename, then we see these @xx sequences.

Comment by Rucha Deodhar [ 2021-04-27 ]

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

Comment by Roel Van de Paar [ 2021-04-27 ]

Thank you for the quick turnaround rucha174

Comment by Rucha Deodhar [ 2021-04-30 ]

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

Comment by Rucha Deodhar [ 2021-04-30 ]

Patch is made for 10.2 because even though the test on 10.2 doesn't crash, we shouldn't get the error either.

Comment by Oleksandr Byelkin [ 2021-05-04 ]

Make the comment we discussed (about other prohibited charsets ) and OK to push

Comment by Rucha Deodhar [ 2021-05-04 ]

Final patch: https://github.com/MariaDB/server/commit/629449172a5b0a6975663ca1ac420789e00b941d

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