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

Assertion `mtr->memo_contains(index->lock, MTR_MEMO_X_LOCK)' failed in btr_attach_half_pages

    XMLWordPrintable

Details

    Description

      Notes:

      • Download the attached file earth.jpg to /tmp before running the test. If you choose another location, modify the test case to point at it.
      • I've set it to critical as a recent regression. The test case is admittedly not smart or practical, so I'm not making it a blocker.
        It is not completely artificial though. What happened originally is that a binary file was loaded into one of many columns of a table, then the table contents was selected into an outfile, and then the outfile was [attempted to be] loaded into the table again as LOAD INFILE. It shouldn't be done so, the blob breaks the outfile format, so resulting contents of the table is meaningless anyway; but the assertion failure raises a concern that the problem may expand to more meaningful use cases.

      --source include/have_innodb.inc
       
      CREATE TABLE t (f1 varbinary(255), key(f1)) ENGINE=InnoDB ROW_FORMAT=compressed;
      LOAD DATA LOCAL INFILE '/tmp/earth.jpg' INTO TABLE t;
       
      # Cleanup
      DROP TABLE t;
      

      10.6 8f87023d

      mariadbd: /data/src/10.6/storage/innobase/btr/btr0btr.cc:2597: dberr_t btr_attach_half_pages(ulint, dict_index_t*, buf_block_t*, const rec_t*, buf_block_t*, ulint, mtr_t*): Assertion `mtr->memo_contains(index->lock, MTR_MEMO_X_LOCK)' failed.
      230501  1:16:34 [ERROR] mysqld got signal 6 ;
       
      0c05de0 "/data/src/10.6/storage/innobase/btr/btr0btr.cc", line=2597, function=0x556f40c09fa0 "dberr_t btr_attach_half_pages(ulint, dict_index_t*, buf_block_t*, const rec_t*, buf_block_t*, ulint, mtr_t*)") at ./assert/assert.c:101
      #10 0x0000556f3f77eb58 in btr_attach_half_pages (flags=7, index=0x6160009d5120, block=0x7f5b29049150, split_rec=0x7f5b2910913b "F\344", new_block=0x7f5b29047ea0, direction=111, mtr=0x7f5b2086dfc0) at /data/src/10.6/storage/innobase/btr/btr0btr.cc:2597
      #11 0x0000556f3f781ed6 in btr_page_split_and_insert (flags=7, cursor=0x7f5b2086cf50, offsets=0x7f5b2086cf30, heap=0x7f5b2086cf10, tuple=0x61a0003ae720, n_ext=0, mtr=0x7f5b2086dfc0, err=0x7f5b2086cdd0) at /data/src/10.6/storage/innobase/btr/btr0btr.cc:3133
      #12 0x0000556f3f7c71ab in btr_cur_pessimistic_insert (flags=7, cursor=0x7f5b2086cf50, offsets=0x7f5b2086cf30, heap=0x7f5b2086cf10, entry=0x61a0003ae720, rec=0x7f5b2086cef0, big_rec=0x7f5b2086ced0, n_ext=0, thr=0x0, mtr=0x7f5b2086dfc0) at /data/src/10.6/storage/innobase/btr/btr0cur.cc:2663
      #13 0x0000556f3f77e063 in btr_insert_on_non_leaf_level (flags=7, index=0x6160009d5120, level=1, tuple=0x61a0003ae720, mtr=0x7f5b2086dfc0) at /data/src/10.6/storage/innobase/btr/btr0btr.cc:2487
      #14 0x0000556f3f77ec18 in btr_attach_half_pages (flags=0, index=0x6160009d5120, block=0x7f5b29060160, split_rec=0x7f5b2981cf08 "\017\262\377", new_block=0x7f5b29057400, direction=111, mtr=0x7f5b2086dfc0) at /data/src/10.6/storage/innobase/btr/btr0btr.cc:2615
      #15 0x0000556f3f781ed6 in btr_page_split_and_insert (flags=0, cursor=0x7f5b2086dab0, offsets=0x7f5b2086d9f0, heap=0x7f5b2086da50, tuple=0x617000051440, n_ext=0, mtr=0x7f5b2086dfc0, err=0x7f5b2086d8f0) at /data/src/10.6/storage/innobase/btr/btr0btr.cc:3133
      #16 0x0000556f3f7c71ab in btr_cur_pessimistic_insert (flags=0, cursor=0x7f5b2086dab0, offsets=0x7f5b2086d9f0, heap=0x7f5b2086da50, entry=0x617000051440, rec=0x7f5b2086da10, big_rec=0x7f5b2086da30, n_ext=0, thr=0x620000015940, mtr=0x7f5b2086dfc0) at /data/src/10.6/storage/innobase/btr/btr0cur.cc:2663
      #17 0x0000556f3f597ca1 in row_ins_sec_index_entry_low (flags=0, mode=BTR_INSERT_TREE, index=0x6160009d5120, offsets_heap=0x61a0003b2898, heap=0x61a0003b1698, entry=0x617000051440, trx_id=0, thr=0x620000015940) at /data/src/10.6/storage/innobase/row/row0ins.cc:3143
      #18 0x0000556f3f598eb3 in row_ins_sec_index_entry (index=0x6160009d5120, entry=0x617000051440, thr=0x620000015940, check_foreign=true) at /data/src/10.6/storage/innobase/row/row0ins.cc:3333
      #19 0x0000556f3f599138 in row_ins_index_entry (index=0x6160009d5120, entry=0x617000051440, thr=0x620000015940) at /data/src/10.6/storage/innobase/row/row0ins.cc:3367
      #20 0x0000556f3f59a2e8 in row_ins_index_entry_step (node=0x620000015608, thr=0x620000015940) at /data/src/10.6/storage/innobase/row/row0ins.cc:3533
      #21 0x0000556f3f59ada2 in row_ins (node=0x620000015608, thr=0x620000015940) at /data/src/10.6/storage/innobase/row/row0ins.cc:3658
      #22 0x0000556f3f59bd40 in row_ins_step (thr=0x620000015940) at /data/src/10.6/storage/innobase/row/row0ins.cc:3787
      #23 0x0000556f3f5df1d6 in row_insert_for_mysql (mysql_rec=0x6190000df7c8 "\376\377\017\025\364\312\341/\230\277.\356\364;\351\240\352\203x\211\037n\277\311\376\257\355d6XZ&!\210\344\r\b\303P\3127\335w\2126\361\340\277\236i\355\302[\300\322|1\223\272\206\257\036#\3552.\002)\303\341=1\315lx\203\370\214\016\325]\230\345\243\2701*\307\207\305\352r,G\300\325\357\376W\371<rm\344\217)\257\234#\232]J\355\243\266\263ZT\232\360\345\366~\327\331\217\226B \270h\017$?\020\351]\372\377", prebuilt=0x620000015120, ins_mode=ROW_INS_NORMAL) at /data/src/10.6/storage/innobase/row/row0mysql.cc:1308
      #24 0x0000556f3f22f107 in ha_innobase::write_row (this=0x61d0002b66b8, record=0x6190000df7c8 "\376\377\017\025\364\312\341/\230\277.\356\364;\351\240\352\203x\211\037n\277\311\376\257\355d6XZ&!\210\344\r\b\303P\3127\335w\2126\361\340\277\236i\355\302[\300\322|1\223\272\206\257\036#\3552.\002)\303\341=1\315lx\203\370\214\016\325]\230\345\243\2701*\307\207\305\352r,G\300\325\357\376W\371<rm\344\217)\257\234#\232]J\355\243\266\263ZT\232\360\345\366~\327\331\217\226B \270h\017$?\020\351]\372\377") at /data/src/10.6/storage/innobase/handler/ha_innodb.cc:7906
      #25 0x0000556f3e8225cc in handler::ha_write_row (this=0x61d0002b66b8, buf=0x6190000df7c8 "\376\377\017\025\364\312\341/\230\277.\356\364;\351\240\352\203x\211\037n\277\311\376\257\355d6XZ&!\210\344\r\b\303P\3127\335w\2126\361\340\277\236i\355\302[\300\322|1\223\272\206\257\036#\3552.\002)\303\341=1\315lx\203\370\214\016\325]\230\345\243\2701*\307\207\305\352r,G\300\325\357\376W\371<rm\344\217)\257\234#\232]J\355\243\266\263ZT\232\360\345\366~\327\331\217\226B \270h\017$?\020\351]\372\377") at /data/src/10.6/sql/handler.cc:7603
      #26 0x0000556f3dec0a1f in write_record (thd=0x62b0000bd218, table=0x6190000df298, info=0x7f5b2086f530, sink=0x0) at /data/src/10.6/sql/sql_insert.cc:2157
      #27 0x0000556f3df5b16d in read_sep_field (thd=0x62b0000bd218, info=..., table_list=0x62b0000c43e8, fields_vars=..., set_fields=..., set_values=..., read_info=..., enclosed=..., skip_lines=0, ignore_check_option_errors=true) at /data/src/10.6/sql/sql_load.cc:1182
      #28 0x0000556f3df572e0 in mysql_load (thd=0x62b0000bd218, ex=0x62b0000c4340, table_list=0x62b0000c43e8, fields_vars=..., set_fields=..., set_values=..., handle_duplicates=DUP_ERROR, ignore=true, read_file_from_client=true) at /data/src/10.6/sql/sql_load.cc:687
      #29 0x0000556f3df872e0 in mysql_execute_command (thd=0x62b0000bd218, is_called_from_prepared_stmt=false) at /data/src/10.6/sql/sql_parse.cc:5040
      #30 0x0000556f3df9b437 in mysql_parse (thd=0x62b0000bd218, rawbuf=0x62b0000c4238 "LOAD DATA LOCAL INFILE '/tmp/earth.jpg' INTO TABLE t", length=52, parser_state=0x7f5b20870a30) at /data/src/10.6/sql/sql_parse.cc:8036
      #31 0x0000556f3df7127e in dispatch_command (command=COM_QUERY, thd=0x62b0000bd218, packet=0x629000280219 "x\301\034yD\v\036]\271%rC\206\270\241\262\357\310\263&\374\265\326\355\24176\002+\221\300\232'\027\252\376\327\302\337\360\277\360\271\037\261\363\005\312\247\350\353\366\375\325x\221\"\203\307\374\226\3449\377", packet_length=52, blocking=true) at /data/src/10.6/sql/sql_parse.cc:1896
      #32 0x0000556f3df6dfbc in do_command (thd=0x62b0000bd218, blocking=true) at /data/src/10.6/sql/sql_parse.cc:1409
      #33 0x0000556f3e3d983a in do_handle_one_connection (connect=0x608000003938, put_in_cache=true) at /data/src/10.6/sql/sql_connect.cc:1416
      #34 0x0000556f3e3d91fb in handle_one_connection (arg=0x6080000038b8) at /data/src/10.6/sql/sql_connect.cc:1318
      #35 0x0000556f3f032f08 in pfs_spawn_thread (arg=0x617000008218) at /data/src/10.6/storage/perfschema/pfs.cc:2201
      #36 0x00007f5b316a7fd4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #37 0x00007f5b317285bc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      The failure started happening on 10.6+ after this commit

      commit f2096478d5750b983f9a9cc4691d20e152dafd4a
      Author: Marko Mäkelä
      Date:   Thu Mar 16 15:52:42 2023 +0200
       
          MDEV-29835 InnoDB hang on B-tree split or merge
      

      Attachments

        1. earth.jpg
          1.84 MB
          Elena Stepanova

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.