[MDEV-7612] Assertins about FK lists and rb-tree not being in sync Created: 2015-02-20  Updated: 2020-08-25  Resolved: 2018-01-10

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table, Storage Engine - InnoDB
Affects Version/s: 5.5.41
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Hartmut Holzgraefe Assignee: Jan Lindström (Inactive)
Resolution: Cannot Reproduce Votes: 1
Labels: upstream

Sprint: 5.5.59

 Description   

http://bugs.mysql.com/bug.php?id=75977

Even with bug #73650 (private) fixed there seem to be cases
where the list of referenced keys and the corresponding
red-black trees (introduced in 5.5.39) are getting out of
sync and so are triggering the

UT_LIST_GET_LEN(table->referenced_list) == rbt_size(table->referenced_rbt)

assertion in dict_foreign_find() in innodb/dict/dict0dict.c

Bug #73761 was closed as duplicate of #73650 (but not marked
private) but it's not clear there whether the different
incidents reported on it are indeed fixed in 5.5.40

Debian bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=768489
shows the same assertion failure, but there the version is clearly
MySQL 5.5.40 which should have this fixed.

And I've also seen one case where the same assertion was triggered
in MariaDB 5.5.41 ... unfortunately there are not much details beyond
this that I can share. Backtrace was the same as with the other cases
and the statement that lead to it was of the form

ALTER TABLE `db1`.`t1` CHANGE COLUMN `some_id` `some_id` INT NOT NULL;

Unfortunately the table this happened on had since been dropped and
the some_id column didn't exist yet in the most recent schema version
that could be recovered.

Nonetheless we have at least two cases (Debian bug report and mine)
where the

UT_LIST_GET_LEN(table->referenced_list) == rbt_size(table->referenced_rbt)

assertion was hit in versions based on 5.5.40 and beyond that have the
fix for bug #73650 applied. So there still seem to be other unhandled
edge cases where the referenced_list and referenced_rbt structures get
out of sync ...

How to repeat:
Unfortunately I don't have anything better than

Do some ALTER operation on a table with foreign
key constraints ...

yet ...



 Comments   
Comment by Jan Lindström (Inactive) [ 2018-01-10 ]

Tried to repeat this using a test script that in a loop added/removed foreign key constraints, but could not repeat the reported assertion.

Generated at Thu Feb 08 07:20:56 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.