[MDEV-13205] InnoDB: Failing assertion: !dict_index_is_online_ddl(index) upon ALTER TABLE Created: 2017-06-29 Updated: 2018-08-15 Resolved: 2018-01-08 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Alter Table, Storage Engine - InnoDB, Storage Engine - XtraDB |
| Affects Version/s: | 10.0, 10.1, 10.2, 10.3 |
| Fix Version/s: | 10.0.34, 10.3.4, 10.1.31, 10.2.13 |
| Type: | Bug | Priority: | Major |
| Reporter: | Elena Stepanova | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Sprint: | 10.2.12 | ||||||||
| Description |
|
Run the test with repeat=N. So far repeat=5 has always been enough for me.
|
| Comments |
| Comment by Marko Mäkelä [ 2017-07-05 ] | ||||||||||||||
|
The ALTER TABLE t2 ADD UNIQUE(c) is aborted due to a duplicate key error, but the index stub cannot be dropped. So, the dict_table_t::drop_aborted flag was set. Normally this flag would be handled by the next ALGORITHM=INPLACE operation (if any). Normally, DML operations would skip aborted indexes. However, FOREIGN KEY operations use a different code path. The ALTER TABLE t3 ADD FOREIGN KEY (c) REFERENCES t2 (c); is wrongly choosing the above-mentioned index stub for check_index, and it is ultimately tripping the assertion. The root cause of this failure would seem to be that dict_foreign_t::referenced_index is wrongly set to point to an invalid index stub. The following patch is a step to the right direction, but it needs more work because the supplied test case would (with enough repetitions) occasionally fail in a different way:
| ||||||||||||||
| Comment by Marko Mäkelä [ 2018-01-08 ] | ||||||||||||||
|
It turns out that my fix is good for this, and the error for the ADD FOREIGN KEY is to be expected when the ADD UNIQUE INDEX failed earlier. I added a DEBUG_SYNC test to innodb.innodb-index-online. | ||||||||||||||
| Comment by Marko Mäkelä [ 2018-07-30 ] | ||||||||||||||
|
For the record, MySQL 5.6.41 and 5.7.23, which were just published on 2018-07-27, contain a similar fix, dated 2018-05-23. Coincidence? Also my | ||||||||||||||
| Comment by Marko Mäkelä [ 2018-08-14 ] | ||||||||||||||
|
Some race condition remains, causing a freed dict_index_t to be accessed, because I just repeated |