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

Assertion `index->table->is_temporary() || !page_is_leaf(block->page.frame) || !!(index)->is_primary()' failed in btr_page_reorganize_low

Details

    Description

      Discussed with marko at lenght.

      SET sql_mode='';
      CREATE TABLE t (c INT,KEY(c)) ENGINE=InnoDB;
      SET debug_dbug='+d,do_page_reorganize';
      INSERT INTO t VALUES ('');
      

      Leads to

      10.9.0 4a2a9c02cd6611ef36bbb735c2b483dbc83580d4 (Debug)

      mysqld: /test/10.9_dbg/storage/innobase/btr/btr0btr.cc:1314: void btr_page_reorganize_low(page_cur_t*, dict_index_t*, mtr_t*): Assertion `index->table->is_temporary() || !page_is_leaf(block->page.frame) || !!(index)->is_primary()' failed.
      

      10.9.0 4a2a9c02cd6611ef36bbb735c2b483dbc83580d4 (Debug)

      Core was generated by `/test/MD260222-mariadb-10.9.0-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      [Current thread is 1 (Thread 0x15222c1f9700 (LWP 1993097))]
      (gdb) bt
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #1  0x0000152240e93859 in __GI_abort () at abort.c:79
      #2  0x0000152240e93729 in __assert_fail_base (fmt=0x152241029588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x56044f9ccac8 "index->table->is_temporary() || !page_is_leaf(block->page.frame) || !!(index)->is_primary()", file=0x56044f9cbe18 "/test/10.9_dbg/storage/innobase/btr/btr0btr.cc", line=1314, function=<optimized out>) at assert.c:92
      #3  0x0000152240ea5006 in __GI___assert_fail (assertion=assertion@entry=0x56044f9ccac8 "index->table->is_temporary() || !page_is_leaf(block->page.frame) || !!(index)->is_primary()", file=file@entry=0x56044f9cbe18 "/test/10.9_dbg/storage/innobase/btr/btr0btr.cc", line=line@entry=1314, function=function@entry=0x56044f9cc940 "void btr_page_reorganize_low(page_cur_t*, dict_index_t*, mtr_t*)") at assert.c:101
      #4  0x000056044f34d01d in btr_page_reorganize_low (cursor=cursor@entry=0x15222c1f63f8, index=index@entry=0x1521ec024a28, mtr=mtr@entry=0x15222c1f6960) at /test/10.9_dbg/storage/innobase/include/dict0mem.h:1160
      #5  0x000056044f34dfb4 in btr_page_reorganize (cursor=cursor@entry=0x15222c1f63f8, index=index@entry=0x1521ec024a28, mtr=mtr@entry=0x15222c1f6960) at /test/10.9_dbg/storage/innobase/btr/btr0btr.cc:1548
      #6  0x000056044f3787a1 in btr_cur_optimistic_insert (flags=flags@entry=0, cursor=cursor@entry=0x15222c1f63f0, offsets=offsets@entry=0x15222c1f6348, heap=heap@entry=0x15222c1f6338, entry=entry@entry=0x1521ec0214c0, rec=rec@entry=0x15222c1f63a0, big_rec=0x15222c1f6490, n_ext=<optimized out>, thr=0x1521ec02a050, mtr=0x15222c1f6960) at /test/10.9_dbg/storage/innobase/btr/btr0cur.cc:3503
      #7  0x000056044f25e027 in row_ins_sec_index_entry_low (flags=flags@entry=0, mode=mode@entry=2, index=index@entry=0x1521ec024a28, offsets_heap=<optimized out>, offsets_heap@entry=0x1521ec06fc78, heap=heap@entry=0x1521ec070118, entry=entry@entry=0x1521ec0214c0, trx_id=<optimized out>, thr=<optimized out>) at /test/10.9_dbg/storage/innobase/row/row0ins.cc:3130
      #8  0x000056044f25e79a in row_ins_sec_index_entry (index=index@entry=0x1521ec024a28, entry=entry@entry=0x1521ec0214c0, thr=thr@entry=0x1521ec02a050, check_foreign=check_foreign@entry=true) at /test/10.9_dbg/storage/innobase/row/row0ins.cc:3331
      #9  0x000056044f260398 in row_ins_index_entry (thr=0x1521ec02a050, entry=0x1521ec0214c0, index=0x1521ec024a28) at /test/10.9_dbg/storage/innobase/row/row0ins.cc:3390
      #10 row_ins_index_entry_step (thr=0x1521ec02a050, node=0x1521ec029e38) at /test/10.9_dbg/storage/innobase/row/row0ins.cc:3556
      #11 row_ins (thr=0x1521ec02a050, node=0x1521ec029e38) at /test/10.9_dbg/storage/innobase/row/row0ins.cc:3702
      #12 row_ins_step (thr=thr@entry=0x1521ec02a050) at /test/10.9_dbg/storage/innobase/row/row0ins.cc:3848
      #13 0x000056044f28485c in row_insert_for_mysql (mysql_rec=mysql_rec@entry=0x1521ec028c58 "\376", prebuilt=0x1521ec029948, ins_mode=ROW_INS_NORMAL) at /test/10.9_dbg/storage/innobase/row/row0mysql.cc:1318
      #14 0x000056044f0ffedb in ha_innobase::write_row (this=0x1521ec0290e0, record=0x1521ec028c58 "\376") at /test/10.9_dbg/storage/innobase/handler/ha_innodb.cc:7846
      #15 0x000056044ed593e7 in handler::ha_write_row (this=0x1521ec0290e0, buf=0x1521ec028c58 "\376") at /test/10.9_dbg/sql/handler.cc:7522
      #16 0x000056044e9ef3a0 in write_record (thd=thd@entry=0x1521ec000db8, table=table@entry=0x1521ec027378, info=info@entry=0x15222c1f7cd0, sink=sink@entry=0x0) at /test/10.9_dbg/sql/sql_insert.cc:2156
      #17 0x000056044e9fb0f6 in mysql_insert (thd=thd@entry=0x1521ec000db8, table_list=0x1521ec013ec0, fields=@0x1521ec006080: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x56045008f9a0 <end_of_list>, last = 0x1521ec006080, elements = 0}, <No data fields>}, values_list=@0x1521ec0060c8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x1521ec014ac8, last = 0x1521ec014ac8, elements = 1}, <No data fields>}, update_fields=@0x1521ec0060b0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x56045008f9a0 <end_of_list>, last = 0x1521ec0060b0, elements = 0}, <No data fields>}, update_values=@0x1521ec006098: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x56045008f9a0 <end_of_list>, last = 0x1521ec006098, elements = 0}, <No data fields>}, duplic=DUP_ERROR, ignore=false, result=0x0) at /test/10.9_dbg/sql/sql_insert.cc:1127
      #18 0x000056044ea41958 in mysql_execute_command (thd=thd@entry=0x1521ec000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.9_dbg/sql/sql_parse.cc:4562
      #19 0x000056044ea2c343 in mysql_parse (thd=thd@entry=0x1521ec000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x15222c1f8400) at /test/10.9_dbg/sql/sql_parse.cc:8027
      #20 0x000056044ea3afdf in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x1521ec000db8, packet=packet@entry=0x1521ec00b889 "INSERT INTO t0 VALUES ('a')", packet_length=packet_length@entry=27, blocking=blocking@entry=true) at /test/10.9_dbg/sql/sql_class.h:1362
      #21 0x000056044ea3e426 in do_command (thd=0x1521ec000db8, blocking=blocking@entry=true) at /test/10.9_dbg/sql/sql_parse.cc:1402
      #22 0x000056044ebb9036 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x560452c4d2b8, put_in_cache=put_in_cache@entry=true) at /test/10.9_dbg/sql/sql_connect.cc:1418
      #23 0x000056044ebb963b in handle_one_connection (arg=arg@entry=0x560452c4d2b8) at /test/10.9_dbg/sql/sql_connect.cc:1312
      #24 0x000056044f03fd23 in pfs_spawn_thread (arg=0x560452b60848) at /test/10.9_dbg/storage/perfschema/pfs.cc:2201
      #25 0x00001522413a4609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #26 0x0000152240f90163 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Likely present in earlier versions also.

      Attachments

        Issue Links

          Activity

            It does not make any sense to invoke page reorganization on an empty page (and table). Hence, neither should the debug injection invoke that.

            The debug assertion that failed during page reorganize ensures that the PAGE_MAX_TRX_ID is nonzero in secondary index leaf pages. On an empty page, that field is supposed to be 0, and page reorganize is not supposed to be invoked.

            marko Marko Mäkelä added a comment - It does not make any sense to invoke page reorganization on an empty page (and table). Hence, neither should the debug injection invoke that. The debug assertion that failed during page reorganize ensures that the PAGE_MAX_TRX_ID is nonzero in secondary index leaf pages. On an empty page, that field is supposed to be 0, and page reorganize is not supposed to be invoked.

            People

              marko Marko Mäkelä
              Roel Roel Van de Paar
              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.