Bug #98530 crash when inplace encryption resumes makes tablespace unusable

Submitted: 10 Feb 2020 9:27 Modified: 17 Sep 2020 16:25
Reporter: Satya Bodapati (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S2 (Serious)
Version:8.0, 8.0.19 OS:Any
Assigned to: CPU Architecture:Any

[10 Feb 2020 9:27] Satya Bodapati
Description:
kill server when ALTER TABLESPACE ENCRYPTION='Y'/'N' is in progress.
When recovery happens, kill the server again at the moment it 'resume encryption' operation is about update DD.

Server fails to load tablespace in next startup

2020-02-10T09:20:40.824917Z 7 [ERROR] [MY-012219] [InnoDB] In file 'encrypt_ts.ibd', tablespace id and flags are 4 and 26624, but in the InnoDB data dictionary they are 4 and 18432. Have you moved InnoDB .ibd files around without using the commands DISCARD TABLESPACE and IMPORT TABLESPACE? Please refer to http://dev.mysql.com/doc/refman/8.0/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
2020-02-10T09:20:40.824930Z 7 [ERROR] [MY-012131] [InnoDB] Could not find a valid tablespace file for `encrypt_ts`. Please refer to http://dev.mysql.com/doc/refman/8.0/en/innodb-troubleshooting-datadict.html for how to resolve the issue.

How to repeat:
Apply attached patch. Run attached mtr testcase.
[10 Feb 2020 9:28] Satya Bodapati
mtr testcase

Attachment: tablespace_encrypt_2_crash.test (application/octet-stream, text), 3.48 KiB.

[10 Feb 2020 9:28] Satya Bodapati
mtr testcase

Attachment: tablespace_encrypt_2_crash.test (application/octet-stream, text), 3.48 KiB.

[10 Feb 2020 9:29] Satya Bodapati
debug crash point change

Attachment: 98530_code_change.diff (text/x-patch), 539 bytes.

[10 Feb 2020 9:30] Satya Bodapati
=============================================================================
                  TEST NAME                       RESULT  TIME (ms) COMMENT
------------------------------------------------------------------------------
[100%] innodb.tablespace_encrypt_2_crash         [ fail ]
        Test ended at 2020-02-10 14:50:41

CURRENT_TEST: innodb.tablespace_encrypt_2_crash
mysqltest: At line 77: Query 'SELECT * FROM t1 LIMIT 10' failed.
ERROR 1812 (HY000): Tablespace is missing for table `test`.`t1`.
safe_process[17324]: Child process: 17325, exit: 1
[10 Feb 2020 9:39] Satya Bodapati
This resume thread exits after it finishes its work. So I couldn't avoid sleeps.. Would ideally avoid sleeps to get deterministic case..
May be a combination of debug_sync and debug_execute_if can avoid that..
[12 Feb 2020 11:28] MySQL Verification Team
Hello Satya,

Thank you for the report and feedback!

regards,
Umesh
[17 Sep 2020 16:25] Daniel Price
Posted by developer:
 
Fixed as of the upcoming 8.0.23 release, and here's the proposed changelog entry from the documentation team:

An interrupted tablespace encryption operation did not update the
encrypt_type table option information in the data dictionary when the
operation resume processing after the server was restarted.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.055 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.