summaryrefslogtreecommitdiff
path: root/storage/innobase/rem/rem0rec.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-11-09 23:01:44 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2017-11-09 23:39:12 +0200
commit5d142f9958d5cbb08782c1ccfa651f98af59ae3e (patch)
tree079e8730eef2d5fbe01eaadc576af394de7f3110 /storage/innobase/rem/rem0rec.cc
parente2376e81374d243e8c32f54ba6d474566d164d6b (diff)
downloadmariadb-git-5d142f9958d5cbb08782c1ccfa651f98af59ae3e.tar.gz
MDEV-13795/MDEV-14332 Corruption during online table-rebuilding ALTER when VIRTUAL columns exist
When MySQL 5.7 introduced indexed virtual columns, it introduced several bugs into the online table-rebuilding ALTER, that is, the row_log_table_apply() family of functions. The online_log format that was introduced for online table-rebuilding ALTER in MySQL 5.6 should be sufficient. Ideally, any indexed virtual column values would be evaluated based on the log records in the temporary file. There is no need to log virtual column values. (For ADD INDEX, that is row_log_apply(), we always must log the values of the keys, no matter if the columns are virtual.) Because omitting the virtual column values removes any chance of row_log_table_apply() working with indexed virtual columns, we will for now refuse LOCK=NONE in table-rebuilding ALTER operations when indexes on virtual columns exist. This restriction would be lifted in MDEV-14341. innobase_indexed_virtual_exist(): New predicate, to determine if indexed virtual columns exist in a table definition. ha_innobase::check_if_supported_inplace_alter(): Refuse online rebuild if indexed virtual columns exist. rec_get_converted_size_temp_v(), rec_convert_dtuple_to_temp_v(): Remove. row_log_table_delete(), row_log_table_update(, row_log_table_insert(): Remove parameters for virtual columns. trx_undo_read_v_rows(): Remove the col_map parameter. row_log_table_apply(): Do not deal with virtual columns.
Diffstat (limited to 'storage/innobase/rem/rem0rec.cc')
-rw-r--r--storage/innobase/rem/rem0rec.cc105
1 files changed, 0 insertions, 105 deletions
diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc
index f755eac84f3..b29a43772b0 100644
--- a/storage/innobase/rem/rem0rec.cc
+++ b/storage/innobase/rem/rem0rec.cc
@@ -936,49 +936,6 @@ rec_get_converted_size_comp_prefix_low(
return(extra_size + data_size);
}
-/** Determine the converted size of virtual column data in a temporary file.
-@see rec_convert_dtuple_to_temp_v()
-@param[in] index clustered index
-@param[in] v clustered index record augmented with the values
- of virtual columns
-@return size in bytes */
-ulint
-rec_get_converted_size_temp_v(const dict_index_t* index, const dtuple_t* v)
-{
- ut_ad(dict_index_is_clust(index));
-
- /* length marker */
- ulint data_size = 2;
- const ulint n_v_fields = dtuple_get_n_v_fields(v);
-
- for (ulint i = 0; i < n_v_fields; i++) {
- const dict_v_col_t* col
- = dict_table_get_nth_v_col(index->table, i);
-
- /* Only those indexed needs to be logged */
- if (!col->m_col.ord_part) {
- continue;
- }
-
- data_size += mach_get_compressed_size(i + REC_MAX_N_FIELDS);
- const dfield_t* vfield = dtuple_get_nth_v_field(v, col->v_pos);
- ulint flen = vfield->len;
-
- if (flen != UNIV_SQL_NULL) {
- flen = ut_min(
- flen,
- static_cast<ulint>(
- DICT_MAX_FIELD_LEN_BY_FORMAT(
- index->table)));
- data_size += flen;
- }
-
- data_size += mach_get_compressed_size(flen);
- }
-
- return(data_size);
-}
-
/**********************************************************//**
Determines the size of a data tuple prefix in ROW_FORMAT=COMPACT.
@return total size */
@@ -1376,68 +1333,6 @@ rec_convert_dtuple_to_rec_comp(
}
}
-/** Write indexed virtual column data into a temporary file.
-@see rec_get_converted_size_temp_v()
-@param[out] rec serialized record
-@param[in] index clustered index
-@param[in] v_entry clustered index record augmented with the values
- of virtual columns */
-void
-rec_convert_dtuple_to_temp_v(
- byte* rec,
- const dict_index_t* index,
- const dtuple_t* v_entry)
-{
- ut_ad(dict_index_is_clust(index));
- const ulint num_v = dtuple_get_n_v_fields(v_entry);
-
- /* reserve 2 bytes for writing length */
- byte* ptr = rec;
- ptr += 2;
-
- /* Now log information on indexed virtual columns */
- for (ulint col_no = 0; col_no < num_v; col_no++) {
- dfield_t* vfield;
- ulint flen;
-
- const dict_v_col_t* col
- = dict_table_get_nth_v_col(index->table, col_no);
-
- if (col->m_col.ord_part) {
- ulint pos = col_no;
-
- pos += REC_MAX_N_FIELDS;
-
- ptr += mach_write_compressed(ptr, pos);
-
- vfield = dtuple_get_nth_v_field(
- v_entry, col->v_pos);
-
- flen = vfield->len;
-
- if (flen != UNIV_SQL_NULL) {
- /* The virtual column can only be in sec
- index, and index key length is bound by
- DICT_MAX_FIELD_LEN_BY_FORMAT */
- flen = ut_min(
- flen,
- static_cast<ulint>(
- DICT_MAX_FIELD_LEN_BY_FORMAT(
- index->table)));
- }
-
- ptr += mach_write_compressed(ptr, flen);
-
- if (flen != UNIV_SQL_NULL) {
- ut_memcpy(ptr, dfield_get_data(vfield), flen);
- ptr += flen;
- }
- }
- }
-
- mach_write_to_2(rec, ptr - rec);
-}
-
/*********************************************************//**
Builds a new-style physical record out of a data tuple and
stores it beginning from the start of the given buffer.