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

InnoDB: Failing assertion: discard.n_recs == 1

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      CREATE OR REPLACE TABLE mysql.general_log (a INT);
      CREATE TABLE t (c TIMESTAMP KEY);
      SET GLOBAL general_log=1;
      SET GLOBAL log_output='FILE,TABLE';
      SET @@autocommit=0;
      SELECT * FROM t;
      TRUNCATE t;
      ALTER TABLE t DISCARD TABLESPACE;
      

      Leads to:

      CS 12.0.1 107291bf980822fcc3c02bd4e01ecbc4db7fd192 (Optimized, Clang) Build 07/07/2025

      InnoDB: Failing assertion: discard.n_recs == 1
      

      CS 12.0.1 107291bf980822fcc3c02bd4e01ecbc4db7fd192 (Optimized, Clang) Build 07/07/2025

      Core was generated by `/test/MD070725-mariadb-12.0.1-linux-x86_64-opt/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 3328436)]
      (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  0x00007853e2e4527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x00007853e2e288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x00005edc04e085c6 in ut_dbg_assertion_failed (expr=0x5edc0598203b "discard.n_recs == 1", file=0x5edc059818d3 "/test/12.0_opt/storage/innobase/row/row0import.cc", line=line@entry=3959) at /test/12.0_opt/storage/innobase/ut/ut0
      dbg.cc:60
      #6  0x00005edc0554eb90 in row_import_update_discarded_flag (trx=trx@entry=0x7853b5279b80, table_id=<optimized out>, discarded=true)at /test/12.0_opt/storage/innobase/row/row0import.cc:3959
      #7  0x00005edc0556f7b3 in row_discard_tablespace (trx=0x7853b5279b80, table=0x7852c4061618)at /test/12.0_opt/storage/innobase/row/row0mysql.cc:2332
      #8  row_discard_tablespace_for_mysql (table=0x7852c4061618, trx=0x7853b5279b80)at /test/12.0_opt/storage/innobase/row/row0mysql.cc:2451
      #9  0x00005edc054c0945 in ha_innobase::discard_or_import_tablespace (this=0x7852c405a9b8, discard=1 '\001')at /test/12.0_opt/storage/innobase/handler/ha_innodb.cc:13401
      #10 0x00005edc05015b6e in mysql_discard_or_import_tablespace (thd=thd@entry=0x7852c4000c68, table_list=table_list@entry=0x7852c4017808, discard=true) at /test/12.0_opt/sql/sql_table.cc:6140
      #11 0x00005edc05091a33 in Sql_cmd_discard_import_tablespace::execute (this=0x7852c4017f40, thd=0x7852c4000c68)at /test/12.0_opt/sql/sql_alter.cc:733
      #12 0x00005edc04f62913 in mysql_execute_command (thd=thd@entry=0x7852c4000c68, is_called_from_prepared_stmt=false) at /test/12.0_opt/sql/sql_parse.cc:5861
      #13 0x00005edc04f5e2e1 in mysql_parse (thd=thd@entry=0x7852c4000c68, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7853b5277420)at /test/12.0_opt/sql/sql_parse.cc:7882
      #14 0x00005edc04f5c7ff in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7852c4000c68, packet=packet@entry=0x7852c4008a69 "ALTER TABLE t DISCARD TABLESPACE", packet_length=packet_length@entry=32, blocking=true)
      at /test/12.0_opt/sql/sql_parse.cc:1877
      #15 0x00005edc04f5e6f1 in do_command (thd=thd@entry=0x7852c4000c68, blocking=true) at /test/12.0_opt/sql/sql_parse.cc:1416
      #16 0x00005edc0508ae4d in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5edc3ea5aae8, put_in_cache=true)at /test/12.0_opt/sql/sql_connect.cc:1414
      #17 0x00005edc0508ac0f in handle_one_connection (arg=arg@entry=0x5edc3ea5aae8)at /test/12.0_opt/sql/sql_connect.cc:1326
      #18 0x00005edc05426349 in pfs_spawn_thread (arg=0x5edc3ea84258)at /test/12.0_opt/storage/perfschema/pfs.cc:2198
      #19 0x00007853e2e9caa4 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #20 0x00007853e2f29c3c 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  070725  31aa8b6939ee9326b4145a9cceae7e5a3711d7bf  thd->transaction->stmt.is_empty() || thd->in_sub_stmt|SIGABRT|mysql_execute_command|mysql_parse|dispatch_command|do_command
      CS  10.6   opt  070725  31aa8b6939ee9326b4145a9cceae7e5a3711d7bf  No bug found
      CS  10.11  dbg  070725  e79aa9ca382ce6d293edeab880212bf472c33f36  No bug found
      CS  10.11  opt  070725  e79aa9ca382ce6d293edeab880212bf472c33f36  No bug found
      CS  11.4   dbg  070725  dbeef00562dd7088a9f0163268f9eb5e5ba072fe  thd->transaction->stmt.is_empty() || thd->in_sub_stmt|SIGABRT|mysql_execute_command|mysql_parse|dispatch_command|do_command
      CS  11.4   opt  070725  dbeef00562dd7088a9f0163268f9eb5e5ba072fe  No bug found
      CS  11.8   dbg  070725  9a4a30aec003a8efdf9d35d3ac669385286ba4b4  thd->transaction->stmt.is_empty() || thd->in_sub_stmt|SIGABRT|mysql_execute_command|mysql_parse|dispatch_command|do_command
      CS  11.8   opt  070725  9a4a30aec003a8efdf9d35d3ac669385286ba4b4  discard.n_recs == 1|SIGABRT|ut_dbg_assertion_failed|row_import_update_discarded_flag|row_discard_tablespace|row_discard_tablespace_for_mysql
      CS  12.0   dbg  070725  107291bf980822fcc3c02bd4e01ecbc4db7fd192  thd->transaction->stmt.is_empty() || thd->in_sub_stmt|SIGABRT|mysql_execute_command|mysql_parse|dispatch_command|do_command
      CS  12.0   opt  070725  107291bf980822fcc3c02bd4e01ecbc4db7fd192  discard.n_recs == 1|SIGABRT|ut_dbg_assertion_failed|row_import_update_discarded_flag|row_discard_tablespace|row_discard_tablespace_for_mysql
      CS  12.1   dbg  070725  d4d0dd00b761b3e94454dff9aa93e2e17232339e  thd->transaction->stmt.is_empty() || thd->in_sub_stmt|SIGABRT|mysql_execute_command|mysql_parse|dispatch_command|do_command
      CS  12.1   opt  070725  d4d0dd00b761b3e94454dff9aa93e2e17232339e  discard.n_recs == 1|SIGABRT|ut_dbg_assertion_failed|row_import_update_discarded_flag|row_discard_tablespace|row_discard_tablespace_for_mysql
      ES  10.5   dbg  070725  70586522eacf09d04d49962072e14325a75d8155  GOT_ERROR|Got error: 98: Address already in use
      ES  10.5   opt  070725  70586522eacf09d04d49962072e14325a75d8155  No bug found
      ES  10.6   dbg  070725  6879c0c0bcdd1b7a88de65dd581cf86195a2cd11  thd->transaction->stmt.is_empty() || thd->in_sub_stmt|SIGABRT|mysql_execute_command|mysql_parse|dispatch_command|do_command
      ES  10.6   opt  070725  6879c0c0bcdd1b7a88de65dd581cf86195a2cd11  No bug found
      ES  11.4   dbg  070725  6ac3c1547652a4391fe0b1210ec241a804293567  thd->transaction->stmt.is_empty() || thd->in_sub_stmt|SIGABRT|mysql_execute_command|mysql_parse|dispatch_command|do_command
      ES  11.4   opt  070725  6ac3c1547652a4391fe0b1210ec241a804293567  No bug found
      ES  11.8   dbg  070725  e09b21aaddefcf0d7ddd96eca5b1d48c1d688de5  thd->transaction->stmt.is_empty() || thd->in_sub_stmt|SIGABRT|mysql_execute_command|mysql_parse|dispatch_command|do_command
      ES  11.8   opt  070725  e09b21aaddefcf0d7ddd96eca5b1d48c1d688de5  discard.n_recs == 1|SIGABRT|ut_dbg_assertion_failed|row_import_update_discarded_flag|row_discard_tablespace|row_discard_tablespace_for_mysql
      

      Attachments

        Issue Links

          Activity

            People

              mariadb-satishkumar Satish Kumar (Inactive)
              saahil Saahil Alam
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.