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

Assertion `offsets' failed in btr_check_node_ptr on INSERT

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      # mysqld options required for replay:  --sql_mode=
      SET GLOBAL innodb_limit_optimistic_insert_debug=5;
      CREATE TABLE t (c INT,INDEX (c));
      INSERT INTO t (c) VALUES (10),(11),(12),(13),(14);
      INSERT INTO t VALUES (1);
      INSERT INTO t VALUES (5),(4),(4),(3),(2),(2),(2),(1);
      INSERT INTO t VALUES (0);
      SET GLOBAL innodb_limit_optimistic_insert_debug=2;
      INSERT INTO t VALUES (35837);
      INSERT INTO t VALUES (20892);
      SET GLOBAL innodb_limit_optimistic_insert_debug=0;
      INSERT INTO t VALUES (1);
      INSERT INTO t VALUES (0);
      SET GLOBAL innodb_limit_optimistic_insert_debug=5;
      INSERT INTO t VALUES (0);
      INSERT INTO t VALUES (1);
      INSERT INTO t VALUES ('10:22:33'),('12:34:78'),(10),(1234),(123456),(1234559.99),('1'),('1:23'),('1:23:45'),('10.22'),('0 1:22:33.45'),('20 10:22:33'),('1999-02-03 20:33:34');
      SET GLOBAL innodb_limit_optimistic_insert_debug=2;
      INSERT INTO t VALUES (0);
      INSERT INTO t VALUES (DES_ENCRYPT ('bROWn dog',0));
      INSERT INTO t VALUES ('2001-01-01 23:59:999000');
      INSERT INTO t (c) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
      SET GLOBAL innodb_limit_optimistic_insert_debug=0;
      INSERT INTO t (c) VALUES (10),(11),(12),(13),(14);
      INSERT INTO t (c) VALUES (0),(0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
      SET GLOBAL innodb_limit_optimistic_insert_debug=2;
      INSERT INTO t VALUES (1);
      SET GLOBAL innodb_limit_optimistic_insert_debug=5;
      INSERT INTO t SELECT * FROM t;
      

      Leads to:

      CS 12.0.1 f1102da37a3dcdc8b92e0205f0a8bd878704b168 (Debug) Build 09/06/2025

      mariadbd: /test/12.0_dbg/storage/innobase/btr/btr0btr.cc:4403: ulint btr_check_node_ptr(dict_index_t *, buf_block_t *, que_thr_t *, mtr_t *): Assertion `offsets' failed.
      

      CS 12.0.1 f1102da37a3dcdc8b92e0205f0a8bd878704b168 (Debug) Build 09/06/2025

      Core was generated by `/test/MD090625-mariadb-12.0.1-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 1936585)]
      (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  0x000079f2bec4527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x000079f2bec288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x000079f2bec2881b in __assert_fail_base (fmt=0x79f2bedd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x617c08c53365 "offsets", file=file@entry=0x617c08c6164e "/test/12.0_dbg/storage/innobase/btr/btr0btr.cc", line=line@entry=4403, function=function@entry=0x617c08c6335a "ulint btr_check_node_ptr(dict_index_t *, buf_block_t *, que_thr_t *, mtr_t *)") at ./assert/assert.c:96
      #6  0x000079f2bec3b517 in __assert_fail (assertion=0x617c08c53365 "offsets", file=0x617c08c6164e "/test/12.0_dbg/storage/innobase/btr/btr0btr.cc", line=4403, function=0x617c08c6335a "ulint btr_check_node_ptr(dict_index_t *, buf_block_t *, que_thr_t *, mtr_t *)") at ./assert/assert.c:105
      #7  0x0000617c085f6f09 in btr_check_node_ptr (index=0x79f1b402c288, block=0x79f28c010380, thr=0x0, mtr=0x79f2984e98f8)at /test/12.0_dbg/storage/innobase/btr/btr0btr.cc:4403
      #8  0x0000617c085f9f55 in btr_discard_page (cursor=0x79f2984e8598, mtr=0x79f2984e98f8) at /test/12.0_dbg/storage/innobase/btr/btr0btr.cc:4219
      #9  0x0000617c0862a1b4 in btr_cur_pessimistic_delete (err=0x79f2984e857c, has_reserved_extents=1, cursor=0x79f2984e8598, flags=16, rollback=false, mtr=0x79f2984e98f8) at /test/12.0_dbg/storage/innobase/btr/btr0cur.cc:4629
      #10 0x0000617c085f3567 in btr_insert_into_right_sibling (flags=7, cursor=0x79f2984e8dd8, offsets=0x79f2984e8b68, heap=0x79f1b428ca20, tuple=0x79f1b428db38, n_ext=0, mtr=0x79f2984e98f8)at /test/12.0_dbg/storage/innobase/btr/btr0btr.cc:2705
      #11 0x0000617c085f08a5 in btr_page_split_and_insert (flags=7, cursor=0x79f2984e8dd8, offsets=0x79f2984e8b68, heap=0x79f2984e8dc8, tuple=0x79f1b428db38, n_ext=0, mtr=0x79f2984e98f8, err=0x79f2984e899c)at /test/12.0_dbg/storage/innobase/btr/btr0btr.cc:2873
      #12 0x0000617c0861e575 in btr_cur_pessimistic_insert (flags=7, cursor=0x79f2984e8dd8, offsets=0x79f2984e8b68, heap=0x79f2984e8dc8, entry=0x79f1b428db38, rec=0x79f2984e8dd0, big_rec=0x79f2984e8e20, n_ext=0, thr=0x0, mtr=0x79f2984e98f8)at /test/12.0_dbg/storage/innobase/btr/btr0cur.cc:2652
      #13 0x0000617c085f2adf in btr_insert_on_non_leaf_level (flags=7, index=0x79f1b402c288, level=1, tuple=0x79f1b428db38, mtr=0x79f2984e98f8)at /test/12.0_dbg/storage/innobase/btr/btr0btr.cc:2390
      #14 0x0000617c085f3639 in btr_insert_into_right_sibling (flags=0, cursor=0x79f2984e9878, offsets=0x79f2984e9608, heap=0x79f1b428da90, tuple=0x79f1b402b7e8, n_ext=0, mtr=0x79f2984e98f8)at /test/12.0_dbg/storage/innobase/btr/btr0btr.cc:2721
      #15 0x0000617c085f08a5 in btr_page_split_and_insert (flags=0, cursor=0x79f2984e9878, offsets=0x79f2984e9608, heap=0x79f2984e98d0, tuple=0x79f1b402b7e8, n_ext=0, mtr=0x79f2984e98f8, err=0x79f2984e930c)at /test/12.0_dbg/storage/innobase/btr/btr0btr.cc:2873
      #16 0x0000617c0861e575 in btr_cur_pessimistic_insert (flags=0, cursor=0x79f2984e9878, offsets=0x79f2984e9608, heap=0x79f2984e98d0, entry=0x79f1b402b7e8, rec=0x79f2984e94c0, big_rec=0x79f2984e94b8, n_ext=0, thr=0x79f1b4028970, mtr=0x79f2984e98f8)at /test/12.0_dbg/storage/innobase/btr/btr0cur.cc:2652
      #17 0x0000617c084d9391 in row_ins_sec_index_entry_low (flags=0, mode=BTR_INSERT_TREE, index=0x79f1b402c288, offsets_heap=0x79f1b428da90, heap=0x79f1b428c5a0, entry=0x79f1b402b7e8, trx_id=0, thr=0x79f1b4028970)at /test/12.0_dbg/storage/innobase/row/row0ins.cc:3218
      #18 0x0000617c084daf93 in row_ins_sec_index_entry (index=0x79f1b402c288, entry=0x79f1b402b7e8, thr=0x79f1b4028970, check_foreign=true)at /test/12.0_dbg/storage/innobase/row/row0ins.cc:3404
      #19 0x0000617c084e333e in row_ins_index_entry (index=0x79f1b402c288, entry=0x79f1b402b7e8, thr=0x79f1b4028970)at /test/12.0_dbg/storage/innobase/row/row0ins.cc:3457
      #20 0x0000617c084e246e in row_ins_index_entry_step (node=0x79f1b4028770, thr=0x79f1b4028970) at /test/12.0_dbg/storage/innobase/row/row0ins.cc:3621
      #21 0x0000617c084db9e2 in row_ins (node=0x79f1b4028770, thr=0x79f1b4028970)at /test/12.0_dbg/storage/innobase/row/row0ins.cc:3738
      #22 0x0000617c084db630 in row_ins_step (thr=0x79f1b4028970)at /test/12.0_dbg/storage/innobase/row/row0ins.cc:3867
      #23 0x0000617c08507aac in row_insert_for_mysql (mysql_rec=0x79f1b4026b88 "\375\f", prebuilt=0x79f1b4028368, ins_mode=ROW_INS_NORMAL)at /test/12.0_dbg/storage/innobase/row/row0mysql.cc:1299
      #24 0x0000617c08304f25 in ha_innobase::write_row (this=0x79f1b4026328, record=0x79f1b4026b88 "\375\f")at /test/12.0_dbg/storage/innobase/handler/ha_innodb.cc:7779
      #25 0x0000617c07f242ee in handler::ha_write_row (this=0x79f1b4026328, buf=0x79f1b4026b88 "\375\f") at /test/12.0_dbg/sql/handler.cc:8236
      #26 0x0000617c07a7ee37 in write_record (thd=0x79f1b4000d58, table=0x79f1b40317e8, info=0x79f1b401bdd0, sink=0x0)at /test/12.0_dbg/sql/sql_insert.cc:2435
      #27 0x0000617c07a843cd in select_insert::send_data (this=0x79f1b401bd80, values=@0x79f1b401c248: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x79f1b401eab8, last = 0x79f1b401eab8, elements = 1}, <No data fields>})at /test/12.0_dbg/sql/sql_insert.cc:4446
      #28 0x0000617c07a45880 in select_result_sink::send_data_with_check (this=0x79f1b401bd80, items=@0x79f1b401c248: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x79f1b401eab8, last = 0x79f1b401eab8, elements = 1}, <No data fields>}, u=0x79f1b4005148, sent=51) at /test/12.0_dbg/sql/sql_class.cc:3245
      #29 0x0000617c07b6920d in end_send (join=0x79f1b401be40, join_tab=0x79f1b401df98, end_of_records=false)at /test/12.0_dbg/sql/sql_select.cc:25794
      #30 0x0000617c07b9528d in evaluate_join_record (join=0x79f1b401be40, join_tab=0x79f1b401db20, error=0) at /test/12.0_dbg/sql/sql_select.cc:24681
      #31 0x0000617c07b94b45 in AGGR_OP::end_send (this=0x79f1b401e988)at /test/12.0_dbg/sql/sql_select.cc:33644
      #32 0x0000617c07b69fc0 in sub_select_postjoin_aggr (join=0x79f1b401be40, join_tab=0x79f1b401db20, end_of_records=true)at /test/12.0_dbg/sql/sql_select.cc:24126
      #33 0x0000617c07b48426 in sub_select (join=0x79f1b401be40, join_tab=0x79f1b401d6a8, end_of_records=true)at /test/12.0_dbg/sql/sql_select.cc:24381
      #34 0x0000617c07b70091 in do_select (join=0x79f1b401be40, procedure=0x0)at /test/12.0_dbg/sql/sql_select.cc:23961
      #35 0x0000617c07b6f393 in JOIN::exec_inner (this=0x79f1b401be40)at /test/12.0_dbg/sql/sql_select.cc:5074
      #36 0x0000617c07b6e23e in JOIN::exec (this=0x79f1b401be40)at /test/12.0_dbg/sql/sql_select.cc:4857
      #37 0x0000617c07b490bd in mysql_select (thd=0x79f1b4000d58, tables=0x79f1b401ad48, fields=@0x79f1b401a9b8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x79f1b401acf8, last = 0x79f1b401acf8, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=37385559870208, result=0x79f1b401bd80, unit=0x79f1b4005148, select_lex=0x79f1b401a700) at /test/12.0_dbg/sql/sql_select.cc:5390
      #38 0x0000617c07b48b45 in handle_select (thd=0x79f1b4000d58, lex=0x79f1b4005068, result=0x79f1b401bd80, setup_tables_done_option=35184372088832)at /test/12.0_dbg/sql/sql_select.cc:634
      #39 0x0000617c07ae8cfb in mysql_execute_command (thd=0x79f1b4000d58, is_called_from_prepared_stmt=false) at /test/12.0_dbg/sql/sql_parse.cc:4651
      #40 0x0000617c07add964 in mysql_parse (thd=0x79f1b4000d58, rawbuf=0x79f1b4019ee0 "INSERT INTO t SELECT * FROM t", length=29, parser_state=0x79f2984eca10) at /test/12.0_dbg/sql/sql_parse.cc:7882
      #41 0x0000617c07adad38 in dispatch_command (command=COM_QUERY, thd=0x79f1b4000d58, packet=0x79f1b400b259 "INSERT INTO t SELECT * FROM t", packet_length=29, blocking=true) at /test/12.0_dbg/sql/sql_parse.cc:1877
      #42 0x0000617c07ade513 in do_command (thd=0x79f1b4000d58, blocking=true)at /test/12.0_dbg/sql/sql_parse.cc:1416
      #43 0x0000617c07cc9ec9 in do_handle_one_connection (connect=0x617c18ba1668, put_in_cache=true) at /test/12.0_dbg/sql/sql_connect.cc:1414
      #44 0x0000617c07cc9c6e in handle_one_connection (arg=0x617c18b34a08)at /test/12.0_dbg/sql/sql_connect.cc:1326
      #45 0x000079f2bec9caa4 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #46 0x000079f2bed29c3c 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  090625  888663ce12647c5aefee5e18accd80843d726741  offsets|SIGABRT|btr_check_node_ptr|btr_discard_page|btr_cur_pessimistic_delete|btr_insert_into_right_sibling
      CS  10.6   opt  090625  888663ce12647c5aefee5e18accd80843d726741  No bug found                  
      CS  10.11  dbg  200625  e69f8cae1a15e15b9e4f5e0f8497e1f17bdc81a4  offsets|SIGABRT|btr_check_node_ptr|btr_discard_page|btr_cur_pessimistic_delete|btr_insert_into_right_sibling
      CS  10.11  opt  200625  e69f8cae1a15e15b9e4f5e0f8497e1f17bdc81a4  No bug found                  
      CS  11.4   dbg  090625  8c6cbb336081a5e1ad781df4a9778b61e3b4d73f  offsets|SIGABRT|btr_check_node_ptr|btr_discard_page|btr_cur_pessimistic_delete|btr_insert_into_right_sibling
      CS  11.4   opt  090625  8c6cbb336081a5e1ad781df4a9778b61e3b4d73f  No bug found                  
      CS  11.8   dbg  170625  c095283ea6f9ef25cd1bd731b6984c7cbc7e4c3f  offsets|SIGABRT|btr_check_node_ptr|btr_discard_page|btr_cur_pessimistic_delete|btr_insert_into_right_sibling
      CS  11.8   opt  170625  c095283ea6f9ef25cd1bd731b6984c7cbc7e4c3f  No bug found                  
      CS  12.0   dbg  090625  f1102da37a3dcdc8b92e0205f0a8bd878704b168  offsets|SIGABRT|btr_check_node_ptr|btr_discard_page|btr_cur_pessimistic_delete|btr_insert_into_right_sibling
      CS  12.0   opt  090625  f1102da37a3dcdc8b92e0205f0a8bd878704b168  No bug found                  
      CS  12.1   dbg  090625  6a2afb42ba86188ccda0972f9c2df363f34e10a0  offsets|SIGABRT|btr_check_node_ptr|btr_discard_page|btr_cur_pessimistic_delete|btr_insert_into_right_sibling
      CS  12.1   opt  090625  6a2afb42ba86188ccda0972f9c2df363f34e10a0  No bug found                  
      ES  10.6   dbg  090625  6111fbaf7bdcb6f1170f556ffd05d6e1a4159f62  offsets|SIGABRT|btr_check_node_ptr|btr_discard_page|btr_cur_pessimistic_delete|btr_insert_into_right_sibling
      ES  10.6   opt  090625  6111fbaf7bdcb6f1170f556ffd05d6e1a4159f62  No bug found                  
      ES  11.4   dbg  090625  9cd12544ebfd0d52d2158af66b5aced58121cf1f  offsets|SIGABRT|btr_check_node_ptr|btr_discard_page|btr_cur_pessimistic_delete|btr_insert_into_right_sibling
      ES  11.4   opt  090625  9cd12544ebfd0d52d2158af66b5aced58121cf1f  No bug found                  
      ES  11.8   dbg  170625  b9f97a5bc42a4f23889996d2891bcbb0cafcf0bc  offsets|SIGABRT|btr_check_node_ptr|btr_discard_page|btr_cur_pessimistic_delete|btr_insert_into_right_sibling
      ES  11.8   opt  170625  b9f97a5bc42a4f23889996d2891bcbb0cafcf0bc  No bug found                  
      

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              saahil Saahil Alam
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.