Bug 38737 - Batch item deletion w/delete record and Elasticsearch is broken
Summary: Batch item deletion w/delete record and Elasticsearch is broken
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low major
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords: regression, RM_priority
Depends on:
Blocks:
 
Reported: 2024-12-18 08:59 UTC by Magnus Enger
Modified: 2024-12-19 21:15 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Magnus Enger 2024-12-18 08:59:17 UTC
To reproduce in koha-testing-docker (I started it wirh "ktd --es7 up"): 

- Find a record with at least one item
- Click on "Select all" for the items
- Click on "Delete selected items"
- Click the checkbox for "Delete records if no items remain."
- Click on "Delete selected items"
- Click on "View detail of the enqueued job"
- The job failed

Logs: 

==> /var/log/koha/kohadev/worker-output.log <==
{UNKNOWN}: An Elasticsearch error occurred during bulk delete at /kohadevbox/koha/Koha/BackgroundJob/BatchDeleteItem.pm line 153. at /kohadevbox/koha/Koha/BackgroundJob/BatchDeleteItem.pm line 177
[2024/12/18 08:55:39] [WARN] Uncaught exception processing job id=9: encountered object '{UNKNOWN}: An Elasticsearch error occurred during bulk delete at /kohadevbox/koha/Koha/BackgroundJob/BatchDeleteItem.pm line 153. at /kohadevbox/koha/Koha/BackgroundJob/BatchDeleteItem.pm line 177
', but neither allow_blessed, convert_blessed nor allow_tags settings are enabled (or TO_JSON/FREEZE method missing) at /kohadevbox/koha/Koha/BackgroundJob.pm line 270.
 main::catch {...}  /kohadevbox/koha/misc/workers/background_jobs_worker.pl (206)

The job in the database:

MariaDB [koha_kohadev]> select * from background_jobs where id = 9\G
*************************** 1. row ***************************
            id: 9
        status: failed
      progress: 0
          size: 4
borrowernumber: 51
          type: batch_item_record_deletion
         queue: long_tasks
          data: {"delete_biblios":"on","record_ids":["27","24","25","26"]}
       context: {"number":"51","register_name":null,"shibboleth":"0","branch":"CPL","cardnumber":"42","flags":"1","desk_name":null,"register_id":null,"emailaddress":null,"interface":"intranet","desk_id":null,"surname":"koha","id":"koha","firstname":null,"branchname":"Centerville"}
   enqueued_on: 2024-12-18 08:55:39
    started_on: 2024-12-18 08:55:39
      ended_on: NULL
1 row in set (0.000 sec)
Comment 1 Magnus Enger 2024-12-18 09:04:44 UTC
Switching to SearchEngine = Zebra makes the delete work.
Comment 2 Magnus Enger 2024-12-18 09:15:13 UTC
I ran into a similar problem on a live server, with Koha 23.11.10 and Elasticsearch 7.16.2. That problem seems to have been solved by reversing the removal of "type => 'data'," from this patch: https://git.koha-community.org/Koha-community/Koha/commit/24aab6b9c52cb9846653d34d5630caf837e0508a but I have tested a similar fix on main, and that did not work.