lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <>
Subject RE: Using Lucene in a production environment
Date Tue, 02 Oct 2001 21:49:01 GMT
> From: Scott Ganyo []
> I have a couple of questions on using Lucene in a production 
> environment:
> 1) Are updates to an index "transactional" in nature?  In 
> other words, can
> an index ever get into an inconsistent/corrupt state by 
> killing a writing
> process?

No, it should not be possible to put an index in an inconsistent or corrupt
state.  The only problem might be that, after a crash, lock files may need
to be manually removed.

> 2) Can you describe where the synchronization points/locks 
> are applied and
> released?  I would like to make sure I avoid any situations 
> that might cause
> performance degradation or deadlock in my application.

The primary synchronization point is during calls to and
IndexWriter.close().  Only one thread may be in this at a time.  For that
reason, and for others, one should re-use IndexReader instances.  Since
IndexReader is thread-safe, this is not hard.  One IndexReader per index is
all that you should need at a time.  When the index changes, you should
create a new IndexReader.  The IndexReader.lastModified() method is designed
to make this easy.  The typical use should be to cache a single index reader
per index, check to see if it is out of date each time the cache is
accessed, and replace it when it is.

IndexWriter.close() commits changes.  Aborting without closing will leave
the index locked but otherwise consistent.


View raw message