lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chuck Williams <ch...@manawiz.com>
Subject Failure recovery
Date Mon, 13 Mar 2006 07:22:02 GMT
Is there a way to determine whether or not an index that was left locked
due to some improper system shutdown needs repair?

My code does the following as part of starting up and creating an
IndexWriter for an existing index that was created in a prior session:

>         if (IndexReader.isLocked(index.indexDirectory)) {
>             // ***** TODO add a test for a valid index, if possible
>             log.error("Forcibly unlocking the index directory for
> investigation " + investigation.getName() + ".  Ensure it is not
> corrupt!");
>             IndexReader.unlock(index.indexDirectory);
>         }


The occurrence of this condition indicates the system did not shutdown
cleanly in the prior run.  I'd like to know whether the index is valid
or not before blindly unlocking it.

Thanks for any help,

Chuck


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message