Log Message: |
Added index lock files. Indexing and search are now not just thread
safe, but also "process safe": multiple processes may may now search
an index while it is being updated from another process.
Two lock files are used in an index. One is "commit.lock". This is
used to synchronize commits [IndexWriter.close()] with opens
[IndexReader.open()]. Since these actions are short-lived, attempts
to obtain this lock will block for up to ten seconds, which should be
plenty of time, before an exception is thrown.
The second lock file is "write.lock". This is used to enforce the
restriction that only one process should be adding documents to an
index at a time. This is created when an IndexWriter is constructed
and removed when it is closed. If index writing is aborted then this
file must be manually removed. Attempts to index from another process
will immediately throw an exception.
It should be impossible to corrupt an index through the Lucene API.
However if a Lucene process exits unexpectedly it can leave the index
locked. The remedy is simply to, at a time when it is certain that no
processes are accessing the index, remove all lock files.
|