subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1589235 - in /subversion/trunk/subversion/libsvn_fs_fs: caching.c fs.h fs_fs.c hotcopy.c
Date Tue, 22 Apr 2014 18:19:52 GMT
Author: stefan2
Date: Tue Apr 22 18:19:52 2014
New Revision: 1589235

URL: http://svn.apache.org/r1589235
Log:
Parse and evaluate the FSFS config file once and store the individual
values in the private data struct.  We then no longer need to keep the
redundant svn_config_t instance around.

The only user of the config file is / was the cache configuration.
We move that bit to read_config() and extend fs_fs_data_t accordingly.

* subversion/libsvn_fs_fs/fs.h
  (fs_fs_data_t): Replace the CONFIG with the bits that we used to
                  read later from it but will now read immediately
                  with the rest of the settings.

* subversion/libsvn_fs_fs/fs_fs.c
  (read_config): Switch to two-pool paradigm to make FS->POOL available.
                 CONFIG is now a temporary and we need to fill more bits
                 in the FFD struct - code taken from caching.c:read_config.
  (svn_fs_fs__open,
   svn_fs_fs__create): Pass both, the FS->POOL as well as the temp POOL
                       to read_config.

* subversion/libsvn_fs_fs/caching.c
  (read_config): Remove the config struct access here.  Only process
                 settings passed to the FS struct here (no FSFS internals).
  (svn_fs_fs__initialize_caches): Get the info from the FFD struct now.

* subversion/libsvn_fs_fs/hotcopy.c
  (hotcopy_create_empty_dest): No CONFIG member to copy anymore.  The new
                               FFD members are not relevant for hotcopy.

Modified:
    subversion/trunk/subversion/libsvn_fs_fs/caching.c
    subversion/trunk/subversion/libsvn_fs_fs/fs.h
    subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
    subversion/trunk/subversion/libsvn_fs_fs/hotcopy.c

Modified: subversion/trunk/subversion/libsvn_fs_fs/caching.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/caching.c?rev=1589235&r1=1589234&r2=1589235&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/caching.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/caching.c Tue Apr 22 18:19:52 2014
@@ -66,32 +66,20 @@ normalize_key_part(const char *original,
   return normalized->data;
 }
 
-/* Return a memcache in *MEMCACHE_P for FS if it's configured to use
-   memcached, or NULL otherwise.  Also, sets *FAIL_STOP to a boolean
-   indicating whether cache errors should be returned to the caller or
-   just passed to the FS warning handler.
-
-   *CACHE_TXDELTAS, *CACHE_FULLTEXTS and *CACHE_REVPROPS flags will be set
+/* *CACHE_TXDELTAS, *CACHE_FULLTEXTS and *CACHE_REVPROPS flags will be set
    according to FS->CONFIG.  *CACHE_NAMESPACE receives the cache prefix
    to use.
 
    Use FS->pool for allocating the memcache and CACHE_NAMESPACE, and POOL
    for temporary allocations. */
 static svn_error_t *
