Bug 32330 - Table background_jobs is missing indexes
Summary: Table background_jobs is missing indexes
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Fridolin Somers
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-23 06:33 UTC by Fridolin Somers
Modified: 2023-12-28 20:44 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.01,22.05.09, 21.11.16
Circulation function:


Attachments
Bug 32330: Add indexes to table background_jobs (2.39 KB, patch)
2022-11-23 07:02 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 32330: Add indexes to table background_jobs (2.61 KB, patch)
2022-11-23 07:07 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 32330: Add indexes to table background_jobs (2.62 KB, patch)
2022-11-23 07:08 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 32330: Add indexes to table background_jobs (2.68 KB, patch)
2022-12-02 08:25 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 32320: Remove text-shadow from header menu links (1.29 KB, patch)
2022-12-07 21:31 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 32330: Add indexes to table background_jobs (2.78 KB, patch)
2022-12-16 08:18 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fridolin Somers 2022-11-23 06:33:43 UTC
Table background_jobs should have indexes to optimize queries.

Query on borrowernumber :
mainpage.pl:    my $already_ran_jobs = Koha::BackgroundJobs->search(
mainpage.pl-        { borrowernumber => $logged_in_user->borrowernumber } )->count ? 1 : 0;

Query on status:
misc/background_jobs_worker.pl:        my $jobs = Koha::BackgroundJobs->search({ status => 'new', queue => \@queues });
Comment 1 Fridolin Somers 2022-11-23 07:02:58 UTC
Created attachment 144184 [details] [review]
Bug 32330: Add indexes to table background_jobs

Table background_jobs should have indexes to optimize queries.

Query on borrowernumber :
mainpage.pl:    my $already_ran_jobs = Koha::BackgroundJobs->search(
mainpage.pl-        { borrowernumber => $logged_in_user->borrowernumber } )->count ? 1 : 0;

Query on status:
misc/background_jobs_worker.pl:        my $jobs = Koha::BackgroundJobs->search({ status => 'new', queue => \@queues });

Test plan :
Run updatedatabase and play with background jobs
Comment 2 Fridolin Somers 2022-11-23 07:07:36 UTC
Created attachment 144185 [details] [review]
Bug 32330: Add indexes to table background_jobs

Table background_jobs should have indexes to optimize queries.

Query on borrowernumber :
mainpage.pl:    my $already_ran_jobs = Koha::BackgroundJobs->search(
mainpage.pl-        { borrowernumber => $logged_in_user->borrowernumber } )->count ? 1 : 0;

Query on status:
misc/background_jobs_worker.pl:        my $jobs = Koha::BackgroundJobs->search({ status => 'new', queue => \@queues });

Test plan :
Run updatedatabase and play with background jobs
Comment 3 Fridolin Somers 2022-11-23 07:08:07 UTC
Created attachment 144186 [details] [review]
Bug 32330: Add indexes to table background_jobs

Table background_jobs should have indexes to optimize queries.

Query on borrowernumber :
mainpage.pl:    my $already_ran_jobs = Koha::BackgroundJobs->search(
mainpage.pl-        { borrowernumber => $logged_in_user->borrowernumber } )->count ? 1 : 0;

Query on status and queue :
misc/background_jobs_worker.pl:        my $jobs = Koha::BackgroundJobs->search({ status => 'new', queue => \@queues });

Test plan :
Run updatedatabase and play with background jobs
Comment 4 Martin Renvoize (ashimema) 2022-12-02 08:25:05 UTC
Created attachment 144390 [details] [review]
Bug 32330: Add indexes to table background_jobs

Table background_jobs should have indexes to optimize queries.

Query on borrowernumber :
mainpage.pl:    my $already_ran_jobs = Koha::BackgroundJobs->search(
mainpage.pl-        { borrowernumber => $logged_in_user->borrowernumber } )->count ? 1 : 0;

Query on status and queue :
misc/background_jobs_worker.pl:        my $jobs = Koha::BackgroundJobs->search({ status => 'new', queue => \@queues });

