View | Details | Raw Unified | Return to bug 11078
Collapse All | Expand All

(-)a/Makefile.PL (-1 / +4 lines)
Lines 186-192 Directory for Zebra configuration files. Link Here
186
186
187
=item ZEBRA_LOCK_DIR
187
=item ZEBRA_LOCK_DIR
188
188
189
Directory for Zebra's lock files.
189
Directory for Zebra's lock files.  This includes subdirs for authorities,
190
biblios, and the zebra rebuild function.  Any activity to reindex
191
zebra from koha should interlock here with rebuild_zebra.pl.
190
192
191
=item ZEBRA_DATA_DIR
193
=item ZEBRA_DATA_DIR
192
194
Lines 318-323 my $target_map = { Link Here
318
  './skel/var/lib/koha/zebradb/biblios/register'  => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
320
  './skel/var/lib/koha/zebradb/biblios/register'  => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
319
  './skel/var/lib/koha/zebradb/biblios/shadow'  => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
321
  './skel/var/lib/koha/zebradb/biblios/shadow'  => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
320
  './skel/var/lib/koha/zebradb/biblios/tmp'  => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
322
  './skel/var/lib/koha/zebradb/biblios/tmp'  => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
323
  './skel/var/lock/koha/zebradb/rebuild' => { target => 'ZEBRA_LOCK_DIR', trimdir => 6 },
321
  './skel/var/lib/koha/plugins' => { target => 'PLUGINS_DIR', trimdir => 6 },
324
  './skel/var/lib/koha/plugins' => { target => 'PLUGINS_DIR', trimdir => 6 },
322
  './sms'                       => 'INTRANET_CGI_DIR',
325
  './sms'                       => 'INTRANET_CGI_DIR',
323
  './suggestion'                => 'INTRANET_CGI_DIR',
326
  './suggestion'                => 'INTRANET_CGI_DIR',
(-)a/debian/templates/koha-conf-site.xml.in (+1 lines)
Lines 280-285 Link Here
280
 <memcached_namespace>__MEMCACHED_NAMESPACE__</memcached_namespace>
280
 <memcached_namespace>__MEMCACHED_NAMESPACE__</memcached_namespace>
281
 <zebra_bib_index_mode>__BIBLIOS_INDEXING_MODE__</zebra_bib_index_mode>
281
 <zebra_bib_index_mode>__BIBLIOS_INDEXING_MODE__</zebra_bib_index_mode>
282
 <zebra_auth_index_mode>__AUTHORITIES_INDEXING_MODE__</zebra_auth_index_mode>
282
 <zebra_auth_index_mode>__AUTHORITIES_INDEXING_MODE__</zebra_auth_index_mode>
283
 <zebra_lockdir>/var/lock/koha/__KOHASITE__</zebra_lockdir>
283
 <queryparser_config>/etc/koha/searchengine/queryparser.yaml</queryparser_config>
284
 <queryparser_config>/etc/koha/searchengine/queryparser.yaml</queryparser_config>
284
</config>
285
</config>
285
286
(-)a/etc/koha-conf.xml (+1 lines)
Lines 296-301 __PAZPAR2_TOGGLE_XML_POST__ Link Here
296
 <useldapserver>0</useldapserver><!-- see C4::Auth_with_ldap for extra configs you must add if you want to turn this on -->
296
 <useldapserver>0</useldapserver><!-- see C4::Auth_with_ldap for extra configs you must add if you want to turn this on -->
297
 <zebra_bib_index_mode>__BIB_INDEX_MODE__</zebra_bib_index_mode>
297
 <zebra_bib_index_mode>__BIB_INDEX_MODE__</zebra_bib_index_mode>
298
 <zebra_auth_index_mode>__AUTH_INDEX_MODE__</zebra_auth_index_mode>
298
 <zebra_auth_index_mode>__AUTH_INDEX_MODE__</zebra_auth_index_mode>
299
 <zebra_lockdir>__ZEBRA_LOCK_DIR__</zebra_lockdir>
299
 <queryparser_config>__KOHA_CONF_DIR__/searchengine/queryparser.yaml</queryparser_config>
300
 <queryparser_config>__KOHA_CONF_DIR__/searchengine/queryparser.yaml</queryparser_config>
300
</config>
301
</config>
301
</yazgfs>
302
</yazgfs>
(-)a/misc/bin/koha-zebra-ctl.sh (+1 lines)
Lines 65-70 case "$1" in Link Here
65
        mkdir -p $LOCKDIR
65
        mkdir -p $LOCKDIR
66
        mkdir -p $LOCKDIR/biblios
66
        mkdir -p $LOCKDIR/biblios
67
        mkdir -p $LOCKDIR/authorities
67
        mkdir -p $LOCKDIR/authorities
68
        mkdir -p $LOCKDIR/rebuild
68
        if [[ $EUID -eq 0 ]]; then
69
        if [[ $EUID -eq 0 ]]; then
69
            chown -R $USER:$GROUP $LOCKDIR
70
            chown -R $USER:$GROUP $LOCKDIR
70
        fi
71
        fi
(-)a/misc/migration_tools/rebuild_zebra.pl (-1 / +25 lines)
Lines 5-10 use strict; Link Here
5
5
6
use C4::Context;
6
use C4::Context;
7
use Getopt::Long;
7
use Getopt::Long;
8
use Fcntl qw(:flock);
8
use File::Temp qw/ tempdir /;
9
use File::Temp qw/ tempdir /;
9
use File::Path;
10
use File::Path;
10
use C4::Biblio;
11
use C4::Biblio;
Lines 153-164 my $dbh = C4::Context->dbh; Link Here
153
my ($biblionumbertagfield,$biblionumbertagsubfield) = &GetMarcFromKohaField("biblio.biblionumber","");
154
my ($biblionumbertagfield,$biblionumbertagsubfield) = &GetMarcFromKohaField("biblio.biblionumber","");
154
my ($biblioitemnumbertagfield,$biblioitemnumbertagsubfield) = &GetMarcFromKohaField("biblioitems.biblioitemnumber","");
155
my ($biblioitemnumbertagfield,$biblioitemnumbertagsubfield) = &GetMarcFromKohaField("biblioitems.biblioitemnumber","");
155
156
157
# Protect against simultaneous update of the zebra index by using a lock file.
158
# Create our own lock directory if its missing.  This shouild be created
159
# by koha-zebra-ctl.sh.
160
161
my $lockdir = C4::Context->config("zebra_lockdir") // "/var/lock";
162
mkpath($lockdir, 0, oct(755)) unless (-d $lockdir);
163
my $lockfile = $lockdir . "/rebuild..LCK";
164
156
if ( $verbose_logging ) {
165
if ( $verbose_logging ) {
157
    print "Zebra configuration information\n";
166
    print "Zebra configuration information\n";
158
    print "================================\n";
167
    print "================================\n";
159
    print "Zebra biblio directory      = $biblioserverdir\n";
168
    print "Zebra biblio directory      = $biblioserverdir\n";
160
    print "Zebra authorities directory = $authorityserverdir\n";
169
    print "Zebra authorities directory = $authorityserverdir\n";
161
    print "Koha directory              = $kohadir\n";
170
    print "Koha directory              = $kohadir\n";
171
    print "Lockfile                    = $lockfile\n";
162
    print "BIBLIONUMBER in :     $biblionumbertagfield\$$biblionumbertagsubfield\n";
172
    print "BIBLIONUMBER in :     $biblionumbertagfield\$$biblionumbertagsubfield\n";
163
    print "BIBLIOITEMNUMBER in : $biblioitemnumbertagfield\$$biblioitemnumbertagsubfield\n";
173
    print "BIBLIOITEMNUMBER in : $biblioitemnumbertagfield\$$biblioitemnumbertagsubfield\n";
164
    print "================================\n";
174
    print "================================\n";
Lines 170-182 if ($do_munge) { Link Here
170
180
171
my $tester = XML::LibXML->new();
181
my $tester = XML::LibXML->new();
172
182
183
# The main work is done here by calling do_one_pass().  We have added locking
184
# avoid race conditions between Full rebuilds and incremental updates either from
185
# daemon mode or periodic invocation from cron.  The race can lead to an updated
186
# record being overwritten by a rebuild if the update is applied after the export
187
# by the rebuild and before the rebuild finishes (more likely to effect large
188
# catalogs).
189
open my $LockFH, q{>}, $lockfile or die "$lockfile: $!";
173
if ($daemon_mode) {
190
if ($daemon_mode) {
174
    while (1) {
191
    while (1) {
175
        do_one_pass() if ( zebraqueue_not_empty() );
192
        # For incremental updates, skip the update if the updates are locked
193
        if (flock($LockFH, LOCK_EX|LOCK_NB)) {
194
            do_one_pass() if ( zebraqueue_not_empty() );
195
            flock($LockFH, LOCK_UN);
196
        }
176
        sleep $daemon_sleep;
197
        sleep $daemon_sleep;
177
    }
198
    }
178
} else {
199
} else {
200
    # all one-off invocations, wait for the lock to free
201
    flock($LockFH, LOCK_EX);
179
    do_one_pass();
202
    do_one_pass();
203
    flock($LockFH, LOCK_UN);
180
}
204
}
181
205
182
206
(-)a/skel/var/lock/koha/zebradb/rebuild/README (-1 / +1 lines)
Line 0 Link Here
0
- 
1
Zebra rebuild lock dir

Return to bug 11078