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

SIGSEGV in QUICK_GROUP_MIN_MAX_SELECT::is_agg_distinct from st_join_table::is_using_agg_loose_index_scan on SELECT FROM a table with subpartitions

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.4.18, 10.5.9, 10.6.0
    • 10.5
    • Partitioning
    • None

    Description

      DROP DATABASE test;
      CREATE DATABASE test;
      USE test;
      SET SESSION SQL_BUFFER_RESULT=1;
      CREATE TABLE t1 (a INT NOT NULL, b varchar (64), INDEX (b,a), PRIMARY KEY (a)) PARTITION BY RANGE (a) SUBPARTITION BY HASH (a) SUBPARTITIONS 3 (PARTITION pNeg VALUES LESS THAN (0) (SUBPARTITION subp0, SUBPARTITION subp1, SUBPARTITION subp2), PARTITION `p0-29` VALUES LESS THAN (30) (SUBPARTITION subp3, SUBPARTITION subp4, SUBPARTITION subp5), PARTITION `p30-299` VALUES LESS THAN (300) (SUBPARTITION subp6, SUBPARTITION subp7, SUBPARTITION subp8), PARTITION `p300-2999` VALUES LESS THAN (3000) (SUBPARTITION subp9, SUBPARTITION subp10, SUBPARTITION subp11), PARTITION `p3000-299999` VALUES LESS THAN (300000) (SUBPARTITION subp12, SUBPARTITION subp13, SUBPARTITION subp14));
      SELECT b, COUNT(DISTINCT a) FROM t1 GROUP BY b HAVING b is NULL;
      

      Sporadically leads to:

      10.5.9 97569d3c37a66bc941b933ac7c2cefa5430a5175 (Debug)

      Core was generated by `/test/MD131120-mariadb-10.5.9-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11)
          at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      [Current thread is 1 (Thread 0x150ffcca4700 (LWP 3219369))]
      (gdb) bt
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      #1  0x000055ff0fa7afde in my_write_core (sig=sig@entry=11) at /test/10.5_dbg/mysys/stacktrace.c:424
      #2  0x000055ff0f2517c7 in handle_fatal_signal (sig=11) at /test/10.5_dbg/sql/signal_handler.cc:330
      #3  <signal handler called>
      #4  QUICK_GROUP_MIN_MAX_SELECT::is_agg_distinct (this=<optimized out>) at /test/10.5_dbg/sql/opt_range.h:1597
      #5  st_join_table::is_using_agg_loose_index_scan (this=0x150fc4016508) at /test/10.5_dbg/sql/sql_select.h:539
      #6  JOIN::create_postjoin_aggr_table (this=this@entry=0x150fc40146a0, tab=tab@entry=0x150fc40168b0, table_fields=table_fields@entry=0x150fc40149c8, table_group=0x0, save_sum_fields=<optimized out>, distinct=distinct@entry=false, keep_row_order=false) at /test/10.5_dbg/sql/sql_select.cc:3785
      #7  0x000055ff0f013079 in JOIN::make_aggr_tables_info (this=this@entry=0x150fc40146a0) at /test/10.5_dbg/sql/sql_select.cc:3348
      #8  0x000055ff0f017f9c in JOIN::optimize_stage2 (this=this@entry=0x150fc40146a0) at /test/10.5_dbg/sql/sql_select.cc:2992
      #9  0x000055ff0f01c38c in JOIN::optimize_inner (this=this@entry=0x150fc40146a0) at /test/10.5_dbg/sql/sql_select.cc:2277
      #10 0x000055ff0f01c712 in JOIN::optimize (this=this@entry=0x150fc40146a0) at /test/10.5_dbg/sql/sql_select.cc:1627
      #11 0x000055ff0f01d051 in mysql_select (thd=thd@entry=0x150fc4000d78, tables=0x150fc4013288, fields=@0x150fc4012b00: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x150fc4012f60, last = 0x150fc4013228, elements = 2}, <No data fields>}, conds=0x0, og_num=1, order=<optimized out>, group=0x150fc4013ab8, having=0x150fc4013c40, proc_param=0x0, select_options=2147879680, result=0x150fc4014678, unit=0x150fc4004f18, select_lex=0x150fc40129b0) at /test/10.5_dbg/sql/sql_select.cc:4641
      #12 0x000055ff0f01d362 in handle_select (thd=thd@entry=0x150fc4000d78, lex=lex@entry=0x150fc4004e50, result=result@entry=0x150fc4014678, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.5_dbg/sql/sql_select.cc:417
      #13 0x000055ff0efa3b14 in execute_sqlcom_select (thd=thd@entry=0x150fc4000d78, all_tables=0x150fc4013288) at /test/10.5_dbg/sql/sql_parse.cc:6266
      #14 0x000055ff0ef9cb44 in mysql_execute_command (thd=thd@entry=0x150fc4000d78) at /test/10.5_dbg/sql/sql_parse.cc:3968
      #15 0x000055ff0efa9a98 in mysql_parse (thd=thd@entry=0x150fc4000d78, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x150ffcca3390, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:8044
      #16 0x000055ff0ef963af in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x150fc4000d78, packet=packet@entry=0x150fc4008f49 "SELECT b, COUNT(DISTINCT a) FROM t1 GROUP BY b HAVING b is NULL", packet_length=packet_length@entry=63, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:1872
      #17 0x000055ff0ef94b99 in do_command (thd=0x150fc4000d78) at /test/10.5_dbg/sql/sql_parse.cc:1353
      #18 0x000055ff0f0f5709 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55ff124ee578, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1410
      #19 0x000055ff0f0f5e2d in handle_one_connection (arg=arg@entry=0x55ff124ee578) at /test/10.5_dbg/sql/sql_connect.cc:1312
      #20 0x000055ff0f561aee in pfs_spawn_thread (arg=0x55ff124253a8) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
      #21 0x000015101306e6db in start_thread (arg=0x150ffcca4700) at pthread_create.c:463
      #22 0x000015101246ca3f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      10.5.9 97569d3c37a66bc941b933ac7c2cefa5430a5175 (Optimized)

      Core was generated by `/test/MD131120-mariadb-10.5.9-linux-x86_64-opt/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11)
          at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      [Current thread is 1 (Thread 0x145ad45d7700 (LWP 3334811))]
      (gdb) bt
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      #1  0x00005625138fcf87 in my_write_core (sig=sig@entry=11) at /test/10.5_opt/mysys/stacktrace.c:424
      #2  0x00005625132df0ba in handle_fatal_signal (sig=11) at /test/10.5_opt/sql/signal_handler.cc:330
      #3  <signal handler called>
      #4  0x0000562513146ca4 in st_join_table::is_using_agg_loose_index_scan (this=0x145a80013f28) at /test/10.5_opt/sql/sql_select.h:539
      #5  0x00005625131344fd in JOIN::create_postjoin_aggr_table (this=this@entry=0x145a80012140, tab=tab@entry=0x145a800142d0, table_fields=table_fields@entry=0x145a80012468, table_group=<optimized out>, save_sum_fields=<optimized out>, distinct=<optimized out>, keep_row_order=false) at /test/10.5_opt/sql/sql_select.cc:3785
      #6  0x0000562513134cec in JOIN::make_aggr_tables_info (this=this@entry=0x145a80012140) at /test/10.5_opt/sql/sql_select.cc:3348
      #7  0x000056251313ea08 in JOIN::optimize_stage2 (this=this@entry=0x145a80012140) at /test/10.5_opt/sql/sql_select.cc:2992
      #8  0x00005625131405dd in JOIN::optimize_inner (this=this@entry=0x145a80012140) at /test/10.5_opt/sql/sql_select.cc:2277
      #9  0x0000562513142723 in JOIN::optimize (this=this@entry=0x145a80012140) at /test/10.5_opt/sql/sql_select.cc:1627
      #10 0x00005625131427e7 in mysql_select (thd=thd@entry=0x145a80000c18, tables=0x145a80010d28, fields=@0x145a800105a0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x145a80010a00, last = 0x145a80010cc8, elements = 2}, <No data fields>}, conds=0x0, og_num=<optimized out>, order=0x0, group=0x145a80011558, having=0x145a800116e0, proc_param=0x0, select_options=2147879680, result=0x145a80012118, unit=0x145a80004bf8, select_lex=0x145a80010450) at /test/10.5_opt/sql/sql_select.cc:4641
      #11 0x00005625131431e1 in handle_select (thd=thd@entry=0x145a80000c18, lex=lex@entry=0x145a80004b30, result=result@entry=0x145a80012118, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.5_opt/sql/sql_select.cc:417
      #12 0x00005625130e85d1 in execute_sqlcom_select (thd=thd@entry=0x145a80000c18, all_tables=0x145a80010d28) at /test/10.5_opt/sql/sql_parse.cc:6266
      #13 0x00005625130e4b2b in mysql_execute_command (thd=thd@entry=0x145a80000c18) at /test/10.5_opt/sql/sql_parse.cc:3968
      #14 0x00005625130eb6ac in mysql_parse (thd=0x145a80000c18, rawbuf=<optimized out>, length=63, parser_state=0x145ad45d6470, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /test/10.5_opt/sql/sql_parse.cc:8044
      #15 0x00005625130e0955 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x145a80000c18, packet=packet@entry=0x145a80007fd9 "SELECT b, COUNT(DISTINCT a) FROM t1 GROUP BY b HAVING b is NULL", packet_length=packet_length@entry=63, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_opt/sql/sql_parse.cc:1872
      #16 0x00005625130dec74 in do_command (thd=0x145a80000c18) at /test/10.5_opt/sql/sql_parse.cc:1353
      #17 0x00005625131d6661 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x562515aef7e8, put_in_cache=put_in_cache@entry=true) at /test/10.5_opt/sql/sql_connect.cc:1410
      #18 0x00005625131d69d4 in handle_one_connection (arg=arg@entry=0x562515aef7e8) at /test/10.5_opt/sql/sql_connect.cc:1312
      #19 0x000056251354a31a in pfs_spawn_thread (arg=0x562515aa8688) at /test/10.5_opt/storage/perfschema/pfs.cc:2201
      #20 0x0000145ad968d6db in start_thread (arg=0x145ad45d7700) at pthread_create.c:463
      #21 0x0000145ad8a8ba3f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.4.18 (dbg), 10.4.18 (opt), 10.5.9 (dbg), 10.5.9 (opt), 10.6.0 (dbg), 10.6.0 (opt).

      Bug confirmed not present in:
      MariaDB: 10.1.49 (dbg), 10.1.49 (opt), 10.2.37 (dbg), 10.2.37 (opt), 10.3.28 (dbg), 10.3.28 (opt).

      Debug server log.
      Debug core files.

      This issue is sporadic and it needs 10 times runs more to reproduce it on 10.6 debug than on 10.6 optimized.

      Attachments

        Issue Links

          Activity

            People

              psergei Sergei Petrunia
              stepan.patryshev Stepan Patryshev (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.