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/03/10 11:53:49 UTC
svn commit: r1299179 - in /subversion/branches/revprop-cache/subversion:
include/svn_fs.h libsvn_fs_fs/caching.c mod_dav_svn/dav_svn.h
mod_dav_svn/mod_dav_svn.c mod_dav_svn/repos.c svnadmin/main.c
svnserve/main.c svnserve/serve.c svnserve/server.h
Author: stefan2
Date: Sat Mar 10 10:53:49 2012
New Revision: 1299179
URL: http://svn.apache.org/viewvc?rev=1299179&view=rev
Log:
On the revprop-cache branch:
introduce revprop caching option next to the existing ones.
* subversion/include/svn_fs.h
(SVN_FS_CONFIG_FSFS_CACHE_REVPROPS): new config option
* subversion/libsvn_fs_fs/caching.c
(read_config): read new config option
(svn_fs_fs__initialize_caches): create revprop cache only
if the new option has been set
* subversion/mod_dav_svn/dav_svn.h
(dav_svn__get_revprop_cache_flag): declare new config access
* subversion/mod_dav_svn/mod_dav_svn.c
(struct dir_conf_t): add flag for revprop caching
(merge_dir_config): process new flag as well
(SVNCacheRevProps_cmd): new command callback
(dav_svn__get_revprop_cache_flag): implement config access
(cmds): add new config command
* subversion/mod_dav_svn/repos.c
(get_resource): pass new config option to repos_open()
* subversion/svnserve/server.h
(serve_params_t): add flag for revprop caching
* subversion/svnserve/main.c
(SVNSERVE_OPT_CACHE_REVPROPS): declare new option ID
(SVNSERVE_OPT_SINGLE_CONN): change option ID
(svnserve__options): add option UI
(main): parse options
* subversion/svnserve/serve.c
(serve): pass new config option to repos_open()
* subversion/svnadmin/main.c
(open_repos): disable revprop caching (data not re-used)
Modified:
subversion/branches/revprop-cache/subversion/include/svn_fs.h
subversion/branches/revprop-cache/subversion/libsvn_fs_fs/caching.c
subversion/branches/revprop-cache/subversion/mod_dav_svn/dav_svn.h
subversion/branches/revprop-cache/subversion/mod_dav_svn/mod_dav_svn.c
subversion/branches/revprop-cache/subversion/mod_dav_svn/repos.c
subversion/branches/revprop-cache/subversion/svnadmin/main.c
subversion/branches/revprop-cache/subversion/svnserve/main.c
subversion/branches/revprop-cache/subversion/svnserve/serve.c
subversion/branches/revprop-cache/subversion/svnserve/server.h
Modified: subversion/branches/revprop-cache/subversion/include/svn_fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-cache/subversion/include/svn_fs.h?rev=1299179&r1=1299178&r2=1299179&view=diff
==============================================================================
--- subversion/branches/revprop-cache/subversion/include/svn_fs.h (original)
+++ subversion/branches/revprop-cache/subversion/include/svn_fs.h Sat Mar 10 10:53:49 2012
@@ -85,6 +85,12 @@ typedef struct svn_fs_t svn_fs_t;
*/
#define SVN_FS_CONFIG_FSFS_CACHE_FULLTEXTS "fsfs-cache-fulltexts"
+/** Enable / disable revprop caching for a FSFS repository.
+ *
+ * @since New in 1.8.
+ */
+#define SVN_FS_CONFIG_FSFS_CACHE_REVPROPS "fsfs-cache-revprops"
+
/* See also svn_fs_type(). */
/** @since New in 1.1. */
#define SVN_FS_CONFIG_FS_TYPE "fs-type"
Modified: subversion/branches/revprop-cache/subversion/libsvn_fs_fs/caching.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-cache/subversion/libsvn_fs_fs/caching.c?rev=1299179&r1=1299178&r2=1299179&view=diff
==============================================================================
--- subversion/branches/revprop-cache/subversion/libsvn_fs_fs/caching.c (original)
+++ subversion/branches/revprop-cache/subversion/libsvn_fs_fs/caching.c Sat Mar 10 10:53:49 2012
@@ -44,6 +44,7 @@ read_config(svn_memcache_t **memcache_p,
svn_boolean_t *fail_stop,
svn_boolean_t *cache_txdeltas,
svn_boolean_t *cache_fulltexts,
+ svn_boolean_t *cache_revprops,
svn_fs_t *fs,
apr_pool_t *pool)
{
@@ -74,6 +75,16 @@ read_config(svn_memcache_t **memcache_p,
SVN_FS_CONFIG_FSFS_CACHE_FULLTEXTS,
TRUE);
+ /* don't cache revprops by default.
+ * Revprop caching significantly speeds up operations like
+ * svn ls -v. However, it requires synchronization that may
+ * not be available or efficient in the current server setup.
+ */
+ *cache_revprops
+ = svn_hash__get_bool(fs->config,
+ SVN_FS_CONFIG_FSFS_CACHE_REVPROPS,
+ TRUE);
+
return svn_config_get_bool(ffd->config, fail_stop,
CONFIG_SECTION_CACHES, CONFIG_OPTION_FAIL_STOP,
FALSE);
@@ -249,12 +260,14 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
svn_boolean_t no_handler;
svn_boolean_t cache_txdeltas;
svn_boolean_t cache_fulltexts;
+ svn_boolean_t cache_revprops;
/* Evaluating the cache configuration. */
SVN_ERR(read_config(&memcache,
&no_handler,
&cache_txdeltas,
&cache_fulltexts,
+ &cache_revprops,
fs,
pool));
@@ -340,7 +353,7 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
SVN_ERR(init_callbacks(ffd->fulltext_cache, fs, no_handler, pool));
/* initialize revprop cache, if full-text caching has been enabled */
- if (cache_fulltexts)
+ if (cache_revprops)
{
SVN_ERR(create_cache(&(ffd->revprop_cache),
NULL,
Modified: subversion/branches/revprop-cache/subversion/mod_dav_svn/dav_svn.h
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-cache/subversion/mod_dav_svn/dav_svn.h?rev=1299179&r1=1299178&r2=1299179&view=diff
==============================================================================
--- subversion/branches/revprop-cache/subversion/mod_dav_svn/dav_svn.h (original)
+++ subversion/branches/revprop-cache/subversion/mod_dav_svn/dav_svn.h Sat Mar 10 10:53:49 2012
@@ -316,6 +316,9 @@ svn_boolean_t dav_svn__get_txdelta_cache
/* for the repository referred to by this request, is fulltext caching active? */
svn_boolean_t dav_svn__get_fulltext_cache_flag(request_rec *r);
+/* for the repository referred to by this request, is revprop caching active? */
+svn_boolean_t dav_svn__get_revprop_cache_flag(request_rec *r);
+
/* for the repository referred to by this request, are subrequests bypassed?
* A function pointer if yes, NULL if not.
*/
Modified: subversion/branches/revprop-cache/subversion/mod_dav_svn/mod_dav_svn.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-cache/subversion/mod_dav_svn/mod_dav_svn.c?rev=1299179&r1=1299178&r2=1299179&view=diff
==============================================================================
--- subversion/branches/revprop-cache/subversion/mod_dav_svn/mod_dav_svn.c (original)
+++ subversion/branches/revprop-cache/subversion/mod_dav_svn/mod_dav_svn.c Sat Mar 10 10:53:49 2012
@@ -95,6 +95,7 @@ typedef struct dir_conf_t {
const char *activities_db; /* path to activities database(s) */
enum conf_flag txdelta_cache; /* whether to enable txdelta caching */
enum conf_flag fulltext_cache; /* whether to enable fulltext caching */
+ enum conf_flag revprop_cache; /* whether to enable revprop caching */
apr_hash_t *hooks_env; /* environment for hook scripts */
} dir_conf_t;
@@ -224,6 +225,7 @@ merge_dir_config(apr_pool_t *p, void *ba
newconf->list_parentpath = INHERIT_VALUE(parent, child, list_parentpath);
newconf->txdelta_cache = INHERIT_VALUE(parent, child, txdelta_cache);
newconf->fulltext_cache = INHERIT_VALUE(parent, child, fulltext_cache);
+ newconf->revprop_cache = INHERIT_VALUE(parent, child, revprop_cache);
newconf->root_dir = INHERIT_VALUE(parent, child, root_dir);
newconf->hooks_env = INHERIT_VALUE(parent, child, hooks_env);
@@ -476,6 +478,19 @@ SVNCacheFullTexts_cmd(cmd_parms *cmd, vo
}
static const char *
+SVNCacheRevProps_cmd(cmd_parms *cmd, void *config, int arg)
+{
+ dir_conf_t *conf = config;
+
+ if (arg)
+ conf->revprop_cache = CONF_FLAG_ON;
+ else
+ conf->revprop_cache = CONF_FLAG_OFF;
+
+ return NULL;
+}
+
+static const char *
SVNInMemoryCacheSize_cmd(cmd_parms *cmd, void *config, const char *arg1)
{
svn_cache_config_t settings = *svn_cache_config_get();
@@ -844,6 +859,16 @@ dav_svn__get_fulltext_cache_flag(request
}
+svn_boolean_t
+dav_svn__get_revprop_cache_flag(request_rec *r)
+{
+ dir_conf_t *conf;
+
+ conf = ap_get_module_config(r->per_dir_config, &dav_svn_module);
+ return conf->revprop_cache == CONF_FLAG_ON;
+}
+
+
int
dav_svn__get_compression_level(void)
{
@@ -1080,6 +1105,14 @@ static const command_rec cmds[] =
"if sufficient in-memory cache is available "
"(default is Off)."),
+ /* per directory/location */
+ AP_INIT_FLAG("SVNCacheRevProps", SVNCacheRevProps_cmd, NULL,
+ ACCESS_CONF|RSRC_CONF,
+ "speeds up 'svn ls -v', export and checkout operations"
+ "but should only be enabled under the conditions described"
+ "in the documentation"
+ "(default is Off)."),
+
/* per server */
AP_INIT_TAKE1("SVNInMemoryCacheSize", SVNInMemoryCacheSize_cmd, NULL,
RSRC_CONF,
Modified: subversion/branches/revprop-cache/subversion/mod_dav_svn/repos.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-cache/subversion/mod_dav_svn/repos.c?rev=1299179&r1=1299178&r2=1299179&view=diff
==============================================================================
--- subversion/branches/revprop-cache/subversion/mod_dav_svn/repos.c (original)
+++ subversion/branches/revprop-cache/subversion/mod_dav_svn/repos.c Sat Mar 10 10:53:49 2012
@@ -2154,6 +2154,10 @@ get_resource(request_rec *r,
SVN_FS_CONFIG_FSFS_CACHE_FULLTEXTS,
APR_HASH_KEY_STRING,
dav_svn__get_fulltext_cache_flag(r) ? "1" : "0");
+ apr_hash_set(fs_config,
+ SVN_FS_CONFIG_FSFS_CACHE_REVPROPS,
+ APR_HASH_KEY_STRING,
+ dav_svn__get_revprop_cache_flag(r) ? "1" : "0");
/* open the FS */
serr = svn_repos_open2(&(repos->repos), fs_path, fs_config,
Modified: subversion/branches/revprop-cache/subversion/svnadmin/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-cache/subversion/svnadmin/main.c?rev=1299179&r1=1299178&r2=1299179&view=diff
==============================================================================
--- subversion/branches/revprop-cache/subversion/svnadmin/main.c (original)
+++ subversion/branches/revprop-cache/subversion/svnadmin/main.c Sat Mar 10 10:53:49 2012
@@ -108,12 +108,14 @@ open_repos(svn_repos_t **repos,
const char *path,
apr_pool_t *pool)
{
- /* construct FS configuration parameters: enable all available caches */
+ /* construct FS configuration parameters: enable caches for r/o data */
apr_hash_t *fs_config = apr_hash_make(pool);
apr_hash_set(fs_config, SVN_FS_CONFIG_FSFS_CACHE_DELTAS,
APR_HASH_KEY_STRING, "1");
apr_hash_set(fs_config, SVN_FS_CONFIG_FSFS_CACHE_FULLTEXTS,
APR_HASH_KEY_STRING, "1");
+ apr_hash_set(fs_config, SVN_FS_CONFIG_FSFS_CACHE_REVPROPS,
+ APR_HASH_KEY_STRING, "0");
/* now, open the requested repository */
SVN_ERR(svn_repos_open2(repos, path, fs_config, pool));
Modified: subversion/branches/revprop-cache/subversion/svnserve/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-cache/subversion/svnserve/main.c?rev=1299179&r1=1299178&r2=1299179&view=diff
==============================================================================
--- subversion/branches/revprop-cache/subversion/svnserve/main.c (original)
+++ subversion/branches/revprop-cache/subversion/svnserve/main.c Sat Mar 10 10:53:49 2012
@@ -147,7 +147,8 @@ void winservice_notify_stop(void)
#define SVNSERVE_OPT_LOG_FILE 264
#define SVNSERVE_OPT_CACHE_TXDELTAS 265
#define SVNSERVE_OPT_CACHE_FULLTEXTS 266
-#define SVNSERVE_OPT_SINGLE_CONN 267
+#define SVNSERVE_OPT_CACHE_REVPROPS 267
+#define SVNSERVE_OPT_SINGLE_CONN 268
static const apr_getopt_option_t svnserve__options[] =
{
@@ -222,6 +223,14 @@ static const apr_getopt_option_t svnserv
"Default is yes.\n"
" "
"[used for FSFS repositories only]")},
+ {"cache-revprops", SVNSERVE_OPT_CACHE_REVPROPS, 1,
+ N_("enable or disable caching of revision properties.\n"
+ " "
+ "Consult the documentation before activating this.\n"
+ " "
+ "Default is no.\n"
+ " "
+ "[used for FSFS repositories only]")},
#ifdef CONNECTION_HAVE_THREAD_OPTION
/* ### Making the assumption here that WIN32 never has fork and so
* ### this option never exists when --service exists. */
@@ -483,6 +492,7 @@ int main(int argc, const char *argv[])
params.memory_cache_size = (apr_uint64_t)-1;
params.cache_fulltexts = TRUE;
params.cache_txdeltas = FALSE;
+ params.cache_revprops = FALSE;
while (1)
{
@@ -626,6 +636,11 @@ int main(int argc, const char *argv[])
= svn_tristate__from_word(arg) == svn_tristate_true;
break;
+ case SVNSERVE_OPT_CACHE_REVPROPS:
+ params.cache_revprops
+ = svn_tristate__from_word(arg) == svn_tristate_true;
+ break;
+
#ifdef WIN32
case SVNSERVE_OPT_SERVICE:
if (run_mode != run_mode_service)
Modified: subversion/branches/revprop-cache/subversion/svnserve/serve.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-cache/subversion/svnserve/serve.c?rev=1299179&r1=1299178&r2=1299179&view=diff
==============================================================================
--- subversion/branches/revprop-cache/subversion/svnserve/serve.c (original)
+++ subversion/branches/revprop-cache/subversion/svnserve/serve.c Sat Mar 10 10:53:49 2012
@@ -3236,6 +3236,8 @@ svn_error_t *serve(svn_ra_svn_conn_t *co
APR_HASH_KEY_STRING, params->cache_txdeltas ? "1" : "0");
apr_hash_set(b.fs_config, SVN_FS_CONFIG_FSFS_CACHE_FULLTEXTS,
APR_HASH_KEY_STRING, params->cache_fulltexts ? "1" : "0");
+ apr_hash_set(b.fs_config, SVN_FS_CONFIG_FSFS_CACHE_REVPROPS,
+ APR_HASH_KEY_STRING, params->cache_revprops ? "1" : "0");
/* Send greeting. We don't support version 1 any more, so we can
* send an empty mechlist. */
Modified: subversion/branches/revprop-cache/subversion/svnserve/server.h
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-cache/subversion/svnserve/server.h?rev=1299179&r1=1299178&r2=1299179&view=diff
==============================================================================
--- subversion/branches/revprop-cache/subversion/svnserve/server.h (original)
+++ subversion/branches/revprop-cache/subversion/svnserve/server.h Sat Mar 10 10:53:49 2012
@@ -116,6 +116,9 @@ typedef struct serve_params_t {
/* Enable full-text caching for all FSFS repositories. */
svn_boolean_t cache_fulltexts;
+ /* Enable revprop caching for all FSFS repositories. */
+ svn_boolean_t cache_revprops;
+
/* Size of the in-memory cache (used by FSFS only). */
apr_uint64_t memory_cache_size;