Technology Versions:
Hibernate 3.6.5
Hibernate Search 3.4.0
Lucene (lucene-core-*.jar) 3.1.0
Spring 3.1.0.M2
Hibernate (Search) Configuration:
<prop key="hibernate.search.default.indexBase">/some/dir</prop>
<prop key="hibernate.search.default.directory_provider">org.hibernate.search.store.FSDirectoryProvider</prop>
<prop key="hibernate.search.default.locking_strategy">native</prop>
<prop key="hibernate.search.default.exclusive_index_use">false</prop>
The issue:
Our application is deployed in Amazon (AWS cloud), but we've faced this issue in our local clusters as well:
The application design is such that there is a Thread
that is spawned from within the main (Web) application wherefrom we need to update an Indexed entity. Basically it's like a status monitor thread which reads a .status file and updates the database every 30 seconds or so. This keeps happening for about 10mins to 1/2 an hour on an average.
The issue we see is that: every few days we need to regenerate the indexes because Hibernate Search stops returning anything for the entity in question (the one discussed above).
I went through few forums and seems it is suggested that only a single thread should be updating the Lucene indexes. But it is also given that index writing is thread-safe. So even if multiple threads are writing to the same index, I still expect that it should not cause the issue (of nothing being returned in the search). That is to say, I may get stale status of the entity in question, but still, something should be returned.
We're using the default IndexReader/Writer implementation of Hibernate Search.
Any help would be highly appreciated. Thanks.