Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-4257

Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' fails on FROM subquery with fulltext search, derived_merge=on

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.0.1, 5.5.29, 5.3.12
    • Fix Version/s: 10.0.4, 5.5.32, 5.3.13
    • Component/s: None
    • Labels:
      None

      Description

      The following test case

      SET optimizer_switch = 'derived_merge=on';
      CREATE TABLE t1 (c1 char(8), c2 char(8)) ENGINE=MyISAM;
      INSERT INTO t1 VALUES ('test1','test2'),('test3','test4');
      SELECT * FROM ( SELECT c1 FROM t1 WHERE MATCH (c2) AGAINST ( 'hello' IN BOOLEAN MODE ) ) AS alias ;

      causes assertion failure:

      mysqld: field.cc:6410: virtual String* Field_string::val_str(String*, String*): Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed.

      #6  0x00007f1dc1e020ee in __assert_fail_base (fmt=<optimized out>, assertion=0xcaebd0 "!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))", file=0xcaeaef "field.cc", line=<optimized out>, function=<optimized out>) at assert.c:94
      #7  0x00007f1dc1e02192 in __GI___assert_fail (assertion=0xcaebd0 "!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))", file=0xcaeaef "field.cc", line=6410, function=0xcb0aa0 "virtual String* Field_string::val_str(String*, String*)") at assert.c:103
      #8  0x00000000006436c3 in Field_string::val_str (this=0x7f1da802dfc0, val_buffer=0x7f1da801a698, val_ptr=0x7f1da801a3d0) at field.cc:6410
      #9  0x0000000000581861 in Item_field::val_str (this=0x7f1da801a3b8, str=0x7f1da801a698) at item.cc:2302
      #10 0x00000000005e1687 in Item_func_concat_ws::val_str (this=0x7f1da8035560, str=0x7f1da801a698) at item_strfunc.cc:656
      #11 0x00000000005c16db in Item_func_match::val_real (this=0x7f1da801a598) at item_func.cc:5761
      #12 0x00000000005c567f in Item_func_match::val_int (this=0x7f1da801a598) at item_func.h:1705
      #13 0x000000000072e944 in evaluate_join_record (join=0x7f1da80318d8, join_tab=0x7f1da8032e70, error=0) at sql_select.cc:15976
      #14 0x000000000072e535 in sub_select (join=0x7f1da80318d8, join_tab=0x7f1da8032e70, end_of_records=false) at sql_select.cc:15880
      #15 0x000000000072dd12 in do_select (join=0x7f1da80318d8, fields=0x360c460, table=0x0, procedure=0x0) at sql_select.cc:15541
      #16 0x000000000070e386 in JOIN::exec (this=0x7f1da80318d8) at sql_select.cc:2769
      #17 0x000000000070ec11 in mysql_select (thd=0x36098b8, rref_pointer_array=0x360c5a8, tables=0x7f1da80314e0, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147764736, result=0x7f1da801ac40, unit=0x360be48, select_lex=0x360c350) at sql_select.cc:2990
      #18 0x0000000000705685 in handle_select (thd=0x36098b8, lex=0x360bda8, result=0x7f1da801ac40, setup_tables_done_option=0) at sql_select.cc:288
      #19 0x0000000000691992 in execute_sqlcom_select (thd=0x36098b8, all_tables=0x7f1da80314e0) at sql_parse.cc:5172
      #20 0x000000000068875a in mysql_execute_command (thd=0x36098b8) at sql_parse.cc:2305
      #21 0x000000000069441c in mysql_parse (thd=0x36098b8, rawbuf=0x7f1da8018f40 "SELECT * FROM ( SELECT c1 FROM t1 WHERE MATCH (c2) AGAINST ( 'hello' IN BOOLEAN MODE ) ) AS alias", length=97, found_semicolon=0x7f1db45477e0) at sql_parse.cc:6173
      #22 0x0000000000685e77 in dispatch_command (command=COM_QUERY, thd=0x36098b8, packet=0x3683b69 "", packet_length=98) at sql_parse.cc:1243
      #23 0x00000000006850e8 in do_command (thd=0x36098b8) at sql_parse.cc:923
      #24 0x0000000000681f82 in handle_one_connection (arg=0x36098b8) at sql_connect.cc:1231
      #25 0x00007f1dc299de9a in start_thread (arg=0x7f1db4548700) at pthread_create.c:308
      #26 0x00007f1dc1ec6cbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

      EXPLAIN EXTENDED
      SELECT * FROM ( SELECT c1 FROM t1 WHERE MATCH (c2) AGAINST ( 'hello' IN BOOLEAN MODE ) ) AS alias ;
      id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
      1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	2	100.00	Using where
      Warnings:
      Note	1003	select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (match `test`.`t1`.`c2` against ('hello' in boolean mode))
      SELECT * FROM ( SELECT c1 FROM t1 WHERE MATCH (c2) AGAINST ( 'hello' IN BOOLEAN MODE ) ) AS alias ;

      Minimal optimizer_switch: derived_merge=on
      Full optimizer_switch (default):

      index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on

      revision-id: igor@askmonty.org-20130308082526-5w0b7gya5ed97uzo
      revno: 3635
      branch-nick: 5.3

      Built with BUILD/compile-pentium-debug-max-no-ndb.

      Also reproducible on 5.5, 10.0.

      Reproducible with a MERGE view instead of the subquery.

        Attachments

          Activity

            People

            • Assignee:
              serg Sergei Golubchik
              Reporter:
              elenst Elena Stepanova
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: