Bug 13753

Summary: INDEXER_DAEMON default is incorrect in koha-indexer
Product: Koha Reporter: Ivan Brown <I.Brown>
Component: SearchingAssignee: Tomás Cohen Arazi (tcohen) <tomascohen>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: chris, mirko, tomascohen
Version: Main   
Hardware: All   
OS: Linux   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 13753: koha-indexer contains invalid statement
Bug 13753: koha-indexer contains invalid statement
[PASSED QA] Bug 13731: Suggestions reason does not save on updating the status
[PASSED QA] Bug 13753: koha-indexer contains invalid statement

Description Ivan Brown 2015-02-24 13:10:53 UTC
After upgrading to Koha 3.18 I thought I'd try the new daemon indexing as our librarian is always complaining about the delay before things appear in searches.

I followed the instructions at http://wiki.koha-community.org/wiki/PackagesIndexDaemon to enable it but it did not seem to be working.

Looking at ps output to see if it was running I noticed something strange:

lcs-koha   947  0.0  0.0  17176   712 ?        S    Feb06   0:58 daemon --name=lcs-koha-indexer --errlog=/var/log/koha/lcs/indexer-error.log --stdout=/var/log/koha/lcs/indexer.log --output=/var/log/koha/lcs/indexer-output.log --verbose=1 --respawn --delay=30 --user=lcs-koha.lcs-koha -- -daemon -x -sleep 5

The executable name seemed to be missing.

Further investigation led me to /usr/sbin/koha-indexer line 177:

# Check if an alternate indexer has been set
if [ -z $ALTERNATE_INDEXER_DAEMON ]; then
    INDEXER_DAEMON="$ALTERNATE_INDEXER_DAEMON"
else
    # We default to rebuild_zebra.pl if no alternate indexer set
    INDEXER_DAEMON="${KOHA_HOME}/bin/migration_tools/rebuild_zebra.pl"
fi

Surely this means that if the INDEXER_DAEMON is zero length then set it to the zero length string! The default daemon program is never set. The INDEXER_DAEMON assigments should be swapped.

I'm surprised no one else has reported this but I can't find any other bug reports.
Comment 1 Tomás Cohen Arazi (tcohen) 2015-02-24 14:00:30 UTC Comment hidden (obsolete)
Comment 2 Mirko Tietgen 2015-02-25 16:29:29 UTC Comment hidden (obsolete)
Comment 3 Mirko Tietgen 2015-02-25 16:30:59 UTC
Not in the scope of this patch: I had to manually start koha-indexer. That is neither mentioned here nor on the Wiki, so I wonder if it is supposed to run automatically?
Comment 4 Tomás Cohen Arazi (tcohen) 2015-02-27 11:39:29 UTC
(In reply to Mirko Tietgen from comment #3)
> Not in the scope of this patch: I had to manually start koha-indexer. That
> is neither mentioned here nor on the Wiki, so I wonder if it is supposed to
> run automatically?

Mirko, have you set /etc/default/koha-common ? And restarted the koha-common service?
Comment 5 Mirko Tietgen 2015-02-27 11:49:34 UTC
(In reply to Tomás Cohen Arazi from comment #4)
> (In reply to Mirko Tietgen from comment #3)
> > Not in the scope of this patch: I had to manually start koha-indexer. That
> > is neither mentioned here nor on the Wiki, so I wonder if it is supposed to
> > run automatically?
> 
> Mirko, have you set /etc/default/koha-common ? And restarted the koha-common
> service?

Yes, I did.
Comment 6 Mirko Tietgen 2015-02-27 15:28:13 UTC
(In reply to Mirko Tietgen from comment #5)
> (In reply to Tomás Cohen Arazi from comment #4)
> > (In reply to Mirko Tietgen from comment #3)
> > > Not in the scope of this patch: I had to manually start koha-indexer. That
> > > is neither mentioned here nor on the Wiki, so I wonder if it is supposed to
> > > run automatically?
> > 
> > Mirko, have you set /etc/default/koha-common ? And restarted the koha-common
> > service?
> 
> Yes, I did.

Sorry, I did not read carefully. I set /etc/koha/koha-common.conf. I did not set /etc/default/koha-common as it was not mentioned in the wiki.
Comment 7 Katrin Fischer 2015-03-02 11:44:53 UTC Comment hidden (obsolete)
Comment 8 Katrin Fischer 2015-03-02 11:48:20 UTC
Created attachment 36286 [details] [review]
[PASSED QA] Bug 13753: koha-indexer contains invalid statement

An incorrect conditional makes the indexer daemon fail to load.

To test:
- Enable the indexer daemon on packages [1]
- Restart koha-common:
  $ service koha-common restart
- Run
  $ ps waux | grep koha-indexer
=> FAIL: there's no reference to the rebuild_zebra.pl script
  (line should look like *rebuild_zebra.pl -daemon*)
   Run ps -ef | grep rebuild_zebra.pl too to make sure.
- Apply the patch, repeat the steps
=> SUCCESS: the rebuild_zebra.pl script is ran
- Sign off :-D

Thanks

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Comment 9 Tomás Cohen Arazi (tcohen) 2015-03-02 15:28:02 UTC
Patch pushed to master.
Comment 10 Chris Cormack 2015-03-12 07:03:40 UTC
Pushed to 3.18.x will be in 3.18.5