[MDEV-22395] Assertion `templ->mbmaxlen > templ->mbminlen || templ->mysql_col_len == len || (field_no == templ->icp_rec_field_no && field->prefix_len > 0)' failed in row_sel_field_store_in_mysql_format_func Created: 2020-04-28  Updated: 2023-03-10  Resolved: 2023-03-10

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.4.13, 10.5.2, 10.5.3
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Roel Van de Paar Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: not-10.1, not-10.2, not-10.3

Issue Links:
Relates
relates to MDEV-18911 Assertion `(templ->is_virtual && !fie... Confirmed
relates to MDEV-24724 SELECT from table with indexed virtua... Confirmed

 Description   

USE test;
CREATE TABLE t (a BINARY) ENGINE=InnoDB;
INSERT INTO t VALUES (1);
ALTER TABLE t CHANGE COLUMN a a CHAR(10);
ALTER TABLE t CHANGE COLUMN a a CHAR(100) BINARY;
SELECT a FROM t;

Leads to:

10.5.3 98003440c2f8d20164a191ced1b7d92b283bb68f

mysqld: /test/10.5_dbg/storage/innobase/row/row0sel.cc:2794: void row_sel_field_store_in_mysql_format_func(byte*, const mysql_row_templ_t*, const dict_index_t*, ulint, const byte*, ulint): Assertion `templ->mbmaxlen > templ->mbminlen || templ->mysql_col_len == len || (field_no == templ->icp_rec_field_no && field->prefix_len > 0)' failed.

10.5.3 98003440c2f8d20164a191ced1b7d92b283bb68f

Core was generated by `/test/MD210420-mariadb-10.5.3-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 0x7fd51ea2a700 (LWP 823557))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x000056479ddb403d in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:518
#2  0x000056479d559d7b in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:329
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#5  0x00007fd51d16e801 in __GI_abort () at abort.c:79
#6  0x00007fd51d15e39a in __assert_fail_base (fmt=0x7fd51d2e57d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x56479e207508 "templ->mbmaxlen > templ->mbminlen || templ->mysql_col_len == len || (field_no == templ->icp_rec_field_no && field->prefix_len > 0)", file=file@entry=0x56479e2072b0 "/test/10.5_dbg/storage/innobase/row/row0sel.cc", line=line@entry=2794, function=function@entry=0x56479e209300 <row_sel_field_store_in_mysql_format_func(unsigned char*, mysql_row_templ_t const*, dict_index_t const*, unsigned long, unsigned char const*, unsigned long)::__PRETTY_FUNCTION__> "void row_sel_field_store_in_mysql_format_func(byte*, const mysql_row_templ_t*, const dict_index_t*, ulint, const byte*, ulint)") at assert.c:92
#7  0x00007fd51d15e412 in __GI___assert_fail (assertion=assertion@entry=0x56479e207508 "templ->mbmaxlen > templ->mbminlen || templ->mysql_col_len == len || (field_no == templ->icp_rec_field_no && field->prefix_len > 0)", file=file@entry=0x56479e2072b0 "/test/10.5_dbg/storage/innobase/row/row0sel.cc", line=line@entry=2794, function=function@entry=0x56479e209300 <row_sel_field_store_in_mysql_format_func(unsigned char*, mysql_row_templ_t const*, dict_index_t const*, unsigned long, unsigned char const*, unsigned long)::__PRETTY_FUNCTION__> "void row_sel_field_store_in_mysql_format_func(byte*, const mysql_row_templ_t*, const dict_index_t*, ulint, const byte*, ulint)") at assert.c:101
#8  0x000056479dacb5fd in row_sel_field_store_in_mysql_format_func (dest=0x7fd4f1452aa9 "1", ' ' <repeats 99 times>, '\245' <repeats 100 times>..., templ=templ@entry=0x7fd4f1471cd8, index=index@entry=0x7fd4f14a6098, field_no=field_no@entry=3, data=data@entry=0x7fd4ffdc4091 "1         ", len=10) at /test/10.5_dbg/storage/innobase/row/row0sel.cc:2794
#9  0x000056479dacbe83 in row_sel_store_mysql_field (mysql_rec=mysql_rec@entry=0x7fd4f1452aa8 "\377\061", ' ' <repeats 99 times>, '\245' <repeats 99 times>..., prebuilt=prebuilt@entry=0x7fd4f14f1098, rec=rec@entry=0x7fd4ffdc407e "", index=index@entry=0x7fd4f14a6098, offsets=offsets@entry=0x7fd51ea27770, field_no=3, templ=0x7fd4f1471cd8) at /test/10.5_dbg/storage/innobase/row/row0sel.cc:2994
#10 0x000056479dacc49f in row_sel_store_mysql_rec (mysql_rec=mysql_rec@entry=0x7fd4f1452aa8 "\377\061", ' ' <repeats 99 times>, '\245' <repeats 99 times>..., prebuilt=prebuilt@entry=0x7fd4f14f1098, rec=rec@entry=0x7fd4ffdc407e "", vrow=0x0, rec_clust=rec_clust@entry=false, index=index@entry=0x7fd4f14a6098, offsets=0x7fd51ea27770) at /test/10.5_dbg/storage/innobase/row/row0sel.cc:3146
#11 0x000056479dad6320 in row_search_mvcc (buf=buf@entry=0x7fd4f1452aa8 "\377\061", ' ' <repeats 99 times>, '\245' <repeats 99 times>..., mode=<optimized out>, mode@entry=PAGE_CUR_G, prebuilt=0x7fd4f14f1098, match_mode=match_mode@entry=0, direction=direction@entry=0) at /test/10.5_dbg/storage/innobase/row/row0sel.cc:5442
#12 0x000056479d92ab40 in ha_innobase::index_read (this=this@entry=0x7fd4f1436ca0, buf=buf@entry=0x7fd4f1452aa8 "\377\061", ' ' <repeats 99 times>, '\245' <repeats 99 times>..., key_ptr=key_ptr@entry=0x0, key_len=key_len@entry=0, find_flag=find_flag@entry=HA_READ_AFTER_KEY) at /test/10.5_dbg/storage/innobase/handler/ha_innodb.cc:9018
#13 0x000056479d92adbe in ha_innobase::index_first (this=this@entry=0x7fd4f1436ca0, buf=buf@entry=0x7fd4f1452aa8 "\377\061", ' ' <repeats 99 times>, '\245' <repeats 99 times>...) at /test/10.5_dbg/storage/innobase/handler/ha_innodb.cc:9392
#14 0x000056479d92ae3f in ha_innobase::rnd_next (this=0x7fd4f1436ca0, buf=0x7fd4f1452aa8 "\377\061", ' ' <repeats 99 times>, '\245' <repeats 99 times>...) at /test/10.5_dbg/storage/innobase/handler/ha_innodb.cc:9485
#15 0x000056479d561918 in handler::ha_rnd_next (this=0x7fd4f1436ca0, buf=0x7fd4f1452aa8 "\377\061", ' ' <repeats 99 times>, '\245' <repeats 99 times>...) at /test/10.5_dbg/sql/handler.cc:2981
#16 0x000056479d700f77 in rr_sequential (info=0x7fd4f1476a80) at /test/10.5_dbg/sql/records.cc:511
#17 0x000056479d305538 in READ_RECORD::read_record (this=0x7fd4f1476a80) at /test/10.5_dbg/sql/records.h:79
#18 join_init_read_record (tab=0x7fd4f14769b8) at /test/10.5_dbg/sql/sql_select.cc:21551
#19 0x000056479d2f5d97 in sub_select (join=0x7fd4f1475798, join_tab=0x7fd4f14769b8, end_of_records=<optimized out>) at /test/10.5_dbg/sql/sql_select.cc:20603
#20 0x000056479d32db28 in do_select (procedure=0x0, join=0x7fd4f1475798) at /test/10.5_dbg/sql/sql_select.cc:20140
#21 JOIN::exec_inner (this=this@entry=0x7fd4f1475798) at /test/10.5_dbg/sql/sql_select.cc:4464
#22 0x000056479d32e143 in JOIN::exec (this=this@entry=0x7fd4f1475798) at /test/10.5_dbg/sql/sql_select.cc:4245
#23 0x000056479d32c458 in mysql_select (thd=thd@entry=0x7fd4f1415088, tables=<optimized out>, fields=..., conds=0x0, og_num=0, order=<optimized out>, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fd4f1475770, unit=0x7fd4f1419098, select_lex=0x7fd4f1474120) at /test/10.5_dbg/sql/sql_select.cc:4669
#24 0x000056479d32c787 in handle_select (thd=thd@entry=0x7fd4f1415088, lex=lex@entry=0x7fd4f1418fd0, result=result@entry=0x7fd4f1475770, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.5_dbg/sql/sql_select.cc:417
#25 0x000056479d2b6ef4 in execute_sqlcom_select (thd=thd@entry=0x7fd4f1415088, all_tables=0x7fd4f1474720) at /test/10.5_dbg/sql/sql_parse.cc:6172
#26 0x000056479d2af919 in mysql_execute_command (thd=thd@entry=0x7fd4f1415088) at /test/10.5_dbg/sql/sql_parse.cc:3901
#27 0x000056479d2bcf2b in mysql_parse (thd=thd@entry=0x7fd4f1415088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7fd51ea29450, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:7957
#28 0x000056479d2a8c45 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7fd4f1415088, packet=packet@entry=0x7fd4f1467089 "", packet_length=packet_length@entry=15, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:1839
#29 0x000056479d2a749b in do_command (thd=0x7fd4f1415088) at /test/10.5_dbg/sql/sql_parse.cc:1358
#30 0x000056479d402415 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x7fd4fcbc53a8, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1422
#31 0x000056479d402744 in handle_one_connection (arg=arg@entry=0x7fd4fcbc53a8) at /test/10.5_dbg/sql/sql_connect.cc:1319
#32 0x000056479d862fb0 in pfs_spawn_thread (arg=0x7fd51c445b08) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
#33 0x00007fd51de516db in start_thread (arg=0x7fd51ea2a700) at pthread_create.c:463
#34 0x00007fd51d24f88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.4.13 (dbg), 10.5.2 (dbg), 10.5.3 (dbg)

Bug confirmed not present in:
MariaDB: 10.1.45 (dbg), 10.1.45 (opt), 10.2.32 (dbg), 10.2.32 (opt), 10.3.23 (dbg), 10.3.23 (opt), 10.4.13 (opt), 10.5.2 (opt), 10.5.3 (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)

No relevant ASAN output.



 Comments   
Comment by Alice Sherepa [ 2021-07-29 ]

could not reproduce now (10.5 0805cdebd33eb39515d05)

Comment by Roel Van de Paar [ 2023-03-10 ]

Confirmed no longer reproducible on any version.

Comment by Roel Van de Paar [ 2023-03-10 ]

The similar virtual columns issue in MDEV-24724 still exists.

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