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

Uwe Schindler commented on LUCENE-4364:
---------------------------------------

Hey, I did not yet fully review the patch, but with ByteBuffers we can do the 
EOF case very easy (the problem Mike had in his CachedDirectory). ByteBuffer 
internally checks limit() in all cases, so you cannot read beyond the limit. So 
when we create a slicer, the last buffer could be created not by a simple 
duplicate(), but instead by ByteBuffer.slice() [which is also a duplicate, but 
with other start [in our case still 0], but with a limited length (the modulo 
of (startOffset + length) % bufsize). As ByteBuffer is doing the checks in all 
cases, a duplicate buffer with a shorter length makes reading behind EOF 
impossible. The checks are done in all cases, by explicitely giving a limit for 
the last buffer we can correctly support EOF with IndexOutofBoundsException.
                
> MMapDirectory makes too many maps for CFS
> -----------------------------------------
>
>                 Key: LUCENE-4364
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4364
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Robert Muir
>         Attachments: LUCENE-4364.patch, LUCENE-4364.patch
>
>
> While looking at LUCENE-4123, i thought about this:
> I don't like how mmap creates a separate mapping for each CFS slice, to me 
> this is way too many mmapings.
> Instead I think its slicer should map the .CFS file, and then when asked for 
> an offset+length slice of that, it should be using .duplicate()d buffers of 
> that single master mapping.
> then when you close the .CFS it closes that one mapping.
> this is probably too scary for 4.0, we should take our time, but I think we 
> should do it.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
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