MDEV-17138 follow-up: Optimize index page creation
btr_create(), btr_root_raise_and_insert(): Write a MLOG_MEMSET record to set FIL_PAGE_PREV,FIL_PAGE_NEXT to FIL_NULL, instead of writing two MLOG_4BYTES records. For ROW_FORMAT=COMPRESSED pages, we will not use MLOG_MEMSET because we want the crash-downgrade to earlier 10.4 releases to succeed. mlog_parse_nbytes(): Relax the too strict assertion. There is no problem with MLOG_MEMSET records that affect the uncompressed header of ROW_FORMAT=COMPRESSED index pages.
This commit is contained in:
parent
2b7aa60b7e
commit
49019dde65
@ -1156,8 +1156,23 @@ btr_create(
|
||||
btr_page_set_index_id(page, page_zip, index_id, mtr);
|
||||
|
||||
/* Set the next node and previous node fields */
|
||||
btr_page_set_next(page, page_zip, FIL_NULL, mtr);
|
||||
btr_page_set_prev(page, page_zip, FIL_NULL, mtr);
|
||||
compile_time_assert(FIL_PAGE_NEXT == FIL_PAGE_PREV + 4);
|
||||
compile_time_assert(FIL_NULL == 0xffffffff);
|
||||
#if MYSQL_VERSION_ID < 100500
|
||||
if (UNIV_LIKELY_NULL(page_zip)) {
|
||||
/* Avoid tripping the ut_a() in mlog_parse_nbytes()
|
||||
when crash-downgrading to an earlier MariaDB 10.4 version. */
|
||||
btr_page_set_next(page, page_zip, FIL_NULL, mtr);
|
||||
btr_page_set_prev(page, page_zip, FIL_NULL, mtr);
|
||||
} else {
|
||||
mlog_memset(block, FIL_PAGE_PREV, 8, 0xff, mtr);
|
||||
}
|
||||
#else
|
||||
mlog_memset(block, FIL_PAGE_PREV, 8, 0xff, mtr);
|
||||
if (UNIV_LIKELY_NULL(page_zip)) {
|
||||
memset(page_zip->data + FIL_PAGE_PREV, 0xff, 8);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* We reset the free bits for the page in a separate
|
||||
mini-transaction to allow creation of several trees in the
|
||||
@ -1934,8 +1949,23 @@ btr_root_raise_and_insert(
|
||||
btr_page_create(new_block, new_page_zip, index, level, mtr);
|
||||
|
||||
/* Set the next node and previous node fields of new page */
|
||||
btr_page_set_next(new_page, new_page_zip, FIL_NULL, mtr);
|
||||
btr_page_set_prev(new_page, new_page_zip, FIL_NULL, mtr);
|
||||
compile_time_assert(FIL_PAGE_NEXT == FIL_PAGE_PREV + 4);
|
||||
compile_time_assert(FIL_NULL == 0xffffffff);
|
||||
#if MYSQL_VERSION_ID < 100500
|
||||
if (UNIV_LIKELY_NULL(new_page_zip)) {
|
||||
/* Avoid tripping the ut_a() in mlog_parse_nbytes()
|
||||
when crash-downgrading to an earlier MariaDB 10.4 version. */
|
||||
btr_page_set_next(new_page, new_page_zip, FIL_NULL, mtr);
|
||||
btr_page_set_prev(new_page, new_page_zip, FIL_NULL, mtr);
|
||||
} else {
|
||||
mlog_memset(new_block, FIL_PAGE_PREV, 8, 0xff, mtr);
|
||||
}
|
||||
#else
|
||||
mlog_memset(new_block, FIL_PAGE_PREV, 8, 0xff, mtr);
|
||||
if (UNIV_LIKELY_NULL(new_page_zip)) {
|
||||
memset(new_page_zip->data + FIL_PAGE_PREV, 0xff, 8);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Copy the records from root to the new page one by one. */
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, 2018, MariaDB Corporation.
|
||||
Copyright (c) 2017, 2019, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@ -139,6 +139,7 @@ mlog_parse_nbytes(
|
||||
|
||||
ut_ad(type <= MLOG_8BYTES || type == MLOG_MEMSET);
|
||||
ut_a(!page || !page_zip
|
||||
|| type == MLOG_MEMSET
|
||||
|| !fil_page_index_page_check(page));
|
||||
if (end_ptr < ptr + 2) {
|
||||
return NULL;
|
||||
@ -164,6 +165,8 @@ mlog_parse_nbytes(
|
||||
if (page) {
|
||||
memset(page + offset, *ptr, val);
|
||||
if (page_zip) {
|
||||
ut_ad(offset + val <= PAGE_DATA
|
||||
|| !fil_page_index_page_check(page));
|
||||
memset(static_cast<page_zip_des_t*>(page_zip)
|
||||
->data + offset, *ptr, val);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user