MDEV-22650 Dirty compressed page checksum validation fails

Problem:
=======
  While evicting the uncompressed page from buffer pool, InnoDB writes
the checksum for the compressed page in buf_LRU_free_page().
So while flushing the compressed page, checksum validation fails
when innodb_checksum_algorithm variable changed to strict_none.

Solution:
========
- Calculate the checksum only during flushing of page. Removed the
checksum write in buf_LRU_free_page().
parent 83d0e72b
......@@ -4625,7 +4625,7 @@ buf_page_get_low(
buf_pool->mutex or block->mutex. */
{
bool success = buf_zip_decompress(block, TRUE);
bool success = buf_zip_decompress(block, false);
if (!success) {
buf_pool_mutex_enter(buf_pool);
......
......@@ -1069,10 +1069,8 @@ buf_flush_write_block_low(
case BUF_BLOCK_ZIP_DIRTY:
frame = bpage->zip.data;
mach_write_to_8(frame + FIL_PAGE_LSN,
bpage->newest_modification);
ut_a(page_zip_verify_checksum(frame, bpage->size.physical()));
buf_flush_update_zip_checksum(frame, bpage->size.physical(),
bpage->newest_modification);
break;
case BUF_BLOCK_FILE_PAGE:
frame = bpage->zip.data;
......
......@@ -1617,27 +1617,6 @@ buf_LRU_free_page(
UNIV_MEM_INVALID(((buf_block_t*) bpage)->frame,
UNIV_PAGE_SIZE);
if (b != NULL) {
/* Compute and stamp the compressed page
checksum while not holding any mutex. The
block is already half-freed
(BUF_BLOCK_REMOVE_HASH) and removed from
buf_pool->page_hash, thus inaccessible by any
other thread. */
ut_ad(b->size.is_compressed());
const uint32_t checksum = page_zip_calc_checksum(
b->zip.data,
b->size.physical(),
static_cast<srv_checksum_algorithm_t>(
srv_checksum_algorithm));
mach_write_to_4(b->zip.data + FIL_PAGE_SPACE_OR_CHKSUM,
checksum);
}
buf_pool_mutex_enter(buf_pool);
if (b != NULL) {
......
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