subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1679924 - in /subversion/trunk/subversion/libsvn_fs_fs: temp_serializer.c temp_serializer.h transaction.c
Date Mon, 18 May 2015 03:50:57 GMT
Author: stefan2
Date: Mon May 18 03:50:57 2015
New Revision: 1679924

URL: http://svn.apache.org/r1679924
Log:
Continue work on the fs-test 44 issue in FSFS:
When updating the in-txn directory representation on disk, i.e. appending
to the file, update the filesize in the respective cache entry as well,
if such an entry exists.

* subversion/libsvn_fs_fs/temp_serializer.h
  (replace_baton_t): Add field to pass the new filesize to the cache
                     updater function.

* subversion/libsvn_fs_fs/temp_serializer.c
  (svn_fs_fs__replace_dir_entry): Update additional data field.

* subversion/libsvn_fs_fs/transaction.c
  (svn_fs_fs__set_entry): Provide the new file size to the updater.

Modified:
    subversion/trunk/subversion/libsvn_fs_fs/temp_serializer.c
    subversion/trunk/subversion/libsvn_fs_fs/temp_serializer.h
    subversion/trunk/subversion/libsvn_fs_fs/transaction.c

Modified: subversion/trunk/subversion/libsvn_fs_fs/temp_serializer.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/temp_serializer.c?rev=1679924&r1=1679923&r2=1679924&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/temp_serializer.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/temp_serializer.c Mon May 18 03:50:57 2015
@@ -985,6 +985,12 @@ svn_fs_fs__replace_dir_entry(void **data
 
   svn_temp_serializer__context_t *context;
 
+  /* update the cached file length info.
+   * Because we are writing to the cache, it is fair to assume that the
+   * caller made sure that the current contents is consistent with the
+   * previous state of the directory file. */
+  dir_data->txn_filesize = replace_baton->txn_filesize;
+
   /* after quite a number of operations, let's re-pack everything.
    * This is to limit the number of wasted space as we cannot overwrite
    * existing data but must always append. */

Modified: subversion/trunk/subversion/libsvn_fs_fs/temp_serializer.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/temp_serializer.h?rev=1679924&r1=1679923&r2=1679924&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/temp_serializer.h (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/temp_serializer.h Mon May 18 03:50:57 2015
@@ -248,7 +248,10 @@ svn_fs_fs__extract_dir_entry(void **out,
  * Describes the change to be done to a directory: Set the entry
  * identify by @a name to the value @a new_entry. If the latter is
  * @c NULL, the entry shall be removed if it exists. Otherwise it
- * will be replaced or automatically added, respectively.
+ * will be replaced or automatically added, respectively.  The
+ * @a filesize allows readers to identify stale cache data (e.g.
+ * due to concurrent access to txns); writers use it to update the
+ * cached file size info.
  */
 typedef struct replace_baton_t
 {
@@ -257,6 +260,10 @@ typedef struct replace_baton_t
 
   /** directory entry to insert instead */
   svn_fs_dirent_t *new_entry;
+
+  /** Current length of the in-txn in-disk representation of the directory.
+   * SVN_INVALID_FILESIZE if unknown. */
+  svn_filesize_t txn_filesize;
 } replace_baton_t;
 
 /**

Modified: subversion/trunk/subversion/libsvn_fs_fs/transaction.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/transaction.c?rev=1679924&r1=1679923&r2=1679924&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/transaction.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/transaction.c Mon May 18 03:50:57 2015
@@ -1586,13 +1586,18 @@ svn_fs_fs__set_entry(svn_fs_t *fs,
   /* if we have a directory cache for this transaction, update it */
   if (ffd->txn_dir_cache)
     {
-      /* build parameters: (name, new entry) pair */
+      /* build parameters: name, new entry, new file size  */
       const char *key =
           svn_fs_fs__id_unparse(parent_noderev->id, subpool)->data;
       replace_baton_t baton;
 
+      const svn_io_dirent2_t *dirent;
+      SVN_ERR(svn_io_stat_dirent2(&dirent, filename, FALSE, FALSE,
+                                  subpool, subpool));
+
       baton.name = name;
       baton.new_entry = NULL;
+      baton.txn_filesize = dirent->filesize;
 
       if (id)
         {



Mime
View raw message