[Bug 43894] New: AddIssue stores UpdateNotForLoanStatusOnCheckout after enqueuing the record reindex
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43894 Bug ID: 43894 Summary: AddIssue stores UpdateNotForLoanStatusOnCheckout after enqueuing the record reindex Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: minor Priority: P5 - low Component: Circulation Assignee: koha-bugs@lists.koha-community.org Reporter: adolfo.rodriguez@xercode.es QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle@bywatersolutions.com Target Milestone: --- When an item is checked out, AddIssue stores the item (onloan, holdingbranch, issues...) without skip_record_index, which enqueues the reindex of the bibliographic record. Later in the same function, it applies UpdateNotForLoanStatusOnCheckout with a second store, this time with skip_record_index => 1. If the indexing daemon (es_indexer_daemon.pl) processes the job between the two stores, the record is indexed with the old notforloan value and nothing reindexes it again. For example, with UpdateNotForLoanStatusOnCheckout set to "-1: 0", an item that was "Ordered" can keep being shown as "Ordered" in the search results after the checkout. The window is small (both stores happen in the same request), but it exists, and the item is written twice. Nothing between the two stores reads notforloan, so the rule can be applied to the item object before the first store, and a single store writes everything. The holds queue is not affected: the second store was the only one updating it, but AddIssue already enqueues the holds queue update at the end when RealTimeHoldsQueue is enabled. -- 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=43894 Adolfo Rodríguez Taboada <adolfo.rodriguez@xercode.es> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43894 --- Comment #1 from Adolfo Rodríguez Taboada <adolfo.rodriguez@xercode.es> --- Created attachment 208818 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208818&action=edit Bug 43894: Store the new notforloan status with the checkout in AddIssue AddIssue stored the item, which enqueues the reindex of the record, and then applied UpdateNotForLoanStatusOnCheckout with a second store using skip_record_index. If the indexing daemon processed the job between the two stores, the record was indexed with the old notforloan value and nothing reindexed it again. This patch applies the UpdateNotForLoanStatusOnCheckout rule to the item object before the store, so a single store writes onloan and notforloan together and the record is reindexed with the new status. Nothing between the two stores read notforloan. The holds queue is still updated at the end of AddIssue when RealTimeHoldsQueue is enabled. The race cannot be reproduced reliably by hand, the new test checks that the item already has the new notforloan value when the reindex is enqueued. Steps to follow: 1. Set AllowNotForLoanOverride to "Allow" and UpdateNotForLoanStatusOnCheckout to: -1: 0 2. Edit an item that is not checked out and set "Not for loan" to "Ordered". Search for its record: the item is shown as "Ordered". 3. Apply the patch and restart_all (or restart Plack). 4. Check the item out, confirming the "not for loan" warning. 5. The item is no longer "Ordered" (its not for loan value is now 0), and the search results show it as checked out. 6. Check the item in and restore the two preferences. 7. prove t/db_dependent/Circulation/issue.t Without the patch, the new subtest fails: the item still has the old notforloan value (-1) when the record reindex is enqueued. Signed-off-by: Adolfo Rodríguez <adolfo.rodriguez@xercode.es> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43894 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- 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=43894 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #208818|0 |1 is obsolete| | -- 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=43894 --- Comment #2 from David Nind <david@davidnind.com> --- Created attachment 208908 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208908&action=edit Bug 43894: Store the new notforloan status with the checkout in AddIssue AddIssue stored the item, which enqueues the reindex of the record, and then applied UpdateNotForLoanStatusOnCheckout with a second store using skip_record_index. If the indexing daemon processed the job between the two stores, the record was indexed with the old notforloan value and nothing reindexed it again. This patch applies the UpdateNotForLoanStatusOnCheckout rule to the item object before the store, so a single store writes onloan and notforloan together and the record is reindexed with the new status. Nothing between the two stores read notforloan. The holds queue is still updated at the end of AddIssue when RealTimeHoldsQueue is enabled. The race cannot be reproduced reliably by hand, the new test checks that the item already has the new notforloan value when the reindex is enqueued. Steps to follow: 1. Set AllowNotForLoanOverride to "Allow" and UpdateNotForLoanStatusOnCheckout to: -1: 0 2. Edit an item that is not checked out and set "Not for loan" to "Ordered". Search for its record: the item is shown as "Ordered". 3. Apply the patch and restart_all (or restart Plack). 4. Check the item out, confirming the "not for loan" warning. 5. The item is no longer "Ordered" (its not for loan value is now 0), and the search results show it as checked out. 6. Check the item in and restore the two preferences. 7. prove t/db_dependent/Circulation/issue.t Without the patch, the new subtest fails: the item still has the old notforloan value (-1) when the record reindex is enqueued. Signed-off-by: Adolfo Rodríguez <adolfo.rodriguez@xercode.es> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: David Nind <david@davidnind.com> -- 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=43894 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com Assignee|koha-bugs@lists.koha-commun |adolfo.rodriguez@xercode.es |ity.org | Keywords| |release-notes-needed --- Comment #3 from David Nind <david@davidnind.com> --- Added assignee. Testing notes (using KTD): 1. Step 7: not able to test the updated tests before the patch (See some of Tomás Cohen Arazi's (tcohen) patches for how he does it: - add the tests as a separate patch - you apply the tests patch (using interactive mode): tests fail - you then apply the rest of the patches: tests pass) -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43894 Adolfo Rodríguez Taboada <adolfo.rodriguez@xercode.es> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |When an item is checked out release notes| |and | |UpdateNotForLoanStatusOnChe | |ckout changes its not for | |loan status, the new status | |is now saved together with | |the checkout, before the | |record is reindexed. | |Previously, the status was | |saved in a second step | |after the reindex was | |queued, so the search | |results could keep showing | |the old status (for example | |"Ordered") after the | |checkout. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org