Test plan :
Run updatedatabase and play with background jobs

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 5 Martin Renvoize (ashimema) 2022-12-02 08:25:34 UTC
Good call
Comment 6 Katrin Fischer 2022-12-07 21:31:13 UTC
Created attachment 144493 [details] [review]
Bug 32320: Remove text-shadow from header menu links

This patch unsets the text-shadow style on links in the header menu.
This makes the links look a little crisper. The style is inherited from
Bootstrap's defaults and is incorrect for our design.

To test, apply the patch and rebuild the staff interface CSS.

View any page in the staff interface to confirm that header menu links
look correct.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 7 Katrin Fischer 2022-12-07 22:03:24 UTC
Comment on attachment 144493 [details] [review]
Bug 32320: Remove text-shadow from header menu links

Wrong bug number, sorry!
Comment 8 Marcel de Rooy 2022-12-16 08:18:55 UTC
Created attachment 144638 [details] [review]
Bug 32330: Add indexes to table background_jobs

Table background_jobs should have indexes to optimize queries.

Query on borrowernumber :
mainpage.pl:    my $already_ran_jobs = Koha::BackgroundJobs->search(
mainpage.pl-        { borrowernumber => $logged_in_user->borrowernumber } )->count ? 1 : 0;

Query on status and queue :
misc/background_jobs_worker.pl:        my $jobs = Koha::BackgroundJobs->search({ status => 'new', queue => \@queues });

Test plan :
Run updatedatabase and play with background jobs

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 9 Tomás Cohen Arazi (tcohen) 2022-12-16 18:50:18 UTC
Nice, Frido.
Comment 10 Tomás Cohen Arazi (tcohen) 2022-12-19 14:41:29 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 11 Martin Renvoize (ashimema) 2022-12-19 15:01:39 UTC
Nice work everyone!

Pushed to 22.11.x for the next release
Comment 12 Lucas Gass (lukeg) 2023-01-24 17:52:46 UTC
Backported to 22.05.x for upcoming 22.05.09
Comment 13 Arthur Suzuki 2023-01-26 13:24:24 UTC
applied to 21.11.x for 21.11.16
Comment 14 Pablo AB 2023-01-30 15:33:11 UTC
Today, while upgrading a koha-common (21.11.16-1) over (21.11.13-1), the process crash with:

Upgrade to 21.11.15.001  [12:03:24]: Bug 32330 - Add indexes to background_jobs table
ERROR - {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Key column 'queue' doesn't exist in table at /usr/share/koha/lib/C4/Installer.pm line 739

queue is not present on background_jobs on 21.11:
https://schema.koha-community.org/21_11/tables/background_jobs.html

There is a workaround? This reveals a QA flaw?
Comment 15 Fridolin Somers 2023-01-31 07:44:23 UTC
Arf indeed, 
background_job.queue has been added by Bug 27783 in 22.05.00

I contact RMaint of 21.11.x
Comment 16 Tomás Cohen Arazi (tcohen) 2023-02-03 13:26:48 UTC
(In reply to Pablo AB from comment #14)
> Upgrade to 21.11.15.001  [12:03:24]: Bug 32330 - Add indexes to
> background_jobs table
> ERROR - {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Key column
> 'queue' doesn't exist in table at /usr/share/koha/lib/C4/Installer.pm line
> 739
> 
> queue is not present on background_jobs on 21.11:
> https://schema.koha-community.org/21_11/tables/background_jobs.html
> 
> There is a workaround?

We just released a hot-fix 21.11.17. Thanks for reporting it.

>  This reveals a QA flaw?

This patch was intended for 22.11 and 22.05, probably a communication problem.

Best regards
Comment 17 Tomás Cohen Arazi (tcohen) 2023-02-03 13:27:10 UTC
Reverted the 'queue' portion of this dev, on 21.11.x.
Comment 18 Wainui Witika-Park 2023-03-15 01:35:08 UTC
Not backported to 21.05.x