[MDEV-17349] Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed on concurrent SELECT and DELETE after RENAME from table with index on virtual column Created: 2018-10-02  Updated: 2018-11-04  Resolved: 2018-11-04

Status: Closed
Project: MariaDB Server
Component/s: Data Manipulation - Delete, Virtual Columns
Affects Version/s: 10.2, 10.3
Fix Version/s: 10.3.11, 10.2.19

Type: Bug Priority: Critical
Reporter: Elena Stepanova Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: affects-tests


 Description   

The test case is non-deterministic, run with --repeat=N. Usually the failure happens fast enough (in the first few repetitions), but sometimes it might take several dozen, so use a big enough N.

Also, running with --mem, while not essential for reproducing, make it much faster.

--source include/have_innodb.inc
 
CREATE TABLE t1 (f TEXT, vf TINYTEXT AS (f), KEY (vf(64))) ENGINE=InnoDB;
INSERT INTO t1 (f) VALUES ('foo');
 
--connect (con1,localhost,root,,test)
 
RENAME TABLE t1 TO tmp, tmp TO t1;
--send
  SELECT * from t1;
 
--connection default
  DELETE FROM t1;
 
# Cleanup
--connection con1
--reap
--disconnect con1
--connection default
DROP TABLE t1;

10.2 61a6f4bd9

mysqld: /data/src/10.2/sql/field.cc:8108: virtual String* Field_blob::val_str(String*, String*): Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed.
181002 16:07:47 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f4feb139ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x000055afec101814 in Field_blob::val_str (this=0x7f4f900a40b8, val_buffer=0x7f4f900a42b8, val_ptr=0x7f4f900a42b8) at /data/src/10.2/sql/field.cc:8108
#9  0x000055afebddd429 in Field::val_str (this=0x7f4f900a40b8, str=0x7f4f900a42b8) at /data/src/10.2/sql/field.h:865
#10 0x000055afec10d6ed in Field_blob::store_field (this=0x7f4f900a41d8, from=0x7f4f900a40b8) at /data/src/10.2/sql/field.h:3303
#11 0x000055afec1121b3 in field_conv_incompatible (to=0x7f4f900a41d8, from=0x7f4f900a40b8) at /data/src/10.2/sql/field_conv.cc:831
#12 0x000055afec11220f in field_conv (to=0x7f4f900a41d8, from=0x7f4f900a40b8) at /data/src/10.2/sql/field_conv.cc:844
#13 0x000055afec13f499 in save_field_in_field (from=0x7f4f900a40b8, null_value=0x7f4f9009b98a, to=0x7f4f900a41d8, no_conversions=false) at /data/src/10.2/sql/item.cc:6421
#14 0x000055afec13f6a0 in Item_field::save_in_field (this=0x7f4f9009b918, to=0x7f4f900a41d8, no_conversions=false) at /data/src/10.2/sql/item.cc:6467
#15 0x000055afebfb41a1 in TABLE::update_virtual_fields (this=0x7f4f900a9400, h=0x7f4f900a24c8, update_mode=VCOL_UPDATE_FOR_READ) at /data/src/10.2/sql/table.cc:7621
#16 0x000055afec11fd9a in handler::ha_rnd_next (this=0x7f4f900a24c8, buf=0x7f4f900a4070 "\374\003") at /data/src/10.2/sql/handler.cc:2585
#17 0x000055afec28d6c4 in rr_sequential (info=0x7f4fdc55ced0) at /data/src/10.2/sql/records.cc:485
#18 0x000055afec2b8f9a in mysql_delete (thd=0x7f4f90000b00, table_list=0x7f4f90012550, conds=0x0, order_list=0x7f4f90005078, limit=18446744073709551615, options=0, result=0x0) at /data/src/10.2/sql/sql_delete.cc:559
#19 0x000055afebea6f40 in mysql_execute_command (thd=0x7f4f90000b00) at /data/src/10.2/sql/sql_parse.cc:4633
#20 0x000055afebeb187f in mysql_parse (thd=0x7f4f90000b00, rawbuf=0x7f4f90012488 "DELETE FROM t1", length=14, parser_state=0x7f4fdc55e200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:8011
#21 0x000055afebe9f1da in dispatch_command (command=COM_QUERY, thd=0x7f4f90000b00, packet=0x7f4f90095ef1 "DELETE FROM t1", packet_length=14, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1824
#22 0x000055afebe9db3d in do_command (thd=0x7f4f90000b00) at /data/src/10.2/sql/sql_parse.cc:1378
#23 0x000055afebfefb4e in do_handle_one_connection (connect=0x55afef31d6c0) at /data/src/10.2/sql/sql_connect.cc:1335
#24 0x000055afebfef8db in handle_one_connection (arg=0x55afef31d6c0) at /data/src/10.2/sql/sql_connect.cc:1241
#25 0x000055afec413aa8 in pfs_spawn_thread (arg=0x55afef268bf0) at /data/src/10.2/storage/perfschema/pfs.cc:1862
#26 0x00007f4fece10494 in start_thread (arg=0x7f4fdc55f700) at pthread_create.c:333
#27 0x00007f4feb1f693f in clone () from /lib/x86_64-linux-gnu/libc.so.6

Reproducible on 10.2, 10.3. Not applicable to 10.1 due to the index on the virtual columns.
Couldn't reproduce on 10.4 in 1000 repetitions.
No visible effect on non-debug builds.


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