Bug 11078: QA Follow-up for missing file permissions on lockfile
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Wed, 19 Feb 2014 12:58:00 +0000 (13:58 +0100)
committerFridolin Somers <fridolin.somers@biblibre.com>
Tue, 27 May 2014 10:41:45 +0000 (12:41 +0200)
commita5c1f0452871c6cf98cf557cb6787a49e740dde0
treea4a7449a7c178719672a73f26d1f87f39826b9d1
parent7a2d830637e673e7ff9a82613d9f4119f1ed4c34
Bug 11078: QA Follow-up for missing file permissions on lockfile

The original patch creates a lockfile in the ZEBRA_LOCKDIR.
It can fall back to /var/lock or even /tmp.
If the create fails, it dies. This can be considered as very
exceptional.

This followup adjusts the fallback location in /var/lock or /tmp
slightly.  It appends the database name to the folder in order to
prevent interfering between multiple Koha instances. Creation of the
lockfile has been moved to a subroutine extending directory and file
creation testing.

In the very unlikely case that we cannot create the lockfile (after
three separate tries), this follow-up allows you to continue instead
of die.  This is just as we did before we had file locking here. Every
time skipping a reindex could cause more harm than continuing and
having the race condition once in a while.

Test plan:
Test adding and removing lockdir from your koha-conf.xml. Check fallback.
Note that fallback in /var/lock or /tmp must contain database name.
Remove the lockdir config line and remove permissions from fallback. In
this case the reindex should continue but with a warning.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tested with daemon and one-off invocation simultaneously.
Tested new wait parameter.
Tried all variations of lock directory (changing permissions etc.)

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 07de37f0e5ea8685573794ff6a84ab30e32f1973)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
misc/migration_tools/rebuild_zebra.pl