subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i...@apache.org
Subject svn commit: r1604063 - in /subversion/branches/remove-log-addressing/subversion/libsvn_fs_fs: cached_data.c pack.c
Date Fri, 20 Jun 2014 00:57:42 GMT
Author: ivan
Date: Fri Jun 20 00:57:42 2014
New Revision: 1604063

URL: http://svn.apache.org/r1604063
Log:
On remove-log-addressing branch: Further cleanup now unused code.

* subversion/libsvn_fs_fs/cached_data.c
  (dbg_log_access): Remove unused local variable.
  (init_rep_state, block_read_windows, read_rep_header, block_read_contents,
   auto_select_stream, block_read_changes,  block_read_noderev): Remove 
   unused static functions.

* subversion/libsvn_fs_fs/pack.c
  (): Remove explanation how log addressing enabled repositories packing 
   works.
  (DEFAULT_MAX_MEM, path_order_t, reference_t): Remove.
  (pack_rev_shard): Remove unused argument MAX_MEM.
  (pack_shard): Update caller.

Modified:
    subversion/branches/remove-log-addressing/subversion/libsvn_fs_fs/cached_data.c
    subversion/branches/remove-log-addressing/subversion/libsvn_fs_fs/pack.c

Modified: subversion/branches/remove-log-addressing/subversion/libsvn_fs_fs/cached_data.c
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/libsvn_fs_fs/cached_data.c?rev=1604063&r1=1604062&r2=1604063&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/libsvn_fs_fs/cached_data.c (original)
+++ subversion/branches/remove-log-addressing/subversion/libsvn_fs_fs/cached_data.c Fri Jun
20 00:57:42 2014
@@ -70,7 +70,6 @@ dbg_log_access(svn_fs_t *fs,
 #ifdef SVN_FS_FS__LOG_ACCESS
   fs_fs_data_t *ffd = fs->fsap_data;
   apr_off_t end_offset = 0;
-  svn_fs_fs__p2l_entry_t *entry = NULL;
   static const char *types[] = {"<n/a>", "frep ", "drep ", "fprop", "dprop",
                                 "node ", "chgs ", "rep  "};
   const char *description = "";
@@ -2557,46 +2556,6 @@ svn_fs_fs__get_changes(apr_array_header_
   return SVN_NO_ERROR;
 }
 
-/* Inialize the representation read state RS for the given REP_HEADER and
- * p2l index ENTRY.  If not NULL, assign FILE and STREAM to RS.
- * Use POOL for allocations.
- */
-static svn_error_t *
-init_rep_state(rep_state_t *rs,
-               svn_fs_fs__rep_header_t *rep_header,
-               svn_fs_t *fs,
-               svn_fs_fs__revision_file_t *file,
-               svn_fs_fs__p2l_entry_t* entry,
-               apr_pool_t *pool)
-{
-  fs_fs_data_t *ffd = fs->fsap_data;
-  shared_file_t *shared_file = apr_pcalloc(pool, sizeof(*shared_file));
-
-  /* this function does not apply to representation containers */
-  SVN_ERR_ASSERT(entry->type >= SVN_FS_FS__ITEM_TYPE_FILE_REP
-                 && entry->type <= SVN_FS_FS__ITEM_TYPE_DIR_PROPS);
-  
-  shared_file->rfile = file;
-  shared_file->fs = fs;
-  shared_file->revision = entry->item.revision;
-  shared_file->pool = pool;
-
-  rs->sfile = shared_file;
-  rs->revision = entry->item.revision;
-  rs->item_index = entry->item.number;
-  rs->header_size = rep_header->header_size;
-  rs->start = entry->offset + rs->header_size;
-  rs->current = rep_header->type == svn_fs_fs__rep_plain ? 0 : 4;
-  rs->size = entry->size - rep_header->header_size - 7;
-  rs->ver = 1;
-  rs->chunk_index = 0;
-  rs->raw_window_cache = ffd->raw_window_cache;
-  rs->window_cache = ffd->txdelta_window_cache;
-  rs->combined_cache = ffd->combined_window_cache;
-
-  return SVN_NO_ERROR;
-}
-
 /* Implement svn_cache__partial_getter_func_t for txdelta windows.
  * Instead of the whole window data, return only END_OFFSET member.
  */
@@ -2723,252 +2682,3 @@ cache_windows(svn_fs_t *fs,
   svn_pool_destroy(iterpool);
   return SVN_NO_ERROR;
 }
-
-/* Read all txdelta / plain windows following REP_HEADER in FS as described
- * by ENTRY.  Read the data from the already open FILE and the wrapping
- * STREAM object.  If MAX_OFFSET is not -1, don't read windows that start
- * at or beyond that offset.  Use POOL for allocations.
- * If caching is not enabled, this is a no-op.
- */
-static svn_error_t *
-block_read_windows(svn_fs_fs__rep_header_t *rep_header,
-                   svn_fs_t *fs,
-                   svn_fs_fs__revision_file_t *rev_file,
-                   svn_fs_fs__p2l_entry_t* entry,
-                   apr_off_t max_offset,
-                   apr_pool_t *pool)
-{
-  fs_fs_data_t *ffd = fs->fsap_data;
-  rep_state_t rs = { 0 };
-  apr_off_t offset;
-  window_cache_key_t key = { 0 };
-
-  if (   (rep_header->type != svn_fs_fs__rep_plain
-          && (!ffd->txdelta_window_cache || !ffd->raw_window_cache))
-      || (rep_header->type == svn_fs_fs__rep_plain
-          && !ffd->combined_window_cache))
-    return SVN_NO_ERROR;
-
-  SVN_ERR(init_rep_state(&rs, rep_header, fs, rev_file, entry, pool));
-  
-  /* RS->FILE may be shared between RS instances -> make sure we point
-   * to the right data. */
-  offset = rs.start + rs.current;
-  if (rep_header->type == svn_fs_fs__rep_plain)
-    {
-      svn_stringbuf_t *plaintext;
-      svn_boolean_t is_cached;
-
-      /* already in cache? */
-      SVN_ERR(svn_cache__has_key(&is_cached, rs.combined_cache,
-                                 get_window_key(&key, &rs), pool));
-      if (is_cached)
-        return SVN_NO_ERROR;
-
-      /* for larger reps, the header may have crossed a block boundary.
-       * make sure we still read blocks properly aligned, i.e. don't use
-       * plain seek here. */
-      SVN_ERR(aligned_seek(fs, rev_file->file, NULL, offset, pool));
-
-      plaintext = svn_stringbuf_create_ensure(rs.size, pool);
-      SVN_ERR(svn_io_file_read_full2(rev_file->file, plaintext->data,
-                                     rs.size, &plaintext->len, NULL, pool));
-      plaintext->data[plaintext->len] = 0;
-      rs.current += rs.size;
-
-      SVN_ERR(set_cached_combined_window(plaintext, &rs, pool));
-    }
-  else
-    {
-      SVN_ERR(cache_windows(fs, &rs, max_offset, pool));
-    }
-
-  return SVN_NO_ERROR;
-}
-
-/* Try to get the representation header identified by KEY from FS's cache.
- * If it has not been cached, read it from the current position in STREAM
- * and put it into the cache (if caching has been enabled for rep headers).
- * Return the result in *REP_HEADER.  Use POOL for allocations.
- */
-static svn_error_t *
-read_rep_header(svn_fs_fs__rep_header_t **rep_header,
-                svn_fs_t *fs,
-                svn_stream_t *stream,
-                pair_cache_key_t *key,
-                apr_pool_t *pool)
-{
-  fs_fs_data_t *ffd = fs->fsap_data;
-  svn_boolean_t is_cached = FALSE;
-  
-  if (ffd->rep_header_cache)
-    {
-      SVN_ERR(svn_cache__get((void**)rep_header, &is_cached,
-                             ffd->rep_header_cache, key, pool));
-      if (is_cached)
-        return SVN_NO_ERROR;
-    }
-
-  SVN_ERR(svn_fs_fs__read_rep_header(rep_header, stream, pool));
-
-  if (ffd->rep_header_cache)
-    SVN_ERR(svn_cache__set(ffd->rep_header_cache, key, *rep_header, pool));
-
-  return SVN_NO_ERROR;
-}
-
-/* Fetch the representation data (header, txdelta / plain windows)
- * addressed by ENTRY->ITEM in FS and cache it if caches are enabled.
- * Read the data from the already open FILE and the wrapping
- * STREAM object.  If MAX_OFFSET is not -1, don't read windows that start
- * at or beyond that offset.  Use POOL for allocations.
- */
-static svn_error_t *
-block_read_contents(svn_fs_t *fs,
-                    svn_fs_fs__revision_file_t *rev_file,
-                    svn_fs_fs__p2l_entry_t* entry,
-                    apr_off_t max_offset,
-                    apr_pool_t *pool)
-{
-  pair_cache_key_t header_key = { 0 };
-  svn_fs_fs__rep_header_t *rep_header;
-
-  header_key.revision = (apr_int32_t)entry->item.revision;
-  header_key.second = entry->item.number;
-
-  SVN_ERR(read_rep_header(&rep_header, fs, rev_file->stream, &header_key,
-                          pool));
-  SVN_ERR(block_read_windows(rep_header, fs, rev_file, entry, max_offset,
-                             pool));
-
-  return SVN_NO_ERROR;
-}
-
-/* For the given FILE in FS and wrapping FILE_STREAM return the stream
- * object in *STREAM that has the lowest performance overhead for reading
- * and parsing the item addressed by ENTRY.  Use POOL for allocations.
- */
-static svn_error_t *
-auto_select_stream(svn_stream_t **stream,
-                   svn_fs_t *fs,
-                   svn_fs_fs__revision_file_t *rev_file,
-                   svn_fs_fs__p2l_entry_t* entry,
-                   apr_pool_t *pool)
-{
-  fs_fs_data_t *ffd = fs->fsap_data;
-
-  /* Item parser might be crossing block boundaries? */
-  if (((entry->offset + entry->size + SVN__LINE_CHUNK_SIZE) ^ entry->offset)
-      >= ffd->block_size)
-    {
-      /* Parsing items that cross block boundaries will cause the file
-         buffer to be re-read and misaligned.  So, read the whole block
-         into memory - it must fit anyways since the parsed object will
-         be even larger.
-       */
-      svn_stringbuf_t *text = svn_stringbuf_create_ensure(entry->size, pool);
-      text->len = entry->size;
-      text->data[text->len] = 0;
-      SVN_ERR(svn_io_file_read_full2(rev_file->file, text->data, text->len,
-                                     NULL, NULL, pool));
-      *stream = svn_stream_from_stringbuf(text, pool);
-    }
-  else
-    {
-      *stream = rev_file->stream;
-    }
-
-  return SVN_NO_ERROR;
-}
-
-/* If not already cached or if MUST_READ is set, read the changed paths
- * list addressed by ENTRY in FS and retúrn it in *CHANGES.  Cache the
- * result if caching is enabled.  Read the data from the already open
- * FILE and wrapping FILE_STREAM.  Use POOL for allocations.
- */
-static svn_error_t *
-block_read_changes(apr_array_header_t **changes,
-                   svn_fs_t *fs,
-                   svn_fs_fs__revision_file_t *rev_file,
-                   svn_fs_fs__p2l_entry_t *entry,
-                   svn_boolean_t must_read,
-                   apr_pool_t *pool)
-{
-  fs_fs_data_t *ffd = fs->fsap_data;
-  svn_stream_t *stream;
-  if (!must_read && !ffd->changes_cache)
-    return SVN_NO_ERROR;
-
-  /* already in cache? */
-  if (!must_read && ffd->changes_cache)
-    {
-      svn_boolean_t is_cached;
-      SVN_ERR(svn_cache__has_key(&is_cached, ffd->changes_cache,
-                                 &entry->item.revision, pool));
-      if (is_cached)
-        return SVN_NO_ERROR;
-    }
-
-  SVN_ERR(auto_select_stream(&stream, fs, rev_file, entry, pool));
-
-  /* read changes from revision file */
-
-  SVN_ERR(svn_fs_fs__read_changes(changes, stream, pool));
-
-  /* cache for future reference */
-
-  if (ffd->changes_cache)
-    SVN_ERR(svn_cache__set(ffd->changes_cache, &entry->item.revision,
-                           *changes, pool));
-
-  return SVN_NO_ERROR;
-}
-
-/* If not already cached or if MUST_READ is set, read the nod revision
- * addressed by ENTRY in FS and retúrn it in *NODEREV_P.  Cache the
- * result if caching is enabled.  Read the data from the already open
- * FILE and wrapping FILE_STREAM.  Use POOL for allocations.
- */
-static svn_error_t *
-block_read_noderev(node_revision_t **noderev_p,
-                   svn_fs_t *fs,
-                   svn_fs_fs__revision_file_t *rev_file,
-                   svn_fs_fs__p2l_entry_t *entry,
-                   svn_boolean_t must_read,
-                   apr_pool_t *pool)
-{
-  fs_fs_data_t *ffd = fs->fsap_data;
-  svn_stream_t *stream;
-
-  pair_cache_key_t key = { 0 };
-  key.revision = entry->item.revision;
-  key.second = entry->item.number;
-
-  if (!must_read && !ffd->node_revision_cache)
-    return SVN_NO_ERROR;
-
-  /* already in cache? */
-  if (!must_read && ffd->node_revision_cache)
-    {
-      svn_boolean_t is_cached;
-      SVN_ERR(svn_cache__has_key(&is_cached, ffd->node_revision_cache,
-                                 &key, pool));
-      if (is_cached)
-        return SVN_NO_ERROR;
-    }
-
-  SVN_ERR(auto_select_stream(&stream, fs, rev_file, entry, pool));
-
-  /* read node rev from revision file */
-
-  SVN_ERR(svn_fs_fs__read_noderev(noderev_p, stream, pool));
-
-  /* Workaround issue #4031: is-fresh-txn-root in revision files. */
-  (*noderev_p)->is_fresh_txn_root = FALSE;
-
-  if (ffd->node_revision_cache)
-    SVN_ERR(svn_cache__set(ffd->node_revision_cache, &key, *noderev_p,
-                           pool));
-
-  return SVN_NO_ERROR;
-}

Modified: subversion/branches/remove-log-addressing/subversion/libsvn_fs_fs/pack.c
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/libsvn_fs_fs/pack.c?rev=1604063&r1=1604062&r2=1604063&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/libsvn_fs_fs/pack.c (original)
+++ subversion/branches/remove-log-addressing/subversion/libsvn_fs_fs/pack.c Fri Jun 20 00:57:42
2014
@@ -44,92 +44,6 @@
 #include "svn_private_config.h"
 #include "temp_serializer.h"
 
-/* Logical addressing packing logic:
- *
- * We pack files on a pack file basis (e.g. 1000 revs) without changing
- * existing pack files nor the revision files outside the range to pack.
- *
- * First, we will scan the revision file indexes to determine the number
- * of items to "place" (i.e. determine their optimal position within the
- * future pack file).  For each item, we will need a constant amount of
- * memory to track it.  A MAX_MEM parameter sets a limit to the number of
- * items we may place in one go.  That means, we may not be able to add
- * all revisions at once.  Instead, we will run the placement for a subset
- * of revisions at a time.  The very unlikely worst case will simply append
- * all revision data with just a little reshuffling inside each revision.
- *
- * In a second step, we read all revisions in the selected range, build
- * the item tracking information and copy the items themselves from the
- * revision files to temporary files.  The latter serve as buckets for a
- * very coarse bucket presort:  Separate change lists, file properties,
- * directory properties and noderevs + representations from one another.
- *
- * The third step will determine an optimized placement for the items in
- * each of the 4 buckets separately.  The first three will simply order
- * their items by revision, starting with the newest once.  Placing rep
- * and noderev items is a more elaborate process documented in the code.
- * 
- * In short, we store items in the following order:
- * - changed paths lists
- * - node property
- * - directory properties
- * - directory representations corresponding noderevs, lexical path order
- *   with special treatment of "trunk" and "branches"
- * - same for file representations
- *
- * Step 4 copies the items from the temporary buckets into the final
- * pack file and writes the temporary index files.
- *
- * Finally, after the last range of revisions, create the final indexes.
- */
-
-/* Maximum amount of memory we allocate for placement information during
- * the pack process.
- */
-#define DEFAULT_MAX_MEM (64 * 1024 * 1024)
-
-/* Data structure describing a node change at PATH, REVISION.
- * We will sort these instances by PATH and NODE_ID such that we can combine
- * similar nodes in the same reps container and store containers in path
- * major order.
- */
-typedef struct path_order_t
-{
-  /* changed path */
-  svn_prefix_string__t *path;
-
-  /* node ID for this PATH in REVISION */
-  svn_fs_fs__id_part_t node_id;
-
-  /* when this change happened */
-  svn_revnum_t revision;
-
-  /* noderev predecessor count */
-  int predecessor_count;
-
-  /* this is a directory node */
-  svn_boolean_t is_dir;
-
-  /* length of the expanded representation content */
-  apr_int64_t expanded_size;
-
-  /* item ID of the noderev linked to the change. May be (0, 0). */
-  svn_fs_fs__id_part_t noderev_id;
-
-  /* item ID of the representation containing the new data. May be (0, 0). */
-  svn_fs_fs__id_part_t rep_id;
-} path_order_t;
-
-/* Represents a reference from item FROM to item TO.  FROM may be a noderev
- * or rep_id while TO is (currently) always a representation.  We will sort
- * them by TO which allows us to collect all dependent items.
- */
-typedef struct reference_t
-{
-  svn_fs_fs__id_part_t to;
-  svn_fs_fs__id_part_t from;
-} reference_t;
-
 /* Directories entries sorted by revision (decreasing - to max cache hits)
  * and offset (increasing - to max benefit from APR file buffering).
  */
@@ -336,7 +250,6 @@ pack_rev_shard(svn_fs_t *fs,
                const char *shard_path,
                apr_int64_t shard,
                int max_files_per_dir,
-               apr_size_t max_mem,
                svn_cancel_func_t cancel_func,
                void *cancel_baton,
                apr_pool_t *pool)
@@ -496,7 +409,7 @@ pack_shard(struct pack_baton *baton,
   /* pack the revision content */
   SVN_ERR(pack_rev_shard(baton->fs, rev_pack_file_dir, baton->rev_shard_path,
                          baton->shard, ffd->max_files_per_dir,
-                         DEFAULT_MAX_MEM, baton->cancel_func,
+                         baton->cancel_func,
                          baton->cancel_baton, pool));
 
   /* For newer repo formats, we only acquired the pack lock so far.



Mime
View raw message