lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shai Erera (Commented) (JIRA)" <>
Subject [jira] [Commented] (LUCENE-3703) DirectoryTaxonomyReader.refresh misbehaves with ref counts
Date Thu, 19 Jan 2012 08:17:40 GMT


Shai Erera commented on LUCENE-3703:

Thanks for reviewing Doron !

bq. CHANGES: rephrase the e.g. part like this: (e.g. if application called incRef/decRef).

Will fix, thanks.

bq. LTC.newDirectory() instead of new RAMDirectory()

I wrote a comment in the test "// no need for random directories here" -- it's really not
related to any Directory.

bq. text messages in the asserts.


bq. Would it be simpler to make close() synchronized (just like IR.close())

It would, but then it'd mean everyone who calls close() will wait, even if the TR is already
closed. The code now is a nice way to only block threads which discover that TR is not already
closed. I don't think it's that critical (how often do you call close() anyway), so I don't
mind to keep it / make the entire method synchronized.

bq. Would it - again - be simpler to keep maintaining the ref-counts in the internal IR

I think that the code would look odd -- we'll ir.openIfChanged, then call incRef() until newIR.getRefCount()
== oldIR.getRefCount(). And I'm not sure how will that play with someone calling concurrently
to DTR.decRef() ... it might be a mess. Even though we duplicate ref counting logic, I think
it's safer, but perhaps I misunderstood what you meant?

bq. Perhaps should document about it in CHANGES entry.

I will mention it as well.
> DirectoryTaxonomyReader.refresh misbehaves with ref counts
> ----------------------------------------------------------
>                 Key: LUCENE-3703
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: modules/facet
>            Reporter: Shai Erera
>            Assignee: Shai Erera
>             Fix For: 3.6, 4.0
>         Attachments: LUCENE-3703.patch
> DirectoryTaxonomyReader uses the internal IndexReader in order to track its own reference
counting. However, when you call refresh(), it reopens the internal IndexReader, and from
that point, all previous reference counting gets lost (since the new IndexReader's refCount
is 1).
> The solution is to track reference counting in DTR itself. I wrote a simple unit test
which exposes the bug (will be attached with the patch shortly).

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message