diff options
author | Jan Lindström <jan.lindstrom@mariadb.com> | 2015-08-07 15:21:20 +0300 |
---|---|---|
committer | Jan Lindström <jan.lindstrom@mariadb.com> | 2015-08-08 09:56:07 +0300 |
commit | 18b0176a058d7e6cc9a4f6886f32460345df8d0c (patch) | |
tree | f2387ca7cf5ca6ee17ff4906abf6216bc7443eb9 /storage/innobase/buf | |
parent | 3025c42605af4d3341d0df155525dc174fe10843 (diff) | |
download | mariadb-git-18b0176a058d7e6cc9a4f6886f32460345df8d0c.tar.gz |
MDEV-8410: Changing file-key-management to example-key-management causes crash and no real error
MDEV-8409: Changing file-key-management-encryption-algorithm causes crash and no real info why
Analysis: Both bugs has two different error cases. Firstly, at startup
when server reads latest checkpoint but requested key_version,
key management plugin or encryption algorithm or method is not found
leading corrupted log entry. Secondly, similarly when reading system
tablespace if requested key_version, key management plugin or encryption
algorithm or method is not found leading buffer pool page corruption.
Fix: Firsly, when reading checkpoint at startup check if the log record
may be encrypted and if we find that it could be encrypted, print error
message and do not start server. Secondly, if page is buffer pool seems
corrupted but we find out that there is crypt_info, print additional
error message before asserting.
Diffstat (limited to 'storage/innobase/buf')
-rw-r--r-- | storage/innobase/buf/buf0buf.cc | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 12115fde7f4..9fa0591c95c 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -4273,6 +4273,46 @@ buf_mark_space_corrupt( } /********************************************************************//** +Check if page is maybe compressed, encrypted or both when we encounter +corrupted page. Note that we can't be 100% sure if page is corrupted +or decrypt/decompress just failed. +*/ +static +void +buf_page_check_corrupt( +/*===================*/ + const buf_page_t* bpage) /*!< in/out: buffer page read from disk */ +{ + ulint zip_size = buf_page_get_zip_size(bpage); + byte* dst_frame = (zip_size) ? bpage->zip.data : + ((buf_block_t*) bpage)->frame; + unsigned key_version = + mach_read_from_4(dst_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION); + bool page_compressed = fil_page_is_compressed(dst_frame); + bool page_compressed_encrypted = fil_page_is_compressed_encrypted(dst_frame); + ulint space_id = mach_read_from_4( + dst_frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); + fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space_id); + fil_space_t* space = fil_space_found_by_id(space_id); + + if (key_version != 0 || + (crypt_data && crypt_data->type != CRYPT_SCHEME_UNENCRYPTED) || + page_compressed || page_compressed_encrypted) { + ib_logf(IB_LOG_LEVEL_ERROR, + "Maybe corruption: Block space_id %lu in file %s maybe corrupted\n" + "Reason could be that key_version in page %u \n" + "or in crypt_data %p could not be found,\n" + "key management plugin is not found or\n" + "used encryption algorithm or method does not match.\n" + "Page compressed %d, compressed and encrypted %d.\n", + space_id, space ? space->name : "NULL", + key_version, + crypt_data, + page_compressed, page_compressed_encrypted); + } +} + +/********************************************************************//** Completes an asynchronous read or write request of a file page to or from the buffer pool. @return true if successful */ @@ -4438,6 +4478,8 @@ corrupt: && buf_mark_space_corrupt(bpage)) { return(false); } else { + buf_page_check_corrupt(bpage); + fputs("InnoDB: Ending processing" " because of" " a corrupt database page.\n", |