I think this exception should be thrown only when the bytes land in the
Directory. I think that in general we buffer bytes before sending them to
the actual IndexOutput? I don't know if this is done with RAMDir too i.e.
that there isn't code out there that buffers its writes to any IndexOutput,
not caring if it's RAMFile or not.

And technically, if you have a buffer of 16K, but can only write 2K to the
underlying Directory, you shouldn't hit the exception until you actually
flush the bytes?

Adrien, not in front of the code now, but if writeBytes applies the limit,
why do we need any special logic in MDW.flush?

Shai


On Thu, May 16, 2013 at 3:45 PM, Adrien Grand <jpou...@gmail.com> wrote:

> On Thu, May 16, 2013 at 1:58 PM, Robert Muir <rcm...@gmail.com> wrote:
> > I dont get it. MDW wraps its IndexOutput so it "knows"... sounds like
> > the counting is off.
>
> The problem is that RAMDirectory delays the counting.
> MockDirectoryWrapper.getRecomputedActualSizeInBytes sums all the
> lengths of the existing RAMFiles to get the actual size, but
> RAMFile.length is only updated after a RAMOutputStream seek or flush.
> This means that if you write 5 bytes, then 3 bytes, RAMFile.length
> will still be 0 and then suddenly upon flush it will become 5+3=8.
>
> Using the Mock IndexOutput to track bytes is an option, but I was
> thinking it could be interesting too to see what happens with
> directories that buffer content so that the disk full exception
> happens in flush instead of writeBytes?
>
> --
> Adrien
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
> For additional commands, e-mail: dev-h...@lucene.apache.org
>
>

Reply via email to