You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2011/09/21 11:34:34 UTC

svn commit: r1173542 - in /subversion/branches/1.7.x: ./ STATUS subversion/include/svn_config.h subversion/libsvn_ra_local/ra_plugin.c subversion/libsvn_subr/config_file.c subversion/svn/main.c

Author: hwright
Date: Wed Sep 21 09:34:33 2011
New Revision: 1173542

URL: http://svn.apache.org/viewvc?rev=1173542&view=rev
Log:
Merge r1171708, r1173111 from trunk:

 * r1171708, r1173111
   Enable FSFS cache in svn, introduce config:miscellaneous:memory-cache-size.
   Justification:
     Make FSFS intensive operations, like blame, faster over ra_local.
   Votes:
     +1: philip, hwright, danielsh

Modified:
    subversion/branches/1.7.x/   (props changed)
    subversion/branches/1.7.x/STATUS
    subversion/branches/1.7.x/subversion/include/svn_config.h
    subversion/branches/1.7.x/subversion/libsvn_ra_local/ra_plugin.c
    subversion/branches/1.7.x/subversion/libsvn_subr/config_file.c
    subversion/branches/1.7.x/subversion/svn/main.c

Propchange: subversion/branches/1.7.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Sep 21 09:34:33 2011
@@ -64,4 +64,4 @@
 /subversion/branches/tree-conflicts:868291-873154
 /subversion/branches/tree-conflicts-notify:873926-874008
 /subversion/branches/uris-as-urls:1060426-1064427
-/subversion/trunk:1146013,1146121,1146219,1146222,1146274,1146492,1146555,1146606,1146620,1146684,1146781,1146832,1146834,1146870,1146899,1146904,1147293,1147309,1147882,1148071,1148083,1148094,1148131,1148374,1148424,1148566,1148588,1148853,1148877,1148882,1148936,1149105,1149141,1149160,1149228,1149240,1149343,1149371-1149372,1149377,1149398,1149401,1149539,1149572,1149627,1149675,1149701,1149713,1150242,1150254,1150260-1150261,1150266,1150302,1150327,1150368,1150372,1150441,1150506,1150812,1150853,1151036,1151177,1151610,1151906,1151911,1152129,1152140,1152189-1152190,1152267,1152282,1152286,1152726,1152809,1153138,1153141,1153416,1153799,1153807,1153968,1154009,1154023,1154115,1154119,1154121,1154144,1154155,1154159,1154165,1154215,1154225,1154273,1154461,1154717-1154718,1154733,1154908,1154982,1155015,1155044,1155124,1155131,1155160,1155313,1155334,1155391,1155404,1156085,1156098,1156216,1156218,1156312,1156527,1156717,1156721,1156750,1156827,1156838,1157416,1158187,115
 8193-1158194,1158196,1158201,1158207,1158209-1158210,1158217,1158285,1158288,1158303,1158309,1158407,1158419,1158421,1158436,1158455,1158616-1158617,1158634,1158854,1158875,1158886,1158893,1158896,1158919,1158924,1158963,1159093,1159098,1159101,1159132,1159136,1159148,1159230,1159275,1159400,1159686,1159760,1159772,1160605,1160671,1160682,1160704-1160705,1160756,1161063,1161080,1161185,1161210,1161683,1161721,1162024,1162033,1162201,1162516,1162880,1163557,1163792,1163953,1164027,1164517,1164535,1164554,1164580,1164645,1164760,1164765,1166500,1166555,1166678,1167062,1167173,1167209,1167269,1167503,1169524,1169531,1169650
+/subversion/trunk:1146013,1146121,1146219,1146222,1146274,1146492,1146555,1146606,1146620,1146684,1146781,1146832,1146834,1146870,1146899,1146904,1147293,1147309,1147882,1148071,1148083,1148094,1148131,1148374,1148424,1148566,1148588,1148853,1148877,1148882,1148936,1149105,1149141,1149160,1149228,1149240,1149343,1149371-1149372,1149377,1149398,1149401,1149539,1149572,1149627,1149675,1149701,1149713,1150242,1150254,1150260-1150261,1150266,1150302,1150327,1150368,1150372,1150441,1150506,1150812,1150853,1151036,1151177,1151610,1151906,1151911,1152129,1152140,1152189-1152190,1152267,1152282,1152286,1152726,1152809,1153138,1153141,1153416,1153799,1153807,1153968,1154009,1154023,1154115,1154119,1154121,1154144,1154155,1154159,1154165,1154215,1154225,1154273,1154461,1154717-1154718,1154733,1154908,1154982,1155015,1155044,1155124,1155131,1155160,1155313,1155334,1155391,1155404,1156085,1156098,1156216,1156218,1156312,1156527,1156717,1156721,1156750,1156827,1156838,1157416,1158187,115
 8193-1158194,1158196,1158201,1158207,1158209-1158210,1158217,1158285,1158288,1158303,1158309,1158407,1158419,1158421,1158436,1158455,1158616-1158617,1158634,1158854,1158875,1158886,1158893,1158896,1158919,1158924,1158963,1159093,1159098,1159101,1159132,1159136,1159148,1159230,1159275,1159400,1159686,1159760,1159772,1160605,1160671,1160682,1160704-1160705,1160756,1161063,1161080,1161185,1161210,1161683,1161721,1162024,1162033,1162201,1162516,1162880,1163557,1163792,1163953,1164027,1164517,1164535,1164554,1164580,1164645,1164760,1164765,1166500,1166555,1166678,1167062,1167173,1167209,1167269,1167503,1169524,1169531,1169650,1171708,1173111

Modified: subversion/branches/1.7.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/STATUS?rev=1173542&r1=1173541&r2=1173542&view=diff
==============================================================================
--- subversion/branches/1.7.x/STATUS (original)
+++ subversion/branches/1.7.x/STATUS Wed Sep 21 09:34:33 2011
@@ -140,10 +140,3 @@ Veto-blocked changes:
 
 Approved changes:
 =================
-
- * r1171708, r1173111
-   Enable FSFS cache in svn, introduce config:miscellaneous:memory-cache-size.
-   Justification:
-     Make FSFS intensive operations, like blame, faster over ra_local.
-   Votes:
-     +1: philip, hwright, danielsh

Modified: subversion/branches/1.7.x/subversion/include/svn_config.h
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/include/svn_config.h?rev=1173542&r1=1173541&r2=1173542&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/include/svn_config.h (original)
+++ subversion/branches/1.7.x/subversion/include/svn_config.h Wed Sep 21 09:34:33 2011
@@ -112,6 +112,7 @@ typedef struct svn_config_t svn_config_t
 #define SVN_CONFIG_OPTION_MIMETYPES_FILE            "mime-types-file"
 #define SVN_CONFIG_OPTION_PRESERVED_CF_EXTS         "preserved-conflict-file-exts"
 #define SVN_CONFIG_OPTION_INTERACTIVE_CONFLICTS     "interactive-conflicts"
+#define SVN_CONFIG_OPTION_MEMORY_CACHE_SIZE         "memory-cache-size"
 #define SVN_CONFIG_SECTION_TUNNELS              "tunnels"
 #define SVN_CONFIG_SECTION_AUTO_PROPS           "auto-props"
 /** @} */

Modified: subversion/branches/1.7.x/subversion/libsvn_ra_local/ra_plugin.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/libsvn_ra_local/ra_plugin.c?rev=1173542&r1=1173541&r2=1173542&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/libsvn_ra_local/ra_plugin.c (original)
+++ subversion/branches/1.7.x/subversion/libsvn_ra_local/ra_plugin.c Wed Sep 21 09:34:33 2011
@@ -32,12 +32,14 @@
 #include "svn_mergeinfo.h"
 #include "svn_path.h"
 #include "svn_version.h"
+#include "svn_cache_config.h"
 
 #include "svn_private_config.h"
 #include "../libsvn_ra/ra_loader.h"
 #include "private/svn_mergeinfo_private.h"
 #include "private/svn_repos_private.h"
 #include "private/svn_fspath.h"
+#include "private/svn_atomic.h"
 
 #define APR_WANT_STRFUNC
 #include <apr_want.h>
@@ -129,6 +131,35 @@ get_username(svn_ra_session_t *session,
   return SVN_NO_ERROR;
 }
 
