Skip to content

Commit 89723ce

Browse files
After-merge fixup f84e28c
1 parent f84e28c commit 89723ce

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

mysql-test/suite/encryption/t/innodb_import.test

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
--source include/have_innodb.inc
2-
-- source include/have_example_key_management_plugin.inc
2+
--source include/have_example_key_management_plugin.inc
3+
--source include/innodb_checksum_algorithm.inc
34
--echo #
45
--echo # MDEV-26131 SEGV in ha_innobase::discard_or_import_tablespace
56
--echo #

mysql-test/suite/innodb/t/full_crc32_import.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ EOF
134134
ALTER TABLE t1 IMPORT TABLESPACE;
135135
--enable_warnings
136136
ALTER TABLE t1 DROP INDEX idx1;
137+
--replace_regex /opening '.*\/test\//opening '.\/test\//
137138
ALTER TABLE t1 IMPORT TABLESPACE;
138139
--disable_warnings
139140
SHOW CREATE TABLE t1;

storage/innobase/row/row0import.cc

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ struct FetchIndexRootPages : public AbstractCallback {
665665
@param block Block to use for IO
666666
@retval DB_SUCCESS or error code */
667667
dberr_t run(const fil_iterator_t& iter,
668-
buf_block_t* block) UNIV_NOTHROW;
668+
buf_block_t* block) UNIV_NOTHROW override;
669669

670670
/** Called for each block as it is read from the file.
671671
@param block block to convert, it is not from the buffer pool.
@@ -839,7 +839,8 @@ class PageConverter : public AbstractCallback {
839839
}
840840
}
841841

842-
dberr_t run(const fil_iterator_t& iter, buf_block_t* block) UNIV_NOTHROW
842+
dberr_t run(const fil_iterator_t& iter,
843+
buf_block_t* block) UNIV_NOTHROW override
843844
{
844845
return fil_iterate(iter, block, *this);
845846
}
@@ -3448,6 +3449,8 @@ dberr_t FetchIndexRootPages::run(const fil_iterator_t& iter,
34483449
#endif
34493450
srv_page_size;
34503451
byte* page_compress_buf = static_cast<byte*>(malloc(buf_size));
3452+
const bool full_crc32 = fil_space_t::full_crc32(m_space_flags);
3453+
bool skip_checksum_check = false;
34513454
ut_ad(!srv_read_only_mode);
34523455

34533456
if (!page_compress_buf)
@@ -3486,15 +3489,18 @@ dberr_t FetchIndexRootPages::run(const fil_iterator_t& iter,
34863489
goto func_exit;
34873490
}
34883491

3489-
page_compressed= fil_page_is_compressed_encrypted(readptr) ||
3490-
fil_page_is_compressed(readptr);
3492+
page_compressed=
3493+
(full_crc32 && fil_space_t::is_compressed(m_space_flags) &&
3494+
buf_page_is_compressed(readptr, m_space_flags)) ||
3495+
(fil_page_is_compressed_encrypted(readptr) ||
3496+
fil_page_is_compressed(readptr));
34913497

34923498
if (page_compressed && block->page.zip.data)
34933499
goto page_corrupted;
34943500

34953501
if (encrypted)
34963502
{
3497-
if (!fil_space_verify_crypt_checksum(readptr, zip_size))
3503+
if (!buf_page_verify_crypt_checksum(readptr, m_space_flags))
34983504
goto page_corrupted;
34993505

35003506
if (!fil_space_decrypt(get_space_id(), iter.crypt_data, readptr,
@@ -3503,15 +3509,21 @@ dberr_t FetchIndexRootPages::run(const fil_iterator_t& iter,
35033509
goto func_exit;
35043510
}
35053511

3512+
/* For full_crc32 format, skip checksum check
3513+
after decryption. */
3514+
skip_checksum_check= full_crc32 && encrypted;
3515+
35063516
if (page_compressed)
35073517
{
3508-
ulint compress_length= fil_page_decompress(page_compress_buf, readptr,
3518+
ulint compress_length= fil_page_decompress(page_compress_buf,
3519+
readptr,
35093520
m_space_flags);
35103521
ut_ad(compress_length != srv_page_size);
35113522
if (compress_length == 0)
35123523
goto page_corrupted;
35133524
}
3514-
else if (buf_page_is_corrupted(false, readptr, m_space_flags))
3525+
else if (!skip_checksum_check
3526+
&& buf_page_is_corrupted(false, readptr, m_space_flags))
35153527
goto page_corrupted;
35163528

35173529
err= this->operator()(block);

0 commit comments

Comments
 (0)