[Bug 43469] New: Duplicate records in biblio and deletedbiblio tables if deleting records metadata fails
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43469 Bug ID: 43469 Summary: Duplicate records in biblio and deletedbiblio tables if deleting records metadata fails Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Cataloging Assignee: koha-bugs@lists.koha-community.org Reporter: emmi.takkinen@koha-suomi.fi QA Contact: testopia@bugs.koha-community.org CC: m.de.rooy@rijksmuseum.nl Target Milestone: --- A while ago we faced a deadlock problem with our biblio_metadata table. This led to our biblio record deletion background jobs to fail, leaving duplicate records in biblio and deletedbiblio tables, moving biblioitems row to deletedbiblioitems and leaving metadata to biblio_metadata table. While this really is an edge case and happened because our own scripts were interfering delete process of metadata, I suggest that we add rollback to addbiblio.pl in case something goes wrong with delete. Also we should handle FIXME in line 867 and move error message to template alert. This is tricky to reproduce and only way I could think of is to break code in sub _koha_delete_biblio_metadata directly. To reproduce: 1. Create a biblio record. 2. Find sub _koha_delete_biblio_metadata from Biblio.pm and break it e.g. remove one column from SQL query. 3. Attempt to delete biblio. => Error "ERROR when DELETING BIBLIO x : Exception raised - DBI Exception: DBD::mysql::db do failed..." is raised but not as standard template error as in other error cases. 4. Search your biblio from database. => Note that biblio is in both biblio and deletedbiblio table. => Note that biblio has been inserted to deletedbiblioitems table and deleted from biblioitems table. => Note that biblios metadata is still in biblio_metadata table but not in deletedbiblio_metadata table. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43469 Emmi Takkinen <emmi.takkinen@koha-suomi.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |emmi.takkinen@koha-suomi.fi |ity.org | Status|NEW |Needs Signoff --- Comment #1 from Emmi Takkinen <emmi.takkinen@koha-suomi.fi> --- Created attachment 205141 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205141&action=edit Bug 43469: Rollback deleting biblio if error occurs In some edge cases, deleting a biblio can fail for example due error deleting biblios metadata. When this happens biblio is left both in biblio and deletedbiblio tables, moved to deletedbiblioitems table and left to biblio_metadata table. This patch adds rollback to prevent this from happening and changes the way error is displayed in UI. To test: 1. Create a biblio record. 2. Find sub _koha_delete_biblio_metadata from Biblio.pm and break it, e.g. remove one column from SQL query. 3. Attempt to delete biblio. => Error "ERROR when DELETING BIBLIO x : Exception raised - DBI Exception: DBD::mysql::db do failed..." is raised but not as standard template error as in other error cases. 4. Search your biblio from database. => Note that biblio is in both biblio and deletedbiblio table. => Note that biblio has been inserted to deletedbiblioitems table and deleted from biblioitems table. => Note that biblios metadata is still in biblio_metadata table but not in deletedbiblio_metadata table. 5. Apply this patch. 6. Create a new biblio or use previously created one (remember to remove biblio from deletedbiblio table and insert biblioitems row back). 7. Break code again and attempt to delete biblio. => Standard template error is displayed. => Detailed error message is displayed in logs. 8. Search your biblio from database. => Confirm that biblio is not in deletedbiblio, deleteditems or deletedbiblio_metadata tables. Sponsored-by: Koha-Suomi Oy -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org