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

Re: [PATCH]: Stop putting stuff in empty props files

From: Branko Čibej <brane_at_xbc.nu>
Date: 2005-10-20 20:51:06 CEST

Daniel Berlin wrote:

>On Thu, 2005-10-20 at 13:15 -0400, Daniel Berlin wrote:
>
>
>>Actually, i think i can teach it to not create the props file if the
>>hash is empty, which works on all versions (they stat the path first,
>>and treat non-existence as emptyness).
>>
>>That works fine for my porpoises.
>>
>>
>
>Yup, the attached actually works.
>
>This is fully backwards compatible with 1.2.x due to how hash_read
>works.
>
>Again, i'd badly like this change in 1.3.x.
>
>(In 1.4, we probably want to not create the file at all. It turns out
>not everything uses empty_props_p, however, so this actually introduces
>an incompatibility)
>
>For the curious, gcc's checkout has 30k files in it
>
>each 4 byte file was taking 1 disk block of 4096 bytes.
>
>30k * 4k = 120 meg
>
>multiply by 2 (one props, one props-base), and you get 240 meg.
>
>Whee.
>
>This also stops useless I/O when a file has no properties set, as a
>side-benefit.
>
>I've applied this to the trunk in the meanwhile.
>
>[[[
>
>Don't write empty hashes to the props file, it just wastes space.
>
>* subversion/libsvn_wc/props.c (svn_wc__save_prop_file): Check hash
>count before writing to file.
>(empty_props_p): finfo.size == 0 is empty too.
>
>
Aieee, bad indentatin in log message!

>Index: subversion/libsvn_wc/props.c
>===================================================================
>--- subversion/libsvn_wc/props.c (revision 16853)
>+++ subversion/libsvn_wc/props.c (working copy)
>@@ -187,16 +187,18 @@
> apr_pool_t *pool)
> {
> apr_file_t *prop_tmp;
>+
>
>
Aargh, extraneous new line with two trailing spaces!

>
> SVN_ERR (svn_io_file_open (&prop_tmp, propfile_path,
> (APR_WRITE | APR_CREATE | APR_TRUNCATE
> | APR_BUFFERED),
> APR_OS_DEFAULT, pool));
>
>- SVN_ERR_W (svn_hash_write (hash, prop_tmp, pool),
>- apr_psprintf (pool,
>- _("Can't write property hash to '%s'"),
>- svn_path_local_style (propfile_path, pool)));
>+ if (apr_hash_count (hash) != 0)
>+ SVN_ERR_W (svn_hash_write (hash, prop_tmp, pool),
>+ apr_psprintf (pool,
>+ _("Can't write property hash to '%s'"),
>+ svn_path_local_style (propfile_path, pool)));
>
> SVN_ERR (svn_io_file_close (prop_tmp, pool));
>
>@@ -1729,7 +1731,7 @@
>
> /* If we remove props from a propfile, eventually the file will
> contain nothing but "END\n" */
>- if (finfo.filetype == APR_REG && finfo.size == 4)
>+ if (finfo.filetype == APR_REG && (finfo.size == 4 || finfo.size == 0))
> *empty_p = TRUE;
>
>
Heh. :)

Disregarding my deep and relevant comments above, if this truly doesn't
cause an incompatibility and/or doesn't require a WC version update,
then please commit and add my +1 to the backport entry in the 1.3.x
STATUS file.

-- Brane

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Oct 20 20:52:00 2005

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.