mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
MDEV-14126: Detect unexpected emptying of B-tree pages
If an index page becomes empty, btr_page_empty() should be called.
This commit is contained in:
parent
a4d0d6828b
commit
72b934e3f7
4 changed files with 10 additions and 4 deletions
|
@ -173,8 +173,9 @@ page_header_set_field(
|
|||
{
|
||||
ut_ad(page);
|
||||
ut_ad(field <= PAGE_N_RECS);
|
||||
ut_ad(field == PAGE_N_HEAP || val < UNIV_PAGE_SIZE);
|
||||
ut_ad(field != PAGE_N_HEAP || (val & 0x7fff) < UNIV_PAGE_SIZE);
|
||||
ut_ad(field != PAGE_N_RECS || val);
|
||||
ut_ad(field == PAGE_N_HEAP || val < srv_page_size);
|
||||
ut_ad(field != PAGE_N_HEAP || (val & 0x7fff) < srv_page_size);
|
||||
|
||||
mach_write_to_2(page + PAGE_HEADER + field, val);
|
||||
if (page_zip) {
|
||||
|
|
|
@ -2140,6 +2140,8 @@ page_copy_rec_list_end_to_created_page(
|
|||
rec = page_rec_get_next(rec);
|
||||
} while (!page_rec_is_supremum(rec));
|
||||
|
||||
ut_ad(n_recs);
|
||||
|
||||
if ((slot_index > 0) && (count + 1
|
||||
+ (PAGE_DIR_SLOT_MAX_N_OWNED + 1) / 2
|
||||
<= PAGE_DIR_SLOT_MAX_N_OWNED)) {
|
||||
|
|
|
@ -1231,6 +1231,7 @@ delete_all:
|
|||
page_header_set_field(page, NULL, PAGE_GARBAGE, size
|
||||
+ page_header_get_field(page, PAGE_GARBAGE));
|
||||
|
||||
ut_ad(page_get_n_recs(page) > n_recs);
|
||||
page_header_set_field(page, NULL, PAGE_N_RECS,
|
||||
(ulint)(page_get_n_recs(page) - n_recs));
|
||||
}
|
||||
|
|
|
@ -4448,10 +4448,12 @@ page_zip_dir_delete(
|
|||
slot_rec = page_zip_dir_find(page_zip, page_offset(rec));
|
||||
|
||||
ut_a(slot_rec);
|
||||
|
||||
uint16_t n_recs = page_get_n_recs(page);
|
||||
ut_ad(n_recs);
|
||||
ut_ad(n_recs > 1 || page_get_page_no(page) == index->page);
|
||||
/* This could not be done before page_zip_dir_find(). */
|
||||
page_header_set_field(page, page_zip, PAGE_N_RECS,
|
||||
(ulint)(page_get_n_recs(page) - 1));
|
||||
n_recs - 1);
|
||||
|
||||
if (UNIV_UNLIKELY(!free)) {
|
||||
/* Make the last slot the start of the free list. */
|
||||
|
|
Loading…
Add table
Reference in a new issue