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

Virtual fields are not recalculated on system fields value assignment

    XMLWordPrintable

    Details

      Description

      Corruption errors or Assertion `btr_validate_index(index, 0)' failed in row_upd_sec_index_entry upon DELETE HISTORY

      Note: We have a variety of btr_validate_index bugs, so it might be one of them. But I can't tell which one it would be a duplicate of, so I'm filing it separately just in case.

      --source include/have_innodb.inc
      CREATE TABLE t1 (
        a varchar(4096),
        UNIQUE KEY (a)
      ) ENGINE=InnoDB WITH SYSTEM VERSIONING;
       
      INSERT INTO t1 VALUES ('foo'),('bar');
      UPDATE IGNORE t1 SET a = 'qux';
      DELETE HISTORY FROM t1;
       
      # Cleanup
      DROP TABLE t1;
      

      10.4 debug b4417142

      mysqld: /data/src/10.4/storage/innobase/row/row0upd.cc:2425: dberr_t row_upd_sec_index_entry(upd_node_t*, que_thr_t*): Assertion `btr_validate_index(index, 0)' failed.
      190924 19:49:20 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f889f0d1f12 in __GI___assert_fail (assertion=0x55b3d858f1c5 "btr_validate_index(index, 0)", file=0x55b3d858ea28 "/data/src/10.4/storage/innobase/row/row0upd.cc", line=2425, function=0x55b3d8591920 <row_upd_sec_index_entry(upd_node_t*, que_thr_t*)::__PRETTY_FUNCTION__> "dberr_t row_upd_sec_index_entry(upd_node_t*, que_thr_t*)") at assert.c:101
      #8  0x000055b3d7db7fbb in row_upd_sec_index_entry (node=0x7f8844072b00, thr=0x7f8844072e68) at /data/src/10.4/storage/innobase/row/row0upd.cc:2425
      #9  0x000055b3d7db87b6 in row_upd_sec_step (node=0x7f8844072b00, thr=0x7f8844072e68) at /data/src/10.4/storage/innobase/row/row0upd.cc:2539
      #10 0x000055b3d7dbb721 in row_upd (node=0x7f8844072b00, thr=0x7f8844072e68) at /data/src/10.4/storage/innobase/row/row0upd.cc:3315
      #11 0x000055b3d7dbbb67 in row_upd_step (thr=0x7f8844072e68) at /data/src/10.4/storage/innobase/row/row0upd.cc:3430
      #12 0x000055b3d7d596a3 in row_update_for_mysql (prebuilt=0x7f884414e788) at /data/src/10.4/storage/innobase/row/row0mysql.cc:1889
      #13 0x000055b3d7bb8e96 in ha_innobase::delete_row (this=0x7f884414d338, record=0x7f88441385e8 "\374\003") at /data/src/10.4/storage/innobase/handler/ha_innodb.cc:8971
      #14 0x000055b3d797aff8 in handler::ha_delete_row (this=0x7f884414d338, buf=0x7f88441385e8 "\374\003") at /data/src/10.4/sql/handler.cc:6782
      #15 0x000055b3d7b352fb in TABLE::delete_row (this=0x7f884414c4d0) at /data/src/10.4/sql/sql_delete.cc:297
      #16 0x000055b3d7b321d4 in mysql_delete (thd=0x7f8844000b00, table_list=0x7f8844013200, conds=0x0, order_list=0x7f88440054b0, limit=18446744073709551615, options=0, result=0x0) at /data/src/10.4/sql/sql_delete.cc:834
      #17 0x000055b3d7610811 in mysql_execute_command (thd=0x7f8844000b00) at /data/src/10.4/sql/sql_parse.cc:4723
      #18 0x000055b3d761c04f in mysql_parse (thd=0x7f8844000b00, rawbuf=0x7f8844013128 "DELETE HISTORY FROM t1", length=22, parser_state=0x7f88984a2170, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7912
      #19 0x000055b3d76072e2 in dispatch_command (command=COM_QUERY, thd=0x7f8844000b00, packet=0x7f884419e1a1 "DELETE HISTORY FROM t1", packet_length=22, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1841
      #20 0x000055b3d760596f in do_command (thd=0x7f8844000b00) at /data/src/10.4/sql/sql_parse.cc:1359
      #21 0x000055b3d778cdef in do_handle_one_connection (connect=0x55b3daa64250) at /data/src/10.4/sql/sql_connect.cc:1412
      #22 0x000055b3d778cb3e in handle_one_connection (arg=0x55b3daa64250) at /data/src/10.4/sql/sql_connect.cc:1316
      #23 0x000055b3d818c2ed in pfs_spawn_thread (arg=0x55b3da9a7f00) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #24 0x00007f88a0c464a4 in start_thread (arg=0x7f88984a3700) at pthread_create.c:456
      #25 0x00007f889f18ed0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      10.4 non-debug b4417142

      2019-09-24 19:52:15 9 [ERROR] InnoDB: Record in index `a` of table `test`.`t1` was not found on update: TUPLE (info_bits=0, 2 fields): {[8]g  " [  (0x67F29822F85B939F),[6]      (0x000000000202)} at: COMPACT RECORD(info_bits=0, 2 fields): {[8])& Ex   (0x29269F4578D5ADD8),[6]      (0x000000000201)}
      

      Same test case, but with MyISAM:

      mysqltest: At line 9: query 'DELETE HISTORY FROM t1' failed: 126: Index for table './test/t1.MYI' is corrupt; try to repair it
      

      Error log

      2019-09-24 19:57:50 9 [ERROR] mysqld: Index for table './test/t1.MYI' is corrupt; try to repair it
      2019-09-24 19:57:50 9 [ERROR] mysqld: Index for table './test/t1.MYI' is corrupt; try to repair it
      2019-09-24 19:57:50 9 [ERROR] Got an error from thread_id=9, /data/src/10.4/storage/myisam/mi_delete.c:121
      2019-09-24 19:57:50 9 [ERROR] MySQL thread id 9, OS thread handle 140687717869312, query id 25 localhost root Updating
      DELETE HISTORY FROM t1
      2019-09-24 19:57:50 9 [ERROR] mysqld: Index for table 't1' is corrupt; try to repair it
      

      Also reproducible on 10.5 8887effe.
      The test case is not applicable to 10.3 due to the long index.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              midenok Aleksey Midenkov
              Reporter:
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: