mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
branches/zip: buf_LRU_free_block(): Check if the block has been reloaded
to the buffer pool while we were not holding buf_pool->mutex. If it was, do not attempt to preserve the compressed page.
This commit is contained in:
@@ -925,21 +925,29 @@ buf_LRU_free_block(
|
||||
mutex_enter(&(buf_pool->mutex));
|
||||
|
||||
if (bpage->zip.data) {
|
||||
/* Keep the compressed page.
|
||||
Allocate a block descriptor for it. */
|
||||
buf_page_t* b = buf_buddy_alloc(sizeof *b, FALSE);
|
||||
const ulint fold = buf_page_address_fold(
|
||||
bpage->space, bpage->offset);
|
||||
buf_page_t* b = buf_page_hash_get(
|
||||
bpage->space, bpage->offset);
|
||||
|
||||
if (UNIV_LIKELY_NULL(b)) {
|
||||
/* The block was reloaded to the buffer pool
|
||||
while we were not holding buf_pool->mutex.
|
||||
Free this block entirely; do not attempt to
|
||||
preserve the compressed page. */
|
||||
b = NULL;
|
||||
} else {
|
||||
/* Keep the compressed page.
|
||||
Allocate a block descriptor for it. */
|
||||
b = buf_buddy_alloc(sizeof *b, FALSE);
|
||||
}
|
||||
|
||||
if (b) {
|
||||
ulint fold;
|
||||
|
||||
memcpy(b, bpage, sizeof *b);
|
||||
b->state = b->oldest_modification
|
||||
? BUF_BLOCK_ZIP_DIRTY
|
||||
: BUF_BLOCK_ZIP_PAGE;
|
||||
|
||||
fold = buf_page_address_fold(b->space,
|
||||
b->offset);
|
||||
|
||||
HASH_INSERT(buf_page_t, hash,
|
||||
buf_pool->page_hash, fold, b);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user