You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Andi Vajda <va...@osafoundation.org> on 2009/02/11 03:27:47 UTC
problem with IndexReader.reopen()
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)
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).
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
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
Re: problem with IndexReader.reopen()
Posted by Michael McCandless <lu...@mikemccandless.com>.
Andi Vajda wrote:
>
> On Wed, 11 Feb 2009, Andi Vajda wrote:
>
>> Hi Mike,
>>
>>> This looks like it could be LUCENE-1453 (fixed on trunk). Does
>>> this exception happen on trunk Lucene?
>> I'm about to test this by applying this fix to 2.4.0 (if possible).
>
> Applying the patch attached to LUCENE-1453 to 2.4.0 seems to have
> fixed it.
Phew!
> Is this patch otherwise safe against 2.4.0 or should I consider
> running the version of trunk as-of-now instead ?
I think very likely it's safe on 2.4.0.
Mike
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
Re: problem with IndexReader.reopen()
Posted by Andi Vajda <va...@osafoundation.org>.
On Wed, 11 Feb 2009, Andi Vajda wrote:
> Hi Mike,
>
>> This looks like it could be LUCENE-1453 (fixed on trunk). Does this
>> exception happen on trunk Lucene?
> I'm about to test this by applying this fix to 2.4.0 (if possible).
Applying the patch attached to LUCENE-1453 to 2.4.0 seems to have fixed it.
Is this patch otherwise safe against 2.4.0 or should I consider running
the version of trunk as-of-now instead ?
Thanks !
Andi..
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
Re: problem with IndexReader.reopen()
Posted by Andi Vajda <va...@osafoundation.org>.
On Wed, 11 Feb 2009, Michael McCandless wrote:
Hi Mike,
> This looks like it could be LUCENE-1453 (fixed on trunk). Does this
> exception happen on trunk Lucene?
I'm about to test this by applying this fix to 2.4.0 (if possible).
> Are you opening the original reader w/ String or File path?
String.
Andi..
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
Re: problem with IndexReader.reopen()
Posted by Michael McCandless <lu...@mikemccandless.com>.
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