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

Assertion `res->charset() == item->collation.collation' failed in Type_handler_string_result::make_packed_sort_key_part

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.5
    • Fix Version/s: 10.5.5
    • Component/s: Server
    • Labels:
      None

      Description

      CREATE TABLE t1 (a CHAR(3), b BINARY(255));
      INSERT INTO t1 VALUES ('foo','bar'),('baz','qux');
      SELECT COALESCE(a, b) AS f FROM t1 ORDER BY f;
       
      # Cleanup
      DROP TABLE t1;
      

      bb-10.5-release 91c3c9efc1

      mariadbd: /data/src/bb-10.5-release/sql/filesort.cc:2581: virtual uint Type_handler_string_result::make_packed_sort_key_part(uchar*, Item*, const SORT_FIELD_ATTR*, Sort_param*) const: Assertion `res->charset() == item->collation.collation' failed.
      200806 21:32:15 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f2c3db49f12 in __GI___assert_fail (assertion=0x555cb388c3f8 "res->charset() == item->collation.collation", file=0x555cb388bbc0 "/data/src/bb-10.5-release/sql/filesort.cc", line=2581, function=0x555cb388d120 <Type_handler_string_result::make_packed_sort_key_part(unsigned char*, Item*, SORT_FIELD_ATTR const*, Sort_param*) const::__PRETTY_FUNCTION__> "virtual uint Type_handler_string_result::make_packed_sort_key_part(uchar*, Item*, const SORT_FIELD_ATTR*, Sort_param*) const") at assert.c:101
      #8  0x0000555cb2c6b88e in Type_handler_string_result::make_packed_sort_key_part (this=0x555cb44d6ac0 <type_handler_string>, to=0x7f2c28063a7d '\245' <repeats 200 times>..., item=0x7f2c280140c8, sort_field=0x7f2c28017980, param=0x7f2c386e4080) at /data/src/bb-10.5-release/sql/filesort.cc:2581
      #9  0x0000555cb2c6cb14 in make_packed_sortkey (param=0x7f2c386e4080, to=0x7f2c28063a7c "\001", '\245' <repeats 199 times>...) at /data/src/bb-10.5-release/sql/filesort.cc:3062
      #10 0x0000555cb2c682a0 in make_sortkey (param=0x7f2c386e4080, to=0x7f2c28063a78 "\245\245\245\245\001", '\245' <repeats 195 times>..., ref_pos=0x7f2c280f8c78 "", using_packed_sortkeys=true) at /data/src/bb-10.5-release/sql/filesort.cc:1338
      #11 0x0000555cb2c66fce in find_all_keys (thd=0x7f2c28000b18, param=0x7f2c386e4080, select=0x7f2c28017030, fs_info=0x7f2c28063700, buffpek_pointers=0x7f2c386e42a0, tempfile=0x7f2c386e4130, pq=0x0, found_rows=0x7f2c280638f0) at /data/src/bb-10.5-release/sql/filesort.cc:957
      #12 0x0000555cb2c64e93 in filesort (thd=0x7f2c28000b18, table=0x7f2c280f84b8, filesort=0x7f2c28017200, tracker=0x7f2c280178f0, join=0x7f2c280153e0, first_table_bit=1) at /data/src/bb-10.5-release/sql/filesort.cc:357
      #13 0x0000555cb29a2353 in create_sort_index (thd=0x7f2c28000b18, join=0x7f2c280153e0, tab=0x7f2c280166f0, fsort=0x7f2c28017200) at /data/src/bb-10.5-release/sql/sql_select.cc:23875
      #14 0x0000555cb299c51c in st_join_table::sort_table (this=0x7f2c280166f0) at /data/src/bb-10.5-release/sql/sql_select.cc:21625
      #15 0x0000555cb299c0f7 in join_init_read_record (tab=0x7f2c280166f0) at /data/src/bb-10.5-release/sql/sql_select.cc:21564
      #16 0x0000555cb2999e9f in sub_select (join=0x7f2c280153e0, join_tab=0x7f2c280166f0, end_of_records=false) at /data/src/bb-10.5-release/sql/sql_select.cc:20638
      #17 0x0000555cb29993ba in do_select (join=0x7f2c280153e0, procedure=0x0) at /data/src/bb-10.5-release/sql/sql_select.cc:20175
      #18 0x0000555cb296ce25 in JOIN::exec_inner (this=0x7f2c280153e0) at /data/src/bb-10.5-release/sql/sql_select.cc:4450
      #19 0x0000555cb296bf51 in JOIN::exec (this=0x7f2c280153e0) at /data/src/bb-10.5-release/sql/sql_select.cc:4231
      #20 0x0000555cb296d682 in mysql_select (thd=0x7f2c28000b18, tables=0x7f2c280141f0, fields=..., conds=0x0, og_num=1, order=0x7f2c28015248, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f2c280153b8, unit=0x7f2c28004b30, select_lex=0x7f2c28013990) at /data/src/bb-10.5-release/sql/sql_select.cc:4655
      #21 0x0000555cb295d328 in handle_select (thd=0x7f2c28000b18, lex=0x7f2c28004a68, result=0x7f2c280153b8, setup_tables_done_option=0) at /data/src/bb-10.5-release/sql/sql_select.cc:429
      #22 0x0000555cb29226f8 in execute_sqlcom_select (thd=0x7f2c28000b18, all_tables=0x7f2c280141f0) at /data/src/bb-10.5-release/sql/sql_parse.cc:6210
      #23 0x0000555cb291999f in mysql_execute_command (thd=0x7f2c28000b18) at /data/src/bb-10.5-release/sql/sql_parse.cc:3932
      #24 0x0000555cb2927545 in mysql_parse (thd=0x7f2c28000b18, rawbuf=0x7f2c280138d0 "SELECT COALESCE(a, b) AS f FROM t1 ORDER BY f", length=45, parser_state=0x7f2c386e5520, is_com_multi=false, is_next_command=false) at /data/src/bb-10.5-release/sql/sql_parse.cc:7994
      #25 0x0000555cb291383e in dispatch_command (command=COM_QUERY, thd=0x7f2c28000b18, packet=0x7f2c281af209 "", packet_length=45, is_com_multi=false, is_next_command=false) at /data/src/bb-10.5-release/sql/sql_parse.cc:1868
      #26 0x0000555cb2911f76 in do_command (thd=0x7f2c28000b18) at /data/src/bb-10.5-release/sql/sql_parse.cc:1349
      #27 0x0000555cb2ab7bd8 in do_handle_one_connection (connect=0x555cb708cbf8, put_in_cache=true) at /data/src/bb-10.5-release/sql/sql_connect.cc:1410
      #28 0x0000555cb2ab7940 in handle_one_connection (arg=0x555cb708cbf8) at /data/src/bb-10.5-release/sql/sql_connect.cc:1312
      #29 0x0000555cb2ff7f84 in pfs_spawn_thread (arg=0x555cb708c828) at /data/src/bb-10.5-release/storage/perfschema/pfs.cc:2201
      #30 0x00007f2c3fad24a4 in start_thread (arg=0x7f2c386e6700) at pthread_create.c:456
      #31 0x00007f2c3dc06d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Reproducible with at least MyISAM, InnoDB, Aria.
      No obvious problem on a non-debug build.

      The failure appeared in bb-10.5-release after this commit which added the assertion:

      commit 453e898001a33f3227dfbaac5d36228e8167c15e
      Author: Michael Widenius <monty@mariadb.org>
      Date:   Mon Aug 3 10:33:24 2020 +0300
       
          MDEV-23330 Server crash when using DES_DECYPT
      

        Attachments

          Issue Links

            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:

                  Git Integration