Index "corruption" makes it return a different result

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Index "corruption" makes it return a different result

Lucas F. A. Teixeira-2
Hello all!

I had a problem this week, and I like to share with you all.
My weblogic server that generate my index hrows its logs in a shared storage. During my indexing process (SOLR+Lucene), this shared storage became 100% full, and everything collapsed (all servers that uses this shared storage). But my index (that is generated in the local filesystem, just "grabbed" some logs of the server (who knows weblogic knows the managed server accesslog, that's the guy) from the buffer (my supposition), and put inside my index files! Take a look how my "_al1.cfs" became between some binary parts of the file:

2008-03-19    -    02:31:03    -    [ip]    -    POST    -    200    -    /AcomProductSyncServiceWeb/AcomProductSyncService
2008-03-19    -    02:31:03    -    [ip]    -    POST    -    200    -    /AcomProductSyncServiceWeb/AcomProductSyncService
2008-03-19    -    02:31:04    -    [ip]    -    POST    -    200    -    /AcomProductSyncServiceWeb/AcomProductSyncService
2008-03-19    -    02:31:04    -    [ip]    -    POST    -    200    -    /AcomProductSyncServiceWeb/AcomProductSyncService
2008-03-19    -    02:31:04    -    [ip]    -    POST    -    200    -    /AcomProductSyncServiceWeb/AcomProductSyncService

The most incredible thing, is that I can open the index without a CorruptedIndexException, normally. That's really bad for me, cause the application didn't warn about a corrupted index (of course, it is not). I can open it with the Luke App, and with this simple code snippet accessing directly the lucene index without solr:

        IndexReader indexReader = IndexReader.open(FSDirectory.getDirectory("C/index/index.2008-03-19"));
        IndexSearcher indexSearcher = new IndexSearcher(indexReader);
       
        TermQuery termQuery = new TermQuery(new Term("itemId", "680804"));
        Hits hits = indexSearcher.search(termQuery);
       
        Iterator itHits = hits.iterator();
        while (itHits.hasNext()) {
            Hit hit = (Hit) itHits.next();
            Document document = hit.getDocument();
            String itemId = document.getField("itemId").stringValue();
            System.out.println("itemId="+itemId);
        }
       
        indexSearcher.close();
        indexReader.close();


Ok, ok. But, if it's opening, whats my real problem?  Making this little search above, the Document that I got, was another one, with other information different from the original one that I was looking for (the one with the itemId field = 680804). The whole document was another document (but a valid document, that I've indexed before). The itemId value that I got, the one that was printed from that application above was 578340. Wow!!

I can reproduce this error anytime with this code or with luke on this corrupted index, but was terrible for me to find the exact point of this fault.

I've reindexed everything, it solves my problem. But I wants to know if someone have any idea why this happened...

Thanks people!

[]s,

Lucas Teixeira
[hidden email]