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

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

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

          Still happens with a very similar test case:

          --source include/have_innodb.inc
           
          CREATE TABLE t1 (id int, k int, PRIMARY KEY (id)) ENGINE=InnoDB WITH SYSTEM VERSIONING;
          INSERT INTO t1 VALUES (1,1),(2,2);
          CREATE VIEW v1 AS SELECT * FROM t1;
          UPDATE v1 SET id = 2 WHERE k = 0;
           
          # Cleanup
          DROP VIEW v1;
          DROP TABLE t1;
          

          10.3 9d9a2253

          mysqld: /data/src/10.3/sql/field.cc:4300: virtual longlong Field_long::val_int(): 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.
          191203 11:48:18 [ERROR] mysqld got signal 6 ;
           
          #7  0x00007f38209dff12 in __GI___assert_fail (assertion=0x5653f82647c0 "!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))", file=0x5653f8264619 "/data/src/10.3/sql/field.cc", line=4300, function=0x5653f8267000 <Field_long::val_int()::__PRETTY_FUNCTION__> "virtual longlong Field_long::val_int()") at assert.c:101
          #8  0x00005653f7787dae in Field_long::val_int (this=0x7f37c8006c38) at /data/src/10.3/sql/field.cc:4300
          #9  0x00005653f77e04b5 in Item_field::val_int (this=0x7f37c8015038) at /data/src/10.3/sql/item.cc:3432
          #10 0x00005653f77f0211 in Item_direct_ref::val_int (this=0x7f37c8016968) at /data/src/10.3/sql/item.cc:8517
          #11 0x00005653f77fb093 in Item_direct_view_ref::val_int (this=0x7f37c8016968) at /data/src/10.3/sql/item.h:5333
          #12 0x00005653f780333b in Arg_comparator::compare_int_signed (this=0x7f37c80133b8) at /data/src/10.3/sql/item_cmpfunc.cc:915
          #13 0x00005653f78181be in Arg_comparator::compare (this=0x7f37c80133b8) at /data/src/10.3/sql/item_cmpfunc.h:102
          #14 0x00005653f7805cec in Item_func_eq::val_int (this=0x7f37c80132f8) at /data/src/10.3/sql/item_cmpfunc.cc:1743
          #15 0x00005653f76a216b in Type_handler_int_result::Item_val_bool (this=0x5653f8b02950 <type_handler_long>, item=0x7f37c80132f8) at /data/src/10.3/sql/sql_type.cc:3281
          #16 0x00005653f7394e4e in Item::val_bool (this=0x7f37c80132f8) at /data/src/10.3/sql/item.h:1213
          #17 0x00005653f7810f02 in Item_cond_and::val_int (this=0x7f37c8016aa0) at /data/src/10.3/sql/item_cmpfunc.cc:5070
          #18 0x00005653f75b02f0 in SQL_SELECT::skip_record (this=0x7f37c8016da8, thd=0x7f37c8000af0) at /data/src/10.3/sql/opt_range.h:1658
          #19 0x00005653f75a8b01 in mysql_update (thd=0x7f37c8000af0, table_list=0x7f37c8012908, fields=..., values=..., conds=0x7f37c8016aa0, order_num=0, order=0x0, limit=18446744073709551615, ignore=false, found_return=0x7f3819d80f10, updated_return=0x7f3819d80fd0) at /data/src/10.3/sql/sql_update.cc:759
          #20 0x00005653f74a60d7 in mysql_execute_command (thd=0x7f37c8000af0) at /data/src/10.3/sql/sql_parse.cc:4301
          #21 0x00005653f74b214b in mysql_parse (thd=0x7f37c8000af0, rawbuf=0x7f37c8012818 "UPDATE v1 SET id = 2 WHERE k = 0", length=32, parser_state=0x7f3819d815e0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7818
          #22 0x00005653f749ec97 in dispatch_command (command=COM_QUERY, thd=0x7f37c8000af0, packet=0x7f37c8165681 "UPDATE v1 SET id = 2 WHERE k = 0", packet_length=32, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1856
          #23 0x00005653f749d5df in do_command (thd=0x7f37c8000af0) at /data/src/10.3/sql/sql_parse.cc:1401
          #24 0x00005653f7614a70 in do_handle_one_connection (connect=0x5653fb369540) at /data/src/10.3/sql/sql_connect.cc:1403
          #25 0x00005653f76147d2 in handle_one_connection (arg=0x5653fb369540) at /data/src/10.3/sql/sql_connect.cc:1308
          #26 0x00005653f7fc230c in pfs_spawn_thread (arg=0x5653fb2b3360) at /data/src/10.3/storage/perfschema/pfs.cc:1862
          #27 0x00007f38225554a4 in start_thread (arg=0x7f3819d82700) at pthread_create.c:456
          #28 0x00007f3820a9cd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
          

          10.4 0b8b11b0

          mysqld: /data/src/10.4/sql/field.cc:4292: virtual longlong Field_long::val_int(): Assertion `marked_for_read()' failed.
          191203 11:49:48 [ERROR] mysqld got signal 6 ;
           
          #7  0x00007f44e212df12 in __GI___assert_fail (assertion=0x559ac22c1d50 "marked_for_read()", file=0x559ac22c1b8b "/data/src/10.4/sql/field.cc", line=4292, function=0x559ac22c4600 <Field_long::val_int()::__PRETTY_FUNCTION__> "virtual longlong Field_long::val_int()") at assert.c:101
          #8  0x0000559ac1777931 in Field_long::val_int (this=0x7f44880400d8) at /data/src/10.4/sql/field.cc:4292
          #9  0x0000559ac17cfdb1 in Item_field::val_int (this=0x7f4488016308) at /data/src/10.4/sql/item.cc:3196
          #10 0x0000559ac17dfad9 in Item_direct_ref::val_int (this=0x7f44880185a0) at /data/src/10.4/sql/item.cc:8342
          #11 0x0000559ac17ea24d in Item_direct_view_ref::val_int (this=0x7f44880185a0) at /data/src/10.4/sql/item.h:5725
          #12 0x0000559ac17f32fb in Arg_comparator::compare_int_signed (this=0x7f4488013d68) at /data/src/10.4/sql/item_cmpfunc.cc:936
          #13 0x0000559ac180a00c in Arg_comparator::compare (this=0x7f4488013d68) at /data/src/10.4/sql/item_cmpfunc.h:104
          #14 0x0000559ac17f5c5c in Item_func_eq::val_int (this=0x7f4488013ca0) at /data/src/10.4/sql/item_cmpfunc.cc:1769
          #15 0x0000559ac166aeef in Type_handler_int_result::Item_val_bool (this=0x559ac2be9b70 <type_handler_bool>, item=0x7f4488013ca0) at /data/src/10.4/sql/sql_type.cc:4416
          #16 0x0000559ac1329b9e in Item::val_bool (this=0x7f4488013ca0) at /data/src/10.4/sql/item.h:1458
          #17 0x0000559ac1802112 in Item_cond_and::val_int (this=0x7f44880186d8) at /data/src/10.4/sql/item_cmpfunc.cc:5297
          #18 0x0000559ac1564a44 in SQL_SELECT::skip_record (this=0x7f44880189e8, thd=0x7f4488000af0) at /data/src/10.4/sql/opt_range.h:1664
          #19 0x0000559ac155cdc6 in mysql_update (thd=0x7f4488000af0, table_list=0x7f4488013248, fields=..., values=..., conds=0x7f44880186d8, order_num=0, order=0x0, limit=18446744073709551615, ignore=false, found_return=0x7f44dc0fe840, updated_return=0x7f44dc0fe900) at /data/src/10.4/sql/sql_update.cc:846
          #20 0x0000559ac144e3b9 in mysql_execute_command (thd=0x7f4488000af0) at /data/src/10.4/sql/sql_parse.cc:4377
          #21 0x0000559ac145b387 in mysql_parse (thd=0x7f4488000af0, rawbuf=0x7f4488013158 "UPDATE v1 SET id = 2 WHERE k = 0", length=32, parser_state=0x7f44dc0ff160, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7901
          #22 0x0000559ac144652c in dispatch_command (command=COM_QUERY, thd=0x7f4488000af0, packet=0x7f44881363c1 "UPDATE v1 SET id = 2 WHERE k = 0", packet_length=32, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
          #23 0x0000559ac1444bb9 in do_command (thd=0x7f4488000af0) at /data/src/10.4/sql/sql_parse.cc:1360
          #24 0x0000559ac15cd6a7 in do_handle_one_connection (connect=0x559ac41c3e50) at /data/src/10.4/sql/sql_connect.cc:1412
          #25 0x0000559ac15cd3f6 in handle_one_connection (arg=0x559ac41c3e50) at /data/src/10.4/sql/sql_connect.cc:1316
          #26 0x0000559ac1fcf7bb in pfs_spawn_thread (arg=0x559ac4141540) at /data/src/10.4/storage/perfschema/pfs.cc:1862
          #27 0x00007f44e3ca34a4 in start_thread (arg=0x7f44dc100700) at pthread_create.c:456
          #28 0x00007f44e21ead0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
          

          elenst Elena Stepanova added a comment - Still happens with a very similar test case: --source include/have_innodb.inc   CREATE TABLE t1 (id int , k int , PRIMARY KEY (id)) ENGINE=InnoDB WITH SYSTEM VERSIONING; INSERT INTO t1 VALUES (1,1),(2,2); CREATE VIEW v1 AS SELECT * FROM t1; UPDATE v1 SET id = 2 WHERE k = 0;   # Cleanup DROP VIEW v1; DROP TABLE t1; 10.3 9d9a2253 mysqld: /data/src/10.3/sql/field.cc:4300: virtual longlong Field_long::val_int(): 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. 191203 11:48:18 [ERROR] mysqld got signal 6 ;   #7 0x00007f38209dff12 in __GI___assert_fail (assertion=0x5653f82647c0 "!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))", file=0x5653f8264619 "/data/src/10.3/sql/field.cc", line=4300, function=0x5653f8267000 <Field_long::val_int()::__PRETTY_FUNCTION__> "virtual longlong Field_long::val_int()") at assert.c:101 #8 0x00005653f7787dae in Field_long::val_int (this=0x7f37c8006c38) at /data/src/10.3/sql/field.cc:4300 #9 0x00005653f77e04b5 in Item_field::val_int (this=0x7f37c8015038) at /data/src/10.3/sql/item.cc:3432 #10 0x00005653f77f0211 in Item_direct_ref::val_int (this=0x7f37c8016968) at /data/src/10.3/sql/item.cc:8517 #11 0x00005653f77fb093 in Item_direct_view_ref::val_int (this=0x7f37c8016968) at /data/src/10.3/sql/item.h:5333 #12 0x00005653f780333b in Arg_comparator::compare_int_signed (this=0x7f37c80133b8) at /data/src/10.3/sql/item_cmpfunc.cc:915 #13 0x00005653f78181be in Arg_comparator::compare (this=0x7f37c80133b8) at /data/src/10.3/sql/item_cmpfunc.h:102 #14 0x00005653f7805cec in Item_func_eq::val_int (this=0x7f37c80132f8) at /data/src/10.3/sql/item_cmpfunc.cc:1743 #15 0x00005653f76a216b in Type_handler_int_result::Item_val_bool (this=0x5653f8b02950 <type_handler_long>, item=0x7f37c80132f8) at /data/src/10.3/sql/sql_type.cc:3281 #16 0x00005653f7394e4e in Item::val_bool (this=0x7f37c80132f8) at /data/src/10.3/sql/item.h:1213 #17 0x00005653f7810f02 in Item_cond_and::val_int (this=0x7f37c8016aa0) at /data/src/10.3/sql/item_cmpfunc.cc:5070 #18 0x00005653f75b02f0 in SQL_SELECT::skip_record (this=0x7f37c8016da8, thd=0x7f37c8000af0) at /data/src/10.3/sql/opt_range.h:1658 #19 0x00005653f75a8b01 in mysql_update (thd=0x7f37c8000af0, table_list=0x7f37c8012908, fields=..., values=..., conds=0x7f37c8016aa0, order_num=0, order=0x0, limit=18446744073709551615, ignore=false, found_return=0x7f3819d80f10, updated_return=0x7f3819d80fd0) at /data/src/10.3/sql/sql_update.cc:759 #20 0x00005653f74a60d7 in mysql_execute_command (thd=0x7f37c8000af0) at /data/src/10.3/sql/sql_parse.cc:4301 #21 0x00005653f74b214b in mysql_parse (thd=0x7f37c8000af0, rawbuf=0x7f37c8012818 "UPDATE v1 SET id = 2 WHERE k = 0", length=32, parser_state=0x7f3819d815e0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7818 #22 0x00005653f749ec97 in dispatch_command (command=COM_QUERY, thd=0x7f37c8000af0, packet=0x7f37c8165681 "UPDATE v1 SET id = 2 WHERE k = 0", packet_length=32, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1856 #23 0x00005653f749d5df in do_command (thd=0x7f37c8000af0) at /data/src/10.3/sql/sql_parse.cc:1401 #24 0x00005653f7614a70 in do_handle_one_connection (connect=0x5653fb369540) at /data/src/10.3/sql/sql_connect.cc:1403 #25 0x00005653f76147d2 in handle_one_connection (arg=0x5653fb369540) at /data/src/10.3/sql/sql_connect.cc:1308 #26 0x00005653f7fc230c in pfs_spawn_thread (arg=0x5653fb2b3360) at /data/src/10.3/storage/perfschema/pfs.cc:1862 #27 0x00007f38225554a4 in start_thread (arg=0x7f3819d82700) at pthread_create.c:456 #28 0x00007f3820a9cd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97 10.4 0b8b11b0 mysqld: /data/src/10.4/sql/field.cc:4292: virtual longlong Field_long::val_int(): Assertion `marked_for_read()' failed. 191203 11:49:48 [ERROR] mysqld got signal 6 ;   #7 0x00007f44e212df12 in __GI___assert_fail (assertion=0x559ac22c1d50 "marked_for_read()", file=0x559ac22c1b8b "/data/src/10.4/sql/field.cc", line=4292, function=0x559ac22c4600 <Field_long::val_int()::__PRETTY_FUNCTION__> "virtual longlong Field_long::val_int()") at assert.c:101 #8 0x0000559ac1777931 in Field_long::val_int (this=0x7f44880400d8) at /data/src/10.4/sql/field.cc:4292 #9 0x0000559ac17cfdb1 in Item_field::val_int (this=0x7f4488016308) at /data/src/10.4/sql/item.cc:3196 #10 0x0000559ac17dfad9 in Item_direct_ref::val_int (this=0x7f44880185a0) at /data/src/10.4/sql/item.cc:8342 #11 0x0000559ac17ea24d in Item_direct_view_ref::val_int (this=0x7f44880185a0) at /data/src/10.4/sql/item.h:5725 #12 0x0000559ac17f32fb in Arg_comparator::compare_int_signed (this=0x7f4488013d68) at /data/src/10.4/sql/item_cmpfunc.cc:936 #13 0x0000559ac180a00c in Arg_comparator::compare (this=0x7f4488013d68) at /data/src/10.4/sql/item_cmpfunc.h:104 #14 0x0000559ac17f5c5c in Item_func_eq::val_int (this=0x7f4488013ca0) at /data/src/10.4/sql/item_cmpfunc.cc:1769 #15 0x0000559ac166aeef in Type_handler_int_result::Item_val_bool (this=0x559ac2be9b70 <type_handler_bool>, item=0x7f4488013ca0) at /data/src/10.4/sql/sql_type.cc:4416 #16 0x0000559ac1329b9e in Item::val_bool (this=0x7f4488013ca0) at /data/src/10.4/sql/item.h:1458 #17 0x0000559ac1802112 in Item_cond_and::val_int (this=0x7f44880186d8) at /data/src/10.4/sql/item_cmpfunc.cc:5297 #18 0x0000559ac1564a44 in SQL_SELECT::skip_record (this=0x7f44880189e8, thd=0x7f4488000af0) at /data/src/10.4/sql/opt_range.h:1664 #19 0x0000559ac155cdc6 in mysql_update (thd=0x7f4488000af0, table_list=0x7f4488013248, fields=..., values=..., conds=0x7f44880186d8, order_num=0, order=0x0, limit=18446744073709551615, ignore=false, found_return=0x7f44dc0fe840, updated_return=0x7f44dc0fe900) at /data/src/10.4/sql/sql_update.cc:846 #20 0x0000559ac144e3b9 in mysql_execute_command (thd=0x7f4488000af0) at /data/src/10.4/sql/sql_parse.cc:4377 #21 0x0000559ac145b387 in mysql_parse (thd=0x7f4488000af0, rawbuf=0x7f4488013158 "UPDATE v1 SET id = 2 WHERE k = 0", length=32, parser_state=0x7f44dc0ff160, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7901 #22 0x0000559ac144652c in dispatch_command (command=COM_QUERY, thd=0x7f4488000af0, packet=0x7f44881363c1 "UPDATE v1 SET id = 2 WHERE k = 0", packet_length=32, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842 #23 0x0000559ac1444bb9 in do_command (thd=0x7f4488000af0) at /data/src/10.4/sql/sql_parse.cc:1360 #24 0x0000559ac15cd6a7 in do_handle_one_connection (connect=0x559ac41c3e50) at /data/src/10.4/sql/sql_connect.cc:1412 #25 0x0000559ac15cd3f6 in handle_one_connection (arg=0x559ac41c3e50) at /data/src/10.4/sql/sql_connect.cc:1316 #26 0x0000559ac1fcf7bb in pfs_spawn_thread (arg=0x559ac4141540) at /data/src/10.4/storage/perfschema/pfs.cc:1862 #27 0x00007f44e3ca34a4 in start_thread (arg=0x7f44dc100700) at pthread_create.c:456 #28 0x00007f44e21ead0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

          CREATE TABLE t1 (a INT) WITH SYSTEM VERSIONING;
          CREATE VIEW v1 AS SELECT * FROM t1;
          CREATE PROCEDURE sp() UPDATE v1 SET xx = 1; 
          --error ER_BAD_FIELD_ERROR
          CALL sp;
          --error ER_BAD_FIELD_ERROR
          CALL sp;
           
          # Cleanup
          DROP PROCEDURE sp;
          DROP VIEW v1;
          DROP TABLE t1;
          

          bb-10.3-release 734bdf04

          #3  <signal handler called>
          #4  0x0000561a1fe05f46 in Item_cond::fix_fields (this=0x7f5b5c0388f8, thd=0x7f5b5c000af0, ref=0x7f5b5c073cd0) at /data/src/bb-10.3-release/sql/item_cmpfunc.cc:4592
          #5  0x0000561a1fbbe685 in TABLE_LIST::prep_where (this=0x7f5b5c073ae0, thd=0x7f5b5c000af0, conds=0x7f5b6e5253d8, no_where_clause=false) at /data/src/bb-10.3-release/sql/table.cc:4978
          #6  0x0000561a1fa15db3 in TABLE_LIST::prepare_where (this=0x7f5b5c073ae0, thd=0x7f5b5c000af0, conds=0x7f5b6e5253d8, no_where_clause=false) at /data/src/bb-10.3-release/sql/table.h:2480
          #7  0x0000561a1fa13250 in setup_conds (thd=0x7f5b5c000af0, tables=0x7f5b5c073ae0, leaves=..., conds=0x7f5b6e5253d8) at /data/src/bb-10.3-release/sql/sql_base.cc:8186
          #8  0x0000561a1fba0d6d in mysql_prepare_update (thd=0x7f5b5c000af0, table_list=0x7f5b5c073ae0, conds=0x7f5b6e5253d8, order_num=0, order=0x0) at /data/src/bb-10.3-release/sql/sql_update.cc:1288
          #9  0x0000561a1fb9dc23 in mysql_update (thd=0x7f5b5c000af0, table_list=0x7f5b5c073ae0, fields=..., values=..., conds=0x7f5b5c0384c0, order_num=0, order=0x0, limit=18446744073709551615, ignore=false, found_return=0x7f5b6e525aa0, updated_return=0x7f5b6e525b60) at /data/src/bb-10.3-release/sql/sql_update.cc:401
          #10 0x0000561a1fa9c6f3 in mysql_execute_command (thd=0x7f5b5c000af0) at /data/src/bb-10.3-release/sql/sql_parse.cc:4301
          #11 0x0000561a1f9bdf16 in sp_instr_stmt::exec_core (this=0x7f5b5c074320, thd=0x7f5b5c000af0, nextp=0x7f5b6e5261c4) at /data/src/bb-10.3-release/sql/sp_head.cc:3592
          #12 0x0000561a1f9bd3d4 in sp_lex_keeper::reset_lex_and_exec_core (this=0x7f5b5c074368, thd=0x7f5b5c000af0, nextp=0x7f5b6e5261c4, open_tables=false, instr=0x7f5b5c074320) at /data/src/bb-10.3-release/sql/sp_head.cc:3324
          #13 0x0000561a1f9bdaf6 in sp_instr_stmt::execute (this=0x7f5b5c074320, thd=0x7f5b5c000af0, nextp=0x7f5b6e5261c4) at /data/src/bb-10.3-release/sql/sp_head.cc:3498
          #14 0x0000561a1f9b7734 in sp_head::execute (this=0x7f5b5c072e58, thd=0x7f5b5c000af0, merge_da_on_success=true) at /data/src/bb-10.3-release/sql/sp_head.cc:1356
          #15 0x0000561a1f9ba1ec in sp_head::execute_procedure (this=0x7f5b5c072e58, thd=0x7f5b5c000af0, args=0x7f5b5c005778) at /data/src/bb-10.3-release/sql/sp_head.cc:2296
          #16 0x0000561a1fa984f2 in do_execute_sp (thd=0x7f5b5c000af0, sp=0x7f5b5c072e58) at /data/src/bb-10.3-release/sql/sql_parse.cc:2992
          #17 0x0000561a1fa99168 in Sql_cmd_call::execute (this=0x7f5b5c0128d0, thd=0x7f5b5c000af0) at /data/src/bb-10.3-release/sql/sql_parse.cc:3232
          #18 0x0000561a1faa3006 in mysql_execute_command (thd=0x7f5b5c000af0) at /data/src/bb-10.3-release/sql/sql_parse.cc:6031
          #19 0x0000561a1faa8767 in mysql_parse (thd=0x7f5b5c000af0, rawbuf=0x7f5b5c012818 "CALL sp", length=7, parser_state=0x7f5b6e5275e0, is_com_multi=false, is_next_command=false) at /data/src/bb-10.3-release/sql/sql_parse.cc:7818
          #20 0x0000561a1fa952b3 in dispatch_command (command=COM_QUERY, thd=0x7f5b5c000af0, packet=0x7f5b5c123431 "CALL sp", packet_length=7, is_com_multi=false, is_next_command=false) at /data/src/bb-10.3-release/sql/sql_parse.cc:1856
          #21 0x0000561a1fa93bfb in do_command (thd=0x7f5b5c000af0) at /data/src/bb-10.3-release/sql/sql_parse.cc:1401
          #22 0x0000561a1fc0b02c in do_handle_one_connection (connect=0x561a22b3f9e0) at /data/src/bb-10.3-release/sql/sql_connect.cc:1403
          #23 0x0000561a1fc0ad8e in handle_one_connection (arg=0x561a22b3f9e0) at /data/src/bb-10.3-release/sql/sql_connect.cc:1308
          #24 0x0000561a205b7858 in pfs_spawn_thread (arg=0x561a22b5a9a0) at /data/src/bb-10.3-release/storage/perfschema/pfs.cc:1862
          #25 0x00007f5b75e9e4a4 in start_thread (arg=0x7f5b6e528700) at pthread_create.c:456
          #26 0x00007f5b743e5d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
          

          The failure started happening on bb-10.3-release after this commit:

          commit bf2f391664c56334ff9229e448bb3efa166c40b7
          Author: Aleksey Midenkov <midenok@gmail.com>
          Date:   Tue Dec 3 15:46:49 2019 +0300
           
              MDEV-21147 Assertion `marked_for_read()' upon UPDATE on versioned table via view
              
              Unit prepare prematurely fixed field which must be fixed via
              setup_conds() to correctly update table->covering_keys.
              
              Call vers_setup_conds() directly instead, because actually everything
              else is not needed.
          

          elenst Elena Stepanova added a comment - CREATE TABLE t1 (a INT ) WITH SYSTEM VERSIONING; CREATE VIEW v1 AS SELECT * FROM t1; CREATE PROCEDURE sp() UPDATE v1 SET xx = 1; --error ER_BAD_FIELD_ERROR CALL sp; --error ER_BAD_FIELD_ERROR CALL sp;   # Cleanup DROP PROCEDURE sp; DROP VIEW v1; DROP TABLE t1; bb-10.3-release 734bdf04 #3 <signal handler called> #4 0x0000561a1fe05f46 in Item_cond::fix_fields (this=0x7f5b5c0388f8, thd=0x7f5b5c000af0, ref=0x7f5b5c073cd0) at /data/src/bb-10.3-release/sql/item_cmpfunc.cc:4592 #5 0x0000561a1fbbe685 in TABLE_LIST::prep_where (this=0x7f5b5c073ae0, thd=0x7f5b5c000af0, conds=0x7f5b6e5253d8, no_where_clause=false) at /data/src/bb-10.3-release/sql/table.cc:4978 #6 0x0000561a1fa15db3 in TABLE_LIST::prepare_where (this=0x7f5b5c073ae0, thd=0x7f5b5c000af0, conds=0x7f5b6e5253d8, no_where_clause=false) at /data/src/bb-10.3-release/sql/table.h:2480 #7 0x0000561a1fa13250 in setup_conds (thd=0x7f5b5c000af0, tables=0x7f5b5c073ae0, leaves=..., conds=0x7f5b6e5253d8) at /data/src/bb-10.3-release/sql/sql_base.cc:8186 #8 0x0000561a1fba0d6d in mysql_prepare_update (thd=0x7f5b5c000af0, table_list=0x7f5b5c073ae0, conds=0x7f5b6e5253d8, order_num=0, order=0x0) at /data/src/bb-10.3-release/sql/sql_update.cc:1288 #9 0x0000561a1fb9dc23 in mysql_update (thd=0x7f5b5c000af0, table_list=0x7f5b5c073ae0, fields=..., values=..., conds=0x7f5b5c0384c0, order_num=0, order=0x0, limit=18446744073709551615, ignore=false, found_return=0x7f5b6e525aa0, updated_return=0x7f5b6e525b60) at /data/src/bb-10.3-release/sql/sql_update.cc:401 #10 0x0000561a1fa9c6f3 in mysql_execute_command (thd=0x7f5b5c000af0) at /data/src/bb-10.3-release/sql/sql_parse.cc:4301 #11 0x0000561a1f9bdf16 in sp_instr_stmt::exec_core (this=0x7f5b5c074320, thd=0x7f5b5c000af0, nextp=0x7f5b6e5261c4) at /data/src/bb-10.3-release/sql/sp_head.cc:3592 #12 0x0000561a1f9bd3d4 in sp_lex_keeper::reset_lex_and_exec_core (this=0x7f5b5c074368, thd=0x7f5b5c000af0, nextp=0x7f5b6e5261c4, open_tables=false, instr=0x7f5b5c074320) at /data/src/bb-10.3-release/sql/sp_head.cc:3324 #13 0x0000561a1f9bdaf6 in sp_instr_stmt::execute (this=0x7f5b5c074320, thd=0x7f5b5c000af0, nextp=0x7f5b6e5261c4) at /data/src/bb-10.3-release/sql/sp_head.cc:3498 #14 0x0000561a1f9b7734 in sp_head::execute (this=0x7f5b5c072e58, thd=0x7f5b5c000af0, merge_da_on_success=true) at /data/src/bb-10.3-release/sql/sp_head.cc:1356 #15 0x0000561a1f9ba1ec in sp_head::execute_procedure (this=0x7f5b5c072e58, thd=0x7f5b5c000af0, args=0x7f5b5c005778) at /data/src/bb-10.3-release/sql/sp_head.cc:2296 #16 0x0000561a1fa984f2 in do_execute_sp (thd=0x7f5b5c000af0, sp=0x7f5b5c072e58) at /data/src/bb-10.3-release/sql/sql_parse.cc:2992 #17 0x0000561a1fa99168 in Sql_cmd_call::execute (this=0x7f5b5c0128d0, thd=0x7f5b5c000af0) at /data/src/bb-10.3-release/sql/sql_parse.cc:3232 #18 0x0000561a1faa3006 in mysql_execute_command (thd=0x7f5b5c000af0) at /data/src/bb-10.3-release/sql/sql_parse.cc:6031 #19 0x0000561a1faa8767 in mysql_parse (thd=0x7f5b5c000af0, rawbuf=0x7f5b5c012818 "CALL sp", length=7, parser_state=0x7f5b6e5275e0, is_com_multi=false, is_next_command=false) at /data/src/bb-10.3-release/sql/sql_parse.cc:7818 #20 0x0000561a1fa952b3 in dispatch_command (command=COM_QUERY, thd=0x7f5b5c000af0, packet=0x7f5b5c123431 "CALL sp", packet_length=7, is_com_multi=false, is_next_command=false) at /data/src/bb-10.3-release/sql/sql_parse.cc:1856 #21 0x0000561a1fa93bfb in do_command (thd=0x7f5b5c000af0) at /data/src/bb-10.3-release/sql/sql_parse.cc:1401 #22 0x0000561a1fc0b02c in do_handle_one_connection (connect=0x561a22b3f9e0) at /data/src/bb-10.3-release/sql/sql_connect.cc:1403 #23 0x0000561a1fc0ad8e in handle_one_connection (arg=0x561a22b3f9e0) at /data/src/bb-10.3-release/sql/sql_connect.cc:1308 #24 0x0000561a205b7858 in pfs_spawn_thread (arg=0x561a22b5a9a0) at /data/src/bb-10.3-release/storage/perfschema/pfs.cc:1862 #25 0x00007f5b75e9e4a4 in start_thread (arg=0x7f5b6e528700) at pthread_create.c:456 #26 0x00007f5b743e5d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97 The failure started happening on bb-10.3-release after this commit: commit bf2f391664c56334ff9229e448bb3efa166c40b7 Author: Aleksey Midenkov <midenok@gmail.com> Date: Tue Dec 3 15:46:49 2019 +0300   MDEV-21147 Assertion `marked_for_read()' upon UPDATE on versioned table via view Unit prepare prematurely fixed field which must be fixed via setup_conds() to correctly update table->covering_keys. Call vers_setup_conds() directly instead, because actually everything else is not needed.

          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.