Bugzilla – Attachment 172706 Details for
Bug 38156
Auto renew cron job mangles digest notices when parallel processing is enabled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38156: Sort issues by borrowernumber before parallel chunking
Bug-38156-Sort-issues-by-borrowernumber-before-par.patch (text/plain), 3.62 KB, created by
Emily Lamancusa (emlam)
on 2024-10-11 20:15:59 UTC
(
hide
)
Description:
Bug 38156: Sort issues by borrowernumber before parallel chunking
Filename:
MIME Type:
Creator:
Emily Lamancusa (emlam)
Created:
2024-10-11 20:15:59 UTC
Size:
3.62 KB
patch
obsolete
>From 0bee1c56a9d9e3a75eecae614789845be2507e5a Mon Sep 17 00:00:00 2001 >From: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> >Date: Fri, 11 Oct 2024 15:26:25 -0400 >Subject: [PATCH] Bug 38156: Sort issues by borrowernumber before parallel > chunking > >When the automatic renewal cron job is using parallel processing, it >aims to process all of the renewals for any given patron together in one >chunk to avoid data conflicts. To accomplish this, it starts a new data >chunk each time it encounters a new patron. However, if a patron's >renewing checkouts aren't all consecutive in the database, that patron's >data ends up split across multiple chunks. > >We need to sort the issues by borrowernumber before attempting to chunk >them in order to make sure they are chunked and processed correctly. > >To test (using KTD default test data): >Setup: >1. Edit the default circulation rule: > - Set Automatic renewal to "Yes" > - Set No automatic renewal before to 3 >2. Open the following patron accounts in separate tabs: > - Floyd Delgado > - Joyce Gaines > - Edna Acosta > - Mary Burton >3. Perform the following patron account edits for each of the above > patrons (and keep the tabs open): > - Enable automatic renewal notices, and set them to digests only > - Add a value to the email field >4. Enter the kshell (ktd --shell) >5. Edit /etc/koha/sites/kohadev/koha-conf.xml, and add the following > lines near the end, just above the </config> and </yazgfs> closing > tags: ><auto_renew_cronjob> > <parallel_loops_count>2</parallel_loops_count> ></auto_renew_cronjob> >6. restart_all > >Reproducing the issue: >7. Apply the test patch only >8. Run perl generate_checkouts.pl to generate test data >9. perl misc/cronjobs/automatic_renewals.pl -v -c >--> The test patch added output that will show how the renewals were > chunked into "chunk 0" and "chunk 1" for the two parallel loops. > Note that the issues for each borrower are not processed nicely in > one chunk, but are separated across multiple chunks and alternated > with other borrowers. >10. Check the checkouts for each of the four patrons from above >--> All checkouts should have renewed >11. Check the notices tab for each of the four patrons >--> Notice errors in the automatic renewal digest notices. A patron's > renewals may be split across multiple digests, a digest may be > missing renewals, or a patron may not have received a digest at all > >Testing the patch: >12. Apply the second patch >13. Reset the due dates on all checkouts so that they will all be > eligible for automatic renewal again: > - koha-mysql kohadev > - UPDATE issues SET date_due=<two days from today>; >14. perl misc/cronjobs/automatic_renewals.pl -v -c >--> Note that the renewals are now correctly chunked by patron >15. Check the checkouts and notices tab for each of the four patrons >--> All checkouts should have renewed, and all patrons should have a > single new Auto Renewals Digest notice that correctly lists all of > their renewed items >--- > misc/cronjobs/automatic_renewals.pl | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > >diff --git a/misc/cronjobs/automatic_renewals.pl b/misc/cronjobs/automatic_renewals.pl >index 3c687e4517..c7f882521b 100755 >--- a/misc/cronjobs/automatic_renewals.pl >+++ b/misc/cronjobs/automatic_renewals.pl >@@ -141,7 +141,10 @@ my @auto_renews = Koha::Checkouts->search( > auto_renew => 1, > 'patron.autorenew_checkouts' => 1, > }, >- { join => [ 'patron', 'item' ] } >+ { >+ join => [ 'patron', 'item' ], >+ order_by => 'patron.borrowernumber', >+ } > )->as_list; > print "found " . scalar @auto_renews . " auto renewals\n" if $verbose; > >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 38156
:
172705
|
172706
|
172763
|
172831