Bugzilla – Attachment 22992 Details for
Bug 11078
rebuild_zebra.pl can lose updates due to race condition during full rebuilds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11078 Add locking to rebuild_zebra (QA patch 5)
0007-Bug-11078-Add-locking-to-rebuild_zebra-QA-Patch-5.patch (text/plain), 2.00 KB, created by
Doug Kingston
on 2013-11-18 05:40:54 UTC
(
hide
)
Description:
Bug 11078 Add locking to rebuild_zebra (QA patch 5)
Filename:
MIME Type:
Creator:
Doug Kingston
Created:
2013-11-18 05:40:54 UTC
Size:
2.00 KB
patch
obsolete
>From 2be13e4ae8bda6d4121e44855871b3f622ce0a40 Mon Sep 17 00:00:00 2001 >From: Doug Kingston <dpk@randomnotes.org> >Date: Sun, 17 Nov 2013 21:27:19 -0800 >Subject: [PATCH 7/7] Bug 11078 Add locking to rebuild_zebra QA Patch 5 > >Address concern on the initialization of $lockdir. If lockdir is >undef, then it will default to /var/lock. If lockdir is specified >in the config, it is expected to be a valid directory. mkpath() >will fail if its not a valid path. >--- > misc/migration_tools/rebuild_zebra.pl | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) > >diff --git a/misc/migration_tools/rebuild_zebra.pl b/misc/migration_tools/rebuild_zebra.pl >index 74976c1..702377c 100755 >--- a/misc/migration_tools/rebuild_zebra.pl >+++ b/misc/migration_tools/rebuild_zebra.pl >@@ -143,8 +143,7 @@ my ($biblioitemnumbertagfield,$biblioitemnumbertagsubfield) = &GetMarcFromKohaFi > # We need to create our own lock directory which incorporates the database instance > # we are indexing to facilitate multiple instances on the same machine. > >-my $lockdir = C4::Context->config("lockdir"); >-$lockdir = "/var/lock" if $lockdir == ""; >+my $lockdir = C4::Context->config("lockdir") // "/var/lock"; > $lockdir .= ("/koha_rebuild_zebra_" . C4::Context->config("database")); > mkpath($lockdir, 0, oct(755)) unless (-d $lockdir); > my $lockfile = $lockdir . "/lock"; >@@ -177,17 +176,17 @@ open my $LockFH, q{>}, $lockfile or die "$lockfile: $!"; > if ($daemon_mode) { > while (1) { > # For incremental updates, skip the update if the updates are locked >- if (flock(LockFH, LOCK_EX|LOCK_NB)) { >+ if (flock($LockFH, LOCK_EX|LOCK_NB)) { > do_one_pass() if ( zebraqueue_not_empty() ); >- flock(LockFH, LOCK_UN); >+ flock($LockFH, LOCK_UN); > } > sleep $daemon_sleep; > } > } else { > # all one-off invocations, wait for the lock to free >- flock(LockFH, LOCK_EX); >+ flock($LockFH, LOCK_EX); > do_one_pass(); >- flock(LockFH, LOCK_UN); >+ flock($LockFH, LOCK_UN); > } > > >-- >1.7.9.5 >
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 11078
:
22044
|
22045
|
22205
|
22458
|
22506
|
22508
|
22532
|
22985
|
22992
|
23220
|
23221
|
23573
|
23574
|
25114
|
25172
|
25330
|
25412
|
25446
|
25447