Commit 0f950e53 authored by Marko Mäkelä's avatar Marko Mäkelä

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 2e814d47.

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.
parent df4dee4b
......@@ -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 =========================*/
......
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