Bugzilla – Attachment 131532 Details for
Bug 30260
Script which checks index should also check if the zebraqueue has uncommitted records
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30260: Add is_indexer_working check
Bug-30260-Add-isindexerworking-check.patch (text/plain), 3.18 KB, created by
Aleisha Amohia
on 2022-03-10 02:48:31 UTC
(
hide
)
Description:
Bug 30260: Add is_indexer_working check
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2022-03-10 02:48:31 UTC
Size:
3.18 KB
patch
obsolete
>From 272281397c713fd4153197262d45ac3272e92909 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Tue, 8 Mar 2022 07:37:18 +1300 >Subject: [PATCH] Bug 30260: Add is_indexer_working check > >Function checks if the zebraqueue has rows that are not 'done' > >Will depend on a change in checkindex.sh which implements the check: https://git.koha-community.org/Koha-community/global/src/branch/master/koha-zebra/checkindex.sh > >To test: > >1. disable the indexer > >sudo koha-indexer --stop INSTANCENAME > >2. catalogue 5 new records >3. confirm they don't show in any search results >4. in your terminal, go to the shell > >sudo koha-shell INSTANCENAME > >5. run the new script. run with -v for verbose or --rows X to specify >how many uncommitted records should be checked for. 5 is the default > >perl misc/maintenance/check_zebraqueue.pl > >6. confirm the script returns that the indexer is not working. > >The function in koha-functions.sh is required for the pending change to >checkindex.sh > >Sponsored-by: Catalyst IT >--- > debian/scripts/koha-functions.sh | 9 ++++++++ > misc/maintenance/check_zebraqueue.pl | 44 ++++++++++++++++++++++++++++++++++++ > 2 files changed, 53 insertions(+) > create mode 100755 misc/maintenance/check_zebraqueue.pl > >diff --git a/debian/scripts/koha-functions.sh b/debian/scripts/koha-functions.sh >index 8888ad62904..18d6532d9fb 100755 >--- a/debian/scripts/koha-functions.sh >+++ b/debian/scripts/koha-functions.sh >@@ -199,6 +199,15 @@ is_indexer_running() > fi > } > >+is_indexer_working() >+{ >+ if ./usr/share/koha/bin/maintenance/check_zebraqueue.pl; then >+ return 0 >+ else >+ return 1 >+ fi >+} >+ > is_worker_running() > { > local instancename=$1 >diff --git a/misc/maintenance/check_zebraqueue.pl b/misc/maintenance/check_zebraqueue.pl >new file mode 100755 >index 00000000000..5e397184ef6 >--- /dev/null >+++ b/misc/maintenance/check_zebraqueue.pl >@@ -0,0 +1,44 @@ >+#!/usr/bin/perl >+ >+# Copyright 2022 Aleisha Amohia <aleisha@catalyst.net.nz> >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+use Getopt::Long qw( GetOptions ); >+use C4::Context; >+ >+my $verbose = 0; >+my $rows = 5; >+ >+GetOptions( >+ 'v|verbose' => \$verbose, >+ 'r|rows=i' => \$rows, >+); >+ >+my $dbh = C4::Context->dbh; >+my $sth = $dbh->prepare("SELECT COUNT(*) FROM zebraqueue WHERE done = ?"); >+$sth->execute("0"); >+ >+my ( $count ) = $sth->fetchrow; >+ >+if ( $count > $rows ) { >+ print "zebraqueue has incomplete rows, so indexer isn't running.\n" if $verbose; >+ exit 0; >+} >+ >+print "zebraqueue does not have enough incomplete rows, we can assume indexer is running.\n" if $verbose; >+exit 1; >-- >2.11.0
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 30260
:
131532
|
131582
|
160395