[Bug 44348] New: Retrying a partial MARC import leaves the remaining records uncommitted
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44348 Bug ID: 44348 Summary: Retrying a partial MARC import leaves the remaining records uncommitted Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: MARC Bibliographic record staging/import Assignee: nugged@gmail.com Reporter: nugged@gmail.com QA Contact: testopia@bugs.koha-community.org Target Milestone: --- If a MARC batch import stops partway through, retrying the same batch after resolving the original problem can leave the new job at Started (0 / 3). The batch remains Staged and the remaining records are not added to the catalog. To reproduce on a test instance, stage the attached three-record MARC fixture with "Always add items" and no match rule. Start the import. The second item's library, NOPE, does not exist, so the job fails after importing the first record. Add the NOPE library under Administration > Libraries and import the same batch again. Expected: The retry finishes. The batch is Imported and all three records and items are in the catalog. Actual: The batch is still Staged and only the first record and item are present. The retry job stays Started at 0 / 3. The same rollback can occur when the web service import cron job retries a partially imported batch. It exits successfully, but the records processed on that retry are not committed. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44348 --- Comment #1 from Andrii Nugged <nugged@gmail.com> --- Created attachment 212856 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212856&action=edit Bug 44348: Finish a MARC import when retrying a partial batch BatchCommitRecords opens a transaction for each record, then skips records already imported or marked as errors. Each skip leaves an open transaction, so later records and the job status are rolled back when the worker exits. Start the transaction after deciding whether to skip a record. The regression test checks that retrying a batch preserves transaction depth and imports the pending record while skipping prior work. Test plan: Use a test instance and the attached three-record MARC fixture. The second item's library is NOPE. Use a fresh fixture or database in each phase and ensure that NOPE does not exist before staging. Before applying the patch: 1. Open Cataloging > Stage records for import. 2. Stage the attached file with "Always add items" and no match rule. 3. Open the batch in Manage staged MARC records. 4. Click "Import this batch into the catalog". 5. Open the job details and wait for Failed. 6. Open Administration > Libraries. 7. Add a library with the code NOPE. 8. Return to the same batch in Manage staged MARC records. 9. Click "Import this batch into the catalog" again. 10. Open the new job details. The status remains Started at 0 / 3. 11. Reopen the batch. It is Staged, with one record in the catalog. Apply the patch. After applying the patch: 1. Repeat the workflow with a fresh test database and batch. 2. Verify that the second job shows Finished at 3 / 3. 3. Reopen the batch. It is Imported, with three records and items in the catalog. Co-Authored-By: Loontik <loontik@nugged.team> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44348 --- Comment #2 from Andrii Nugged <nugged@gmail.com> --- Created attachment 212857 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212857&action=edit Synthetic MARC test fixture for retrying a partial import -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44348 Andrii Nugged <nugged@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=35438, | |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=32638 Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org