Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 537502

Summary: rhn-search should generate empty index file (instead of none) when there's no data - example: serverCustomInfo
Product: Red Hat Satellite 5 Reporter: Xixi <xdmoon>
Component: ServerAssignee: Justin Sherrill <jsherril>
Status: CLOSED CURRENTRELEASE QA Contact: Dimitar Yordanov <dyordano>
Severity: medium Docs Contact:
Priority: medium    
Version: 530CC: akarlsso, cperry, dyordano, jalviso, mhuth, mminar, tao, xdmoon
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-10-28 15:00:00 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: 487678    

Description Xixi 2009-11-13 21:36:03 UTC
Description of problem:
On a 5.3.0 satellite, if there're custom info keys but no values set for servers, then attempting to do system search via Custom Info will return no-index error in UI and exception in logs, e.g., - 

/var/log/rhn/search/rhn_search.log:
...
com.redhat.satellite.search.index.IndexingException: java.io.FileNotFoundException: no segments* file found in org.apache.lucene.store.FSDirectory@/usr/share/rhn/search/indexes/serverCustomInfo: files:
        at com.redhat.satellite.search.index.IndexManager.search(IndexManager.java:189)
        at com.redhat.satellite.search.rpc.handlers.IndexHandler.search(IndexHandler.java:147)
        at com.redhat.satellite.search.rpc.handlers.IndexHandler.search(IndexHandler.java:120)
)
...
Caused by:
java.io.FileNotFoundException: no segments* file found in org.apache.lucene.store.FSDirectory@/usr/share/rhn/search/indexes/serverCustomInfo: files:
        at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:587)
        at org.apache.lucene.index.DirectoryIndexReader.open(DirectoryIndexReader.java:63)
        at org.apache.lucene.index.IndexReader.open(IndexReader.java:209)
        at org.apache.lucene.index.IndexReader.open(IndexReader.java:192)
        at com.redhat.satellite.search.index.IndexManager.getIndexReader(IndexManager.java:364)
        at com.redhat.satellite.search.index.IndexManager.search(IndexManager.java:161)
        ... 15 more
...

/var/log/rhn/search/rhn_search_daemon.log:
...
INFO   | jvm 1    | 2009/11/13 16:03:36 | 2009-11-13 16:03:35,985 [Thread-6] ERROR com.redhat.satellite.search.rpc.handlers.IndexHandler - Caught exception:
INFO   | jvm 1    | 2009/11/13 16:03:36 | com.redhat.satellite.search.index.IndexingException: java.io.FileNotFoundException: no segments* file found in org.apache.lucene.store.FSDirectory@/usr/share/rhn/search/indexes/serverCustomInfo: files:
INFO   | jvm 1    | 2009/11/13 16:03:36 |       at com.redhat.satellite.search.index.IndexManager.search(IndexManager.java:189)
INFO   | jvm 1    | 2009/11/13 16:03:36 |       at com.redhat.satellite.search.rpc.handlers.IndexHandler.search(IndexHandler.java:147)
INFO   | jvm 1    | 2009/11/13 16:03:36 |       at com.redhat.satellite.search.rpc.handlers.IndexHandler.search(IndexHandler.java:120)
INFO   | jvm 1    | 2009/11/13 16:03:36 |       at com.redhat.satellite.search.rpc.handlers.IndexHandler.search(IndexHandler.java:80)
...
INFO   | jvm 1    | 2009/11/13 16:03:36 | Caused by:
INFO   | jvm 1    | 2009/11/13 16:03:36 | java.io.FileNotFoundException: no segments* file found in org.apache.lucene.store.FSDirectory@/usr/share/rhn/search/indexes/serverCustomInfo: files:
INFO   | jvm 1    | 2009/11/13 16:03:36 |       at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:587)
INFO   | jvm 1    | 2009/11/13 16:03:36 |       at org.apache.lucene.index.DirectoryIndexReader.open(DirectoryIndexReader.java:63)
IndexReader.java:209)
IndexReader.java:192)
nager.getIndexReader(IndexManager.java:364)
nager.search(IndexManager.java:161)
INFO   | jvm 1    | 2009/11/13 16:03:36 |       ... 15 more
atcher writeError
/rhn/search/indexes/serverCustomInfo: files:
...

This is b/c index files are currently only generated when data is returned from the database. An empty one should be generated regardless if there's data or not, instead of erroring out on UI and stacktraces in logs. 

Version-Release number of selected component (if applicable):
Red Hat Network (RHN) Satellite 5.3.0

How reproducible:
Always.

Steps to Reproduce:
1. Have a 5.3.0 satellite with at least 1 server custom info key but value set for any systems.
2. Go to Systems -> Advanced Search and search for something by Custom Info.

Actual results:
Error in UI about missing index files and asking user to re-generate search index, however the error persists after that.  Also error in search logs (see stacktraces above).  No files found under /usr/share/rhn/search/indexes/serverCustomInfo/ at all.

Expected results:
Empty index files should be generated, and search should return no results instead of error.

Additional info:
Solution is to set at least one custom info value for at least one server, then regenerate search indexes (/etc/init.d/rhn-search cleanindex; service rhn-search restart).

Comment 4 Justin Sherrill 2010-08-09 20:57:48 UTC
I believe this should fix the issue:

b2218820cb0d0e854a48050051f2afd443bf0a0b

Comment 5 Dimitar Yordanov 2010-09-15 12:42:06 UTC
I managed to reproduce the problem on Satellite 5.3 (spacewalk-search-0.5.10-15.el5sa.)
On Satellite 5.4 (spacewalk-search-1.2.2-1.el5sat.noarch) the problem  does not appear.

Dimi

Comment 7 Clifford Perry 2010-10-28 14:55:07 UTC
The 5.4.0 RHN Satellite and RHN Proxy release has occurred. This issue has been resolved with this release. 


RHEA-2010:0801 - RHN Satellite Server 5.4.0 Upgrade
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10332

RHEA-2010:0803 - RHN Tools enhancement update
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10333

RHEA-2010:0802 - RHN Proxy Server 5.4.0 bug fix update
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10334

RHEA-2010:0800 - RHN Satellite Server 5.4.0
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10335

Docs are available:

http://docs.redhat.com/docs/en-US/Red_Hat_Network_Satellite/index.html 

Regards,
Clifford