mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 19:11:46 +01:00
branches/zip: Fix two bugs in the relocation of block descriptors.
Improve diagnostics. buf_buddy_relocate(): Do not assume all small blocks to contain only one buf_page_t object. Require an exact size match, as in the case of compressed pages. buf_relocate(): Relocate buf_pool->LRU_old if needed. Validate the LRU list in debug builds. buf_LRU_block_remove_hashed_page(): Do not overwrite FIL_PAGE_OFFSET or FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID. The memory will be invalidated in debug builds of buf_buddy_free(). buf0buddy.c: Add assertions for not holding buf_pool->zip_mutex. The calling thread should not be holding any block->mutex, but it might be too time-consuming to assert against that, even #ifdef UNIV_SYNC_DEBUG.
This commit is contained in:
parent
324df09d57
commit
ede8e7bcd0
3 changed files with 13 additions and 4 deletions
|
@ -102,6 +102,7 @@ buf_buddy_block_free(
|
|||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
ut_a(mutex_own(&buf_pool->mutex));
|
||||
ut_a(!mutex_own(&buf_pool->zip_mutex));
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
ut_a(buf == ut_align_down(buf, UNIV_PAGE_SIZE));
|
||||
|
||||
|
@ -130,6 +131,7 @@ buf_buddy_block_register(
|
|||
ulint fold;
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
ut_a(mutex_own(&buf_pool->mutex));
|
||||
ut_a(!mutex_own(&buf_pool->zip_mutex));
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
buf_block_set_state(block, BUF_BLOCK_MEMORY);
|
||||
|
||||
|
@ -187,6 +189,7 @@ buf_buddy_alloc_clean(
|
|||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
ut_a(mutex_own(&buf_pool->mutex));
|
||||
ut_a(!mutex_own(&buf_pool->zip_mutex));
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
if (BUF_BUDDY_LOW << i >= PAGE_ZIP_MIN_SIZE
|
||||
|
@ -294,6 +297,7 @@ buf_buddy_alloc_low(
|
|||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
ut_a(mutex_own(&buf_pool->mutex));
|
||||
ut_a(!mutex_own(&buf_pool->zip_mutex));
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
if (i < BUF_BUDDY_SIZES) {
|
||||
|
@ -355,6 +359,7 @@ buf_buddy_relocate(
|
|||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
ut_a(mutex_own(&buf_pool->mutex));
|
||||
ut_a(!mutex_own(&buf_pool->zip_mutex));
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
ut_ad(!ut_align_offset(src, size));
|
||||
ut_ad(!ut_align_offset(dst, size));
|
||||
|
@ -418,7 +423,7 @@ buf_buddy_relocate(
|
|||
}
|
||||
|
||||
mutex_exit(mutex);
|
||||
} else {
|
||||
} else if (i == buf_buddy_get_slot(sizeof(buf_page_t))) {
|
||||
/* This must be a buf_page_t object. */
|
||||
bpage = (buf_page_t*) src;
|
||||
|
||||
|
@ -484,6 +489,7 @@ buf_buddy_free_low(
|
|||
buf_page_t* buddy;
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
ut_a(mutex_own(&buf_pool->mutex));
|
||||
ut_a(!mutex_own(&buf_pool->zip_mutex));
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
recombine:
|
||||
if (i == BUF_BUDDY_SIZES) {
|
||||
|
|
|
@ -990,6 +990,12 @@ buf_relocate(
|
|||
UT_LIST_ADD_FIRST(LRU, buf_pool->LRU, dpage);
|
||||
}
|
||||
|
||||
if (UNIV_UNLIKELY(buf_pool->LRU_old == bpage)) {
|
||||
buf_pool->LRU_old = dpage;
|
||||
}
|
||||
|
||||
ut_d(UT_LIST_VALIDATE(LRU, buf_page_t, buf_pool->LRU));
|
||||
|
||||
/* relocate buf_pool->page_hash */
|
||||
fold = buf_page_address_fold(bpage->space, bpage->offset);
|
||||
|
||||
|
|
|
@ -1094,9 +1094,6 @@ buf_LRU_block_remove_hashed_page(
|
|||
ut_ad(!bpage->in_LRU_list);
|
||||
ut_a(bpage->zip.data);
|
||||
ut_a(buf_page_get_zip_size(bpage));
|
||||
memset(bpage->zip.data + FIL_PAGE_OFFSET, 0xff, 4);
|
||||
memset(bpage->zip.data + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID,
|
||||
0xff, 4);
|
||||
|
||||
UT_LIST_REMOVE(list, buf_pool->zip_clean, bpage);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue