[MDEV-24724] SELECT from table with indexed virtual column and certain charset causes Assertion `templ->mbmaxlen > templ->mbminlen || templ->mysql_col_len == len || (field_no == templ->icp_rec_field_no && field->prefix_len > 0)' failure Created: 2021-01-28  Updated: 2023-12-18

Status: Confirmed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB, Virtual Columns
Affects Version/s: 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 11.0, 11.1, 11.2, 11.3, 11.4
Fix Version/s: 10.4, 10.5, 10.6, 10.11, 11.0, 11.1, 11.2, 11.3

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Nikita Malyavin
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-18911 Assertion `(templ->is_virtual && !fie... Confirmed
relates to MDEV-22395 Assertion `templ->mbmaxlen > templ->m... Closed

 Description   

The difference with MDEV-22395 is that older versions are also affected, and virtual columns are used.
Setting to minor because it seems to only affect debug builds and involves indexed virtual columns and a non-common character set (although quite possibly there are other charsets that can be used instead).

--source include/have_innodb.inc
 
CREATE TABLE t1 (pk INT, i INT, a CHAR(8), va CHAR(8) AS (a) VIRTUAL, PRIMARY KEY(pk), KEY(va(4),i)) ENGINE=InnoDB CHARACTER SET macce;
INSERT INTO t1 (pk,a) VALUES (1,'foo'),(2,'bar');
SELECT i FROM t1;
 
# Cleanup
DROP TABLE t1;

10.2 3edad542

mysqld: /data/src/10.2/storage/innobase/row/row0sel.cc:2914: 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.
210128 18:01:03 [ERROR] mysqld got signal 6 ;
 
#7  0x00007fdc509e6f36 in __GI___assert_fail (assertion=0x564e91a2e198 "templ->mbmaxlen > templ->mbminlen || templ->mysql_col_len == len || (field_no == templ->icp_rec_field_no && field->prefix_len > 0)", file=0x564e91a2d250 "/data/src/10.2/storage/innobase/row/row0sel.cc", line=2914, function=0x564e91a2e070 "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  0x0000564e91413c39 in row_sel_field_store_in_mysql_format_func (dest=0x7fdbf8035331 "bar     ", '\245' <repeats 39 times>, "\210S\003\370\333\177", templ=0x7fdbf8148230, index=0x7fdbf80366e0, field_no=0, data=0x7fdc4b62008c "bar \200", len=4) at /data/src/10.2/storage/innobase/row/row0sel.cc:2914
#9  0x0000564e91414860 in row_sel_store_mysql_rec (mysql_rec=0x7fdbf8035320 "\377\002", prebuilt=0x7fdbf8038490, rec=0x7fdc4b61c09d "\200", vrow=0x7fdbf8008110, rec_clust=true, index=0x7fdbf80366e0, offsets=0x7fdc4ae4b7c0) at /data/src/10.2/storage/innobase/row/row0sel.cc:3217
#10 0x0000564e91419ed9 in row_search_mvcc (buf=0x7fdbf8035320 "\377\002", mode=PAGE_CUR_G, prebuilt=0x7fdbf8038490, match_mode=0, direction=0) at /data/src/10.2/storage/innobase/row/row0sel.cc:5623
#11 0x0000564e912a664f in ha_innobase::index_read (this=0x7fdbf80ab288, buf=0x7fdbf8035320 "\377\002", key_ptr=0x0, key_len=0, find_flag=HA_READ_AFTER_KEY) at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:9392
#12 0x0000564e912a75f4 in ha_innobase::index_first (this=0x7fdbf80ab288, buf=0x7fdbf8035320 "\377\002") at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:9769
#13 0x0000564e9109df61 in handler::ha_index_first (this=0x7fdbf80ab288, buf=0x7fdbf8035320 "\377\002") at /data/src/10.2/sql/handler.cc:2809
#14 0x0000564e90e877a1 in join_read_first (tab=0x7fdbf8014128) at /data/src/10.2/sql/sql_select.cc:19847
#15 0x0000564e90e8516e in sub_select (join=0x7fdbf8012fe0, join_tab=0x7fdbf8014128, end_of_records=false) at /data/src/10.2/sql/sql_select.cc:18855
#16 0x0000564e90e84732 in do_select (join=0x7fdbf8012fe0, procedure=0x0) at /data/src/10.2/sql/sql_select.cc:18402
#17 0x0000564e90e5e3a9 in JOIN::exec_inner (this=0x7fdbf8012fe0) at /data/src/10.2/sql/sql_select.cc:3641
#18 0x0000564e90e5d850 in JOIN::exec (this=0x7fdbf8012fe0) at /data/src/10.2/sql/sql_select.cc:3436
#19 0x0000564e90e5ea12 in mysql_select (thd=0x7fdbf8000d90, tables=0x7fdbf80128d8, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fdbf8012fc0, unit=0x7fdbf8004988, select_lex=0x7fdbf80050c8) at /data/src/10.2/sql/sql_select.cc:3836
#20 0x0000564e90e52b8c in handle_select (thd=0x7fdbf8000d90, lex=0x7fdbf80048c8, result=0x7fdbf8012fc0, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:361
#21 0x0000564e90e1d296 in execute_sqlcom_select (thd=0x7fdbf8000d90, all_tables=0x7fdbf80128d8) at /data/src/10.2/sql/sql_parse.cc:6248
#22 0x0000564e90e13c45 in mysql_execute_command (thd=0x7fdbf8000d90) at /data/src/10.2/sql/sql_parse.cc:3559
#23 0x0000564e90e2103f in mysql_parse (thd=0x7fdbf8000d90, rawbuf=0x7fdbf80126f8 "SELECT i FROM t1", length=16, parser_state=0x7fdc4ae4d5f0, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7763
#24 0x0000564e90e0f318 in dispatch_command (command=COM_QUERY, thd=0x7fdbf8000d90, packet=0x7fdbf8008b51 "", packet_length=16, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1827
#25 0x0000564e90e0de13 in do_command (thd=0x7fdbf8000d90) at /data/src/10.2/sql/sql_parse.cc:1381
#26 0x0000564e90f6872e in do_handle_one_connection (connect=0x564e93093220) at /data/src/10.2/sql/sql_connect.cc:1336
#27 0x0000564e90f68493 in handle_one_connection (arg=0x564e93093220) at /data/src/10.2/sql/sql_connect.cc:1241
#28 0x0000564e917909fa in pfs_spawn_thread (arg=0x564e930763a0) at /data/src/10.2/storage/perfschema/pfs.cc:1869
#29 0x00007fdc50ef6609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#30 0x00007fdc50ad2293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Reproducible on 10.2-10.6.
No obvious immediate problem on a non-debug build.
No obvious problem with MyISAM and otherwise the same test case.



 Comments   
Comment by Elena Stepanova [ 2021-01-31 ]

A slightly different assertion failure:

--source include/have_innodb.inc
 
CREATE TABLE t1 (id INT, a CHAR(194), b INT, c CHAR(194) AS (a) VIRTUAL, KEY(id,c(64))) CHARACTER SET utf8 ENGINE=InnoDB;
INSERT INTO t1 (a,b,id) VALUES ('ixs',3,5);
UPDATE t1 SET b = 1 WHERE id = 5;
 
# Cleanup
DROP TABLE t1;

10.2 b87c342d

mysqld: /data/src/10.2/storage/innobase/row/row0sel.cc:2923: void row_sel_field_store_in_mysql_format_func(byte*, const mysql_row_templ_t*, const dict_index_t*, ulint, const byte*, ulint): Assertion `len * templ->mbmaxlen >= templ->mysql_col_len || (field_no == templ->icp_rec_field_no && field->prefix_len > 0) || templ->rec_field_is_prefix' failed.
 
#7  0x00007f99d2e0bf36 in __GI___assert_fail (assertion=0x558fa6ffb2a0 "len * templ->mbmaxlen >= templ->mysql_col_len || (field_no == templ->icp_rec_field_no && field->prefix_len > 0) || templ->rec_field_is_prefix", file=0x558fa6ffa290 "/data/src/10.2/storage/innobase/row/row0sel.cc", line=2923, function=0x558fa6ffb0b0 "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  0x0000558fa69e0d45 in row_sel_field_store_in_mysql_format_func (dest=0x7f99781761e7 "ixs", ' ' <repeats 197 times>..., templ=0x7f9978148400, index=0x7f99780a9590, field_no=0, data=0x7f99cda44083 "ixs", ' ' <repeats 61 times>, len=64) at /data/src/10.2/storage/innobase/row/row0sel.cc:2923
#9  0x0000558fa69e18b8 in row_sel_store_mysql_rec (mysql_rec=0x7f9978175f98 "\361\005", prebuilt=0x7f9978037b30, rec=0x7f99cda40080 "", vrow=0x7f9978008110, rec_clust=true, index=0x7f99780a9590, offsets=0x7f99cd2708e0) at /data/src/10.2/storage/innobase/row/row0sel.cc:3217
#10 0x0000558fa69e6f31 in row_search_mvcc (buf=0x7f9978175f98 "\361\005", mode=PAGE_CUR_GE, prebuilt=0x7f9978037b30, match_mode=1, direction=0) at /data/src/10.2/storage/innobase/row/row0sel.cc:5623
#11 0x0000558fa68736a7 in ha_innobase::index_read (this=0x7f9978036548, buf=0x7f9978175f98 "\361\005", key_ptr=0x7f997809f2f8 "", key_len=5, find_flag=HA_READ_KEY_EXACT) at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:9392
#12 0x0000558fa6674678 in handler::index_read_map (this=0x7f9978036548, buf=0x7f9978175f98 "\361\005", key=0x7f997809f2f8 "", keypart_map=1, find_flag=HA_READ_KEY_EXACT) at /data/src/10.2/sql/handler.h:3132
#13 0x0000558fa666a45f in handler::ha_index_read_map (this=0x7f9978036548, buf=0x7f9978175f98 "\361\005", key=0x7f997809f2f8 "", keypart_map=1, find_flag=HA_READ_KEY_EXACT) at /data/src/10.2/sql/handler.cc:2718
#14 0x0000558fa66714a2 in handler::read_range_first (this=0x7f9978036548, start_key=0x7f9978036630, end_key=0x7f9978036650, eq_range_arg=true, sorted=true) at /data/src/10.2/sql/handler.cc:5483
#15 0x0000558fa6582b31 in handler::multi_range_read_next (this=0x7f9978036548, range_info=0x7f99cd2714c0) at /data/src/10.2/sql/multi_range_read.cc:298
#16 0x0000558fa6582c73 in Mrr_simple_index_reader::get_next (this=0x7f9978036ab8, range_info=0x7f99cd2714c0) at /data/src/10.2/sql/multi_range_read.cc:335
#17 0x0000558fa65858bc in DsMrr_impl::dsmrr_next (this=0x7f9978036978, range_info=0x7f99cd2714c0) at /data/src/10.2/sql/multi_range_read.cc:1411
#18 0x0000558fa6887d52 in ha_innobase::multi_range_read_next (this=0x7f9978036548, range_info=0x7f99cd2714c0) at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:21472
#19 0x0000558fa67cb041 in QUICK_RANGE_SELECT::get_next (this=0x7f9978176bd0) at /data/src/10.2/sql/opt_range.cc:11517
#20 0x0000558fa67dcad1 in rr_quick (info=0x7f99cd271700) at /data/src/10.2/sql/records.cc:373
#21 0x0000558fa64d52d3 in mysql_update (thd=0x7f9978000d90, table_list=0x7f99780127e0, fields=..., values=..., conds=0x7f9978013170, order_num=0, order=0x0, limit=18446744073709551615, handle_duplicates=DUP_ERROR, ignore=false, found_return=0x7f99cd271c60, updated_return=0x7f99cd271d10) at /data/src/10.2/sql/sql_update.cc:635
#22 0x0000558fa63e22fa in mysql_execute_command (thd=0x7f9978000d90) at /data/src/10.2/sql/sql_parse.cc:4033
#23 0x0000558fa63ee065 in mysql_parse (thd=0x7f9978000d90, rawbuf=0x7f99780126f8 "UPDATE t1 SET b = 1 WHERE id = 5", length=32, parser_state=0x7f99cd2725f0, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7763
#24 0x0000558fa63dc33e in dispatch_command (command=COM_QUERY, thd=0x7f9978000d90, packet=0x7f9978008b51 "UPDATE t1 SET b = 1 WHERE id = 5", packet_length=32, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1827
#25 0x0000558fa63dae39 in do_command (thd=0x7f9978000d90) at /data/src/10.2/sql/sql_parse.cc:1381
#26 0x0000558fa653575e in do_handle_one_connection (connect=0x558fa9e5e210) at /data/src/10.2/sql/sql_connect.cc:1336
#27 0x0000558fa65354c3 in handle_one_connection (arg=0x558fa9e5e210) at /data/src/10.2/sql/sql_connect.cc:1241
#28 0x0000558fa6d5da52 in pfs_spawn_thread (arg=0x558fa9e41600) at /data/src/10.2/storage/perfschema/pfs.cc:1869
#29 0x00007f99d331b609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#30 0x00007f99d2ef7293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

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

--source include/have_innodb.inc
SET sql_mode='', collation_server=armscii8_bin;
CREATE TABLE t1 (c INT) ENGINE=InnoDB;
SELECT 1 FROM t1 INTO OUTFILE 'a';
--error ER_DB_DROP_RMDIR
DROP DATABASE test;
SELECT 1 FROM mysql.user;
CREATE TABLE t2 (b CHAR(128) AS (c),c INT,UNIQUE (c,b (64))) ENGINE=InnoDB;
INSERT INTO t2 VALUES (0,1);
SELECT 1 FROM t2;

11.0.1 f2dc4d4c10ac36a73b5c1eb765352d3aee808d66 (Debug)

mariadbd: /test/11.0_dbg/storage/innobase/row/row0sel.cc:2899: 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.

11.0.1 f2dc4d4c10ac36a73b5c1eb765352d3aee808d66 (Debug)

Core was generated by `/test/MD180223-mariadb-11.0.1-linux-x86_64-dbg/bin/mariadbd --no-defaults --cor'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=22592535299648)
    at ./nptl/pthread_kill.c:44
[Current thread is 1 (Thread 0x148c3c0a8640 (LWP 936321))]
(gdb) bt
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=22592535299648) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=22592535299648) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=22592535299648, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x0000148c54b41476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x0000148c54b277f3 in __GI_abort () at ./stdlib/abort.c:79
#5  0x0000148c54b2771b in __assert_fail_base (fmt=0x148c54cdc150 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55b424079cd8 "templ->mbmaxlen > templ->mbminlen || templ->mysql_col_len == len || (field_no == templ->icp_rec_field_no && field->prefix_len > 0)", file=0x55b424079840 "/test/11.0_dbg/storage/innobase/row/row0sel.cc", line=2899, function=<optimized out>) at ./assert/assert.c:92
#6  0x0000148c54b38e96 in __GI___assert_fail (assertion=0x55b424079cd8 "templ->mbmaxlen > templ->mbminlen || templ->mysql_col_len == len || (field_no == templ->icp_rec_field_no && field->prefix_len > 0)", file=0x55b424079840 "/test/11.0_dbg/storage/innobase/row/row0sel.cc", line=2899, function=0x55b424079c08 "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/assert.c:101
#7  0x000055b423a4e786 in row_sel_field_store_in_mysql_format_func (dest=0x148bec075a5d "1", ' ' <repeats 127 times>, '\245' <repeats 72 times>..., templ=templ@entry=0x148bec098ef0, index=index@entry=0x148bec078770, field_no=0, data=0x148c47d04082 "1", ' ' <repeats 63 times>, len=64) at /test/11.0_dbg/storage/innobase/row/row0sel.cc:2899
#8  0x000055b423a513dd in row_sel_store_mysql_rec (mysql_rec=mysql_rec@entry=0x148bec075a58 "\377", prebuilt=prebuilt@entry=0x148bec09ac30, rec=0x148c47d0007e "", vrow=0x148bec01aff0, rec_clust=true, index=index@entry=0x148bec078770, offsets=0x148c3c0a5890) at /test/11.0_dbg/storage/innobase/row/row0sel.cc:3205
#9  0x000055b423a5d4ec in row_search_mvcc (buf=buf@entry=0x148bec075a58 "\377", mode=<optimized out>, prebuilt=<optimized out>, match_mode=<optimized out>, direction=direction@entry=0) at /test/11.0_dbg/storage/innobase/row/row0sel.cc:5685
#10 0x000055b4238de778 in ha_innobase::index_read (this=0x148bec099860, buf=0x148bec075a58 "\377", key_ptr=key_ptr@entry=0x0, key_len=key_len@entry=0, find_flag=find_flag@entry=HA_READ_AFTER_KEY) at /test/11.0_dbg/storage/innobase/handler/ha_innodb.cc:8953
#11 0x000055b4238de8e5 in ha_innobase::index_first (this=<optimized out>, buf=<optimized out>) at /test/11.0_dbg/storage/innobase/handler/ha_innodb.cc:9308
#12 0x000055b4235f8e3b in handler::ha_index_first (this=0x148bec099860, buf=0x148bec075a58 "\377") at /test/11.0_dbg/sql/handler.cc:3732
#13 0x000055b4233ac56f in join_read_first (tab=0x148bec015ce8) at /test/11.0_dbg/sql/sql_select.cc:23864
#14 0x000055b42337e8b0 in sub_select (join=0x148bec014798, join_tab=0x148bec015ce8, end_of_records=false) at /test/11.0_dbg/sql/sql_select.cc:22794
#15 0x000055b4233b467f in do_select (procedure=0x0, join=0x148bec014798) at /test/11.0_dbg/sql/sql_select.cc:22329
#16 JOIN::exec_inner (this=this@entry=0x148bec014798) at /test/11.0_dbg/sql/sql_select.cc:4888
#17 0x000055b4233b4be0 in JOIN::exec (this=this@entry=0x148bec014798) at /test/11.0_dbg/sql/sql_select.cc:4666
#18 0x000055b4233b2b18 in mysql_select (thd=thd@entry=0x148bec000d58, tables=0x148bec013740, fields=@0x148bec013478: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x148bec0136f8, last = 0x148bec0136f8, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2164525824, result=0x148bec014770, unit=0x148bec004fa0, select_lex=0x148bec0131c0) at /test/11.0_dbg/sql/sql_select.cc:5146
#19 0x000055b4233b328b in handle_select (thd=thd@entry=0x148bec000d58, lex=lex@entry=0x148bec004ec8, result=result@entry=0x148bec014770, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/11.0_dbg/sql/sql_select.cc:608
#20 0x000055b423318e8d in execute_sqlcom_select (thd=thd@entry=0x148bec000d58, all_tables=0x148bec013740) at /test/11.0_dbg/sql/sql_parse.cc:6267
#21 0x000055b4233244af in mysql_execute_command (thd=thd@entry=0x148bec000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/11.0_dbg/sql/sql_parse.cc:3949
#22 0x000055b42332b7cf in mysql_parse (thd=thd@entry=0x148bec000d58, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x148c3c0a72c0) at /test/11.0_dbg/sql/sql_parse.cc:8002
#23 0x000055b42332d963 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x148bec000d58, packet=packet@entry=0x148bec00ae19 "", packet_length=packet_length@entry=16, blocking=blocking@entry=true) at /test/11.0_dbg/sql/sql_class.h:242
#24 0x000055b42332f7bc in do_command (thd=0x148bec000d58, blocking=blocking@entry=true) at /test/11.0_dbg/sql/sql_parse.cc:1407
#25 0x000055b4234806e2 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55b426ec4748, put_in_cache=put_in_cache@entry=true) at /test/11.0_dbg/sql/sql_connect.cc:1416
#26 0x000055b423480941 in handle_one_connection (arg=0x55b426ec4748) at /test/11.0_dbg/sql/sql_connect.cc:1318
#27 0x0000148c54b93b43 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#28 0x0000148c54c25a00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Bug confirmed present in:
MariaDB: 10.3.38 (dbg), 10.4.29 (dbg), 10.5.20 (dbg), 10.6.13 (dbg), 10.7.8 (dbg), 10.8.8 (dbg), 10.9.6 (dbg), 10.11.2 (dbg), 11.0.1 (dbg)

Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.3.38 (opt), 10.4.29 (opt), 10.5.20 (opt), 10.6.13 (opt), 10.7.8 (opt), 10.8.8 (opt), 10.9.6 (opt), 10.10.4 (dbg), 10.10.4 (opt), 10.11.2 (opt), 11.0.1 (opt)

Comment by Roel Van de Paar [ 2023-12-18 ]

SET sql_mode='';
ALTER DATABASE DEFAULT CHARACTER SET latin7;
CREATE TABLE t (a CHAR(1),b CHAR(128) AS (a),c DATE,UNIQUE (c,b (64)));
INSERT INTO t VALUES (1,0,0);
UPDATE t AS ta1,t AS ta2 SET ta1.a=0;

11.3.0 126157061b4376496c034a809ea4943e863d1465

mariadbd: /test/11.3_dbg/storage/innobase/row/row0sel.cc:2892: 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.

11.3.0 126157061b4376496c034a809ea4943e863d1465

Core was generated by `/test/MD311023-mariadb-11.3.0-linux-x86_64-dbg/bin/mariadbd --defaults-group-su'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=22358209144384)
    at ./nptl/pthread_kill.c:44
[Current thread is 1 (Thread 0x1455ad1d2640 (LWP 2983987))]
(gdb) bt
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=22358209144384) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=22358209144384) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=22358209144384, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x00001455b8a42476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00001455b8a287f3 in __GI_abort () at ./stdlib/abort.c:79
#5  0x00001455b8a2871b in __assert_fail_base (fmt=0x1455b8bdd130 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x558663dba2b0 "templ->mbmaxlen > templ->mbminlen || templ->mysql_col_len == len || (field_no == templ->icp_rec_field_no && field->prefix_len > 0)", file=0x558663db9ee0 "/test/11.3_dbg/storage/innobase/row/row0sel.cc", line=2892, function=<optimized out>) at ./assert/assert.c:92
#6  0x00001455b8a39e96 in __GI___assert_fail (assertion=0x558663dba2b0 "templ->mbmaxlen > templ->mbminlen || templ->mysql_col_len == len || (field_no == templ->icp_rec_field_no && field->prefix_len > 0)", file=0x558663db9ee0 "/test/11.3_dbg/storage/innobase/row/row0sel.cc", line=2892, function=0x558663dba1e0 "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/assert.c:101
#7  0x0000558663722870 in row_sel_field_store_in_mysql_format_func (dest=0x14558405958d "1", ' ' <repeats 127 times>, '\245' <repeats 72 times>..., templ=templ@entry=0x145584062998, index=index@entry=0x14558420dee8, field_no=0, data=0x1455aea68081 "1", ' ' <repeats 63 times>, len=64) at /test/11.3_dbg/storage/innobase/row/row0sel.cc:2892
#8  0x00005586637254ca in row_sel_store_mysql_rec (mysql_rec=mysql_rec@entry=0x145584059588 "\377 ", prebuilt=prebuilt@entry=0x14558405b808, rec=0x1455aea6407e "", vrow=0x145584214f48, rec_clust=true, index=index@entry=0x14558420dee8, offsets=0x1455ad1cfa10) at /test/11.3_dbg/storage/innobase/row/row0sel.cc:3198
#9  0x000055866373191e in row_search_mvcc (buf=buf@entry=0x145584059588 "\377 ", mode=<optimized out>, prebuilt=<optimized out>, match_mode=<optimized out>, direction=direction@entry=0) at /test/11.3_dbg/storage/innobase/row/row0sel.cc:5682
#10 0x00005586635a3406 in ha_innobase::index_read (this=0x145584059bc0, buf=0x145584059588 "\377 ", key_ptr=key_ptr@entry=0x0, key_len=key_len@entry=0, find_flag=find_flag@entry=HA_READ_AFTER_KEY) at /test/11.3_dbg/storage/innobase/handler/ha_innodb.cc:9039
#11 0x00005586635a35e1 in ha_innobase::index_first (this=<optimized out>, buf=<optimized out>) at /test/11.3_dbg/storage/innobase/handler/ha_innodb.cc:9395
#12 0x0000558663233594 in handler::ha_index_first (this=0x145584059bc0, buf=0x145584059588 "\377 ") at /test/11.3_dbg/sql/handler.cc:3781
#13 0x0000558662fb399a in join_read_first (tab=0x14558405cb00) at /test/11.3_dbg/sql/sql_select.cc:24578
#14 0x0000558662f84a4a in sub_select (join=0x145584015af0, join_tab=0x14558405cb00, end_of_records=false) at /test/11.3_dbg/sql/sql_select.cc:23507
#15 0x0000558662f6d3e6 in evaluate_join_record (join=join@entry=0x145584015af0, join_tab=join_tab@entry=0x14558405c690, error=error@entry=0) at /test/11.3_dbg/sql/sql_select.cc:23743
#16 0x0000558662f84a7c in sub_select (join=0x145584015af0, join_tab=0x14558405c690, end_of_records=false) at /test/11.3_dbg/sql/sql_select.cc:23510
#17 0x0000558662fbbecc in do_select (procedure=0x0, join=0x145584015af0) at /test/11.3_dbg/sql/sql_select.cc:23027
#18 JOIN::exec_inner (this=this@entry=0x145584015af0) at /test/11.3_dbg/sql/sql_select.cc:4949
#19 0x0000558662fbc44e in JOIN::exec (this=this@entry=0x145584015af0) at /test/11.3_dbg/sql/sql_select.cc:4726
#20 0x0000558662fbc606 in Sql_cmd_dml::execute_inner (this=this@entry=0x145584015960, thd=thd@entry=0x145584000d58) at /test/11.3_dbg/sql/sql_select.cc:33489
#21 0x000055866303cd8c in Sql_cmd_update::execute_inner (this=0x145584015960, thd=0x145584000d58) at /test/11.3_dbg/sql/sql_update.cc:3082
#22 0x0000558662f6ac53 in Sql_cmd_dml::execute (this=0x145584015960, thd=0x145584000d58) at /test/11.3_dbg/sql/sql_select.cc:33426
#23 0x0000558662f27f18 in mysql_execute_command (thd=thd@entry=0x145584000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/11.3_dbg/sql/sql_parse.cc:4372
#24 0x0000558662f2d193 in mysql_parse (thd=thd@entry=0x145584000d58, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x1455ad1d11e0) at /test/11.3_dbg/sql/sql_parse.cc:7742
#25 0x0000558662f2f509 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x145584000d58, packet=packet@entry=0x145584112179 "UPDATE t AS ta1,t AS ta2 SET ta1.a=0", packet_length=packet_length@entry=36, blocking=blocking@entry=true) at /test/11.3_dbg/sql/sql_class.h:251
#26 0x0000558662f31625 in do_command (thd=0x145584000d58, blocking=blocking@entry=true) at /test/11.3_dbg/sql/sql_parse.cc:1406
#27 0x000055866309654d in do_handle_one_connection (connect=<optimized out>, connect@entry=0x558665f155a8, put_in_cache=put_in_cache@entry=true) at /test/11.3_dbg/sql/sql_connect.cc:1418
#28 0x0000558663096842 in handle_one_connection (arg=arg@entry=0x558665f155a8) at /test/11.3_dbg/sql/sql_connect.cc:1320
#29 0x00005586634dba28 in pfs_spawn_thread (arg=0x558665e6c348) at /test/11.3_dbg/storage/perfschema/pfs.cc:2201
#30 0x00001455b8a94ac3 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#31 0x00001455b8b26660 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Comment by Roel Van de Paar [ 2023-12-18 ]

The testcase in the first comment (with 'ixs' in the INSERT) does not seem to fail anymore on 11.3/11.4

Comment by Roel Van de Paar [ 2023-12-18 ]

Issue does not seem limited to virtual columns. Slightly increased prio.

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