[MDEV-28779] ALTER TABLE IMPORT TABLESPACE fails with Data structure corruption Created: 2022-06-08 Updated: 2023-03-10 Resolved: 2022-06-09 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Alter Table, Storage Engine - InnoDB |
| Affects Version/s: | 10.3, 10.4 |
| Fix Version/s: | 10.3.36, 10.4.26 |
| Type: | Bug | Priority: | Major |
| Reporter: | Sasha Pachev | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | not-10.5 | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
Attached is the MTR test that demonstrates the bug. Also a patch with a proposed fix. The problem is that during ALTER TABLE IMPORT TABLESPACE two things happen:
I believe the right thing to do is to not write the LSN at FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION for encrypted pages. At least it fixes the problem at hand. |
| Comments |
| Comment by Marko Mäkelä [ 2022-06-09 ] | |||||||||||||||||||||||
|
Thank you, spachev! I think that it is even simpler than that: the field should not be written at all. The history is:
| |||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-06-09 ] | |||||||||||||||||||||||
|
If I got it right, the time-consuming operations on the table db1.t1 in t2.test
With or without the patch, the IMPORT TABLESPACE would crash:
In the current 10.6, the same modification to the test would cause a different type of failure:
I will try to fix that as well. | |||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-06-09 ] | |||||||||||||||||||||||
|
The problem with the above test is that DISCARD TABLESPACE forgets that the tablespace was default-encrypted. If I add explicit ENCRYPTED=YES to the CREATE TABLE statement, the file can be imported. Preserving the .cfg file did not help. This finally reproduced the problem as reported. | |||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-06-09 ] | |||||||||||||||||||||||
|
It turns out that as part of |