[MDEV-18166] ASSERT_COLUMN_MARKED_FOR_READ failed on tables with vcols Created: 2019-01-08  Updated: 2021-11-18  Resolved: 2021-07-16

Status: Closed
Project: MariaDB Server
Component/s: Data types, Virtual Columns
Affects Version/s: 10.2, 10.3, 10.4, 10.5, 10.6
Fix Version/s: 10.2.40, 10.3.31, 10.4.21, 10.5.12, 10.6.4

Type: Bug Priority: Critical
Reporter: Elena Stepanova Assignee: Nikita Malyavin
Resolution: Fixed Votes: 0
Labels: affects-tests, bitmaps

Issue Links:
Duplicate
duplicates MDEV-18167 Assertion `!table || (!table->read_se... Closed
is duplicated by MDEV-19306 Assertion `marked_for_read()' failed ... Closed
is duplicated by MDEV-19361 Assertion `marked_for_read()' failed ... Closed
Relates
relates to MDEV-23597 Assertion `marked_for_read()' failed ... Closed
relates to MDEV-24658 Assertion `marked_for_read()' failed ... Confirmed

 Description   

IMPORTANT: Some of the test cases below fail on all of 10.2-10.6, and some only on 10.4-10.6. Please pay attention to the inline notes before declaring something as "not reproducible", and make sure all variations are fixed before closing the issue.

Test case 1, only fails on 10.4-10.6

CREATE TABLE t1 (d DATETIME(3), v DATETIME(2) AS (d));
CREATE VIEW v1 AS SELECT * FROM t1;
 
INSERT INTO t1 (d) VALUES ('2004-04-19 15:37:39.123'),('1985-12-24 10:15:08.456') ;
DELETE FROM v1 ORDER BY v LIMIT 4;
 
# Cleanup
DROP VIEW v1;
DROP TABLE t1;

10.4 30da40bb8c3

mysqld: /data/src/10.4/sql/field.cc:6889: virtual bool Field_datetimef::get_TIME(MYSQL_TIME*, const uchar*, date_mode_t) const: Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))' failed.
190108 14:10:23 [ERROR] mysqld got signal 6 ;
 
#7  0x00007fc39319cee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x0000557ec9ec85ed in Field_datetimef::get_TIME (this=0x7fc37c124110, ltime=0x7fc38d32d1b0, pos=0x7fc37c1376ae "\231r&\371g", fuzzydate=...) at /data/src/10.4/sql/field.cc:6889
#9  0x0000557ec9ede076 in Field_datetimef::get_date (this=0x7fc37c124110, ltime=0x7fc38d32d1b0, fuzzydate=...) at /data/src/10.4/sql/field.h:3410
#10 0x0000557ec9edcd1c in Field_temporal::save_in_field (this=0x7fc37c124110, to=0x7fc37c13a0e8) at /data/src/10.4/sql/field.h:2664
#11 0x0000557ec9ed9c0e in Field::store_field (this=0x7fc37c13a0e8, from=0x7fc37c124110) at /data/src/10.4/sql/field.h:770
#12 0x0000557ec9ee3816 in field_conv_incompatible (to=0x7fc37c13a0e8, from=0x7fc37c124110) at /data/src/10.4/sql/field_conv.cc:851
#13 0x0000557ec9ee3872 in field_conv (to=0x7fc37c13a0e8, from=0x7fc37c124110) at /data/src/10.4/sql/field_conv.cc:864
#14 0x0000557ec9f174e3 in save_field_in_field (from=0x7fc37c124110, null_value=0x7fc37c16fbbe, to=0x7fc37c13a0e8, no_conversions=false) at /data/src/10.4/sql/item.cc:6352
#15 0x0000557ec9f17724 in Item_field::save_in_field (this=0x7fc37c16fb48, to=0x7fc37c13a0e8, no_conversions=false) at /data/src/10.4/sql/item.cc:6403
#16 0x0000557ec9cff23c in TABLE::update_virtual_fields (this=0x7fc37c123340, h=0x7fc37c136f18, update_mode=VCOL_UPDATE_FOR_DELETE) at /data/src/10.4/sql/table.cc:7798
#17 0x0000557eca09891f in record_should_be_deleted (thd=0x7fc37c000b00, table=0x7fc37c123340, sel=0x0, explain=0x7fc37c07f278, truncate_history=false) at /data/src/10.4/sql/sql_delete.cc:239
#18 0x0000557eca09a620 in mysql_delete (thd=0x7fc37c000b00, table_list=0x7fc37c0152f8, conds=0x7fc37c015bb0, order_list=0x7fc37c0053a8, limit=4, options=0, result=0x0) at /data/src/10.4/sql/sql_delete.cc:736
#19 0x0000557ec9be02a6 in mysql_execute_command (thd=0x7fc37c000b00) at /data/src/10.4/sql/sql_parse.cc:4928
#20 0x0000557ec9bea2c4 in mysql_parse (thd=0x7fc37c000b00, rawbuf=0x7fc37c014f98 "DELETE LOW_PRIORITY IGNORE FROM `view_t8` WHERE `col_timestamp` BETWEEN 1 AND 7 ORDER BY `col_bit`,`col_blob`,`col_char`,`col_date`,`col_enum`,`col_int`,`col_time`,`col_timestamp`,`col_varchar`,`col_y"..., length=330, parser_state=0x7fc38d32e600, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8104
#21 0x0000557ec9bd74ee in dispatch_command (command=COM_QUERY, thd=0x7fc37c000b00, packet=0x7fc37c00b421 "DELETE LOW_PRIORITY IGNORE FROM `view_t8` WHERE `col_timestamp` BETWEEN 1 AND 7 ORDER BY `col_bit`,`col_blob`,`col_char`,`col_date`,`col_enum`,`col_int`,`col_time`,`col_timestamp`,`col_varchar`,`col_y"..., packet_length=331, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1851
#22 0x0000557ec9bd5f12 in do_command (thd=0x7fc37c000b00) at /data/src/10.4/sql/sql_parse.cc:1396
#23 0x0000557ec9d42140 in do_handle_one_connection (connect=0x557ecde7c320) at /data/src/10.4/sql/sql_connect.cc:1402
#24 0x0000557ec9d41ec4 in handle_one_connection (arg=0x557ecde7c320) at /data/src/10.4/sql/sql_connect.cc:1308
#25 0x0000557eca201308 in pfs_spawn_thread (arg=0x557ecdd8d140) at /data/src/10.4/storage/perfschema/pfs.cc:1862
#26 0x00007fc394c58494 in start_thread (arg=0x7fc38d32f700) at pthread_create.c:333
#27 0x00007fc39325993f in clone () from /lib/x86_64-linux-gnu/libc.so.6

10.5.10 dd07cfcecd4aabb0aeae9c4f5087f82b4080c1bd (Debug)

mysqld: /test/10.5_dbg/sql/field.cc:7100: virtual bool Field_datetimef::get_TIME(MYSQL_TIME*, const uchar*, date_mode_t) const: Assertion `marked_for_read()' failed.

10.5.10 dd07cfcecd4aabb0aeae9c4f5087f82b4080c1bd (Debug)

Core was generated by `/test/MD270421-mariadb-10.5.10-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 0x14e2f011f700 (LWP 643960))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x000014e2f26db859 in __GI_abort () at abort.c:79
#2  0x000014e2f26db729 in __assert_fail_base (fmt=0x14e2f2871588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55cdcf6200bc "marked_for_read()", file=0x55cdcf61fea3 "/test/10.5_dbg/sql/field.cc", line=7100, function=<optimized out>) at assert.c:92
#3  0x000014e2f26ecf36 in __GI___assert_fail (assertion=assertion@entry=0x55cdcf6200bc "marked_for_read()", file=file@entry=0x55cdcf61fea3 "/test/10.5_dbg/sql/field.cc", line=line@entry=7100, function=function@entry=0x55cdcf621d70 "virtual bool Field_datetimef::get_TIME(MYSQL_TIME*, const uchar*, date_mode_t) const") at assert.c:101
#4  0x000055cdcea505cf in Field_datetimef::get_TIME (this=0x14e288024b50, ltime=0x14e2f011d1f0, pos=0x14e288024b19 "\231\066p\243\310\021Ѐ", fuzzydate={m_mode = date_mode_t::CONV_NONE}) at /test/10.5_dbg/sql/field.cc:7100
#5  0x000055cdcea70a65 in Field_datetimef::get_date (this=<optimized out>, ltime=<optimized out>, fuzzydate=<optimized out>) at /test/10.5_dbg/sql/field.h:3923
#6  0x000055cdcea6b0f2 in Field_temporal::save_in_field (this=0x14e288024b50, to=0x14e288024c28) at /test/10.5_dbg/sql/sql_basic_types.h:279
#7  0x000055cdce8f49bf in Field::store_field (this=<optimized out>, from=<optimized out>) at /test/10.5_dbg/sql/field.h:907
#8  0x000055cdcea7125d in field_conv_incompatible (to=to@entry=0x14e288024c28, from=from@entry=0x14e288024b50) at /test/10.5_dbg/sql/field_conv.cc:850
#9  0x000055cdcea72859 in field_conv (to=to@entry=0x14e288024c28, from=from@entry=0x14e288024b50) at /test/10.5_dbg/sql/field_conv.cc:861
#10 0x000055cdcea9f001 in save_field_in_field (from=0x14e288024b50, null_value=0x14e288025fde, to=0x14e288024c28, no_conversions=<optimized out>) at /test/10.5_dbg/sql/item.cc:6521
#11 0x000055cdcea9f0e5 in Item_field::save_in_field (this=<optimized out>, to=<optimized out>, no_conversions=<optimized out>) at /test/10.5_dbg/sql/item.cc:6572
#12 0x000055cdce8c9ea3 in TABLE::update_virtual_fields (this=0x14e28801e998, h=h@entry=0x14e288024f80, update_mode=update_mode@entry=VCOL_UPDATE_FOR_READ) at /test/10.5_dbg/sql/table.cc:8619
#13 0x000055cdcea840ee in handler::ha_rnd_pos (this=0x14e288024f80, buf=0x14e288024b18 "\371\231\066p\243\310\021Ѐ", pos=<optimized out>) at /test/10.5_dbg/sql/handler.cc:3107
#14 0x000055cdcec59310 in rr_from_pointers (info=0x14e2f011d620) at /test/10.5_dbg/sql/records.h:81
#15 0x000055cdcec7704f in READ_RECORD::read_record (this=0x14e2f011d620) at /test/10.5_dbg/sql/records.h:80
#16 mysql_delete (thd=thd@entry=0x14e288000db8, table_list=0x14e288013dc8, conds=<optimized out>, order_list=order_list@entry=0x14e288005a08, limit=4, options=<optimized out>, result=0x0) at /test/10.5_dbg/sql/sql_delete.cc:772
#17 0x000055cdce7b6fb7 in mysql_execute_command (thd=thd@entry=0x14e288000db8) at /test/10.5_dbg/sql/sql_limit.h:67
#18 0x000055cdce7a034f in mysql_parse (thd=thd@entry=0x14e288000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14e2f011e3d0, 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:8099
#19 0x000055cdce7af565 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14e288000db8, packet=packet@entry=0x14e28800b499 "DELETE FROM v1 ORDER BY v LIMIT 4", packet_length=packet_length@entry=33, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_class.h:1270
#20 0x000055cdce7b2dea in do_command (thd=0x14e288000db8) at /test/10.5_dbg/sql/sql_parse.cc:1370
#21 0x000055cdce90f379 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55cdd22c72d8, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1410
#22 0x000055cdce90fa7d in handle_one_connection (arg=arg@entry=0x55cdd22c72d8) at /test/10.5_dbg/sql/sql_connect.cc:1312
#23 0x000055cdcedc8885 in pfs_spawn_thread (arg=0x55cdd21fa038) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
#24 0x000014e2f2be9609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#25 0x000014e2f27d8293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

