Skip to content

Commit

Permalink
MDEV-20562 btr_cur_open_at_rnd_pos() fails to return error for corrup…
Browse files Browse the repository at this point in the history
…ted 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 2e814d4.

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.
  • Loading branch information
dr-m committed Sep 11, 2019
1 parent df4dee4 commit 0f950e5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions storage/innobase/btr/btr0cur.cc
Expand Up @@ -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);
Expand Down Expand Up @@ -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 =========================*/
Expand Down

0 comments on commit 0f950e5

Please sign in to comment.