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

Crash of INSERT SELECT when preparing structures for split optimization

    XMLWordPrintable

Details

    • Bug
    • Status: Stalled (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 11.3.0, 10.4(EOL), 10.5, 10.6, 10.11, 11.0(EOL), 11.1(EOL), 11.2(EOL)
    • 10.5, 10.6, 10.11, 11.4
    • Optimizer
    • Ubuntu 20.04

    Description

      Run these queries in debug build:

      CREATE TABLE v0 ( v1 INT UNIQUE ) ;
      INSERT INTO v0 ( v1 ) VALUES ( ( SELECT 1 FROM ( SELECT v1 FROM v0 GROUP BY v1 ) AS v6 NATURAL JOIN v0 AS v2 NATURAL JOIN v0 AS v4 NATURAL JOIN v0 AS v3 NATURAL JOIN ( SELECT v1 FROM v0 ) AS v7 ) ) ;
      

      Will trigger Segmentation fault.

      GDB info:
      #0  0x00005555572f3e53 in optimize_keyuse (join=0x62900012e928, keyuse_array=0x62900012ec90)
          at /home/wx/mariadb-11.3.0/sql/sql_select.cc:7667
      #1  0x000055555793d67c in JOIN::add_keyuses_for_splitting (this=0x62900012e928) at /home/wx/mariadb-11.3.0/sql/opt_split.cc:847
      #2  0x000055555793daee in st_join_table::add_keyuses_for_splitting (this=0x62d00000a4a8) at /home/wx/mariadb-11.3.0/sql/opt_split.cc:874
      #3  0x00005555572e509c in make_join_statistics (join=0x62900012e228, tables_list=..., keyuse_array=0x62900012e590)
          at /home/wx/mariadb-11.3.0/sql/sql_select.cc:6020
      #4  0x00005555572c2c36 in JOIN::optimize_inner (this=0x62900012e228) at /home/wx/mariadb-11.3.0/sql/sql_select.cc:2624
      #5  0x00005555572bbba6 in JOIN::optimize (this=0x62900012e228) at /home/wx/mariadb-11.3.0/sql/sql_select.cc:1944
      #6  0x0000555557143851 in st_select_lex::optimize_unflattened_subqueries (this=0x6290000f5d80, const_only=false)
          at /home/wx/mariadb-11.3.0/sql/sql_lex.cc:4916
      #7  0x00005555570f2cc5 in mysql_insert (thd=0x62c0001d0288, table_list=0x6290000f5508, fields=..., values_list=..., update_fields=..., 
          update_values=..., duplic=DUP_ERROR, ignore=false, result=0x0) at /home/wx/mariadb-11.3.0/sql/sql_insert.cc:875
      #8  0x00005555571c1ecb in mysql_execute_command (thd=0x62c0001d0288, is_called_from_prepared_stmt=false)
          at /home/wx/mariadb-11.3.0/sql/sql_parse.cc:4417
      #9  0x00005555571d95e2 in mysql_parse (thd=0x62c0001d0288, 
          rawbuf=0x6290000f52a8 "INSERT INTO v0 ( v1 ) VALUES ( ( SELECT 1 FROM ( SELECT v1 FROM v0 GROUP BY v1 ) AS v6 NATURAL JOIN v0 AS v2 NATURAL JOIN v0 AS v4 NATURAL JOIN v0 AS v3 NATURAL JOIN ( SELECT v1 FROM v0 ) AS v7 ) )", length=197, parser_state=0x7fffe33c0870)
          at /home/wx/mariadb-11.3.0/sql/sql_parse.cc:7734
      #10 0x00005555571b1237 in dispatch_command (command=COM_QUERY, thd=0x62c0001d0288, 
          packet=0x6290000eb289 "INSERT INTO v0 ( v1 ) VALUES ( ( SELECT 1 FROM ( SELECT v1 FROM v0 GROUP BY v1 ) AS v6 NATURAL JOIN v0 AS v2 NATURAL JOIN v0 AS v4 NATURAL JOIN v0 AS v3 NATURAL JOIN ( SELECT v1 FROM v0 ) AS v7 ) )", packet_length=197, blocking=true)
          at /home/wx/mariadb-11.3.0/sql/sql_parse.cc:1893
      #11 0x00005555571adf7c in do_command (thd=0x62c0001d0288, blocking=true) at /home/wx/mariadb-11.3.0/sql/sql_parse.cc:1406
      #12 0x000055555768e557 in do_handle_one_connection (connect=0x61100004df08, put_in_cache=true)
          at /home/wx/mariadb-11.3.0/sql/sql_connect.cc:1445
      #13 0x000055555768deb4 in handle_one_connection (arg=0x61100004df08) at /home/wx/mariadb-11.3.0/sql/sql_connect.cc:1347
      #14 0x00005555582fa350 in pfs_spawn_thread (arg=0x618000005108) at /home/wx/mariadb-11.3.0/storage/perfschema/pfs.cc:2201
      #15 0x00007ffff7115609 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
      #16 0x00007ffff6ce8133 in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Attachments

        Issue Links

          Activity

            People

              igor Igor Babaev
              Xin Wen Xin Wen
              Votes:
              1 Vote for this issue
              Watchers:
              8 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.