Remove unused parameters and dead code

upd_field_set_field_no(): Remove the unused parameter trx, and
remove a debug message. In debug builds, the out-of-bounds access
would still be caught by dict_index_get_nth_col().

trx_undo_update_rec_get_update(): Remove the unnecessary parameter trx.
This commit is contained in:
Marko Mäkelä 2017-09-29 16:19:28 +03:00
parent 358ab5d6b1
commit 7cd4a66de6
8 changed files with 11 additions and 29 deletions

View File

@ -87,8 +87,7 @@ upd_field_set_field_no(
upd_field_t* upd_field, /*!< in: update vector field */ upd_field_t* upd_field, /*!< in: update vector field */
ulint field_no, /*!< in: field number in a clustered ulint field_no, /*!< in: field number in a clustered
index */ index */
dict_index_t* index, /*!< in: index */ dict_index_t* index);
trx_t* trx); /*!< in: transaction */
/** set field number to a update vector field, marks this field is updated /** set field number to a update vector field, marks this field is updated
@param[in,out] upd_field update vector field @param[in,out] upd_field update vector field

View File

@ -95,22 +95,10 @@ upd_field_set_field_no(
upd_field_t* upd_field, /*!< in: update vector field */ upd_field_t* upd_field, /*!< in: update vector field */
ulint field_no, /*!< in: field number in a clustered ulint field_no, /*!< in: field number in a clustered
index */ index */
dict_index_t* index, /*!< in: index */ dict_index_t* index) /*!< in: index */
trx_t* trx) /*!< in: transaction */
{ {
upd_field->field_no = unsigned(field_no); upd_field->field_no = unsigned(field_no);
upd_field->orig_len = 0; upd_field->orig_len = 0;
if (UNIV_UNLIKELY(field_no >= dict_index_get_n_fields(index))) {
ib::error()
<< " trying to access field " << field_no
<< " in " << index->name
<< " of table " << index->table->name
<< " which contains only " << index->n_fields
<< " fields";
ut_ad(0);
}
dict_col_copy_type(dict_index_get_nth_col(index, field_no), dict_col_copy_type(dict_index_get_nth_col(index, field_no),
dfield_get_type(&upd_field->new_val)); dfield_get_type(&upd_field->new_val));
} }

View File

@ -152,7 +152,6 @@ trx_undo_update_rec_get_update(
trx_id_t trx_id, /*!< in: transaction id from this undorecord */ trx_id_t trx_id, /*!< in: transaction id from this undorecord */
roll_ptr_t roll_ptr,/*!< in: roll pointer from this undo record */ roll_ptr_t roll_ptr,/*!< in: roll pointer from this undo record */
ulint info_bits,/*!< in: info bits from this undo record */ ulint info_bits,/*!< in: info bits from this undo record */
trx_t* trx, /*!< in: transaction */
mem_heap_t* heap, /*!< in: memory heap from which the memory mem_heap_t* heap, /*!< in: memory heap from which the memory
needed is allocated */ needed is allocated */
upd_t** upd); /*!< out, own: update vector */ upd_t** upd); /*!< out, own: update vector */

View File

