[ 
https://issues.apache.org/jira/browse/LUCENE-3292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13062809#comment-13062809
 ] 

Michael McCandless commented on LUCENE-3292:
--------------------------------------------

SegmentCacheKey.equals needs { } around the single-statement ifs.

Make sure you remove the TODO in ReaderPool.get since this issue is fixing it.

{quote}
I am still not sure on 2 things:

In SegmentReader#get the assert statement.
{quote}
Hmm... why are we adding this assert again?

bq. In IW.ReaderPool.SegmentCacheKey the equals() method - Does it need to call 
.equals on the SegmetnInfo and context? Since we are just including 
IOContext.Context only won't this be wrong ?

Yes, it should && the .equals of its two member.  It's not wrong -- we only 
must ensure that the SegmentReader for merging is shared during merging, and 
for searching during searching; we don't want t open a new SegmentReader for 
every new IOContext.

Actually: why do we have IOContext.equals/hashCode...?  Who relies on these 
methods today?

ReaderPool.commit should pass IOContext.READ.

I think we should add a ReaderPool.getIfExists that does not take an IOContext 
and tries both READ and MERGE and returns the SegmentReader if it's found; 
likewise for release.

> IOContext should be part of the SegmentReader cache key 
> --------------------------------------------------------
>
>                 Key: LUCENE-3292
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3292
>             Project: Lucene - Java
>          Issue Type: Task
>          Components: core/index
>    Affects Versions: 4.0
>            Reporter: Simon Willnauer
>            Assignee: Varun Thacker
>            Priority: Minor
>             Fix For: 4.0
>
>         Attachments: LUCENE-3292.patch, LUCENE-3292.patch
>
>
> Once IOContext (LUCENE-2793) is landed the IOContext should be part of the 
> key used to cache that reader in the pool

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to