Bug 501925

Summary: `service rhn-search cleanindex` do not work
Product: Red Hat Satellite 5 Reporter: Jan Hutař <jhutar>
Component: New FeatureAssignee: John Matthews <jmatthew>
Status: CLOSED CURRENTRELEASE QA Contact: Jan Hutař <jhutar>
Severity: medium Docs Contact:
Priority: medium    
Version: 530CC: cperry
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: sat530 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-09-10 19:32:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 457073    

Description Jan Hutař 2009-05-21 11:02:59 UTC
Description of problem:
Getting error message when calling `service rhn-search cleanindex`.


Version-Release number of selected component (if applicable):
Satellite-5.3.0-RHEL5-re20090507.1-x86_64


How reproducible:
always


Steps to Reproduce:
1. # /etc/init.d/rhn-search cleanindex


Actual results:
Stopping rhn-search...
rhn-search was not running.
/etc/init.d/rhn-search: line 79: exec: java: not found


Expected results:
indexes cleaned

Comment 1 Jan Hutař 2009-05-21 11:03:38 UTC
# rpm -qa | grep -i java | sort
java-1.4.2-gcj-compat-1.4.2.0-40jpp.115.x86_64
java-1.6.0-ibm-1.6.0.4-1jpp.1.el5.x86_64
java-1.6.0-ibm-devel-1.6.0.4-1jpp.1.el5.x86_64
java-1.6.0-openjdk-1.6.0.0-0.25.b09.el5.x86_64
java-1.6.0-openjdk-devel-1.6.0.0-0.25.b09.el5.x86_64
spacewalk-java-0.5.44-17.el5sat.noarch
spacewalk-java-config-0.5.44-17.el5sat.noarch
spacewalk-java-lib-0.5.44-17.el5sat.noarch

Comment 2 Clifford Perry 2009-05-22 15:11:57 UTC
Most likely want to use:

/etc/alternatives/java 

as command, rather than 'java' for the 'exec java' and hope that it is correctly within the bash environment $PATH. 

removeindex() {
    SEARCH_CLASS_PATH=`build-classpath-directory /usr/share/rhn/search/lib /usr/share/java/ojdbc14.jar`
    CLASSPATH=${SEARCH_CLASS_PATH} exec java com.redhat.satellite.search.DeleteIndexes
}


Cliff

PS - John - not sure why, but maybe cleanindex should also restart search post running, my older (month old 530 Sat shows):

    'cleanindex')
        stopit
        unlock
        removeindex
        ;;

Comment 3 Jan Hutař 2009-05-25 07:56:49 UTC
I have just resolved this. This appeared on the system where I have installed & uninstalled Satellite few times and I have just noted that /etc/alternatives/java was a broken link. So this is not a $PATH issue, this was problem with a system. `alternatives --auto java` fixed the link. Sorry for a mess :-(

Comment 4 John Matthews 2009-05-26 15:03:15 UTC
Vader commit:  3a09a2120282008ade983a6075e4893f28bc8a04

Changed cleanindex to start search after clean has completed.

Comment 5 Jan Hutař 2009-06-17 11:35:52 UTC
Seems to be working correctly now on Satellite-5.3.0-RHEL5-re20090612.0-x86_64:

# service rhn-search cleanindex
Stopping rhn-search...
Stopped rhn-search.
09/06/17 13:34:50 INFO search.DeleteIndexes: Running query: deleteLastErrata
09/06/17 13:34:51 INFO search.DeleteIndexes: Attempting to delete /usr/share/rhn/search/indexes/errata
09/06/17 13:34:52 INFO search.DeleteIndexes: Running query: deleteLastPackage
09/06/17 13:34:52 INFO search.DeleteIndexes: Attempting to delete /usr/share/rhn/search/indexes/package
09/06/17 13:34:52 INFO search.DeleteIndexes: Running query: deleteLastServer
09/06/17 13:34:52 INFO search.DeleteIndexes: Attempting to delete /usr/share/rhn/search/indexes/server
09/06/17 13:34:52 INFO search.DeleteIndexes: Running query: deleteLastHardwareDevice
09/06/17 13:34:52 INFO search.DeleteIndexes: Attempting to delete /usr/share/rhn/search/indexes/hwdevice
09/06/17 13:34:52 INFO search.DeleteIndexes: Running query: deleteLastSnapshotTag
09/06/17 13:34:52 INFO search.DeleteIndexes: Running query: deleteLastServerCustomInfo
09/06/17 13:34:52 INFO search.DeleteIndexes: Index files have been deleted and database has been cleaned up, ready to reindex
Starting rhn-search...
# service rhn-search status
rhn-search is running (6381).

Comment 6 Milan Zázrivec 2009-08-20 13:15:00 UTC
5.3.0 stage testing: service rhn-search cleanindex cleans the indexes
and starts the service again -> RELEASE_PENDING

Comment 7 Brandon Perkins 2009-09-10 19:32:36 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2009-1434.html