lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <luc...@mikemccandless.com>
Subject Re: problem with IndexReader.reopen()
Date Wed, 11 Feb 2009 11:06:18 GMT

Hi Andi,

Andi Vajda wrote:

>
> Hi !
>
> I just upgraded from Lucene 2.3.2 to Lucene 2.4.0.
> I've been using IndexReader.reopen() with 2.3.2 just fine for a long  
> time now.
>
> With 2.4.0, reopening the same index (hence, a 2.3.2 index), I'm  
> getting spurious AlreadyClosedExceptions thrown from inside reopen():
>
> "trace": "org.apache.lucene.store.AlreadyClosedException: this  
> Directory is closed
> 	at org.apache.lucene.store.Directory.ensureOpen(Directory.java:220)
> 	at org.apache.lucene.store.FSDirectory.list(FSDirectory.java:320)
> 	at org.apache.lucene.index.SegmentInfos 
> $FindSegmentsFile.run(SegmentInfos.java:533)
> 	at  
> org 
> .apache 
> .lucene.index.SegmentInfos.readCurrentVersion(SegmentInfos.java:366)
> 	at  
> org 
> .apache 
> .lucene 
> .index.DirectoryIndexReader.isCurrent(DirectoryIndexReader.java:188)
> 	at  
> org 
> .apache 
> .lucene.index.DirectoryIndexReader.reopen(DirectoryIndexReader.java: 
> 124)

This looks like it could be LUCENE-1453 (fixed on trunk).  Does this  
exception happen on trunk Lucene?  Are you opening the original reader  
w/ String or File path?

> Is the javadoc about this method still correct ? That is, do I need  
> to close
> the old reader instance manually after reopen() returned a new  
> instance as
> is stated there ?
> This is what I was doing in 2.3.2 (and am still doing in 2.4.0).

Yes, you have to close the old reader.

> If I remove the close() call I don't get the error anymore but won't  
> that leak ? Or is the javadoc for IndexReader.reopen() just wrong ?
>
> Andi..
>
> ps: that javadoc uses a variable called 'new'. Isn't that a java  
> keyword ?
> http://lucene.apache.org/java/2_4_0/api/core/org/apache/lucene/index/IndexReader.html

Good point!  It is not valid java code (in the javadocs).  I'll fix!

Mike

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


Mime
View raw message