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

Assertion `cmp_rec_rec(rec, old_rec, offsets, old_offsets, m_index) > 0' failed in PageBulk::insertPage<(PageBulk::format)1>

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      Upon some reason, the issue does not reproduce in MTR (even when adding --source include/have_innodb.inc). Please use the CLI for reproduction.

      SET sql_mode='';
      CREATE TABLE t (c1 CHAR(10) BINARY CHARACTER SET 'utf8',PRIMARY KEY(c1(4))) ENGINE=InnoDB;
      REPLACE INTO t VALUES ('𝌆');
      INSERT INTO t VALUES (0);
      ALTER TABLE t CONVERT TO CHARACTER SET utf8;
      

      Leads to:

      CS 12.3.2 f5bb9922107672e88f7b5cbdb3d25151cc5744bb (Debug, Clang 21.1.3-20250923) Build 10/04/2026

      mariadbd: /test/12.3_dbg/storage/innobase/btr/btr0bulk.cc:172: void PageBulk::insertPage(rec_t *, rec_offs *) [fmt = PageBulk::DYNAMIC]: Assertion `cmp_rec_rec(rec, old_rec, offsets, old_offsets, m_index) > 0' failed.
      

      CS 12.3.2 f5bb9922107672e88f7b5cbdb3d25151cc5744bb (Debug, Clang 21.1.3-20250923) Build 10/04/2026

      Core was generated by `/test/MD100426-mariadb-12.3.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 3747604)]
      (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  0x000075171ea4526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x000075171ea288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x000075171ea2881b in __assert_fail_base (fmt=0x75171ebd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x653a4e69eb18 "cmp_rec_rec(rec, old_rec, offsets, old_offsets, m_index) > 0", file=file@entry=0x653a4e510713 "/test/12.3_dbg/storage/innobase/btr/btr0bulk.cc", line=line@entry=172, function=function@entry=0x653a4e690bbf "void PageBulk::insertPage(rec_t *, rec_offs *) [fmt = PageBulk::DYNAMIC]") at ./assert/assert.c:94
      #6  0x000075171ea3b507 in __assert_fail (assertion=0x653a4e69eb18 "cmp_rec_rec(rec, old_rec, offsets, old_offsets, m_index) > 0", file=0x653a4e510713 "/test/12.3_dbg/storage/innobase/btr/btr0bulk.cc", line=172, function=0x653a4e690bbf "void PageBulk::insertPage(rec_t *, rec_offs *) [fmt = PageBulk::DYNAMIC]") at ./assert/assert.c:103
      #7  0x0000653a4f9856ee in PageBulk::insertPage<(PageBulk::format)1> (this=0x6d15d81254b0, rec=0x6d15d8125997 "?   ", offsets=0x6d15d81259b8)at /test/12.3_dbg/storage/innobase/btr/btr0bulk.cc:172
      #8  0x0000653a4f9816f4 in PageBulk::insert (this=0x6d15d81254b0, rec=0x6d15d8125997 "?   ", offsets=0x6d15d81259b8)at /test/12.3_dbg/storage/innobase/btr/btr0bulk.cc:331
      #9  0x0000653a4f97da62 in BtrBulk::insert (this=0x6d15d8087cf0, tuple=0x6d15d81451d8, level=0)at /test/12.3_dbg/storage/innobase/btr/btr0bulk.cc:1103
      #10 0x0000653a4fae61d1 in BtrBulk::insert (this=0x6d15d8087cf0, tuple=0x6d15d81451d8) at include/btr0bulk.h:296
      #11 0x0000653a4fb1a044 in row_merge_insert_index_tuples (trx=0x751711000b80, index=0x6d15d8088158, old_table=0x6d15d802c508, fd=@0x75171c07fd00: {m_file = -1}, block=0x0, row_buf=0x6d15d8018668, btr_bulk=0x6d15d8087cf0, table_total_rows=2, pct_progress=0, pct_cost=50, crypt_block=0x0, space=9, stage=0x0, blob_file=0x0)at /test/12.3_dbg/storage/innobase/row/row0merge.cc:3838
      #12 0x0000653a4fb18172 in row_merge_read_clustered_index (trx=0x751711000b80, table=0x75171c082000, old_table=0x6d15d802c508, new_table=0x6d15d8086e38, online=true, index=0x6d15d80868c8, fts_sort_idx=0x0, psort_info=0x0, files=0x6d15d80186d0, key_numbers=0x6d15d80868d0, n_index=1, defaults=0x0, add_v=0x0, col_map=0x6d15d8086928, add_autoinc=18446744073709551615, sequence=@0x6d15d801b8c8: {m_max_value = 0, m_increment = 0, m_offset = 0, m_next_value = 0, m_eof = true}, block=0x6d16dcc00000 "", skip_pk_sort=true, tmpfd=0x75171c080738, stage=0x6d15d80186f0, pct_cost=50, crypt_block=0x0, eval_table=0x75171c082000, allow_not_null=true, col_collate=0x0)at /test/12.3_dbg/storage/innobase/row/row0merge.cc:2702
      #13 0x0000653a4fb131cb in row_merge_build_indexes (trx=0x751711000b80, old_table=0x6d15d802c508, new_table=0x6d15d8086e38, online=true, indexes=0x6d15d80868c8, key_numbers=0x6d15d80868d0, n_indexes=1, table=0x75171c082000, defaults=0x0, col_map=0x6d15d8086928, add_autoinc=18446744073709551615, sequence=@0x6d15d801b8c8: {m_max_value = 0, m_increment = 0, m_offset = 0, m_next_value = 0, m_eof = true}, skip_pk_sort=true, stage=0x6d15d80186f0, add_v=0x0, eval_table=0x75171c082000, allow_not_null=true, col_collate=0x0)at /test/12.3_dbg/storage/innobase/row/row0merge.cc:4775
      #14 0x0000653a4f99b4eb in ha_innobase::inplace_alter_table (this=0x6d15d8031548, altered_table=0x75171c082000, ha_alter_info=0x75171c081cd8)at /test/12.3_dbg/storage/innobase/handler/handler0alter.cc:8928
      #15 0x0000653a4f3ea9b9 in handler::ha_inplace_alter_table (this=0x6d15d8031548, altered_table=0x75171c082000, ha_alter_info=0x75171c081cd8) at /test/12.3_dbg/sql/handler.h:5165
      #16 0x0000653a4f3db125 in mysql_inplace_alter_table (thd=0x6d15d8000d58, table_list=0x6d15d801a248, table=0x6d15d802b7d8, altered_table=0x75171c082000, ha_alter_info=0x75171c081cd8, target_mdl_request=0x75171c083ec0, ddl_log_state=0x75171c081f70, trigger_param=0x75171c083ac0, alter_ctx=0x75171c082e18, partial_alter=@0x75171c081f3d: false, start_alter_id=@0x75171c081f30: 0, if_exists=false) at /test/12.3_dbg/sql/sql_table.cc:8310
      #17 0x0000653a4f3d3eb8 in mysql_alter_table (thd=0x6d15d8000d58, new_db=0x6d15d8005ba0, new_name=0x6d15d8006018, create_info=0x75171c084f90, table_list=0x6d15d801a248, recreate_info=0x75171c0846a8, alter_info=0x75171c084e18, order_num=0, order=0x0, ignore=false, if_exists=false)at /test/12.3_dbg/sql/sql_table.cc:11812
      #18 0x0000653a4f4a83fd in Sql_cmd_alter_table::execute (this=0x6d15d801a9a8, thd=0x6d15d8000d58) at /test/12.3_dbg/sql/sql_alter.cc:695
      #19 0x0000653a4f2a8195 in mysql_execute_command (thd=0x6d15d8000d58, is_called_from_prepared_stmt=false) at /test/12.3_dbg/sql/sql_parse.cc:5905
      #20 0x0000653a4f299308 in mysql_parse (thd=0x6d15d8000d58, rawbuf=0x6d15d801a140 "ALTER TABLE t CONVERT TO CHARACTER SET utf8", length=43, parser_state=0x75171c0869f0)at /test/12.3_dbg/sql/sql_parse.cc:7944
      #21 0x0000653a4f296a5e in dispatch_command (command=COM_QUERY, thd=0x6d15d8000d58, packet=0x6d15d800b4e9 "ALTER TABLE t CONVERT TO CHARACTER SET utf8", packet_length=43, blocking=true) at /test/12.3_dbg/sql/sql_parse.cc:1898
      #22 0x0000653a4f299d8a in do_command (thd=0x6d15d8000d58, blocking=true)at /test/12.3_dbg/sql/sql_parse.cc:1432
      #23 0x0000653a4f49c3ce in do_handle_one_connection (connect=0x653a531850d8, put_in_cache=true) at /test/12.3_dbg/sql/sql_connect.cc:1503
      #24 0x0000653a4f49c1b1 in handle_one_connection (arg=0x653a53093f28)at /test/12.3_dbg/sql/sql_connect.cc:1415
      #25 0x000075171ea9ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #26 0x000075171eb29c3c 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  100426  f39b634db715cd9dc1835653d1ce544df2aa1613  No bug found                  
      CS  10.6   opt  100426  f39b634db715cd9dc1835653d1ce544df2aa1613  No bug found                  
      CS  10.11  dbg  100426  ba774a0a90fac0163babe9d7a964aa36503e1711  No bug found                  
      CS  10.11  opt  100426  ba774a0a90fac0163babe9d7a964aa36503e1711  No bug found                  
      CS  11.4   dbg  100426  dc89915ad9bf3dcb67e66d2844c77ec0403373de  No bug found                  
      CS  11.4   opt  100426  dc89915ad9bf3dcb67e66d2844c77ec0403373de  No bug found                  
      CS  11.8   dbg  100426  e47db94aea7f0d6e0177e948486fc8860331f05f  cmp_rec_rec(rec, old_rec, offsets, old_offsets, m_index) > 0|SIGABRT|PageBulk::insertPage<btr0bulk.cc|PageBulk::insert|BtrBulk::insert|BtrBulk::insert
      CS  11.8   opt  100426  e47db94aea7f0d6e0177e948486fc8860331f05f  No bug found                  
      CS  12.2   dbg  100426  d26a6f44c1f2119377e79a9540886c6d8c01472f  cmp_rec_rec(rec, old_rec, offsets, old_offsets, m_index) > 0|SIGABRT|PageBulk::insertPage<btr0bulk.cc|PageBulk::insert|BtrBulk::insert|BtrBulk::insert
      CS  12.2   opt  100426  d26a6f44c1f2119377e79a9540886c6d8c01472f  No bug found                  
      CS  12.3   dbg  100426  f5bb9922107672e88f7b5cbdb3d25151cc5744bb  cmp_rec_rec(rec, old_rec, offsets, old_offsets, m_index) > 0|SIGABRT|PageBulk::insertPage<btr0bulk.cc|PageBulk::insert|BtrBulk::insert|BtrBulk::insert
      CS  12.3   opt  100426  f5bb9922107672e88f7b5cbdb3d25151cc5744bb  No bug found                  
      CS  13.0   dbg  100426  3a2f8e27981b76b99d2b87cc3bcec5ef022b2b23  cmp_rec_rec(rec, old_rec, offsets, old_offsets, m_index) > 0|SIGABRT|PageBulk::insertPage<btr0bulk.cc|PageBulk::insert|BtrBulk::insert|BtrBulk::insert
      CS  13.0   opt  100426  3a2f8e27981b76b99d2b87cc3bcec5ef022b2b23  No bug found                  
      ES  10.6   dbg  100426  84a80c8b38208d362225496da08d86d8d454e453  No bug found                  
      ES  10.6   opt  100426  84a80c8b38208d362225496da08d86d8d454e453  No bug found                  
      ES  11.4   dbg  100426  8b2bf17b733262409422ce7d039a0c021fc47077  No bug found                  
      ES  11.4   opt  100426  8b2bf17b733262409422ce7d039a0c021fc47077  No bug found                  
      ES  11.8   dbg  100426  854cae81f52e477c7777a51db26ba640d8755b81  cmp_rec_rec(rec, old_rec, offsets, old_offsets, m_index) > 0|SIGABRT|PageBulk::insertPage<btr0bulk.cc|PageBulk::insert|BtrBulk::insert|BtrBulk::insert
      ES  11.8   opt  100426  854cae81f52e477c7777a51db26ba640d8755b81  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                  
      

      Attachments

        Activity

          People

            bar Alexander Barkov
            Roel Roel Van de Paar
            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.