10.6.1 f8665314d4ba190679001b81bb7d9fd7a38fc0f6 (Debug)

mysqld: /test/10.6_dbg/sql/field.cc:7112: virtual bool Field_datetimef::get_TIME(MYSQL_TIME*, const uchar*, date_mode_t) const: Assertion `marked_for_read()' failed.

10.6.1 f8665314d4ba190679001b81bb7d9fd7a38fc0f6 (Debug)

Core was generated by `/test/MD100521-mariadb-10.6.1-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 0x148e1c803700 (LWP 3944549))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x0000148e1f3c1859 in __GI_abort () at abort.c:79
#2  0x0000148e1f3c1729 in __assert_fail_base (fmt=0x148e1f557588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55e850f406e4 "marked_for_read()", file=0x55e850f404cb "/test/10.6_dbg/sql/field.cc", line=7112, function=<optimized out>) at assert.c:92
#3  0x0000148e1f3d2f36 in __GI___assert_fail (assertion=assertion@entry=0x55e850f406e4 "marked_for_read()", file=file@entry=0x55e850f404cb "/test/10.6_dbg/sql/field.cc", line=line@entry=7112, function=function@entry=0x55e850f42398 "virtual bool Field_datetimef::get_TIME(MYSQL_TIME*, const uchar*, date_mode_t) const") at assert.c:101
#4  0x000055e8503b8c5d in Field_datetimef::get_TIME (this=0x148dc4025290, ltime=0x148e1c801250, pos=0x148dc4025259 "\231\066p\243\310\021Ѐ", fuzzydate={m_mode = date_mode_t::CONV_NONE}) at /test/10.6_dbg/sql/field.cc:7112
#5  0x000055e8503d9127 in Field_datetimef::get_date (this=<optimized out>, ltime=<optimized out>, fuzzydate=<optimized out>) at /test/10.6_dbg/sql/field.h:3926
#6  0x000055e8503d37b4 in Field_temporal::save_in_field (this=0x148dc4025290, to=0x148dc4025368) at /test/10.6_dbg/sql/sql_basic_types.h:279
#7  0x000055e85025b203 in Field::store_field (this=<optimized out>, from=<optimized out>) at /test/10.6_dbg/sql/field.h:907
#8  0x000055e8503d991f in field_conv_incompatible (to=to@entry=0x148dc4025368, from=from@entry=0x148dc4025290) at /test/10.6_dbg/sql/field_conv.cc:850
#9  0x000055e8503daf1b in field_conv (to=to@entry=0x148dc4025368, from=from@entry=0x148dc4025290) at /test/10.6_dbg/sql/field_conv.cc:861
#10 0x000055e85040603d in save_field_in_field (from=0x148dc4025290, null_value=0x148dc402672e, to=0x148dc4025368, no_conversions=<optimized out>) at /test/10.6_dbg/sql/item.cc:6525
#11 0x000055e850406121 in Item_field::save_in_field (this=<optimized out>, to=<optimized out>, no_conversions=<optimized out>) at /test/10.6_dbg/sql/item.cc:6576
#12 0x000055e850230743 in TABLE::update_virtual_fields (this=0x148dc401f008, h=h@entry=0x148dc40256c0, update_mode=update_mode@entry=VCOL_UPDATE_FOR_READ) at /test/10.6_dbg/sql/table.cc:8707
#13 0x000055e8503ec610 in handler::ha_rnd_pos (this=0x148dc40256c0, buf=0x148dc4025258 "\371\231\066p\243\310\021Ѐ", pos=<optimized out>) at /test/10.6_dbg/sql/handler.cc:3109
#14 0x000055e8505be8fa in rr_from_pointers (info=0x148e1c8016a0) at /test/10.6_dbg/sql/records.h:82
#15 0x000055e8505dc6af in READ_RECORD::read_record (this=0x148e1c8016a0) at /test/10.6_dbg/sql/records.h:81
#16 mysql_delete (thd=thd@entry=0x148dc4000db8, table_list=0x148dc40140c8, conds=<optimized out>, order_list=order_list@entry=0x148dc4005bd8, limit=4, options=<optimized out>, result=0x0) at /test/10.6_dbg/sql/sql_delete.cc:782
#17 0x000055e85011e398 in mysql_execute_command (thd=thd@entry=0x148dc4000db8) at /test/10.6_dbg/sql/sql_limit.h:83
#18 0x000055e85010802b in mysql_parse (thd=thd@entry=0x148dc4000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x148e1c802410) at /test/10.6_dbg/sql/sql_parse.cc:8018
#19 0x000055e850116e5d in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x148dc4000db8, packet=packet@entry=0x148dc400b799 "DELETE FROM v1 ORDER BY v LIMIT 4", packet_length=packet_length@entry=33, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_class.h:1333
#20 0x000055e85011a250 in do_command (thd=0x148dc4000db8, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_parse.cc:1406
#21 0x000055e850274dec in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55e8542da9b8, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1410
#22 0x000055e8502753f1 in handle_one_connection (arg=arg@entry=0x55e8542da9b8) at /test/10.6_dbg/sql/sql_connect.cc:1312
#23 0x000055e850727cee in pfs_spawn_thread (arg=0x55e8541c42a8) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
#24 0x0000148e1f8cf609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#25 0x0000148e1f4be293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Reproducible with at least MyISAM and InnoDB.
Not reproducible on 10.3.
No visible effect on a non-debug build.

Test case 2, from MDEV-18167, only fails on 10.4-10.6

CREATE TABLE t1 ( 
  id INT NOT NULL AUTO_INCREMENT,
  f ENUM('a','b','c'),
  v ENUM('a','b','c') AS (f),
  KEY(v,id)
) ENGINE=MyISAM;
INSERT INTO t1 (f) VALUES ('a'),('b');
INSERT IGNORE INTO t1 SELECT * FROM t1;
 
# Cleanup
DROP TABLE t1;

10.4 30da40bb8c

mysqld: /data/src/10.4/sql/field.cc:9118: virtual longlong Field_enum::val_int(): Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))' failed.
190108 15:32:35 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f37f7c0eee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x000055fa5f90e33c in Field_enum::val_int (this=0x7f37e000aab0) at /data/src/10.4/sql/field.cc:9118
#9  0x000055fa5f91bf77 in Field_enum::store_field (this=0x7f37e000aba8, from=0x7f37e000aab0) at /data/src/10.4/sql/field.h:4146
#10 0x000055fa5f920816 in field_conv_incompatible (to=0x7f37e000aba8, from=0x7f37e000aab0) at /data/src/10.4/sql/field_conv.cc:851
#11 0x000055fa5f920872 in field_conv (to=0x7f37e000aba8, from=0x7f37e000aab0) at /data/src/10.4/sql/field_conv.cc:864
#12 0x000055fa5f9544e3 in save_field_in_field (from=0x7f37e000aab0, null_value=0x7f37e0123ff6, to=0x7f37e000aba8, no_conversions=false) at /data/src/10.4/sql/item.cc:6352
#13 0x000055fa5f954724 in Item_field::save_in_field (this=0x7f37e0123f80, to=0x7f37e000aba8, no_conversions=false) at /data/src/10.4/sql/item.cc:6403
#14 0x000055fa5f73c23c in TABLE::update_virtual_fields (this=0x7f37e0122ac0, h=0x7f37e01236f8, update_mode=VCOL_UPDATE_FOR_WRITE) at /data/src/10.4/sql/table.cc:7798
#15 0x000055fa5f5913ce in fill_record (thd=0x7f37e0000b00, table_arg=0x7f37e0122ac0, fields=..., values=..., ignore_errors=false, update=false) at /data/src/10.4/sql/sql_base.cc:8431
#16 0x000055fa5f59188a in fill_record_n_invoke_before_triggers (thd=0x7f37e0000b00, table=0x7f37e0122ac0, fields=..., values=..., ignore_errors=false, event=TRG_EVENT_INSERT) at /data/src/10.4/sql/sql_base.cc:8562
#17 0x000055fa5f5d5b4f in mysql_insert (thd=0x7f37e0000b00, table_list=0x7f37e0015090, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false) at /data/src/10.4/sql/sql_insert.cc:960
#18 0x000055fa5f61c639 in mysql_execute_command (thd=0x7f37e0000b00) at /data/src/10.4/sql/sql_parse.cc:4730
#19 0x000055fa5f6272c4 in mysql_parse (thd=0x7f37e0000b00, rawbuf=0x7f37e0014f98 "INSERT INTO t1 (f) VALUES ('a'),('b')", length=37, parser_state=0x7f37f1da0600, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8104
#20 0x000055fa5f6144ee in dispatch_command (command=COM_QUERY, thd=0x7f37e0000b00, packet=0x7f37e000b421 "INSERT INTO t1 (f) VALUES ('a'),('b')", packet_length=37, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1851
#21 0x000055fa5f612f12 in do_command (thd=0x7f37e0000b00) at /data/src/10.4/sql/sql_parse.cc:1396
#22 0x000055fa5f77f140 in do_handle_one_connection (connect=0x55fa622bd320) at /data/src/10.4/sql/sql_connect.cc:1402
#23 0x000055fa5f77eec4 in handle_one_connection (arg=0x55fa622bd320) at /data/src/10.4/sql/sql_connect.cc:1308
#24 0x000055fa5fc3e308 in pfs_spawn_thread (arg=0x55fa621ce140) at /data/src/10.4/storage/perfschema/pfs.cc:1862
#25 0x00007f37f96ca494 in start_thread (arg=0x7f37f1da1700) at pthread_create.c:333
#26 0x00007f37f7ccb93f in clone () from /lib/x86_64-linux-gnu/libc.so.6

Not reproducible with InnoDB (the test case is not applicable due to the order of columns in the key).
Not reproducible on 10.3.
No visible effect on a non-debug build.

Test case 3, fails on 10.2, 10.3, 10.5 and 10.6 but not 10.4

--source include/have_partition.inc
 
CREATE TABLE t1 ( 
    a INT,
    b INT,
    c BIT(4) NOT NULL DEFAULT b'0',
    pk INTEGER AUTO_INCREMENT,
    d BIT(4) AS (c) VIRTUAL,
    PRIMARY KEY(pk),
    KEY (b,d)
) PARTITION BY HASH(pk);
INSERT INTO t1 () VALUES (),();
UPDATE t1 SET a = 0 WHERE b IS NULL ORDER BY pk;
 
# Cleanup
DROP TABLE t1;

10.2 b8b74e14

mysqld: /data/src/10.2/sql/field.cc:9532: virtual longlong Field_bit::val_int(): Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))' failed.
190530  3:55:17 [ERROR] mysqld got signal 6 ;
 
#7  0x00007fc44db56f12 in __GI___assert_fail (assertion=0x55a3e60f7e78 "!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))", file=0x55a3e60f7c18 "/data/src/10.2/sql/field.cc", line=9532, function=0x55a3e60fc3e0 <Field_bit::val_int()::__PRETTY_FUNCTION__> "virtual longlong Field_bit::val_int()") at assert.c:101
#8  0x000055a3e580fe0c in Field_bit::val_int (this=0x7fc42c0312a0) at /data/src/10.2/sql/field.cc:9532
#9  0x000055a3e5818bea in Field_bit::save_in_field (this=0x7fc42c0312a0, to=0x7fc42c091d88) at /data/src/10.2/sql/field.h:3746
#10 0x000055a3e562f89a in Field::store_field (this=0x7fc42c091d88, from=0x7fc42c0312a0) at /data/src/10.2/sql/field.h:829
#11 0x000055a3e581ca31 in field_conv_incompatible (to=0x7fc42c091d88, from=0x7fc42c0312a0) at /data/src/10.2/sql/field_conv.cc:831
#12 0x000055a3e581ca8d in field_conv (to=0x7fc42c091d88, from=0x7fc42c0312a0) at /data/src/10.2/sql/field_conv.cc:842
#13 0x000055a3e5849f12 in save_field_in_field (from=0x7fc42c0312a0, null_value=0x7fc42c06b85a, to=0x7fc42c091d88, no_conversions=false) at /data/src/10.2/sql/item.cc:6274
#14 0x000055a3e584a11a in Item_field::save_in_field (this=0x7fc42c06b7e8, to=0x7fc42c091d88, no_conversions=false) at /data/src/10.2/sql/item.cc:6320
#15 0x000055a3e56baff6 in TABLE::update_virtual_fields (this=0x7fc42c069e50, h=0x7fc42c06aa58, update_mode=VCOL_UPDATE_FOR_READ) at /data/src/10.2/sql/table.cc:7642
#16 0x000055a3e582b0d4 in handler::ha_index_read_map (this=0x7fc42c06aa58, buf=0x7fc42c0310b0 "\a\360", key=0x7fc42c081258 "\001", keypart_map=1, find_flag=HA_READ_KEY_EXACT) at /data/src/10.2/sql/handler.cc:2684
#17 0x000055a3e5831c00 in handler::read_range_first (this=0x7fc42c06aa58, start_key=0x7fc42c00c6e0, end_key=0x7fc42c00c2c0, eq_range_arg=true, sorted=false) at /data/src/10.2/sql/handler.cc:5424
#18 0x000055a3e5f461b6 in ha_partition::handle_unordered_scan_next_partition (this=0x7fc42c00c188, buf=0x7fc42c0310b0 "\a\360") at /data/src/10.2/sql/ha_partition.cc:6037
#19 0x000055a3e5f451e4 in ha_partition::common_index_read (this=0x7fc42c00c188, buf=0x7fc42c0310b0 "\a\360", have_start_key=true) at /data/src/10.2/sql/ha_partition.cc:5519
#20 0x000055a3e5f45a7c in ha_partition::read_range_first (this=0x7fc42c00c188, start_key=0x7fc42c00c270, end_key=0x7fc42c00c290, eq_range_arg=true, sorted=true) at /data/src/10.2/sql/ha_partition.cc:5810
#21 0x000055a3e5742c50 in handler::multi_range_read_next (this=0x7fc42c00c188, range_info=0x7fc448689ac0) at /data/src/10.2/sql/multi_range_read.cc:298
#22 0x000055a3e598280c in QUICK_RANGE_SELECT::get_next (this=0x7fc42c080ff0) at /data/src/10.2/sql/opt_range.cc:11452
#23 0x000055a3e581f4a0 in find_all_keys (thd=0x7fc42c000b00, param=0x7fc448689d80, select=0x7fc42c013328, fs_info=0x7fc42c07ff90, buffpek_pointers=0x7fc448689f80, tempfile=0x7fc448689e10, pq=0x0, found_rows=0x7fc42c080170) at /data/src/10.2/sql/filesort.cc:781
#24 0x000055a3e581db22 in filesort (thd=0x7fc42c000b00, table=0x7fc42c069e50, filesort=0x7fc44868a250, tracker=0x7fc42c013790, join=0x0, first_table_bit=0) at /data/src/10.2/sql/filesort.cc:274
#25 0x000055a3e5697f7b in mysql_update (thd=0x7fc42c000b00, table_list=0x7fc42c012560, fields=..., values=..., conds=0x7fc42c012e50, order_num=1, order=0x7fc42c013018, limit=18446744073709551615, handle_duplicates=DUP_ERROR, ignore=false, found_return=0x7fc44868a870, updated_return=0x7fc44868a920) at /data/src/10.2/sql/sql_update.cc:562
#26 0x000055a3e55abe78 in mysql_execute_command (thd=0x7fc42c000b00) at /data/src/10.2/sql/sql_parse.cc:4290
#27 0x000055a3e55b7cba in mysql_parse (thd=0x7fc42c000b00, rawbuf=0x7fc42c012458 "UPDATE t1 SET a = 0 WHERE b IS NULL ORDER BY pk", length=47, parser_state=0x7fc44868b200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:8020
#28 0x000055a3e55a550e in dispatch_command (command=COM_QUERY, thd=0x7fc42c000b00, packet=0x7fc42c08d531 "UPDATE t1 SET a = 0 WHERE b IS NULL ORDER BY pk", packet_length=47, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1833
#29 0x000055a3e55a3e62 in do_command (thd=0x7fc42c000b00) at /data/src/10.2/sql/sql_parse.cc:1386
#30 0x000055a3e56f6b38 in do_handle_one_connection (connect=0x55a3e7efc700) at /data/src/10.2/sql/sql_connect.cc:1335
#31 0x000055a3e56f68b8 in handle_one_connection (arg=0x55a3e7efc700) at /data/src/10.2/sql/sql_connect.cc:1241
#32 0x000055a3e5f23032 in pfs_spawn_thread (arg=0x55a3e7f1f9b0) at /data/src/10.2/storage/perfschema/pfs.cc:1862
#33 0x00007fc44f6cb4a4 in start_thread (arg=0x7fc44868c700) at pthread_create.c:456
#34 0x00007fc44dc13d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

10.3.29 4d412e9854ccb3676a9a51a002fbcc6b44a26294 (Debug)

mysqld: /test/10.3_dbg/sql/field.cc:9902: virtual longlong Field_bit::val_int(): Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))' failed.

10.3.29 4d412e9854ccb3676a9a51a002fbcc6b44a26294 (Debug)

