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

Wrong result or Assertion on INSERT after DELETE HISTORY

    XMLWordPrintable

Details

    Description

      CREATE TABLE t1 (a INT CHECK (a > 0)) WITH SYSTEM VERSIONING;
      DELETE HISTORY FROM t1;
      INSERT INTO t1 VALUES (1);
       
      # Cleanup
      DROP TABLE t1;
      

      10.3 f6d0d309

      mysqld: /data/src/10.3/sql/field.cc:5545: virtual bool Field_timestampf::is_max(): 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.
      190726 16:13:02 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fa3bdabef12 in __GI___assert_fail (assertion=0x561680551af8 "!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))", file=0x5616805518f0 "/data/src/10.3/sql/field.cc", line=5545, function=0x561680554cc0 <Field_timestampf::is_max()::__PRETTY_FUNCTION__> "virtual bool Field_timestampf::is_max()") at assert.c:101
      #8  0x000056167fb4e8c8 in Field_timestampf::is_max (this=0x7fa39c006d18) at /data/src/10.3/sql/field.cc:5545
      #9  0x000056167f9988eb in TABLE::verify_constraints (this=0x7fa39c11ecf0, ignore_failure=false) at /data/src/10.3/sql/table.cc:5286
      #10 0x000056167f99880d in TABLE_LIST::view_check_option (this=0x7fa39c0128f8, thd=0x7fa39c000b00, ignore_failure=false) at /data/src/10.3/sql/table.cc:5269
      #11 0x000056167f83f65b in mysql_insert (thd=0x7fa39c000b00, table_list=0x7fa39c0128f8, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false) at /data/src/10.3/sql/sql_insert.cc:1048
      #12 0x000056167f88041a in mysql_execute_command (thd=0x7fa39c000b00) at /data/src/10.3/sql/sql_parse.cc:4450
      #13 0x000056167f88b3f0 in mysql_parse (thd=0x7fa39c000b00, rawbuf=0x7fa39c012818 "INSERT INTO t1 VALUES (1)", length=25, parser_state=0x7fa3b84be5f0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7829
      #14 0x000056167f878fee in dispatch_command (command=COM_QUERY, thd=0x7fa39c000b00, packet=0x7fa39c008c71 "INSERT INTO t1 VALUES (1)", packet_length=25, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1856
      #15 0x000056167f877a11 in do_command (thd=0x7fa39c000b00) at /data/src/10.3/sql/sql_parse.cc:1401
      #16 0x000056167f9e10a2 in do_handle_one_connection (connect=0x561682893ed0) at /data/src/10.3/sql/sql_connect.cc:1403
      #17 0x000056167f9e0e04 in handle_one_connection (arg=0x561682893ed0) at /data/src/10.3/sql/sql_connect.cc:1308
      #18 0x00005616802bc2a8 in pfs_spawn_thread (arg=0x5616828aee50) at /data/src/10.3/storage/perfschema/pfs.cc:1862
      #19 0x00007fa3bf6334a4 in start_thread (arg=0x7fa3b84bf700) at pthread_create.c:456
      #20 0x00007fa3bdb7bd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      The failure appeared in 10.3 main tree with this commit:

      commit f6d0d309fa4ffe1d5890c09447d947103143a68a
      Author: Aleksey Midenkov
      Date:   Tue Jul 23 13:27:57 2019 +0300
       
          MDEV-19814 Assertion `update->n_fields < ulint(table->n_cols + table->n_v_cols)' on DELETE HISTORY
          
          Turn off versioned_write for DELETE HISTORY.
      

      Non-debug build doesn't fail, but it produces a wrong result with an extra SELECT:

      CREATE TABLE t1 (a INT CHECK (a > 0)) WITH SYSTEM VERSIONING;
      DELETE HISTORY FROM t1;
      INSERT INTO t1 VALUES (1);
      SELECT * FROM t1;
      

      SELECT * FROM t1;
      a
      DROP TABLE t1;
      

      Attachments

        Issue Links

          Activity

            People

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