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

Re: svn commit: r27098 - trunk/subversion/libsvn_fs_fs

From: Eric Gillespie <epg_at_google.com>
Date: Wed, 06 Feb 2008 13:55:57 -0800

glasser_at_tigris.org writes:

> Modified: trunk/subversion/libsvn_fs_fs/fs_fs.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_fs_fs/fs_fs.c?pathrev=27098&r1=27097&r2=27098
> ==============================================================================
> --- trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
> +++ trunk/subversion/libsvn_fs_fs/fs_fs.c Wed Oct 10 17:11:58 2007
> @@ -1748,14 +1748,15 @@
> apr_off_t root_offset;
> svn_fs_id_t *root_id;
> svn_error_t *err;
> - unsigned int hid;
> + const char *rev_str = apr_psprintf(ffd->rev_root_id_cache_pool, "%ld", rev);

Allocate rev_str from ffd->rev_root_id_cache_pool...

> svn_fs_id_t *cached_id;
>
> /* Calculate an index into the revroot id cache */
> - hid = RRI_CACHE_ENTRIES_MASK(rev);
> - cached_id = ffd->rev_root_id_cache[hid];
> + cached_id = apr_hash_get(ffd->rev_root_id_cache,
> + rev_str,
> + APR_HASH_KEY_STRING);
>
> - if (cached_id && rev == svn_fs_fs__id_rev(cached_id))
> + if (cached_id)
> {
> *root_id_p = svn_fs_fs__id_copy(cached_id, pool);
> return SVN_NO_ERROR;
> @@ -1779,14 +1780,16 @@
>
> SVN_ERR(svn_io_file_close(revision_file, pool));
>
> - /* Cache it (and a pool) */
> - ffd->rev_root_id_cache[hid] = NULL;
> - if (ffd->rev_root_id_cache_pool[hid])
> - svn_pool_clear(ffd->rev_root_id_cache_pool[hid]);
> - else
> - ffd->rev_root_id_cache_pool[hid] = svn_pool_create(fs->pool);
> - ffd->rev_root_id_cache[hid]
> - = svn_fs_fs__id_copy(root_id, ffd->rev_root_id_cache_pool[hid]);
> + /* Cache it */
> + if (apr_hash_count(ffd->rev_root_id_cache) >= NUM_RRI_CACHE_ENTRIES)
> + {
> + /* In order to only use one pool for the whole cache, we need to
> + * completely wipe it to expire entries! */
> + svn_pool_clear(ffd->rev_root_id_cache_pool);

Clear ffd->rev_root_id_cache_pool...

> + ffd->rev_root_id_cache = apr_hash_make(ffd->rev_root_id_cache_pool);
> + }
> + apr_hash_set(ffd->rev_root_id_cache, rev_str, APR_HASH_KEY_STRING,
> + svn_fs_fs__id_copy(root_id, ffd->rev_root_id_cache_pool));

And use rev_str. Boom!

Yeah, we just hit a svnadmin dump segfault on this one ;->

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-02-06 22:56:18 CET

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.