@ -1180,7 +1180,7 @@ pars_process_assign_list(
upd_field_set_field_no(upd_field, dict_index_get_nth_col_pos( upd_field_set_field_no(upd_field, dict_index_get_nth_col_pos(
clust_index, col_sym->col_no, clust_index, col_sym->col_no,
NULL), NULL),
clust_index, NULL); clust_index);
upd_field->exp = assign_node->val; upd_field->exp = assign_node->val;
if (!dict_col_get_fixed_size( if (!dict_col_get_fixed_size(

View File

@ -819,7 +819,6 @@ row_purge_parse_undo_rec(
{ {
dict_index_t* clust_index; dict_index_t* clust_index;
byte* ptr; byte* ptr;
trx_t* trx;
undo_no_t undo_no; undo_no_t undo_no;
table_id_t table_id; table_id_t table_id;
trx_id_t trx_id; trx_id_t trx_id;
@ -911,10 +910,8 @@ err_exit:
ptr = trx_undo_rec_get_row_ref(ptr, clust_index, &(node->ref), ptr = trx_undo_rec_get_row_ref(ptr, clust_index, &(node->ref),
node->heap); node->heap);
trx = thr_get_trx(thr);
ptr = trx_undo_update_rec_get_update(ptr, clust_index, type, trx_id, ptr = trx_undo_update_rec_get_update(ptr, clust_index, type, trx_id,
roll_ptr, info_bits, trx, roll_ptr, info_bits,
node->heap, &(node->update)); node->heap, &(node->update));
/* Read to the partial row the fields that occur in indexes */ /* Read to the partial row the fields that occur in indexes */

View File

@ -1160,7 +1160,7 @@ close_table:
node->heap); node->heap);
ptr = trx_undo_update_rec_get_update(ptr, clust_index, type, trx_id, ptr = trx_undo_update_rec_get_update(ptr, clust_index, type, trx_id,
roll_ptr, info_bits, node->trx, roll_ptr, info_bits,
node->heap, &(node->update)); node->heap, &(node->update));
node->new_trx_id = trx_id; node->new_trx_id = trx_id;
node->cmpl_info = cmpl_info; node->cmpl_info = cmpl_info;

View File

@ -1006,7 +1006,7 @@ row_upd_build_sec_rec_difference_binary(
dfield_copy(&(upd_field->new_val), dfield); dfield_copy(&(upd_field->new_val), dfield);
upd_field_set_field_no(upd_field, i, index, NULL); upd_field_set_field_no(upd_field, i, index);
n_diff++; n_diff++;
} }
@ -1103,7 +1103,7 @@ row_upd_build_difference_binary(
dfield_copy(&(upd_field->new_val), dfield); dfield_copy(&(upd_field->new_val), dfield);
upd_field_set_field_no(upd_field, i, index, trx); upd_field_set_field_no(upd_field, i, index);
n_diff++; n_diff++;
} }

View File

@ -1453,7 +1453,6 @@ trx_undo_update_rec_get_update(
trx_id_t trx_id, /*!< in: transaction id from this undo record */ trx_id_t trx_id, /*!< in: transaction id from this undo record */
roll_ptr_t roll_ptr,/*!< in: roll pointer from this undo record */ roll_ptr_t roll_ptr,/*!< in: roll pointer from this undo record */
ulint info_bits,/*!< in: info bits from this undo record */ ulint info_bits,/*!< in: info bits from this undo record */
trx_t* trx, /*!< in: transaction */
mem_heap_t* heap, /*!< in: memory heap from which the memory mem_heap_t* heap, /*!< in: memory heap from which the memory
needed is allocated */ needed is allocated */
upd_t** upd) /*!< out, own: update vector */ upd_t** upd) /*!< out, own: update vector */
@ -1489,7 +1488,7 @@ trx_undo_update_rec_get_update(
upd_field_set_field_no(upd_field, upd_field_set_field_no(upd_field,
dict_index_get_sys_col_pos(index, DATA_TRX_ID), dict_index_get_sys_col_pos(index, DATA_TRX_ID),
index, trx); index);
dfield_set_data(&(upd_field->new_val), buf, DATA_TRX_ID_LEN); dfield_set_data(&(upd_field->new_val), buf, DATA_TRX_ID_LEN);
upd_field = upd_get_nth_field(update, n_fields + 1); upd_field = upd_get_nth_field(update, n_fields + 1);
@ -1500,7 +1499,7 @@ trx_undo_update_rec_get_update(
upd_field_set_field_no( upd_field_set_field_no(
upd_field, dict_index_get_sys_col_pos(index, DATA_ROLL_PTR), upd_field, dict_index_get_sys_col_pos(index, DATA_ROLL_PTR),
index, trx); index);
dfield_set_data(&(upd_field->new_val), buf, DATA_ROLL_PTR_LEN); dfield_set_data(&(upd_field->new_val), buf, DATA_ROLL_PTR_LEN);
/* Store then the updated ordinary columns to the update vector */ /* Store then the updated ordinary columns to the update vector */
@ -1561,7 +1560,7 @@ trx_undo_update_rec_get_update(
upd_field_set_v_field_no( upd_field_set_v_field_no(
upd_field, field_no, index); upd_field, field_no, index);
} else { } else {
upd_field_set_field_no(upd_field, field_no, index, trx); upd_field_set_field_no(upd_field, field_no, index);
} }
ptr = trx_undo_rec_get_col_val(ptr, &field, &len, &orig_len); ptr = trx_undo_rec_get_col_val(ptr, &field, &len, &orig_len);
@ -2247,7 +2246,7 @@ trx_undo_prev_version_build(
ptr = trx_undo_update_rec_get_update(ptr, index, type, trx_id, ptr = trx_undo_update_rec_get_update(ptr, index, type, trx_id,
roll_ptr, info_bits, roll_ptr, info_bits,
NULL, heap, &update); heap, &update);
ut_a(ptr); ut_a(ptr);
if (row_upd_changes_field_size_or_external(index, offsets, update)) { if (row_upd_changes_field_size_or_external(index, offsets, update)) {