summaryrefslogtreecommitdiff
path: root/storage/innobase/fsp
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2017-08-29 14:23:34 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2017-08-29 14:23:34 +0300
commit352d27ce36bc807f0c3c803e192ad1851f7f86a0 (patch)
tree8b667bf665f6721f722850e8f22b94e59c171bdf /storage/innobase/fsp
parentdda40b930498b70bb5546f857b27744039a5649d (diff)
downloadmariadb-git-352d27ce36bc807f0c3c803e192ad1851f7f86a0.tar.gz
MDEV-13557: Startup failure, unable to decrypt ibdata1
Fixes also MDEV-13488: InnoDB writes CRYPT_INFO even though encryption is not enabled. Problem was that we created encryption metadata (crypt_data) for system tablespace even when no encryption was enabled and too early. System tablespace can be encrypted only using key rotation. Test innodb-key-rotation-disable, innodb_encryption, innodb_lotoftables require adjustment because INFORMATION_SCHEMA INNODB_TABLESPACES_ENCRYPTION contain row only if tablespace really has encryption metadata. fil_crypt_set_thread_cnt: Send message to background encryption threads if they exits when they are ready. This is required to find tablespaces requiring key rotation if no other changes happen. fil_crypt_find_space_to_rotate: Decrease the amount of time waiting when nothing happens to better enable key rotation on startup. fsp_header_init: Write encryption metadata to page 0 only if tablespace is encrypted or encryption is disabled by table option. i_s_dict_fill_tablespaces_encryption : Skip tablespaces that do not contain encryption metadata. This is required to avoid too early wait condition trigger in encrypted -> unencrypted state transfer. open_or_create_data_files: Do not create encryption metadata by default to system tablespace.
Diffstat (limited to 'storage/innobase/fsp')
-rw-r--r--storage/innobase/fsp/fsp0fsp.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc
index 0b66856d2c3..1cf37f366d7 100644
--- a/storage/innobase/fsp/fsp0fsp.cc
+++ b/storage/innobase/fsp/fsp0fsp.cc
@@ -726,7 +726,11 @@ fsp_header_init(ulint space_id, ulint size, mtr_t* mtr)
fil_space_t* space = fil_space_acquire(space_id);
ut_ad(space);
- if (space->crypt_data) {
+ /* Write encryption metadata to page 0 if tablespace is
+ encrypted or encryption is disabled by table option. */
+ if (space->crypt_data &&
+ (space->crypt_data->should_encrypt() ||
+ space->crypt_data->not_encrypted())) {
space->crypt_data->write_page0(page, mtr);
}