Commit 1f7bc8e2 authored by marko's avatar marko

branches/zip: Remove a race condition.

buf_page_init_for_read(): Protect the buf_zip_decompress() call with
an X-lock on the block.

page_zip_validate(): Move the page_is_comp() assertion after the
page header comparison.
parent b25ed2da
...@@ -2161,6 +2161,7 @@ buf_page_init_for_read( ...@@ -2161,6 +2161,7 @@ buf_page_init_for_read(
} }
} }
rw_lock_x_lock(&block->lock);
mutex_exit(&block->mutex); mutex_exit(&block->mutex);
mutex_exit(&buf_pool->zip_mutex); mutex_exit(&buf_pool->zip_mutex);
...@@ -2174,6 +2175,7 @@ buf_page_init_for_read( ...@@ -2174,6 +2175,7 @@ buf_page_init_for_read(
} }
buf_zip_decompress(block, srv_use_checksums); buf_zip_decompress(block, srv_use_checksums);
rw_lock_x_unlock(&block->lock);
return(NULL); return(NULL);
case BUF_BLOCK_FILE_PAGE: case BUF_BLOCK_FILE_PAGE:
......
...@@ -2401,8 +2401,6 @@ page_zip_validate( ...@@ -2401,8 +2401,6 @@ page_zip_validate(
page_t* temp_page; page_t* temp_page;
ibool valid; ibool valid;
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,
FIL_PAGE_LSN - FIL_PAGE_PREV) FIL_PAGE_LSN - FIL_PAGE_PREV)
|| memcmp(page_zip->data + FIL_PAGE_TYPE, page + FIL_PAGE_TYPE, 2) || memcmp(page_zip->data + FIL_PAGE_TYPE, page + FIL_PAGE_TYPE, 2)
...@@ -2412,6 +2410,8 @@ page_zip_validate( ...@@ -2412,6 +2410,8 @@ page_zip_validate(
return(FALSE); return(FALSE);
} }
ut_a(page_is_comp(page));
if (page_zip_validate_header_only) { if (page_zip_validate_header_only) {
return(TRUE); return(TRUE);
} }
......
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