+/* Implements an svn_atomic__init_once callback.  Sets the FSFS memory
+   cache size. */
+static svn_error_t *
+cache_init(void *baton, apr_pool_t *pool)
+{
+  apr_hash_t *config_hash = baton;
+  svn_config_t *config = NULL;
+  const char *memory_cache_size_str;
+
+  if (config_hash)
+    config = apr_hash_get(config_hash, SVN_CONFIG_CATEGORY_CONFIG,
+                          APR_HASH_KEY_STRING);
+  svn_config_get(config, &memory_cache_size_str, SVN_CONFIG_SECTION_MISCELLANY,
+                 SVN_CONFIG_OPTION_MEMORY_CACHE_SIZE, NULL);
+  if (memory_cache_size_str)
+    {
+      apr_uint64_t memory_cache_size;
+      svn_cache_config_t settings = *svn_cache_config_get();
+
+      SVN_ERR(svn_error_quick_wrap(svn_cstring_atoui64(&memory_cache_size,
+                                                       memory_cache_size_str),
+                                   _("memory-cache-size invalid")));
+      settings.cache_size = 1024 * 1024 * memory_cache_size; 
+      svn_cache_config_set(&settings);
+    }
+
+  return SVN_NO_ERROR;
+}
+
 /*----------------------------------------------------------------*/
 
 /*** The reporter vtable needed by do_update() and friends ***/
@@ -451,6 +482,12 @@ svn_ra_local__open(svn_ra_session_t *ses
 {
   svn_ra_local__session_baton_t *sess;
   const char *fs_path;
+  static volatile svn_atomic_t cache_init_state = 0;
+
+  /* Initialise the FSFS memory cache size.  We can only do this once
+     so one CONFIG will win the race and all others will be ignored
+     silently.  */
+  SVN_ERR(svn_atomic__init_once(&cache_init_state, cache_init, config, pool));
 
   /* We don't support redirections in ra-local. */
   if (corrected_url)

Modified: subversion/branches/1.7.x/subversion/libsvn_subr/config_file.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/libsvn_subr/config_file.c?rev=1173542&r1=1173541&r2=1173542&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/libsvn_subr/config_file.c (original)
+++ subversion/branches/1.7.x/subversion/libsvn_subr/config_file.c Wed Sep 21 09:34:33 2011
@@ -1070,6 +1070,11 @@ svn_config_ensure(const char *config_dir
         "### Set interactive-conflicts to 'no' to disable interactive"       NL
         "### conflict resolution prompting.  It defaults to 'yes'."          NL
         "# interactive-conflicts = no"                                       NL
+        "### Set memory-cache-size to define the size of the memory cache"   NL
+        "### used by the client when accessing a FSFS repository via"        NL
+        "### ra_local (the file:// scheme). The value represents the number" NL
+        "### of MB used by the cache."                                       NL
+        "# memory-cache-size = 16"                                           NL
         ""                                                                   NL
         "### Section for configuring automatic properties."                  NL
         "[auto-props]"                                                       NL

Modified: subversion/branches/1.7.x/subversion/svn/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/svn/main.c?rev=1173542&r1=1173541&r2=1173542&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/svn/main.c (original)
+++ subversion/branches/1.7.x/subversion/svn/main.c Wed Sep 21 09:34:33 2011
@@ -53,7 +53,6 @@
 #include "svn_hash.h"
 #include "svn_version.h"
 #include "cl.h"
-#include "svn_cache_config.h"
 
 #include "private/svn_wc_private.h"
 #include "private/svn_cmdline_private.h"
@@ -1450,7 +1449,6 @@ main(int argc, const char *argv[])
   svn_error_t *err;
   apr_allocator_t *allocator;
   apr_pool_t *pool;
-  svn_cache_config_t settings;
   int opt_id;
   apr_getopt_t *os;
   svn_cl__opt_state_t opt_state = { 0, { 0 } };
@@ -1498,17 +1496,6 @@ main(int argc, const char *argv[])
     }
 #endif
 
-  /* Per default, disable large expensive FS caching on the client side.
-   * We can still chose a different size for that cache later in the
-   * startup phase, e.g. after reading config files. If that does not
-   * happen until the first FSFS repository get opened, low initialization
-   * overhead caches will be used for the most time-critical structures.
-   *
-   * This is only relevant for FSFS over ra_local. */
-  settings = *svn_cache_config_get();
-  settings.cache_size = 0x0;
-  svn_cache_config_set(&settings);
-
   /* Initialize the RA library. */
   err = svn_ra_initialize(pool);
   if (err)