lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pierre Luc Dupont" <PLDup...@mediagrif.com>
Subject RE: Failure recovery
Date Mon, 13 Mar 2006 15:32:28 GMT
Hi Chuck,

    I suggest to use status file to indicate your index status. I use
this and it works very well. 

-----Original Message-----
From: Chuck Williams [mailto:chuck@manawiz.com] 
Sent: 2006-03-13 02:22
To: java-user@lucene.apache.org
Subject: Failure recovery

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


---------------------------------------------------------------------
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