Bug #107891 Allow mysql to load the local manifest file from a different data directory
Submitted: 15 Jul 2022 6:08 Modified: 15 Jul 2022 12:56
Reporter: Phong Dinh Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Security: Encryption Severity:S3 (Non-critical)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: keyring component, keyring plugin

[15 Jul 2022 6:08] Phong Dinh
Description:
When re-initialise MySQL to enable innodb_sys_tablespace_encrypt, in case of using a local manifest file for keyring component, we need to prepare the local manifest file in the datadir. So then when initializing, mysql detects that the datadir is not empty and the initializing failed.

It is not possible to comply both these two conditions when we want to use local manifest file to install keyring component

Condition 1: A keyring component or plugin must be loaded early during the server startup sequence so that other components can access it as necessary during their own initialization. For example, the InnoDB storage engine uses the keyring for tablespace encryption, so a keyring component or plugin must be loaded and available prior to InnoDB initialization.

If the data directory exists but is not empty (that is, it contains files or subdirectories), the server exits after producing an error message

We can use global manifest file for initializing but when we have multiple instances in the same host, it becomes a problem

How to repeat:
- Start MySQL without enabling innodb_sys_tablespace_encrypt
- Stop MýQL, delete the data dir to enable  innodb_sys_tablespace_encrypt
- Prepare a local manifest file in the datadir, and in the global manifest file indicates the use of a local manifest file
- Start MySQL, 

Suggested fix:
- Allow MySQL to read the local manifest file from a different directory

OR

- When initializing, allow MySQL to ignore the existing mysqld.my (local manifest file)
[15 Jul 2022 12:56] MySQL Verification Team
Hi Mr. Dinh,

Thank you for your bug report.

However, this is not a bug.

Please use 8.0.29 and read our Reference Manual for that release. You will see how the use of the global manifest file resolves that problem.

Not a bug.