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

Crash in EITS code when enabling 128 indexes

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.4
    • Fix Version/s: 10.4.5
    • Component/s: Optimizer
    • Labels:
      None

      Description

      Got this from Wlad: range_vs_index_merge test fails in 128-index build.

      Can be reproduced on bb-10.4-wlad with

      cmake . -DCMAKE_BUILD_TYPE=Debug -DWITHOUT_MROONGA:bool=1 -DWITHOUT_TOKUDB:bool=1 -DMAX_INDEXES=128 
      

      The stack trace:

        #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
        #1  0x00007ffff52b2801 in __GI_abort () at abort.c:79
        #2  0x00007ffff52a239a in __assert_fail_base (fmt=0x7ffff54297d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55555689b584 "bit < (map)->n_bits", file=file@entry=0x55555689b550 "/home/psergey/dev-git/10.4-wlad/include/my_bitmap.h", line=line@entry=115, function=function@entry=0x55555689ec60 <_ZZ14bitmap_set_bitE19__PRETTY_FUNCTION__> "void bitmap_set_bit(MY_BITMAP*, uint)") at assert.c:92
        #3  0x00007ffff52a2412 in __GI___assert_fail (assertion=0x55555689b584 "bit < (map)->n_bits", file=0x55555689b550 "/home/psergey/dev-git/10.4-wlad/include/my_bitmap.h", line=115, function=0x55555689ec60 <_ZZ14bitmap_set_bitE19__PRETTY_FUNCTION__> "void bitmap_set_bit(MY_BITMAP*, uint)") at assert.c:101
        #4  0x0000555555c3a3f7 in bitmap_set_bit (map=0x7fffdc104f88, bit=32767) at /home/psergey/dev-git/10.4-wlad/include/my_bitmap.h:115
        #5  0x0000555555c544a4 in Bitmap<128u>::set_bit (this=0x7fffdc104f88, n=32767) at /home/psergey/dev-git/10.4-wlad/sql/sql_bitmap.h:46
        #6  0x00005555561940b6 in and_range_trees (param=0x7fffee1c1ff0, tree1=0x7fffdc1200c8, tree2=0x7fffdc1203e8, result=0x7fffdc120308) at /home/psergey/dev-git/10.4-wlad/sql/opt_range.cc:9047
        #7  0x000055555617defd in SEL_IMERGE::and_sel_tree (this=0x7fffdc120058, param=0x7fffee1c1ff0, tree=0x7fffdc11f7c8, new_imerge=0x7fffdc120298) at /home/psergey/dev-git/10.4-wlad/sql/opt_range.cc:605
        #8  0x000055555617ed35 in imerge_list_and_tree (param=0x7fffee1c1ff0, merges=0x7fffdc11ffd0, tree=0x7fffdc11f7c8, replace=true) at /home/psergey/dev-git/10.4-wlad/sql/opt_range.cc:1148
        #9  0x00005555561942a6 in tree_and (param=0x7fffee1c1ff0, tree1=0x7fffdc11f7c8, tree2=0x7fffdc11ff78) at /home/psergey/dev-git/10.4-wlad/sql/opt_range.cc:9148
        #10 0x0000555556191024 in Item_cond_and::get_mm_tree (this=0x7fffdc01a3d0, param=0x7fffee1c1ff0, cond_ptr=0x7fffdc01a610) at /home/psergey/dev-git/10.4-wlad/sql/opt_range.cc:8220
        #11 0x000055555619120f in Item_cond::get_mm_tree (this=0x7fffdc01a508, param=0x7fffee1c1ff0, cond_ptr=0x7fffdc01b9e0) at /home/psergey/dev-git/10.4-wlad/sql/opt_range.cc:8258
        #12 0x0000555556184b94 in calculate_cond_selectivity_for_table (thd=0x7fffdc000d60, table=0x7fffdc1036a0, cond=0x7fffdc01b9e0) at /home/psergey/dev-git/10.4-wlad/sql/opt_range.cc:3412
        #13 0x0000555555d30184 in make_join_statistics (join=0x7fffdc01b5d8, tables_list=..., keyuse_array=0x7fffdc01b8c8) at /home/psergey/dev-git/10.4-wlad/sql/sql_select.cc:5393
        #14 0x0000555555d249f8 in JOIN::optimize_inner (this=0x7fffdc01b5d8) at /home/psergey/dev-git/10.4-wlad/sql/sql_select.cc:2191
        #15 0x0000555555d225a0 in JOIN::optimize (this=0x7fffdc01b5d8) at /home/psergey/dev-git/10.4-wlad/sql/sql_select.cc:1561
        #16 0x0000555555d2d44a in mysql_select (thd=0x7fffdc000d60, tables=0x7fffdc018270, wild_num=1, fields=..., conds=0x7fffdc01a508, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748612, result=0x7fffdc01af60, unit=0x7fffdc004c90, select_lex=0x7fffdc017c10) at /home/psergey/dev-git/10.4-wlad/sql/sql_select.cc:4588
        #17 0x0000555555d6822f in mysql_explain_union (thd=0x7fffdc000d60, unit=0x7fffdc004c90, result=0x7fffdc01af60) at /home/psergey/dev-git/10.4-wlad/sql/sql_select.cc:26541
        #18 0x0000555555ce6f6b in execute_sqlcom_select (thd=0x7fffdc000d60, all_tables=0x7fffdc018270) at /home/psergey/dev-git/10.4-wlad/sql/sql_parse.cc:6541
        #19 0x0000555555cdc60d in mysql_execute_command (thd=0x7fffdc000d60) at /home/psergey/dev-git/10.4-wlad/sql/sql_parse.cc:3891
        #20 0x0000555555ceb0f7 in mysql_parse (thd=0x7fffdc000d60, rawbuf=0x7fffdc017a98 "EXPLAIN\nSELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4)\nWHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10\nOR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 != 1 )", length=137, parser_state=0x7fffee1c4160, is_com_multi=false, is_next_command=false) at /home/psergey/dev-git/10.4-wlad/sql/sql_parse.cc:8154
        #21 0x0000555555cd67bf in dispatch_command (command=COM_QUERY, thd=0x7fffdc000d60, packet=0x7fffdc00ac51 "", packet_length=137, is_com_multi=false, is_next_command=false) at /home/psergey/dev-git/10.4-wlad/sql/sql_parse.cc:1831
        #22 0x0000555555cd4f7e in do_command (thd=0x7fffdc000d60) at /home/psergey/dev-git/10.4-wlad/sql/sql_parse.cc:1364
        #23 0x0000555555e4eeb3 in do_handle_one_connection (connect=0x555558106b60) at /home/psergey/dev-git/10.4-wlad/sql/sql_connect.cc:1398
        #24 0x0000555555e4ec17 in handle_one_connection (arg=0x555558106b60) at /home/psergey/dev-git/10.4-wlad/sql/sql_connect.cc:1301
        #25 0x000055555677a08e in pfs_spawn_thread (arg=0x55555814ef90) at /home/psergey/dev-git/10.4-wlad/storage/perfschema/pfs.cc:1862
        #26 0x00007ffff61ad6db in start_thread (arg=0x7fffee1c5700) at pthread_create.c:463
        #27 0x00007ffff539388f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      The crash happens because param->real_keynr[n] has garbage values for all values except 0.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                psergey Sergei Petrunia
                Reporter:
                psergey Sergei Petrunia
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: