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

Index corruption and/or assertion failure upon using RANDOM_BYTES for indexed virtual column

    XMLWordPrintable

Details

    Description

      create table t (a int, b binary(32) as (random_bytes(a)), key(b));
      insert into t (a) values (1),(2);
      select a, hex(b) from t;
      update t set a = 3;
      select a, hex(b) from t;
       
      # Cleanup
      drop table t;
      

      bb-10.10-MDEV-25704 1303dfde0 with InnoDB

      2022-07-05  2:18:14 4 [ERROR] InnoDB: Record in index `b` of table `test`.`t` was not found on update: TUPLE (info_bits=0, 2 fields): {[32]                                (0x8500000000000000000000000000000000000000000000000000000000000000),[6]      (0x000000000200)} at: COMPACT RECORD(info_bits=0, 2 fields): {[32](                               (0x28EE000000000000000000000000000000000000000000000000000000000000),[6]      (0x000000000201)}
      mariadbd: /data/src/bb-10.10-MDEV-25704/storage/innobase/row/row0upd.cc:1970: dberr_t row_upd_sec_index_entry(upd_node_t*, que_thr_t*): Assertion `0' failed.
      220705  2:18:14 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fbfb1300662 in __GI___assert_fail (assertion=assertion@entry=0x5640393e89a0 "0", file=file@entry=0x5640393f1ba0 "/data/src/bb-10.10-MDEV-25704/storage/innobase/row/row0upd.cc", line=line@entry=1970, function=function@entry=0x5640393effe0 "dberr_t row_upd_sec_index_entry(upd_node_t*, que_thr_t*)") at assert.c:101
      No locals.
      #8  0x0000564037934973 in row_upd_sec_index_entry (node=node@entry=0x620000014bd8, thr=thr@entry=0x6240000f0258) at /data/src/bb-10.10-MDEV-25704/storage/innobase/row/row0upd.cc:1970
              mtr = {m_start = <optimized out>, m_commit = <optimized out>, m_freeing_tree = <optimized out>, m_last = <optimized out>, m_last_offset = <optimized out>, m_log_mode = <optimized out>, m_modifications = <optimized out>, m_made_dirty = <optimized out>, m_latch_ex = <optimized out>, m_inside_ibuf = <optimized out>, m_trim_pages = <optimized out>, m_crc = <optimized out>, m_user_space_id = <optimized out>, m_memo = {m_heap = <optimized out>, m_list = {<ilist<mtr_buf_t::block_t, void>> = {sentinel_ = {next = <optimized out>, prev = <optimized out>}}, size_ = <optimized out>}, m_size = <optimized out>, m_first_block = {<ilist_node<void>> = {next = <optimized out>, prev = <optimized out>}, m_buf_end = <optimized out>, m_magic_n = <optimized out>, m_data = {<optimized out> <repeats 500 times>}, m_used = <optimized out>}}, m_log = {m_heap = <optimized out>, m_list = {<ilist<mtr_buf_t::block_t, void>> = {sentinel_ = {next = <optimized out>, prev = <optimized out>}}, size_ = <optimized out>}, m_size = <optimized out>, m_first_block = {<ilist_node<void>> = {next = <optimized out>, prev = <optimized out>}, m_buf_end = <optimized out>, m_magic_n = <optimized out>, m_data = {<optimized out> <repeats 500 times>}, m_used = <optimized out>}}, m_user_space = <optimized out>, m_commit_lsn = <optimized out>, m_freed_space = <optimized out>, m_freed_pages = <optimized out>}
              rec = 0x7fbfa63680aa "(\356"
              pcur = {btr_cur = {index = <optimized out>, page_cur = {index = <optimized out>, rec = <optimized out>, offsets = <optimized out>, block = <optimized out>}, purge_node = <optimized out>, left_block = <optimized out>, thr = <optimized out>, flag = <optimized out>, tree_height = <optimized out>, up_match = <optimized out>, up_bytes = <optimized out>, low_match = <optimized out>, low_bytes = <optimized out>, n_fields = <optimized out>, n_bytes = <optimized out>, fold = <optimized out>, path_arr = <optimized out>, rtr_info = <optimized out>}, latch_mode = <optimized out>, old_stored = <optimized out>, old_rec = <optimized out>, old_n_core_fields = <optimized out>, old_n_fields = <optimized out>, rel_pos = <optimized out>, block_when_stored = {m_block = <optimized out>, m_page_id = {m_id = <optimized out>}}, modify_clock = <optimized out>, pos_state = <optimized out>, search_mode = <optimized out>, trx_if_known = <optimized out>, old_rec_buf = <optimized out>, buf_size = <optimized out>}
              heap = <optimized out>
              entry = <optimized out>
              index = 0x6160009df320
              btr_cur = 0x7fbfa172c410
              err = DB_SUCCESS
              trx = 0x7fbfa7031340
              mode = <optimized out>
              flags = 0
              search_result = <optimized out>
              __PRETTY_FUNCTION__ = "dberr_t row_upd_sec_index_entry(upd_node_t*, que_thr_t*)"
              referenced = false
              foreign = false
      #9  0x0000564037936112 in row_upd_sec_step (node=node@entry=0x620000014bd8, thr=thr@entry=0x6240000f0258) at /data/src/bb-10.10-MDEV-25704/storage/innobase/row/row0upd.cc:2095
              __PRETTY_FUNCTION__ = "dberr_t row_upd_sec_step(upd_node_t*, que_thr_t*)"
      #10 0x000056403793a51f in row_upd (node=node@entry=0x620000014bd8, thr=thr@entry=0x6240000f0258) at /data/src/bb-10.10-MDEV-25704/storage/innobase/row/row0upd.cc:2819
              err = DB_SUCCESS
              _db_stack_frame_ = {func = <optimized out>, file = <optimized out>, level = <optimized out>, line = <optimized out>, prev = <optimized out>}
              __PRETTY_FUNCTION__ = "dberr_t row_upd(upd_node_t*, que_thr_t*)"
      #11 0x000056403793b4a2 in row_upd_step (thr=thr@entry=0x6240000f0258) at /data/src/bb-10.10-MDEV-25704/storage/innobase/row/row0upd.cc:2934
              node = 0x620000014bd8
              sel_node = 0x0
              parent = 0x6240000f0258
              err = <optimized out>
              trx = 0x7fbfa7031340
              _db_stack_frame_ = {func = <optimized out>, file = <optimized out>, level = <optimized out>, line = <optimized out>, prev = <optimized out>}
              __PRETTY_FUNCTION__ = "que_thr_t* row_upd_step(que_thr_t*)"
      #12 0x00005640377f1e36 in row_update_for_mysql (prebuilt=0x620000014120) at /data/src/bb-10.10-MDEV-25704/storage/innobase/row/row0mysql.cc:1685
              was_lock_wait = <optimized out>
              savept = {least_undo_no = <optimized out>}
              err = <optimized out>
              thr = <optimized out>
              clust_index = <optimized out>
              node = <optimized out>
              table = 0x61800004b120
              trx = <optimized out>
              fk_depth = <optimized out>
              _db_stack_frame_ = {func = <optimized out>, file = <optimized out>, level = <optimized out>, line = <optimized out>, prev = <optimized out>}
              __PRETTY_FUNCTION__ = "dberr_t row_update_for_mysql(row_prebuilt_t*)"
              is_delete = false
              update_statistics = <optimized out>
      #13 0x000056403714a14b in ha_innobase::update_row (this=0x61d0002d1eb8, old_row=<optimized out>, new_row=<optimized out>) at /data/src/bb-10.10-MDEV-25704/storage/innobase/handler/ha_innodb.cc:8585
              vers_set_fields = <optimized out>
              vers_ins_row = false
              err = <optimized out>
              error = <optimized out>
              trx = 0x7fbfa7031340
              _db_stack_frame_ = {func = <optimized out>, file = <optimized out>, level = <optimized out>, line = <optimized out>, prev = <optimized out>}
              __PRETTY_FUNCTION__ = "virtual int ha_innobase::update_row(const uchar*, const uchar*)"
              uvect = <optimized out>
              autoinc = <optimized out>
      #14 0x00005640352161d4 in handler::ha_update_row (this=this@entry=0x61d0002d1eb8, old_data=<optimized out>, new_data=<optimized out>) at /data/src/bb-10.10-MDEV-25704/sql/handler.cc:7604
              sub_locker = 0x7fbfa172d190
              reentrant_safe_state = {m_flags = <optimized out>, m_io_operation = <optimized out>, m_table = <optimized out>, m_table_share = <optimized out>, m_thread = <optimized out>, m_timer_start = <optimized out>, m_timer = <optimized out>, m_wait = <optimized out>, m_index = <optimized out>}
              this_tracker = <optimized out>
              error = 0
              __PRETTY_FUNCTION__ = "int handler::ha_update_row(const uchar*, const uchar*)"
              saved_status = <optimized out>
      #15 0x000056403403d9d0 in mysql_update (thd=thd@entry=0x62b00017a218, table_list=<optimized out>, fields=@0x62b00017f0d8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x629000109c10, last = 0x629000109c10, elements = 1}, <No data fields>}, values=@0x62b00017f508: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x629000109c28, last = 0x629000109c28, elements = 1}, <No data fields>}, conds=conds@entry=0x0, order_num=order_num@entry=0, order=<optimized out>, limit=18446744073709551615, ignore=<optimized out>, found_return=<optimized out>, updated_return=<optimized out>) at /data/src/bb-10.10-MDEV-25704/sql/sql_update.cc:1095
              record_was_same = false
              need_update = true
              using_limit = <optimized out>
              safe_update = <optimized out>
              used_key_is_modified = <optimized out>
              transactional_table = <optimized out>
              will_batch = false
              can_compare_record = true
              res = <optimized out>
              error = <optimized out>
              loc_error = <optimized out>
              dup_key_found = <optimized out>
              need_sort = <optimized out>
              reverse = <optimized out>
              want_privilege = <optimized out>
              table_count = <optimized out>
              updated = 0
              updated_or_same = <optimized out>
              found = 1
              old_covering_keys = {buffer = {<optimized out>}}
              table = 0x6190000edd98
              select = <optimized out>
              file_sort = <optimized out>
              info = {table = <optimized out>, unlock_row = <optimized out>, read_record_func = <optimized out>, read_record_func_and_unpack_calls = <optimized out>, thd = <optimized out>, select = <optimized out>, ref_length = <optimized out>, reclength = <optimized out>, rec_cache_size = <optimized out>, error_offset = <optimized out>, unpack_counter = <optimized out>, ref_pos = <optimized out>, rec_buf = <optimized out>, cache = <optimized out>, cache_pos = <optimized out>, cache_end = <optimized out>, read_positions = <optimized out>, sort_info = <optimized out>, io_cache = <optimized out>, print_error = <optimized out>, copy_field = <optimized out>, copy_field_end = <optimized out>}
              select_lex = <optimized out>
              id = <optimized out>
              all_fields = {<base_list> = {<Sql_alloc> = {<No data fields>}, first = <optimized out>, last = <optimized out>, elements = <optimized out>}, <No data fields>}
              killed_status = NOT_KILLED
              has_triggers = <optimized out>
              binlog_is_row = <optimized out>
              do_direct_update = <optimized out>
              query_plan = {_vptr.Update_plan = <optimized out>, impossible_where = <optimized out>, no_partitions = <optimized out>, mem_root = <optimized out>, table = <optimized out>, select = <optimized out>, index = <optimized out>, scanned_rows = <optimized out>, select_lex = <optimized out>, possible_keys = {buffer = {<optimized out>}}, using_filesort = <optimized out>, using_io_buffer = <optimized out>}
              explain = <optimized out>
              update_source_table = <optimized out>
              rows_inserted = <optimized out>
              _db_stack_frame_ = {func = <optimized out>, file = <optimized out>, level = <optimized out>, line = <optimized out>, prev = <optimized out>}
              __PRETTY_FUNCTION__ = "int mysql_update(THD*, TABLE_LIST*, List<Item>&, List<Item>&, COND*, uint, ORDER*, ha_rows, bool, ha_rows*, ha_rows*)"
              has_vers_fields = <optimized out>
              err2 = <optimized out>
      #16 0x0000564033766bb4 in mysql_execute_command (thd=thd@entry=0x62b00017a218, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /data/src/bb-10.10-MDEV-25704/sql/sql_parse.cc:4405
              found = <optimized out>
              updated = <optimized out>
              res = 0
              up_result = 0
              lex = 0x62b00017e560
              select_lex = 0x62b00017ee38
              first_table = 0x629000109338
              all_tables = <optimized out>
              unit = 0x62b00017e638
              have_table_map_for_update = false
              rpl_filter = <optimized out>
              _db_stack_frame_ = {func = <optimized out>, file = <optimized out>, level = <optimized out>, line = <optimized out>, prev = <optimized out>}
              __PRETTY_FUNCTION__ = "int mysql_execute_command(THD*, bool)"
              ots = {ctx = <optimized out>, traceable = <optimized out>}
              orig_binlog_format = <optimized out>
              orig_current_stmt_binlog_format = <optimized out>
      #17 0x000056403378e9f3 in mysql_parse (thd=thd@entry=0x62b00017a218, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7fbfa172eba0) at /data/src/bb-10.10-MDEV-25704/sql/sql_parse.cc:8036
              found_semicolon = 0x0
              error = <optimized out>
              lex = 0x62b00017e560
              err = <optimized out>
              _db_stack_frame_ = {func = <optimized out>, file = <optimized out>, level = <optimized out>, line = <optimized out>, prev = <optimized out>}
              __PRETTY_FUNCTION__ = "void mysql_parse(THD*, char*, uint, Parser_state*)"
      #18 0x00005640337a07d9 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x62b00017a218, packet=packet@entry=0x62900028f219 "update t set a = 3", packet_length=packet_length@entry=18, blocking=blocking@entry=true) at /data/src/bb-10.10-MDEV-25704/sql/sql_parse.cc:1894
              packet_end = 0x62900010924a ""
              parser_state = {m_lip = {lookahead_token = <optimized out>, lookahead_yylval = <optimized out>, m_thd = <optimized out>, m_ptr = <optimized out>, m_tok_start = <optimized out>, m_tok_end = <optimized out>, m_end_of_query = <optimized out>, m_tok_start_prev = <optimized out>, m_buf = <optimized out>, m_buf_length = <optimized out>, m_echo = <optimized out>, m_echo_saved = <optimized out>, m_cpp_buf = <optimized out>, m_cpp_ptr = <optimized out>, m_cpp_tok_start = <optimized out>, m_cpp_tok_start_prev = <optimized out>, m_cpp_tok_end = <optimized out>, m_body_utf8 = <optimized out>, m_body_utf8_ptr = <optimized out>, m_cpp_utf8_processed_ptr = <optimized out>, next_state = <optimized out>, found_semicolon = <optimized out>, ignore_space = <optimized out>, stmt_prepare_mode = <optimized out>, multi_statements = <optimized out>, yylineno = <optimized out>, m_digest = <optimized out>, in_comment = <optimized out>, in_comment_saved = <optimized out>, m_cpp_text_start = <optimized out>, m_cpp_text_end = <optimized out>, m_underscore_cs = <optimized out>}, m_yacc = {yacc_yyss = <optimized out>, yacc_yyvs = <optimized out>, m_set_signal_info = {m_item = {<optimized out> <repeats 13 times>}}, m_lock_type = <optimized out>, m_mdl_type = <optimized out>}, m_digest_psi = <optimized out>}
              net = 0x62b00017a550
              error = false
              do_end_of_statement = true
              _db_stack_frame_ = {func = <optimized out>, file = <optimized out>, level = <optimized out>, line = <optimized out>, prev = <optimized out>}
              drop_more_results = false
              __PRETTY_FUNCTION__ = "dispatch_command_return dispatch_command(enum_server_command, THD*, char*, uint, bool)"
              __FUNCTION__ = "dispatch_command"
              res = <optimized out>
      #19 0x00005640337b4992 in do_command (thd=0x62b00017a218, blocking=blocking@entry=true) at /data/src/bb-10.10-MDEV-25704/sql/sql_parse.cc:1407
              return_value = <optimized out>
              packet = 0x62900028f218 "\003update t set a = 3"
              packet_length = 19
              net = 0x62b00017a550
              command = COM_QUERY
              _db_stack_frame_ = {func = <optimized out>, file = <optimized out>, level = <optimized out>, line = <optimized out>, prev = <optimized out>}
              __PRETTY_FUNCTION__ = "dispatch_command_return do_command(THD*, bool)"
              __FUNCTION__ = "do_command"
      #20 0x00005640342ecfeb in do_handle_one_connection (connect=<optimized out>, connect@entry=0x6080000107b8, put_in_cache=put_in_cache@entry=true) at /data/src/bb-10.10-MDEV-25704/sql/sql_connect.cc:1418
              create_user = true
              thr_create_utime = 3398806356207
              thd = <optimized out>
              __PRETTY_FUNCTION__ = "void do_handle_one_connection(CONNECT*, bool)"
      #21 0x00005640342eead3 in handle_one_connection (arg=0x6080000107b8) at /data/src/bb-10.10-MDEV-25704/sql/sql_connect.cc:1312
              connect = 0x6080000107b8
      #22 0x0000564036c22409 in pfs_spawn_thread (arg=0x617000006d18) at /data/src/bb-10.10-MDEV-25704/storage/perfschema/pfs.cc:2201
              typed_arg = 0x617000006d18
              user_arg = 0x6080000107b8
              user_start_routine = 0x5640342ee8e5 <handle_one_connection(void*)>
              pfs = <optimized out>
              klass = <optimized out>
      #23 0x00007fbfb2136ea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
              ret = <optimized out>
              pd = <optimized out>
              unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140461024151296, -7442672373028694203, 140736385992638, 140736385992639, 140461024149248, 1060864, 7478528503781185349, 7478566716643530565}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
              not_first_call = 0
      #24 0x00007fbfb13c9def in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      bb-10.10-MDEV-25704 1303dfde0 with MyISAM

      select a, hex(b) from t;
      a	hex(b)
      1	2000000000000000000000000000000000000000000000000000000000000000
      2	8EFA000000000000000000000000000000000000000000000000000000000000
      update t set a = 3;
      bug.t2                                   [ fail ]
              Test ended at 2022-07-05 01:49:42
       
      CURRENT_TEST: bug.t2
      mysqltest: At line 4: query 'update t set a = 3' failed: HA_ERR_CRASHED (126): Index for table './test/t.MYI' is corrupt; try to repair it
      

      Attachments

        Issue Links

          Activity

            People

              danblack Daniel Black
              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.