Commit 84003dc1 authored by Marko Mäkelä's avatar Marko Mäkelä

Simplify dtuple-to-rec conversions

rec_get_converted_size_comp(): Replace status,fields,n_fields with tuple.

rec_init_offsets_comp_ordinary(), rec_get_converted_size_comp_prefix_low(),
rec_convert_dtuple_to_rec_comp(): Add template<bool mblob = false>.
With mblob=true, process a record with a metadata BLOB.

rec_copy_prefix_to_buf(): Assert that no fields beyond the key and
system columns are being copied. Exclude the metadata BLOB field.
parent d6652411
......@@ -1110,42 +1110,6 @@ struct dict_index_t {
return n;
}
/** Determine the number of non-core instant columns present
in the clustered index.
@param[in] n_prefix number of fields in the prefix
@return number of fields n_core_fields...n_prefix-1 that undergoes
instant operation. */
unsigned get_n_instant_cols(ulint n_prefix) const
{
DBUG_ASSERT(n_prefix > 0);
DBUG_ASSERT(n_prefix <= n_fields);
unsigned n = 0;
for (ulint i = n_core_fields; i < n_prefix; i++) {
const dict_col_t* col = fields[i].col;
if (col->is_dropped() || col->is_added()) {
n++;
continue;
}
}
DBUG_ASSERT(n < n_def);
return n;
}
/** Get the number of non-drop nullable fields from the index.
@return number of non-drop nullable fields in the index. */
unsigned get_n_non_drop_nullable_fields() const
{
DBUG_ASSERT(n_fields <= n_def);
unsigned n = 0;
for (unsigned i = 0; i < n_fields; i++) {
n += !fields[i].col->is_nullable();
}
return n;
}
/** Get the default value of an instantly-added clustered index field.
@param[in] n instantly added field position
@param[out] len value length (in bytes), or UNIV_SQL_NULL
......
......@@ -1118,28 +1118,18 @@ rec_get_converted_size_comp_prefix(
ulint* extra) /*!< out: extra size */
MY_ATTRIBUTE((warn_unused_result, nonnull(1,2)));
/** Determines the size of a data tuple in ROW_FORMAT=COMPACT.
/** Determine the size of a record in ROW_FORMAT=COMPACT.
@param[in] index record descriptor. dict_table_is_comp()
is assumed to hold, even if it doesn't
@param[in] status status bits of the record
@param[in] fields array of data fields
@param[in] n_fields number of data fields
@param[in] tuple logical record
@param[out] extra extra size
@return total size */
ulint
rec_get_converted_size_comp(
const dict_index_t* index,
rec_comp_status_t status,
const dfield_t* fields,
ulint n_fields,
const dtuple_t* tuple,
ulint* extra)
MY_ATTRIBUTE((nonnull(1,3)));
ulint
rec_get_metadata_converted_size(
const dict_index_t* clust_index,
const dtuple_t* dtuple,
ulint* ext);
MY_ATTRIBUTE((nonnull(1,2)));
/**********************************************************//**
The following function returns the size of a data tuple when converted to
......
......@@ -1416,19 +1416,7 @@ rec_get_converted_size(
#endif
if (dict_table_is_comp(index->table)) {
if (UNIV_UNLIKELY(dtuple->is_alter_metadata())) {
return rec_get_metadata_converted_size(
index, dtuple, NULL);
}
return(rec_get_converted_size_comp(
index,
static_cast<rec_comp_status_t>(
dtuple->info_bits
& REC_NEW_STATUS_MASK),
dtuple->fields,
dtuple->n_fields, NULL));
return rec_get_converted_size_comp(index, dtuple, NULL);
}
data_size = dtuple_get_data_size(dtuple, 0);
......
This diff is collapsed.
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