[MDEV-26866] FOREIGN KEY…SET NULL corrupts an index on a virtual column Created: 2021-10-20 Updated: 2021-11-01 Resolved: 2021-10-28 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB, Virtual Columns |
| Affects Version/s: | 10.2, 10.3, 10.4, 10.5, 10.6, 10.7 |
| Fix Version/s: | 10.2.41, 10.3.32, 10.4.22, 10.5.13, 10.6.5, 10.7.1 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Marko Mäkelä | Assignee: | Nikita Malyavin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | corruption, upstream | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
MySQL 5.7.36 includes a bug fix with a test case:
Curiously, if I add CHECK TABLE to the test, it will not report any corruption. |
| Comments |
| Comment by Marko Mäkelä [ 2021-10-20 ] | |||||||||||||||||||||||||||||||
|
nikitamalyavin, I applied the test from the patch to MariaDB as foreign_key.patch This is otherwise the same as the original test, but there now is a trailing space in two WHERE conditions in the .test file. I wanted to see if it matters. With that, and with or without my attempted crude port of the fix, the test still fails like this:
| |||||||||||||||||||||||||||||||
| Comment by Nikita Malyavin [ 2021-10-22 ] | |||||||||||||||||||||||||||||||
|
By most, the problem was in the following call:
We want new_vfield, but fetch it from update->old_vrow, where actually some 'new row' should be used. Unfortunately, in case of DELETE, cascade->row corresponding the new row, is NULL Then Sachin Agarwal's trick was to NULL the old fields in place:
The direct patch application could have failed, but it works fine with a little bit more context applied. please review the following commits: | |||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2021-10-25 ] | |||||||||||||||||||||||||||||||
|
Please address my review comments and prepare also a 10.6 version for additional stress testing. | |||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2021-10-27 ] | |||||||||||||||||||||||||||||||
|
This looks like very welcome cleanup. OK to push if the stress tests pass. | |||||||||||||||||||||||||||||||
| Comment by Matthias Leich [ 2021-10-27 ] | |||||||||||||||||||||||||||||||
|
|