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

Assertion `marked_for_read()' failed while evaluating DEFAULT

    XMLWordPrintable

Details

    Description

      Whilst there are many other bugs with the same assertion, this one looked new/unrelated. Issue reproduces on all engines tested. MDEV-18166 (testcase 2) and MDEV-19680 may be related

      USE test;
      CREATE TABLE t (a INT, b INT DEFAULT (a+1));
      INSERT INTO t VALUES (1,1);
      UPDATE t SET b=DEFAULT;
      

      Leads to:

      10.5.6 1c587481966abc7a9ad5309d0a91ca920f7a5657 (Debug)

      mysqld: /test/10.5_dbg/sql/field.cc:4354: virtual longlong Field_long::val_int(): Assertion `marked_for_read()' failed.
      

      10.5.6 1c587481966abc7a9ad5309d0a91ca920f7a5657 (Debug)

      Core was generated by `/test/MD110820-mariadb-10.5.6-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
          at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      [Current thread is 1 (Thread 0x14d9735d0700 (LWP 3547045))]
      (gdb) bt
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      #1  0x000056240faf3b86 in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:519
      #2  0x000056240f2aad7b in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:330
      #3  <signal handler called>
      #4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
      #5  0x000014d9718668b1 in __GI_abort () at abort.c:79
      #6  0x000014d97185642a in __assert_fail_base (fmt=0x14d9719dda38 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x56240fdfc604 "marked_for_read()", file=file@entry=0x56240fdfc433 "/test/10.5_dbg/sql/field.cc", line=line@entry=4354, function=function@entry=0x56240fe016a0 <Field_long::val_int()::__PRETTY_FUNCTION__> "virtual longlong Field_long::val_int()") at assert.c:92
      #7  0x000014d9718564a2 in __GI___assert_fail (assertion=assertion@entry=0x56240fdfc604 "marked_for_read()", file=file@entry=0x56240fdfc433 "/test/10.5_dbg/sql/field.cc", line=line@entry=4354, function=function@entry=0x56240fe016a0 <Field_long::val_int()::__PRETTY_FUNCTION__> "virtual longlong Field_long::val_int()") at assert.c:101
      #8  0x000056240f28264e in Field_long::val_int (this=0x14d94f0520e0) at /test/10.5_dbg/sql/field.cc:4354
      #9  0x000056240f2cc7ec in Item_field::val_int (this=0x14d94f052aa0) at /test/10.5_dbg/sql/item.cc:3258
      #10 0x000056240f335ae7 in Item_func_plus::int_op (this=0x14d94f052be0) at /test/10.5_dbg/sql/item_func.cc:1111
      #11 0x000056240f1cf4de in Item_func_hybrid_field_type::val_int_from_int_op (this=<optimized out>) at /test/10.5_dbg/sql/item_func.h:844
      #12 Type_handler_int_result::Item_func_hybrid_field_type_val_int (this=<optimized out>, item=<optimized out>) at /test/10.5_dbg/sql/sql_type.cc:5296
      #13 0x000056240f3086c8 in Item_func_hybrid_field_type::val_int (this=0x14d94f052be0) at /test/10.5_dbg/sql/item_func.h:900
      #14 0x000056240f2df1e7 in Item::save_int_in_field (this=0x14d94f052be0, field=0x14d94f0521b8, no_conversions=<optimized out>) at /test/10.5_dbg/sql/item.cc:6627
      #15 0x000056240f1d1f78 in Type_handler_int_result::Item_save_in_field (this=<optimized out>, item=<optimized out>, field=<optimized out>, no_conversions=<optimized out>) at /test/10.5_dbg/sql/sql_type.cc:4242
      #16 0x000056240f2c9b20 in Item::save_in_field (this=0x14d94f052be0, field=0x14d94f0521b8, no_conversions=<optimized out>) at /test/10.5_dbg/sql/item.cc:6637
      #17 0x000056240f27dff1 in Field::set_default (this=0x14d94f0521b8) at /test/10.5_dbg/sql/field.cc:2541
      #18 0x000056240f29a94d in Field::save_in_field_default_value (this=0x14d94f0521b8, view_error_processing=view_error_processing@entry=false) at /test/10.5_dbg/sql/field.cc:11058
      #19 0x000056240f23faff in Item_default_specification::save_in_field (this=<optimized out>, field_arg=<optimized out>, no_conversions=<optimized out>) at /test/10.5_dbg/sql/item.h:6437
      #20 0x000056240ef83e6f in fill_record (thd=thd@entry=0x14d94f015088, table_arg=table_arg@entry=0x14d94f052588, fields=@0x14d94f0199f0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14d94f074a30, last = 0x14d94f074a30, elements = 1}, <No data fields>}, values=@0x14d94f019f68: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14d94f074a40, last = 0x14d94f074a40, elements = 1}, <No data fields>}, ignore_errors=ignore_errors@entry=false, update=update@entry=true) at /test/10.5_dbg/sql/sql_base.cc:8451
      #21 0x000056240ef84206 in fill_record_n_invoke_before_triggers (thd=thd@entry=0x14d94f015088, table=table@entry=0x14d94f052588, fields=@0x14d94f0199f0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14d94f074a30, last = 0x14d94f074a30, elements = 1}, <No data fields>}, values=@0x14d94f019f68: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14d94f074a40, last = 0x14d94f074a40, elements = 1}, <No data fields>}, ignore_errors=ignore_errors@entry=false, event=event@entry=TRG_EVENT_UPDATE) at /test/10.5_dbg/sql/sql_base.cc:8623
      #22 0x000056240f0f5cc8 in mysql_update (thd=thd@entry=0x14d94f015088, table_list=<optimized out>, fields=@0x14d94f0199f0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14d94f074a30, last = 0x14d94f074a30, elements = 1}, <No data fields>}, values=@0x14d94f019f68: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14d94f074a40, last = 0x14d94f074a40, elements = 1}, <No data fields>}, conds=<optimized out>, order_num=<optimized out>, order=<optimized out>, limit=18446744073709551615, ignore=<optimized out>, found_return=<optimized out>, updated_return=<optimized out>) at /test/10.5_dbg/sql/sql_update.cc:994
      #23 0x000056240effe160 in mysql_execute_command (thd=thd@entry=0x14d94f015088) at /test/10.5_dbg/sql/sql_parse.cc:4394
      #24 0x000056240f009d4e in mysql_parse (thd=thd@entry=0x14d94f015088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14d9735cf350, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:7994
      #25 0x000056240eff677e in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14d94f015088, packet=packet@entry=0x14d94f067089 "UPDATE t SET b=DEFAULT", packet_length=packet_length@entry=22, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:1867
      #26 0x000056240eff4f58 in do_command (thd=0x14d94f015088) at /test/10.5_dbg/sql/sql_parse.cc:1348
      #27 0x000056240f151bc9 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x14d9524d0808, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1410
      #28 0x000056240f1522e5 in handle_one_connection (arg=arg@entry=0x14d9524d0808) at /test/10.5_dbg/sql/sql_connect.cc:1312
      #29 0x000056240f5b8572 in pfs_spawn_thread (arg=0x14d970446508) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
      #30 0x000014d9725496db in start_thread (arg=0x14d9735d0700) at pthread_create.c:463
      #31 0x000014d971947a3f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.2.34 (dbg), 10.3.25 (dbg), 10.4.15 (dbg), 10.5.6 (dbg)

      Bug confirmed not present in:
      MariaDB: 10.1.47 (dbg), 10.1.47 (opt), 10.2.34 (opt), 10.3.25 (opt), 10.4.15 (opt), 10.5.6 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)

      10.1 Does not support the syntax:

      10.1.47>CREATE TABLE t (a INT, b INT DEFAULT (a+1));
      ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(a+1))' at line 1
      

      Attachments

        Issue Links

          Activity

            People

              nikitamalyavin Nikita Malyavin
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.