[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Q regarding svn_io_open_unique_file and persistent files

From: Erik Huelsmann <ehuels_at_gmail.com>
Date: 2004-12-23 20:01:01 CET

On Thu, 23 Dec 2004 07:58:51 +0100, Ph. Marek <philipp.marek@bmlv.gv.at> wrote:
> Hello everybody!
>
> I have a question: How shall svn_io_open_unique_file be used, if the
> destination file should stay in the filesystem (and already exists)?
> - shall the file be opened with delete_on_close=TRUE, and renamed
> before it is closed?
> -> Failures on close lead to data loss, as possibly not everything
> could be written.
> (or is that avoided by the use of svn_io_file_flush_to_disk()?)
> -> It is a little bit "wrong" to unlink() a file which isn't valid
> any more (as it is renamed on close())
> - shall the file be opened with delete_on_close=FALSE?
> -> If an SVN_ERR() cancels this function, the temporary file is left and
> takes space in the filesystem.
> - shall it be opened with delete_on_close=TRUE, and before the
> svn_io_file_close() the flag is cleared?
> file->flags &= ~APR_DELONCLOSE;
>
> Opinions, hints?

Well, the file->flags &= .. ;

won't work but on unix: on Win32 there is an api which signals the
removal to requirement to the OS. It can't be reset.

To understand the cleaning system, you have to understand about pools.
As memory, other resources can be tied to pools too. Files get closed
and cleaned if they were not closed before the pool gets cleaned or
destroyed. Pools get destroyed if their parent gets destroyed, so that
upon errors files are cleaned up.

If you specify delete_on_close, as the name suggests, the file gets
deleted when closed, even if you rename the file before it gets closed
(at least on some OSes).

bye,

Erik.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Dec 23 20:02:22 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.