Commit 3e8339ae authored by Marko Mäkelä's avatar Marko Mäkelä

Fix innodb.instant_alter_crash

row_undo_mod_parse_undo_rec(): Handle both types of metadata records.

row_upd_index_replace_metadata(): Correctly process DB_TRX_ID,DB_ROLL_PTR,
and assert that a new value for the metadata BLOB is present.
parent 5482fa25
......@@ -1237,17 +1237,21 @@ row_undo_mod_parse_undo_rec(
ut_ad(!node->ref->info_bits);
if (node->update->info_bits & REC_INFO_MIN_REC_FLAG) {
/* This must be an undo log record for a subsequent
instant ALTER TABLE, extending the metadata record. */
ut_ad(clust_index->is_instant());
if (node->update->info_bits != REC_INFO_MIN_REC_FLAG) {
if ((node->update->info_bits & ~REC_INFO_DELETED_FLAG)
!= REC_INFO_MIN_REC_FLAG) {
ut_ad(!"wrong info_bits in undo log record");
goto close_table;
}
// FIXME: Could be REC_INFO_METADATA_ALTER as well?
node->update->info_bits = REC_INFO_METADATA_ADD;
const_cast<dtuple_t*>(node->ref)->info_bits
= REC_INFO_METADATA_ADD;
/* This must be an undo log record for a subsequent
instant ALTER TABLE, extending the metadata record. */
ut_ad(clust_index->is_instant());
ut_ad(clust_index->table->instant
|| !(node->update->info_bits & REC_INFO_DELETED_FLAG));
const_cast<dtuple_t*>(node->ref)->info_bits =
node->update->info_bits = (node->update->info_bits
& REC_INFO_DELETED_FLAG)
? REC_INFO_METADATA_ALTER
: REC_INFO_METADATA_ADD;
}
if (!row_undo_search_clust_to_pcur(node)) {
......
......@@ -1341,15 +1341,17 @@ row_upd_index_replace_metadata(
ut_ad(entry->n_fields == ulint(index->n_fields) + 1);
const page_size_t& page_size = dict_table_page_size(index->table);
const ulint first = index->first_user_field();
ut_d(bool found_mblob = false);
for (ulint i = upd_get_n_fields(update); i--; ) {
const upd_field_t* uf = upd_get_nth_field(update, i);
ut_ad(!upd_fld_is_virtual_col(uf));
ut_ad(uf->field_no >= first);
ut_ad(uf->field_no >= first - 2);
ulint f = uf->field_no;
dfield_t* dfield = dtuple_get_nth_field(entry, f);
if (f-- == first) {
if (f == first) {
ut_d(found_mblob = true);
ut_ad(!dfield_is_ext(&uf->new_val));
ut_ad(!dfield_is_null(&uf->new_val));
ut_ad(dfield_is_ext(dfield));
......@@ -1359,10 +1361,13 @@ row_upd_index_replace_metadata(
continue;
}
f -= f > first;
const dict_field_t* field = dict_index_get_nth_field(index, f);
row_upd_index_replace_new_col_val(dfield, field, field->col,
uf, heap, page_size);
}
ut_ad(found_mblob);
}
/** Apply an update vector to an index entry.
......
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