Commit 9b967c4c authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-26826 fixup: ROW_FORMAT=COMPRESSED may corrupt buf_pool.page_hash

In commit c091a0bc we removed
the use of the HASH_ macros for inserting into
buf_pool.page_hash, or accessing buf_page_t::hash.

However, the binary buddy allocator for block->page.zip.data would
still use the HASH_ macros. HASH_INSERT and not HASH_DELETE would reset
the next-block pointer to the null pointer. Our replacement of
HASH_DELETE() will reset the next-block pointer, and the replacement of
HASH_INSERT() assumes that the pointer is the null pointer.

buf_LRU_block_free_non_file_page(): Assert that the next-block pointer
is the null pointer.

buf_buddy_block_free(): Reset the pointer before invoking
buf_LRU_block_free_non_file_page(). Without this, the added
assertion would fail in the test encryption.innochecksum.
parent 20f7fc6e
...@@ -362,6 +362,7 @@ buf_buddy_block_free(void* buf) ...@@ -362,6 +362,7 @@ buf_buddy_block_free(void* buf)
ut_ad(bpage->in_zip_hash); ut_ad(bpage->in_zip_hash);
ut_d(bpage->in_zip_hash = false); ut_d(bpage->in_zip_hash = false);
HASH_DELETE(buf_page_t, hash, &buf_pool.zip_hash, fold, bpage); HASH_DELETE(buf_page_t, hash, &buf_pool.zip_hash, fold, bpage);
bpage->hash = nullptr;
ut_d(memset(buf, 0, srv_page_size)); ut_d(memset(buf, 0, srv_page_size));
MEM_UNDEFINED(buf, srv_page_size); MEM_UNDEFINED(buf, srv_page_size);
......
...@@ -219,7 +219,7 @@ buf_pool.LRU. ...@@ -219,7 +219,7 @@ buf_pool.LRU.
The chains of free memory blocks (buf_pool.zip_free[]) are used by The chains of free memory blocks (buf_pool.zip_free[]) are used by
the buddy allocator (buf0buddy.cc) to keep track of currently unused the buddy allocator (buf0buddy.cc) to keep track of currently unused
memory blocks of size sizeof(buf_page_t)..srv_page_size / 2. These memory blocks of size UNIV_PAGE_SIZE_MIN..srv_page_size / 2. These
blocks are inside the srv_page_size-sized memory blocks of type blocks are inside the srv_page_size-sized memory blocks of type
BUF_BLOCK_MEMORY that the buddy allocator requests from the buffer BUF_BLOCK_MEMORY that the buddy allocator requests from the buffer
pool. The buddy allocator is solely used for allocating control pool. The buddy allocator is solely used for allocating control
......
...@@ -1010,6 +1010,7 @@ buf_LRU_block_free_non_file_page( ...@@ -1010,6 +1010,7 @@ buf_LRU_block_free_non_file_page(
ut_ad(!block->page.in_free_list); ut_ad(!block->page.in_free_list);
ut_ad(!block->page.oldest_modification()); ut_ad(!block->page.oldest_modification());
ut_ad(!block->page.in_LRU_list); ut_ad(!block->page.in_LRU_list);
ut_ad(!block->page.hash);
block->page.set_state(BUF_BLOCK_NOT_USED); block->page.set_state(BUF_BLOCK_NOT_USED);
......
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