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

Unique hash index is broken on DML for system-versioned table

    XMLWordPrintable

Details

    Description

      Looks to be different from MDEV-33231/MDEV-29992 (no NOPAD being used here), and from MDEV-20610 (system versioning is required here)

      CREATE TABLE t (c INT, UNIQUE (c) USING HASH) WITH SYSTEM VERSIONING;
      INSERT INTO t VALUES (0);
      DELETE FROM t;
      DELETE HISTORY FROM t BEFORE SYSTEM_TIME '2031-01-01 23:13';
      

      When using InnoDB, leads to:

      11.4.0 9b1ea6904965dd345478dedd80e181ad54c767da (Debug)

      2024-02-16 13:39:26 4 [ERROR] InnoDB: Record in index `c` of table `test`.`t` was not found on update: TUPLE (info_bits=0, 2 fields): {[8]        (0x00000000D39986AA),[6]      (0x000000000001)} at: COMPACT RECORD(info_bits=0, 1 fields): {[8]infimum (0x696E66696D756D00)}
      mariadbd: /test/11.4_dbg/storage/innobase/row/row0upd.cc:1909: dberr_t row_upd_sec_index_entry(upd_node_t*, que_thr_t*): Assertion `0' failed.
      

      11.4.0 9b1ea6904965dd345478dedd80e181ad54c767da (Debug)

      Core was generated by `/test/MD060224-mariadb-11.4.0-linux-x86_64-dbg/bin/mariadbd --no-defaults --max'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=23132225209920)
          at ./nptl/pthread_kill.c:44
      [Current thread is 1 (LWP 3693356)]
      (gdb) bt
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=23132225209920) at ./nptl/pthread_kill.c:44
      #1  __pthread_kill_internal (signo=6, threadid=23132225209920) at ./nptl/pthread_kill.c:78
      #2  __GI___pthread_kill (threadid=23132225209920, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
      #3  0x00001509efe42476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
      #4  0x00001509efe287f3 in __GI_abort () at ./stdlib/abort.c:79
      #5  0x00001509efe2871b in __assert_fail_base (fmt=0x1509effdd130 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55f0ae05544a "0", file=0x55f0ae130f70 "/test/11.4_dbg/storage/innobase/row/row0upd.cc", line=1909, function=<optimized out>) at ./assert/assert.c:92
      #6  0x00001509efe39e96 in __GI___assert_fail (assertion=0x55f0ae05544a "0", file=0x55f0ae130f70 "/test/11.4_dbg/storage/innobase/row/row0upd.cc", line=1909, function=0x55f0ae131f20 "dberr_t row_upd_sec_index_entry(upd_node_t*, que_thr_t*)") at ./assert/assert.c:101
      #7  0x000055f0adaaec72 in row_upd_sec_index_entry (node=node@entry=0x1509ac02bc80, thr=thr@entry=0x1509ac070408) at /test/11.4_dbg/storage/innobase/row/row0upd.cc:1909
      #8  0x000055f0adab12e1 in row_upd_sec_step (thr=0x1509ac070408, node=0x1509ac02bc80) at /test/11.4_dbg/storage/innobase/row/row0upd.cc:2036
      #9  row_upd (thr=0x1509ac070408, node=0x1509ac02bc80) at /test/11.4_dbg/storage/innobase/row/row0upd.cc:2783
      #10 row_upd_step (thr=thr@entry=0x1509ac070408) at /test/11.4_dbg/storage/innobase/row/row0upd.cc:2898
      #11 0x000055f0ada5bed3 in row_update_for_mysql (prebuilt=0x1509ac02b1e8) at /test/11.4_dbg/storage/innobase/row/row0mysql.cc:1681
      #12 0x000055f0ad90f0f9 in ha_innobase::delete_row (this=0x1509ac02a0f0, record=0x1509ac021308 <incomplete sequence \371>) at /test/11.4_dbg/storage/innobase/handler/ha_innodb.cc:8731
      #13 0x000055f0ad5a7a7f in handler::ha_delete_row (this=0x1509ac02a0f0, buf=0x1509ac021308 <incomplete sequence \371>) at /test/11.4_dbg/sql/handler.cc:8000
      #14 0x000055f0ad23a761 in TABLE::delete_row (this=this@entry=0x1509ac018848) at /test/11.4_dbg/sql/sql_delete.cc:292
      #15 0x000055f0ad237ddd in Sql_cmd_delete::delete_from_single_table (this=this@entry=0x1509ac019e10, thd=thd@entry=0x1509ac000d58) at /test/11.4_dbg/sql/sql_delete.cc:833
      #16 0x000055f0ad238ce5 in Sql_cmd_delete::execute_inner (this=0x1509ac019e10, thd=0x1509ac000d58) at /test/11.4_dbg/sql/sql_delete.cc:1810
      #17 0x000055f0ad2cf295 in Sql_cmd_dml::execute (this=0x1509ac019e10, thd=0x1509ac000d58) at /test/11.4_dbg/sql/sql_select.cc:33587
      #18 0x000055f0ad28bae6 in mysql_execute_command (thd=thd@entry=0x1509ac000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/11.4_dbg/sql/sql_parse.cc:4375
      #19 0x000055f0ad290e39 in mysql_parse (thd=thd@entry=0x1509ac000d58, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x1509e410f1e0) at /test/11.4_dbg/sql/sql_parse.cc:7798
      #20 0x000055f0ad2931fc in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x1509ac000d58, packet=packet@entry=0x1509ac00b1c9 "DELETE HISTORY FROM t BEFORE SYSTEM_TIME '2031-01-01 23:13'", packet_length=packet_length@entry=59, blocking=blocking@entry=true) at /test/11.4_dbg/sql/sql_class.h:254
      #21 0x000055f0ad295333 in do_command (thd=0x1509ac000d58, blocking=blocking@entry=true) at /test/11.4_dbg/sql/sql_parse.cc:1406
      #22 0x000055f0ad3fb9fd in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55f0b1988cc8, put_in_cache=put_in_cache@entry=true) at /test/11.4_dbg/sql/sql_connect.cc:1417
      #23 0x000055f0ad3fbcf2 in handle_one_connection (arg=arg@entry=0x55f0b1988cc8) at /test/11.4_dbg/sql/sql_connect.cc:1319
      #24 0x000055f0ad848e9a in pfs_spawn_thread (arg=0x55f0b18f11f8) at /test/11.4_dbg/storage/perfschema/pfs.cc:2201
      #25 0x00001509efe94ac3 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #26 0x00001509eff26850 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      Bug confirmed present in:
      MariaDB: 10.4.33 (dbg), 10.5.24 (dbg), 10.6.17 (dbg), 10.11.7 (dbg), 11.0.5 (dbg), 11.1.4 (dbg), 11.2.3 (dbg), 11.3.2 (dbg), 11.4.0 (dbg), 10.4.33 (opt), 10.5.24 (opt), 10.6.17 (opt), 10.11.7 (opt), 11.0.5 (opt), 11.1.4 (opt), 11.2.3 (opt), 11.3.2 (opt), 11.4.0 (opt)

      Optimized show the corruption as well:

      11.4.0 9b1ea6904965dd345478dedd80e181ad54c767da (Optimized)

      2024-02-16 13:42:59 4 [ERROR] InnoDB: Record in index `c` of table `test`.`t` was not found on update: TUPLE (info_bits=0, 2 fields): {[8]        (0x00000000A58A2004),[6]      (0x000000000001)} at: COMPACT RECORD(info_bits=0, 1 fields): {[8]infimum (0x696E66696D756D00)}
      

      No UBSAN/ASAN issue detected.

      Attachments

        Issue Links

          Activity

            People

              midenok Aleksey Midenkov
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.