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

Assertion `marked_for_read()' upon UPDATE on versioned table via view

    XMLWordPrintable

Details

    Description

      Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))' or Assertion `marked_for_read()' failed upon UPDATE on versioned table via view

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (
          pk int,
          a char(8),
          b char(8),
      primary key (pk)
      ) ENGINE=InnoDB WITH SYSTEM VERSIONING;
       
      CREATE  VIEW v1 AS SELECT * FROM t1;
      INSERT INTO t1 VALUES  (1, NULL, 'd') ,  (2, NULL, 'i') ;
      UPDATE v1 SET a = NULL WHERE b = '';
       
      # Cleanup
      DROP VIEW v1;
      DROP TABLE t1;
      

      10.5 86407a59

      mysqld: /data/src/10.5-bug/sql/field.cc:7251: virtual String* Field_string::val_str(String*, String*): Assertion `marked_for_read()' failed.
      191126  4:06:49 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fbff4eacf12 in __GI___assert_fail (assertion=0x561c44811890 "marked_for_read()", file=0x561c448116c0 "/data/src/10.5-bug/sql/field.cc", line=7251, function=0x561c448165a0 <Field_string::val_str(String*, String*)::__PRETTY_FUNCTION__> "virtual String* Field_string::val_str(String*, String*)") at assert.c:101
      #8  0x0000561c43c75169 in Field_string::val_str (this=0x7fbfbc007c98, val_buffer=0x7fbfbc0141f0, val_ptr=0x7fbfbc016898) at /data/src/10.5-bug/sql/field.cc:7251
      #9  0x0000561c43cbcae6 in Item_field::val_str (this=0x7fbfbc016860, str=0x7fbfbc0141f0) at /data/src/10.5-bug/sql/item.cc:3182
      #10 0x0000561c43ccccd2 in Item_direct_ref::val_str (this=0x7fbfbc018be0, tmp=0x7fbfbc0141f0) at /data/src/10.5-bug/sql/item.cc:8359
      #11 0x0000561c43cd737a in Item_direct_view_ref::val_str (this=0x7fbfbc018be0, tmp=0x7fbfbc0141f0) at /data/src/10.5-bug/sql/item.h:5706
      #12 0x0000561c43cdfa49 in Arg_comparator::compare_string (this=0x7fbfbc0140c0) at /data/src/10.5-bug/sql/item_cmpfunc.cc:769
      #13 0x0000561c43cf7c24 in Arg_comparator::compare (this=0x7fbfbc0140c0) at /data/src/10.5-bug/sql/item_cmpfunc.h:104
      #14 0x0000561c43ce2ef8 in Item_func_eq::val_int (this=0x7fbfbc013ff0) at /data/src/10.5-bug/sql/item_cmpfunc.cc:1778
      #15 0x0000561c43b89f1d in Type_handler_int_result::Item_val_bool (this=0x561c45388240 <type_handler_bool>, item=0x7fbfbc013ff0) at /data/src/10.5-bug/sql/sql_type.cc:4915
      #16 0x0000561c4382d9d8 in Item::val_bool (this=0x7fbfbc013ff0) at /data/src/10.5-bug/sql/item.h:1468
      #17 0x0000561c43cef9a2 in Item_cond_and::val_int (this=0x7fbfbc018d40) at /data/src/10.5-bug/sql/item_cmpfunc.cc:5401
      #18 0x0000561c43a79f30 in SQL_SELECT::skip_record (this=0x7fbfbc0190a8, thd=0x7fbfbc000b00) at /data/src/10.5-bug/sql/opt_range.h:1665
      #19 0x0000561c43a72397 in mysql_update (thd=0x7fbfbc000b00, table_list=0x7fbfbc013560, fields=..., values=..., conds=0x7fbfbc018d40, order_num=0, order=0x0, limit=18446744073709551615, ignore=false, found_return=0x7fbff0081000, updated_return=0x7fbff00810c0) at /data/src/10.5-bug/sql/sql_update.cc:837
      #20 0x0000561c43954c73 in mysql_execute_command (thd=0x7fbfbc000b00) at /data/src/10.5-bug/sql/sql_parse.cc:4359
      #21 0x0000561c43961f44 in mysql_parse (thd=0x7fbfbc000b00, rawbuf=0x7fbfbc013468 "UPDATE v1 SET a = NULL WHERE b = ''", length=35, parser_state=0x7fbff0081580, is_com_multi=false, is_next_command=false) at /data/src/10.5-bug/sql/sql_parse.cc:7988
      #22 0x0000561c4394cfdf in dispatch_command (command=COM_QUERY, thd=0x7fbfbc000b00, packet=0x7fbfbc093d61 "UPDATE v1 SET a = NULL WHERE b = ''", packet_length=35, is_com_multi=false, is_next_command=false) at /data/src/10.5-bug/sql/sql_parse.cc:1846
      #23 0x0000561c4394b739 in do_command (thd=0x7fbfbc000b00) at /data/src/10.5-bug/sql/sql_parse.cc:1364
      #24 0x0000561c43aeb091 in do_handle_one_connection (connect=0x561c47046bd0, put_in_cache=true) at /data/src/10.5-bug/sql/sql_connect.cc:1422
      #25 0x0000561c43aeadc0 in handle_one_connection (arg=0x561c47046bd0) at /data/src/10.5-bug/sql/sql_connect.cc:1319
      #26 0x0000561c44030541 in pfs_spawn_thread (arg=0x561c46fa8700) at /data/src/10.5-bug/storage/perfschema/pfs.cc:1862
      #27 0x00007fbff6a224a4 in start_thread (arg=0x7fbff0082700) at pthread_create.c:456
      #28 0x00007fbff4f69d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      10.3 0076dce2c

      mysqld: /data/src/10.3-bug-post/sql/field.cc:7247: virtual String* Field_string::val_str(String*, String*): Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))' failed.
       
      #7  0x00007f5b1efa2f12 in __GI___assert_fail (assertion=0x55a23e8b61d8 "!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))", file=0x55a23e8b6028 "/data/src/10.3-bug-post/sql/field.cc", line=7247, function=0x55a23e8ba380 <Field_string::val_str(String*, String*)::__PRETTY_FUNCTION__> "virtual String* Field_string::val_str(String*, String*)") at assert.c:101
      #8  0x000055a23dde8250 in Field_string::val_str (this=0x7f5ac8163d98, val_buffer=0x7f5ac80133f0, val_ptr=0x7f5ac80151e8) at /data/src/10.3-bug-post/sql/field.cc:7247
      #9  0x000055a23de315ac in Item_field::val_str (this=0x7f5ac80151b8, str=0x7f5ac80133f0) at /data/src/10.3-bug-post/sql/item.cc:3414
      #10 0x000055a23de41524 in Item_direct_ref::val_str (this=0x7f5ac8016b88, tmp=0x7f5ac80133f0) at /data/src/10.3-bug-post/sql/item.cc:8525
      #11 0x000055a23de4c37c in Item_direct_view_ref::val_str (this=0x7f5ac8016b88, tmp=0x7f5ac80133f0) at /data/src/10.3-bug-post/sql/item.h:5340
      #12 0x000055a23de53ca0 in Arg_comparator::compare_string (this=0x7f5ac8013390) at /data/src/10.3-bug-post/sql/item_cmpfunc.cc:777
      #13 0x000055a23de6946a in Arg_comparator::compare (this=0x7f5ac8013390) at /data/src/10.3-bug-post/sql/item_cmpfunc.h:102
      #14 0x000055a23de56f98 in Item_func_eq::val_int (this=0x7f5ac80132d0) at /data/src/10.3-bug-post/sql/item_cmpfunc.cc:1743
      #15 0x000055a23dcf3547 in Type_handler_int_result::Item_val_bool (this=0x55a23f159950 <type_handler_long>, item=0x7f5ac80132d0) at /data/src/10.3-bug-post/sql/sql_type.cc:3281
      #16 0x000055a23d9e6a1e in Item::val_bool (this=0x7f5ac80132d0) at /data/src/10.3-bug-post/sql/item.h:1213
      #17 0x000055a23de621ae in Item_cond_and::val_int (this=0x7f5ac8016cc0) at /data/src/10.3-bug-post/sql/item_cmpfunc.cc:5070
      #18 0x000055a23dc016de in SQL_SELECT::skip_record (this=0x7f5ac8016ff0, thd=0x7f5ac8000af0) at /data/src/10.3-bug-post/sql/opt_range.h:1658
      #19 0x000055a23dbf9fc4 in mysql_update (thd=0x7f5ac8000af0, table_list=0x7f5ac8012900, fields=..., values=..., conds=0x7f5ac8016cc0, order_num=0, order=0x0, limit=18446744073709551615, ignore=false, found_return=0x7f5b18343f10, updated_return=0x7f5b18343fd0) at /data/src/10.3-bug-post/sql/sql_update.cc:756
      #20 0x000055a23daf7503 in mysql_execute_command (thd=0x7f5ac8000af0) at /data/src/10.3-bug-post/sql/sql_parse.cc:4301
      #21 0x000055a23db03577 in mysql_parse (thd=0x7f5ac8000af0, rawbuf=0x7f5ac8012808 "UPDATE v1 SET a = NULL WHERE b = ''", length=35, parser_state=0x7f5b183445e0, is_com_multi=false, is_next_command=false) at /data/src/10.3-bug-post/sql/sql_parse.cc:7818
      #22 0x000055a23daf00c3 in dispatch_command (command=COM_QUERY, thd=0x7f5ac8000af0, packet=0x7f5ac8008c61 "UPDATE v1 SET a = NULL WHERE b = ''", packet_length=35, is_com_multi=false, is_next_command=false) at /data/src/10.3-bug-post/sql/sql_parse.cc:1856
      #23 0x000055a23daeea0b in do_command (thd=0x7f5ac8000af0) at /data/src/10.3-bug-post/sql/sql_parse.cc:1401
      #24 0x000055a23dc65e4c in do_handle_one_connection (connect=0x55a241395510) at /data/src/10.3-bug-post/sql/sql_connect.cc:1403
      #25 0x000055a23dc65bae in handle_one_connection (arg=0x55a241395510) at /data/src/10.3-bug-post/sql/sql_connect.cc:1308
      #26 0x000055a23e6124ee in pfs_spawn_thread (arg=0x55a2412dac90) at /data/src/10.3-bug-post/storage/perfschema/pfs.cc:1862
      #27 0x00007f5b20b184a4 in start_thread (arg=0x7f5b18345700) at pthread_create.c:456
      #28 0x00007f5b1f05fd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Reproducible on 10.3-10.5.

      The failure appeared in 10.3 tree with this commit:

      commit 0076dce2c89248b6c0252ec4385879194f9aadbf
      Author: Aleksey Midenkov
      Date:   Fri Nov 22 14:29:03 2019 +0300
       
          MDEV-18727 improve DML operation of System Versioning
          MDEV-18957 UPDATE with LIMIT clause is wrong for versioned partitioned tables
          
          UPDATE, DELETE: replace linear search of current/historical records
          with vers_setup_conds().
          
          Additional DML cases in view.test
      

      Attachments

        Activity

          People

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