mirror of
https://github.com/MariaDB/server.git
synced 2025-02-02 03:51:50 +01:00
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.
This commit is contained in:
parent
d01ae09cca
commit
785eb0c7e9
2 changed files with 4 additions and 2 deletions
|
@ -2161,6 +2161,7 @@ buf_page_init_for_read(
|
|||
}
|
||||
}
|
||||
|
||||
rw_lock_x_lock(&block->lock);
|
||||
mutex_exit(&block->mutex);
|
||||
mutex_exit(&buf_pool->zip_mutex);
|
||||
|
||||
|
@ -2174,6 +2175,7 @@ buf_page_init_for_read(
|
|||
}
|
||||
|
||||
buf_zip_decompress(block, srv_use_checksums);
|
||||
rw_lock_x_unlock(&block->lock);
|
||||
|
||||
return(NULL);
|
||||
case BUF_BLOCK_FILE_PAGE:
|
||||
|
|
|
@ -2401,8 +2401,6 @@ page_zip_validate(
|
|||
page_t* temp_page;
|
||||
ibool valid;
|
||||
|
||||
ut_a(page_is_comp(page));
|
||||
|
||||
if (memcmp(page_zip->data + FIL_PAGE_PREV, page + FIL_PAGE_PREV,
|
||||
FIL_PAGE_LSN - FIL_PAGE_PREV)
|
||||
|| memcmp(page_zip->data + FIL_PAGE_TYPE, page + FIL_PAGE_TYPE, 2)
|
||||
|
@ -2412,6 +2410,8 @@ page_zip_validate(
|
|||
return(FALSE);
|
||||
}
|
||||
|
||||
ut_a(page_is_comp(page));
|
||||
|
||||
if (page_zip_validate_header_only) {
|
||||
return(TRUE);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue