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 297-302 __PAZPAR2_TOGGLE_XML_POST__ Link Here
297
 <useldapserver>0</useldapserver><!-- see C4::Auth_with_ldap for extra configs you must add if you want to turn this on -->
297
 <useldapserver>0</useldapserver><!-- see C4::Auth_with_ldap for extra configs you must add if you want to turn this on -->
298
 <zebra_bib_index_mode>__BIB_INDEX_MODE__</zebra_bib_index_mode>
298
 <zebra_bib_index_mode>__BIB_INDEX_MODE__</zebra_bib_index_mode>
299
 <zebra_auth_index_mode>__AUTH_INDEX_MODE__</zebra_auth_index_mode>
299
 <zebra_auth_index_mode>__AUTH_INDEX_MODE__</zebra_auth_index_mode>
300
 <zebra_lockdir>__ZEBRA_LOCK_DIR__</zebra_lockdir>
300
 <queryparser_config>__KOHA_CONF_DIR__/searchengine/queryparser.yaml</queryparser_config>
301
 <queryparser_config>__KOHA_CONF_DIR__/searchengine/queryparser.yaml</queryparser_config>
301
</config>
302
</config>
302
</yazgfs>
303
</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 / +26 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 151-162 my $dbh = C4::Context->dbh; Link Here
151
my ($biblionumbertagfield,$biblionumbertagsubfield) = &GetMarcFromKohaField("biblio.biblionumber","");
152
my ($biblionumbertagfield,$biblionumbertagsubfield) = &GetMarcFromKohaField("biblio.biblionumber","");
152
my ($biblioitemnumbertagfield,$biblioitemnumbertagsubfield) = &GetMarcFromKohaField("biblioitems.biblioitemnumber","");
153
my ($biblioitemnumbertagfield,$biblioitemnumbertagsubfield) = &GetMarcFromKohaField("biblioitems.biblioitemnumber","");
153
154
155
# Protect against simultaneous update of the zebra index by using a lock file.
156
# Create our own lock directory if its missing.  This shouild be created
157
# by koha-zebra-ctl.sh.
158
159
my $lockdir = C4::Context->config("zebra_lockdir") // "/var/lock";
160
$lockdir .= '/rebuild';
161
mkpath($lockdir, 0, oct(755)) unless (-d $lockdir);
162
my $lockfile = $lockdir . "/rebuild..LCK";
163
154
if ( $verbose_logging ) {
164
if ( $verbose_logging ) {
155
    print "Zebra configuration information\n";
165
    print "Zebra configuration information\n";
156
    print "================================\n";
166
    print "================================\n";
157
    print "Zebra biblio directory      = $biblioserverdir\n";
167
    print "Zebra biblio directory      = $biblioserverdir\n";
158
    print "Zebra authorities directory = $authorityserverdir\n";
168
    print "Zebra authorities directory = $authorityserverdir\n";
159
    print "Koha directory              = $kohadir\n";
169
    print "Koha directory              = $kohadir\n";
170
    print "Lockfile                    = $lockfile\n";
160
    print "BIBLIONUMBER in :     $biblionumbertagfield\$$biblionumbertagsubfield\n";
171
    print "BIBLIONUMBER in :     $biblionumbertagfield\$$biblionumbertagsubfield\n";
161
    print "BIBLIOITEMNUMBER in : $biblioitemnumbertagfield\$$biblioitemnumbertagsubfield\n";
172
    print "BIBLIOITEMNUMBER in : $biblioitemnumbertagfield\$$biblioitemnumbertagsubfield\n";
162
    print "================================\n";
173
    print "================================\n";
Lines 164-176 if ( $verbose_logging ) { Link Here
164
175
165
my $tester = XML::LibXML->new();
176
my $tester = XML::LibXML->new();
166
177
178
# The main work is done here by calling do_one_pass().  We have added locking
179
# avoid race conditions between Full rebuilds and incremental updates either from
180
# daemon mode or periodic invocation from cron.  The race can lead to an updated
181
# record being overwritten by a rebuild if the update is applied after the export
182
# by the rebuild and before the rebuild finishes (more likely to effect large
183
# catalogs).
184
open my $LockFH, q{>}, $lockfile or die "$lockfile: $!";
167
if ($daemon_mode) {
185
if ($daemon_mode) {
168
    while (1) {
186
    while (1) {
169
        do_one_pass() if ( zebraqueue_not_empty() );
187
        # For incremental updates, skip the update if the updates are locked
188
        if (flock($LockFH, LOCK_EX|LOCK_NB)) {
189
            do_one_pass() if ( zebraqueue_not_empty() );
190
            flock($LockFH, LOCK_UN);
191
        }
170
        sleep $daemon_sleep;
192
        sleep $daemon_sleep;
171
    }
193
    }
172
} else {
194
} else {
195
    # all one-off invocations, wait for the lock to free
196
    flock($LockFH, LOCK_EX);
173
    do_one_pass();
197
    do_one_pass();
198
    flock($LockFH, LOCK_UN);
174
}
199
}
175
200
176
201
(-)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