You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2012/09/22 14:35:16 UTC
svn commit: r1388789 - in /subversion/branches/10Gb/subversion/libsvn_fs_fs:
caching.c fs.h fs_fs.c
Author: stefan2
Date: Sat Sep 22 12:35:16 2012
New Revision: 1388789
URL: http://svn.apache.org/viewvc?rev=1388789&view=rev
Log:
On the 10Gb branch: Cache node properties in their
parsed state instead of just the plain full-text.
temp_(de-)serialization is much faster then parsing
from a generic stream.
* subversion/libsvn_fs_fs/fs.h
(fs_fs_data_t): add a new cache
* subversion/libsvn_fs_fs/caching.c
(svn_fs_fs__initialize_caches): initialize it
* subversion/libsvn_fs_fs/fs_fs.c
(svn_fs_fs__get_proplist): use it
Modified:
subversion/branches/10Gb/subversion/libsvn_fs_fs/caching.c
subversion/branches/10Gb/subversion/libsvn_fs_fs/fs.h
subversion/branches/10Gb/subversion/libsvn_fs_fs/fs_fs.c
Modified: subversion/branches/10Gb/subversion/libsvn_fs_fs/caching.c
URL: http://svn.apache.org/viewvc/subversion/branches/10Gb/subversion/libsvn_fs_fs/caching.c?rev=1388789&r1=1388788&r2=1388789&view=diff
==============================================================================
--- subversion/branches/10Gb/subversion/libsvn_fs_fs/caching.c (original)
+++ subversion/branches/10Gb/subversion/libsvn_fs_fs/caching.c Sat Sep 22 12:35:16 2012
@@ -359,6 +359,27 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
SVN_ERR(init_callbacks(ffd->fulltext_cache, fs, no_handler, pool));
+ /* initialize node properties cache, if that has been enabled */
+ if (cache_fulltexts)
+ {
+ SVN_ERR(create_cache(&(ffd->properties_cache),
+ NULL,
+ membuffer,
+ 0, 0, /* Do not use inprocess cache */
+ svn_fs_fs__serialize_properties,
+ svn_fs_fs__deserialize_properties,
+ sizeof(pair_cache_key_t),
+ apr_pstrcat(pool, prefix, "PROP",
+ (char *)NULL),
+ fs->pool));
+ }
+ else
+ {
+ ffd->properties_cache = NULL;
+ }
+
+ SVN_ERR(init_callbacks(ffd->properties_cache, fs, no_handler, pool));
+
/* initialize revprop cache, if full-text caching has been enabled */
if (cache_revprops)
{
Modified: subversion/branches/10Gb/subversion/libsvn_fs_fs/fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/10Gb/subversion/libsvn_fs_fs/fs.h?rev=1388789&r1=1388788&r2=1388789&view=diff
==============================================================================
--- subversion/branches/10Gb/subversion/libsvn_fs_fs/fs.h (original)
+++ subversion/branches/10Gb/subversion/libsvn_fs_fs/fs.h Sat Sep 22 12:35:16 2012
@@ -283,6 +283,9 @@ typedef struct fs_fs_data_t
/* Revision property cache. Maps from (rev,generation) to apr_hash_t. */
svn_cache__t *revprop_cache;
+ /* Node properties cache. Maps from rep key to apr_hash_t. */
+ svn_cache__t *properties_cache;
+
/* Pack manifest cache; a cache mapping (svn_revnum_t) shard number to
a manifest; and a manifest is a mapping from (svn_revnum_t) revision
number offset within a shard to (apr_off_t) byte-offset in the
Modified: subversion/branches/10Gb/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/10Gb/subversion/libsvn_fs_fs/fs_fs.c?rev=1388789&r1=1388788&r2=1388789&view=diff
==============================================================================
--- subversion/branches/10Gb/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/branches/10Gb/subversion/libsvn_fs_fs/fs_fs.c Sat Sep 22 12:35:16 2012
@@ -5424,11 +5424,10 @@ svn_fs_fs__get_proplist(apr_hash_t **pro
apr_hash_t *proplist;
svn_stream_t *stream;
- proplist = apr_hash_make(pool);
-
if (noderev->prop_rep && noderev->prop_rep->txn_id)
{
const char *filename = path_txn_node_props(fs, noderev->id, pool);
+ proplist = apr_hash_make(pool);
SVN_ERR(svn_stream_open_readonly(&stream, filename, pool, pool));
SVN_ERR(svn_hash_read2(proplist, stream, SVN_HASH_TERMINATOR, pool));
@@ -5436,9 +5435,31 @@ svn_fs_fs__get_proplist(apr_hash_t **pro
}
else if (noderev->prop_rep)
{
+ fs_fs_data_t *ffd = fs->fsap_data;
+ representation_t *rep = noderev->prop_rep;
+
+ pair_cache_key_t key = { rep->revision, rep->offset };
+ if (ffd->properties_cache && SVN_IS_VALID_REVNUM(rep->revision))
+ {
+ svn_boolean_t is_cached;
+ SVN_ERR(svn_cache__get((void **) proplist_p, &is_cached,
+ ffd->properties_cache, &key, pool));
+ if (is_cached)
+ return SVN_NO_ERROR;
+ }
+
+ proplist = apr_hash_make(pool);
SVN_ERR(read_representation(&stream, fs, noderev->prop_rep, pool));
SVN_ERR(svn_hash_read2(proplist, stream, SVN_HASH_TERMINATOR, pool));
SVN_ERR(svn_stream_close(stream));
+
+ if (ffd->properties_cache && SVN_IS_VALID_REVNUM(rep->revision))
+ SVN_ERR(svn_cache__set(ffd->properties_cache, &key, proplist, pool));
+ }
+ else
+ {
+ /* return an empty prop list if the node doesn't have any props */
+ proplist = apr_hash_make(pool);
}
*proplist_p = proplist;