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 2011/05/22 19:24:19 UTC

svn commit: r1126110 - in /subversion/trunk/subversion/svnserve: main.c serve.c server.h

Author: stefan2
Date: Sun May 22 17:24:19 2011
New Revision: 1126110

URL: http://svn.apache.org/viewvc?rev=1126110&view=rev
Log:
Switch FS cache configuration in svnserve  from global cache settings
to per-repository parameters. Also, provide new command line
parameters "--cache-txdeltas" and "--cache-fulltexts" for fine-grained
cache control.

* subversion/svnserve/server.h
  (server_baton_t): add fs_config member
  (serve_params_t): add cache enabling flags
* subversion/svnserve/serve.c
  (find_repos): forward fs_config to repos layer
  (serve): construct fs_config
* subversion/svnserve/main.c
  (SVNSERVE_OPT_CACHE_TXDELTAS, SVNSERVE_OPT_CACHE_FULLTEXTS):
   new parameters
  (svnserve__options): declare them in the UI
  (main): parse them from command line; don't modify respective global
   caching defaults anymore.

Modified:
    subversion/trunk/subversion/svnserve/main.c
    subversion/trunk/subversion/svnserve/serve.c
    subversion/trunk/subversion/svnserve/server.h

Modified: subversion/trunk/subversion/svnserve/main.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnserve/main.c?rev=1126110&r1=1126109&r2=1126110&view=diff
==============================================================================
--- subversion/trunk/subversion/svnserve/main.c (original)
+++ subversion/trunk/subversion/svnserve/main.c Sun May 22 17:24:19 2011
@@ -136,15 +136,17 @@ void winservice_notify_stop(void)
  * APR requires that options without abbreviations
  * have codes greater than 255.
  */
-#define SVNSERVE_OPT_LISTEN_PORT 256
-#define SVNSERVE_OPT_LISTEN_HOST 257
-#define SVNSERVE_OPT_FOREGROUND  258
-#define SVNSERVE_OPT_TUNNEL_USER 259
-#define SVNSERVE_OPT_VERSION     260
-#define SVNSERVE_OPT_PID_FILE    261
-#define SVNSERVE_OPT_SERVICE     262
-#define SVNSERVE_OPT_CONFIG_FILE 263
-#define SVNSERVE_OPT_LOG_FILE 264
+#define SVNSERVE_OPT_LISTEN_PORT     256
+#define SVNSERVE_OPT_LISTEN_HOST     257
+#define SVNSERVE_OPT_FOREGROUND      258
+#define SVNSERVE_OPT_TUNNEL_USER     259
+#define SVNSERVE_OPT_VERSION         260
+#define SVNSERVE_OPT_PID_FILE        261
+#define SVNSERVE_OPT_SERVICE         262
+#define SVNSERVE_OPT_CONFIG_FILE     263
+#define SVNSERVE_OPT_LOG_FILE        264
+#define SVNSERVE_OPT_CACHE_TXDELTAS  265
+#define SVNSERVE_OPT_CACHE_FULLTEXTS 266
 
 static const apr_getopt_option_t svnserve__options[] =
   {
@@ -205,6 +207,20 @@ static const apr_getopt_option_t svnserv
         "threaded mode.\n"
         "                             "
         "[used for FSFS repositories only]")},
