subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From svn-r...@apache.org
Subject svn commit: r1494850 - in /subversion/branches/1.8.x: ./ STATUS subversion/libsvn_fs_fs/fs_fs.c
Date Thu, 20 Jun 2013 04:00:37 GMT
Author: svn-role
Date: Thu Jun 20 04:00:36 2013
New Revision: 1494850

URL: http://svn.apache.org/r1494850
Log:
Merge the r1494298 group from trunk:

 * r1494298, r1494318
   Fix a FSFS data loss when aborting 'svnadmin upgrade' late in the process.
   Justification:
     This is a critical issue. People may actually abort the potentially long-
     running 'svnadmin upgrade'.  If they do that after the actual packing
     phase, they *will* lose data.
     r1494318 is a follow-up that fixes a copy'n'pasto.
   Notes:
     Depends on r1494287 which must be merged first.
   Votes:
     +1: stefan2, danielsh, ivan

Modified:
    subversion/branches/1.8.x/   (props changed)
    subversion/branches/1.8.x/STATUS
    subversion/branches/1.8.x/subversion/libsvn_fs_fs/fs_fs.c

Propchange: subversion/branches/1.8.x/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1494298,1494318

Modified: subversion/branches/1.8.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/STATUS?rev=1494850&r1=1494849&r2=1494850&view=diff
==============================================================================
--- subversion/branches/1.8.x/STATUS (original)
+++ subversion/branches/1.8.x/STATUS Thu Jun 20 04:00:36 2013
@@ -194,18 +194,6 @@ Veto-blocked changes:
 Approved changes:
 =================
 
- * r1494298, r1494318
-   Fix a FSFS data loss when aborting 'svnadmin upgrade' late in the process.
-   Justification:
-     This is a critical issue. People may actually abort the potentially long-
-     running 'svnadmin upgrade'.  If they do that after the actual packing
-     phase, they *will* lose data.
-     r1494318 is a follow-up that fixes a copy'n'pasto.
-   Notes:
-     Depends on r1494287 which must be merged first.
-   Votes:
-     +1: stefan2, danielsh, ivan
-
  * r1494223
    Forbid 'svnadmin create --fs-type=fsfs --compatible-version=1.0'.
    Justification:

Modified: subversion/branches/1.8.x/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_fs_fs/fs_fs.c?rev=1494850&r1=1494849&r2=1494850&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/branches/1.8.x/subversion/libsvn_fs_fs/fs_fs.c Thu Jun 20 04:00:36 2013
@@ -1467,6 +1467,12 @@ delete_revprops_shard(const char *shard_
                       apr_pool_t *scratch_pool);
 
 /* In the filesystem FS, pack all revprop shards up to min_unpacked_rev.
+ * 
+ * NOTE: Keep the old non-packed shards around until after the format bump.
+ * Otherwise, re-running upgrade will drop the packed revprop shard but
+ * have no unpacked data anymore.  Call upgrade_cleanup_pack_revprops after
+ * the bump.
+ * 
  * Use SCRATCH_POOL for temporary allocations.
  */
 static svn_error_t *
@@ -1507,6 +1513,29 @@ upgrade_pack_revprops(svn_fs_t *fs,
       svn_pool_clear(iterpool);
     }
 
+  svn_pool_destroy(iterpool);
+
+  return SVN_NO_ERROR;
+}
+
+/* In the filesystem FS, remove all non-packed revprop shards up to
+ * min_unpacked_rev.  Use SCRATCH_POOL for temporary allocations.
+ * See upgrade_pack_revprops for more info.
+ */
+static svn_error_t *
+upgrade_cleanup_pack_revprops(svn_fs_t *fs,
+                              apr_pool_t *scratch_pool)
+{
+  fs_fs_data_t *ffd = fs->fsap_data;
+  const char *revprops_shard_path;
+  apr_int64_t shard;
+  apr_int64_t first_unpacked_shard
+    =  ffd->min_unpacked_rev / ffd->max_files_per_dir;
+
+  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
+  const char *revsprops_dir = svn_dirent_join(fs->path, PATH_REVPROPS_DIR,
+                                              scratch_pool);
+  
   /* delete the non-packed revprops shards afterwards */
   for (shard = 0; shard < first_unpacked_shard; ++shard)
     {
@@ -1531,6 +1560,7 @@ upgrade_body(void *baton, apr_pool_t *po
   int format, max_files_per_dir;
   const char *format_path = path_format(fs, pool);
   svn_node_kind_t kind;
+  svn_boolean_t needs_revprop_shard_cleanup = FALSE;
 
   /* Read the FS format number and max-files-per-dir setting. */
   SVN_ERR(read_format(&format, &max_files_per_dir, format_path, pool));
@@ -1584,15 +1614,26 @@ upgrade_body(void *baton, apr_pool_t *po
 
   /* If the file system supports revision packing but not revprop packing
      *and* the FS has been sharded, pack the revprops up to the point that
-     revision data has been packed. */
+     revision data has been packed.  However, keep the non-packed revprop
+     files around until after the format bump */
   if (   format >= SVN_FS_FS__MIN_PACKED_FORMAT
       && format < SVN_FS_FS__MIN_PACKED_REVPROP_FORMAT
       && max_files_per_dir > 0)
-    SVN_ERR(upgrade_pack_revprops(fs, pool));
+    {
+      needs_revprop_shard_cleanup = TRUE;
+      SVN_ERR(upgrade_pack_revprops(fs, pool));
+    }
 
   /* Bump the format file. */
-  return write_format(format_path, SVN_FS_FS__FORMAT_NUMBER, max_files_per_dir,
-                      TRUE, pool);
+  SVN_ERR(write_format(format_path, SVN_FS_FS__FORMAT_NUMBER,
+                       max_files_per_dir, TRUE, pool));
+
+  /* Now, it is safe to remove the redundant revprop files. */
+  if (needs_revprop_shard_cleanup)
+    SVN_ERR(upgrade_cleanup_pack_revprops(fs, pool));
+
+  /* Done */
+  return SVN_NO_ERROR;
 }
 
 



Mime
View raw message