diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-10-03 09:15:01 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-10-03 09:20:44 +0300 |
commit | c134f565c4e69da37b9d99e4fbf82a70616c92f2 (patch) | |
tree | 4aba200d363679e1974a3b16f7724cbb861ff4b6 /storage/innobase | |
parent | 15c7225a08b5ef39d07ece92b725592cd61163d7 (diff) | |
download | mariadb-git-c134f565c4e69da37b9d99e4fbf82a70616c92f2.tar.gz |
MDEV-11369: Implement stricter checks for the metadata record
btr_cur_instant_init_low(): If columns were instantly added and dropped,
then index->is_instant() might not hold even though the root page type
was FIL_PAGE_TYPE_INSTANT. MariaDB 10.3 must refuse to open such files,
because instant DROP COLUMN is not supported.
Also, refuse to open the table if the metadata record has
wrong info OR status bits. Previously, we only refused to open
if both bits were wrong.
Diffstat (limited to 'storage/innobase')
-rw-r--r-- | storage/innobase/btr/btr0cur.cc | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 0f2d3b9289f..41156ba5517 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -413,7 +413,14 @@ btr_cur_instant_init_low(dict_index_t* index, mtr_t* mtr) ut_ad(index->n_core_null_bytes != dict_index_t::NO_CORE_NULL_BYTES); if (!index->is_instant()) { - return DB_SUCCESS; + if (fil_page_get_type(root) == FIL_PAGE_INDEX) { + return DB_SUCCESS; + } +incompatible: + ib::error() << "Table " << index->table->name + << " contains unrecognizable instant ALTER metadata"; + index->table->corrupted = true; + return DB_CORRUPTION; } btr_cur_t cur; @@ -430,25 +437,19 @@ btr_cur_instant_init_low(dict_index_t* index, mtr_t* mtr) page_cur_move_to_next(&cur.page_cur); const rec_t* rec = cur.page_cur.rec; + const ulint comp = dict_table_is_comp(index->table); + const ulint info_bits = rec_get_info_bits(rec, comp); - if (page_rec_is_supremum(rec) || !rec_is_metadata(rec, index)) { + if (page_rec_is_supremum(rec) + || !(info_bits & REC_INFO_MIN_REC_FLAG)) { ib::error() << "Table " << index->table->name << " is missing instant ALTER metadata"; index->table->corrupted = true; return DB_CORRUPTION; } - if (dict_table_is_comp(index->table)) { - if (rec_get_info_bits(rec, true) != REC_INFO_MIN_REC_FLAG - && rec_get_status(rec) != REC_STATUS_COLUMNS_ADDED) { -incompatible: - ib::error() << "Table " << index->table->name - << " contains unrecognizable " - "instant ALTER metadata"; - index->table->corrupted = true; - return DB_CORRUPTION; - } - } else if (rec_get_info_bits(rec, false) != REC_INFO_MIN_REC_FLAG) { + if (info_bits != REC_INFO_MIN_REC_FLAG + || (comp && rec_get_status(rec) != REC_STATUS_COLUMNS_ADDED)) { goto incompatible; } |