Core was generated by `/test/MD270421-mariadb-10.3.29-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 0x14c5ac057700 (LWP 1263192))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x000014c5aff9f859 in __GI_abort () at abort.c:79
#2  0x000014c5aff9f729 in __assert_fail_base (fmt=0x14c5b0135588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55959a861788 "!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))", file=0x55959a860837 "/test/10.3_dbg/sql/field.cc", line=9902, function=<optimized out>) at assert.c:92
#3  0x000014c5affb0f36 in __GI___assert_fail (assertion=assertion@entry=0x55959a861788 "!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))", file=file@entry=0x55959a860837 "/test/10.3_dbg/sql/field.cc", line=line@entry=9902, function=function@entry=0x55959a862418 "virtual longlong Field_bit::val_int()") at assert.c:101
#4  0x0000559599dea051 in Field_bit::val_int (this=0x14c54400c860) at /test/10.3_dbg/sql/field.cc:9902
#5  0x0000559599e07d4e in Field_bit::save_in_field (this=<optimized out>, to=0x14c544029b80) at /test/10.3_dbg/sql/field.h:4146
#6  0x0000559599e0636d in Field::store_field (this=<optimized out>, from=<optimized out>) at /test/10.3_dbg/sql/field.h:791
#7  0x0000559599e0bd8f in field_conv_incompatible (to=to@entry=0x14c544029b80, from=from@entry=0x14c54400c860) at /test/10.3_dbg/sql/field_conv.cc:836
#8  0x0000559599e0d2d8 in field_conv (to=to@entry=0x14c544029b80, from=from@entry=0x14c54400c860) at /test/10.3_dbg/sql/field_conv.cc:847
#9  0x0000559599e314cb in save_field_in_field (from=0x14c54400c860, null_value=0x14c54402b036, to=0x14c544029b80, no_conversions=<optimized out>) at /test/10.3_dbg/sql/item.cc:6742
#10 0x0000559599e315af in Item_field::save_in_field (this=<optimized out>, to=<optimized out>, no_conversions=<optimized out>) at /test/10.3_dbg/sql/item.cc:6793
#11 0x0000559599c810c6 in TABLE::update_virtual_fields (this=0x14c544020440, h=h@entry=0x14c5440218d8, update_mode=update_mode@entry=VCOL_UPDATE_FOR_READ) at /test/10.3_dbg/sql/table.cc:7978
#12 0x0000559599e1bae2 in handler::ha_index_read_map (this=this@entry=0x14c5440218d8, buf=0x14c54400c660 <incomplete sequence \367>, key=0x14c544006f00 "\001", keypart_map=<optimized out>, find_flag=<optimized out>) at /test/10.3_dbg/sql/handler.cc:2913
#13 0x0000559599e23233 in handler::read_range_first (this=0x14c5440218d8, start_key=0x14c5440219c8, end_key=0x14c5440219e8, eq_range_arg=<optimized out>, sorted=<optimized out>) at /test/10.3_dbg/sql/handler.cc:5844
#14 0x0000559599cfde5e in handler::multi_range_read_next (this=0x14c5440218d8, range_info=range_info@entry=0x14c544025860) at /test/10.3_dbg/sql/multi_range_read.cc:299
#15 0x0000559599cfdef0 in Mrr_simple_index_reader::get_next (this=0x14c544021e68, range_info=0x14c544025860) at /test/10.3_dbg/sql/multi_range_read.cc:336
#16 0x0000559599cffc64 in DsMrr_impl::dsmrr_next (this=0x14c544021d28, range_info=0x14c544025860) at /test/10.3_dbg/sql/multi_range_read.cc:1406
#17 0x000055959a030fe4 in ha_innobase::multi_range_read_next (this=<optimized out>, range_info=<optimized out>) at /test/10.3_dbg/storage/innobase/handler/ha_innodb.cc:20735
#18 0x000055959a5f38ba in ha_partition::handle_ordered_index_scan (this=this@entry=0x14c544021088, buf=0x14c54400c660 <incomplete sequence \367>, reverse_order=reverse_order@entry=false) at /test/10.3_dbg/sql/ha_partition.cc:7575
#19 0x000055959a5f5719 in ha_partition::multi_range_read_next (this=0x14c544021088, range_info=0x14c5ac053ee8) at /test/10.3_dbg/sql/ha_partition.cc:6517
#20 0x0000559599f8e898 in QUICK_RANGE_SELECT::get_next (this=0x14c544031350) at /test/10.3_dbg/sql/opt_range.cc:11552
#21 0x0000559599e11fe2 in find_all_keys (found_rows=0x14c5440301e0, pq=0x0, tempfile=0x14c5ac054130, buffpek_pointers=0x14c5ac0542a0, fs_info=0x14c544030000, select=0x14c5440124b0, param=0x14c5ac0540a0, thd=0x14c544000d90) at /test/10.3_dbg/sql/filesort.cc:780
#22 filesort (thd=thd@entry=0x14c544000d90, table=table@entry=0x14c544020440, filesort=filesort@entry=0x14c5ac054950, tracker=0x14c544012918, join=join@entry=0x0, first_table_bit=first_table_bit@entry=0) at /test/10.3_dbg/sql/filesort.cc:269
#23 0x0000559599c643f6 in mysql_update (thd=thd@entry=0x14c544000d90, table_list=<optimized out>, fields=@0x14c544005508: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14c544011e98, last = 0x14c544011e98, elements = 1}, <No data fields>}, values=@0x14c544005a38: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14c544011ea8, last = 0x14c544011ea8, elements = 1}, <No data fields>}, conds=<optimized out>, order_num=<optimized out>, order=0x14c5440121a8, limit=18446744073709551615, ignore=false, found_return=0x14c5ac054db0, updated_return=0x14c5ac054e70) at /test/10.3_dbg/sql/sql_update.cc:691
#24 0x0000559599b86af8 in mysql_execute_command (thd=thd@entry=0x14c544000d90) at /test/10.3_dbg/sql/sql_parse.cc:4346
#25 0x0000559599b8e3ec in mysql_parse (thd=thd@entry=0x14c544000d90, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14c5ac056540, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.3_dbg/sql/sql_parse.cc:7873
#26 0x0000559599b90b5d in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14c544000d90, packet=packet@entry=0x14c5440198f1 "UPDATE t1 SET a = 0 WHERE b IS NULL ORDER BY pk", packet_length=packet_length@entry=47, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.3_dbg/sql/sql_class.h:1152
#27 0x0000559599b93cfd in do_command (thd=0x14c544000d90) at /test/10.3_dbg/sql/sql_parse.cc:1398
#28 0x0000559599cbab11 in do_handle_one_connection (connect=connect@entry=0x55959c745490) at /test/10.3_dbg/sql/sql_connect.cc:1403
#29 0x0000559599cbad48 in handle_one_connection (arg=0x55959c745490) at /test/10.3_dbg/sql/sql_connect.cc:1308
#30 0x000014c5b0175609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#31 0x000014c5b009c293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

10.6.1 f8665314d4ba190679001b81bb7d9fd7a38fc0f6 (Debug)

mysqld: /test/10.6_dbg/sql/field.cc:9848: virtual longlong Field_bit::val_int(): Assertion `marked_for_read()' failed.

10.6.1 f8665314d4ba190679001b81bb7d9fd7a38fc0f6 (Debug)