-read_config(svn_memcache_t **memcache_p,
-            svn_boolean_t *fail_stop,
-            const char **cache_namespace,
+read_config(const char **cache_namespace,
             svn_boolean_t *cache_txdeltas,
             svn_boolean_t *cache_fulltexts,
             svn_boolean_t *cache_revprops,
             svn_fs_t *fs,
             apr_pool_t *pool)
 {
-  fs_fs_data_t *ffd = fs->fsap_data;
-
-  SVN_ERR(svn_cache__make_memcache_from_config(memcache_p, ffd->config,
-                                               fs->pool));
-
   /* No cache namespace by default.  I.e. all FS instances share the
    * cached data.  If you specify different namespaces, the data will
    * share / compete for the same cache memory but keys will not match
@@ -149,9 +137,7 @@ read_config(svn_memcache_t **memcache_p,
   else
     *cache_revprops = svn_named_atomic__is_efficient();
 
-  return svn_config_get_bool(ffd->config, fail_stop,
-                             CONFIG_SECTION_CACHES, CONFIG_OPTION_FAIL_STOP,
-                             FALSE);
+  return SVN_NO_ERROR;
 }
 
 
@@ -377,18 +363,15 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
                                    "/", normalize_key_part(fs->path, pool),
                                    ":",
                                    SVN_VA_NULL);
-  svn_memcache_t *memcache;
   svn_membuffer_t *membuffer;
-  svn_boolean_t no_handler;
+  svn_boolean_t no_handler = ffd->fail_stop;
   svn_boolean_t cache_txdeltas;
   svn_boolean_t cache_fulltexts;
   svn_boolean_t cache_revprops;
   const char *cache_namespace;
 
   /* Evaluating the cache configuration. */
-  SVN_ERR(read_config(&memcache,
-                      &no_handler,
-                      &cache_namespace,
+  SVN_ERR(read_config(&cache_namespace,
                       &cache_txdeltas,
                       &cache_fulltexts,
                       &cache_revprops,
@@ -535,7 +518,7 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
   if (cache_fulltexts)
     {
       SVN_ERR(create_cache(&(ffd->fulltext_cache),
-                           memcache,
+                           ffd->memcache,
                            membuffer,
                            0, 0, /* Do not use inprocess cache */
                            /* Values are svn_stringbuf_t */

Modified: subversion/trunk/subversion/libsvn_fs_fs/fs.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs.h?rev=1589235&r1=1589234&r2=1589235&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/fs.h (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/fs.h Tue Apr 22 18:19:52 2014
@@ -28,6 +28,7 @@
 #include <apr_network_io.h>
 #include <apr_md5.h>
 #include <apr_sha1.h>
+#include <apr_poll.h>
 
 #include "svn_fs.h"
 #include "svn_config.h"
@@ -315,13 +316,16 @@ typedef struct fs_fs_data_t
   /* The revision that was youngest, last time we checked. */
   svn_revnum_t youngest_rev_cache;
 
-  /* The fsfs.conf file, parsed.  Allocated in FS->pool. */
-  svn_config_t *config;
-
-  /* Caches of immutable data.  (Note that if these are created with
-     svn_cache__create_memcache, the data can be shared between
+  /* Caches of immutable data.  (Note that these may be shared between
      multiple svn_fs_t's for the same filesystem.) */
 
+  /* Access to the configured memcached instances.  May be NULL. */
+  svn_memcache_t *memcache;
+
+  /* If TRUE, don't ignore any cache-related errors.  If FALSE, errors from
+     e.g. memcached may be ignored as caching is an optional feature. */
+  svn_boolean_t fail_stop;
+
   /* A cache of revision root IDs, mapping from (svn_revnum_t *) to
      (svn_fs_id_t *).  (Not threadsafe.) */
   svn_cache__t *rev_root_id_cache;

Modified: subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c?rev=1589235&r1=1589234&r2=1589235&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Tue Apr 22 18:19:52 2014
@@ -628,20 +628,23 @@ svn_fs_fs__fs_supports_mergeinfo(svn_fs_
 }
 
 /* Read the configuration information of the file system at FS_PATH
- * and set the respective values in FFD.  Use POOL for allocations.
+ * and set the respective values in FFD.  Use pools as usual.
  */
 static svn_error_t *
 read_config(fs_fs_data_t *ffd,
             const char *fs_path,
-            apr_pool_t *pool)
+            apr_pool_t *result_pool,
+            apr_pool_t *scratch_pool)
 {
-  SVN_ERR(svn_config_read3(&ffd->config,
-                           svn_dirent_join(fs_path, PATH_CONFIG, pool),
-                           FALSE, FALSE, FALSE, pool));
+  svn_config_t *config;
+
+  SVN_ERR(svn_config_read3(&config,
+                           svn_dirent_join(fs_path, PATH_CONFIG, scratch_pool),
+                           FALSE, FALSE, FALSE, scratch_pool));
 
   /* Initialize ffd->rep_sharing_allowed. */
   if (ffd->format >= SVN_FS_FS__MIN_REP_SHARING_FORMAT)
-    SVN_ERR(svn_config_get_bool(ffd->config, &ffd->rep_sharing_allowed,
+    SVN_ERR(svn_config_get_bool(config, &ffd->rep_sharing_allowed,
                                 CONFIG_SECTION_REP_SHARING,
                                 CONFIG_OPTION_ENABLE_REP_SHARING, TRUE));
   else
@@ -652,24 +655,24 @@ read_config(fs_fs_data_t *ffd,
     {
       apr_int64_t compression_level;
 
-      SVN_ERR(svn_config_get_bool(ffd->config, &ffd->deltify_directories,
+      SVN_ERR(svn_config_get_bool(config, &ffd->deltify_directories,
                                   CONFIG_SECTION_DELTIFICATION,
                                   CONFIG_OPTION_ENABLE_DIR_DELTIFICATION,
                                   TRUE));
-      SVN_ERR(svn_config_get_bool(ffd->config, &ffd->deltify_properties,
+      SVN_ERR(svn_config_get_bool(config, &ffd->deltify_properties,
                                   CONFIG_SECTION_DELTIFICATION,
                                   CONFIG_OPTION_ENABLE_PROPS_DELTIFICATION,
                                   TRUE));
-      SVN_ERR(svn_config_get_int64(ffd->config, &ffd->max_deltification_walk,
+      SVN_ERR(svn_config_get_int64(config, &ffd->max_deltification_walk,
                                    CONFIG_SECTION_DELTIFICATION,
                                    CONFIG_OPTION_MAX_DELTIFICATION_WALK,
                                    SVN_FS_FS_MAX_DELTIFICATION_WALK));
-      SVN_ERR(svn_config_get_int64(ffd->config, &ffd->max_linear_deltification,
+      SVN_ERR(svn_config_get_int64(config, &ffd->max_linear_deltification,
                                    CONFIG_SECTION_DELTIFICATION,
                                    CONFIG_OPTION_MAX_LINEAR_DELTIFICATION,
                                    SVN_FS_FS_MAX_LINEAR_DELTIFICATION));
 
-      SVN_ERR(svn_config_get_int64(ffd->config, &compression_level,
+      SVN_ERR(svn_config_get_int64(config, &compression_level,
                                    CONFIG_SECTION_DELTIFICATION,
                                    CONFIG_OPTION_COMPRESSION_LEVEL,
                                    SVN_DELTA_COMPRESSION_LEVEL_DEFAULT));
@@ -689,11 +692,11 @@ read_config(fs_fs_data_t *ffd,
   /* Initialize revprop packing settings in ffd. */
   if (ffd->format >= SVN_FS_FS__MIN_PACKED_REVPROP_FORMAT)
     {
-      SVN_ERR(svn_config_get_bool(ffd->config, &ffd->compress_packed_revprops,
+      SVN_ERR(svn_config_get_bool(config, &ffd->compress_packed_revprops,
                                   CONFIG_SECTION_PACKED_REVPROPS,
                                   CONFIG_OPTION_COMPRESS_PACKED_REVPROPS,
                                   TRUE));
-      SVN_ERR(svn_config_get_int64(ffd->config, &ffd->revprop_pack_size,
+      SVN_ERR(svn_config_get_int64(config, &ffd->revprop_pack_size,
                                    CONFIG_SECTION_PACKED_REVPROPS,
                                    CONFIG_OPTION_REVPROP_PACK_SIZE,
                                    ffd->compress_packed_revprops
@@ -710,15 +713,15 @@ read_config(fs_fs_data_t *ffd,
 
   if (ffd->format >= SVN_FS_FS__MIN_LOG_ADDRESSING_FORMAT)
     {
-      SVN_ERR(svn_config_get_int64(ffd->config, &ffd->block_size,
+      SVN_ERR(svn_config_get_int64(config, &ffd->block_size,
                                    CONFIG_SECTION_IO,
                                    CONFIG_OPTION_BLOCK_SIZE,
                                    64));
-      SVN_ERR(svn_config_get_int64(ffd->config, &ffd->l2p_page_size,
+      SVN_ERR(svn_config_get_int64(config, &ffd->l2p_page_size,
                                    CONFIG_SECTION_IO,
                                    CONFIG_OPTION_L2P_PAGE_SIZE,
                                    0x2000));
-      SVN_ERR(svn_config_get_int64(ffd->config, &ffd->p2l_page_size,
+      SVN_ERR(svn_config_get_int64(config, &ffd->p2l_page_size,
                                    CONFIG_SECTION_IO,
                                    CONFIG_OPTION_P2L_PAGE_SIZE,
                                    0x400));
@@ -736,7 +739,7 @@ read_config(fs_fs_data_t *ffd,
 
   if (ffd->format >= SVN_FS_FS__MIN_PACKED_FORMAT)
     {
-      SVN_ERR(svn_config_get_bool(ffd->config, &ffd->pack_after_commit,
+      SVN_ERR(svn_config_get_bool(config, &ffd->pack_after_commit,
                                   CONFIG_SECTION_DEBUG,
                                   CONFIG_OPTION_PACK_AFTER_COMMIT,
                                   FALSE));
@@ -746,6 +749,14 @@ read_config(fs_fs_data_t *ffd,
       ffd->pack_after_commit = FALSE;
     }
 
+  /* memcached configuration */
+  SVN_ERR(svn_cache__make_memcache_from_config(&ffd->memcache, config,
+                                               result_pool));
+
+  SVN_ERR(svn_config_get_bool(config, &ffd->fail_stop,
+                              CONFIG_SECTION_CACHES, CONFIG_OPTION_FAIL_STOP,
+                              FALSE));
+
   return SVN_NO_ERROR;
 }
 
@@ -991,7 +1002,7 @@ svn_fs_fs__open(svn_fs_t *fs, const char
     SVN_ERR(svn_fs_fs__update_min_unpacked_rev(fs, pool));
 
   /* Read the configuration file. */
-  SVN_ERR(read_config(ffd, fs->path, fs->pool));
+  SVN_ERR(read_config(ffd, fs->path, fs->pool, pool));
 
   return get_youngest(&(ffd->youngest_rev_cache), path, pool);
 }
@@ -1574,7 +1585,7 @@ svn_fs_fs__create(svn_fs_t *fs,
   if (ffd->format >= SVN_FS_FS__MIN_CONFIG_FILE)
     SVN_ERR(write_config(fs, pool));
 
-  SVN_ERR(read_config(ffd, fs->path, pool));
+  SVN_ERR(read_config(ffd, fs->path, fs->pool, pool));
 
   /* Create the min unpacked rev file. */
   if (ffd->format >= SVN_FS_FS__MIN_PACKED_FORMAT)

Modified: subversion/trunk/subversion/libsvn_fs_fs/hotcopy.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/hotcopy.c?rev=1589235&r1=1589234&r2=1589235&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/hotcopy.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/hotcopy.c Tue Apr 22 18:19:52 2014
@@ -978,7 +978,6 @@ hotcopy_create_empty_dest(svn_fs_t *src_
 
   dst_ffd->max_files_per_dir = src_ffd->max_files_per_dir;
   dst_ffd->min_log_addressing_rev = src_ffd->min_log_addressing_rev;
-  dst_ffd->config = src_ffd->config;
   dst_ffd->format = src_ffd->format;
 
   /* Create the revision data directories. */



Mime
View raw message