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 2013/06/14 14:02:03 UTC

svn commit: r1493048 - in /subversion/branches/fsfs-format7/subversion/libsvn_fs_fs: cached_data.c caching.c fs.h

Author: stefan2
Date: Fri Jun 14 12:02:02 2013
New Revision: 1493048

URL: http://svn.apache.org/r1493048
Log:
On the fsfs-format7 branch: make containered representations work across
packing boundaries.

During the pack proccess, a given representation / representation head
may be cached in the non-packed format while the on-disk data or some
other container calls for the packed format.  That is, we must make the
packing info part of the represenation header cache key.

* subversion/libsvn_fs_fs/fs.h
  (struct representation_cache_key_t): new cache key type

* subversion/libsvn_fs_fs/caching.c
  (svn_fs_fs__initialize_caches): update

* subversion/libsvn_fs_fs/cached_data.c
  (create_rep_state_body,
   cache_windows,
   read_rep_header,
   svn_fs_fs__get_representation_length,
   block_read_contents): use the new key type

Modified:
    subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/cached_data.c
    subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/caching.c
    subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/fs.h

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/cached_data.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/cached_data.c?rev=1493048&r1=1493047&r2=1493048&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/cached_data.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/cached_data.c Fri Jun 14 12:02:02 2013
@@ -671,9 +671,10 @@ create_rep_state_body(rep_state_t **rep_
       && (   ((*shared_file)->revision / ffd->max_files_per_dir)
           == (rep->revision / ffd->max_files_per_dir));
       
-  pair_cache_key_t key;
+  representation_cache_key_t key;
   key.revision = rep->revision;
-  key.second = rep->item_index;
+  key.is_packed = rep->revision < ffd->min_unpacked_rev;
+  key.item_index = rep->item_index;
 
   /* continue constructing RS and RA */
   rs->size = rep->size;
@@ -1730,6 +1731,9 @@ cache_windows(svn_filesize_t *fulltext_l
           SVN_ERR(svn_txdelta_read_svndiff_window(&window, rs->file->stream,
                                                   rs->ver, pool));
 
+          /* aggregate expanded window size */
+          *fulltext_len += window->tview_len;
+          
           /* determine on-disk window size */
           SVN_ERR(get_file_offset(&end_offset, rs->file->file, pool));
           rs->current = end_offset - rs->start;
@@ -1759,7 +1763,7 @@ 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,
+                representation_cache_key_t *key,
                 apr_pool_t *pool)
 {
   fs_fs_data_t *ffd = fs->fsap_data;
@@ -1790,7 +1794,7 @@ svn_fs_fs__get_representation_length(svn
                                      svn_fs_fs__p2l_entry_t* entry,
                                      apr_pool_t *pool)
 {
-  pair_cache_key_t key = { 0 };
+  representation_cache_key_t key = { 0 };
   rep_state_t rs = { 0 };
   svn_fs_fs__rep_header_t *rep_header;
   
@@ -1801,7 +1805,8 @@ svn_fs_fs__get_representation_length(svn
 
   /* get / read the representation header */  
   key.revision = entry->items[0].revision;
-  key.second = entry->items[0].number;
+  key.is_packed = is_packed_rev(fs, key.revision);
+  key.item_index = entry->items[0].number;
   SVN_ERR(read_rep_header(&rep_header, fs, stream, &key, pool));
 
   /* prepare representation reader state (rs) structure */
@@ -2621,8 +2626,14 @@ block_read_contents(svn_stringbuf_t **it
                     pair_cache_key_t *key,
                     apr_pool_t *pool)
 {
+  representation_cache_key_t header_key = { 0 };
   svn_fs_fs__rep_header_t *rep_header;
-  SVN_ERR(read_rep_header(&rep_header, fs, stream, key, pool));
+
+  header_key.revision = (apr_int32_t)key->revision;
+  header_key.is_packed = is_packed_rev(fs, header_key.revision);
+  header_key.item_index = key->second;
+
+  SVN_ERR(read_rep_header(&rep_header, fs, stream, &header_key, pool));
   SVN_ERR(block_read_windows(rep_header, fs, file, stream, entry, pool));
 
   return SVN_NO_ERROR;

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/caching.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/caching.c?rev=1493048&r1=1493047&r2=1493048&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/caching.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/caching.c Fri Jun 14 12:02:02 2013
@@ -513,7 +513,7 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
                        0, 0, /* Do not use inprocess cache */
                        svn_fs_fs__serialize_rep_header,
                        svn_fs_fs__deserialize_rep_header,
-                       sizeof(pair_cache_key_t),
+                       sizeof(representation_cache_key_t),
                        apr_pstrcat(pool, prefix, "REPHEADER", (char *)NULL),
                        SVN_CACHE__MEMBUFFER_HIGH_PRIORITY,
                        fs,

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/fs.h?rev=1493048&r1=1493047&r2=1493048&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/fs.h (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/fs.h Fri Jun 14 12:02:02 2013
@@ -243,6 +243,19 @@ typedef struct pair_cache_key_t
   apr_uint64_t second;
 } pair_cache_key_t;
 
+/* Key type that identifies a represenation / rep header. */
+typedef struct representation_cache_key_t
+{
+  /* Revision that contains the representation */
+  apr_uint32_t revision;
+
+  /* Packed or non-packed representation? */
+  svn_boolean_t is_packed;
+
+  /* Item index of the representation */
+  apr_uint64_t item_index;
+} representation_cache_key_t;
+
 /* Key type that identifies a txdelta window. */
 typedef struct window_cache_key_t
 {