View Issue Details

IDProjectCategoryView StatusLast Update
2105RackTablesdefaultpublic2024-12-17 11:11
Reportermfleurke Assigned To 
PriorityhighSeveritycrashReproducibilityalways
Status newResolutionopen 
Product Version0.22.0 
Summary2105: database tables can't be created on MySQL >= 8.4 because KEY is not unique
DescriptionWhen using MySQL 8.4 or higher, there are a few tables that can't be created because a Key is not unique and there is a foreign key that references it, and from MySQL 8.4 it's not allowed to reference non-unique KEYs.

the keys that are bad (not UNIQUE) are:
Object.id-tid
TagTree.id-is_assignable

The fix:
ALTER TABLE Object DROP KEY `id-tid`, ADD UNIQUE KEY `id-tid` (`id`,`objtype_id`);
ALTER TABLE TagTree DROP KEY `id-is_assignable`, ADD UNIQUE KEY `id-is_assignable` (`id`,`is_assignable`);
Steps To Reproducedo a restore backup or create a new instance of RackTables on MySQL 8.4 or higher.
Additional Informationhttps://bugs.mysql.com/bug.php?id=114838
TagsNo tags attached.

Activities

infrastation

infrastation

2024-12-12 16:34

administrator   ~0004587

Thank you for reporting this problem. The matter is, both Object.id and TagTree.id are unique because each is a primary key, therefore the compound keys are always unique. It is unfortunate that MySQL has lost the ability to verify this relation automatically.

Anyway, could you provide the steps to reproduce the problem? Which OS and MySQL version did you use?
mfleurke

mfleurke

2024-12-13 00:17

reporter   ~0004589

I was using
bash-5.1$ mysql --version
mysql Ver 9.1.0 for Linux on x86_64 (MySQL Community Server - GPL)
running on bash-5.1$ cat /etc/redhat-release
Red Hat Enterprise Linux release 9.4 (Plow)

and restoring a dump of racktables 0.21.5

There is a pull request to fix the bug:
https://github.com/RackTables/racktables/pull/291
mfleurke

mfleurke

2024-12-17 11:11

reporter   ~0004591

Another issue: when using a mysql cluster, it complains:
ERROR: The following tables do not have a Primary Key or equivalent column:
racktables_db.IPv4LB
 
Group Replication requires tables to use InnoDB and have a PRIMARY KEY or PRIMARY KEY Equivalent (non-null unique key). Tables that do not follow these requirements will be readable but not updateable when used with Group Replication. If your applications make updates (INSERT, UPDATE or DELETE) to these tables, ensure they use the InnoDB storage engine and have a PRIMARY KEY or PRIMARY KEY Equivalent.
If you can't change the tables structure to include an extra visible key to be used as PRIMARY KEY, you can make use of the INVISIBLE COLUMN feature available since 8.0.23: https://dev.mysql.com/doc/refman/en/invisible-columns.html"

The solution:
ALTER TABLE IPv4LB
DROP INDEX `LB-VS`,
ADD PRIMARY KEY (`object_id`, `vs_id`);

Issue History

Date Modified Username Field Change
2024-12-12 15:45 mfleurke New Issue
2024-12-12 16:34 infrastation Note Added: 0004587
2024-12-13 00:17 mfleurke Note Added: 0004589
2024-12-17 11:11 mfleurke Note Added: 0004591