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

Failing assertion: !cursor->index->is_committed() upon update on table with HASH index

    XMLWordPrintable

    Details

      Description

      There are other infamous bugs for this assertion failure, this one probably doesn't explain any of them, unless somebody can come up with a scenario when an InnoDB table in pre-MDEV-371 versions would use a HASH key. Still, I'll link the other bugs for this assertion failure to it, so that it's easier to see all the alternatives when we ask users about specifics of their data.

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (
        a INT NOT NULL AUTO_INCREMENT,
        b char(8) NOT NULL DEFAULT '',
        UNIQUE KEY (b),
        UNIQUE KEY (a) USING HASH
      ) ENGINE=InnoDB;
       
      INSERT INTO t1 (b) VALUES ('');
      UPDATE t1 SET a = 0;
       
      # Cleanup
      DROP TABLE t1;
      

      10.4 non-debug 6da14d7b

      2020-05-31 14:49:03 9 [ERROR] InnoDB: Record in index `a` of table `test`.`t1` was not found on update: TUPLE (info_bits=0, 2 fields): {[8]        (0x00000104000002D0),[8]        (0x2020202020202020)} at: COMPACT RECORD(info_bits=0, 2 fields): {[8]        (0x00000104000002C4),[8]        (0x2020202020202020)}
      2020-05-31 14:49:03 0x7fb7a5468700  InnoDB: Assertion failure in file /data/src/10.4/storage/innobase/row/row0ins.cc line 218
      InnoDB: Failing assertion: !cursor->index->is_committed()
       
      #6  0x000055698a2428f2 in ut_dbg_assertion_failed (expr=expr@entry=0x55698ad8cd28 "!cursor->index->is_committed()", file=file@entry=0x55698ad8c840 "/data/src/10.4/storage/innobase/row/row0ins.cc", line=line@entry=218) at /data/src/10.4/storage/innobase/ut/ut0dbg.cc:60
      #7  0x000055698a79c4f1 in row_ins_sec_index_entry_by_modify (mtr=0x7fb7a5463eb0, thr=0x7fb758045d98, entry=0x7fb758047bc8, heap=0x7fb758048440, offsets_heap=<optimized out>, offsets=0x7fb7a5462fc8, cursor=0x7fb7a54630a0, mode=2, flags=0) at /data/src/10.4/storage/innobase/row/row0ins.cc:218
      #8  row_ins_sec_index_entry_low (flags=flags@entry=0, mode=mode@entry=2, index=index@entry=0x7fb758084748, offsets_heap=<optimized out>, offsets_heap@entry=0x7fb758047fd0, heap=heap@entry=0x7fb758048440, entry=entry@entry=0x7fb758047bc8, trx_id=0, thr=0x7fb758045d98) at /data/src/10.4/storage/innobase/row/row0ins.cc:3056
      #9  0x000055698a79c9de in row_ins_sec_index_entry (index=index@entry=0x7fb758084748, entry=0x7fb758047bc8, thr=thr@entry=0x7fb758045d98, check_foreign=<optimized out>) at /data/src/10.4/storage/innobase/row/row0ins.cc:3271
      #10 0x000055698a7d3417 in row_upd_sec_index_entry (node=node@entry=0x7fb7580c8a50, thr=thr@entry=0x7fb758045d98) at /data/src/10.4/storage/innobase/row/row0upd.cc:2520
      #11 0x000055698a7d8acd in row_upd_sec_step (thr=0x7fb758045d98, node=0x7fb7580c8a50) at /data/src/10.4/storage/innobase/row/row0upd.cc:2547
      #12 row_upd (thr=0x7fb758045d98, node=0x7fb7580c8a50) at /data/src/10.4/storage/innobase/row/row0upd.cc:3327
      #13 row_upd_step (thr=thr@entry=0x7fb758045d98) at /data/src/10.4/storage/innobase/row/row0upd.cc:3442
      #14 0x000055698a7aef34 in row_update_for_mysql (prebuilt=0x7fb7580c7f88) at /data/src/10.4/storage/innobase/row/row0mysql.cc:1889
      #15 0x000055698a6ed4ff in ha_innobase::update_row (this=0x7fb7580c77b0, old_row=0x7fb7580815e0 "\377\001", new_row=0x7fb7580815c8 "\377") at /data/src/10.4/storage/innobase/handler/ha_innodb.cc:8816
      #16 0x000055698a547b85 in handler::ha_update_row (this=0x7fb7580c77b0, old_data=0x7fb7580815e0 "\377\001", new_data=0x7fb7580815c8 "\377") at /data/src/10.4/sql/handler.cc:6764
      #17 0x000055698a3d4949 in mysql_update (thd=thd@entry=0x7fb7580009a8, table_list=<optimized out>, fields=..., values=..., conds=<optimized out>, order_num=<optimized out>, order=<optimized out>, limit=18446744073709551615, ignore=false, found_return=0x7fb7a5465880, updated_return=0x7fb7a5465940) at /data/src/10.4/sql/sql_update.cc:1056
      #18 0x000055698a32c535 in mysql_execute_command (thd=thd@entry=0x7fb7580009a8) at /data/src/10.4/sql/sql_parse.cc:4376
      #19 0x000055698a3311ca in mysql_parse (thd=thd@entry=0x7fb7580009a8, rawbuf=<optimized out>, length=19, parser_state=parser_state@entry=0x7fb7a5467580, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.4/sql/sql_parse.cc:7901
      #20 0x000055698a333474 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7fb7580009a8, packet=packet@entry=0x7fb758007a19 "UPDATE t1 SET a = 0", packet_length=packet_length@entry=19, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.4/sql/sql_parse.cc:1842
      #21 0x000055698a334cd6 in do_command (thd=0x7fb7580009a8) at /data/src/10.4/sql/sql_parse.cc:1360
      #22 0x000055698a4128a2 in do_handle_one_connection (connect=connect@entry=0x55698ca8c308) at /data/src/10.4/sql/sql_connect.cc:1412
      #23 0x000055698a41295d in handle_one_connection (arg=arg@entry=0x55698ca8c308) at /data/src/10.4/sql/sql_connect.cc:1316
      #24 0x000055698aa54261 in pfs_spawn_thread (arg=0x55698c793388) at /data/src/10.4/storage/perfschema/pfs.cc:1869
      #25 0x00007fb7ad3164a4 in start_thread (arg=0x7fb7a5468700) at pthread_create.c:456
      #26 0x00007fb7ac394d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      10.4 debug 6da14d7b

      2020-05-31 14:50:32 9 [ERROR] InnoDB: Record in index `a` of table `test`.`t1` was not found on update: TUPLE (info_bits=0, 2 fields): {[8]        (0x00000104000002D0),[8]        (0x2020202020202020)} at: COMPACT RECORD(info_bits=0, 2 fields): {[8]        (0x00000104000002C4),[8]        (0x2020202020202020)}
      mysqld: /data/src/10.4/storage/innobase/row/row0upd.cc:2423: dberr_t row_upd_sec_index_entry(upd_node_t*, que_thr_t*): Assertion `btr_validate_index(index, 0)' failed.
      200531 14:50:32 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fe555394f12 in __GI___assert_fail (assertion=0x55cb6b7b38cd "btr_validate_index(index, 0)", file=0x55cb6b7b3130 "/data/src/10.4/storage/innobase/row/row0upd.cc", line=2423, function=0x55cb6b7b5fa0 <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  0x000055cb6afb6b3a in row_upd_sec_index_entry (node=0x7fe504146d08, thr=0x7fe504069090) at /data/src/10.4/storage/innobase/row/row0upd.cc:2423
      #9  0x000055cb6afb74e2 in row_upd_sec_step (node=0x7fe504146d08, thr=0x7fe504069090) at /data/src/10.4/storage/innobase/row/row0upd.cc:2547
      #10 0x000055cb6afba4e0 in row_upd (node=0x7fe504146d08, thr=0x7fe504069090) at /data/src/10.4/storage/innobase/row/row0upd.cc:3327
      #11 0x000055cb6afba926 in row_upd_step (thr=0x7fe504069090) at /data/src/10.4/storage/innobase/row/row0upd.cc:3442
      #12 0x000055cb6af5857f in row_update_for_mysql (prebuilt=0x7fe504146200) at /data/src/10.4/storage/innobase/row/row0mysql.cc:1889
      #13 0x000055cb6adb0f76 in ha_innobase::update_row (this=0x7fe50400b868, old_row=0x7fe50400b428 "\377\001", new_row=0x7fe50400b410 "\377") at /data/src/10.4/storage/innobase/handler/ha_innodb.cc:8816
      #14 0x000055cb6ab729a6 in handler::ha_update_row (this=0x7fe50400b868, old_data=0x7fe50400b428 "\377\001", new_data=0x7fe50400b410 "\377") at /data/src/10.4/sql/handler.cc:6764
      #15 0x000055cb6a91a60b in mysql_update (thd=0x7fe504000af0, table_list=0x7fe504013270, fields=..., values=..., conds=0x0, order_num=0, order=0x0, limit=18446744073709551615, ignore=false, found_return=0x7fe54a6fde40, updated_return=0x7fe54a6fdf00) at /data/src/10.4/sql/sql_update.cc:1056
      #16 0x000055cb6a80b94f in mysql_execute_command (thd=0x7fe504000af0) at /data/src/10.4/sql/sql_parse.cc:4376
      #17 0x000055cb6a8179cf in mysql_parse (thd=0x7fe504000af0, rawbuf=0x7fe504013198 "UPDATE t1 SET a = 0", length=19, parser_state=0x7fe54a6fe570, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7901
      #18 0x000055cb6a803f59 in dispatch_command (command=COM_QUERY, thd=0x7fe504000af0, packet=0x7fe504156e41 "UPDATE t1 SET a = 0", packet_length=19, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
      #19 0x000055cb6a8026fb in do_command (thd=0x7fe504000af0) at /data/src/10.4/sql/sql_parse.cc:1360
      #20 0x000055cb6a98a78a in do_handle_one_connection (connect=0x55cb6dc9c5c0) at /data/src/10.4/sql/sql_connect.cc:1412
      #21 0x000055cb6a98a4d9 in handle_one_connection (arg=0x55cb6dc9c5c0) at /data/src/10.4/sql/sql_connect.cc:1316
      #22 0x000055cb6b387fe3 in pfs_spawn_thread (arg=0x55cb6dc1a570) at /data/src/10.4/storage/perfschema/pfs.cc:1869
      #23 0x00007fe55731d4a4 in start_thread (arg=0x7fe54a6ff700) at pthread_create.c:456
      #24 0x00007fe555451d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Reproducible on 10.4, 10.5.
      Not reproducible on 10.3, because until MDEV-371 USING HASH was apparently ignored. Starting from MDEV-371, it makes a difference. It wasn't this assertion failure after the first push of MDEV-371, but SIGSEGV in row_sel_store_mysql_rec. I didn't bisect to find out when it mutated into the assertion failure, as it seems unimportant.

      Slight tweaks in the table structure or DML can make the assertion failure go away and leave only the error "Record in index ... was not found".

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sachin.setiya.007 Sachin Setiya
              Reporter:
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: