subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1671330 - in /subversion/branches/fsx-1.10/subversion/libsvn_fs_x: caching.c fs.h temp_serializer.c temp_serializer.h tree.c
Date Sat, 04 Apr 2015 20:57:38 GMT
Author: stefan2
Date: Sat Apr  4 20:57:38 2015
New Revision: 1671330

URL: http://svn.apache.org/r1671330
Log:
On the fsx-1.10 branch:
Remove the meminfo caches in FSX as they have become mostly ineffective.
The property caches are still there, of course.

* subversion/libsvn_fs_x/fs.h
  (svn_fs_x__data_t): Remove cache instances.

* subversion/libsvn_fs_x/caching.c
  (svn_fs_x__initialize_caches): 2 caches less to initialize.

* subversion/libsvn_fs_x/temp_serializer.h
  (svn_fs_x__serialize_mergeinfo,
   svn_fs_x__deserialize_mergeinfo): Remove now unused (de-)serializers.

* subversion/libsvn_fs_x/temp_serializer.c
  (mergeinfo_data_t,
   svn_fs_x__serialize_mergeinfo,
   svn_fs_x__deserialize_mergeinfo): Same.

* subversion/libsvn_fs_x/tree.c
  (mergeinfo_cache_key): Obsolete.
  (get_mergeinfo_for_path_internal): Rename back to ...
  (get_mergeinfo_for_path): ... this and drop the caching wrapper.
                            Ensure proper initialization of the result.

Modified:
    subversion/branches/fsx-1.10/subversion/libsvn_fs_x/caching.c
    subversion/branches/fsx-1.10/subversion/libsvn_fs_x/fs.h
    subversion/branches/fsx-1.10/subversion/libsvn_fs_x/temp_serializer.c
    subversion/branches/fsx-1.10/subversion/libsvn_fs_x/temp_serializer.h
    subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.c

Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/caching.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/caching.c?rev=1671330&r1=1671329&r2=1671330&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/caching.c (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/caching.c Sat Apr  4 20:57:38 2015
@@ -514,41 +514,11 @@ svn_fs_x__initialize_caches(svn_fs_t *fs
                            fs,
                            no_handler,
                            fs->pool, scratch_pool));
