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

ibuf_insert tries to insert the entry for uncommitted index

    XMLWordPrintable

Details

    Description

      This issue has found during the testing of MDEV-30009:

      mysqld: /data/Server/bb-10.6-MDEV-30009/storage/innobase/include/dict0dict.inl:82: ulint dict_col_type_assert_equal(const dict_col_t*, const dtype_t*): Assertion `col->mtype == type->mtype' failed.
      sdp:/data/results/1669148461/TBR-1670$ _RR_TRACE_DIR=./1/rr rr replay --mark-stdio
      

      The purge tries to do ibuf_insert() for the uncommitted index:

      #5  0x00007f9389df071b in __assert_fail_base (fmt=0x7f9389fa5150 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
          assertion=0x56509dfb9760 "col->mtype == type->mtype", 
          file=0x56509dfb94a0 "/data/Server/bb-10.6-MDEV-30009/storage/innobase/include/dict0dict.inl", line=82, function=<optimized out>)
          at ./assert/assert.c:92
      #6  0x00007f9389e01e96 in __GI___assert_fail (assertion=0x56509dfb9760 "col->mtype == type->mtype", 
          file=0x56509dfb94a0 "/data/Server/bb-10.6-MDEV-30009/storage/innobase/include/dict0dict.inl", line=82, 
          function=0x56509dfb97a0 "ulint dict_col_type_assert_equal(const dict_col_t*, const dtype_t*)") at ./assert/assert.c:101
      #7  0x000056509cfb513a in dict_col_type_assert_equal (col=0x6190000f1848, type=type@entry=0x619000afe750)
          at /data/Server/bb-10.6-MDEV-30009/storage/innobase/include/dict0dict.inl:82
      #8  0x000056509cfb9e92 in rec_get_converted_size_comp_prefix_low<>(const dict_index_t *, const dfield_t *, ulint, ulint *, rec_comp_status_t, bool) (index=index@entry=0x616004b30d08, dfield=0x619000afe740, n_fields=<optimized out>, extra=extra@entry=0x0, 
          status=status@entry=REC_STATUS_ORDINARY, temp=temp@entry=false) at /data/Server/bb-10.6-MDEV-30009/storage/innobase/rem/rem0rec.cc:1212
      #9  0x000056509cfc9a5c in rec_get_converted_size_comp (index=index@entry=0x616004b30d08, tuple=tuple@entry=0x619000afe708, extra=extra@entry=0x0)
          at /data/Server/bb-10.6-MDEV-30009/storage/innobase/rem/rem0rec.cc:1338
      #10 0x000056509ce01966 in rec_get_converted_size (index=index@entry=0x616004b30d08, dtuple=dtuple@entry=0x619000afe708, n_ext=n_ext@entry=0)
          at /data/Server/bb-10.6-MDEV-30009/storage/innobase/include/rem0rec.inl:1120
      #11 0x000056509ce279ff in ibuf_insert (op=op@entry=IBUF_OP_DELETE, entry=entry@entry=0x619000afe708, index=index@entry=0x616004b30d08, 
          page_id=..., zip_size=zip_size@entry=2048, thr=<optimized out>) at /data/Server/bb-10.6-MDEV-30009/storage/innobase/ibuf/ibuf0ibuf.cc:3568
      #12 0x000056509d2cc71b in btr_cur_search_to_nth_level (level=level@entry=0, tuple=tuple@entry=0x619000afe708, mode=mode@entry=PAGE_CUR_LE, 
          latch_mode=latch_mode@entry=BTR_PURGE_LEAF, cursor=cursor@entry=0x7f936761f340, mtr=mtr@entry=0x7f936761f820, autoinc=<optimized out>)
          at /data/Server/bb-10.6-MDEV-30009/storage/innobase/btr/btr0cur.cc:1619
      #13 0x000056509d0e7e82 in btr_pcur_open (mtr=0x7f936761f820, autoinc=0, cursor=0x7f936761f340, latch_mode=BTR_PURGE_LEAF, mode=PAGE_CUR_LE, 
          tuple=0x619000afe708) at /data/Server/bb-10.6-MDEV-30009/storage/innobase/include/btr0pcur.inl:325
      #14 row_search_index_entry (entry=entry@entry=0x619000afe708, mode=mode@entry=BTR_PURGE_LEAF, pcur=pcur@entry=0x7f936761f340, 
          mtr=mtr@entry=0x7f936761f820) at /data/Server/bb-10.6-MDEV-30009/storage/innobase/row/row0row.cc:1286
      #15 0x000056509d0cdeb5 in row_purge_remove_sec_if_poss_leaf (node=node@entry=0x61a000009fb8, index=index@entry=0x616004b30d08, 
          entry=entry@entry=0x619000afe708) at /data/Server/bb-10.6-MDEV-30009/storage/innobase/row/row0purge.cc:471
      #16 0x000056509d0cfc63 in row_purge_remove_sec_if_poss (entry=0x619000afe708, index=0x616004b30d08, node=0x61a000009fb8)
          at /data/Server/bb-10.6-MDEV-30009/storage/innobase/row/row0purge.cc:573
      #17 row_purge_upd_exist_or_extern_func (thr=thr@entry=0x61a000009f10, node=node@entry=0x61a000009fb8, undo_rec=undo_rec@entry=0x6210000490b8 "")
          at /data/Server/bb-10.6-MDEV-30009/storage/innobase/row/row0purge.cc:773
      

      Meanwhile the alter is waiting for exclusive MDL:

      #16 MDL_wait::timed_wait (this=this@entry=0x62b000149370, owner=0x62b000149300, abs_timeout=abs_timeout@entry=0x7f936958c240, 
          set_status_on_timeout=set_status_on_timeout@entry=false, wait_state_name=<optimized out>) at /data/Server/bb-10.6-MDEV-30009/sql/mdl.cc:1207
      #17 0x000056509be0be62 in MDL_context::acquire_lock (this=this@entry=0x62b000149370, mdl_request=mdl_request@entry=0x7f936958c340, 
          lock_wait_timeout=lock_wait_timeout@entry=2) at /data/Server/bb-10.6-MDEV-30009/sql/mdl.cc:2388
      #18 0x000056509be0d9be in MDL_context::upgrade_shared_lock (this=this@entry=0x62b000149370, mdl_ticket=0x6070000f75c0, 
          new_type=new_type@entry=MDL_EXCLUSIVE, lock_wait_timeout=<optimized out>) at /data/Server/bb-10.6-MDEV-30009/sql/mdl.cc:2597
      #19 0x000056509b806789 in wait_while_table_is_used (thd=thd@entry=0x62b000149218, table=table@entry=0x6190009d1298, 
          function=function@entry=HA_EXTRA_PREPARE_FOR_RENAME) at /data/Server/bb-10.6-MDEV-30009/sql/sql_base.cc:1344
      #20 0x000056509bc2f3ec in mysql_inplace_alter_table (thd=thd@entry=0x62b000149218, table_list=<optimized out>, table=table@entry=0x6190009d1298, 
          altered_table=altered_table@entry=0x7f936958dbf0, ha_alter_info=ha_alter_info@entry=0x7f936958d4f0, 
          target_mdl_request=target_mdl_request@entry=0x7f936958d5f0, ddl_log_state=<optimized out>, trigger_param=<optimized out>, 
          alter_ctx=<optimized out>) at /data/Server/bb-10.6-MDEV-30009/sql/sql_table.cc:7427
      #21 0x000056509bc6666c in mysql_alter_table (thd=thd@entry=0x62b000149218, new_db=new_db@entry=0x62b00014dc48, 
      --Type <RET> for more, q to quit, c to continue without paging--
          new_name=new_name@entry=0x62b00014e060, create_info=0x7f936958ff70, table_list=table_list@entry=0x62b000118418, alter_info=<optimized out>, 
          order_num=<optimized out>, order=<optimized out>, ignore=<optimized out>, if_exists=<optimized out>)
          at /data/Server/bb-10.6-MDEV-30009/sql/sql_table.cc:10347
      #22 0x000056509bdf88cf in Sql_cmd_alter_table::execute (this=<optimized out>, thd=0x62b000149218)
          at /data/Server/bb-10.6-MDEV-30009/sql/sql_alter.cc:552
      #23 0x000056509b9b71c6 in mysql_execute_command (thd=thd@entry=0x62b000149218, 
          is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /data/Server/bb-10.6-MDEV-30009/sql/sql_parse.cc:5997
      #24 0x000056509b9b957e in mysql_parse (thd=thd@entry=0x62b000149218, rawbuf=<optimized out>, length=<optimized out>, 
          parser_state=parser_state@entry=0x7f9369591620) at /data/Server/bb-10.6-MDEV-30009/sql/sql_parse.cc:8016
      #25 0x000056509b9bfdb9 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x62b000149218, 
          packet=packet@entry=0x629000b8b219 " ALTER TABLE t2 MODIFY COLUMN col_string VARCHAR(20) NULL, LOCK = SHARED, ALGORITHM = NOCOPY  /* E_R Thread8 QNO 1783 CON_ID 160 */ ", packet_length=packet_length@entry=132, blocking=blocking@entry=true)
          at /data/Server/bb-10.6-MDEV-30009/sql/sql_parse.cc:1896
      #26 0x000056509b9c4e18 in do_command (thd=0x62b000149218, blocking=blocking@entry=true) at /data/Server/bb-10.6-MDEV-30009/sql/sql_parse.cc:1409
      #27 0x000056509bde0786 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x6080000033b8, put_in_cache=put_in_cache@entry=true)
          at /data/Server/bb-10.6-MDEV-30009/sql/sql_connect.cc:1415
      #28 0x000056509bde0dec in handle_one_connection (arg=0x6080000033b8) at /data/Server/bb-10.6-MDEV-30009/sql/sql_connect.cc:1317
      #29 0x00007f9389e5cb43 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #30 0x00007f9389eedbb4 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:100
      

      Possible fix is to do the following in ibuf_insert()

      if (!index->is_committed())
        DBUG_RETURN(false);
      

      Write a mtr test case to repeat the scenario. As of now, it should be repeatable due to MDEV-26294

      Attachments

        Activity

          People

            thiru Thirunarayanan Balathandayuthapani
            thiru Thirunarayanan Balathandayuthapani
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.