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

Server crashed in Cached_item_str::cmp / sortcmp or Assertion `item->null_value' failed in Type_handler_temporal_result::make_sort_key upon SELECT with NULLIF and ROLLUP

    XMLWordPrintable

Details

    Description

      CREATE TABLE t1 (i INT);
      INSERT INTO t1 VALUES (1),(2);
      SELECT NULLIF( CAST( 'foo' AS DATE ), NULL & 'bar' ) AS f FROM t1 GROUP BY f WITH ROLLUP;
      

      10.3 debug d8da97b09ab

      mysqld: /data/src/10.3/sql/filesort.cc:1086: virtual void Type_handler_temporal_result::make_sort_key(uchar*, Item*, const SORT_FIELD_ATTR*, Sort_param*) const: Assertion `item->null_value' failed.
       
      #7  0x00007fb7ba6c9ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x0000562aca3ba7d2 in Type_handler_temporal_result::make_sort_key (this=0x562acb8483c8 <type_handler_newdate>, to=0x7fb7a4079460 '\245' <repeats 192 times>, "h4z\025\217\217\217\217"..., item=0x7fb7a4017760, sort_field=0x7fb7a40185f8, param=0x7fb7b486e550) at /data/src/10.3/sql/filesort.cc:1086
      #9  0x0000562aca3babc3 in make_sortkey (param=0x7fb7b486e550, to=0x7fb7a4079460 '\245' <repeats 192 times>, "h4z\025\217\217\217\217"..., ref_pos=0x7fb7b486e3d0 "") at /data/src/10.3/sql/filesort.cc:1190
      #10 0x0000562aca3b9d5b in find_all_keys (thd=0x7fb7a4000b00, param=0x7fb7b486e550, select=0x7fb7a40179f0, fs_info=0x7fb7a40951f0, buffpek_pointers=0x7fb7b486e750, tempfile=0x7fb7b486e5e0, pq=0x0, found_rows=0x7fb7a40953d0) at /data/src/10.3/sql/filesort.cc:863
      #11 0x0000562aca3b7f68 in filesort (thd=0x7fb7a4000b00, table=0x7fb7a400dbf0, filesort=0x7fb7a4017d78, tracker=0x7fb7a4018578, join=0x7fb7a4015d28, first_table_bit=1) at /data/src/10.3/sql/filesort.cc:278
      #12 0x0000562aca1543fc in create_sort_index (thd=0x7fb7a4000b00, join=0x7fb7a4015d28, tab=0x7fb7a4016fe0, fsort=0x7fb7a4017d78) at /data/src/10.3/sql/sql_select.cc:22365
      #13 0x0000562aca14ed0a in st_join_table::sort_table (this=0x7fb7a4016fe0) at /data/src/10.3/sql/sql_select.cc:20200
      #14 0x0000562aca14e91e in join_init_read_record (tab=0x7fb7a4016fe0) at /data/src/10.3/sql/sql_select.cc:20141
      #15 0x0000562aca14c8a8 in sub_select (join=0x7fb7a4015d28, join_tab=0x7fb7a4016fe0, end_of_records=false) at /data/src/10.3/sql/sql_select.cc:19235
      #16 0x0000562aca14be73 in do_select (join=0x7fb7a4015d28, procedure=0x0) at /data/src/10.3/sql/sql_select.cc:18778
      #17 0x0000562aca124e78 in JOIN::exec_inner (this=0x7fb7a4015d28) at /data/src/10.3/sql/sql_select.cc:3989
      #18 0x0000562aca124310 in JOIN::exec (this=0x7fb7a4015d28) at /data/src/10.3/sql/sql_select.cc:3783
      #19 0x0000562aca125551 in mysql_select (thd=0x7fb7a4000b00, tables=0x7fb7a4015460, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x0, group=0x7fb7a4015be0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fb7a4015d08, unit=0x7fb7a4004948, select_lex=0x7fb7a40050c0) at /data/src/10.3/sql/sql_select.cc:4188
      #20 0x0000562aca1177f5 in handle_select (thd=0x7fb7a4000b00, lex=0x7fb7a4004880, result=0x7fb7a4015d08, setup_tables_done_option=0) at /data/src/10.3/sql/sql_select.cc:382
      #21 0x0000562aca0e2991 in execute_sqlcom_select (thd=0x7fb7a4000b00, all_tables=0x7fb7a4015460) at /data/src/10.3/sql/sql_parse.cc:6556
      #22 0x0000562aca0d900e in mysql_execute_command (thd=0x7fb7a4000b00) at /data/src/10.3/sql/sql_parse.cc:3770
      #23 0x0000562aca0e639c in mysql_parse (thd=0x7fb7a4000b00, rawbuf=0x7fb7a4014d58 "SELECT NULLIF( CAST( 'foo' AS DATE ), NULL & 'bar' ) AS f FROM t1 GROUP BY f WITH ROLLUP", length=88, parser_state=0x7fb7b48705d0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:8013
      #24 0x0000562aca0d3a4f in dispatch_command (command=COM_QUERY, thd=0x7fb7a4000b00, packet=0x7fb7a40904f1 "", packet_length=88, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1842
      #25 0x0000562aca0d248e in do_command (thd=0x7fb7a4000b00) at /data/src/10.3/sql/sql_parse.cc:1387
      #26 0x0000562aca236e77 in do_handle_one_connection (connect=0x562acdc56c90) at /data/src/10.3/sql/sql_connect.cc:1402
      #27 0x0000562aca236c04 in handle_one_connection (arg=0x562acdc56c90) at /data/src/10.3/sql/sql_connect.cc:1308
      #28 0x0000562aca6be61d in pfs_spawn_thread (arg=0x562acdc6a520) at /data/src/10.3/storage/perfschema/pfs.cc:1862
      #29 0x00007fb7bc3a0494 in start_thread (arg=0x7fb7b4871700) at pthread_create.c:333
      #30 0x00007fb7ba78693f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      10.3 non-debug 209375fdd0

      #2  <signal handler called>
      #3  sortcmp (s=0x7f83980143e8, t=0x0, cs=0x56026f6f77c0 <my_charset_latin1>) at /data/src/10.3/sql/sql_string.cc:830
      #4  0x000056026e9207cb in Cached_item_str::cmp (this=0x7f83980143c8) at /data/src/10.3/sql/item_buff.cc:95
      #5  0x000056026e76bb85 in test_if_group_changed (list=...) at /data/src/10.3/sql/sql_select.cc:23588
      #6  0x000056026e772948 in end_send_group (join=0x7f8398012630, join_tab=<optimized out>, end_of_records=<optimized out>) at /data/src/10.3/sql/sql_select.cc:20597
      #7  0x000056026e74ec0b in evaluate_join_record (join=join@entry=0x7f8398012630, join_tab=join_tab@entry=0x7f83980138e8, error=<optimized out>) at /data/src/10.3/sql/sql_select.cc:19452
      #8  0x000056026e75b21b in sub_select (join=0x7f8398012630, join_tab=0x7f83980138e8, end_of_records=<optimized out>) at /data/src/10.3/sql/sql_select.cc:19232
      #9  0x000056026e77c2ec in do_select (procedure=<optimized out>, join=0x7f8398012630) at /data/src/10.3/sql/sql_select.cc:18772
      #10 JOIN::exec_inner (this=this@entry=0x7f8398012630) at /data/src/10.3/sql/sql_select.cc:3987
      #11 0x000056026e77c4d9 in JOIN::exec (this=this@entry=0x7f8398012630) at /data/src/10.3/sql/sql_select.cc:3781
      #12 0x000056026e77c61b in mysql_select (thd=thd@entry=0x7f83980009a8, tables=0x7f8398011d68, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x0, group=0x7f83980124e8, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f8398012610, unit=0x7f8398004618, select_lex=0x7f8398004d90) at /data/src/10.3/sql/sql_select.cc:4186
      #13 0x000056026e77d017 in handle_select (thd=thd@entry=0x7f83980009a8, lex=lex@entry=0x7f8398004550, result=result@entry=0x7f8398012610, setup_tables_done_option=setup_tables_done_option@entry=0) at /data/src/10.3/sql/sql_select.cc:382
      #14 0x000056026e646ad5 in execute_sqlcom_select (thd=0x7f83980009a8, all_tables=0x7f8398011d68) at /data/src/10.3/sql/sql_parse.cc:6556
      #15 0x000056026e72a31b in mysql_execute_command (thd=0x7f83980009a8) at /data/src/10.3/sql/sql_parse.cc:3770
      #16 0x000056026e72cc5a in mysql_parse (thd=0x7f83980009a8, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /data/src/10.3/sql/sql_parse.cc:8013
      #17 0x000056026e730559 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f83980009a8, packet=packet@entry=0x7f83980092f9 "", packet_length=packet_length@entry=88, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.3/sql/sql_parse.cc:1842
      #18 0x000056026e730b2f in do_command (thd=0x7f83980009a8) at /data/src/10.3/sql/sql_parse.cc:1387
      #19 0x000056026e7ff894 in do_handle_one_connection (connect=connect@entry=0x5602710b4758) at /data/src/10.3/sql/sql_connect.cc:1402
      #20 0x000056026e7ffa34 in handle_one_connection (arg=arg@entry=0x5602710b4758) at /data/src/10.3/sql/sql_connect.cc:1308
      #21 0x000056026eae17a4 in pfs_spawn_thread (arg=0x5602710c06b8) at /data/src/10.3/storage/perfschema/pfs.cc:1862
      #22 0x00007f83bb5cf494 in start_thread (arg=0x7f83b429f700) at pthread_create.c:333
      #23 0x00007f83b99b593f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      The problem appeared in bb-10.2-ext and later in 10.3 with this commit:

      commit 95d075a0e5b9b4276c53f888c8090113a8adfbf4
      Author: Alexander Barkov <bar@mariadb.org>
      Date:   Tue Feb 13 20:37:31 2018 +0400
       
          MDEV-15293 CAST(AS TIME) returns bad results for LAST_VALUE(),NAME_CONST(),SP variable
      

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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