Core was generated by `/test/MD100521-mariadb-10.6.1-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 0x1497c80a0700 (LWP 990566))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00001497d1304859 in __GI_abort () at abort.c:79
#2  0x00001497d1304729 in __assert_fail_base (fmt=0x1497d149a588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55999db326e4 "marked_for_read()", file=0x55999db324cb "/test/10.6_dbg/sql/field.cc", line=9848, function=<optimized out>) at assert.c:92
#3  0x00001497d1315f36 in __GI___assert_fail (assertion=assertion@entry=0x55999db326e4 "marked_for_read()", file=file@entry=0x55999db324cb "/test/10.6_dbg/sql/field.cc", line=line@entry=9848, function=function@entry=0x55999db344a8 "virtual longlong Field_bit::val_int()") at assert.c:101
#4  0x000055999cfab08d in Field_bit::val_int (this=0x14977c022d48) at /test/10.6_dbg/sql/field.cc:9848
#5  0x000055999ce4e247 in Field_bit::save_in_field (this=<optimized out>, to=0x14977c029df8) at /test/10.6_dbg/sql/field.h:4899
#6  0x000055999ce4d203 in Field::store_field (this=<optimized out>, from=<optimized out>) at /test/10.6_dbg/sql/field.h:907
#7  0x000055999cfcb91f in field_conv_incompatible (to=to@entry=0x14977c029df8, from=from@entry=0x14977c022d48) at /test/10.6_dbg/sql/field_conv.cc:850
#8  0x000055999cfccf1b in field_conv (to=to@entry=0x14977c029df8, from=from@entry=0x14977c022d48) at /test/10.6_dbg/sql/field_conv.cc:861
#9  0x000055999cff803d in save_field_in_field (from=0x14977c022d48, null_value=0x14977c02aa5e, to=0x14977c029df8, no_conversions=<optimized out>) at /test/10.6_dbg/sql/item.cc:6525
#10 0x000055999cff8121 in Item_field::save_in_field (this=<optimized out>, to=<optimized out>, no_conversions=<optimized out>) at /test/10.6_dbg/sql/item.cc:6576
#11 0x000055999ce22743 in TABLE::update_virtual_fields (this=0x14977c01e088, h=h@entry=0x14977c0294c0, update_mode=update_mode@entry=VCOL_UPDATE_FOR_READ) at /test/10.6_dbg/sql/table.cc:8707
#12 0x000055999cfdeb05 in handler::ha_index_read_map (this=this@entry=0x14977c0294c0, buf=0x14977c022af8 <incomplete sequence \367>, key=<optimized out>, keypart_map=<optimized out>, find_flag=<optimized out>) at /test/10.6_dbg/sql/handler.cc:3132
#13 0x000055999cfe6c1e in handler::read_range_first (this=0x14977c0294c0, start_key=0x14977c0295c0, end_key=0x14977c0295e0, eq_range_arg=<optimized out>, sorted=<optimized out>) at /test/10.6_dbg/sql/handler.cc:6208
#14 0x000055999ceb3efc in handler::multi_range_read_next (this=0x14977c0294c0, range_info=range_info@entry=0x14977c02c408) at /test/10.6_dbg/sql/multi_range_read.cc:516
#15 0x000055999ceb3f8e in Mrr_simple_index_reader::get_next (this=0x14977c029ae8, range_info=0x14977c02c408) at /test/10.6_dbg/sql/multi_range_read.cc:553
#16 0x000055999ceb5db0 in DsMrr_impl::dsmrr_next (this=0x14977c029998, range_info=0x14977c02c408) at /test/10.6_dbg/sql/multi_range_read.cc:1653
#17 0x000055999d3bdab0 in ha_innobase::multi_range_read_next (this=<optimized out>, range_info=<optimized out>) at /test/10.6_dbg/storage/innobase/handler/ha_innodb.cc:19482
#18 0x000055999d30884f in ha_partition::handle_ordered_index_scan (this=this@entry=0x14977c028bd0, buf=0x14977c022af8 <incomplete sequence \367>, reverse_order=reverse_order@entry=false) at /test/10.6_dbg/sql/ha_partition.cc:7717
#19 0x000055999d30a6c7 in ha_partition::multi_range_read_next (this=0x14977c028bd0, range_info=0x1497c809dff8) at /test/10.6_dbg/sql/ha_partition.cc:6665
#20 0x000055999d182574 in QUICK_RANGE_SELECT::get_next (this=0x14977c076810) at /test/10.6_dbg/sql/opt_range.cc:12647
#21 0x000055999cfd3e1a in find_all_keys (found_rows=0x14977c075820, pq=0x0, tempfile=0x1497c809e250, buffpek_pointers=0x1497c809e3c0, fs_info=0x14977c075630, select=0x14977c015068, param=0x1497c809e190, thd=0x14977c000db8) at /test/10.6_dbg/sql/filesort.cc:898
#22 filesort (thd=thd@entry=0x14977c000db8, table=table@entry=0x14977c01e088, filesort=filesort@entry=0x1497c809eab0, tracker=0x14977c0154f8, join=join@entry=0x0, first_table_bit=first_table_bit@entry=0) at /test/10.6_dbg/sql/filesort.cc:355
#23 0x000055999ce09a22 in mysql_update (thd=thd@entry=0x14977c000db8, table_list=<optimized out>, fields=@0x14977c005a88: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14977c0149b8, last = 0x14977c0149b8, elements = 1}, <No data fields>}, values=@0x14977c006020: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14977c0149c8, last = 0x14977c0149c8, elements = 1}, <No data fields>}, conds=<optimized out>, order_num=<optimized out>, order=0x14977c014d50, limit=18446744073709551615, ignore=false, found_return=0x1497c809ef10, updated_return=0x1497c809f000) at /test/10.6_dbg/sql/sql_update.cc:794
#24 0x000055999cd0f2b7 in mysql_execute_command (thd=thd@entry=0x14977c000db8) at /test/10.6_dbg/sql/sql_limit.h:83
#25 0x000055999ccfa02b in mysql_parse (thd=thd@entry=0x14977c000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x1497c809f410) at /test/10.6_dbg/sql/sql_parse.cc:8018
#26 0x000055999cd08e5d in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14977c000db8, packet=packet@entry=0x14977c00b799 "UPDATE t1 SET a = 0 WHERE b IS NULL ORDER BY pk", packet_length=packet_length@entry=47, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_class.h:1333
#27 0x000055999cd0c250 in do_command (thd=0x14977c000db8, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_parse.cc:1406
#28 0x000055999ce66dec in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5599a107c9d8, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1410
#29 0x000055999ce673f1 in handle_one_connection (arg=arg@entry=0x5599a107c9d8) at /test/10.6_dbg/sql/sql_connect.cc:1312
#30 0x000055999d319cee in pfs_spawn_thread (arg=0x5599a0f662c8) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
#31 0x00001497d1812609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#32 0x00001497d1401293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

10.4.19 9e6310e323a3abd411f852ff57fe41c9f149ff3a (Debug)

10.4.19-dbg>CREATE TABLE t1 (a INT, b INT, c BIT(4) NOT NULL DEFAULT b'0', pk INTEGER AUTO_INCREMENT, d BIT(4) AS (c) VIRTUAL, PRIMARY KEY(pk), KEY (b,d)) PARTITION BY HASH(pk);
Query OK, 0 rows affected (0.027 sec)
10.4.19-dbg>INSERT INTO t1 () VALUES (),();
Query OK, 2 rows affected (0.010 sec)
Records: 2  Duplicates: 0  Warnings: 0
10.4.19-dbg>UPDATE t1 SET a = 0 WHERE b IS NULL ORDER BY pk;
Query OK, 2 rows affected (0.008 sec)
Rows matched: 2  Changed: 2  Warnings: 0
10.4.19-dbg>

Not applicable to 10.1. Fails with at least MyISAM and InnoDB.
No obvious problem on a non-debug build.



 Comments   
Comment by Sergei Golubchik [ 2019-01-08 ]

This assert is getting ridiculously long. I'd suggest to move it into a function, like

static inline bool column_marked_for_read(...) { return ... }
#define ASSERT_COLUMN_MARKED_FOR_READ DBUG_ASSERT(column_marked_for_read(...))

Comment by Alexander Barkov [ 2019-01-15 ]

Seems to be repeatable with any combination of two non-binary compatible data types in columns d and v.
For example:

DROP VIEW IF EXISTS v1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (d INT, v TINYINT AS (d));
CREATE VIEW v1 AS SELECT * FROM t1;
INSERT INTO t1 (d) VALUES ('2004'),('1985') ;
DELETE FROM v1 ORDER BY v LIMIT 4;

One more example:

DROP TABLE IF EXISTS t1;
DROP VIEW IF EXISTS v1;
CREATE TABLE t1 (d VARCHAR(64), v VARCHAR(63) AS (d));
CREATE VIEW v1 AS SELECT * FROM t1;
INSERT INTO t1 (d) VALUES ('2004-04-19 15:37:39.123'),('1985-12-24 10:15:08.456') ;
DELETE FROM v1 ORDER BY v LIMIT 4;

(note, lengths of d and v must be different to make it crash)

Comment by Alexander Barkov [ 2019-01-15 ]

sanja, can you please take over this issue? Thanks.

Comment by Alice Sherepa [ 2019-06-05 ]

The assertion was renamed to `marked_for_read()' and MDEV-19306 seems to be a duplicate of this bug

Comment by Roel Van de Paar [ 2021-05-11 ]

Summary:

Assertion `marked_for_read()' failed in Field_blob::val_str (10.4,10.5,10.6)
Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))' failed (10.2,10.3) 

With the following testcase:

# mysqld options required for replay:  --log-bin
SET SESSION binlog_row_image=1;
CREATE TEMPORARY TABLE t1 SELECT UUID();
CREATE TABLE t2 (a INT PRIMARY KEY, b TEXT, c INT GENERATED ALWAYS AS(b)) ENGINE=InnoDB;
INSERT INTO t2 (a,b) VALUES (1,1);

Leads to:

10.6.1 f8665314d4ba190679001b81bb7d9fd7a38fc0f6 (Debug)

mysqld: /test/10.6_dbg/sql/field.cc:8662: virtual String* Field_blob::val_str(String*, String*): Assertion `marked_for_read()' failed.

10.6.1 f8665314d4ba190679001b81bb7d9fd7a38fc0f6 (Debug)

