diff options
Diffstat (limited to 'storage/innobase/row')
-rw-r--r-- | storage/innobase/row/row0upd.cc | 155 |
1 files changed, 1 insertions, 154 deletions
diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc index 82910ace04f..97094abc8a3 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -585,163 +585,10 @@ row_upd_changes_disowned_external( return(false); } -/***********************************************************//** -Replaces the new column values stored in the update vector to the -record given. No field size changes are allowed. This function is -usually invoked on a clustered index. The only use case for a -secondary index is row_ins_sec_index_entry_by_modify() or its -counterpart in ibuf_insert_to_index_page(). */ -void -row_upd_rec_in_place( -/*=================*/ - rec_t* rec, /*!< in/out: record where replaced */ - dict_index_t* index, /*!< in: the index the record belongs to */ - const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */ - const upd_t* update, /*!< in: update vector */ - page_zip_des_t* page_zip)/*!< in: compressed page with enough space - available, or NULL */ -{ - const upd_field_t* upd_field; - const dfield_t* new_val; - ulint n_fields; - ulint i; - - ut_ad(rec_offs_validate(rec, index, offsets)); - ut_ad(!index->table->skip_alter_undo); - - if (rec_offs_comp(offsets)) { -#ifdef UNIV_DEBUG - switch (rec_get_status(rec)) { - case REC_STATUS_ORDINARY: - break; - case REC_STATUS_INSTANT: - ut_ad(index->is_instant()); - break; - case REC_STATUS_NODE_PTR: - if (index->is_dummy - && fil_page_get_type(page_align(rec)) - == FIL_PAGE_RTREE) { - /* The function rtr_update_mbr_field_in_place() - is generating MLOG_COMP_REC_UPDATE_IN_PLACE - and MLOG_REC_UPDATE_IN_PLACE records for - node pointer pages. */ - break; - } - /* fall through */ - case REC_STATUS_INFIMUM: - case REC_STATUS_SUPREMUM: - ut_ad(!"wrong record status in update"); - } -#endif /* UNIV_DEBUG */ - - rec_set_info_bits_new(rec, update->info_bits); - } else { - rec_set_info_bits_old(rec, update->info_bits); - } - - n_fields = upd_get_n_fields(update); - - for (i = 0; i < n_fields; i++) { - upd_field = upd_get_nth_field(update, i); - - /* No need to update virtual columns for non-virtual index */ - if (upd_fld_is_virtual_col(upd_field) - && !dict_index_has_virtual(index)) { - continue; - } - - new_val = &(upd_field->new_val); - ut_ad(!dfield_is_ext(new_val) == - !rec_offs_nth_extern(offsets, upd_field->field_no)); - - rec_set_nth_field(rec, offsets, upd_field->field_no, - dfield_get_data(new_val), - dfield_get_len(new_val)); - } - - if (page_zip) { - page_zip_write_rec(page_zip, rec, index, offsets, 0); - } -} - -/***********************************************************//** -Writes to the redo log the new values of the fields occurring in the index. */ -void -row_upd_index_write_log( -/*====================*/ - const upd_t* update, /*!< in: update vector */ - byte* log_ptr,/*!< in: pointer to mlog buffer: must - contain at least MLOG_BUF_MARGIN bytes - of free space; the buffer is closed - within this function */ - mtr_t* mtr) /*!< in: mtr into whose log to write */ -{ - const upd_field_t* upd_field; - const dfield_t* new_val; - ulint len; - ulint n_fields; - byte* buf_end; - ulint i; - - n_fields = upd_get_n_fields(update); - - buf_end = log_ptr + MLOG_BUF_MARGIN; - - mach_write_to_1(log_ptr, update->info_bits); - log_ptr++; - log_ptr += mach_write_compressed(log_ptr, n_fields); - - for (i = 0; i < n_fields; i++) { - compile_time_assert(MLOG_BUF_MARGIN > 30); - - if (log_ptr + 30 > buf_end) { - mlog_close(mtr, log_ptr); - - log_ptr = mlog_open(mtr, MLOG_BUF_MARGIN); - buf_end = log_ptr + MLOG_BUF_MARGIN; - } - - upd_field = upd_get_nth_field(update, i); - - new_val = &(upd_field->new_val); - - len = dfield_get_len(new_val); - - /* If this is a virtual column, mark it using special - field_no */ - ulint field_no = upd_fld_is_virtual_col(upd_field) - ? REC_MAX_N_FIELDS + unsigned(upd_field->field_no) - : unsigned(upd_field->field_no); - - log_ptr += mach_write_compressed(log_ptr, field_no); - log_ptr += mach_write_compressed(log_ptr, len); - - if (len != UNIV_SQL_NULL) { - if (log_ptr + len < buf_end) { - memcpy(log_ptr, dfield_get_data(new_val), len); - - log_ptr += len; - } else { - mlog_close(mtr, log_ptr); - - mlog_catenate_string( - mtr, - static_cast<const byte*>( - dfield_get_data(new_val)), - len); - - log_ptr = mlog_open(mtr, MLOG_BUF_MARGIN); - buf_end = log_ptr + MLOG_BUF_MARGIN; - } - } - } - - mlog_close(mtr, log_ptr); -} - /*********************************************************************//** Parses the log data written by row_upd_index_write_log. @return log data end or NULL */ +ATTRIBUTE_COLD /* only used when crash-upgrading */ byte* row_upd_index_parse( /*================*/ |