Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed with MyISAM/Aria + MRR + DISABLE/ENABLE KEYS

Bug #693126 reported by Philip Stoev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MariaDB
Invalid
Undecided
Sergey Petrunia

Bug Description

In the latest maria-5.3, after the dsmrr-cpk changes were brought in:

mysqld: field.cc:3730: virtual longlong Field_long::val_int(): Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed.

backtrace:

#8 0x006b0d98 in __assert_fail () from /lib/libc.so.6
#9 0x08255df9 in Field_long::val_int (this=0xae647eb0) at field.cc:3730
#10 0x081c41d9 in Item_field::val_int (this=0xae62e670) at item.cc:2129
#11 0x08200f6e in Arg_comparator::compare_int_signed (this=0xae62e800) at item_cmpfunc.cc:1472
#12 0x081e5d6c in Arg_comparator::compare (this=0xae62e800) at item_cmpfunc.h:81
#13 0x0820270d in Item_func_ge::val_int (this=0xae62e780) at item_cmpfunc.cc:2101
#14 0x084bd42b in index_cond_func_myisam (arg=0xae6530e8) at ha_myisam.cc:1726
#15 0x085006ff in mi_check_index_cond (info=0xae639190, keynr=0,
    record=0xae647560 "\373\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"...) at mi_key.c:521
#16 0x084c29d6 in mi_rkey (info=0xae639190,
    buf=0xae647560 "\373\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"..., inx=0, key=0xae653ee0 "", keypart_map=1, search_flag=HA_READ_KEY_OR_NEXT) at mi_rkey.c:121
#17 0x084bd587 in ha_myisam::index_read_map (this=0xae6530e8,
    buf=0xae647560 "\373\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"..., key=0xae653ee0 "", keypart_map=1, find_flag=HA_READ_KEY_OR_NEXT) at ha_myisam.cc:1761
#18 0x081b1335 in handler::ha_index_read_map (this=0xae6530e8,
    buf=0xae647560 "\373\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"..., key=0xae653ee0 "", keypart_map=1, find_flag=HA_READ_KEY_OR_NEXT) at sql_class.h:3494
#19 0x083db897 in handler::read_range_first (this=0xae6530e8, start_key=0xae65318c, end_key=0x0, eq_range_arg=false, sorted=false) at handler.cc:4323
#20 0x084a4583 in handler::multi_range_read_next (this=0xae6530e8, range_info=0xae9dfb88) at multi_range_read.cc:280
#21 0x084a472b in Mrr_simple_index_reader::get_next (this=0xae64748c, range_info=0xae9dfb88) at multi_range_read.cc:312
#22 0x084a521d in Mrr_ordered_rndpos_reader::refill_from_index_reader (this=0xae647404) at multi_range_read.cc:601
#23 0x084a506b in Mrr_ordered_rndpos_reader::refill_buffer (this=0xae647404, initial=false) at multi_range_read.cc:557
#24 0x084a5b89 in DsMrr_impl::dsmrr_init (this=0xae6473ec, h_arg=0xae647078, seq_funcs=0xae9dfcc0, seq_init_param=0xae63a160, n_ranges=1, mode=4, buf=0xae664ec0) at multi_range_read.cc:884
#25 0x084be7ec in ha_myisam::multi_range_read_init (this=0xae647078, seq=0xae9dfcc0, seq_init_param=0xae63a160, n_ranges=1, mode=4, buf=0xae664ec0) at ha_myisam.cc:2224
#26 0x083ba40b in QUICK_RANGE_SELECT::reset (this=0xae63a160) at opt_range.cc:8427
#27 0x083d0b49 in find_all_keys (param=0xae9dffc8, select=0xae6527e0, sort_keys=0xae63a3c8, buffpek_pointers=0xae9dfe00, tempfile=0xae9dfee4, indexfile=0x0) at filesort.cc:568
#28 0x083cfa38 in filesort (thd=0xaa2da70, table=0xae646968, sortorder=0xae6530b8, s_length=1, select=0xae6527e0, max_rows=18446744073709551615, sort_positions=false, examined_rows=0xae9e0130) at filesort.cc:246
#29 0x083318fb in create_sort_index (thd=0xaa2da70, join=0xae64d068, order=0xae62eee8, filesort_limit=18446744073709551615, select_limit=18446744073709551615, is_order_by=false) at sql_select.cc:16234
#30 0x0830f038 in JOIN::exec (this=0xae64d068) at sql_select.cc:2347
#31 0x0830fb06 in mysql_select (thd=0xaa2da70, rref_pointer_array=0xaa2f50c, tables=0xae62dce0, wild_num=0, fields=..., conds=0xae62eb78, og_num=1, order=0xae62eee8, group=0x0, having=0xae62ed40, proc_param=0x0,
    select_options=2147764736, result=0xae62ef88, unit=0xaa2f16c, select_lex=0xaa2f408) at sql_select.cc:2621