-
-      SVN_ERR(create_cache(&(ffd->mergeinfo_cache),
-                           NULL,
-                           membuffer,
-                           0, 0, /* Do not use inprocess cache */
-                           svn_fs_x__serialize_mergeinfo,
-                           svn_fs_x__deserialize_mergeinfo,
-                           APR_HASH_KEY_STRING,
-                           apr_pstrcat(scratch_pool, prefix, "MERGEINFO",
-                                       SVN_VA_NULL),
-                           0,
-                           fs,
-                           no_handler,
-                           fs->pool, scratch_pool));
-
-      SVN_ERR(create_cache(&(ffd->mergeinfo_existence_cache),
-                           NULL,
-                           membuffer,
-                           0, 0, /* Do not use inprocess cache */
-                           /* Values are svn_stringbuf_t */
-                           NULL, NULL,
-                           APR_HASH_KEY_STRING,
-                           apr_pstrcat(scratch_pool, prefix, "HAS_MERGEINFO",
-                                       SVN_VA_NULL),
-                           0,
-                           fs,
-                           no_handler,
-                           fs->pool, scratch_pool));
     }
   else
     {
       ffd->fulltext_cache = NULL;
       ffd->properties_cache = NULL;
-      ffd->mergeinfo_cache = NULL;
-      ffd->mergeinfo_existence_cache = NULL;
     }
 
   /* if enabled, cache revprops */

Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/fs.h?rev=1671330&r1=1671329&r2=1671330&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/fs.h (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/fs.h Sat Apr  4 20:57:38 2015
@@ -345,15 +345,6 @@ typedef struct svn_fs_x__data_t
      (revision, item index) pair */
   svn_cache__t *rep_header_cache;
 
-  /* Cache for svn_mergeinfo_t objects; the key is a combination of
-     revision, inheritance flags and path. */
-  svn_cache__t *mergeinfo_cache;
-
-  /* Cache for presence of svn_mergeinfo_t on a noderev; the key is a
-     combination of revision, inheritance flags and path; value is "1"
-     if the node has mergeinfo, "0" if it doesn't. */
-  svn_cache__t *mergeinfo_existence_cache;
-
   /* Cache for l2p_header_t objects; the key is (revision, is-packed).
      Will be NULL for pre-format7 repos */
   svn_cache__t *l2p_header_cache;

Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/temp_serializer.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/temp_serializer.c?rev=1671330&r1=1671329&r2=1671330&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/temp_serializer.c (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/temp_serializer.c Sat Apr  4 20:57:38
2015
@@ -1188,148 +1188,3 @@ svn_fs_x__deserialize_changes(void **out
   return SVN_NO_ERROR;
 }
 
-/* Auxiliary structure representing the content of a svn_mergeinfo_t hash.
-   This structure is much easier to (de-)serialize than an APR array.
- */
-typedef struct mergeinfo_data_t
-{
-  /* number of paths in the hash */
-  unsigned count;
-
-  /* COUNT keys (paths) */
-  const char **keys;
-
-  /* COUNT keys lengths (strlen of path) */
-  apr_ssize_t *key_lengths;
-
-  /* COUNT entries, each giving the number of ranges for the key */
-  int *range_counts;
-
-  /* all ranges in a single, concatenated buffer */
-  svn_merge_range_t *ranges;
-} mergeinfo_data_t;
-
-svn_error_t *
-svn_fs_x__serialize_mergeinfo(void **data,
-                              apr_size_t *data_len,
-                              void *in,
-                              apr_pool_t *pool)
-{
-  svn_mergeinfo_t mergeinfo = in;
-  mergeinfo_data_t merges;
-  svn_temp_serializer__context_t *context;
-  svn_stringbuf_t *serialized;
-  apr_hash_index_t *hi;
-  unsigned i;
-  int k;
-  apr_size_t range_count;
-
-  /* initialize our auxiliary data structure */
-  merges.count = apr_hash_count(mergeinfo);
-  merges.keys = apr_palloc(pool, sizeof(*merges.keys) * merges.count);
-  merges.key_lengths = apr_palloc(pool, sizeof(*merges.key_lengths) *
-                                        merges.count);
-  merges.range_counts = apr_palloc(pool, sizeof(*merges.range_counts) *
-                                         merges.count);
-
-  i = 0;
-  range_count = 0;
-  for (hi = apr_hash_first(pool, mergeinfo); hi; hi = apr_hash_next(hi), ++i)
-    {
-      svn_rangelist_t *ranges;
-      apr_hash_this(hi, (const void**)&merges.keys[i],
-                        &merges.key_lengths[i],
-                        (void **)&ranges);
-      merges.range_counts[i] = ranges->nelts;
-      range_count += ranges->nelts;
-    }
-
-  merges.ranges = apr_palloc(pool, sizeof(*merges.ranges) * range_count);
-
-  i = 0;
-  for (hi = apr_hash_first(pool, mergeinfo); hi; hi = apr_hash_next(hi))
-    {
-      svn_rangelist_t *ranges = apr_hash_this_val(hi);
-      for (k = 0; k < ranges->nelts; ++k, ++i)
-        merges.ranges[i] = *APR_ARRAY_IDX(ranges, k, svn_merge_range_t*);
-    }
-
-  /* serialize it and all its elements */
-  context = svn_temp_serializer__init(&merges,
-                                      sizeof(merges),
-                                      range_count * 30,
-                                      pool);
-
-  /* keys array */
-  svn_temp_serializer__push(context,
-                            (const void * const *)&merges.keys,
-                            merges.count * sizeof(*merges.keys));
-
-  for (i = 0; i < merges.count; ++i)
-    svn_temp_serializer__add_string(context, &merges.keys[i]);
-
-  svn_temp_serializer__pop(context);
-
-  /* key lengths array */
-  svn_temp_serializer__add_leaf(context,
-                                (const void * const *)&merges.key_lengths,
-                                merges.count * sizeof(*merges.key_lengths));
-
-  /* range counts array */
-  svn_temp_serializer__add_leaf(context,
-                                (const void * const *)&merges.range_counts,
-                                merges.count * sizeof(*merges.range_counts));
-
-  /* ranges */
-  svn_temp_serializer__add_leaf(context,
-                                (const void * const *)&merges.ranges,
-                                range_count * sizeof(*merges.ranges));
-
-  /* return the serialized result */
-  serialized = svn_temp_serializer__get(context);
-
-  *data = serialized->data;
-  *data_len = serialized->len;
-
-  return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_fs_x__deserialize_mergeinfo(void **out,
-                                void *data,
-                                apr_size_t data_len,
-                                apr_pool_t *result_pool)
-{
-  unsigned i;
-  int k, n;
-  mergeinfo_data_t *merges = (mergeinfo_data_t *)data;
-  svn_mergeinfo_t mergeinfo;
-
-  /* de-serialize our auxiliary data structure */
-  svn_temp_deserializer__resolve(merges, (void**)&merges->keys);
-  svn_temp_deserializer__resolve(merges, (void**)&merges->key_lengths);
-  svn_temp_deserializer__resolve(merges, (void**)&merges->range_counts);
-  svn_temp_deserializer__resolve(merges, (void**)&merges->ranges);
-
-  /* de-serialize keys and add entries to the result */
-  n = 0;
-  mergeinfo = svn_hash__make(result_pool);
-  for (i = 0; i < merges->count; ++i)
-    {
-      svn_rangelist_t *ranges = apr_array_make(result_pool,
-                                               merges->range_counts[i],
-                                               sizeof(svn_merge_range_t*));
-      for (k = 0; k < merges->range_counts[i]; ++k, ++n)
-        APR_ARRAY_PUSH(ranges, svn_merge_range_t*) = &merges->ranges[n];
-
-      svn_temp_deserializer__resolve(merges->keys,
-                                     (void**)&merges->keys[i]);
-      apr_hash_set(mergeinfo, merges->keys[i], merges->key_lengths[i], ranges);
-    }
-
-  /* done */
-  *out = mergeinfo;
-
-  return SVN_NO_ERROR;
-}
-

Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/temp_serializer.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/temp_serializer.h?rev=1671330&r1=1671329&r2=1671330&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/temp_serializer.h (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/temp_serializer.h Sat Apr  4 20:57:38
2015
@@ -264,22 +264,4 @@ svn_fs_x__deserialize_changes(void **out
                               apr_size_t data_len,
                               apr_pool_t *result_pool);
 
-/**
- * Implements #svn_cache__serialize_func_t for #svn_mergeinfo_t objects.
- */
-svn_error_t *
-svn_fs_x__serialize_mergeinfo(void **data,
-                              apr_size_t *data_len,
-                              void *in,
-                              apr_pool_t *pool);
-
-/**
- * Implements #svn_cache__deserialize_func_t for #svn_mergeinfo_t objects.
- */
-svn_error_t *
-svn_fs_x__deserialize_mergeinfo(void **out,
-                                void *data,
-                                apr_size_t data_len,
-                                apr_pool_t *result_pool);
-
 #endif

Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.c?rev=1671330&r1=1671329&r2=1671330&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.c (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.c Sat Apr  4 20:57:38 2015
@@ -2871,43 +2871,25 @@ crawl_directory_dag_for_mergeinfo(svn_fs
   return SVN_NO_ERROR;
 }
 
-/* Return the cache key as a combination of REV_ROOT->REV, the inheritance
-   flags INHERIT and ADJUST_INHERITED_MERGEINFO, and the PATH.  The result
-   will be allocated in RESULT_POOL.
- */
-static const char *
-mergeinfo_cache_key(const char *path,
-                    svn_fs_root_t *rev_root,
-                    svn_mergeinfo_inheritance_t inherit,
-                    svn_boolean_t adjust_inherited_mergeinfo,
-                    apr_pool_t *result_pool)
-{
-  apr_int64_t number = rev_root->rev;
-  number = number * 4
-         + (inherit == svn_mergeinfo_nearest_ancestor ? 2 : 0)
-         + (adjust_inherited_mergeinfo ? 1 : 0);
-
-  return svn_fs_x__combine_number_and_string(number, path, result_pool);
-}
-
 /* Calculates the mergeinfo for PATH under REV_ROOT using inheritance
    type INHERIT.  Returns it in *MERGEINFO, or NULL if there is none.
    The result is allocated in RESULT_POOL; SCRATCH_POOL is
    used for temporary allocations.
  */
 static svn_error_t *
-get_mergeinfo_for_path_internal(svn_mergeinfo_t *mergeinfo,
-                                svn_fs_root_t *rev_root,
-                                const char *path,
-                                svn_mergeinfo_inheritance_t inherit,
-                                svn_boolean_t adjust_inherited_mergeinfo,
-                                apr_pool_t *result_pool,
-                                apr_pool_t *scratch_pool)
+get_mergeinfo_for_path(svn_mergeinfo_t *mergeinfo,
+                       svn_fs_root_t *rev_root,
+                       const char *path,
+                       svn_mergeinfo_inheritance_t inherit,
+                       svn_boolean_t adjust_inherited_mergeinfo,
+                       apr_pool_t *result_pool,
+                       apr_pool_t *scratch_pool)
 {
   svn_fs_x__dag_path_t *dag_path, *nearest_ancestor;
   apr_hash_t *proplist;
   svn_string_t *mergeinfo_string;
 
+  *mergeinfo = NULL;
   SVN_ERR(svn_fs_x__get_dag_path(&dag_path, rev_root, path, 0, FALSE,
                                  scratch_pool, scratch_pool));
 
@@ -2988,58 +2970,6 @@ get_mergeinfo_for_path_internal(svn_merg
     }
 
   return SVN_NO_ERROR;
-}
-
-/* Caching wrapper around get_mergeinfo_for_path_internal().
- */
-static svn_error_t *
-get_mergeinfo_for_path(svn_mergeinfo_t *mergeinfo,
-                       svn_fs_root_t *rev_root,
-                       const char *path,
-                       svn_mergeinfo_inheritance_t inherit,
-                       svn_boolean_t adjust_inherited_mergeinfo,
-                       apr_pool_t *result_pool,
-                       apr_pool_t *scratch_pool)
-{
-  svn_fs_x__data_t *ffd = rev_root->fs->fsap_data;
-  const char *cache_key;
-  svn_boolean_t found = FALSE;
-  svn_stringbuf_t *mergeinfo_exists;
-
-  *mergeinfo = NULL;
-
-  cache_key = mergeinfo_cache_key(path, rev_root, inherit,
-                                  adjust_inherited_mergeinfo, scratch_pool);
-  if (ffd->mergeinfo_existence_cache)
-    {
-      SVN_ERR(svn_cache__get((void **)&mergeinfo_exists, &found,
-                             ffd->mergeinfo_existence_cache,
-                             cache_key, result_pool));
-      if (found && mergeinfo_exists->data[0] == '1')
-        SVN_ERR(svn_cache__get((void **)mergeinfo, &found,
-                              ffd->mergeinfo_cache,
-                              cache_key, result_pool));
-    }
-
-  if (! found)
-    {
-      SVN_ERR(get_mergeinfo_for_path_internal(mergeinfo, rev_root, path,
-                                              inherit,
-                                              adjust_inherited_mergeinfo,
-                                              result_pool, scratch_pool));
-      if (ffd->mergeinfo_existence_cache)
-        {
-          mergeinfo_exists = svn_stringbuf_create(*mergeinfo ? "1" : "0",
-                                                  scratch_pool);
-          SVN_ERR(svn_cache__set(ffd->mergeinfo_existence_cache,
-                                 cache_key, mergeinfo_exists, scratch_pool));
-          if (*mergeinfo)
-            SVN_ERR(svn_cache__set(ffd->mergeinfo_cache,
-                                  cache_key, *mergeinfo, scratch_pool));
-        }
-    }
-
-  return SVN_NO_ERROR;
 }
 
 /* Adds mergeinfo for each descendant of PATH (but not PATH itself)



Mime
View raw message