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-3776) NRTManager shouldn't expose its private SearcherManager
Date Fri, 17 Feb 2012 05:25:59 GMT


Shai Erera commented on LUCENE-3776:

bq. Hang on – SM now takes either IW or Director

You're right, I missed that. For some reason I had the impression it takes an IR, which is
obviously wrong, since it won't be allowed to close it.

bq. do you mean the SearcherFactory could make some other reader

I'm less worried about that. We give SF an IndexReader, I can only expect that it will return
an IndexSearcher on top of it. Maybe we can assert that IndexSearcher.getIndexReader == newReader
in refreshIfNeeded?

bq. I think there's no way a non-DirReader can get into NRTManager 

You're right. If you keep the assert, maybe add a nice msg to it?

bq. I didn't yet add a hard check for an evil SearcherFactory...

I think that's ok to assume that SearcherFactory is not evil. Maybe the assert I suggested
above would be enough?
> NRTManager shouldn't expose its private SearcherManager
> -------------------------------------------------------
>                 Key: LUCENE-3776
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>            Priority: Blocker
>             Fix For: 3.6, 4.0
>         Attachments: LUCENE-3776.patch, LUCENE-3776.patch
> Spinoff from LUCENE-3769.
> To actually obtain an IndexSearcher from NRTManager, it's a 2-step process now.
> You must .getSearcherManager(), then .acquire() from the returned SearcherManager.
> This is very trappy... because if the app incorrectly calls maybeReopen on that private
SearcherManager (instead of NRTManager.maybeReopen) then it can unexpectedly cause threads
to block forever, waiting for the necessary gen to become visible.  This will be hard to debug...
I don't like creating trappy APIs.
> Hopefully once LUCENE-3761 is in, we can fix NRTManager to no longer expose its private
SM, instead subclassing ReferenceManaager.
> Or alternatively, or in addition, maybe we factor out a new interface (SearcherProvider
or something...) that only has acquire and release methods, and both NRTManager and ReferenceManager/SM
impl that, and we keep NRTManager's SM private.

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