Bugzilla – Attachment 55564 Details for
Bug 16758
Caching issues in scripts running in daemon mode
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16758 - Caching issues in scripts running in daemon mode
Bug-16758---Caching-issues-in-scripts-running-in-d.patch (text/plain), 2.43 KB, created by
Jacek Ablewicz
on 2016-09-14 13:50:46 UTC
(
hide
)
Description:
Bug 16758 - Caching issues in scripts running in daemon mode
Filename:
MIME Type:
Creator:
Jacek Ablewicz
Created:
2016-09-14 13:50:46 UTC
Size:
2.43 KB
patch
obsolete
>From bf18fc68984c4f587a43b6edef371a041c7808df Mon Sep 17 00:00:00 2001 >From: Jacek Ablewicz <abl@biblos.pk.edu.pl> >Date: Wed, 14 Sep 2016 15:33:07 +0200 >Subject: [PATCH] Bug 16758 - Caching issues in scripts running in daemon mode > >As L1 cache does not have expiration mechanism, scripts running >in daemon mode (rebuild_zebra.pl -daemon, sip server ?, ...) would >not be aware of any possible changes in the data being cached >in upstream L2 cache. > >This patch adds ->flush_L1_caches() call in rebuild_zebra.pl >inside daemon mode loop. > >To test: > >1) apply patch >2) ensure that rebuild_zebra.pl -daemon is still working properly, >without any noticeable performance degradation >3) stop memcached daemon and try to run rebuild_zebra.pl -daemon >again: there should be a warning emitted stating that the script >is running in daemon mode but without recommended caching system >--- > misc/migration_tools/rebuild_zebra.pl | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > >diff --git a/misc/migration_tools/rebuild_zebra.pl b/misc/migration_tools/rebuild_zebra.pl >index ea813d8..7d49898 100755 >--- a/misc/migration_tools/rebuild_zebra.pl >+++ b/misc/migration_tools/rebuild_zebra.pl >@@ -26,6 +26,7 @@ use C4::Biblio; > use C4::AuthoritiesMarc; > use C4::Items; > use Koha::RecordProcessor; >+use Koha::Caches; > use XML::LibXML; > > use constant LOCK_FILENAME => 'rebuild..LCK'; >@@ -63,6 +64,7 @@ my $run_user = (getpwuid($<))[0]; > my $wait_for_lock = 0; > my $use_flock; > my $table = 'biblioitems'; >+my $is_memcached = Koha::Caches->get_instance('syspref')->memcached_cache; > > my $verbose_logging = 0; > my $zebraidx_log_opt = " -v none,fatal,warn "; >@@ -136,6 +138,9 @@ if ($daemon_mode) { > $msg .= "Please do '$0 --help' to see usage.\n"; > die $msg; > } >+ unless ($is_memcached) { >+ warn "Warning: script running in daemon mode, without recommended caching system (memcached).\n"; >+ } > $authorities = 1; > $biblios = 1; > $process_zebraqueue = 1; >@@ -243,7 +248,10 @@ if ($daemon_mode) { > while (1) { > # For incremental updates, skip the update if the updates are locked > if (_flock($LockFH, LOCK_EX|LOCK_NB)) { >- do_one_pass() if ( zebraqueue_not_empty() ); >+ if ( zebraqueue_not_empty() ) { >+ Koha::Caches->flush_L1_caches() if ($is_memcached); >+ do_one_pass(); >+ } > _flock($LockFH, LOCK_UN); > } > sleep $daemon_sleep; >-- >1.7.10.4
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 16758
:
55564
|
60858
|
61820
|
63247
|
63248