#32 0x0830800d in handle_select (thd=0xaa2da70, lex=0xaa2f110, result=0xae62ef88, setup_tables_done_option=0) at sql_select.cc:286
#33 0x082a3400 in execute_sqlcom_select (thd=0xaa2da70, all_tables=0xae62dce0) at sql_parse.cc:5070
#34 0x08299e1b in mysql_execute_command (thd=0xaa2da70) at sql_parse.cc:2234
#35 0x082a599e in mysql_parse (thd=0xaa2da70,
    rawbuf=0xae62d9f0 "SELECT table2 . `f1` AS field1 FROM D AS table1\nRIGHT JOIN D AS table2 ON table1 . `f11` = table2 . `f5`\nWHERE ( table2 . `f9` >= 1 AND table1 . `f1` IN (127, 2, 2) )\nHAVING field1 != 3\nORDER"...,
    length=210, found_semicolon=0xae9e1228) at sql_parse.cc:6077
#36 0x08297904 in dispatch_command (command=COM_QUERY, thd=0xaa2da70,
    packet=0xaa47c31 "SELECT table2 . `f1` AS field1 FROM D AS table1\nRIGHT JOIN D AS table2 ON table1 . `f11` = table2 . `f5`\nWHERE ( table2 . `f9` >= 1 AND table1 . `f1` IN (127, 2, 2) )\nHAVING field1 != 3\nORDER"...,
    packet_length=211) at sql_parse.cc:1210
#37 0x08296d6e in do_command (thd=0xaa2da70) at sql_parse.cc:903
#38 0x08293e4a in handle_one_connection (arg=0xaa2da70) at sql_connect.cc:1154
#39 0x00821919 in start_thread () from /lib/libpthread.so.0
#40 0x0076acce in clone () from /lib/libc.so.6

Revision history for this message
Philip Stoev (philip-stoev) wrote :

Test case:

CREATE TABLE D (
f1 int,
f5 varchar(1024),
f9 int(11),
f11 varchar(10),
KEY (f9),
KEY (f11)) ;
ALTER TABLE D DISABLE KEYS;
INSERT IGNORE INTO D VALUES (1,'f','-577699840','all'),('8','I\'ll','6','w');
ALTER TABLE D ENABLE KEYS;

SELECT table2 . `f1` AS field1 FROM D AS table1
RIGHT JOIN D AS table2 ON table1 . `f11` = table2 . `f5`
WHERE ( table2 . `f9` >= 1 AND table1 . `f1` IN (127, 2, 2) )
HAVING field1 != 3
ORDER BY field1
;

summary: Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set,
- field_index))' failed with MyISAM/Aria + MRR
+ field_index))' failed with MyISAM/Aria + MRR + DISABLE/ENABLE KEYS
Changed in maria:
assignee: nobody → Sergey Petrunia (sergefp)
milestone: none → 5.3
Revision history for this message
Philip Stoev (philip-stoev) wrote :

Sergey P, for some reason the backtrace remains the same even with optimizer_use_mrr='disable'. Can you please make sure the optimizer_use_mrr switch is applied properly in this case -- there should be no MRR functions in the backtrace if MRR is supposedly off.

Revision history for this message
Sergey Petrunia (sergefp) wrote :

Not repeatable with current 5.3 tree. Added a testcase to the testsuite.

Changed in maria:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.