You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Mike Matrigali <mi...@sbcglobal.net> on 2005/12/09 07:09:55 UTC

When is space allocated to a file in java?

As usual with these types of questions, the java documentation is
unclear.

If I use RandomAccessFile to write data at the end
of a file, extending it

AND don't sync the file either on the write using one of the "rwd" modes

AND don't call sync on the file

Is it possible that a subsequent sync or subsequent write on that 
extended portion of the file will return an out of disk space error?


Re: When is space allocated to a file in java?

Posted by Bryan Pendleton <bp...@amberpoint.com>.
> Is it possible that a subsequent sync or subsequent write on that 
> extended portion of the file will return an out of disk space error?

I think you're looking for an analytic answer based on theory and
reasoning, rather than a practical answer based on experiment, but
just in case I'm wrong: there's a rather nifty tool out there called
Holodeck (http://www.se.fit.edu/boneyard/holodeck/) which
allows you to precisely trigger detailed failures under your control,
so that you can test exactly the scenario you're concerned about.

For example, you can cause your application to run out of disk space,
or get a "too many files" error, or get a disk read or write error,
at just the point that you desire.

One downside is that the tool is Windows-only. I should also admit
that I haven't used the tool myself, just read about it.

Hope this helps,

bryan