Skip to content

Commit 5f60c7c

Browse files
committed
MDEV-17823 Assertion failed when accessing indexed instantly added column
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.
1 parent 77cbaa9 commit 5f60c7c

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

storage/innobase/row/row0sel.cc

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,9 @@ row_sel_sec_rec_is_for_clust_rec(
254254
clust_field = static_cast<byte*>(vfield->data);
255255
} else {
256256
clust_pos = dict_col_get_clust_pos(col, clust_index);
257-
ut_ad(!rec_offs_nth_default(clust_offs, clust_pos));
258-
clust_field = rec_get_nth_field(
259-
clust_rec, clust_offs, clust_pos, &clust_len);
257+
clust_field = rec_get_nth_cfield(
258+
clust_rec, clust_index, clust_offs,
259+
clust_pos, &clust_len);
260260
}
261261

262262
sec_field = rec_get_nth_field(sec_rec, sec_offs, i, &sec_len);
@@ -3010,17 +3010,7 @@ row_sel_store_mysql_field_func(
30103010
} else {
30113011
/* The field is stored in the index record, or
30123012
in the metadata for instant ADD COLUMN. */
3013-
3014-
if (rec_offs_nth_default(offsets, field_no)) {
3015-
ut_ad(dict_index_is_clust(index));
3016-
ut_ad(index->is_instant());
3017-
const dict_index_t* clust_index
3018-
= dict_table_get_first_index(prebuilt->table);
3019-
ut_ad(index == clust_index);
3020-
data = clust_index->instant_field_value(field_no,&len);
3021-
} else {
3022-
data = rec_get_nth_field(rec, offsets, field_no, &len);
3023-
}
3013+
data = rec_get_nth_cfield(rec, index, offsets, field_no, &len);
30243014

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

0 commit comments

Comments
 (0)