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

Simon Willnauer commented on LUCENE-3292:
-----------------------------------------

Hey varun, patch looks good here are some comments:

 * SegmentCacheKey should only have final members
 * SegmentCacheKey should be final and the ctor visibility should be package 
private
 * you can omit "this" and "== true" in SegmentCacheKey#equals and simply 
return the comparison result
 * in IndexWriter#drop(SegmentInfo, IOContext) you can simply call if ((sr = 
readerMap.remove(new SegmentCacheKey(info, context))) != null) that way you 
only do the lookup only once instead of getting the instance first and then 
look it up a second time to remove it. this applies to more places in that 
method as far as I can see.
 * I try to understand what you are doing in  getIfExists(SegmentInfo info) it 
seems you are probing if there is a reader for this segment with two different 
IOContext. Maybe it would make more sense to pass in the context here too OR 
don't put the IOContext in the cache key and hold two distinct maps one for 
read one for merge? The try catch here doesn't make sense to me at all.

> 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, 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