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

Assertion `marked_for_read()' failed upon updating view referencing versioned table

    Details

      Description

      Note: Possibly it has nothing to do with application periods, but I couldn't get rid of it in the test case.

      CREATE TABLE t1 (a INT);
      CREATE TABLE t2 (s DATE, e DATE, PERIOD FOR app(s,e), KEY(s));
      REPLACE INTO t1 VALUES (1),(2);
      REPLACE INTO t2 VALUES ('2018-01-02','2027-06-22'),('2019-12-12','2020-12-12');
      CREATE VIEW v AS SELECT * FROM t1 JOIN t2;
      UPDATE v SET e = '2021-01-01' ORDER BY s LIMIT 1;
       
      # Cleanup
      DROP VIEW v;
      DROP TABLE t1, t2;
      

      10.4 f98bb231

      mysqld: /data/src/10.4/sql/field.cc:6572: virtual bool Field_newdate::get_TIME(MYSQL_TIME*, const uchar*, date_mode_t) const: Assertion `marked_for_read()' failed.
      190603  0:43:25 [ERROR] mysqld got signal 6 ;
       
      #6  0x00007f9eadb9ce67 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x56535e98c8b0 "marked_for_read()", file=file@entry=0x56535e98c6c4 "/data/src/10.4/sql/field.cc", line=line@entry=6572, function=function@entry=0x56535e990a00 <Field_newdate::get_TIME(st_mysql_time*, unsigned char const*, date_mode_t) const::__PRETTY_FUNCTION__> "virtual bool Field_newdate::get_TIME(MYSQL_TIME*, const uchar*, date_mode_t) const") at assert.c:92
      #7  0x00007f9eadb9cf12 in __GI___assert_fail (assertion=0x56535e98c8b0 "marked_for_read()", file=0x56535e98c6c4 "/data/src/10.4/sql/field.cc", line=6572, function=0x56535e990a00 <Field_newdate::get_TIME(st_mysql_time*, unsigned char const*, date_mode_t) const::__PRETTY_FUNCTION__> "virtual bool Field_newdate::get_TIME(MYSQL_TIME*, const uchar*, date_mode_t) const") at assert.c:101
      #8  0x000056535df242e8 in Field_newdate::get_TIME (this=0x7f9e8c069cf8, ltime=0x7f9ea856db60, pos=0x7f9e8c069bf4 "!\312\017\245\377\"\304\017\326\326\017\245\245\245\245\245\245\245\245\245 \234\006\214\236\177", fuzzydate=...) at /data/src/10.4/sql/field.cc:6572
      #9  0x000056535df3869c in Field_newdate::get_date (this=0x7f9e8c069cf8, ltime=0x7f9ea856db60, fuzzydate=...) at /data/src/10.4/sql/field.h:3133
      #10 0x000056535df6da2a in Item_field::get_date (this=0x7f9e8c06b048, thd=0x7f9e8c000b00, ltime=0x7f9ea856db60, fuzzydate=...) at /data/src/10.4/sql/item.cc:3218
      #11 0x000056535de10275 in Temporal_with_date::make_from_item (this=0x7f9ea856db60, thd=0x7f9e8c000b00, item=0x7f9e8c06b048, fuzzydate=...) at /data/src/10.4/sql/sql_type.cc:848
      #12 0x000056535daf99ae in Temporal_with_date::Temporal_with_date (this=0x7f9ea856db60, thd=0x7f9e8c000b00, item=0x7f9e8c06b048, fuzzydate=...) at /data/src/10.4/sql/sql_type.h:1784
      #13 0x000056535daf9b12 in Datetime::Datetime (this=0x7f9ea856db60, thd=0x7f9e8c000b00, item=0x7f9e8c06b048, fuzzydate=...) at /data/src/10.4/sql/sql_type.h:2027
      #14 0x000056535dafa962 in Item::val_datetime_packed (this=0x7f9e8c06b048, thd=0x7f9e8c000b00) at /data/src/10.4/sql/item.h:1731
      #15 0x000056535df8e68c in Arg_comparator::compare_datetime (this=0x7f9e8c06b460) at /data/src/10.4/sql/item_cmpfunc.cc:730
      #16 0x000056535dfa48ae in Arg_comparator::compare (this=0x7f9e8c06b460) at /data/src/10.4/sql/item_cmpfunc.h:104
      #17 0x000056535df91c5b in Item_func_lt::val_int (this=0x7f9e8c06b398) at /data/src/10.4/sql/item_cmpfunc.cc:1808
      #18 0x000056535dd376eb in TABLE::verify_constraints (this=0x7f9e8c068d80, ignore_failure=false) at /data/src/10.4/sql/table.cc:5693
      #19 0x000056535dd37597 in TABLE_LIST::view_check_option (this=0x7f9e8c077a30, thd=0x7f9e8c000b00, ignore_failure=false) at /data/src/10.4/sql/table.cc:5668
      #20 0x000056535dd1ce7f in multi_update::do_updates (this=0x7f9e8c077160) at /data/src/10.4/sql/sql_update.cc:2831
      #21 0x000056535dd1d544 in multi_update::send_eof (this=0x7f9e8c077160) at /data/src/10.4/sql/sql_update.cc:2954
      #22 0x000056535dc8afb2 in do_select (join=0x7f9e8c077238, procedure=0x0) at /data/src/10.4/sql/sql_select.cc:19658
      #23 0x000056535dc61489 in JOIN::exec_inner (this=0x7f9e8c077238) at /data/src/10.4/sql/sql_select.cc:4390
      #24 0x000056535dc60636 in JOIN::exec (this=0x7f9e8c077238) at /data/src/10.4/sql/sql_select.cc:4172
      #25 0x000056535dc61cdb in mysql_select (thd=0x7f9e8c000b00, tables=0x7f9e8c013218, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x7f9e8c013bf8, group=0x0, having=0x0, proc_param=0x0, select_options=1342177408, result=0x7f9e8c077160, unit=0x7f9e8c004a28, select_lex=0x7f9e8c005208) at /data/src/10.4/sql/sql_select.cc:4604
      #26 0x000056535dd19a86 in mysql_multi_update (thd=0x7f9e8c000b00, table_list=0x7f9e8c013218, fields=0x7f9e8c005350, values=0x7f9e8c0058d8, conds=0x0, options=0, handle_duplicates=DUP_ERROR, ignore=false, unit=0x7f9e8c004a28, select_lex=0x7f9e8c005208, result=0x7f9ea856e910) at /data/src/10.4/sql/sql_update.cc:1918
      #27 0x000056535dc13768 in mysql_execute_command (thd=0x7f9e8c000b00) at /data/src/10.4/sql/sql_parse.cc:4710
      #28 0x000056535dc1fa07 in mysql_parse (thd=0x7f9e8c000b00, rawbuf=0x7f9e8c013108 "UPDATE v SET e = '2021-01-01' ORDER BY s LIMIT 1", length=48, parser_state=0x7f9ea856f180, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8164
      #29 0x000056535dc0b0e3 in dispatch_command (command=COM_QUERY, thd=0x7f9e8c000b00, packet=0x7f9e8c008311 "UPDATE v SET e = '2021-01-01' ORDER BY s LIMIT 1", packet_length=48, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1829
      #30 0x000056535dc098a1 in do_command (thd=0x7f9e8c000b00) at /data/src/10.4/sql/sql_parse.cc:1362
      #31 0x000056535dd8226f in do_handle_one_connection (connect=0x5653612e4010) at /data/src/10.4/sql/sql_connect.cc:1403
      #32 0x000056535dd81fd3 in handle_one_connection (arg=0x5653612e4010) at /data/src/10.4/sql/sql_connect.cc:1306
      #33 0x000056535e6abfef in pfs_spawn_thread (arg=0x5653613193a0) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #34 0x00007f9eaf7114a4 in start_thread (arg=0x7f9ea8570700) at pthread_create.c:456
      #35 0x00007f9eadc59d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Same with timestamps instead of dates:

      mysqld: /data/src/10.4/sql/field.cc:5576: virtual bool Field_timestampf::val_native(Native*): Assertion `marked_for_read()' failed.
      190603  0:44:42 [ERROR] mysqld got signal 6 ;
       
      #6  0x00007f8f223cce67 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x5636e00d98b0 "marked_for_read()", file=file@entry=0x5636e00d96c4 "/data/src/10.4/sql/field.cc", line=line@entry=5576, function=function@entry=0x5636e00dcee0 <Field_timestampf::val_native(Native*)::__PRETTY_FUNCTION__> "virtual bool Field_timestampf::val_native(Native*)") at assert.c:92
      #7  0x00007f8f223ccf12 in __GI___assert_fail (assertion=0x5636e00d98b0 "marked_for_read()", file=0x5636e00d96c4 "/data/src/10.4/sql/field.cc", line=5576, function=0x5636e00dcee0 <Field_timestampf::val_native(Native*)::__PRETTY_FUNCTION__> "virtual bool Field_timestampf::val_native(Native*)") at assert.c:101
      #8  0x00005636df66d099 in Field_timestampf::val_native (this=0x7f8f0c069d18, to=0x7f8f0c06b528) at /data/src/10.4/sql/field.cc:5576
      #9  0x00005636df6d0d65 in Item::val_native_from_field (this=0x7f8f0c06b048, field=0x7f8f0c069d18, to=0x7f8f0c06b528) at /data/src/10.4/sql/item.h:872
      #10 0x00005636df6bab44 in Item_field::val_native (this=0x7f8f0c06b048, thd=0x7f8f0c000b00, to=0x7f8f0c06b528) at /data/src/10.4/sql/item.cc:3239
      #11 0x00005636df570451 in Type_handler_timestamp_common::Item_val_native_with_conversion (this=0x5636e09e9b18 <type_handler_timestamp>, thd=0x7f8f0c000b00, item=0x7f8f0c06b048, to=0x7f8f0c06b528) at /data/src/10.4/sql/sql_type.cc:8239
      #12 0x00005636df60dbe8 in Item::val_native_with_conversion (this=0x7f8f0c06b048, thd=0x7f8f0c000b00, to=0x7f8f0c06b528, th=0x5636e09e9b18 <type_handler_timestamp>) at /data/src/10.4/sql/item.h:1299
      #13 0x00005636df6dba10 in Arg_comparator::compare_native (this=0x7f8f0c06b460) at /data/src/10.4/sql/item_cmpfunc.cc:791
      #14 0x00005636df6f18ae in Arg_comparator::compare (this=0x7f8f0c06b460) at /data/src/10.4/sql/item_cmpfunc.h:104
      #15 0x00005636df6dec5b in Item_func_lt::val_int (this=0x7f8f0c06b398) at /data/src/10.4/sql/item_cmpfunc.cc:1808
      #16 0x00005636df4846eb in TABLE::verify_constraints (this=0x7f8f0c068d80, ignore_failure=false) at /data/src/10.4/sql/table.cc:5693
      #17 0x00005636df484597 in TABLE_LIST::view_check_option (this=0x7f8f0c077990, thd=0x7f8f0c000b00, ignore_failure=false) at /data/src/10.4/sql/table.cc:5668
      #18 0x00005636df469e7f in multi_update::do_updates (this=0x7f8f0c0770c0) at /data/src/10.4/sql/sql_update.cc:2831
      #19 0x00005636df46a544 in multi_update::send_eof (this=0x7f8f0c0770c0) at /data/src/10.4/sql/sql_update.cc:2954
      #20 0x00005636df3d7fb2 in do_select (join=0x7f8f0c077198, procedure=0x0) at /data/src/10.4/sql/sql_select.cc:19658
      #21 0x00005636df3ae489 in JOIN::exec_inner (this=0x7f8f0c077198) at /data/src/10.4/sql/sql_select.cc:4390
      #22 0x00005636df3ad636 in JOIN::exec (this=0x7f8f0c077198) at /data/src/10.4/sql/sql_select.cc:4172
      #23 0x00005636df3aecdb in mysql_select (thd=0x7f8f0c000b00, tables=0x7f8f0c013218, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x7f8f0c013bf8, group=0x0, having=0x0, proc_param=0x0, select_options=1342177408, result=0x7f8f0c0770c0, unit=0x7f8f0c004a28, select_lex=0x7f8f0c005208) at /data/src/10.4/sql/sql_select.cc:4604
      #24 0x00005636df466a86 in mysql_multi_update (thd=0x7f8f0c000b00, table_list=0x7f8f0c013218, fields=0x7f8f0c005350, values=0x7f8f0c0058d8, conds=0x0, options=0, handle_duplicates=DUP_ERROR, ignore=false, unit=0x7f8f0c004a28, select_lex=0x7f8f0c005208, result=0x7f8f1c59d910) at /data/src/10.4/sql/sql_update.cc:1918
      #25 0x00005636df360768 in mysql_execute_command (thd=0x7f8f0c000b00) at /data/src/10.4/sql/sql_parse.cc:4710
      #26 0x00005636df36ca07 in mysql_parse (thd=0x7f8f0c000b00, rawbuf=0x7f8f0c013108 "UPDATE v SET e = '2021-01-01' ORDER BY s LIMIT 1", length=48, parser_state=0x7f8f1c59e180, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8164
      #27 0x00005636df3580e3 in dispatch_command (command=COM_QUERY, thd=0x7f8f0c000b00, packet=0x7f8f0c008311 "UPDATE v SET e = '2021-01-01' ORDER BY s LIMIT 1", packet_length=48, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1829
      #28 0x00005636df3568a1 in do_command (thd=0x7f8f0c000b00) at /data/src/10.4/sql/sql_parse.cc:1362
      #29 0x00005636df4cf26f in do_handle_one_connection (connect=0x5636e1dcf010) at /data/src/10.4/sql/sql_connect.cc:1403
      #30 0x00005636df4cefd3 in handle_one_connection (arg=0x5636e1dcf010) at /data/src/10.4/sql/sql_connect.cc:1306
      #31 0x00005636dfdf8fef in pfs_spawn_thread (arg=0x5636e1e043a0) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #32 0x00007f8f23f414a4 in start_thread (arg=0x7f8f1c59f700) at pthread_create.c:456
      #33 0x00007f8f22489d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Reproducible with InnoDB, MyISAM, Aria.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sanja Oleksandr Byelkin
                Reporter:
                elenst Elena Stepanova
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: