summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-07-28 11:24:07 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-07-28 13:00:59 +0300
commit3c3f172f17de217389bc51053c555a5d7e91ddff (patch)
treec52a7037be02c7869d18957d315fbc8421c87f0e
parent6307b17aa11fb6179ed04f16abfa7ed9d5228e99 (diff)
downloadmariadb-git-3c3f172f17de217389bc51053c555a5d7e91ddff.tar.gz
MDEV-23308 CHECK TABLE attempts to access parent_right_page_no=FIL_NULL
mysql/mysql-server@e00ad49edc8b07317b52c9efd0810f2cbc57877a which introduced WL#6326 to MySQL 5.7.2 added a buffer page acquisition to CHECK TABLE code (solely for the purpose of obeying the changed latching order), but failed to check that a parent page actually exists. It would not necessarily exist in a corrupted index where a parent page is missing pointer records to child pages.
-rw-r--r--storage/innobase/btr/btr0btr.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc
index 5f38e623985..313790f1db3 100644
--- a/storage/innobase/btr/btr0btr.cc
+++ b/storage/innobase/btr/btr0btr.cc
@@ -5028,11 +5028,13 @@ loop:
mtr_release_block_at_savepoint(
&mtr, savepoint, right_block);
- btr_block_get(
- page_id_t(index->space,
- parent_right_page_no),
- table_page_size,
- RW_SX_LATCH, index, &mtr);
+ if (parent_right_page_no != FIL_NULL) {
+ btr_block_get(
+ page_id_t(index->space,
+ parent_right_page_no),
+ table_page_size,
+ RW_SX_LATCH, index, &mtr);
+ }
right_block = btr_block_get(
page_id_t(index->space,