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

Assertion `const_item_cache == true' failed in Item_func::fix_fields

    XMLWordPrintable

Details

    Description

      CREATE TABLE t (f1 INT, f2 INT, fv INT GENERATED ALWAYS AS (case user() when 'foo' or 'bar' then f1 else f2 end) VIRTUAL);
      SELECT * FROM t;
      CREATE TABLE tmp AS SELECT * FROM information_schema.tables where table_name = 't';
      SELECT * FROM t;
       
      # Cleanup
      DROP TABLE t, tmp;
      

      10.3 ca001cf2

      mysqld: /data/src/10.3/sql/item_func.cc:330: virtual bool Item_func::fix_fields(THD*, Item**): Assertion `const_item_cache == true' failed.
      230520 19:30:28 [ERROR] mysqld got signal 6 ;
       
      #8  0x00007f3d83845395 in __assert_fail_base (fmt=0x7f3d839b9a70 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x560106063fe0 "const_item_cache == true", file=file@entry=0x560106063a80 "/data/src/10.3/sql/item_func.cc", line=line@entry=330, function=function@entry=0x560106063f40 "virtual bool Item_func::fix_fields(THD*, Item**)") at ./assert/assert.c:92
      #9  0x00007f3d83853df2 in __GI___assert_fail (assertion=0x560106063fe0 "const_item_cache == true", file=0x560106063a80 "/data/src/10.3/sql/item_func.cc", line=330, function=0x560106063f40 "virtual bool Item_func::fix_fields(THD*, Item**)") at ./assert/assert.c:101
      #10 0x0000560104884db5 in Item_func::fix_fields (this=0x61d00018db88, thd=0x62a000060208, ref=0x61d00018dd70) at /data/src/10.3/sql/item_func.cc:330
      #11 0x000056010481afe7 in Item_func_case::fix_fields (this=0x61d00018db88, thd=0x62a000060208, ref=0x61d00018dd70) at /data/src/10.3/sql/item_cmpfunc.cc:3048
      #12 0x00005601042c829d in Virtual_column_info::fix_expr (this=0x61d00018dd60, thd=0x62a000060208) at /data/src/10.3/sql/table.cc:2966
      #13 0x00005601042c86bc in Virtual_column_info::fix_session_expr (this=0x61d00018dd60, thd=0x62a000060208) at /data/src/10.3/sql/table.cc:2992
      #14 0x00005601042c91dd in TABLE::vcol_fix_expr (this=0x61f000043688, thd=0x62a000060208) at /data/src/10.3/sql/table.cc:3080
      #15 0x0000560103e6a46f in open_table (thd=0x62a000060208, table_list=0x62b000000448, ot_ctx=0x7f3d7a9996d0) at /data/src/10.3/sql/sql_base.cc:2057
      #16 0x0000560103e72d39 in open_and_process_table (thd=0x62a000060208, tables=0x62b000000448, counter=0x7f3d7a9997e0, flags=0, prelocking_strategy=0x7f3d7a9998f0, has_prelocking_list=false, ot_ctx=0x7f3d7a9996d0) at /data/src/10.3/sql/sql_base.cc:3733
      #17 0x0000560103e75296 in open_tables (thd=0x62a000060208, options=..., start=0x7f3d7a9997f0, counter=0x7f3d7a9997e0, flags=0, prelocking_strategy=0x7f3d7a9998f0) at /data/src/10.3/sql/sql_base.cc:4208
      #18 0x0000560103e7a32d in open_and_lock_tables (thd=0x62a000060208, options=..., tables=0x62b000000448, derived=true, flags=0, prelocking_strategy=0x7f3d7a9998f0) at /data/src/10.3/sql/sql_base.cc:5148
      #19 0x0000560103de0599 in open_and_lock_tables (thd=0x62a000060208, tables=0x62b000000448, derived=true, flags=0) at /data/src/10.3/sql/sql_base.h:503
      #20 0x0000560103ff0c6e in execute_sqlcom_select (thd=0x62a000060208, all_tables=0x62b000000448) at /data/src/10.3/sql/sql_parse.cc:6261
      #21 0x0000560103fdf4b7 in mysql_execute_command (thd=0x62a000060208) at /data/src/10.3/sql/sql_parse.cc:3871
      #22 0x0000560103ffb180 in mysql_parse (thd=0x62a000060208, rawbuf=0x62b000000228 "SELECT * FROM t", length=15, parser_state=0x7f3d7a99b9b0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7855
      #23 0x0000560103fd1faf in dispatch_command (command=COM_QUERY, thd=0x62a000060208, packet=0x6290000dc209 "SELECT * FROM t", packet_length=15, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1852
      #24 0x0000560103fceb47 in do_command (thd=0x62a000060208) at /data/src/10.3/sql/sql_parse.cc:1398
      #25 0x0000560104396f5c in do_handle_one_connection (connect=0x6080000006a8) at /data/src/10.3/sql/sql_connect.cc:1404
      #26 0x0000560104396889 in handle_one_connection (arg=0x6080000006a8) at /data/src/10.3/sql/sql_connect.cc:1309
      #27 0x000056010597dbd5 in pfs_spawn_thread (arg=0x615000003008) at /data/src/10.3/storage/perfschema/pfs.cc:1869
      #28 0x00007f3d838a7fd4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #29 0x00007f3d839285bc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      The test case started failing after this commit in 10.3.35:

      commit 08c7ab404f69d9c4ca6ca7a9cf7eec74c804f917
      Author: Aleksey Midenkov
      Date:   Mon Apr 18 12:44:27 2022 +0300
       
          MDEV-24176 Server crashes after insert in the table with virtual
          column generated using date_format() and if()
      

      For a short while the assertion failure was different, it took its current form after this commit in the same branch/release:

      commit b3c3291f0b7c1623cb20663f7cf31b7f749768bc
      Author: Marko Mäkelä
      Date:   Tue Apr 19 10:29:21 2022 +0300
       
          MDEV-24176 fixup: GCC -Wmaybe-uninitialized
      

      Attachments

        Activity

          People

            midenok Aleksey Midenkov
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.