diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-10-05 20:30:57 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-10-05 20:30:57 +0300 |
commit | 65d0c57c1a2036c8a8c065d3e3bd4f85d0cc5d57 (patch) | |
tree | 9165f331634b0725bcf628390fcfd8a3381f7147 /storage/innobase/trx | |
parent | df97eb1432f91ad13e562111bda393b3650719d0 (diff) | |
parent | c0eda62aec1de8b74ca51791df5ad142dee2ef08 (diff) | |
download | mariadb-git-65d0c57c1a2036c8a8c065d3e3bd4f85d0cc5d57.tar.gz |
Merge 10.3 into 10.4
Diffstat (limited to 'storage/innobase/trx')
-rw-r--r-- | storage/innobase/trx/trx0rec.cc | 179 | ||||
-rw-r--r-- | storage/innobase/trx/trx0trx.cc | 2 |
2 files changed, 2 insertions, 179 deletions
diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc index 4ef7a043104..22d8915f582 100644 --- a/storage/innobase/trx/trx0rec.cc +++ b/storage/innobase/trx/trx0rec.cc @@ -1762,185 +1762,6 @@ trx_undo_update_rec_get_update( return(const_cast<byte*>(ptr)); } -/*******************************************************************//** -Builds a partial row from an update undo log record, for purge. -It contains the columns which occur as ordering in any index of the table. -Any missing columns are indicated by col->mtype == DATA_MISSING. -@return pointer to remaining part of undo record */ -byte* -trx_undo_rec_get_partial_row( -/*=========================*/ - const byte* ptr, /*!< in: remaining part in update undo log - record of a suitable type, at the start of - the stored index columns; - NOTE that this copy of the undo log record must - be preserved as long as the partial row is - used, as we do NOT copy the data in the - record! */ - dict_index_t* index, /*!< in: clustered index */ - const upd_t* update, /*!< in: updated columns */ - dtuple_t** row, /*!< out, own: partial row */ - ibool ignore_prefix, /*!< in: flag to indicate if we - expect blob prefixes in undo. Used - only in the assertion. */ - mem_heap_t* heap) /*!< in: memory heap from which the memory - needed is allocated */ -{ - const byte* end_ptr; - bool first_v_col = true; - bool is_undo_log = true; - - ut_ad(index->is_primary()); - - *row = dtuple_create_with_vcol( - heap, dict_table_get_n_cols(index->table), - dict_table_get_n_v_cols(index->table)); - - /* Mark all columns in the row uninitialized, so that - we can distinguish missing fields from fields that are SQL NULL. */ - for (ulint i = 0; i < dict_table_get_n_cols(index->table); i++) { - dfield_get_type(dtuple_get_nth_field(*row, i)) - ->mtype = DATA_MISSING; - } - - dtuple_init_v_fld(*row); - - for (const upd_field_t* uf = update->fields, * const ue - = update->fields + update->n_fields; - uf != ue; uf++) { - if (uf->old_v_val) { - continue; - } - const dict_col_t& c = *dict_index_get_nth_col(index, - uf->field_no); - if (!c.is_dropped()) { - *dtuple_get_nth_field(*row, c.ind) = uf->new_val; - } - } - - end_ptr = ptr + mach_read_from_2(ptr); - ptr += 2; - - while (ptr != end_ptr) { - dfield_t* dfield; - const byte* field; - ulint field_no; - const dict_col_t* col; - ulint len; - ulint orig_len; - bool is_virtual; - - field_no = mach_read_next_compressed(&ptr); - - is_virtual = (field_no >= REC_MAX_N_FIELDS); - - if (is_virtual) { - ptr = trx_undo_read_v_idx( - index->table, ptr, first_v_col, &is_undo_log, - &field_no); - first_v_col = false; - } - - ptr = trx_undo_rec_get_col_val(ptr, &field, &len, &orig_len); - - /* This column could be dropped or no longer indexed */ - if (field_no == ULINT_UNDEFINED) { - ut_ad(is_virtual); - continue; - } - - if (is_virtual) { - dict_v_col_t* vcol = dict_table_get_nth_v_col( - index->table, field_no); - col = &vcol->m_col; - dfield = dtuple_get_nth_v_field(*row, vcol->v_pos); - dict_col_copy_type( - &vcol->m_col, - dfield_get_type(dfield)); - } else { - col = dict_index_get_nth_col(index, field_no); - - if (col->is_dropped()) { - continue; - } - - dfield = dtuple_get_nth_field(*row, col->ind); - ut_ad(dfield->type.mtype == DATA_MISSING - || dict_col_type_assert_equal(col, - &dfield->type)); - ut_ad(dfield->type.mtype == DATA_MISSING - || dfield->len == len - || (len != UNIV_SQL_NULL - && len >= UNIV_EXTERN_STORAGE_FIELD)); - dict_col_copy_type(col, dfield_get_type(dfield)); - } - - dfield_set_data(dfield, field, len); - - if (len != UNIV_SQL_NULL - && len >= UNIV_EXTERN_STORAGE_FIELD) { - spatial_status_t spatial_status; - - /* Decode spatial status. */ - spatial_status = static_cast<spatial_status_t>( - (len & SPATIAL_STATUS_MASK) - >> SPATIAL_STATUS_SHIFT); - len &= ~SPATIAL_STATUS_MASK; - - /* Keep compatible with 5.7.9 format. */ - if (spatial_status == SPATIAL_UNKNOWN) { - spatial_status = - dict_col_get_spatial_status(col); - } - - switch (spatial_status) { - case SPATIAL_ONLY: - ut_ad(len - UNIV_EXTERN_STORAGE_FIELD - == DATA_MBR_LEN); - dfield_set_len( - dfield, - len - UNIV_EXTERN_STORAGE_FIELD); - break; - - case SPATIAL_MIXED: - dfield_set_len( - dfield, - len - UNIV_EXTERN_STORAGE_FIELD - - DATA_MBR_LEN); - break; - - case SPATIAL_NONE: - dfield_set_len( - dfield, - len - UNIV_EXTERN_STORAGE_FIELD); - break; - - case SPATIAL_UNKNOWN: - ut_ad(0); - break; - } - - dfield_set_ext(dfield); - dfield_set_spatial_status(dfield, spatial_status); - - /* If the prefix of this column is indexed, - ensure that enough prefix is stored in the - undo log record. */ - if (!ignore_prefix && col->ord_part - && spatial_status != SPATIAL_ONLY) { - ut_a(dfield_get_len(dfield) - >= BTR_EXTERN_FIELD_REF_SIZE); - ut_a(dict_table_has_atomic_blobs(index->table) - || dfield_get_len(dfield) - >= REC_ANTELOPE_MAX_INDEX_COL_LEN - + BTR_EXTERN_FIELD_REF_SIZE); - } - } - } - - return(const_cast<byte*>(ptr)); -} - /** Erase the unused undo log page end. @param[in,out] undo_page undo log page @return whether the page contained something */ diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index 038cf9be825..770bbd961f2 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -568,8 +568,10 @@ void trx_disconnect_prepared(trx_t *trx) ut_ad(trx_state_eq(trx, TRX_STATE_PREPARED)); ut_ad(trx->mysql_thd); trx->read_view.close(); + mutex_enter(&trx_sys.mutex); trx->is_recovered= true; trx->mysql_thd= NULL; + mutex_exit(&trx_sys.mutex); /* todo/fixme: suggest to do it at innodb prepare */ trx->will_lock= false; } |