Commit 8341f582 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-15527 fixup for innodb_checksum_algorithm=full_crc32

parent 50de71b0
[strict_crc32]
--innodb-checksum-algorithm=strict_crc32
[strict_full_crc32]
--innodb-checksum-algorithm=strict_full_crc32
[strict_crc32]
--innodb-checksum-algorithm=strict_crc32
[strict_full_crc32]
--innodb-checksum-algorithm=strict_full_crc32
...@@ -3356,6 +3356,7 @@ struct fil_iterator_t { ...@@ -3356,6 +3356,7 @@ struct fil_iterator_t {
tablespace involved. It does help to save the disk space when tablespace involved. It does help to save the disk space when
punch hole is enabled punch hole is enabled
@param iter Tablespace iterator @param iter Tablespace iterator
@param full_crc32 whether the file is in the full_crc32 format
@param write_request Request to write into the file @param write_request Request to write into the file
@param offset offset of the file to be written @param offset offset of the file to be written
@param writeptr buffer to be written @param writeptr buffer to be written
...@@ -3365,16 +3366,19 @@ punch hole is enabled ...@@ -3365,16 +3366,19 @@ punch hole is enabled
@return DB_SUCCESS */ @return DB_SUCCESS */
static static
dberr_t fil_import_compress_fwrite(const fil_iterator_t &iter, dberr_t fil_import_compress_fwrite(const fil_iterator_t &iter,
bool full_crc32,
const IORequest &write_request, const IORequest &write_request,
os_offset_t offset, os_offset_t offset,
const byte *writeptr, const byte *writeptr,
ulint n_bytes, ulint n_bytes,
bool try_punch_only= false) bool try_punch_only= false)
{ {
dberr_t err= os_file_punch_hole(iter.file, offset, n_bytes); if (dberr_t err= os_file_punch_hole(iter.file, offset, n_bytes))
if (err != DB_SUCCESS || try_punch_only)
return err; return err;
if (try_punch_only)
return DB_SUCCESS;
for (ulint j= 0; j < n_bytes; j+= srv_page_size) for (ulint j= 0; j < n_bytes; j+= srv_page_size)
{ {
/* Read the original data length from block and /* Read the original data length from block and
...@@ -3388,16 +3392,23 @@ dberr_t fil_import_compress_fwrite(const fil_iterator_t &iter, ...@@ -3388,16 +3392,23 @@ dberr_t fil_import_compress_fwrite(const fil_iterator_t &iter,
/* Ignore the empty page */ /* Ignore the empty page */
if (ptype == 0 && n_write_bytes == 0) if (ptype == 0 && n_write_bytes == 0)
continue; continue;
n_write_bytes+= FIL_PAGE_DATA + FIL_PAGE_ENCRYPT_COMP_METADATA_LEN; if (full_crc32)
n_write_bytes= buf_page_full_crc32_size(writeptr + j,
nullptr, nullptr);
else
{
n_write_bytes+= ptype == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED
? FIL_PAGE_DATA + FIL_PAGE_ENCRYPT_COMP_METADATA_LEN
: FIL_PAGE_DATA + FIL_PAGE_COMP_METADATA_LEN;
} }
err= os_file_write(write_request, iter.filepath, iter.file,
writeptr + j, offset + j, n_write_bytes);
if (err != DB_SUCCESS)
break;
} }
if (dberr_t err= os_file_write(write_request, iter.filepath, iter.file,
writeptr + j, offset + j, n_write_bytes))
return err; return err;
}
return DB_SUCCESS;
} }
/********************************************************************//** /********************************************************************//**
...@@ -3721,8 +3732,8 @@ fil_iterate( ...@@ -3721,8 +3732,8 @@ fil_iterate(
if (page_compressed && punch_hole) { if (page_compressed && punch_hole) {
err = fil_import_compress_fwrite( err = fil_import_compress_fwrite(
iter, write_request, offset, writeptr, n_bytes, iter, full_crc32, write_request, offset,
!updated); writeptr, n_bytes, !updated);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
punch_hole = false; punch_hole = false;
......
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