Commit c3695b40 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-21511: Remove unnecessary code

Now that we will be invoking dtuple_get_n_ext() instead of
letting btr_push_update_extern_fields() update an already
calculated value, it is unnecessary to calculate the n_ext
upfront.

row_rec_to_index_entry(), row_rec_to_index_entry_low():
Remove the output parameter n_ext.
parent 5838b527
...@@ -3969,7 +3969,6 @@ btr_cur_optimistic_update( ...@@ -3969,7 +3969,6 @@ btr_cur_optimistic_update(
dtuple_t* new_entry; dtuple_t* new_entry;
roll_ptr_t roll_ptr; roll_ptr_t roll_ptr;
ulint i; ulint i;
ulint n_ext;
block = btr_cur_get_block(cursor); block = btr_cur_get_block(cursor);
page = buf_block_get_frame(block); page = buf_block_get_frame(block);
...@@ -4042,10 +4041,8 @@ btr_cur_optimistic_update( ...@@ -4042,10 +4041,8 @@ btr_cur_optimistic_update(
+ DTUPLE_EST_ALLOC(rec_offs_n_fields(*offsets))); + DTUPLE_EST_ALLOC(rec_offs_n_fields(*offsets)));
} }
new_entry = row_rec_to_index_entry(rec, index, *offsets, new_entry = row_rec_to_index_entry(rec, index, *offsets, *heap);
&n_ext, *heap); ut_ad(!dtuple_get_n_ext(new_entry));
/* We checked above that there are no externally stored fields. */
ut_a(!n_ext);
/* The page containing the clustered index record /* The page containing the clustered index record
corresponding to new_entry is latched in mtr. corresponding to new_entry is latched in mtr.
...@@ -4293,7 +4290,6 @@ btr_cur_pessimistic_update( ...@@ -4293,7 +4290,6 @@ btr_cur_pessimistic_update(
roll_ptr_t roll_ptr; roll_ptr_t roll_ptr;
ibool was_first; ibool was_first;
ulint n_reserved = 0; ulint n_reserved = 0;
ulint n_ext;
ulint max_ins_size = 0; ulint max_ins_size = 0;
*offsets = NULL; *offsets = NULL;
...@@ -4358,7 +4354,7 @@ btr_cur_pessimistic_update( ...@@ -4358,7 +4354,7 @@ btr_cur_pessimistic_update(
ut_ad(rec_offs_validate(rec, index, *offsets)); ut_ad(rec_offs_validate(rec, index, *offsets));
dtuple_t* new_entry = row_rec_to_index_entry( dtuple_t* new_entry = row_rec_to_index_entry(
rec, index, *offsets, &n_ext, entry_heap); rec, index, *offsets, entry_heap);
/* The page containing the clustered index record /* The page containing the clustered index record
corresponding to new_entry is latched in mtr. If the corresponding to new_entry is latched in mtr. If the
...@@ -4375,9 +4371,6 @@ btr_cur_pessimistic_update( ...@@ -4375,9 +4371,6 @@ btr_cur_pessimistic_update(
ut_ad(!page_is_comp(page) || !rec_get_node_ptr_flag(rec)); ut_ad(!page_is_comp(page) || !rec_get_node_ptr_flag(rec));
ut_ad(rec_offs_validate(rec, index, *offsets)); ut_ad(rec_offs_validate(rec, index, *offsets));
/* Get number of externally stored columns in updated record */
n_ext = dtuple_get_n_ext(new_entry);
if ((flags & BTR_NO_UNDO_LOG_FLAG) if ((flags & BTR_NO_UNDO_LOG_FLAG)
&& rec_offs_any_extern(*offsets)) { && rec_offs_any_extern(*offsets)) {
/* We are in a transaction rollback undoing a row /* We are in a transaction rollback undoing a row
...@@ -4397,6 +4390,8 @@ btr_cur_pessimistic_update( ...@@ -4397,6 +4390,8 @@ btr_cur_pessimistic_update(
index, rec, page_zip, *offsets, update, true, mtr); index, rec, page_zip, *offsets, update, true, mtr);
} }
ulint n_ext = dtuple_get_n_ext(new_entry);
if (page_zip_rec_needs_ext( if (page_zip_rec_needs_ext(
rec_get_converted_size(index, new_entry, n_ext), rec_get_converted_size(index, new_entry, n_ext),
page_is_comp(page), page_is_comp(page),
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, 2017, MariaDB Corporation. Copyright (c) 2016, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -207,8 +207,6 @@ row_rec_to_index_entry_low( ...@@ -207,8 +207,6 @@ row_rec_to_index_entry_low(
const rec_t* rec, /*!< in: record in the index */ const rec_t* rec, /*!< in: record in the index */
const dict_index_t* index, /*!< in: index */ const dict_index_t* index, /*!< in: index */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
ulint* n_ext, /*!< out: number of externally
stored columns */
mem_heap_t* heap) /*!< in: memory heap from which mem_heap_t* heap) /*!< in: memory heap from which
the memory needed is allocated */ the memory needed is allocated */
MY_ATTRIBUTE((warn_unused_result)); MY_ATTRIBUTE((warn_unused_result));
...@@ -222,8 +220,6 @@ row_rec_to_index_entry( ...@@ -222,8 +220,6 @@ row_rec_to_index_entry(
const rec_t* rec, /*!< in: record in the index */ const rec_t* rec, /*!< in: record in the index */
const dict_index_t* index, /*!< in: index */ const dict_index_t* index, /*!< in: index */
const offset_t* offsets,/*!< in/out: rec_get_offsets(rec) */ const offset_t* offsets,/*!< in/out: rec_get_offsets(rec) */
ulint* n_ext, /*!< out: number of externally
stored columns */
mem_heap_t* heap) /*!< in: memory heap from which mem_heap_t* heap) /*!< in: memory heap from which
the memory needed is allocated */ the memory needed is allocated */
MY_ATTRIBUTE((warn_unused_result)); MY_ATTRIBUTE((warn_unused_result));
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2015, 2019, MariaDB Corporation. Copyright (c) 2015, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -1720,7 +1720,6 @@ row_fts_merge_insert( ...@@ -1720,7 +1720,6 @@ row_fts_merge_insert(
corresponding FTS index auxiliary tables */ corresponding FTS index auxiliary tables */
for (;;) { for (;;) {
dtuple_t* dtuple; dtuple_t* dtuple;
ulint n_ext;
int min_rec = 0; int min_rec = 0;
if (fts_sort_pll_degree <= 2) { if (fts_sort_pll_degree <= 2) {
...@@ -1763,7 +1762,7 @@ row_fts_merge_insert( ...@@ -1763,7 +1762,7 @@ row_fts_merge_insert(
} }
dtuple = row_rec_to_index_entry_low( dtuple = row_rec_to_index_entry_low(
mrec[min_rec], index, offsets[min_rec], &n_ext, mrec[min_rec], index, offsets[min_rec],
tuple_heap); tuple_heap);
row_fts_insert_tuple( row_fts_insert_tuple(
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 2011, 2018, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2011, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2019, MariaDB Corporation. Copyright (c) 2017, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -3314,7 +3314,6 @@ row_log_apply_op( ...@@ -3314,7 +3314,6 @@ row_log_apply_op(
enum row_op op; enum row_op op;
ulint extra_size; ulint extra_size;
ulint data_size; ulint data_size;
ulint n_ext;
dtuple_t* entry; dtuple_t* entry;
trx_id_t trx_id; trx_id_t trx_id;
...@@ -3392,10 +3391,10 @@ row_log_apply_op( ...@@ -3392,10 +3391,10 @@ row_log_apply_op(
} }
entry = row_rec_to_index_entry_low( entry = row_rec_to_index_entry_low(
mrec - data_size, index, offsets, &n_ext, heap); mrec - data_size, index, offsets, heap);
/* Online index creation is only implemented for secondary /* Online index creation is only implemented for secondary
indexes, which never contain off-page columns. */ indexes, which never contain off-page columns. */
ut_ad(n_ext == 0); ut_ad(dtuple_get_n_ext(entry) == 0);
row_log_apply_op_low(index, dup, error, offsets_heap, row_log_apply_op_low(index, dup, error, offsets_heap,
has_index_lock, op, trx_id, entry); has_index_lock, op, trx_id, entry);
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 2005, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2005, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2014, 2019, MariaDB Corporation. Copyright (c) 2014, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -3393,7 +3393,6 @@ row_merge_insert_index_tuples( ...@@ -3393,7 +3393,6 @@ row_merge_insert_index_tuples(
double curr_progress = 0; double curr_progress = 0;
dict_index_t* old_index = NULL; dict_index_t* old_index = NULL;
const mrec_t* mrec = NULL; const mrec_t* mrec = NULL;
ulint n_ext = 0;
mtr_t mtr; mtr_t mtr;
...@@ -3459,8 +3458,6 @@ row_merge_insert_index_tuples( ...@@ -3459,8 +3458,6 @@ row_merge_insert_index_tuples(
row buffer to data tuple record */ row buffer to data tuple record */
row_merge_mtuple_to_dtuple( row_merge_mtuple_to_dtuple(
index, dtuple, &row_buf->tuples[n_rows]); index, dtuple, &row_buf->tuples[n_rows]);
n_ext = dtuple_get_n_ext(dtuple);
n_rows++; n_rows++;
/* BLOB pointers must be copied from dtuple */ /* BLOB pointers must be copied from dtuple */
mrec = NULL; mrec = NULL;
...@@ -3479,7 +3476,7 @@ row_merge_insert_index_tuples( ...@@ -3479,7 +3476,7 @@ row_merge_insert_index_tuples(
} }
dtuple = row_rec_to_index_entry_low( dtuple = row_rec_to_index_entry_low(
mrec, index, offsets, &n_ext, tuple_heap); mrec, index, offsets, tuple_heap);
} }
old_index = dict_table_get_first_index(old_table); old_index = dict_table_get_first_index(old_table);
...@@ -3492,10 +3489,7 @@ row_merge_insert_index_tuples( ...@@ -3492,10 +3489,7 @@ row_merge_insert_index_tuples(
} }
} }
if (!n_ext) { if (dict_index_is_clust(index) && dtuple_get_n_ext(dtuple)) {
/* There are no externally stored columns. */
} else {
ut_ad(dict_index_is_clust(index));
/* Off-page columns can be fetched safely /* Off-page columns can be fetched safely
when concurrent modifications to the table when concurrent modifications to the table
are disabled. (Purge can process delete-marked are disabled. (Purge can process delete-marked
......
...@@ -4652,7 +4652,6 @@ row_scan_index_for_mysql( ...@@ -4652,7 +4652,6 @@ row_scan_index_for_mysql(
ulint i; ulint i;
ulint cnt; ulint cnt;
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint n_ext;
offset_t offsets_[REC_OFFS_NORMAL_SIZE]; offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets; offset_t* offsets;
rec_offs_init(offsets_); rec_offs_init(offsets_);
...@@ -4793,7 +4792,7 @@ row_scan_index_for_mysql( ...@@ -4793,7 +4792,7 @@ row_scan_index_for_mysql(
mem_heap_empty(heap); mem_heap_empty(heap);
prev_entry = row_rec_to_index_entry( prev_entry = row_rec_to_index_entry(
rec, index, offsets, &n_ext, heap); rec, index, offsets, heap);
if (UNIV_LIKELY_NULL(tmp_heap)) { if (UNIV_LIKELY_NULL(tmp_heap)) {
mem_heap_free(tmp_heap); mem_heap_free(tmp_heap);
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2018, 2019, MariaDB Corporation. Copyright (c) 2018, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -653,8 +653,6 @@ row_rec_to_index_entry_low( ...@@ -653,8 +653,6 @@ row_rec_to_index_entry_low(
const rec_t* rec, /*!< in: record in the index */ const rec_t* rec, /*!< in: record in the index */
const dict_index_t* index, /*!< in: index */ const dict_index_t* index, /*!< in: index */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
ulint* n_ext, /*!< out: number of externally
stored columns */
mem_heap_t* heap) /*!< in: memory heap from which mem_heap_t* heap) /*!< in: memory heap from which
the memory needed is allocated */ the memory needed is allocated */
{ {
...@@ -672,8 +670,6 @@ row_rec_to_index_entry_low( ...@@ -672,8 +670,6 @@ row_rec_to_index_entry_low(
/* Because this function may be invoked by row0merge.cc /* Because this function may be invoked by row0merge.cc
on a record whose header is in different format, the check on a record whose header is in different format, the check
rec_offs_validate(rec, index, offsets) must be avoided here. */ rec_offs_validate(rec, index, offsets) must be avoided here. */
ut_ad(n_ext);
*n_ext = 0;
rec_len = rec_offs_n_fields(offsets); rec_len = rec_offs_n_fields(offsets);
...@@ -698,7 +694,6 @@ row_rec_to_index_entry_low( ...@@ -698,7 +694,6 @@ row_rec_to_index_entry_low(
if (rec_offs_nth_extern(offsets, i)) { if (rec_offs_nth_extern(offsets, i)) {
dfield_set_ext(dfield); dfield_set_ext(dfield);
(*n_ext)++;
} }
} }
...@@ -717,8 +712,6 @@ row_rec_to_index_entry( ...@@ -717,8 +712,6 @@ row_rec_to_index_entry(
const rec_t* rec, /*!< in: record in the index */ const rec_t* rec, /*!< in: record in the index */
const dict_index_t* index, /*!< in: index */ const dict_index_t* index, /*!< in: index */
const offset_t* offsets,/*!< in: rec_get_offsets(rec) */ const offset_t* offsets,/*!< in: rec_get_offsets(rec) */
ulint* n_ext, /*!< out: number of externally
stored columns */
mem_heap_t* heap) /*!< in: memory heap from which mem_heap_t* heap) /*!< in: memory heap from which
the memory needed is allocated */ the memory needed is allocated */
{ {
...@@ -739,7 +732,7 @@ row_rec_to_index_entry( ...@@ -739,7 +732,7 @@ row_rec_to_index_entry(
rec_offs_make_valid(copy_rec, index, const_cast<offset_t*>(offsets)); rec_offs_make_valid(copy_rec, index, const_cast<offset_t*>(offsets));
entry = row_rec_to_index_entry_low( entry = row_rec_to_index_entry_low(
copy_rec, index, offsets, n_ext, heap); copy_rec, index, offsets, heap);
rec_offs_make_valid(rec, index, const_cast<offset_t*>(offsets)); rec_offs_make_valid(rec, index, const_cast<offset_t*>(offsets));
dtuple_set_info_bits(entry, dtuple_set_info_bits(entry,
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2015, 2019, MariaDB Corporation. Copyright (c) 2015, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -223,7 +223,6 @@ row_upd_check_references_constraints( ...@@ -223,7 +223,6 @@ row_upd_check_references_constraints(
dtuple_t* entry; dtuple_t* entry;
trx_t* trx; trx_t* trx;
const rec_t* rec; const rec_t* rec;
ulint n_ext;
dberr_t err; dberr_t err;
ibool got_s_lock = FALSE; ibool got_s_lock = FALSE;
...@@ -240,7 +239,7 @@ row_upd_check_references_constraints( ...@@ -240,7 +239,7 @@ row_upd_check_references_constraints(
heap = mem_heap_create(500); heap = mem_heap_create(500);
entry = row_rec_to_index_entry(rec, index, offsets, &n_ext, heap); entry = row_rec_to_index_entry(rec, index, offsets, heap);
mtr_commit(mtr); mtr_commit(mtr);
...@@ -373,7 +372,6 @@ wsrep_row_upd_check_foreign_constraints( ...@@ -373,7 +372,6 @@ wsrep_row_upd_check_foreign_constraints(
dtuple_t* entry; dtuple_t* entry;
trx_t* trx; trx_t* trx;
const rec_t* rec; const rec_t* rec;
ulint n_ext;
dberr_t err; dberr_t err;
ibool got_s_lock = FALSE; ibool got_s_lock = FALSE;
ibool opened = FALSE; ibool opened = FALSE;
...@@ -391,8 +389,7 @@ wsrep_row_upd_check_foreign_constraints( ...@@ -391,8 +389,7 @@ wsrep_row_upd_check_foreign_constraints(
heap = mem_heap_create(500); heap = mem_heap_create(500);
entry = row_rec_to_index_entry(rec, index, offsets, entry = row_rec_to_index_entry(rec, index, offsets, heap);
&n_ext, heap);
mtr_commit(mtr); mtr_commit(mtr);
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2019, MariaDB Corporation. Copyright (c) 2017, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -136,15 +136,13 @@ row_vers_impl_x_locked_low( ...@@ -136,15 +136,13 @@ row_vers_impl_x_locked_low(
const ulint rec_del = rec_get_deleted_flag(rec, comp); const ulint rec_del = rec_get_deleted_flag(rec, comp);
if (dict_index_has_virtual(index)) { if (dict_index_has_virtual(index)) {
ulint n_ext;
ulint est_size = DTUPLE_EST_ALLOC(index->n_fields); ulint est_size = DTUPLE_EST_ALLOC(index->n_fields);
/* Allocate the dtuple for virtual columns extracted from undo /* Allocate the dtuple for virtual columns extracted from undo
log with its own heap, so to avoid it being freed as we log with its own heap, so to avoid it being freed as we
iterating in the version loop below. */ iterating in the version loop below. */
v_heap = mem_heap_create(est_size); v_heap = mem_heap_create(est_size);
ientry = row_rec_to_index_entry( ientry = row_rec_to_index_entry(rec, index, offsets, v_heap);
rec, index, offsets, &n_ext, v_heap);
} }
/* We look up if some earlier version, which was modified by /* We look up if some earlier version, which was modified by
......
...@@ -2404,8 +2404,6 @@ trx_undo_prev_version_build( ...@@ -2404,8 +2404,6 @@ trx_undo_prev_version_build(
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)) {
ulint n_ext;
/* We should confirm the existence of disowned external data, /* We should confirm the existence of disowned external data,
if the previous version record is delete marked. If the trx_id if the previous version record is delete marked. If the trx_id
of the previous record is seen by purge view, we should treat of the previous record is seen by purge view, we should treat
...@@ -2446,15 +2444,14 @@ trx_undo_prev_version_build( ...@@ -2446,15 +2444,14 @@ trx_undo_prev_version_build(
those fields that update updates to become externally stored those fields that update updates to become externally stored
fields. Store the info: */ fields. Store the info: */
entry = row_rec_to_index_entry( entry = row_rec_to_index_entry(rec, index, offsets, heap);
rec, index, offsets, &n_ext, heap);
/* The page containing the clustered index record /* The page containing the clustered index record
corresponding to entry is latched in mtr. Thus the corresponding to entry is latched in mtr. Thus the
following call is safe. */ following call is safe. */
row_upd_index_replace_new_col_vals(entry, index, update, heap); row_upd_index_replace_new_col_vals(entry, index, update, heap);
/* Get number of externally stored columns in updated record */ /* Get number of externally stored columns in updated record */
n_ext = dtuple_get_n_ext(entry); const ulint n_ext = dtuple_get_n_ext(entry);
buf = static_cast<byte*>(mem_heap_alloc( buf = static_cast<byte*>(mem_heap_alloc(
heap, rec_get_converted_size(index, entry, n_ext))); heap, rec_get_converted_size(index, entry, n_ext)));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment