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

Assertion `error != DB_FOREIGN_DUPLICATE_KEY' failed in virtual int ha_innobase::delete_row(const uchar *)

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      --source include/have_innodb.inc
       
      CREATE TABLE t (y INT UNIQUE,r INT,f INT,KEY(r),FOREIGN KEY(f) REFERENCES t (r) ON DELETE SET NULL) ENGINE=INNODB WITH SYSTEM VERSIONING;
      SET TIMESTAMP=UNIX_TIMESTAMP('2013-01-31 09:00:00');
      INSERT INTO t VALUES (1,0,0),(2,0,0),(3,0,0);
      DELETE FROM t;
      INSERT INTO t VALUES (1,0,0),(2,0,0),(3,0,0);
      DELETE FROM t;
      

      Leads to:

      CS 12.2.2 997d0c4dfc551ea54faa1e9b7d56f3a0ff2ca849 (Debug, Clang 18.1.3-11) Build 12/12/2025

      mariadbd: /test/12.2_dbg/storage/innobase/handler/ha_innodb.cc:8674: virtual int ha_innobase::delete_row(const uchar *): Assertion `error != DB_FOREIGN_DUPLICATE_KEY' failed.
      

      CS 12.2.2 997d0c4dfc551ea54faa1e9b7d56f3a0ff2ca849 (Debug, Clang 18.1.3-11) Build 12/12/2025

      Core was generated by `/test/MD121225-mariadb-12.2.2-linux-x86_64-dbg/bin/mariadbd --no-defaults --max'.
      Program terminated with signal SIGABRT, Aborted.
      Download failed: Invalid argument.  Continuing without source file ./nptl/./nptl/pthread_kill.c.
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
       
      [Current thread is 1 (LWP 1893595)]
      (gdb) bt
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
      #1  __pthread_kill_internal (signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:78
      #2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6)at ./nptl/pthread_kill.c:89
      #3  0x0000712ab9e4527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x0000712ab9e288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x0000712ab9e2881b in __assert_fail_base (fmt=0x712ab9fd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x631c98233687 "error != DB_FOREIGN_DUPLICATE_KEY", file=file@entry=0x631c982324e8 "/test/12.2_dbg/storage/innobase/handler/ha_innodb.cc", line=line@entry=8674, function=function@entry=0x631c9823363a "virtual int ha_innobase::delete_row(const uchar *)") at ./assert/assert.c:96
      #6  0x0000712ab9e3b517 in __assert_fail (assertion=0x631c98233687 "error != DB_FOREIGN_DUPLICATE_KEY", file=0x631c982324e8 "/test/12.2_dbg/storage/innobase/handler/ha_innodb.cc", line=8674, function=0x631c9823363a "virtual int ha_innobase::delete_row(const uchar *)") at ./assert/assert.c:105
      #7  0x0000631c97868742 in ha_innobase::delete_row (this=0x7129cc029fb8, record=0x7129cc02a838 "\361\001")at /test/12.2_dbg/storage/innobase/handler/ha_innodb.cc:8674
      #8  0x0000631c97456df0 in handler::ha_delete_row (this=0x7129cc029fb8, buf=0x7129cc02a838 "\361\001") at /test/12.2_dbg/sql/handler.cc:8414
      #9  0x0000631c96f8d6e9 in TABLE::delete_row<false> (this=0x7129cc029b78, treat_versioned=true) at /test/12.2_dbg/sql/sql_delete.cc:373
      #10 0x0000631c96f8dd3d in TABLE::delete_row (this=0x7129cc029b78)at /test/12.2_dbg/sql/table.h:2016
      #11 0x0000631c96f8845f in Sql_cmd_delete::delete_from_single_table (this=0x7129cc01ae38, thd=0x7129cc000d58)at /test/12.2_dbg/sql/sql_delete.cc:968
      #12 0x0000631c96f8cb26 in Sql_cmd_delete::execute_inner (this=0x7129cc01ae38, thd=0x7129cc000d58) at /test/12.2_dbg/sql/sql_delete.cc:2168
      #13 0x0000631c970c1fa6 in Sql_cmd_dml::execute (this=0x7129cc01ae38, thd=0x7129cc000d58) at /test/12.2_dbg/sql/sql_select.cc:34833
      #14 0x0000631c97006229 in mysql_execute_command (thd=0x7129cc000d58, is_called_from_prepared_stmt=false) at /test/12.2_dbg/sql/sql_parse.cc:4400
      #15 0x0000631c96ffc644 in mysql_parse (thd=0x7129cc000d58, rawbuf=0x7129cc019ee0 "DELETE FROM t", length=13, parser_state=0x712ab8114ac0) at /test/12.2_dbg/sql/sql_parse.cc:7888
      #16 0x0000631c96ff9a18 in dispatch_command (command=COM_QUERY, thd=0x7129cc000d58, packet=0x7129cc00b239 "DELETE FROM t", packet_length=13, blocking=true) at /test/12.2_dbg/sql/sql_parse.cc:1878
      #17 0x0000631c96ffd1f3 in do_command (thd=0x7129cc000d58, blocking=true)at /test/12.2_dbg/sql/sql_parse.cc:1417
      #18 0x0000631c971eb529 in do_handle_one_connection (connect=0x631cb135e858, put_in_cache=true) at /test/12.2_dbg/sql/sql_connect.cc:1503
      #19 0x0000631c971eb2ce in handle_one_connection (arg=0x631cb132c268)at /test/12.2_dbg/sql/sql_connect.cc:1415
      #20 0x0000712ab9e9caa4 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #21 0x0000712ab9f29c6c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Bug Detection Matrix

          Rel    o/d  Build   Commit                                    UniqueID observed             
      CS  10.11  dbg  121225  4ee491f1b2eb356e9dc40f388f79b62cfeb13609  error != DB_FOREIGN_DUPLICATE_KEY|SIGABRT|ha_innobase::delete_row|handler::ha_delete_row|TABLE::delete_row<false>|TABLE::delete_row
      CS  10.11  opt  121225  4ee491f1b2eb356e9dc40f388f79b62cfeb13609  No bug found                  
      CS  11.4   dbg  121225  4cff562f3f89d4df03e09233d835d0451bc37cc4  error != DB_FOREIGN_DUPLICATE_KEY|SIGABRT|ha_innobase::delete_row|handler::ha_delete_row|TABLE::delete_row<false>|TABLE::delete_row
      CS  11.4   opt  121225  4cff562f3f89d4df03e09233d835d0451bc37cc4  No bug found                  
      CS  11.8   dbg  121225  a7528a6190807281d3224e4e67a9b76083a202a6  error != DB_FOREIGN_DUPLICATE_KEY|SIGABRT|ha_innobase::delete_row|handler::ha_delete_row|TABLE::delete_row<false>|TABLE::delete_row
      CS  11.8   opt  121225  a7528a6190807281d3224e4e67a9b76083a202a6  No bug found                  
      CS  12.1   dbg  121225  70117463f032d59f8e328335e19b59157d34cf07  error != DB_FOREIGN_DUPLICATE_KEY|SIGABRT|ha_innobase::delete_row|handler::ha_delete_row|TABLE::delete_row<false>|TABLE::delete_row
      CS  12.1   opt  121225  70117463f032d59f8e328335e19b59157d34cf07  No bug found                  
      CS  12.2   dbg  121225  997d0c4dfc551ea54faa1e9b7d56f3a0ff2ca849  error != DB_FOREIGN_DUPLICATE_KEY|SIGABRT|ha_innobase::delete_row|handler::ha_delete_row|TABLE::delete_row<false>|TABLE::delete_row
      CS  12.2   dbg  251125  5676ecfbb3716937129105d98e69355e90bfa3f8  error != DB_FOREIGN_DUPLICATE_KEY|SIGABRT|ha_innobase::delete_row|handler::ha_delete_row|TABLE::delete_row<false>|TABLE::delete_row
      CS  12.2   opt  121225  997d0c4dfc551ea54faa1e9b7d56f3a0ff2ca849  No bug found                  
      CS  12.2   opt  251125  5676ecfbb3716937129105d98e69355e90bfa3f8  No bug found                  
      CS  12.3   dbg  121225  5879c85f505d3a11d4b8f479f2437416d8a1d724  error != DB_FOREIGN_DUPLICATE_KEY|SIGABRT|ha_innobase::delete_row|handler::ha_delete_row|TABLE::delete_row<false>|TABLE::delete_row
      CS  12.3   opt  121225  5879c85f505d3a11d4b8f479f2437416d8a1d724  No bug found    
      ES  10.6   dbg  151225  bc33b05c6a65de27dbe811a30bc37c207d60ee8e  No bug found
      ES  10.6   opt  151225  bc33b05c6a65de27dbe811a30bc37c207d60ee8e  No bug found
      ES  11.4   dbg  151225  714f2134597e00f4ff107886cf3a55eff48e4510  error != DB_FOREIGN_DUPLICATE_KEY|SIGABRT|ha_innobase::delete_row|handler::ha_delete_row|TABLE::delete_row<false>|TABLE::delete_row
      ES  11.4   opt  151225  714f2134597e00f4ff107886cf3a55eff48e4510  No bug found                  
      ES  11.8   dbg  151225  4008de1a5b06105a64821db7b851328f1b27d99e  error != DB_FOREIGN_DUPLICATE_KEY|SIGABRT|ha_innobase::delete_row|handler::ha_delete_row|TABLE::delete_row<false>|TABLE::delete_row
      ES  11.8   opt  151225  4008de1a5b06105a64821db7b851328f1b27d99e  No bug found                               
      

      No UB/ASAN issues observed.

      Attachments

        Activity

          People

            midenok Aleksey Midenkov
            ramesh Ramesh Sivaraman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.