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

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 in Field_xxx upon DML on tables with virtual columns

    Details

      Description

      IMPORTANT: Some of the test cases below fail on all of 10.2-10.4, and some only on 10.4. Please pay attention to the inline notes before declaring something as "not reproducible", and make sure all variations are fixed before closing the issue.

      Test case 1, only fails on 10.4

      CREATE TABLE t1 (d DATETIME(3), v DATETIME(2) AS (d));
      CREATE VIEW v1 AS SELECT * FROM t1;
       
      INSERT INTO t1 (d) VALUES ('2004-04-19 15:37:39.123'),('1985-12-24 10:15:08.456') ;
      DELETE FROM v1 ORDER BY v LIMIT 4;
       
      # Cleanup
      DROP VIEW v1;
      DROP TABLE t1;
      

      10.4 30da40bb8c3

      mysqld: /data/src/10.4/sql/field.cc:6889: virtual bool Field_datetimef::get_TIME(MYSQL_TIME*, const uchar*, date_mode_t) const: 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.
      190108 14:10:23 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fc39319cee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x0000557ec9ec85ed in Field_datetimef::get_TIME (this=0x7fc37c124110, ltime=0x7fc38d32d1b0, pos=0x7fc37c1376ae "\231r&\371g", fuzzydate=...) at /data/src/10.4/sql/field.cc:6889
      #9  0x0000557ec9ede076 in Field_datetimef::get_date (this=0x7fc37c124110, ltime=0x7fc38d32d1b0, fuzzydate=...) at /data/src/10.4/sql/field.h:3410
      #10 0x0000557ec9edcd1c in Field_temporal::save_in_field (this=0x7fc37c124110, to=0x7fc37c13a0e8) at /data/src/10.4/sql/field.h:2664
      #11 0x0000557ec9ed9c0e in Field::store_field (this=0x7fc37c13a0e8, from=0x7fc37c124110) at /data/src/10.4/sql/field.h:770
      #12 0x0000557ec9ee3816 in field_conv_incompatible (to=0x7fc37c13a0e8, from=0x7fc37c124110) at /data/src/10.4/sql/field_conv.cc:851
      #13 0x0000557ec9ee3872 in field_conv (to=0x7fc37c13a0e8, from=0x7fc37c124110) at /data/src/10.4/sql/field_conv.cc:864
      #14 0x0000557ec9f174e3 in save_field_in_field (from=0x7fc37c124110, null_value=0x7fc37c16fbbe, to=0x7fc37c13a0e8, no_conversions=false) at /data/src/10.4/sql/item.cc:6352
      #15 0x0000557ec9f17724 in Item_field::save_in_field (this=0x7fc37c16fb48, to=0x7fc37c13a0e8, no_conversions=false) at /data/src/10.4/sql/item.cc:6403
      #16 0x0000557ec9cff23c in TABLE::update_virtual_fields (this=0x7fc37c123340, h=0x7fc37c136f18, update_mode=VCOL_UPDATE_FOR_DELETE) at /data/src/10.4/sql/table.cc:7798
      #17 0x0000557eca09891f in record_should_be_deleted (thd=0x7fc37c000b00, table=0x7fc37c123340, sel=0x0, explain=0x7fc37c07f278, truncate_history=false) at /data/src/10.4/sql/sql_delete.cc:239
      #18 0x0000557eca09a620 in mysql_delete (thd=0x7fc37c000b00, table_list=0x7fc37c0152f8, conds=0x7fc37c015bb0, order_list=0x7fc37c0053a8, limit=4, options=0, result=0x0) at /data/src/10.4/sql/sql_delete.cc:736
      #19 0x0000557ec9be02a6 in mysql_execute_command (thd=0x7fc37c000b00) at /data/src/10.4/sql/sql_parse.cc:4928
      #20 0x0000557ec9bea2c4 in mysql_parse (thd=0x7fc37c000b00, rawbuf=0x7fc37c014f98 "DELETE LOW_PRIORITY IGNORE FROM `view_t8` WHERE `col_timestamp` BETWEEN 1 AND 7 ORDER BY `col_bit`,`col_blob`,`col_char`,`col_date`,`col_enum`,`col_int`,`col_time`,`col_timestamp`,`col_varchar`,`col_y"..., length=330, parser_state=0x7fc38d32e600, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8104
      #21 0x0000557ec9bd74ee in dispatch_command (command=COM_QUERY, thd=0x7fc37c000b00, packet=0x7fc37c00b421 "DELETE LOW_PRIORITY IGNORE FROM `view_t8` WHERE `col_timestamp` BETWEEN 1 AND 7 ORDER BY `col_bit`,`col_blob`,`col_char`,`col_date`,`col_enum`,`col_int`,`col_time`,`col_timestamp`,`col_varchar`,`col_y"..., packet_length=331, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1851
      #22 0x0000557ec9bd5f12 in do_command (thd=0x7fc37c000b00) at /data/src/10.4/sql/sql_parse.cc:1396
      #23 0x0000557ec9d42140 in do_handle_one_connection (connect=0x557ecde7c320) at /data/src/10.4/sql/sql_connect.cc:1402
      #24 0x0000557ec9d41ec4 in handle_one_connection (arg=0x557ecde7c320) at /data/src/10.4/sql/sql_connect.cc:1308
      #25 0x0000557eca201308 in pfs_spawn_thread (arg=0x557ecdd8d140) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #26 0x00007fc394c58494 in start_thread (arg=0x7fc38d32f700) at pthread_create.c:333
      #27 0x00007fc39325993f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Reproducible with at least MyISAM and InnoDB.
      Not reproducible on 10.3.
      No visible effect on a non-debug build.

      Test case 2, from MDEV-18167, only fails on 10.4

      CREATE TABLE t1 ( 
        id INT NOT NULL AUTO_INCREMENT,
        f ENUM('a','b','c'),
        v ENUM('a','b','c') AS (f),
        KEY(v,id)
      ) ENGINE=MyISAM;
      INSERT INTO t1 (f) VALUES ('a'),('b');
      INSERT IGNORE INTO t1 SELECT * FROM t1;
       
      # Cleanup
      DROP TABLE t1;
      

      10.4 30da40bb8c

      mysqld: /data/src/10.4/sql/field.cc:9118: virtual longlong Field_enum::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.
      190108 15:32:35 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f37f7c0eee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x000055fa5f90e33c in Field_enum::val_int (this=0x7f37e000aab0) at /data/src/10.4/sql/field.cc:9118
      #9  0x000055fa5f91bf77 in Field_enum::store_field (this=0x7f37e000aba8, from=0x7f37e000aab0) at /data/src/10.4/sql/field.h:4146
      #10 0x000055fa5f920816 in field_conv_incompatible (to=0x7f37e000aba8, from=0x7f37e000aab0) at /data/src/10.4/sql/field_conv.cc:851
      #11 0x000055fa5f920872 in field_conv (to=0x7f37e000aba8, from=0x7f37e000aab0) at /data/src/10.4/sql/field_conv.cc:864
      #12 0x000055fa5f9544e3 in save_field_in_field (from=0x7f37e000aab0, null_value=0x7f37e0123ff6, to=0x7f37e000aba8, no_conversions=false) at /data/src/10.4/sql/item.cc:6352
      #13 0x000055fa5f954724 in Item_field::save_in_field (this=0x7f37e0123f80, to=0x7f37e000aba8, no_conversions=false) at /data/src/10.4/sql/item.cc:6403
      #14 0x000055fa5f73c23c in TABLE::update_virtual_fields (this=0x7f37e0122ac0, h=0x7f37e01236f8, update_mode=VCOL_UPDATE_FOR_WRITE) at /data/src/10.4/sql/table.cc:7798
      #15 0x000055fa5f5913ce in fill_record (thd=0x7f37e0000b00, table_arg=0x7f37e0122ac0, fields=..., values=..., ignore_errors=false, update=false) at /data/src/10.4/sql/sql_base.cc:8431
      #16 0x000055fa5f59188a in fill_record_n_invoke_before_triggers (thd=0x7f37e0000b00, table=0x7f37e0122ac0, fields=..., values=..., ignore_errors=false, event=TRG_EVENT_INSERT) at /data/src/10.4/sql/sql_base.cc:8562
      #17 0x000055fa5f5d5b4f in mysql_insert (thd=0x7f37e0000b00, table_list=0x7f37e0015090, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false) at /data/src/10.4/sql/sql_insert.cc:960
      #18 0x000055fa5f61c639 in mysql_execute_command (thd=0x7f37e0000b00) at /data/src/10.4/sql/sql_parse.cc:4730
      #19 0x000055fa5f6272c4 in mysql_parse (thd=0x7f37e0000b00, rawbuf=0x7f37e0014f98 "INSERT INTO t1 (f) VALUES ('a'),('b')", length=37, parser_state=0x7f37f1da0600, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8104
      #20 0x000055fa5f6144ee in dispatch_command (command=COM_QUERY, thd=0x7f37e0000b00, packet=0x7f37e000b421 "INSERT INTO t1 (f) VALUES ('a'),('b')", packet_length=37, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1851
      #21 0x000055fa5f612f12 in do_command (thd=0x7f37e0000b00) at /data/src/10.4/sql/sql_parse.cc:1396
      #22 0x000055fa5f77f140 in do_handle_one_connection (connect=0x55fa622bd320) at /data/src/10.4/sql/sql_connect.cc:1402
      #23 0x000055fa5f77eec4 in handle_one_connection (arg=0x55fa622bd320) at /data/src/10.4/sql/sql_connect.cc:1308
      #24 0x000055fa5fc3e308 in pfs_spawn_thread (arg=0x55fa621ce140) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #25 0x00007f37f96ca494 in start_thread (arg=0x7f37f1da1700) at pthread_create.c:333
      #26 0x00007f37f7ccb93f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Not reproducible with InnoDB (the test case is not applicable due to the order of columns in the key).
      Not reproducible on 10.3.
      No visible effect on a non-debug build.

      Test case 3, fails on all of 10.2-10.4

      --source include/have_partition.inc
       
      CREATE TABLE t1 ( 
          a INT,
          b INT,
          c BIT(4) NOT NULL DEFAULT b'0',
          pk INTEGER AUTO_INCREMENT,
          d BIT(4) AS (c) VIRTUAL,
          PRIMARY KEY(pk),
          KEY (b,d)
      ) PARTITION BY HASH(pk);
      INSERT INTO t1 () VALUES (),();
      UPDATE t1 SET a = 0 WHERE b IS NULL ORDER BY pk;
       
      # Cleanup
      DROP TABLE t1;
      

      10.2 b8b74e14

      mysqld: /data/src/10.2/sql/field.cc:9532: virtual longlong Field_bit::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.
      190530  3:55:17 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fc44db56f12 in __GI___assert_fail (assertion=0x55a3e60f7e78 "!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))", file=0x55a3e60f7c18 "/data/src/10.2/sql/field.cc", line=9532, function=0x55a3e60fc3e0 <Field_bit::val_int()::__PRETTY_FUNCTION__> "virtual longlong Field_bit::val_int()") at assert.c:101
      #8  0x000055a3e580fe0c in Field_bit::val_int (this=0x7fc42c0312a0) at /data/src/10.2/sql/field.cc:9532
      #9  0x000055a3e5818bea in Field_bit::save_in_field (this=0x7fc42c0312a0, to=0x7fc42c091d88) at /data/src/10.2/sql/field.h:3746
      #10 0x000055a3e562f89a in Field::store_field (this=0x7fc42c091d88, from=0x7fc42c0312a0) at /data/src/10.2/sql/field.h:829
      #11 0x000055a3e581ca31 in field_conv_incompatible (to=0x7fc42c091d88, from=0x7fc42c0312a0) at /data/src/10.2/sql/field_conv.cc:831
      #12 0x000055a3e581ca8d in field_conv (to=0x7fc42c091d88, from=0x7fc42c0312a0) at /data/src/10.2/sql/field_conv.cc:842
      #13 0x000055a3e5849f12 in save_field_in_field (from=0x7fc42c0312a0, null_value=0x7fc42c06b85a, to=0x7fc42c091d88, no_conversions=false) at /data/src/10.2/sql/item.cc:6274
      #14 0x000055a3e584a11a in Item_field::save_in_field (this=0x7fc42c06b7e8, to=0x7fc42c091d88, no_conversions=false) at /data/src/10.2/sql/item.cc:6320
      #15 0x000055a3e56baff6 in TABLE::update_virtual_fields (this=0x7fc42c069e50, h=0x7fc42c06aa58, update_mode=VCOL_UPDATE_FOR_READ) at /data/src/10.2/sql/table.cc:7642
      #16 0x000055a3e582b0d4 in handler::ha_index_read_map (this=0x7fc42c06aa58, buf=0x7fc42c0310b0 "\a\360", key=0x7fc42c081258 "\001", keypart_map=1, find_flag=HA_READ_KEY_EXACT) at /data/src/10.2/sql/handler.cc:2684
      #17 0x000055a3e5831c00 in handler::read_range_first (this=0x7fc42c06aa58, start_key=0x7fc42c00c6e0, end_key=0x7fc42c00c2c0, eq_range_arg=true, sorted=false) at /data/src/10.2/sql/handler.cc:5424
      #18 0x000055a3e5f461b6 in ha_partition::handle_unordered_scan_next_partition (this=0x7fc42c00c188, buf=0x7fc42c0310b0 "\a\360") at /data/src/10.2/sql/ha_partition.cc:6037
      #19 0x000055a3e5f451e4 in ha_partition::common_index_read (this=0x7fc42c00c188, buf=0x7fc42c0310b0 "\a\360", have_start_key=true) at /data/src/10.2/sql/ha_partition.cc:5519
      #20 0x000055a3e5f45a7c in ha_partition::read_range_first (this=0x7fc42c00c188, start_key=0x7fc42c00c270, end_key=0x7fc42c00c290, eq_range_arg=true, sorted=true) at /data/src/10.2/sql/ha_partition.cc:5810
      #21 0x000055a3e5742c50 in handler::multi_range_read_next (this=0x7fc42c00c188, range_info=0x7fc448689ac0) at /data/src/10.2/sql/multi_range_read.cc:298
      #22 0x000055a3e598280c in QUICK_RANGE_SELECT::get_next (this=0x7fc42c080ff0) at /data/src/10.2/sql/opt_range.cc:11452
      #23 0x000055a3e581f4a0 in find_all_keys (thd=0x7fc42c000b00, param=0x7fc448689d80, select=0x7fc42c013328, fs_info=0x7fc42c07ff90, buffpek_pointers=0x7fc448689f80, tempfile=0x7fc448689e10, pq=0x0, found_rows=0x7fc42c080170) at /data/src/10.2/sql/filesort.cc:781
      #24 0x000055a3e581db22 in filesort (thd=0x7fc42c000b00, table=0x7fc42c069e50, filesort=0x7fc44868a250, tracker=0x7fc42c013790, join=0x0, first_table_bit=0) at /data/src/10.2/sql/filesort.cc:274
      #25 0x000055a3e5697f7b in mysql_update (thd=0x7fc42c000b00, table_list=0x7fc42c012560, fields=..., values=..., conds=0x7fc42c012e50, order_num=1, order=0x7fc42c013018, limit=18446744073709551615, handle_duplicates=DUP_ERROR, ignore=false, found_return=0x7fc44868a870, updated_return=0x7fc44868a920) at /data/src/10.2/sql/sql_update.cc:562
      #26 0x000055a3e55abe78 in mysql_execute_command (thd=0x7fc42c000b00) at /data/src/10.2/sql/sql_parse.cc:4290
      #27 0x000055a3e55b7cba in mysql_parse (thd=0x7fc42c000b00, rawbuf=0x7fc42c012458 "UPDATE t1 SET a = 0 WHERE b IS NULL ORDER BY pk", length=47, parser_state=0x7fc44868b200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:8020
      #28 0x000055a3e55a550e in dispatch_command (command=COM_QUERY, thd=0x7fc42c000b00, packet=0x7fc42c08d531 "UPDATE t1 SET a = 0 WHERE b IS NULL ORDER BY pk", packet_length=47, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1833
      #29 0x000055a3e55a3e62 in do_command (thd=0x7fc42c000b00) at /data/src/10.2/sql/sql_parse.cc:1386
      #30 0x000055a3e56f6b38 in do_handle_one_connection (connect=0x55a3e7efc700) at /data/src/10.2/sql/sql_connect.cc:1335
      #31 0x000055a3e56f68b8 in handle_one_connection (arg=0x55a3e7efc700) at /data/src/10.2/sql/sql_connect.cc:1241
      #32 0x000055a3e5f23032 in pfs_spawn_thread (arg=0x55a3e7f1f9b0) at /data/src/10.2/storage/perfschema/pfs.cc:1862
      #33 0x00007fc44f6cb4a4 in start_thread (arg=0x7fc44868c700) at pthread_create.c:456
      #34 0x00007fc44dc13d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Not applicable to 10.1. Fails with at least MyISAM and InnoDB.
      No obvious problem on a non-debug build.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated: