[MDEV-31351] [MariaDB 10.3 -> MariaDB 10.6][InnoDB] Duplicate entry '...' for key 'unique_index' Created: 2023-05-26 Updated: 2023-08-20 Resolved: 2023-08-20 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Manipulation - Insert |
| Affects Version/s: | 10.6.12 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Luigi Troiano | Assignee: | Unassigned |
| Resolution: | Incomplete | Votes: | 0 |
| Labels: | innodb | ||
| Environment: |
Ubuntu 22.04 |
||
| Description |
|
Recently we upgraded mariadb from 10.3 to 10.6 and we are facing a weird problem. *Table structure:*
``` *Example of duplicates*: Rows in the table are managed with PHP and the query used is:
``` *SHOW VARIABLES 10.3(before upgrade):* DB structure is the same that was in 10.3, unique key was already there before upgrade. In 10.3 there weren't any duplicate rows. We restored the database from a backup(mysqldump) and everyday we need to delete duplicate rows. We also tried to re-create index many times. I suppose I just need to create a bug report We really don't understand why it happens. |
| Comments |
| Comment by Marko Mäkelä [ 2023-05-26 ] | |||||||||
|
Do you have any recent (physical, not logical like mysqldump) backup of the database from before the ugrade? If yes, can you please execute CHECK TABLE ordini_meta on MariaDB Server 10.3? I suspect that the InnoDB change buffer could have played a role in this. There was a bug in CREATE INDEX or ALTER TABLE…ADD INDEX that was rather recently found and fixed in Whatever caused the secondary index corruption, the easiest way to fix it is to rebuild the table:
If the table is large and you wish to save some I/O, you can also try to drop and re-create all corrupted secondary indexes:
| |||||||||
| Comment by Luigi Troiano [ 2023-05-26 ] | |||||||||
|
We already try "OPTIMIZE TABLE ordini_meta;" many times, it doesn't solve the issue. | |||||||||
| Comment by Luigi Troiano [ 2023-06-07 ] | |||||||||
|
It seems problem has been solved after following tuning.
| |||||||||
| Comment by Elena Stepanova [ 2023-07-23 ] | |||||||||
|
Do you (or did you before the tuning) have innodb_change_buffering set to anything other than none? Marko mentioned it in the first comment as well. |