[MDEV-30910] Error 1062 reported on insert after deletion of all table tuples Created: 2023-03-23 Updated: 2023-06-18 Resolved: 2023-06-18 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Manipulation - Delete, Data Manipulation - Insert, Platform RedHat, Storage Engine - InnoDB |
| Affects Version/s: | 10.4.26 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Andy Liu | Assignee: | Unassigned |
| Resolution: | Incomplete | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
The error 1062 (Duplicate entry) was reported when trying to insert tuple immediately after deleting all table tuples (The delete operation has been commited via mysql_query C API before insert): at 89661187 +++ 2023/03/22 07:46:48.549 FAULT HIGH dbload:4023999 E:7128 S:1 (MariadbTran.cpp 1536 v-0001 169.254.64.1 oam-a) Error: Statement 'insert into appcnfg.sipia_port_status (node_id, port_name, filler1, port_type, administrative_state, service_state) values (320, 'ecsf-stdn', 0, 10, 1, 1);' failed, rc = 1. Is it possible that the delete operation has not been fully committed (even mysql_query ("commit") returned success) while the insert comes? How to ensure a clean start for insert? |
| Comments |
| Comment by Daniel Black [ 2023-03-23 ] | ||||||||||||||
|
The return of commit success should be enough to say the transaction is committed. Can you include SHOW CREATE TABLE appcnfg.sipia_port_status. Any non-standard server settings (apart from binlog which I see active)? Was there a version that previously worked? | ||||||||||||||
| Comment by Andy Liu [ 2023-03-23 ] | ||||||||||||||
|
Thanks for the quick analysis. See below for the requested info: 1) Can you include SHOW CREATE TABLE appcnfg.sipia_port_status.
2) Any non-standard server settings (apart from binlog which I see active)? 3) Was there a version that previously worked? | ||||||||||||||
| Comment by Daniel Black [ 2023-03-23 ] | ||||||||||||||
|
assumptions the delete and insert are in different connections? this is occuring at a master rather than a replica? possibility 1 - insert into appcnf .. was in a repeatable read transaction that looked at the duplicate row before the delete SQL was executed? | ||||||||||||||
| Comment by Andy Liu [ 2023-03-23 ] | ||||||||||||||
|
assumptions the delete and insert are in different connections? this is occuring at a master rather than a replica? | ||||||||||||||
| Comment by Andy Liu [ 2023-04-03 ] | ||||||||||||||
|
Hi, Is there any advice for moving forward? | ||||||||||||||
| Comment by Sergei Golubchik [ 2023-05-19 ] | ||||||||||||||
|
I'm sorry, I failed to repeat the problem. Could you provide more info that would help me to repeat it? Or, ideally, provide a repeatable test case. Thanks. |