Commit 7319444c authored by marko's avatar marko

branches/zip: Improve Valgrind instrumentation.

buf_LRU_free_block(): Check that the block descriptor contains valid data.

buf_buddy_relocate(): Check that the source block contains valid data.

buf_page_get_gen(): Do not dereference bpage after calling buf_relocate().
This avoids a bogus Valgrind warning; the memory itself was valid.

buf_page_hash_get(): Check that the returned block descriptor contains
valid data.
parent 8b6467ce
......@@ -528,9 +528,8 @@ buf_buddy_relocate(
ut_ad(!mutex_own(&buf_pool->zip_mutex));
ut_ad(!ut_align_offset(src, size));
ut_ad(!ut_align_offset(dst, size));
#ifdef UNIV_DEBUG_VALGRIND
VALGRIND_CHECK_MEM_IS_ADDRESSABLE(dst, BUF_BUDDY_LOW << i);
#endif /* UNIV_DEBUG_VALGRIND */
UNIV_MEM_ASSERT_RW(src, size);
UNIV_MEM_ASSERT_W(dst, size);
/* We assume that all memory from buf_buddy_alloc()
is used for either compressed pages or buf_page_t
......
......@@ -1813,8 +1813,8 @@ wait_until_unfixed:
buf_block_init_low(block);
block->lock_hash_val = lock_rec_hash(space, offset);
UNIV_MEM_DESC(bpage->zip.data,
page_zip_get_size(&bpage->zip), block);
UNIV_MEM_DESC(&block->page.zip.data,
page_zip_get_size(&block->page.zip), block);
if (buf_page_get_state(&block->page)
== BUF_BLOCK_ZIP_PAGE) {
......@@ -1884,6 +1884,7 @@ wait_until_unfixed:
ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
mutex_enter(&block->mutex);
UNIV_MEM_ASSERT_RW(&block->page, sizeof block->page);
buf_block_buf_fix_inc(block, file, line);
mutex_exit(&buf_pool->mutex);
......
......@@ -949,6 +949,7 @@ buf_LRU_free_block(
ut_ad(buf_page_in_file(bpage));
ut_ad(bpage->in_LRU_list);
ut_ad(!bpage->in_flush_list == !bpage->oldest_modification);
UNIV_MEM_ASSERT_RW(bpage, sizeof *bpage);
if (!buf_page_can_relocate(bpage)) {
......
......@@ -897,9 +897,12 @@ buf_page_hash_get(
HASH_SEARCH(hash, buf_pool->page_hash, fold, buf_page_t*, bpage,
bpage->space == space && bpage->offset == offset);
ut_a(!bpage || buf_page_in_file(bpage));
ut_ad(!bpage || bpage->in_page_hash);
ut_ad(!bpage || !bpage->in_zip_hash);
if (bpage) {
ut_a(buf_page_in_file(bpage));
ut_ad(bpage->in_page_hash);
ut_ad(bpage->in_zip_hash);
UNIV_MEM_ASSERT_RW(bpage, sizeof *bpage);
}
return(bpage);
}
......
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