[MDEV-17755] 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 in Field_bit::val_int upon SELECT with JOIN, partitions, indexed virtual column Created: 2018-11-16  Updated: 2018-12-20  Resolved: 2018-12-20

Status: Closed
Project: MariaDB Server
Component/s: Partitioning, Storage Engine - InnoDB, Virtual Columns
Affects Version/s: 10.2
Fix Version/s: 10.2.20

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

Issue Links:
Duplicate
is duplicated by MDEV-16429 Assertion `!table || (!table->read_se... Closed

 Description   

Note: On some reason, it is only reproducible on 10.2.

--source include/have_innodb.inc
--source include/have_partition.inc
 
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (
  b INT,
  c INT,
  d BIT NOT NULL DEFAULT 0,
  v BIT AS (d) VIRTUAL,
  KEY (b,v)
) ENGINE=InnoDB PARTITION BY HASH (b);
 
INSERT INTO t1 VALUES (1),(2);
INSERT INTO t2 (b,c,d) VALUES (1,1,0),(2,2,0);
 
SELECT t1.* FROM t1 JOIN t2 ON (v = a);
 
# Cleanup
DROP TABLE t1, t2;

10.2 f74649b522f

mysqld: /data/src/10.2/sql/field.cc:9394: 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.
181117  1:31:03 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f9264806ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x00005587256c8238 in Field_bit::val_int (this=0x7f9214006818) at /data/src/10.2/sql/field.cc:9394
#9  0x00005587256d0e7a in Field_bit::save_in_field (this=0x7f9214006818, to=0x7f92140068f8) at /data/src/10.2/sql/field.h:3688
#10 0x00005587254e9a14 in Field::store_field (this=0x7f92140068f8, from=0x7f9214006818) at /data/src/10.2/sql/field.h:829
#11 0x00005587256d4f61 in field_conv_incompatible (to=0x7f92140068f8, from=0x7f9214006818) at /data/src/10.2/sql/field_conv.cc:831
#12 0x00005587256d4fbd in field_conv (to=0x7f92140068f8, from=0x7f9214006818) at /data/src/10.2/sql/field_conv.cc:844
#13 0x0000558725701b37 in save_field_in_field (from=0x7f9214006818, null_value=0x7f921409269a, to=0x7f92140068f8, no_conversions=false) at /data/src/10.2/sql/item.cc:6245
#14 0x0000558725701d3e in Item_field::save_in_field (this=0x7f9214092628, to=0x7f92140068f8, no_conversions=false) at /data/src/10.2/sql/item.cc:6291
#15 0x00005587255746e9 in TABLE::update_virtual_fields (this=0x7f92140909f0, h=0x7f9214091d08, update_mode=VCOL_UPDATE_FOR_READ) at /data/src/10.2/sql/table.cc:7635
#16 0x00005587256e3c02 in handler::ha_index_first (this=0x7f9214091d08, buf=0x7f9214006630 "\365\001") at /data/src/10.2/sql/handler.cc:2727
#17 0x0000558725e044e6 in ha_partition::handle_unordered_scan_next_partition (this=0x7f92140915f8, buf=0x7f9214006630 "\365\001") at /data/src/10.2/sql/ha_partition.cc:6048
#18 0x0000558725e0368b in ha_partition::common_first_last (this=0x7f92140915f8, buf=0x7f9214006630 "\365\001") at /data/src/10.2/sql/ha_partition.cc:5612
#19 0x0000558725e0354c in ha_partition::index_first (this=0x7f92140915f8, buf=0x7f9214006630 "\365\001") at /data/src/10.2/sql/ha_partition.cc:5561
#20 0x00005587256e3b31 in handler::ha_index_first (this=0x7f92140915f8, buf=0x7f9214006630 "\365\001") at /data/src/10.2/sql/handler.cc:2720
#21 0x000055872584f743 in rr_index_first (info=0x7f9214016250) at /data/src/10.2/sql/records.cc:401
#22 0x00005587254d6380 in join_init_read_record (tab=0x7f9214016188) at /data/src/10.2/sql/sql_select.cc:19684
#23 0x00005587255f69c8 in JOIN_TAB_SCAN::open (this=0x7f9214016dd8) at /data/src/10.2/sql/sql_join_cache.cc:3339
#24 0x00005587255f4ed6 in JOIN_CACHE::join_matching_records (this=0x7f9214016ca8, skip_last=false) at /data/src/10.2/sql/sql_join_cache.cc:2250
#25 0x00005587255f4a5a in JOIN_CACHE::join_records (this=0x7f9214016ca8, skip_last=false) at /data/src/10.2/sql/sql_join_cache.cc:2087
#26 0x00005587254d3da2 in sub_select_cache (join=0x7f9214013e30, join_tab=0x7f9214016188, end_of_records=true) at /data/src/10.2/sql/sql_select.cc:18541
#27 0x00005587254d3fb4 in sub_select (join=0x7f9214013e30, join_tab=0x7f9214015dd8, end_of_records=true) at /data/src/10.2/sql/sql_select.cc:18713
#28 0x00005587254d37ca in do_select (join=0x7f9214013e30, procedure=0x0) at /data/src/10.2/sql/sql_select.cc:18308
#29 0x00005587254add5b in JOIN::exec_inner (this=0x7f9214013e30) at /data/src/10.2/sql/sql_select.cc:3621
#30 0x00005587254ad208 in JOIN::exec (this=0x7f9214013e30) at /data/src/10.2/sql/sql_select.cc:3416
#31 0x00005587254ae3d3 in mysql_select (thd=0x7f9214000b00, tables=0x7f9214012650, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f9214013e10, unit=0x7f92140046e0, select_lex=0x7f9214004e18) at /data/src/10.2/sql/sql_select.cc:3816
#32 0x00005587254a2607 in handle_select (thd=0x7f9214000b00, lex=0x7f9214004618, result=0x7f9214013e10, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:376
#33 0x000055872546dc6b in execute_sqlcom_select (thd=0x7f9214000b00, all_tables=0x7f9214012650) at /data/src/10.2/sql/sql_parse.cc:6478
#34 0x0000558725463beb in mysql_execute_command (thd=0x7f9214000b00) at /data/src/10.2/sql/sql_parse.cc:3484
#35 0x0000558725471b45 in mysql_parse (thd=0x7f9214000b00, rawbuf=0x7f9214012448 "SELECT t1.* FROM t1 JOIN t2 ON (v = a)", length=38, parser_state=0x7f925c471200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:8012
#36 0x000055872545f48f in dispatch_command (command=COM_QUERY, thd=0x7f9214000b00, packet=0x7f9214095df1 "", packet_length=38, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1824
#37 0x000055872545ddf2 in do_command (thd=0x7f9214000b00) at /data/src/10.2/sql/sql_parse.cc:1378
#38 0x00005587255b034d in do_handle_one_connection (connect=0x558728787070) at /data/src/10.2/sql/sql_connect.cc:1335
#39 0x00005587255b00da in handle_one_connection (arg=0x558728787070) at /data/src/10.2/sql/sql_connect.cc:1241
#40 0x00005587259d5cea in pfs_spawn_thread (arg=0x5587286d2520) at /data/src/10.2/storage/perfschema/pfs.cc:1862
#41 0x00007f92662c2494 in start_thread (arg=0x7f925c472700) at pthread_create.c:333
#42 0x00007f92648c393f in clone () from /lib/x86_64-linux-gnu/libc.so.6

Not reproducible with MyISAM.
No obvious effect on a non-debug build.


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