+    {"cache-txdeltas", SVNSERVE_OPT_CACHE_TXDELTAS, 1, 
+     N_("enable or disable caching of deltas between older\n"
+        "                             "
+        "revisions.\n"
+        "                             "
+        "Default is no.\n"
+        "                             "
+        "[used for FSFS repositories only]")},
+    {"cache-fulltexts", SVNSERVE_OPT_CACHE_FULLTEXTS, 1, 
+     N_("enable or disable caching of file contents\n"
+        "                             "
+        "Default is yes.\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. */
@@ -457,6 +473,8 @@ int main(int argc, const char *argv[])
   params.log_file = NULL;
   params.username_case = CASE_ASIS;
   params.memory_cache_size = (apr_uint64_t)-1;
+  params.cache_fulltexts = TRUE;
+  params.cache_txdeltas = FALSE;
 
   while (1)
     {
@@ -580,6 +598,16 @@ int main(int argc, const char *argv[])
         case 'M':
           params.memory_cache_size = 0x100000 * apr_strtoi64(arg, NULL, 0);
           break;
+          
+        case SVNSERVE_OPT_CACHE_TXDELTAS:
+          params.cache_txdeltas 
+             = svn_tristate_from_word(arg) == svn_tristate_true;
+          break;
+
+        case SVNSERVE_OPT_CACHE_FULLTEXTS:
+          params.cache_fulltexts
+             = svn_tristate_from_word(arg) == svn_tristate_true;
+          break;
 
 #ifdef WIN32
         case SVNSERVE_OPT_SERVICE:
@@ -845,10 +873,7 @@ int main(int argc, const char *argv[])
     if (params.memory_cache_size != -1)
       settings.cache_size = params.memory_cache_size;
 
-    settings.cache_fulltexts = TRUE;
-    settings.cache_txdeltas = FALSE;
     settings.single_threaded = TRUE;
-
     if (handling_mode == connection_mode_thread)
       {
 #ifdef APR_HAS_THREADS

Modified: subversion/trunk/subversion/svnserve/serve.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnserve/serve.c?rev=1126110&r1=1126109&r2=1126110&view=diff
==============================================================================
--- subversion/trunk/subversion/svnserve/serve.c (original)
+++ subversion/trunk/subversion/svnserve/serve.c Sun May 22 17:24:19 2011
@@ -2998,7 +2998,7 @@ static svn_error_t *find_repos(const cha
                              "No repository found in '%s'", url);
 
   /* Open the repository and fill in b with the resulting information. */
-  SVN_ERR(svn_repos_open2(&b->repos, repos_root, NULL, pool));
+  SVN_ERR(svn_repos_open2(&b->repos, repos_root, b->fs_config, pool));
   SVN_ERR(svn_repos_remember_client_capabilities(b->repos, capabilities));
   b->fs = svn_repos_fs(b->repos);
   fs_path = full_path + strlen(repos_root);
@@ -3096,6 +3096,13 @@ svn_error_t *serve(svn_ra_svn_conn_t *co
   b.pool = pool;
   b.use_sasl = FALSE;
 
+  /* construct FS configuration parameters */
+  b.fs_config = apr_hash_make(pool);
+  apr_hash_set(b.fs_config, SVN_FS_CONFIG_FSFS_CACHE_DELTAS, 
+               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");
+  
   /* Send greeting.  We don't support version 1 any more, so we can
    * send an empty mechlist. */
   if (params->compression_level > 0)

Modified: subversion/trunk/subversion/svnserve/server.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnserve/server.h?rev=1126110&r1=1126109&r2=1126110&view=diff
==============================================================================
--- subversion/trunk/subversion/svnserve/server.h (original)
+++ subversion/trunk/subversion/svnserve/server.h Sun May 22 17:24:19 2011
@@ -49,6 +49,7 @@ typedef struct server_baton_t {
   const char *realm;       /* Authentication realm */
   const char *repos_url;   /* URL to base of repository */
   svn_stringbuf_t *fs_path;/* Decoded base in-repos path (w/ leading slash) */
+  apr_hash_t *fs_config;   /* Additional FS configuration parameters */
   const char *user;        /* Authenticated username of the user */
   enum username_case_type username_case; /* Case-normalize the username? */
   const char *authz_user;  /* Username for authz ('user' + 'username_case') */
@@ -109,6 +110,12 @@ typedef struct serve_params_t {
   /* Username case normalization style. */
   enum username_case_type username_case;
 
+  /* Enable text delta caching for all FSFS repositories. */
+  svn_boolean_t cache_txdeltas;
+
+  /* Enable full-text caching for all FSFS repositories. */
+  svn_boolean_t cache_fulltexts;
+  
   /* Size of the in-memory cache (used by FSFS only). */
   apr_uint64_t memory_cache_size;