Commit 69afb619 authored by marko's avatar marko

branches/zip: buf_LRU_free_block(): Correct the logic for releasing

dirty uncompressed blocks.  Move the page_zip_validate() call to
a more appropriate place, buf_LRU_block_remove_hashed_page().

buf_LRU_block_remove_hashed_page(): Allow bpage->oldest_modification != 0
for uncompressed pages if there is a compressed page that will be preserved.
Release the mutexes before calling buf_print() and buf_LRU_print().

page_zip_validate(): Remove the assertion containing the
buf_frame_get_page_zip() call.  We might already be holding buf_pool->mutex.
parent f54da50c
...@@ -903,10 +903,20 @@ buf_LRU_free_block( ...@@ -903,10 +903,20 @@ buf_LRU_free_block(
return(FALSE); return(FALSE);
} }
if (bpage->oldest_modification if (bpage->oldest_modification) {
&& (zip || buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE)) {
/* Do not completely free dirty blocks. */ /* Do not completely free dirty blocks. */
ut_ad(bpage->in_flush_list);
if (zip || !bpage->zip.data) {
return(FALSE);
}
if (buf_page_get_state(bpage) != BUF_BLOCK_FILE_PAGE) {
ut_ad(buf_page_get_state(bpage)
== BUF_BLOCK_ZIP_DIRTY);
return(FALSE);
}
return(FALSE); return(FALSE);
} }
...@@ -935,10 +945,6 @@ buf_LRU_free_block( ...@@ -935,10 +945,6 @@ buf_LRU_free_block(
(BUF_BLOCK_REMOVE_HASH) and removed from (BUF_BLOCK_REMOVE_HASH) and removed from
buf_pool->page_hash, thus inaccessible by any buf_pool->page_hash, thus inaccessible by any
other thread. */ other thread. */
#ifdef UNIV_ZIP_DEBUG
ut_a(page_zip_validate(&bpage->zip,
((buf_block_t*) bpage)->frame));
#endif /* UNIV_ZIP_DEBUG */
mach_write_to_4( mach_write_to_4(
bpage->zip.data + FIL_PAGE_SPACE_OR_CHKSUM, bpage->zip.data + FIL_PAGE_SPACE_OR_CHKSUM,
...@@ -1084,7 +1090,6 @@ buf_LRU_block_remove_hashed_page( ...@@ -1084,7 +1090,6 @@ buf_LRU_block_remove_hashed_page(
ut_a(buf_page_get_io_fix(bpage) == BUF_IO_NONE); ut_a(buf_page_get_io_fix(bpage) == BUF_IO_NONE);
ut_a(bpage->buf_fix_count == 0); ut_a(bpage->buf_fix_count == 0);
ut_a(bpage->oldest_modification == 0);
buf_LRU_remove_block(bpage); buf_LRU_remove_block(bpage);
...@@ -1093,8 +1098,20 @@ buf_LRU_block_remove_hashed_page( ...@@ -1093,8 +1098,20 @@ buf_LRU_block_remove_hashed_page(
switch (buf_page_get_state(bpage)) { switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_FILE_PAGE: case BUF_BLOCK_FILE_PAGE:
buf_block_modify_clock_inc((buf_block_t*) bpage); buf_block_modify_clock_inc((buf_block_t*) bpage);
if (bpage->zip.data) {
ut_a(!zip || bpage->oldest_modification == 0);
#ifdef UNIV_ZIP_DEBUG
ut_a(fil_page_get_type(bpage->zip.data)
!= FIL_PAGE_INDEX
|| page_zip_validate(&bpage->zip,
((buf_block_t*) bpage)
->frame));
#endif /* UNIV_ZIP_DEBUG */
break; break;
}
/* fall through */
case BUF_BLOCK_ZIP_PAGE: case BUF_BLOCK_ZIP_PAGE:
ut_a(bpage->oldest_modification == 0);
break; break;
case BUF_BLOCK_ZIP_FREE: case BUF_BLOCK_ZIP_FREE:
case BUF_BLOCK_ZIP_DIRTY: case BUF_BLOCK_ZIP_DIRTY:
...@@ -1125,6 +1142,8 @@ buf_LRU_block_remove_hashed_page( ...@@ -1125,6 +1142,8 @@ buf_LRU_block_remove_hashed_page(
} }
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
mutex_exit(buf_page_get_mutex(bpage));
mutex_exit(&buf_pool->mutex);
buf_print(); buf_print();
buf_LRU_print(); buf_LRU_print();
buf_validate(); buf_validate();
......
...@@ -2401,7 +2401,6 @@ page_zip_validate( ...@@ -2401,7 +2401,6 @@ page_zip_validate(
page_t* temp_page; page_t* temp_page;
ibool valid; ibool valid;
ut_a(buf_frame_get_page_zip((byte*) page) == page_zip);
ut_a(page_is_comp(page)); ut_a(page_is_comp(page));
if (memcmp(page_zip->data + FIL_PAGE_PREV, page + FIL_PAGE_PREV, if (memcmp(page_zip->data + FIL_PAGE_PREV, page + FIL_PAGE_PREV,
......
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