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

Shai Erera edited comment on LUCENE-4982 at 5/6/13 3:13 PM:
------------------------------------------------------------

I changed the check to {{freeSpace < len}}, but then the test failed to trip 
disk-full the second time, unless I call out.flush() in between. Debugging 
tells me that RAMOutputStream sets RAMFile.length only on flush(), therefore 
even if I attempt to write a 2K byte[] (with maxSize=2), the test doesn't fail.

Seems like getRecomputedActualSizeInBytes is not very accurate. It only returns 
the size of the flushed files (even for FSDir). This may be ok, dunno. It just 
felt wrong for RAMDirectory, since there is no real buffering happening.

Anyway, I guess we'll have to live with that. Disk-full is anyway a best 
effort, so in this test, I'll just call flush(). In real tests that want to 
trip disk-full, usually indexing happens and therefore files get flushed, and 
the size measure is closer.
                
      was (Author: shaie):
    I changed the check to {{freeSpace < len}}, but then the test failed to 
trip disk-full the second time, unless I call out.flush() in between. Debugging 
tells me that RAMOutputStream sets RAMFile.length only on flush(), therefore 
even if I attempt to write a 2K byte[] (with maxSize=2), the test doesn't fail.

Seems like getRecomputedActualSizeInBytes is not very useful, since if the Dir 
is not RAMDir, it just calls sizeInBytes() which computes the size from the 
file-system, and if it is, then RAMFile.length isn't up-to-date, leading to 
incorrect (0) size computed, unless some files were flushed already.

But getRecomputed cannot flush the streams either in that case ...

So I think I'll leave the test like that. In a real test which wants to trip on 
disk-full, it will usually involve indexing, hence files will be flushed and 
recomputed will return some number, not really the actual number of bytes used, 
but some number.
                  
> Make MockIndexOutputWrapper check disk full on copyBytes
> --------------------------------------------------------
>
>                 Key: LUCENE-4982
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4982
>             Project: Lucene - Core
>          Issue Type: Improvement
>          Components: modules/test-framework
>            Reporter: Shai Erera
>            Assignee: Shai Erera
>         Attachments: LUCENE-4982.patch, LUCENE-4982.patch, LUCENE-4982.patch
>
>
> While working on the consistency test for Replicator (LUCENE-4975), I noticed 
> that I don't trip disk-full exceptions and tracked it down to 
> MockIndexOutputWrapper.copyBytes not doing these checks like writeBytes. I'd 
> like to add this check.

--
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: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to