Skip to content

Commit

Permalink
MDEV-17823 Assertion failed when accessing indexed instantly added co…
Browse files Browse the repository at this point in the history
…lumn

This assertion would fail when a secondary index record for an
instantly added column was accessed.

It is unclear to me why this code path is executed so rarely.
I was unable to cover it even when using FORCE INDEX.

row_sel_sec_rec_is_for_clust_rec(): Remove the assertion, and use
the proper function rec_get_nth_cfield().

row_sel_store_mysql_field_func(): Simply use rec_get_nth_cfield()
instead of duplicating its logic.
  • Loading branch information
dr-m committed Jan 18, 2019
1 parent 77cbaa9 commit 5f60c7c
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions storage/innobase/row/row0sel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,9 @@ row_sel_sec_rec_is_for_clust_rec(
clust_field = static_cast<byte*>(vfield->data);
} else {
clust_pos = dict_col_get_clust_pos(col, clust_index);
ut_ad(!rec_offs_nth_default(clust_offs, clust_pos));
clust_field = rec_get_nth_field(
clust_rec, clust_offs, clust_pos, &clust_len);
clust_field = rec_get_nth_cfield(
clust_rec, clust_index, clust_offs,
clust_pos, &clust_len);
}

sec_field = rec_get_nth_field(sec_rec, sec_offs, i, &sec_len);
Expand Down Expand Up @@ -3010,17 +3010,7 @@ row_sel_store_mysql_field_func(
} else {
/* The field is stored in the index record, or
in the metadata for instant ADD COLUMN. */

if (rec_offs_nth_default(offsets, field_no)) {
ut_ad(dict_index_is_clust(index));
ut_ad(index->is_instant());
const dict_index_t* clust_index
= dict_table_get_first_index(prebuilt->table);
ut_ad(index == clust_index);
data = clust_index->instant_field_value(field_no,&len);
} else {
data = rec_get_nth_field(rec, offsets, field_no, &len);
}
data = rec_get_nth_cfield(rec, index, offsets, field_no, &len);

if (len == UNIV_SQL_NULL) {
/* MySQL assumes that the field for an SQL
Expand Down

0 comments on commit 5f60c7c

Please sign in to comment.