Core was generated by `/test/MD100521-mariadb-10.6.1-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 0x14c2bc89d700 (LWP 1631323))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x000014c2c7d4d859 in __GI_abort () at abort.c:79
#2  0x000014c2c7d4d729 in __assert_fail_base (fmt=0x14c2c7ee3588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x5557095df6e4 "marked_for_read()", file=0x5557095df4cb "/test/10.6_dbg/sql/field.cc", line=8662, function=<optimized out>) at assert.c:92
#3  0x000014c2c7d5ef36 in __GI___assert_fail (assertion=assertion@entry=0x5557095df6e4 "marked_for_read()", file=file@entry=0x5557095df4cb "/test/10.6_dbg/sql/field.cc", line=line@entry=8662, function=function@entry=0x5557095e26d8 "virtual String* Field_blob::val_str(String*, String*)") at assert.c:101
#4  0x0000555708a5fa72 in Field_blob::val_str (this=0x14c27002f168, val_buffer=<optimized out>, val_ptr=0x14c2bc89b660) at /test/10.6_dbg/sql/field.cc:8662
#5  0x00005557088fda9b in Field::val_str (str=0x14c2bc89b660, this=0x14c27002f168) at /test/10.6_dbg/sql/field.h:1026
#6  Field::save_in_field_str (this=0x14c27002f168, to=0x14c27002f290) at /test/10.6_dbg/sql/field.h:745
#7  0x00005557088fdb41 in Field_str::save_in_field (this=<optimized out>, to=<optimized out>) at /test/10.6_dbg/sql/field.h:2094
#8  0x00005557088fa203 in Field::store_field (this=<optimized out>, from=<optimized out>) at /test/10.6_dbg/sql/field.h:907
#9  0x0000555708a7891f in field_conv_incompatible (to=to@entry=0x14c27002f290, from=from@entry=0x14c27002f168) at /test/10.6_dbg/sql/field_conv.cc:850
#10 0x0000555708a79f1b in field_conv (to=to@entry=0x14c27002f290, from=from@entry=0x14c27002f168) at /test/10.6_dbg/sql/field_conv.cc:861
#11 0x0000555708aa503d in save_field_in_field (from=0x14c27002f168, null_value=0x14c27002fe8e, to=0x14c27002f290, no_conversions=<optimized out>) at /test/10.6_dbg/sql/item.cc:6525
#12 0x0000555708aa5121 in Item_field::save_in_field (this=<optimized out>, to=<optimized out>, no_conversions=<optimized out>) at /test/10.6_dbg/sql/item.cc:6576
#13 0x00005557088cf743 in TABLE::update_virtual_fields (this=this@entry=0x14c27002eb88, h=<optimized out>, update_mode=update_mode@entry=VCOL_UPDATE_FOR_WRITE) at /test/10.6_dbg/sql/table.cc:8707
#14 0x00005557087302e7 in fill_record (thd=thd@entry=0x14c270000db8, table_arg=table_arg@entry=0x14c27002eb88, fields=@0x14c270006008: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14c270014a10, last = 0x14c270014b68, elements = 2}, <No data fields>}, values=@0x14c270015010: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14c2700150c8, last = 0x14c270015178, elements = 2}, <No data fields>}, ignore_errors=ignore_errors@entry=false, update=update@entry=false) at /test/10.6_dbg/sql/sql_base.cc:8598
#15 0x0000555708730571 in fill_record_n_invoke_before_triggers (thd=thd@entry=0x14c270000db8, table=table@entry=0x14c27002eb88, fields=@0x14c270006008: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14c270014a10, last = 0x14c270014b68, elements = 2}, <No data fields>}, values=@0x14c270015010: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14c2700150c8, last = 0x14c270015178, elements = 2}, <No data fields>}, ignore_errors=ignore_errors@entry=false, event=event@entry=TRG_EVENT_INSERT) at /test/10.6_dbg/sql/sql_base.cc:8727
#16 0x0000555708774bb3 in mysql_insert (thd=thd@entry=0x14c270000db8, table_list=0x14c2700141e8, fields=@0x14c270006008: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14c270014a10, last = 0x14c270014b68, elements = 2}, <No data fields>}, values_list=@0x14c270006050: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14c270015188, last = 0x14c270015188, elements = 1}, <No data fields>}, update_fields=@0x14c270006038: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x555709d9c480 <end_of_list>, last = 0x14c270006038, elements = 0}, <No data fields>}, update_values=@0x14c270006020: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x555709d9c480 <end_of_list>, last = 0x14c270006020, elements = 0}, <No data fields>}, duplic=DUP_ERROR, ignore=false, result=0x0) at /test/10.6_dbg/sql/sql_insert.cc:996
#17 0x00005557087bc824 in mysql_execute_command (thd=thd@entry=0x14c270000db8) at /test/10.6_dbg/sql/sql_parse.cc:4559
#18 0x00005557087a702b in mysql_parse (thd=thd@entry=0x14c270000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14c2bc89c410) at /test/10.6_dbg/sql/sql_parse.cc:8018
#19 0x00005557087b5e5d in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14c270000db8, packet=packet@entry=0x14c27000b8b9 "INSERT INTO t2 (a,b) VALUES (1,1)", packet_length=packet_length@entry=33, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_class.h:1333
#20 0x00005557087b9250 in do_command (thd=0x14c270000db8, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_parse.cc:1406
#21 0x0000555708913dec in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55570c884bf8, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1410
#22 0x00005557089143f1 in handle_one_connection (arg=arg@entry=0x55570c884bf8) at /test/10.6_dbg/sql/sql_connect.cc:1312
#23 0x0000555708dc6cee in pfs_spawn_thread (arg=0x55570c753178) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
#24 0x000014c2c825b609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#25 0x000014c2c7e4a293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

10.3.29 4d412e9854ccb3676a9a51a002fbcc6b44a26294 (Debug)

mysqld: /test/10.3_dbg/sql/field.cc:8479: virtual String* Field_blob::val_str(String*, String*): Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))' failed.

10.3.29 4d412e9854ccb3676a9a51a002fbcc6b44a26294 (Debug)

Core was generated by `/test/MD270421-mariadb-10.3.29-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 0x14801411e700 (LWP 1647849))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x000014801c414859 in __GI_abort () at abort.c:79
#2  0x000014801c414729 in __assert_fail_base (fmt=0x14801c5aa588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55b0bfab1788 "!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))", file=0x55b0bfab0837 "/test/10.3_dbg/sql/field.cc", line=8479, function=<optimized out>) at assert.c:92
#3  0x000014801c425f36 in __GI___assert_fail (assertion=assertion@entry=0x55b0bfab1788 "!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))", file=file@entry=0x55b0bfab0837 "/test/10.3_dbg/sql/field.cc", line=line@entry=8479, function=function@entry=0x55b0bfab36b0 "virtual String* Field_blob::val_str(String*, String*)") at assert.c:101
#4  0x000055b0bf0449ff in Field_blob::val_str (this=0x147fb0028c78, val_buffer=<optimized out>, val_ptr=0x14801411b4d0) at /test/10.3_dbg/sql/field.cc:8479
#5  0x000055b0bf05b6a3 in Field::val_str (str=0x14801411b4d0, this=0x147fb0028c78) at /test/10.3_dbg/sql/field.h:854
#6  Field::save_in_field_str (this=0x147fb0028c78, to=0x147fb0028da0) at /test/10.3_dbg/sql/field.h:631
#7  0x000055b0bf05b7b3 in Field_str::save_in_field (this=<optimized out>, to=<optimized out>) at /test/10.3_dbg/sql/field.h:1766
#8  0x000055b0bf05636d in Field::store_field (this=<optimized out>, from=<optimized out>) at /test/10.3_dbg/sql/field.h:791
#9  0x000055b0bf05bd8f in field_conv_incompatible (to=to@entry=0x147fb0028da0, from=from@entry=0x147fb0028c78) at /test/10.3_dbg/sql/field_conv.cc:836
#10 0x000055b0bf05d2d8 in field_conv (to=to@entry=0x147fb0028da0, from=from@entry=0x147fb0028c78) at /test/10.3_dbg/sql/field_conv.cc:847
#11 0x000055b0bf0814cb in save_field_in_field (from=0x147fb0028c78, null_value=0x147fb002e13e, to=0x147fb0028da0, no_conversions=<optimized out>) at /test/10.3_dbg/sql/item.cc:6742
#12 0x000055b0bf0815af in Item_field::save_in_field (this=<optimized out>, to=<optimized out>, no_conversions=<optimized out>) at /test/10.3_dbg/sql/item.cc:6793
#13 0x000055b0beed10c6 in TABLE::update_virtual_fields (this=this@entry=0x147fb002cbf0, h=<optimized out>, update_mode=update_mode@entry=VCOL_UPDATE_FOR_WRITE) at /test/10.3_dbg/sql/table.cc:7978
#14 0x000055b0bed61d3f in fill_record (thd=thd@entry=0x147fb0000d90, table_arg=table_arg@entry=0x147fb002cbf0, fields=@0x147fb0005a20: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x147fb0011ed8, last = 0x147fb0012000, elements = 2}, <No data fields>}, values=@0x147fb0012010: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x147fb00120c0, last = 0x147fb0012168, elements = 2}, <No data fields>}, ignore_errors=ignore_errors@entry=false, update=update@entry=false) at /test/10.3_dbg/sql/sql_base.cc:8445
#15 0x000055b0bed62037 in fill_record_n_invoke_before_triggers (thd=thd@entry=0x147fb0000d90, table=table@entry=0x147fb002cbf0, fields=@0x147fb0005a20: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x147fb0011ed8, last = 0x147fb0012000, elements = 2}, <No data fields>}, values=@0x147fb0012010: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x147fb00120c0, last = 0x147fb0012168, elements = 2}, <No data fields>}, ignore_errors=ignore_errors@entry=false, event=event@entry=TRG_EVENT_INSERT) at /test/10.3_dbg/sql/sql_base.cc:8576
#16 0x000055b0beda4c2c in mysql_insert (thd=thd@entry=0x147fb0000d90, table_list=0x147fb0011760, fields=@0x147fb0005a20: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x147fb0011ed8, last = 0x147fb0012000, elements = 2}, <No data fields>}, values_list=@0x147fb0005a68: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x147fb0012178, last = 0x147fb0012178, elements = 1}, <No data fields>}, update_fields=@0x147fb0005a50: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55b0c01a7680 <end_of_list>, last = 0x147fb0005a50, elements = 0}, <No data fields>}, update_values=@0x147fb0005a38: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55b0c01a7680 <end_of_list>, last = 0x147fb0005a38, elements = 0}, <No data fields>}, duplic=DUP_ERROR, ignore=false) at /test/10.3_dbg/sql/sql_insert.cc:968
#17 0x000055b0bedd715b in mysql_execute_command (thd=thd@entry=0x147fb0000d90) at /test/10.3_dbg/sql/sql_parse.cc:4507
#18 0x000055b0bedde3ec in mysql_parse (thd=thd@entry=0x147fb0000d90, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14801411d540, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.3_dbg/sql/sql_parse.cc:7873
#19 0x000055b0bede0b5d in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x147fb0000d90, packet=packet@entry=0x147fb00199f1 "INSERT INTO t2 (a,b) VALUES (1,1)", packet_length=packet_length@entry=33, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.3_dbg/sql/sql_class.h:1152
#20 0x000055b0bede3cfd in do_command (thd=0x147fb0000d90) at /test/10.3_dbg/sql/sql_parse.cc:1398
#21 0x000055b0bef0ab11 in do_handle_one_connection (connect=connect@entry=0x55b0c266c6b0) at /test/10.3_dbg/sql/sql_connect.cc:1403
#22 0x000055b0bef0ad48 in handle_one_connection (arg=0x55b0c266c6b0) at /test/10.3_dbg/sql/sql_connect.cc:1308
#23 0x000014801c5ea609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#24 0x000014801c511293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

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

Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.2.38 (opt), 10.3.29 (opt), 10.4.19 (opt), 10.5.10 (opt), 10.6.1 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.34 (dbg), 5.7.34 (opt), 8.0.24 (dbg), 8.0.24 (opt

Comment by Roel Van de Paar [ 2021-05-11 ]

Raising prio as this issue (and others like it) continue to affect testing.

Comment by Roel Van de Paar [ 2021-05-11 ]

Different stack with altered testcase:

# mysqld options required for replay:  --log-bin
SET SESSION binlog_row_image=1;
CREATE TEMPORARY TABLE t1 SELECT UUID();
CREATE TABLE t2 (a INT PRIMARY KEY, b TEXT) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE t2 ADD COLUMN c INT GENERATED ALWAYS AS (b+1) VIRTUAL;
INSERT INTO t2 (a,b) VALUES (1,1);

Leads to:

10.6.1 f8665314d4ba190679001b81bb7d9fd7a38fc0f6 (Debug)

mysqld: /test/10.6_dbg/sql/field.cc:8633: virtual double Field_blob::val_real(): Assertion `marked_for_read()' failed.

10.6.1 f8665314d4ba190679001b81bb7d9fd7a38fc0f6 (Debug)

Core was generated by `/test/MD100521-mariadb-10.6.1-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 0x14d344bcb700 (LWP 2400518))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x000014d35007b859 in __GI_abort () at abort.c:79
#2  0x000014d35007b729 in __assert_fail_base (fmt=0x14d350211588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55b3c42df6e4 "marked_for_read()", file=0x55b3c42df4cb "/test/10.6_dbg/sql/field.cc", line=8633, function=<optimized out>) at assert.c:92
#3  0x000014d35008cf36 in __GI___assert_fail (assertion=assertion@entry=0x55b3c42df6e4 "marked_for_read()", file=file@entry=0x55b3c42df4cb "/test/10.6_dbg/sql/field.cc", line=line@entry=8633, function=function@entry=0x55b3c42e2688 "virtual double Field_blob::val_real()") at assert.c:101
#4  0x000055b3c375f82f in Field_blob::val_real (this=0x14d2e80308f8) at /test/10.6_dbg/sql/field.cc:8633
#5  0x000055b3c37a3646 in Item_field::val_real (this=0x14d2e804c500) at /test/10.6_dbg/sql/item.cc:3252
#6  0x000055b3c38225bb in Item_func_plus::real_op (this=0x14d2e804cfd0) at /test/10.6_dbg/sql/item_func.cc:1101
#7  0x000055b3c3691cb4 in Item_func_hybrid_field_type::val_real_from_real_op (this=<optimized out>) at /test/10.6_dbg/sql/item_func.h:862
#8  Type_handler_real_result::Item_func_hybrid_field_type_val_real (this=<optimized out>, item=<optimized out>) at /test/10.6_dbg/sql/sql_type.cc:5448
#9  0x000055b3c37ecf10 in Item_func_hybrid_field_type::val_real (this=0x14d2e804cfd0) at /test/10.6_dbg/sql/sql_type.h:7431
#10 0x000055b3c37ba77b in Item::save_real_in_field (this=0x14d2e804cfd0, field=0x14d2e8030a20, no_conversions=<optimized out>) at /test/10.6_dbg/sql/item.cc:6649
#11 0x000055b3c3694882 in Type_handler_real_result::Item_save_in_field (this=<optimized out>, item=<optimized out>, field=<optimized out>, no_conversions=<optimized out>) at /test/10.6_dbg/sql/sql_type.cc:4328
#12 0x000055b3c37a0921 in Item::save_in_field (this=0x14d2e804cfd0, field=0x14d2e8030a20, no_conversions=<optimized out>) at /test/10.6_dbg/sql/item.cc:6679
#13 0x000055b3c35cf743 in TABLE::update_virtual_fields (this=this@entry=0x14d2e803f5c8, h=<optimized out>, update_mode=update_mode@entry=VCOL_UPDATE_FOR_WRITE) at /test/10.6_dbg/sql/table.cc:8707
#14 0x000055b3c34302e7 in fill_record (thd=thd@entry=0x14d2e8000db8, table_arg=table_arg@entry=0x14d2e803f5c8, fields=@0x14d2e8006008: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14d2e8014a10, last = 0x14d2e8014b68, elements = 2}, <No data fields>}, values=@0x14d2e8015010: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14d2e80150c8, last = 0x14d2e8015178, elements = 2}, <No data fields>}, ignore_errors=ignore_errors@entry=false, update=update@entry=false) at /test/10.6_dbg/sql/sql_base.cc:8598
#15 0x000055b3c3430571 in fill_record_n_invoke_before_triggers (thd=thd@entry=0x14d2e8000db8, table=table@entry=0x14d2e803f5c8, fields=@0x14d2e8006008: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14d2e8014a10, last = 0x14d2e8014b68, elements = 2}, <No data fields>}, values=@0x14d2e8015010: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14d2e80150c8, last = 0x14d2e8015178, elements = 2}, <No data fields>}, ignore_errors=ignore_errors@entry=false, event=event@entry=TRG_EVENT_INSERT) at /test/10.6_dbg/sql/sql_base.cc:8727
#16 0x000055b3c3474bb3 in mysql_insert (thd=thd@entry=0x14d2e8000db8, table_list=0x14d2e80141e8, fields=@0x14d2e8006008: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14d2e8014a10, last = 0x14d2e8014b68, elements = 2}, <No data fields>}, values_list=@0x14d2e8006050: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14d2e8015188, last = 0x14d2e8015188, elements = 1}, <No data fields>}, update_fields=@0x14d2e8006038: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55b3c4a9c480 <end_of_list>, last = 0x14d2e8006038, elements = 0}, <No data fields>}, update_values=@0x14d2e8006020: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55b3c4a9c480 <end_of_list>, last = 0x14d2e8006020, elements = 0}, <No data fields>}, duplic=DUP_ERROR, ignore=false, result=0x0) at /test/10.6_dbg/sql/sql_insert.cc:996
#17 0x000055b3c34bc824 in mysql_execute_command (thd=thd@entry=0x14d2e8000db8) at /test/10.6_dbg/sql/sql_parse.cc:4559
#18 0x000055b3c34a702b in mysql_parse (thd=thd@entry=0x14d2e8000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14d344bca410) at /test/10.6_dbg/sql/sql_parse.cc:8018
#19 0x000055b3c34b5e5d in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14d2e8000db8, packet=packet@entry=0x14d2e800b8b9 "INSERT INTO t2 (a,b) VALUES (1,1)", packet_length=packet_length@entry=33, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_class.h:1333
#20 0x000055b3c34b9250 in do_command (thd=0x14d2e8000db8, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_parse.cc:1406
#21 0x000055b3c3613dec in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55b3c768c5c8, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1410
#22 0x000055b3c36143f1 in handle_one_connection (arg=arg@entry=0x55b3c768c5c8) at /test/10.6_dbg/sql/sql_connect.cc:1312
#23 0x000055b3c3ac6cee in pfs_spawn_thread (arg=0x55b3c755b028) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
#24 0x000014d350589609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#25 0x000014d350178293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

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

Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.2.38 (opt), 10.3.29 (opt), 10.4.19 (opt), 10.5.10 (opt), 10.6.1 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.34 (dbg), 5.7.34 (opt), 8.0.24 (dbg), 8.0.24 (opt)

Comment by Roel Van de Paar [ 2021-05-11 ]

There are several testcases in this bug which only fail from 10.4 to 10.6, and those would thus seem to be regressions from 10.4 onwards.

Comment by Roel Van de Paar [ 2021-06-08 ]

Slightly different stack with this possibly interesting testcase. Page size change is needed.

# mysqld options required for replay: --innodb_page_size=4k
CREATE TABLE t (c TEXT,PRIMARY KEY(c (768))) ENGINE=InnoDB;
INSERT INTO t VALUES (100);
ALTER TABLE t CONVERT TO CHARACTER SET utf8mb3;
SELECT 1 FROM t GROUP BY @b :=@a,@b;

Leads to:

10.6.2 06dd151bb86ad5b87d4d46011f36da1289c01074 (Debug)

mysqld: /test/10.6_dbg/sql/field.cc:8663: virtual String* Field_blob::val_str(String*, String*): Assertion `marked_for_read()' failed.

10.6.2 06dd151bb86ad5b87d4d46011f36da1289c01074 (Debug)

Core was generated by `/test/MD050621-mariadb-10.6.2-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 0x1532103e8700 (LWP 418807))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x0000153212fa6859 in __GI_abort () at abort.c:79
#2  0x0000153212fa6729 in __assert_fail_base (fmt=0x15321313c588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x560e16311174 "marked_for_read()", file=0x560e16310f5b "/test/10.6_dbg/sql/field.cc", line=8663, function=<optimized out>) at assert.c:92
#3  0x0000153212fb7f36 in __GI___assert_fail (assertion=assertion@entry=0x560e16311174 "marked_for_read()", file=file@entry=0x560e16310f5b "/test/10.6_dbg/sql/field.cc", line=line@entry=8663, function=function@entry=0x560e16314188 "virtual String* Field_blob::val_str(String*, String*)") at assert.c:101
#4  0x0000560e15797124 in Field_blob::val_str (this=0x1531c0090398, val_buffer=<optimized out>, val_ptr=0x1531c0091030) at /test/10.6_dbg/sql/field.cc:8663
#5  0x0000560e157da9e2 in Item_field::val_str (this=0x1531c0091008, str=0x1531c00911c0) at /test/10.6_dbg/sql/item.cc:3277
#6  0x0000560e1589dcb0 in Item_func_left::val_str (this=0x1531c0091198, str=0x1531c00911c0) at /test/10.6_dbg/sql/item_strfunc.cc:1618
#7  0x0000560e1584bc13 in Item::val_str (this=<optimized out>) at /test/10.6_dbg/sql/item.h:1011
#8  Item_func_hash::val_int (this=0x1531c0091270) at /test/10.6_dbg/sql/item_func.cc:1777
#9  0x0000560e157f2465 in Item::save_int_in_field (this=0x1531c0091270, field=0x1531c00904b8, no_conversions=<optimized out>) at /test/10.6_dbg/sql/item.cc:6702
#10 0x0000560e156cca86 in Type_handler_int_result::Item_save_in_field (this=<optimized out>, item=<optimized out>, field=<optimized out>, no_conversions=<optimized out>) at /test/10.6_dbg/sql/sql_type.cc:4344
#11 0x0000560e157d8605 in Item::save_in_field (this=0x1531c0091270, field=0x1531c00904b8, no_conversions=<optimized out>) at /test/10.6_dbg/sql/item.cc:6712
#12 0x0000560e15606795 in TABLE::update_virtual_fields (this=0x1531c006cdc8, h=h@entry=0x1531c0090790, update_mode=update_mode@entry=VCOL_UPDATE_FOR_READ) at /test/10.6_dbg/sql/table.cc:8718
#13 0x0000560e157c22df in handler::ha_rnd_next (this=0x1531c0090790, buf=0x1531c0090328 "") at /test/10.6_dbg/sql/handler.cc:3138
#14 0x0000560e159896a3 in rr_sequential (info=0x1531c0016d80) at /test/10.6_dbg/sql/records.h:82
#15 0x0000560e1554a2f2 in READ_RECORD::read_record (this=0x1531c0016d80) at /test/10.6_dbg/sql/records.h:81
#16 join_init_read_record (tab=0x1531c0016cb8) at /test/10.6_dbg/sql/sql_select.cc:21971
#17 0x0000560e155319b7 in sub_select (join=0x1531c00159b8, join_tab=0x1531c0016cb8, end_of_records=<optimized out>) at /test/10.6_dbg/sql/sql_select.cc:20993
#18 0x0000560e15569616 in do_select (procedure=0x0, join=0x1531c00159b8) at /test/10.6_dbg/sql/sql_select.cc:20543
#19 JOIN::exec_inner (this=this@entry=0x1531c00159b8) at /test/10.6_dbg/sql/sql_select.cc:4726
#20 0x0000560e15569b04 in JOIN::exec (this=this@entry=0x1531c00159b8) at /test/10.6_dbg/sql/sql_select.cc:4504
#21 0x0000560e15567a7a in mysql_select (thd=thd@entry=0x1531c0000db8, tables=0x1531c0014598, fields=@0x1531c00142f8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x1531c0014550, last = 0x1531c0014550, elements = 1}, <No data fields>}, conds=0x0, og_num=2, order=0x0, group=0x1531c0014ec8, having=0x0, proc_param=0x0, select_options=2147748608, result=0x1531c0015990, unit=0x1531c0005130, select_lex=0x1531c0014058) at /test/10.6_dbg/sql/sql_select.cc:4982
#22 0x0000560e15567d2f in handle_select (thd=thd@entry=0x1531c0000db8, lex=lex@entry=0x1531c0005068, result=result@entry=0x1531c0015990, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.6_dbg/sql/sql_select.cc:544
#23 0x0000560e154db6ac in execute_sqlcom_select (thd=thd@entry=0x1531c0000db8, all_tables=0x1531c0014598) at /test/10.6_dbg/sql/sql_parse.cc:6242
#24 0x0000560e154e858c in mysql_execute_command (thd=thd@entry=0x1531c0000db8) at /test/10.6_dbg/sql/sql_parse.cc:3937
#25 0x0000560e154d4adc in mysql_parse (thd=thd@entry=0x1531c0000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x1532103e7400) at /test/10.6_dbg/sql/sql_parse.cc:8016
#26 0x0000560e154e3646 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x1531c0000db8, packet=packet@entry=0x1531c000b769 "", packet_length=packet_length@entry=35, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_class.h:1340
#27 0x0000560e154e6a26 in do_command (thd=0x1531c0000db8, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_parse.cc:1406
#28 0x0000560e1564aec2 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x560e17fd2dd8, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1410
#29 0x0000560e1564b4c7 in handle_one_connection (arg=arg@entry=0x560e17fd2dd8) at /test/10.6_dbg/sql/sql_connect.cc:1312
#30 0x0000560e15af703a in pfs_spawn_thread (arg=0x560e17ebb368) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
#31 0x00001532134b4609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#32 0x00001532130a3293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

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

Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.2.38 (dbg), 10.2.38 (opt), 10.3.29 (dbg), 10.3.29 (opt), 10.4.19 (opt), 10.5.10 (opt), 10.6.2 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.34 (dbg), 5.7.34 (opt), 8.0.24 (dbg), 8.0.24 (opt)

