Commit 5f60c7c3 authored by Marko Mäkelä's avatar Marko Mäkelä

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.
parent 77cbaa96
...@@ -254,9 +254,9 @@ row_sel_sec_rec_is_for_clust_rec( ...@@ -254,9 +254,9 @@ row_sel_sec_rec_is_for_clust_rec(
clust_field = static_cast<byte*>(vfield->data); clust_field = static_cast<byte*>(vfield->data);
} else { } else {
clust_pos = dict_col_get_clust_pos(col, clust_index); 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_cfield(
clust_field = rec_get_nth_field( clust_rec, clust_index, clust_offs,
clust_rec, clust_offs, clust_pos, &clust_len); clust_pos, &clust_len);
} }
sec_field = rec_get_nth_field(sec_rec, sec_offs, i, &sec_len); sec_field = rec_get_nth_field(sec_rec, sec_offs, i, &sec_len);
...@@ -3010,17 +3010,7 @@ row_sel_store_mysql_field_func( ...@@ -3010,17 +3010,7 @@ row_sel_store_mysql_field_func(
} else { } else {
/* The field is stored in the index record, or /* The field is stored in the index record, or
in the metadata for instant ADD COLUMN. */ in the metadata for instant ADD COLUMN. */
data = rec_get_nth_cfield(rec, index, offsets, field_no, &len);
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);
}
if (len == UNIV_SQL_NULL) { if (len == UNIV_SQL_NULL) {
/* MySQL assumes that the field for an SQL /* MySQL assumes that the field for an SQL
......
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