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

Assertion `!"secondary index is out of sync"' failed in dict_index_t::vers_history_row

    XMLWordPrintable

    Details

      Description

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (a INT, b INT AS (a*2) VIRTUAL, KEY(a)) ENGINE=InnoDB WITH SYSTEM VERSIONING;
      SET FOREIGN_KEY_CHECKS = OFF;
      INSERT IGNORE INTO t1 (a) VALUES (1),(2),(3),(4);
      ALTER TABLE t1 ADD FOREIGN KEY (b) REFERENCES t1 (a), ALGORITHM=COPY;
      UPDATE t1 SET a = NULL ORDER BY a LIMIT 2;
      DELETE FROM t1 ORDER BY a, b LIMIT 2;
      SET FOREIGN_KEY_CHECKS = ON;
      DELETE HISTORY FROM t1;
      DELETE FROM t1;
       
      # Cleanup
      DROP TABLE t1;
      

      10.3 ade89fc8

      mysqld: /data/src/10.3/storage/innobase/dict/dict0mem.cc:1504: bool dict_index_t::vers_history_row(const rec_t*, bool&): Assertion `!"secondary index is out of sync"' failed.
      200122 18:58:46 [ERROR] mysqld got signal 6 ;
       
      #6  0x00007fccad32de67 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x55fa615f39a0 "!\"secondary index is out of sync\"", file=file@entry=0x55fa615f2fb8 "/data/src/10.3/storage/innobase/dict/dict0mem.cc", line=line@entry=1504, function=function@entry=0x55fa615f4ea0 <dict_index_t::vers_history_row(unsigned char const*, bool&)::__PRETTY_FUNCTION__> "bool dict_index_t::vers_history_row(const rec_t*, bool&)") at assert.c:92
      #7  0x00007fccad32df12 in __GI___assert_fail (assertion=0x55fa615f39a0 "!\"secondary index is out of sync\"", file=0x55fa615f2fb8 "/data/src/10.3/storage/innobase/dict/dict0mem.cc", line=1504, function=0x55fa615f4ea0 <dict_index_t::vers_history_row(unsigned char const*, bool&)::__PRETTY_FUNCTION__> "bool dict_index_t::vers_history_row(const rec_t*, bool&)") at assert.c:101
      #8  0x000055fa60f8303f in dict_index_t::vers_history_row (this=0x7fcc5c094418, rec=0x7fcca2e9808e "\200", history_row=@0x7fcca269faea: false) at /data/src/10.3/storage/innobase/dict/dict0mem.cc:1504
      #9  0x000055fa60d6224a in row_ins_check_foreign_constraint (check_ref=0, foreign=0x7fcc5c0921b8, table=0x7fcc5c08fa78, entry=0x7fcc5c03f018, thr=0x7fcc5c074ba0) at /data/src/10.3/storage/innobase/row/row0ins.cc:1776
      #10 0x000055fa60df533c in row_upd_check_references_constraints (node=0x7fcc5c074838, pcur=0x7fcca26a0580, table=0x7fcc5c08fa78, index=0x7fcc5c093aa8, offsets=0x7fcc5c03ebf0, thr=0x7fcc5c074ba0, mtr=0x7fcca26a0c80) at /data/src/10.3/storage/innobase/row/row0upd.cc:295
      #11 0x000055fa60dfb434 in row_upd_sec_index_entry (node=0x7fcc5c074838, thr=0x7fcc5c074ba0) at /data/src/10.3/storage/innobase/row/row0upd.cc:2517
      #12 0x000055fa60dfb7a3 in row_upd_sec_step (node=0x7fcc5c074838, thr=0x7fcc5c074ba0) at /data/src/10.3/storage/innobase/row/row0upd.cc:2566
      #13 0x000055fa60dfe565 in row_upd (node=0x7fcc5c074838, thr=0x7fcc5c074ba0) at /data/src/10.3/storage/innobase/row/row0upd.cc:3336
      #14 0x000055fa60dfe9b2 in row_upd_step (thr=0x7fcc5c074ba0) at /data/src/10.3/storage/innobase/row/row0upd.cc:3451
      #15 0x000055fa60d8fbb7 in row_update_for_mysql (prebuilt=0x7fcc5c074018) at /data/src/10.3/storage/innobase/row/row0mysql.cc:1888
      #16 0x000055fa60bf8d2b in ha_innobase::update_row (this=0x7fcc5c0724e8, old_row=0x7fcc5c0720a8 "\371\004", new_row=0x7fcc5c072090 "\371\004") at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:8838
      #17 0x000055fa609d7cd8 in handler::ha_update_row (this=0x7fcc5c0724e8, old_data=0x7fcc5c0720a8 "\371\004", new_data=0x7fcc5c072090 "\371\004") at /data/src/10.3/sql/handler.cc:6479
      #18 0x000055fa60b7ec95 in TABLE::delete_row (this=0x7fcc5c0a4da0) at /data/src/10.3/sql/sql_delete.cc:249
      #19 0x000055fa60b7bd59 in mysql_delete (thd=0x7fcc5c000af0, table_list=0x7fcc5c0128e0, conds=0x7fcc5c013bc0, order_list=0x7fcc5c0053b8, limit=18446744073709551614, options=0, result=0x0) at /data/src/10.3/sql/sql_delete.cc:720
      #20 0x000055fa606b1066 in mysql_execute_command (thd=0x7fcc5c000af0) at /data/src/10.3/sql/sql_parse.cc:4658
      #21 0x000055fa606bbb91 in mysql_parse (thd=0x7fcc5c000af0, rawbuf=0x7fcc5c012818 "DELETE FROM t1", length=14, parser_state=0x7fcca26a25e0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7818
      #22 0x000055fa606a8705 in dispatch_command (command=COM_QUERY, thd=0x7fcc5c000af0, packet=0x7fcc5c165951 "DELETE FROM t1", packet_length=14, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1856
      #23 0x000055fa606a704d in do_command (thd=0x7fcc5c000af0) at /data/src/10.3/sql/sql_parse.cc:1401
      #24 0x000055fa6081e9bc in do_handle_one_connection (connect=0x55fa63546850) at /data/src/10.3/sql/sql_connect.cc:1403
      #25 0x000055fa6081e71e in handle_one_connection (arg=0x55fa63546850) at /data/src/10.3/sql/sql_connect.cc:1308
      #26 0x000055fa611cf6ee in pfs_spawn_thread (arg=0x55fa634eacb0) at /data/src/10.3/storage/perfschema/pfs.cc:1869
      #27 0x00007fccaf2b64a4 in start_thread (arg=0x7fcca26a3700) at pthread_create.c:456
      #28 0x00007fccad3ead0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Reproducible with 10.3-10.5.

      Non-debug version doesn't crash, but produces an error in the error log:

      10.3 ade89fc8 non-debug

      2020-01-22 19:00:01 9 [ERROR] InnoDB: foreign constraints: secondary index is out of sync
      

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated: