Commit 08a549c3 authored by Marko Mäkelä's avatar Marko Mäkelä

Clean up buf_LRU_remove_hashed()

buf_LRU_block_remove_hashed(): Test for "not ROW_FORMAT=COMPRESSED" first,
because in that case we can assume that an uncompressed page exists.
This removes a condition from the likely code branch.
parent f7780a8e
...@@ -1092,59 +1092,57 @@ static bool buf_LRU_block_remove_hashed(buf_page_t *bpage, const page_id_t id, ...@@ -1092,59 +1092,57 @@ static bool buf_LRU_block_remove_hashed(buf_page_t *bpage, const page_id_t id,
buf_pool.freed_page_clock += 1; buf_pool.freed_page_clock += 1;
if (UNIV_LIKELY(bpage->frame != nullptr)) { if (UNIV_LIKELY(!bpage->zip.data)) {
MEM_CHECK_ADDRESSABLE(bpage, sizeof(buf_block_t)); MEM_CHECK_ADDRESSABLE(bpage, sizeof(buf_block_t));
MEM_CHECK_ADDRESSABLE(bpage->frame, srv_page_size); MEM_CHECK_ADDRESSABLE(bpage->frame, srv_page_size);
buf_block_modify_clock_inc((buf_block_t*) bpage); buf_block_modify_clock_inc((buf_block_t*) bpage);
if (UNIV_LIKELY_NULL(bpage->zip.data)) { } else if (const page_t *page = bpage->frame) {
const page_t* page = bpage->frame; MEM_CHECK_ADDRESSABLE(bpage, sizeof(buf_block_t));
MEM_CHECK_ADDRESSABLE(bpage->frame, srv_page_size);
ut_a(!zip || !bpage->oldest_modification()); buf_block_modify_clock_inc((buf_block_t*) bpage);
ut_ad(bpage->zip_size());
/* Skip consistency checks if the page was freed. ut_a(!zip || !bpage->oldest_modification());
In recovery, we could get a sole FREE_PAGE record ut_ad(bpage->zip_size());
and nothing else, for a ROW_FORMAT=COMPRESSED page. /* Skip consistency checks if the page was freed.
Its contents would be garbage. */ In recovery, we could get a sole FREE_PAGE record
if (!bpage->is_freed()) and nothing else, for a ROW_FORMAT=COMPRESSED page.
switch (fil_page_get_type(page)) { Its contents would be garbage. */
case FIL_PAGE_TYPE_ALLOCATED: if (!bpage->is_freed())
case FIL_PAGE_INODE: switch (fil_page_get_type(page)) {
case FIL_PAGE_IBUF_BITMAP: case FIL_PAGE_TYPE_ALLOCATED:
case FIL_PAGE_TYPE_FSP_HDR: case FIL_PAGE_INODE:
case FIL_PAGE_TYPE_XDES: case FIL_PAGE_IBUF_BITMAP:
/* These are essentially uncompressed pages. */ case FIL_PAGE_TYPE_FSP_HDR:
if (!zip) { case FIL_PAGE_TYPE_XDES:
/* InnoDB writes the data to the /* These are essentially uncompressed pages. */
uncompressed page frame. Copy it if (!zip) {
to the compressed page, which will /* InnoDB writes the data to the
be preserved. */ uncompressed page frame. Copy it
memcpy(bpage->zip.data, page, to the compressed page, which will
bpage->zip_size()); be preserved. */
} memcpy(bpage->zip.data, page,
break; bpage->zip_size());
case FIL_PAGE_TYPE_ZBLOB:
case FIL_PAGE_TYPE_ZBLOB2:
case FIL_PAGE_INDEX:
case FIL_PAGE_RTREE:
break;
default:
ib::error() << "The compressed page to be"
" evicted seems corrupt:";
ut_print_buf(stderr, page, srv_page_size);
ib::error() << "Possibly older version of"
" the page:";
ut_print_buf(stderr, bpage->zip.data,
bpage->zip_size());
putc('\n', stderr);
ut_error;
} }
} else { break;
goto evict_zip; case FIL_PAGE_TYPE_ZBLOB:
case FIL_PAGE_TYPE_ZBLOB2:
case FIL_PAGE_INDEX:
case FIL_PAGE_RTREE:
break;
default:
ib::error() << "The compressed page to be"
" evicted seems corrupt:";
ut_print_buf(stderr, page, srv_page_size);
ib::error() << "Possibly older version of"
" the page:";
ut_print_buf(stderr, bpage->zip.data,
bpage->zip_size());
putc('\n', stderr);
ut_error;
} }
} else { } else {
evict_zip:
ut_a(!bpage->oldest_modification()); ut_a(!bpage->oldest_modification());
MEM_CHECK_ADDRESSABLE(bpage->zip.data, bpage->zip_size()); MEM_CHECK_ADDRESSABLE(bpage->zip.data, bpage->zip_size());
} }
......
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