Author: stefan2
Date: Sat May 21 18:55:43 2011
New Revision: 1125766

URL: http://svn.apache.org/viewvc?rev=1125766&view=rev
Log:
Add "SVNCacheTextDeltas" and "SVNCacheFullTexts" per-directory
(repository) mod_dav_svn configuration parameters. Pass them on
to the svn_repo_open2() function.

* subversion/mod_dav_svn/dav_svn.h
  (dav_svn__get_txdelta_cache_flag, dav_svn__get_fulltext_cache_flag):
   declare new config access functions
* subversion/mod_dav_svn/mod_dav_svn.c
  (dav_svn__get_txdelta_cache_flag, dav_svn__get_fulltext_cache_flag):
   implement them
  (dir_conf_t): add new config flags
  (merge_dir_config): handle them properly during merge
  (SVNCacheTextDeltas_cmd, SVNCacheFullTexts_cmd): parse new
   per-directory config settings
  (cmds): declare new parameter processing  commands
* subversion/mod_dav_svn/repos.c
  (get_resource): pass per-directory config parameters to repo creation

Modified:
    subversion/trunk/subversion/mod_dav_svn/dav_svn.h
    subversion/trunk/subversion/mod_dav_svn/mod_dav_svn.c
    subversion/trunk/subversion/mod_dav_svn/repos.c

Modified: subversion/trunk/subversion/mod_dav_svn/dav_svn.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/dav_svn.h?rev=1125766&r1=1125765&r2=1125766&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/dav_svn.h (original)
+++ subversion/trunk/subversion/mod_dav_svn/dav_svn.h Sat May 21 18:55:43 2011
@@ -313,6 +313,12 @@ svn_boolean_t dav_svn__get_v2_protocol_f
 /* for the repository referred to by this request, are subrequests active? */
 svn_boolean_t dav_svn__get_pathauthz_flag(request_rec *r);
 
+/* for the repository referred to by this request, is txdelta caching active? 
*/
+svn_boolean_t dav_svn__get_txdelta_cache_flag(request_rec *r);
+
+/* 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, are subrequests bypassed?
  * A function pointer if yes, NULL if not.
  */

Modified: subversion/trunk/subversion/mod_dav_svn/mod_dav_svn.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/mod_dav_svn.c?rev=1125766&r1=1125765&r2=1125766&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/mod_dav_svn.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/mod_dav_svn.c Sat May 21 18:55:43 
2011
@@ -89,6 +89,8 @@ typedef struct dir_conf_t {
   const char *root_dir;              /* our top-level directory */
   const char *master_uri;            /* URI to the master SVN repos */
   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 */
 } dir_conf_t;
 
 
@@ -211,6 +213,8 @@ merge_dir_config(apr_pool_t *p, void *ba
   newconf->v2_protocol = INHERIT_VALUE(parent, child, v2_protocol);
   newconf->path_authz_method = INHERIT_VALUE(parent, child, path_authz_method);
   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);
   /* Prefer our parent's value over our new one - hence the swap. */
   newconf->root_dir = INHERIT_VALUE(child, parent, root_dir);
 
@@ -425,6 +429,32 @@ SVNSpecialURI_cmd(cmd_parms *cmd, void *
 }
 
 static const char *
+SVNCacheTextDeltas_cmd(cmd_parms *cmd, void *config, int arg)
+{
+  dir_conf_t *conf = config;
+
+  if (arg)
+    conf->txdelta_cache = CONF_FLAG_ON;
+  else
+    conf->txdelta_cache = CONF_FLAG_OFF;
+
+  return NULL;
+}
+
+static const char *
+SVNCacheFullTexts_cmd(cmd_parms *cmd, void *config, int arg)
+{
+  dir_conf_t *conf = config;
+
+  if (arg)
+    conf->fulltext_cache = CONF_FLAG_ON;
+  else
+    conf->fulltext_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_get_cache_config();
@@ -719,6 +749,26 @@ dav_svn__get_activities_db(request_rec *
 }
 
 
+svn_boolean_t
+dav_svn__get_txdelta_cache_flag(request_rec *r)
+{
+  dir_conf_t *conf;
+
+  conf = ap_get_module_config(r->per_dir_config, &dav_svn_module);
+  return conf->txdelta_cache == CONF_FLAG_ON;
+}
+
+
+svn_boolean_t
+dav_svn__get_fulltext_cache_flag(request_rec *r)
+{
+  dir_conf_t *conf;
+
+  conf = ap_get_module_config(r->per_dir_config, &dav_svn_module);
+  return conf->fulltext_cache == CONF_FLAG_ON;
+}
+
+
 int
 dav_svn__get_compression_level(void)
 {
@@ -928,6 +978,20 @@ static const command_rec cmds[] =
                "enables server advertising of support for version 2 of "
                "Subversion's HTTP protocol (default values is On)."),
 
+  /* per directory/location */
+  AP_INIT_FLAG("SVNCacheTextDeltas", SVNCacheTextDeltas_cmd, NULL,
+               ACCESS_CONF|RSRC_CONF, 
+               "speeds up data access to older revisions by caching "
+               "delta information if sufficient in-memory cache is "
+               "available (default is Off)."),
+
+  /* per directory/location */
+  AP_INIT_FLAG("SVNCacheFullTexts", SVNCacheFullTexts_cmd, NULL,
+               ACCESS_CONF|RSRC_CONF,
+               "speeds up data access by caching full file content "
+               "if sufficient in-memory cache is available "
+               "(default is Off)."),
+
   /* per server */
   AP_INIT_TAKE1("SVNInMemoryCacheSize", SVNInMemoryCacheSize_cmd, NULL,
                 RSRC_CONF,

Modified: subversion/trunk/subversion/mod_dav_svn/repos.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/repos.c?rev=1125766&r1=1125765&r2=1125766&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/repos.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/repos.c Sat May 21 18:55:43 2011
@@ -1931,6 +1931,7 @@ get_resource(request_rec *r,
   dav_locktoken_list *ltl;
   struct cleanup_fs_access_baton *cleanup_baton;
   void *userdata;
+  apr_hash_t *fs_config;
 
   repo_name = dav_svn__get_repo_name(r);
   xslt_uri = dav_svn__get_xslt_uri(r);
@@ -2132,7 +2133,19 @@ get_resource(request_rec *r,
   repos->repos = userdata;
   if (repos->repos == NULL)
     {
-      serr = svn_repos_open2(&(repos->repos), fs_path, NULL, 
+      /* construct FS configuration parameters */
+      fs_config = apr_hash_make(r->connection->pool);
+      apr_hash_set(fs_config, 
+                   SVN_FS_CONFIG_FSFS_CACHE_DELTAS, 
+                   APR_HASH_KEY_STRING, 
+                   dav_svn__get_txdelta_cache_flag(r) ? "1" : "0");
+      apr_hash_set(fs_config, 
+                   SVN_FS_CONFIG_FSFS_CACHE_FULLTEXTS, 
+                   APR_HASH_KEY_STRING, 
+                   dav_svn__get_fulltext_cache_flag(r) ? "1" : "0");
+      
+      /* open the FS */
+      serr = svn_repos_open2(&(repos->repos), fs_path, fs_config, 
                              r->connection->pool);
       if (serr != NULL)
         {


Reply via email to