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

Assertion `0' failed in make_sortkey upon SELECT with GROUP BY after LOAD DATA

    Details

      Description

      CREATE TABLE t1 (a BIT(22), b CHAR(8) NOT NULL, c CHAR(8));
      INSERT INTO t1 VALUES (b'101001001011','foo','qux'),(b'100011110101','bar','foobar');
       
      SELECT * FROM t1 INTO OUTFILE 'load_t1';
      LOAD DATA INFILE 'load_t1' IGNORE INTO TABLE t1;
      SET SESSION SQL_MODE= '';
      SELECT GROUP_CONCAT(c) AS f FROM t1 GROUP BY LPAD('foo', 20, b);
       
      # Cleanup
      --let $datadir= `SELECT @@datadir`
      --remove_file $datadir/test/load_t1
      DROP TABLE t1;
      

      10.1 6567636b

      mysqld: /data/src/10.1/sql/filesort.cc:1016: void make_sortkey(Sort_param*, uchar*, uchar*): Assertion `0' failed.
      190311 16:55:15 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fb813227ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x0000560be35f94c2 in make_sortkey (param=0x7fb8152a9aa0, to=0x7fb80a45b4b6 '\245' <repeats 200 times>..., ref_pos=0x7fb8152a98b0 "") at /data/src/10.1/sql/filesort.cc:1016
      #9  0x0000560be35f8d9f in find_all_keys (thd=0x7fb80c0d5070, param=0x7fb8152a9aa0, select=0x7fb80a445840, fs_info=0x7fb8152a9a30, buffpek_pointers=0x7fb8152a9ca0, tempfile=0x7fb8152a9b20, pq=0x0, found_rows=0x7fb8152a9ea8) at /data/src/10.1/sql/filesort.cc:840
      #10 0x0000560be35f7469 in filesort (thd=0x7fb80c0d5070, table=0x7fb80a481c70, sortorder=0x7fb80a446810, s_length=1, select=0x7fb80a445840, max_rows=18446744073709551615, sort_positions=false, examined_rows=0x7fb8152a9ea0, found_rows=0x7fb8152a9ea8, tracker=0x7fb80a446850) at /data/src/10.1/sql/filesort.cc:301
      #11 0x0000560be342ef07 in create_sort_index (thd=0x7fb80c0d5070, join=0x7fb80a444268, order=0x7fb80a444130, filesort_limit=18446744073709551615, select_limit=18446744073709551615, is_order_by=false) at /data/src/10.1/sql/sql_select.cc:21677
      #12 0x0000560be34014a0 in JOIN::exec_inner (this=0x7fb80a444268) at /data/src/10.1/sql/sql_select.cc:3245
      #13 0x0000560be33fe949 in JOIN::exec (this=0x7fb80a444268) at /data/src/10.1/sql/sql_select.cc:2562
      #14 0x0000560be3401edf in mysql_select (thd=0x7fb80c0d5070, rref_pointer_array=0x7fb80c0d9560, tables=0x7fb80a443770, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x0, group=0x7fb80a444130, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fb80a444248, unit=0x7fb80c0d8bb8, select_lex=0x7fb80c0d92b8) at /data/src/10.1/sql/sql_select.cc:3499
      #15 0x0000560be33f7598 in handle_select (thd=0x7fb80c0d5070, lex=0x7fb80c0d8af0, result=0x7fb80a444248, setup_tables_done_option=0) at /data/src/10.1/sql/sql_select.cc:388
      #16 0x0000560be33c6f2e in execute_sqlcom_select (thd=0x7fb80c0d5070, all_tables=0x7fb80a443770) at /data/src/10.1/sql/sql_parse.cc:5991
      #17 0x0000560be33bd335 in mysql_execute_command (thd=0x7fb80c0d5070) at /data/src/10.1/sql/sql_parse.cc:3042
      #18 0x0000560be33cab71 in mysql_parse (thd=0x7fb80c0d5070, rawbuf=0x7fb80a443088 "SELECT GROUP_CONCAT(c) AS f FROM t1 GROUP BY LPAD('foo', 20, b)", length=63, parser_state=0x7fb8152ab1e0) at /data/src/10.1/sql/sql_parse.cc:7509
      #19 0x0000560be33b9320 in dispatch_command (command=COM_QUERY, thd=0x7fb80c0d5070, packet=0x7fb80ebf9071 "SELECT GROUP_CONCAT(c) AS f FROM t1 GROUP BY LPAD('foo', 20, b)", packet_length=63) at /data/src/10.1/sql/sql_parse.cc:1496
      #20 0x0000560be33b80ab in do_command (thd=0x7fb80c0d5070) at /data/src/10.1/sql/sql_parse.cc:1124
      #21 0x0000560be34f328e in do_handle_one_connection (thd_arg=0x7fb80c0d5070) at /data/src/10.1/sql/sql_connect.cc:1330
      #22 0x0000560be34f2ff2 in handle_one_connection (arg=0x7fb80c0d5070) at /data/src/10.1/sql/sql_connect.cc:1242
      #23 0x0000560be38b1ab4 in pfs_spawn_thread (arg=0x7fb812839ef0) at /data/src/10.1/storage/perfschema/pfs.cc:1861
      #24 0x00007fb814f2b494 in start_thread (arg=0x7fb8152ac700) at pthread_create.c:333
      #25 0x00007fb8132e493f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      10.4 5a796f1f

      mysqld: /data/src/10.4/sql/filesort.cc:990: virtual void Type_handler_string_result::make_sort_key(uchar*, Item*, const SORT_FIELD_ATTR*, Sort_param*) const: Assertion `0' failed.
      190311 16:59:25 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f62cfefbee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x0000564111d0b859 in Type_handler_string_result::make_sort_key (this=0x56411306e4f8 <type_handler_varchar>, to=0x7f62b806b2a6 '\245' <repeats 200 times>..., item=0x7f62b80169c8, sort_field=0x7f62b8019cb8, param=0x7f62ca073900) at /data/src/10.4/sql/filesort.cc:990
      #9  0x0000564111d0c235 in make_sortkey (param=0x7f62ca073900, to=0x7f62b806b2a6 '\245' <repeats 200 times>..., ref_pos=0x7f62b813c650 "") at /data/src/10.4/sql/filesort.cc:1184
      #10 0x0000564111d0b128 in find_all_keys (thd=0x7f62b8000b00, param=0x7f62ca073900, select=0x7f62b80190c8, fs_info=0x7f62b806aea0, buffpek_pointers=0x7f62ca073b00, tempfile=0x7f62ca073990, pq=0x0, found_rows=0x7f62b806b080) at /data/src/10.4/sql/filesort.cc:832
      #11 0x0000564111d09416 in filesort (thd=0x7f62b8000b00, table=0x7f62b813b4a0, filesort=0x7f62b8019580, tracker=0x7f62b8019c38, join=0x7f62b8017428, first_table_bit=1) at /data/src/10.4/sql/filesort.cc:272
      #12 0x0000564111a508d3 in create_sort_index (thd=0x7f62b8000b00, join=0x7f62b8017428, tab=0x7f62b8018748, fsort=0x7f62b8019580) at /data/src/10.4/sql/sql_select.cc:23191
      #13 0x0000564111a4afea in st_join_table::sort_table (this=0x7f62b8018748) at /data/src/10.4/sql/sql_select.cc:20998
      #14 0x0000564111a4abf1 in join_init_read_record (tab=0x7f62b8018748) at /data/src/10.4/sql/sql_select.cc:20935
      #15 0x0000564111a48a7b in sub_select (join=0x7f62b8017428, join_tab=0x7f62b8018748, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:20015
      #16 0x0000564111a4800b in do_select (join=0x7f62b8017428, procedure=0x0) at /data/src/10.4/sql/sql_select.cc:19556
      #17 0x0000564111a1eac7 in JOIN::exec_inner (this=0x7f62b8017428) at /data/src/10.4/sql/sql_select.cc:4371
      #18 0x0000564111a1dc6e in JOIN::exec (this=0x7f62b8017428) at /data/src/10.4/sql/sql_select.cc:4153
      #19 0x0000564111a1f320 in mysql_select (thd=0x7f62b8000b00, tables=0x7f62b8016050, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x0, group=0x7f62b8016ae0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f62b8017400, unit=0x7f62b8004a28, select_lex=0x7f62b80155a8) at /data/src/10.4/sql/sql_select.cc:4585
      #20 0x0000564111a0f898 in handle_select (thd=0x7f62b8000b00, lex=0x7f62b8004960, result=0x7f62b8017400, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:424
      #21 0x00005641119d8c23 in execute_sqlcom_select (thd=0x7f62b8000b00, all_tables=0x7f62b8016050) at /data/src/10.4/sql/sql_parse.cc:6651
      #22 0x00005641119cdede in mysql_execute_command (thd=0x7f62b8000b00) at /data/src/10.4/sql/sql_parse.cc:3888
      #23 0x00005641119dcb63 in mysql_parse (thd=0x7f62b8000b00, rawbuf=0x7f62b80154c8 "SELECT GROUP_CONCAT(c) AS f FROM t1 GROUP BY LPAD('foo', 20, b)", length=63, parser_state=0x7f62ca075180, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8204
      #24 0x00005641119c81a5 in dispatch_command (command=COM_QUERY, thd=0x7f62b8000b00, packet=0x7f62b800a781 "", packet_length=63, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1829
      #25 0x00005641119c698b in do_command (thd=0x7f62b8000b00) at /data/src/10.4/sql/sql_parse.cc:1358
      #26 0x0000564111b40703 in do_handle_one_connection (connect=0x5641142c1340) at /data/src/10.4/sql/sql_connect.cc:1399
      #27 0x0000564111b40474 in handle_one_connection (arg=0x5641142c1340) at /data/src/10.4/sql/sql_connect.cc:1302
      #28 0x0000564112036031 in pfs_spawn_thread (arg=0x5641143b39b0) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #29 0x00007f62d1bd2494 in start_thread (arg=0x7f62ca076700) at pthread_create.c:333
      #30 0x00007f62cffb893f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      No crash on a non-debug build.

        Attachments

          Activity

            People

            • Assignee:
              bar Alexander Barkov
              Reporter:
              elenst Elena Stepanova
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: