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

Assertion on updating view of join with versioned table

    Details

      Description

      Assertion `marked_for_write_or_computed()' failed in Field_date_common::store_TIME_with_warning and variations

      Test case 1, with NO_ZERO_IN_DATE

      --source include/have_innodb.inc
       
      CREATE TABLE t1 ( 
          pk INT,
          a DATE,
          b INT,
          PRIMARY KEY(pk),
          INDEX(b)
      ) ENGINE=InnoDB WITH SYSTEM VERSIONING;
      INSERT INTO t1 (pk) VALUES (1),(2);
       
      CREATE TABLE t2 (c INT);
      INSERT IGNORE INTO t2 VALUES (3),(4);
       
      CREATE VIEW v AS SELECT * FROM t1 JOIN t2;
       
      UPDATE t1 SET a = '2012-12-12' ORDER BY b LIMIT 1;
       
      SET SQL_MODE= 'NO_ZERO_IN_DATE';
      UPDATE v SET a = '2000-01-01' ORDER BY b LIMIT 1;
       
      # Cleanup
      DROP VIEW v;
      DROP TABLE t1, t2;
      

      10.4 d18ef804, with NO_ZERO_IN_DATE

      mysqld: /data/src/10.4/sql/field.cc:6368: int Field_date_common::store_TIME_with_warning(const Datetime*, const ErrConv*, int): Assertion `marked_for_write_or_computed()' failed.
      190507 13:40:45 [ERROR] mysqld got signal 6 ;
       
      #6  0x00007f815e0b0e67 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x55fbeb508eb8 "marked_for_write_or_computed()", file=file@entry=0x55fbeb508c24 "/data/src/10.4/sql/field.cc", line=line@entry=6368, function=function@entry=0x55fbeb50cd20 <Field_date_common::store_TIME_with_warning(Datetime const*, ErrConv const*, int)::__PRETTY_FUNCTION__> "int Field_date_common::store_TIME_with_warning(const Datetime*, const ErrConv*, int)") at assert.c:92
      #7  0x00007f815e0b0f12 in __GI___assert_fail (assertion=0x55fbeb508eb8 "marked_for_write_or_computed()", file=0x55fbeb508c24 "/data/src/10.4/sql/field.cc", line=6368, function=0x55fbeb50cd20 <Field_date_common::store_TIME_with_warning(Datetime const*, ErrConv const*, int)::__PRETTY_FUNCTION__> "int Field_date_common::store_TIME_with_warning(const Datetime*, const ErrConv*, int)") at assert.c:101
      #8  0x000055fbeaaa03b6 in Field_date_common::store_TIME_with_warning (this=0x7f80fc154580, dt=0x7f8158080d00, str=0x7f8158080d30, was_cut=0) at /data/src/10.4/sql/field.cc:6368
      #9  0x000055fbeaaa0895 in Field_date_common::store_time_dec (this=0x7f80fc154580, ltime=0x7f8158080f80, dec=0) at /data/src/10.4/sql/field.cc:6414
      #10 0x000055fbeaaba386 in Field::do_field_temporal (copy=0x7f80fc1bdeb0, fuzzydate=...) at /data/src/10.4/sql/field_conv.cc:435
      #11 0x000055fbeaaba3fb in Field::do_field_date (copy=0x7f80fc1bdeb0) at /data/src/10.4/sql/field_conv.cc:447
      #12 0x000055fbeaab995f in do_copy_null (copy=0x7f80fc1bdeb0) at /data/src/10.4/sql/field_conv.cc:246
      #13 0x000055fbea89bc5b in multi_update::do_updates (this=0x7f80fc1bcd68) at /data/src/10.4/sql/sql_update.cc:2781
      #14 0x000055fbea89c4a4 in multi_update::send_eof (this=0x7f80fc1bcd68) at /data/src/10.4/sql/sql_update.cc:2922
      #15 0x000055fbea80a4fa in do_select (join=0x7f80fc1bce40, procedure=0x0) at /data/src/10.4/sql/sql_select.cc:19637
      #16 0x000055fbea7e13ef in JOIN::exec_inner (this=0x7f80fc1bce40) at /data/src/10.4/sql/sql_select.cc:4389
      #17 0x000055fbea7e059c in JOIN::exec (this=0x7f80fc1bce40) at /data/src/10.4/sql/sql_select.cc:4171
      #18 0x000055fbea7e1c41 in mysql_select (thd=0x7f80fc000b00, tables=0x7f80fc015748, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x7f80fc016140, group=0x0, having=0x0, proc_param=0x0, select_options=1342177408, result=0x7f80fc1bcd68, unit=0x7f80fc004a28, select_lex=0x7f80fc005200) at /data/src/10.4/sql/sql_select.cc:4603
      #19 0x000055fbea8989e6 in mysql_multi_update (thd=0x7f80fc000b00, table_list=0x7f80fc015748, fields=0x7f80fc005348, values=0x7f80fc0058d0, conds=0x0, options=0, handle_duplicates=DUP_ERROR, ignore=true, unit=0x7f80fc004a28, select_lex=0x7f80fc005200, result=0x7f8158081910) at /data/src/10.4/sql/sql_update.cc:1886
      #20 0x000055fbea7936d3 in mysql_execute_command (thd=0x7f80fc000b00) at /data/src/10.4/sql/sql_parse.cc:4702
      #21 0x000055fbea79f97f in mysql_parse (thd=0x7f80fc000b00, rawbuf=0x7f80fc0155d8 "UPDATE IGNORE `v7` SET `col_date` = '' ORDER BY `col_int` LIMIT 1 /* QNO 1647 CON_ID 16 */", length=90, parser_state=0x7f8158082180, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8149
      #22 0x000055fbea78b05a in dispatch_command (command=COM_QUERY, thd=0x7f80fc000b00, packet=0x7f80fc13a2a1 "UPDATE IGNORE `v7` SET `col_date` = '' ORDER BY `col_int` LIMIT 1 /* QNO 1647 CON_ID 16 */", packet_length=90, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1828
      #23 0x000055fbea78981a in do_command (thd=0x7f80fc000b00) at /data/src/10.4/sql/sql_parse.cc:1361
      #24 0x000055fbea901089 in do_handle_one_connection (connect=0x55fbecf1bcd0) at /data/src/10.4/sql/sql_connect.cc:1398
      #25 0x000055fbea900ded in handle_one_connection (arg=0x55fbecf1bcd0) at /data/src/10.4/sql/sql_connect.cc:1301
      #26 0x000055fbeb22db5b in pfs_spawn_thread (arg=0x55fbedbb36b0) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #27 0x00007f815fc254a4 in start_thread (arg=0x7f8158083700) at pthread_create.c:456
      #28 0x00007f815e16dd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      10.3 e8dd18a4, with NO_ZERO_IN_DATE

      mysqld: /data/src/10.3/sql/field.cc:5627: int Field_temporal_with_date::store_TIME_with_warning(MYSQL_TIME*, const ErrConv*, int, int): Assertion `is_stat_field || !table || (!table->write_set || bitmap_is_set(table->write_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength))) || (table->vcol_set && bitmap_is_set(table->vcol_set, field_index))' failed.
      190507 17:47:15 [ERROR] mysqld got signal 6 ;
       
      #6  0x00007f4b05da0e67 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x563389157fa8 "is_stat_field || !table || (!table->write_set || bitmap_is_set(table->write_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength))) || (table->vcol_set && bi"..., file=file@entry=0x563389157c70 "/data/src/10.3/sql/field.cc", line=line@entry=5627, function=function@entry=0x56338915b020 <Field_temporal_with_date::store_TIME_with_warning(st_mysql_time*, ErrConv const*, int, int)::__PRETTY_FUNCTION__> "int Field_temporal_with_date::store_TIME_with_warning(MYSQL_TIME*, const ErrConv*, int, int)") at assert.c:92
      #7  0x00007f4b05da0f12 in __GI___assert_fail (assertion=0x563389157fa8 "is_stat_field || !table || (!table->write_set || bitmap_is_set(table->write_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength))) || (table->vcol_set && bi"..., file=0x563389157c70 "/data/src/10.3/sql/field.cc", line=5627, function=0x56338915b020 <Field_temporal_with_date::store_TIME_with_warning(st_mysql_time*, ErrConv const*, int, int)::__PRETTY_FUNCTION__> "int Field_temporal_with_date::store_TIME_with_warning(MYSQL_TIME*, const ErrConv*, int, int)") at assert.c:101
      #8  0x000056338875b09c in Field_temporal_with_date::store_TIME_with_warning (this=0x7f4ab4033360, ltime=0x7f4afb1064d0, str=0x7f4afb106500, was_cut=0, have_smth_to_conv=1) at /data/src/10.3/sql/field.cc:5627
      #9  0x000056338875b6b5 in Field_temporal_with_date::store_time_dec (this=0x7f4ab4033360, ltime=0x7f4afb106750, dec=0) at /data/src/10.3/sql/field.cc:5719
      #10 0x000056338877b9a9 in Field::do_field_temporal (copy=0x7f4ab403c3a0) at /data/src/10.3/sql/field_conv.cc:435
      #11 0x000056338877af76 in do_copy_null (copy=0x7f4ab403c3a0) at /data/src/10.3/sql/field_conv.cc:246
      #12 0x000056338858e6f0 in multi_update::do_updates (this=0x7f4ab4018660) at /data/src/10.3/sql/sql_update.cc:2677
      #13 0x000056338858ef02 in multi_update::send_eof (this=0x7f4ab4018660) at /data/src/10.3/sql/sql_update.cc:2818
      #14 0x00005633885020ea in do_select (join=0x7f4ab403b508, procedure=0x0) at /data/src/10.3/sql/sql_select.cc:18992
      #15 0x00005633884daf37 in JOIN::exec_inner (this=0x7f4ab403b508) at /data/src/10.3/sql/sql_select.cc:4041
      #16 0x00005633884da37a in JOIN::exec (this=0x7f4ab403b508) at /data/src/10.3/sql/sql_select.cc:3835
      #17 0x00005633884db61b in mysql_select (thd=0x7f4ab4000b00, tables=0x7f4ab4012918, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x7f4ab4013280, group=0x0, having=0x0, proc_param=0x0, select_options=1342177408, result=0x7f4ab4018660, unit=0x7f4ab40049c8, select_lex=0x7f4ab4005138) at /data/src/10.3/sql/sql_select.cc:4240
      #18 0x000056338858b448 in mysql_multi_update (thd=0x7f4ab4000b00, table_list=0x7f4ab4012918, fields=0x7f4ab4005260, values=0x7f4ab4005768, conds=0x0, options=0, handle_duplicates=DUP_ERROR, ignore=false, unit=0x7f4ab40049c8, select_lex=0x7f4ab4005138, result=0x7f4afb106fd0) at /data/src/10.3/sql/sql_update.cc:1769
      #19 0x0000563388490de0 in mysql_execute_command (thd=0x7f4ab4000b00) at /data/src/10.3/sql/sql_parse.cc:4643
      #20 0x000056338849c14e in mysql_parse (thd=0x7f4ab4000b00, rawbuf=0x7f4ab4012808 "UPDATE v SET a = '2000-01-01' ORDER BY b LIMIT 1", length=48, parser_state=0x7f4afb1075f0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:8091
      #21 0x000056338848919e in dispatch_command (command=COM_QUERY, thd=0x7f4ab4000b00, packet=0x7f4ab415fe81 "UPDATE v SET a = '2000-01-01' ORDER BY b LIMIT 1", packet_length=48, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1858
      #22 0x0000563388487bc3 in do_command (thd=0x7f4ab4000b00) at /data/src/10.3/sql/sql_parse.cc:1403
      #23 0x00005633885ef965 in do_handle_one_connection (connect=0x56338b88cf50) at /data/src/10.3/sql/sql_connect.cc:1402
      #24 0x00005633885ef6dc in handle_one_connection (arg=0x56338b88cf50) at /data/src/10.3/sql/sql_connect.cc:1308
      #25 0x0000563388ec42c2 in pfs_spawn_thread (arg=0x56338b7d06f0) at /data/src/10.3/storage/perfschema/pfs.cc:1862
      #26 0x00007f4b079154a4 in start_thread (arg=0x7f4afb108700) at pthread_create.c:456
      #27 0x00007f4b05e5dd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Test case 2, without NO_ZERO_IN_DATE

      --source include/have_innodb.inc
       
      CREATE TABLE t1 ( 
          pk INT,
          a DATE,
          b INT,
          PRIMARY KEY(pk),
          INDEX(b)
      ) ENGINE=InnoDB WITH SYSTEM VERSIONING;
      INSERT INTO t1 (pk) VALUES (1),(2);
       
      CREATE TABLE t2 (c INT);
      INSERT IGNORE INTO t2 VALUES (3),(4);
       
      CREATE VIEW v AS SELECT * FROM t1 JOIN t2;
       
      UPDATE t1 SET a = '2012-12-12' ORDER BY b LIMIT 1;
       
      UPDATE v SET a = '2000-01-01' ORDER BY b LIMIT 1;
       
      # Cleanup
      DROP VIEW v;
      DROP TABLE t1, t2;
      

      10.3 e8dd18a4, without NO_ZERO_IN_DATE

      mysqld: /data/src/10.3/sql/handler.cc:6300: int handler::ha_reset(): Assertion `bitmap_is_set_all(&table->s->all_set)' failed.
      190507 17:49:48 [ERROR] mysqld got signal 6 ;
       
      #6  0x00007f122d281e67 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x5598d0960090 "bitmap_is_set_all(&table->s->all_set)", file=file@entry=0x5598d095e3a8 "/data/src/10.3/sql/handler.cc", line=line@entry=6300, function=function@entry=0x5598d0961e50 <handler::ha_reset()::__PRETTY_FUNCTION__> "int handler::ha_reset()") at assert.c:92
      #7  0x00007f122d281f12 in __GI___assert_fail (assertion=0x5598d0960090 "bitmap_is_set_all(&table->s->all_set)", file=0x5598d095e3a8 "/data/src/10.3/sql/handler.cc", line=6300, function=0x5598d0961e50 <handler::ha_reset()::__PRETTY_FUNCTION__> "int handler::ha_reset()") at assert.c:101
      #8  0x00005598cff938ff in handler::ha_reset (this=0x7f11dc0a70a8) at /data/src/10.3/sql/handler.cc:6300
      #9  0x00005598cfbfa101 in close_thread_table (thd=0x7f11dc000b00, table_ptr=0x7f11dc000be0) at /data/src/10.3/sql/sql_base.cc:903
      #10 0x00005598cfbf9e04 in close_thread_tables (thd=0x7f11dc000b00) at /data/src/10.3/sql/sql_base.cc:854
      #11 0x00005598cfc95460 in mysql_execute_command (thd=0x7f11dc000b00) at /data/src/10.3/sql/sql_parse.cc:6369
      #12 0x00005598cfc9a14e in mysql_parse (thd=0x7f11dc000b00, rawbuf=0x7f11dc012808 "UPDATE v SET a = '2000-01-01' ORDER BY b LIMIT 1", length=48, parser_state=0x7f12225f85f0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:8091
      #13 0x00005598cfc8719e in dispatch_command (command=COM_QUERY, thd=0x7f11dc000b00, packet=0x7f11dc15fe81 "UPDATE v SET a = '2000-01-01' ORDER BY b LIMIT 1", packet_length=48, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1858
      #14 0x00005598cfc85bc3 in do_command (thd=0x7f11dc000b00) at /data/src/10.3/sql/sql_parse.cc:1403
      #15 0x00005598cfded965 in do_handle_one_connection (connect=0x5598d2289f50) at /data/src/10.3/sql/sql_connect.cc:1402
      #16 0x00005598cfded6dc in handle_one_connection (arg=0x5598d2289f50) at /data/src/10.3/sql/sql_connect.cc:1308
      #17 0x00005598d06c22c2 in pfs_spawn_thread (arg=0x5598d21cd6f0) at /data/src/10.3/storage/perfschema/pfs.cc:1862
      #18 0x00007f122edf64a4 in start_thread (arg=0x7f12225f9700) at pthread_create.c:456
      #19 0x00007f122d33ed0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Non-debug build doesn't crash, but produces a warning, I'm not sure whether it is expected:

      UPDATE v SET a = '2000-01-01' ORDER BY b LIMIT 1;
      Warnings:
      Note	1355	View being updated does not have complete key of underlying table in it
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                serg Sergei Golubchik
                Reporter:
                elenst Elena Stepanova
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: