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 2014/05/05 00:58:20 UTC

svn commit: r1592428 - /subversion/trunk/subversion/libsvn_fs_fs/cached_data.c

Author: stefan2
Date: Sun May  4 22:58:20 2014
New Revision: 1592428

URL: http://svn.apache.org/r1592428
Log:
Follow-up to 1547045:  A background pack operation could cause a
concurrent transaction build-up to fail with file-not-found.
(Found by reviewing all calls to index functions for their retry
behavior upon background pack operations).

* subversion/libsvn_fs_fs/cached_data.c
  (svn_fs_fs__check_rep): Fix the detection of background packs.

Modified:
    subversion/trunk/subversion/libsvn_fs_fs/cached_data.c

Modified: subversion/trunk/subversion/libsvn_fs_fs/cached_data.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/cached_data.c?rev=1592428&r1=1592427&r2=1592428&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/cached_data.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/cached_data.c Sun May  4 22:58:20 2014
@@ -905,29 +905,38 @@ svn_fs_fs__check_rep(representation_t *r
       svn_error_t *err;
       apr_off_t offset;
       svn_fs_fs__p2l_entry_t *entry;
-      svn_boolean_t is_packed;
 
       svn_fs_fs__revision_file_t rev_file;
       svn_fs_fs__init_revision_file(&rev_file, fs, rep->revision, pool);
+
+      /* This will auto-retry if there was a background pack. */
       SVN_ERR(svn_fs_fs__item_offset(&offset, fs, &rev_file, rep->revision,
                                      NULL, rep->item_index, pool));
 
-      is_packed = rev_file.is_packed;
+      /* This may fail if there is a background pack operation (can't auto-
+         retry because the item offset lookup has to be redone as well). */
       err = svn_fs_fs__p2l_entry_lookup(&entry, fs, &rev_file, rep->revision,
                                         offset, pool);
 
-      /* retry if the packing state has changed */
-      if (is_packed != rev_file.is_packed)
+      /* Retry if the packing state may have changed, i.e. if we got an
+         error while opening the index for a non-packed rev file. */
+      if (err && !rev_file.is_packed)
         {
-          svn_error_clear(err);
           SVN_ERR(svn_fs_fs__close_revision_file(&rev_file));
-          return svn_error_trace(svn_fs_fs__check_rep(rep, fs, hint, pool));
-        }
-      else
-        {
-          SVN_ERR(err);
+
+          /* Be sure to know the latest pack status of REP. */
+          SVN_ERR(svn_fs_fs__update_min_unpacked_rev(fs, pool));
+          if (svn_fs_fs__is_packed_rev(fs, rep->revision))
+            {
+              /* REP got actually packed. Retry (can happen at most once). */
+              svn_error_clear(err);
+              return svn_error_trace(svn_fs_fs__check_rep(rep, fs, hint,
+                                                          pool));
+            }
         }
 
+      SVN_ERR(err);
+
       if (   entry == NULL
           || entry->type < SVN_FS_FS__ITEM_TYPE_FILE_REP
           || entry->type > SVN_FS_FS__ITEM_TYPE_DIR_PROPS)