diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-10-10 15:19:44 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-10-10 15:24:14 +0300 |
commit | 0f7732d1d1d898f1a9051858932c18bcc9d6f2b4 (patch) | |
tree | d6d2e5e8c667e78a2302a1097ce955b7cb632c77 /storage | |
parent | c11e5cdd12a6ffbc3c95e0abff6cc86920d592fa (diff) | |
download | mariadb-git-0f7732d1d1d898f1a9051858932c18bcc9d6f2b4.tar.gz |
MDEV-19335 adjustment for innodb_checksum_algorithm=full_crc32
When MDEV-12026 introduced innodb_checksum_algorithm=full_crc32 in
MariaDB 10.4, it accidentally added a dependency on buf_page_t::encrypted.
Now that the flag has been removed, we must adjust the page-read routine.
buf_page_io_complete(): When the full_crc32 page checksum matches but the
tablespace ID in the page does not match after decrypting, we should
declare it a decryption failure and suppress the page dump output and
any attempts to re-read the page.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innobase/buf/buf0buf.cc | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index fa6a33662ad..7f00b27df0e 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -5955,7 +5955,7 @@ static dberr_t buf_page_check_corrupt(buf_page_t* bpage, fil_space_t* space) not decrypted and it could be either encrypted and corrupted or corrupted or good page. If we decrypted, there page could still be corrupted if used key does not match. */ - const bool seems_encrypted = (!space->full_crc32() && key_version) + const bool seems_encrypted = !space->full_crc32() && key_version && space->crypt_data && space->crypt_data->type != CRYPT_SCHEME_UNENCRYPTED; ut_ad(space->purpose != FIL_TYPE_TEMPORARY || space->full_crc32()); @@ -5970,7 +5970,6 @@ static dberr_t buf_page_check_corrupt(buf_page_t* bpage, fil_space_t* space) space->id, dst_frame, space->is_compressed())) { err = DB_PAGE_CORRUPTED; } - } else if (buf_page_is_corrupted(true, dst_frame, space->flags)) { err = DB_PAGE_CORRUPTED; } @@ -6085,13 +6084,26 @@ buf_page_io_complete(buf_page_t* bpage, bool dblwr, bool evict) } else if (read_space_id == 0 && read_page_no == 0) { /* This is likely an uninitialized page. */ - } else if ((bpage->id.space() != TRX_SYS_SPACE + } else if (((!space->full_crc32() + || bpage->id.space() != TRX_SYS_SPACE) && bpage->id.space() != read_space_id) || bpage->id.page_no() != read_page_no) { - /* We did not compare space_id to read_space_id - in the system tablespace, because the field - was written as garbage before MySQL 4.1.1, - which did not support innodb_file_per_table. */ + /* We do not compare space_id to read_space_id + in the system tablespace unless space->full_crc32(), + because the field was written as garbage before + MySQL 4.1.1, which introduced support for + innodb_file_per_table. */ + + if (space->full_crc32() + && *reinterpret_cast<uint32_t*> + (&frame[FIL_PAGE_FCRC32_KEY_VERSION]) + && space->crypt_data + && space->crypt_data->type + != CRYPT_SCHEME_UNENCRYPTED) { + ib::error() << "Cannot decrypt " << bpage->id; + err = DB_DECRYPTION_FAILED; + goto release_page; + } ib::error() << "Space id and page no stored in " "the page, read in are " @@ -6165,6 +6177,7 @@ database_corrupted: if (err == DB_PAGE_CORRUPTED || err == DB_DECRYPTION_FAILED) { +release_page: const page_id_t corrupt_page_id = bpage->id; buf_corrupt_page_release(bpage, space); |