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

Assertion `share->rows_recorded' failed in ha_tina::delete_row on multi delete

    XMLWordPrintable

Details

    • Can result in hang or crash
    • Q3/2025 Maintenance

    Description

      I was first considering adding this to MDEV-23699, however found that 1) the stack is different from the 4th frame onwards, 2) this issue is a specific regression in 11.8, 3) the issue is multi-delete related, and 4) git-bisect seems to have located a specific multi-delete commit (more on this below).

      SET sql_mode='';
      CREATE TABLE t (v INT (1) NOT NULL) ENGINE=CSV;
      INSERT INTO t SELECT 1 away;
      DELETE FROM a3,a1 USING t AS a1 JOIN t AS a2 JOIN t AS a3;
      

      Leads to:

      CS 11.8.3 67e6fdee05ead4974fe632e91c38941ade369b0c (Debug) Build 06/06/2025

      mariadbd: /test/11.8_dbg/storage/csv/ha_tina.cc:1142: virtual int ha_tina::delete_row(const uchar *): Assertion `share->rows_recorded' failed.
      

      CS 11.8.3 67e6fdee05ead4974fe632e91c38941ade369b0c (Debug) Build 06/06/2025

      Core was generated by `/test/MD060625-mariadb-11.8.3-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=<optimized out>)at ./nptl/pthread_kill.c:44
       
      [Current thread is 1 (LWP 3570502)]
      (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  0x00007f7acf84526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x00007f7acf8288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x00007f7acf82881b in __assert_fail_base (fmt=0x7f7acf9d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x563f5bfe216c "share->rows_recorded", file=file@entry=0x563f5c18b146 "/test/11.8_dbg/storage/csv/ha_tina.cc", line=line@entry=1142, function=function@entry=0x563f5bffe2e6 "virtual int ha_tina::delete_row(const uchar *)") at ./assert/assert.c:94
      #6  0x00007f7acf83b507 in __assert_fail (assertion=0x563f5bfe216c "share->rows_recorded", file=0x563f5c18b146 "/test/11.8_dbg/storage/csv/ha_tina.cc", line=1142, function=0x563f5bffe2e6 "virtual int ha_tina::delete_row(const uchar *)")at ./assert/assert.c:103
      #7  0x0000563f5d1ddd5b in ha_tina::delete_row (this=0x7f79c0085080, buf=0x7f79c0083088 "") at /test/11.8_dbg/storage/csv/ha_tina.cc:1142
      #8  0x0000563f5c854c60 in handler::ha_delete_row (this=0x7f79c0085080, buf=0x7f79c0083088 "") at /test/11.8_dbg/sql/handler.cc:8353
      #9  0x0000563f5cc50606 in TABLE::delete_row (this=0x7f79c0082c38)at /test/11.8_dbg/sql/sql_delete.cc:296
      #10 0x0000563f5cc4e1e0 in multi_delete::rowid_table_deletes (this=0x7f79c001d370, table=0x7f79c0082c38, ignore=false)at /test/11.8_dbg/sql/sql_delete.cc:1610
      #11 0x0000563f5cc4ddf4 in multi_delete::do_deletes (this=0x7f79c001d370)at /test/11.8_dbg/sql/sql_delete.cc:1519
      #12 0x0000563f5cc4e43b in multi_delete::send_eof (this=0x7f79c001d370)at /test/11.8_dbg/sql/sql_delete.cc:1667
      #13 0x0000563f5cd4697f in do_select (join=0x7f79c001d5a0, procedure=0x0)at /test/11.8_dbg/sql/sql_select.cc:23838
      #14 0x0000563f5cd45a73 in JOIN::exec_inner (this=0x7f79c001d5a0)at /test/11.8_dbg/sql/sql_select.cc:5059
      #15 0x0000563f5cd4491e in JOIN::exec (this=0x7f79c001d5a0)at /test/11.8_dbg/sql/sql_select.cc:4842
      #16 0x0000563f5cd7880f in Sql_cmd_dml::execute_inner (this=0x7f79c001acd0, thd=0x7f79c0000d58) at /test/11.8_dbg/sql/sql_select.cc:34563
      #17 0x0000563f5cc4f946 in Sql_cmd_delete::execute_inner (this=0x7f79c001acd0, thd=0x7f79c0000d58) at /test/11.8_dbg/sql/sql_delete.cc:2078
      #18 0x0000563f5cd78376 in Sql_cmd_dml::execute (this=0x7f79c001acd0, thd=0x7f79c0000d58) at /test/11.8_dbg/sql/sql_select.cc:34497
      #19 0x0000563f5ccba53d in mysql_execute_command (thd=0x7f79c0000d58, is_called_from_prepared_stmt=false) at /test/11.8_dbg/sql/sql_parse.cc:4428
      #20 0x0000563f5ccb0814 in mysql_parse (thd=0x7f79c0000d58, rawbuf=0x7f79c0019d20 "DELETE FROM a3,a1 USING t AS a1 JOIN t AS a2 JOIN t AS a3", length=57, parser_state=0x7f7acc731a20)at /test/11.8_dbg/sql/sql_parse.cc:7906
      #21 0x0000563f5ccadbe4 in dispatch_command (command=COM_QUERY, thd=0x7f79c0000d58, packet=0x7f79c000b099 "DELETE FROM a3,a1 USING t AS a1 JOIN t AS a2 JOIN t AS a3", packet_length=57, blocking=true) at /test/11.8_dbg/sql/sql_parse.cc:1902
      #22 0x0000563f5ccb13c3 in do_command (thd=0x7f79c0000d58, blocking=true)at /test/11.8_dbg/sql/sql_parse.cc:1415
      #23 0x0000563f5ceccb89 in do_handle_one_connection (connect=0x563f5fbdc7e8, put_in_cache=true) at /test/11.8_dbg/sql/sql_connect.cc:1415
      #24 0x0000563f5cecc92e in handle_one_connection (arg=0x563f5fbc0798)at /test/11.8_dbg/sql/sql_connect.cc:1327
      #25 0x00007f7acf89ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #26 0x00007f7acf929c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Bug Detection Matrix

          Rel    o/d  Build   Commit                                    UniqueID observed             
      CS  10.6   dbg  060625  643319a7fb1e273797c2a1e46d76cfac0fa1da8f  No bug found                  
      CS  10.6   opt  060625  643319a7fb1e273797c2a1e46d76cfac0fa1da8f  No bug found                  
      CS  10.11  dbg  060625  11d1ac7285221ab4df7d9ef7cc8ee949b01c9b32  No bug found                  
      CS  10.11  opt  060625  11d1ac7285221ab4df7d9ef7cc8ee949b01c9b32  No bug found                  
      CS  11.4   dbg  060625  8c6cbb336081a5e1ad781df4a9778b61e3b4d73f  No bug found                  
      CS  11.4   opt  060625  8c6cbb336081a5e1ad781df4a9778b61e3b4d73f  No bug found                  
      CS  11.8   dbg  060625  67e6fdee05ead4974fe632e91c38941ade369b0c  share->rows_recorded|SIGABRT|ha_tina::delete_row|handler::ha_delete_row|TABLE::delete_row|multi_delete::rowid_table_deletes
      CS  11.8   opt  060625  67e6fdee05ead4974fe632e91c38941ade369b0c  No bug found                  
      CS  12.0   dbg  060625  f1102da37a3dcdc8b92e0205f0a8bd878704b168  share->rows_recorded|SIGABRT|ha_tina::delete_row|handler::ha_delete_row|TABLE::delete_row|multi_delete::rowid_table_deletes
      CS  12.0   opt  060625  f1102da37a3dcdc8b92e0205f0a8bd878704b168  No bug found                  
      CS  12.1   dbg  100625  6a2afb42ba86188ccda0972f9c2df363f34e10a0  share->rows_recorded|SIGABRT|ha_tina::delete_row|handler::ha_delete_row|TABLE::delete_row|multi_delete::rowid_table_deletes
      CS  12.1   opt  100625  6a2afb42ba86188ccda0972f9c2df363f34e10a0  No bug found                  
      ES  10.5   dbg  060625  ec7bc4f84e490b25f52db7422a1e0e8bbea72fb1  No bug found                  
      ES  10.5   opt  060625  ec7bc4f84e490b25f52db7422a1e0e8bbea72fb1  No bug found                  
      ES  10.6   dbg  060625  8541ea1e4c2fa15789dd162f6ba4b32681f74e61  No bug found                  
      ES  10.6   opt  060625  8541ea1e4c2fa15789dd162f6ba4b32681f74e61  No bug found                  
      ES  11.4   dbg  060625  1c8b2d3059f5ccb67c042868baca3ee269c6eca7  No bug found                  
      ES  11.4   opt  060625  1c8b2d3059f5ccb67c042868baca3ee269c6eca7  No bug found                  
      ES  11.8   dbg  110625  b9f97a5bc42a4f23889996d2891bcbb0cafcf0bc  share->rows_recorded|SIGABRT|ha_tina::delete_row|handler::ha_delete_row|TABLE::delete_row|multi_delete::rowid_table_deletes
      ES  11.8   opt  110625  b9f97a5bc42a4f23889996d2891bcbb0cafcf0bc  No bug found                  
      MS  5.5    dbg  070123  bac287c315b1792e7ae33f91add6a60292f9bae8  No bug found                  
      MS  5.5    opt  070123  bac287c315b1792e7ae33f91add6a60292f9bae8  No bug found                  
      MS  5.6    dbg  070123  dab95781a1244104d6b87020ac2fc4d190ba2946  No bug found                  
      MS  5.6    opt  070123  dab95781a1244104d6b87020ac2fc4d190ba2946  No bug found                  
      MS  5.7    dbg  070525  f7680e98b6bbe3500399fbad465d08a6b75d7a5c  No bug found                  
      MS  5.7    opt  070525  f7680e98b6bbe3500399fbad465d08a6b75d7a5c  No bug found                  
      MS  8.0    dbg  060224  49ef33f7edadef3ae04665e73d1babd40179a4f1  No bug found                  
      MS  8.0    opt  060224  49ef33f7edadef3ae04665e73d1babd40179a4f1  No bug found                  
      MS  9.1    dbg  211024  61a3a1d8ef15512396b4c2af46e922a19bf2b174  No bug found                  
      MS  9.1    opt  211024  61a3a1d8ef15512396b4c2af46e922a19bf2b174  No bug found                  
      

      Git bisect was unable to find the specific commit, though it got it down to 4 possible bad commits, 3 which had build failures and one which was defined as bad. The results were:

      8ec275da1629f595f2c2b1ccf604ad171326b8bf - build failure
        Sergei Petrunia - MDEV-35955 Wrong result for UPDATE ... ORDER BY LIMIT which uses tmp.table
       
      5001300bd48866f885b61fac3857932a4ed9de70 - build failure
        Dave Gosselin - MDEV-30469 Support ORDER BY and LIMIT for multi-table DELETE, index hints for single-table DELETE
       
      edd52b7fc7d6500fd6fcf377c54c8dc2ed365061 - bad commit
        Dave Gosselin - MDEV-30469 Feature rebase
       
      5e07d1abd45465e7c73369207eec4569f0eb112a - build failure
        Dave Gosselin - MDEV-35848, MDEV-35568 Reintroduce delete_while_scanning for multi_delete
      

      Given the testcase using multi_delete, the last one seems to be the one causing the regression:

      commit 5e07d1abd45465e7c73369207eec4569f0eb112a
      Author: Dave Gosselin <dave.gosselin@mariadb.com>
      Date:   Wed Jan 29 15:21:03 2025 -0500
       
          MDEV-35848, MDEV-35568 Reintroduce delete_while_scanning for multi_delete
          
          Reintroduces delete_while_scanning optimization for multi_delete.
          Reverse some test changes from the initial feature devlopment now
          that we delete-on-the-fly once again.
      

      Testcase is CLI and MTR compatible.

      Attachments

        Issue Links

          Activity

            People

              Gosselin Dave Gosselin
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.