Commit 19263724 authored by Marko Mäkelä's avatar Marko Mäkelä

Add Valgrind checks to catch uninitialized writes to data files.

buf_flush_insert_into_flush_list(),
buf_flush_insert_sorted_into_flush_list(),
buf_flush_post_to_doublewrite_buf(): Check that the page is initialized.
parent 39be66c7
......@@ -249,6 +249,17 @@ buf_flush_insert_into_flush_list(
ut_d(block->page.in_flush_list = TRUE);
UT_LIST_ADD_FIRST(list, buf_pool->flush_list, &block->page);
#ifdef UNIV_DEBUG_VALGRIND
{
ulint zip_size = buf_block_get_zip_size(block);
if (UNIV_UNLIKELY(zip_size)) {
UNIV_MEM_ASSERT_RW(block->page.zip.data, zip_size);
} else {
UNIV_MEM_ASSERT_RW(block->frame, UNIV_PAGE_SIZE);
}
}
#endif /* UNIV_DEBUG_VALGRIND */
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
ut_a(buf_flush_validate_low());
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
......@@ -276,6 +287,18 @@ buf_flush_insert_sorted_into_flush_list(
ut_ad(!block->page.in_flush_list);
ut_d(block->page.in_flush_list = TRUE);
#ifdef UNIV_DEBUG_VALGRIND
{
ulint zip_size = buf_block_get_zip_size(block);
if (UNIV_UNLIKELY(zip_size)) {
UNIV_MEM_ASSERT_RW(block->page.zip.data, zip_size);
} else {
UNIV_MEM_ASSERT_RW(block->frame, UNIV_PAGE_SIZE);
}
}
#endif /* UNIV_DEBUG_VALGRIND */
prev_b = NULL;
/* For the most part when this function is called the flush_rbt
......@@ -809,6 +832,7 @@ try_again:
zip_size = buf_page_get_zip_size(bpage);
if (UNIV_UNLIKELY(zip_size)) {
UNIV_MEM_ASSERT_RW(bpage->zip.data, zip_size);
/* Copy the compressed page and clear the rest. */
memcpy(trx_doublewrite->write_buf
+ UNIV_PAGE_SIZE * trx_doublewrite->first_free,
......@@ -818,6 +842,8 @@ try_again:
+ zip_size, 0, UNIV_PAGE_SIZE - zip_size);
} else {
ut_a(buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE);
UNIV_MEM_ASSERT_RW(((buf_block_t*) bpage)->frame,
UNIV_PAGE_SIZE);
memcpy(trx_doublewrite->write_buf
+ UNIV_PAGE_SIZE * trx_doublewrite->first_free,
......
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