Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field_index) || bitmap_is_set(table->vcol_set, field_index))' failed with views in maria-5.3

Bug #798576 reported by Philip Stoev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MariaDB
Fix Released
Critical
Igor Babaev

Bug Description

Not repeatable with maria-5.2, mysql-5.1 . Seems to require views and non-integer field types. Further simplification of the query was not successful.

backtrace:

mysqld: field.cc:3747: virtual int Field_longlong::store(longlong, bool): Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field_index) || bitmap_is_set(table->vcol_set, field_index))' failed.
1

#6 0x00000033b58296e6 in __assert_fail () from /lib64/libc.so.6
#7 0x0000000000653f64 in Field_longlong::store (this=0x6d11a00, nr=29, unsigned_val=false) at field.cc:3747
#8 0x000000000084e193 in do_field_int (copy=0x6d77600) at field_conv.cc:351
#9 0x000000000084df12 in do_copy_maybe_null (copy=0x6d77600) at field_conv.cc:254
#10 0x000000000071d256 in copy_fields (param=0x6d65d10) at sql_select.cc:19261
#11 0x000000000072c2fc in end_update (join=0x6d5fe70, join_tab=0x6d6fb78, end_of_records=false) at sql_select.cc:16144
#12 0x000000000072a048 in evaluate_join_record (join=0x6d5fe70, join_tab=0x6d6f860, error=0) at sql_select.cc:15069
#13 0x00000000007333c4 in sub_select (join=0x6d5fe70, join_tab=0x6d6f860, end_of_records=false) at sql_select.cc:14914
#14 0x000000000072a048 in evaluate_join_record (join=0x6d5fe70, join_tab=0x6d6f548, error=0) at sql_select.cc:15069
#15 0x0000000000733252 in sub_select (join=0x6d5fe70, join_tab=0x6d6f548, end_of_records=false) at sql_select.cc:14874
#16 0x0000000000734586 in do_select (join=0x6d5fe70, fields=0x0, table=0x6d7af50, procedure=0x0) at sql_select.cc:14539
#17 0x00000000007520ce in JOIN::exec (this=0x6d5fe70) at sql_select.cc:2224
#18 0x000000000074dc3c in mysql_select (thd=0x6c90ea8, rref_pointer_array=0x6c939f8, tables=0x6cd8b20, wild_num=0, fields=..., conds=0x6d0e9c8, og_num=9,
    order=0x0, group=0x6d0ebd0, having=0x0, proc_param=0x0, select_options=2147764736, result=0x6d5f7a0, unit=0x6c932f0, select_lex=0x6c937d8)
    at sql_select.cc:2885
#19 0x0000000000754016 in handle_select (thd=0x6c90ea8, lex=0x6c93250, result=0x6d5f7a0, setup_tables_done_option=0) at sql_select.cc:283
#20 0x00000000006a14e8 in execute_sqlcom_select (thd=0x6c90ea8, all_tables=0x6cd8b20) at sql_parse.cc:5082
#21 0x00000000006a319b in mysql_execute_command (thd=0x6c90ea8) at sql_parse.cc:2227
#22 0x00000000006abf33 in mysql_parse (thd=0x6c90ea8,
    rawbuf=0x6cd7960 "SELECT COUNT( alias2.f10 ) , alias1.f11 AS field13 , alias2.f1 AS field14 , alias1.f10 AS field16 , alias2.f10 AS field17 , alias1.f3 AS field18 , alias1.f10 AS field19 , alias1.f6 AS field"..., length=493, found_semicolon=0x40968f08) at sql_parse.cc:6083
#23 0x00000000006acdcb in dispatch_command (command=COM_QUERY, thd=0x6c90ea8,
    packet=0x6cce5e9 "SELECT COUNT( alias2.f10 ) , alias1.f11 AS field13 , alias2.f1 AS field14 , alias1.f10 AS field16 , alias2.f10 AS field17 , alias1.f3 AS field18 , alias1.f10 AS field19 , alias1.f6 AS field"..., packet_length=493) at sql_parse.cc:1206
#24 0x00000000006ae3dd in do_command (thd=0x6c90ea8) at sql_parse.cc:904
#25 0x0000000000698e8f in handle_one_connection (arg=0x6c90ea8) at sql_connect.cc:1177
#26 0x00000033b600673d in start_thread () from /lib64/libpthread.so.0
#27 0x00000033b58d40cd in clone () from /lib64/libc.so.6

explain:

id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 Using temporary; Using filesort
1 SIMPLE alias1 ALL NULL NULL NULL NULL 2 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where

test case:

SET SESSION join_cache_level=0; # to avoid JKL references in stack trace

CREATE TABLE t1 ( f1 int NOT NULL , f10 varchar(32)) ;
INSERT IGNORE INTO t1 VALUES (20,'r');

CREATE TABLE t2 ( f1 int NOT NULL , f3 int, f6 time, f7 time, f8 datetime, f9 datetime, f10 varchar(1) COLLATE latin1_swedish_ci, f11 varchar(1) COLLATE latin1_swedish_ci) ;
INSERT IGNORE INTO t2 VALUES (28,NULL,'08:46:48','08:46:48','2005-03-24 07:33:11','2005-03-24 07:33:11','j','j'),(29,8,'14:11:27','14:11:27','2003-06-13 23:19:49','2003-06-13 23:19:49','c','c');

CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1;
CREATE OR REPLACE VIEW v2 AS SELECT * FROM t2;

EXPLAIN SELECT COUNT( alias2.f10 ) , alias1.f11 AS field13 , alias2.f1 AS field14 , alias1.f10 AS field16 , alias2.f10 AS field17 , alias1.f3 AS field18 , alias1.f10 AS field19 , alias1.f6 AS field20 , alias1.f3 AS field21 , alias2.f6 AS field22 FROM t2 AS alias1 RIGHT JOIN v2 AS alias2 RIGHT JOIN v1 AS alias3 ON alias3.f1 ON alias3.f10 > alias2.f10 WHERE alias1.f1 GROUP BY field13 , field14 , field16 , field17 , field18 , field19 , field20 , field21 , field22;

Changed in maria:
milestone: none → 5.3
assignee: nobody → Igor Babaev (igorb-seattle)
Revision history for this message
Philip Stoev (pstoev-askmonty) wrote :

Simplified test case:

CREATE TABLE t1 ( f1 int NOT NULL , f2 int NOT NULL ) ;
INSERT INTO t1 VALUES (214,0),(6,6);

CREATE TABLE t2 ( f2 int) ;
INSERT INTO t2 VALUES (88),(88);

CREATE ALGORITHM=MERGE VIEW v2 AS SELECT t1.f1, t2.f2 FROM (t2 LEFT JOIN t1 ON (t2.f2 <> t1.f1)) WHERE (t1.f2 <= 'up') ;
SELECT f1 , MIN(f2) FROM v2 GROUP BY f1;

backtrace:

#8 0x006b0d98 in __assert_fail () from /lib/libc.so.6
#9 0x08263da3 in Field_longlong::store (this=0xae529640, nr=88, unsigned_val=false) at field.cc:3747
#10 0x081ea570 in Item_sum_hybrid::reset_field (this=0xae5127d0) at item_sum.cc:1823
#11 0x08343c19 in init_tmptable_sum_functions (func_ptr=0xae52b60c) at sql_select.cc:19545
#12 0x0833c3de in end_update (join=0xae52c9b0, join_tab=0xae52c378, end_of_records=false) at sql_select.cc:16183
#13 0x082ef874 in JOIN_CACHE::generate_full_extensions (this=0xae531d68, rec_ptr=0xae525f90 "\375X") at sql_join_cache.cc:2322
#14 0x082ef62e in JOIN_CACHE::join_matching_records (this=0xae531d68, skip_last=false) at sql_join_cache.cc:2215
#15 0x082ef190 in JOIN_CACHE::join_records (this=0xae531d68, skip_last=false) at sql_join_cache.cc:2014
#16 0x08338bcd in sub_select_cache (join=0xae52c9b0, join_tab=0xae52c174, end_of_records=true) at sql_select.cc:14655
#17 0x08338de5 in sub_select (join=0xae52c9b0, join_tab=0xae52bf70, end_of_records=true) at sql_select.cc:14817
#18 0x083388d4 in do_select (join=0xae52c9b0, fields=0x0, table=0xae533c28, procedure=0x0) at sql_select.cc:14541
#19 0x0831bfc9 in JOIN::exec (this=0xae52c9b0) at sql_select.cc:2224
#20 0x0831e150 in mysql_select (thd=0xaf62680, rref_pointer_array=0xaf64198, tables=0xae5128e0, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x0,
    group=0xae512bd8, having=0x0, proc_param=0x0, select_options=2147764736, result=0xae52aef0, unit=0xaf63d9c, select_lex=0xaf64078) at sql_select.cc:2885
#21 0x0831601b in handle_select (thd=0xaf62680, lex=0xaf63d40, result=0xae52aef0, setup_tables_done_option=0) at sql_select.cc:283
#22 0x082b174b in execute_sqlcom_select (thd=0xaf62680, all_tables=0xae5128e0) at sql_parse.cc:5082
#23 0x082a854f in mysql_execute_command (thd=0xaf62680) at sql_parse.cc:2227
#24 0x082b3d87 in mysql_parse (thd=0xaf62680, rawbuf=0xae5125e0 "SELECT f1 , MIN(f2) FROM v2 GROUP BY f1", length=39, found_semicolon=0xae8a0228)
    at sql_parse.cc:6083
#25 0x082a61eb in dispatch_command (command=COM_QUERY, thd=0xaf62680, packet=0xafbd1c9 "SELECT f1 , MIN(f2) FROM v2 GROUP BY f1", packet_length=39)
    at sql_parse.cc:1206
#26 0x082a5671 in do_command (thd=0xaf62680) at sql_parse.cc:904
#27 0x082a26ec in handle_one_connection (arg=0xaf62680) at sql_connect.cc:1177
#28 0x00821919 in start_thread () from /lib/libpthread.so.0
#29 0x0076acce in clone () from /lib/libc.so.6

Changed in maria:
status: New → Confirmed
importance: Undecided → Critical
Changed in maria:
status: Confirmed → In Progress
Changed in maria:
status: In Progress → Fix Committed
Changed in maria:
status: Fix Committed → Fix Released
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.