MDEV-34372 Temporary tablespace decryption fails with ER_NOT_KEYFILE #3455
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Reason:
Temporary tablespace uses the innodb redo encryption key and key
version(v1) to encrypt the temporary tablespace/files. When encryption key rotation happens, InnoDB assigns the new redo encryption key version(v2) during checkpoint. After this, InnoDB encrypts the temporary tablespace pages using key version (v2). This lead to failure of decrypting the temporary tablespace pages which was encrypted using key version (v1).
Fix:
Store the temporary file/tablespace key and key version
seperately during redo log initialization. Even though InnoDB does key rotation, it doesn't affect temporary file key and key version.
log_crypt_init(): Assign the temporary file/tablespace key and key version
i_s_dict_fill_temp_tablespaces_encryption(): Adds the temporary tablespace information if
innodb_encrypt_temporary_tables is enabled
How can this PR be tested?
./mtr encryption.redo_key_rotation --mem
Basing the PR against the correct MariaDB version
PR quality check