https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44250 --- Comment #2 from Andrii Nugged <nugged@gmail.com> --- Created attachment 212660 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212660&action=edit Bug 44250: Index committed records after a MARC import error BatchCommitRecords commits each record separately and queues one index update when the batch completes. If a later record throws, the earlier records remain in the catalogue database but never reach the index. Staff cannot find those records through catalogue search. Collect bibliographic IDs after each successful commit. On an exception, roll back the current record and queue one normal index update for the committed IDs. Rethrow the original exception so the import job still reports the failure. Leave the batch staged. Skip previously imported rows before opening a transaction. The importer now owns rollback, so the staff job can record the failure without rolling back again. Test plan: Use a disposable MARC21 Koha with Elasticsearch and the workers running. Set up the MARC files and the test-only failure fixture from the accompanying fixture archive. It rejects the fourth commit for the two failure batches. Before applying the patch: 1. Open Cataloging > Stage records for import. 2. Choose bug44250-baseline.xml. 3. Click Upload file. 4. Set Format to MARCXML. 5. Click Stage for import. 6. Open View batch. 7. Click Import this batch into the catalog. 8. Open View detail of the enqueued job. Wait for it to fail. 9. Return to the staged batch. Open the catalogue links of the three imported records. 10. Enter Indexprobe44250Baseline in Search catalog. Expected before the patch: no matching search results. Apply the patch. After applying the patch: 1. Repeat the same steps with bug44250-patched.xml. 2. Verify the import still fails and the staged batch still has three committed records. 3. Enter Indexprobe44250Patched in Search catalog. Three records should appear after the indexing job finishes. 4. Repeat with bug44250-control.xml. All four records should appear in a search for Indexprobe44250Control. Automated regression: prove -I. t/ImportBatchIndexing.t Co-Authored-By: Loontik <loontik@nugged.team> -- You are receiving this mail because: You are watching all bug changes.