Looks like the same bug, if different please let me know and I will lodge a new ticket.

Comment by Nikita Malyavin [ 2021-06-24 ]

Roel With the last test I am getting another crash, even on ALTER TABLE:

mysqld: ../storage/innobase/dict/dict0dict.cc:2322: dict_index_t *dict_index_build_internal_clust(dict_index_t *): Assertion `!index->has_virtual()' failed.
210624 20:29:01 [ERROR] mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
 
To report this bug, see https://mariadb.com/kb/en/reporting-bugs
 
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed, 
something is definitely wrong and this may fail.
 
Server version: 10.4.20-MariaDB-debug-log
key_buffer_size=1048576
read_buffer_size=131072
max_used_connections=1
max_threads=153
thread_count=3
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 63650 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
 
Thread pointer: 0x7fca30001618
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0x7fca440f8d50 thread_stack 0x49000
mysys/stacktrace.c:174(my_print_stacktrace)[0x56432441a47b]
sql/signal_handler.cc:222(handle_fatal_signal)[0x564323994624]
/usr/lib/libpthread.so.0(+0x13960)[0x7fca5422d960]
:0(__GI_raise)[0x7fca53e8bef5]
:0(__GI_abort)[0x7fca53e75862]
loadmsgcat.c:0(_nl_load_domain.cold)[0x7fca53e75747]
:0(__GI___assert_fail)[0x7fca53e84646]
/home/nik/mariadb/bld/sql/mysqld(+0x13dcab4)[0x5643240a3ab4]
dict/dict0dict.cc:2322(dict_index_build_internal_clust(dict_index_t*))[0x5643240a2a70]
dict/dict0crea.cc:1249(dict_create_index_step(que_thr_t*))[0x56432408f488]
que/que0que.cc:1048(que_thr_step(que_thr_t*))[0x564323e0aa94]
que/que0que.cc:1100(que_run_threads_low(que_thr_t*))[0x564323e099d5]
que/que0que.cc:1142(que_run_threads(que_thr_t*))[0x564323e096ed]
row/row0mysql.cc:2560(row_create_index_for_mysql(dict_index_t*, trx_t*, unsigned long const*))[0x564323e8ed07]
handler/ha_innodb.cc:11371(create_index(trx_t*, TABLE const*, dict_table_t*, unsigned int))[0x564323ca56ec]
handler/ha_innodb.cc:12454(create_table_info_t::create_table(bool))[0x564323c816ba]
handler/ha_innodb.cc:12975(ha_innobase::create(char const*, TABLE*, HA_CREATE_INFO*, bool, trx_t*))[0x564323ca696f]
handler/ha_innodb.cc:13026(ha_innobase::create(char const*, TABLE*, HA_CREATE_INFO*))[0x564323c8307f]
addr2line: DWARF error: could not find variable specification at offset 8445
sql/handler.cc:4790(handler::ha_create(char const*, TABLE*, HA_CREATE_INFO*))[0x5643239a75ad]
sql/handler.cc:5255(ha_create_table(THD*, char const*, char const*, char const*, HA_CREATE_INFO*, st_mysql_const_unsigned_lex_string*))[0x5643239a92be]
sql/sql_table.cc:10308(mysql_alter_table(THD*, st_mysql_const_lex_string const*, st_mysql_const_lex_string const*, HA_CREATE_INFO*, TABLE_LIST*, Alter_info*, unsigned int, st_order*, bool))[0x5643236abf91]
sql/sql_alter.cc:520(Sql_cmd_alter_table::execute(THD*))[0x56432376ebd7]
sql/sql_parse.cc:6189(mysql_execute_command(THD*))[0x564323591b56]
sql/sql_parse.cc:7992(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x56432357d284]
sql/sql_parse.cc:1857(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x56432357945e]
sql/sql_parse.cc:1373(do_command(THD*))[0x56432357e2a4]
sql/sql_connect.cc:1412(do_handle_one_connection(CONNECT*))[0x564323763014]
sql/sql_connect.cc:1316(handle_one_connection)[0x564323762dca]
perfschema/pfs.cc:1869(pfs_spawn_thread)[0x564324387a05]
pthread_create.c:0(start_thread)[0x7fca54223299]
:0(__GI___clone)[0x7fca53f4e053]

Did you experience same on 10.4?

10.5 fails like you described, however

EDIT: MDEV-26020 is created to address this issue

Comment by Elena Stepanova [ 2021-06-24 ]

nikitamalyavin,
Long primary keys (as in the last test) are dealt with in MDEV-20131, I'm not sure they belong here.

Comment by Nikita Malyavin [ 2021-06-25 ]

elenst It seems it kinda does, since Roel's issue was fixed by the patches I created for another test cases: http://github.com/MariaDB/server/commit/6f2198c3f61dadb9676ae60d7f5e166d13c48b0d

Thanks for referencing the issue though

Comment by Nikita Malyavin [ 2021-06-25 ]

midenok please review the two patches on `bb-10.2-nikita`:

  • e76a9a52d743ef50ff7be39664753be9c3f9cbaf [1/2] MDEV-18166 ASSERT_COLUMN_MARKED_FOR_READ failed on tables with vcols
  • d14a7a25068e7bf21bda3e94a3809e76d9184667 [2/2] MDEV-18166 ASSERT_COLUMN_MARKED_FOR_READ failed on tables with vcols
Comment by Roel Van de Paar [ 2021-06-26 ]

nikitamalyavin FWIW, yes get the same assert on 10.4.20 @ 8a2b4d531dc661ee605eeecdfc901bc833f86564 (14/6 build)

!index->has_virtual()|SIGABRT|dict_index_build_internal_clust|dict_index_add_to_cache|dict_create_index_step|que_thr_step

Interestingly, 10.5.11 @ 2c6d5c92c7e0e8b38dcb9fad94c7bf11ef4ba4b6 (14/6 build) as well as
10.6.3 @ 367c75c0990c7bd4bc4fb479a622a3acf2ee3769 (22/6 build) now also produce this assert. Bit confusing.

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