summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-09-11 15:08:32 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-09-11 15:30:19 +0300
commit0f950e53f0f6432cbc3f6c9c11cffa53205e1e60 (patch)
treea50d3b4f6b58e0fe4c0f053e5c67e92c3dbe9135
parentdf4dee4b84ddc34799fa3a9648c142f12564597f (diff)
downloadmariadb-git-0f950e53f0f6432cbc3f6c9c11cffa53205e1e60.tar.gz
MDEV-20562 btr_cur_open_at_rnd_pos() fails to return error for corrupted page
In mysql-server/commit@f46329044f8618212923bdf52e15d5b464201edc the InnoDB function btr_cur_open_at_rnd_pos() was corrected so that it would return a status that indicates whether the cursor was successfully positioned. But this change was not correctly merged to MariaDB in 2e814d4702d71a04388386a9f591d14a35980bfe. btr_cur_open_at_rnd_pos(): In the code path that was introduced in MDEV-8588, properly return failure status. No deterministic test case was found for this failure. It was caught after removing the function page_copy_rec_list_end_to_created_page() in a development branch. As a result, the fill factor of index trees would improve, and supposedly, so would the probability of btr_cur_open_at_rnd_pos() reaching the intentionally corrupted page in the test innodb.leaf_page_corrupted_during_recovery. The wrong return value would cause btr_estimate_number_of_different_key_vals() to wrongly invoke btr_rec_get_externally_stored_len() on a non-leaf page and trigger an assertion failure at the start of that function.
-rw-r--r--storage/innobase/btr/btr0cur.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index 349ae990edb..b23cacac227 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -2658,7 +2658,7 @@ btr_cur_open_at_rnd_pos_func(
index->table->file_unreadable = true;
}
- goto exit_loop;
+ break;
}
page = buf_block_get_frame(block);
@@ -2815,12 +2815,11 @@ btr_cur_open_at_rnd_pos_func(
n_blocks++;
}
- exit_loop:
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
- return(true);
+ return err == DB_SUCCESS;
}
/*==================== B-TREE INSERT =========================*/