subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From svn-r...@apache.org
Subject svn commit: r1520723 - in /subversion/branches/1.8.x: ./ STATUS subversion/libsvn_fs_fs/fs_fs.c subversion/tests/cmdline/svnadmin_tests.py
Date Sat, 07 Sep 2013 04:01:13 GMT
Author: svn-role
Date: Sat Sep  7 04:01:13 2013
New Revision: 1520723

URL: http://svn.apache.org/r1520723
Log:
Merge the r1512300 group from trunk:

 * r1512300, r1512301
   Clean up unpacked revprops in 'svnadmin hotcopy --incremental'
   Justification:
     Although keeping the unpacked revprop files should not do
     harm, it still results in the target repo being different
     from the source.  Also, it wastes disc space.
   Notes:
     r1512300 is merely a test case update to reproduce the problem.
   Votes:
     +1: stefan2, breser, rhuijben

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
    subversion/branches/1.8.x/subversion/tests/cmdline/svnadmin_tests.py

Propchange: subversion/branches/1.8.x/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1512300-1512301

Modified: subversion/branches/1.8.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/STATUS?rev=1520723&r1=1520722&r2=1520723&view=diff
==============================================================================
--- subversion/branches/1.8.x/STATUS (original)
+++ subversion/branches/1.8.x/STATUS Sat Sep  7 04:01:13 2013
@@ -166,14 +166,3 @@ Veto-blocked changes:
 
 Approved changes:
 =================
-
- * r1512300, r1512301
-   Clean up unpacked revprops in 'svnadmin hotcopy --incremental'
-   Justification:
-     Although keeping the unpacked revprop files should not do
-     harm, it still results in the target repo being different
-     from the source.  Also, it wastes disc space.
-   Notes:
-     r1512300 is merely a test case update to reproduce the problem.
-   Votes:
-     +1: stefan2, breser, rhuijben

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=1520723&r1=1520722&r2=1520723&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 Sat Sep  7 04:01:13 2013
@@ -10928,26 +10928,23 @@ hotcopy_update_current(svn_revnum_t *dst
 }
 
 
-/* Remove revisions between START_REV (inclusive) and END_REV (non-inclusive)
- * from DST_FS. Assume sharding as per MAX_FILES_PER_DIR.
+/* Remove revision or revprop files between START_REV (inclusive) and
+ * END_REV (non-inclusive) from folder DST_SUBDIR in DST_FS.  Assume
+ * sharding as per MAX_FILES_PER_DIR.
  * Use SCRATCH_POOL for temporary allocations. */
 static svn_error_t *
-hotcopy_remove_rev_files(svn_fs_t *dst_fs,
-                         svn_revnum_t start_rev,
-                         svn_revnum_t end_rev,
-                         int max_files_per_dir,
-                         apr_pool_t *scratch_pool)
+hotcopy_remove_files(svn_fs_t *dst_fs,
+                     const char *dst_subdir,
+                     svn_revnum_t start_rev,
+                     svn_revnum_t end_rev,
+                     int max_files_per_dir,
+                     apr_pool_t *scratch_pool)
 {
-  const char *dst_subdir;
   const char *shard;
   const char *dst_subdir_shard;
   svn_revnum_t rev;
   apr_pool_t *iterpool;
 
-  SVN_ERR_ASSERT(start_rev <= end_rev);
-
-  dst_subdir = svn_dirent_join(dst_fs->path, PATH_REVS_DIR, scratch_pool);
-
   /* Pre-compute paths for initial shard. */
   shard = apr_psprintf(scratch_pool, "%ld", start_rev / max_files_per_dir);
   dst_subdir_shard = svn_dirent_join(dst_subdir, shard, scratch_pool);
@@ -10955,8 +10952,7 @@ hotcopy_remove_rev_files(svn_fs_t *dst_f
   iterpool = svn_pool_create(scratch_pool);
   for (rev = start_rev; rev < end_rev; rev++)
     {
-      const char *rev_path;
-
+      const char *path;
       svn_pool_clear(iterpool);
 
       /* If necessary, update paths for shard. */
@@ -10966,19 +10962,66 @@ hotcopy_remove_rev_files(svn_fs_t *dst_f
           dst_subdir_shard = svn_dirent_join(dst_subdir, shard, scratch_pool);
         }
 
-      rev_path = svn_dirent_join(dst_subdir_shard,
-                                 apr_psprintf(iterpool, "%ld", rev),
-                                 iterpool);
+      /* remove files for REV */
+      path = svn_dirent_join(dst_subdir_shard,
+                             apr_psprintf(iterpool, "%ld", rev),
+                             iterpool);
 
       /* Make the rev file writable and remove it. */
-      SVN_ERR(svn_io_set_file_read_write(rev_path, TRUE, iterpool));
-      SVN_ERR(svn_io_remove_file2(rev_path, TRUE, iterpool));
+      SVN_ERR(svn_io_set_file_read_write(path, TRUE, iterpool));
+      SVN_ERR(svn_io_remove_file2(path, TRUE, iterpool));
     }
+
   svn_pool_destroy(iterpool);
 
   return SVN_NO_ERROR;
 }
 
+/* Remove revisions between START_REV (inclusive) and END_REV (non-inclusive)
+ * from DST_FS. Assume sharding as per MAX_FILES_PER_DIR.
+ * Use SCRATCH_POOL for temporary allocations. */
+static svn_error_t *
+hotcopy_remove_rev_files(svn_fs_t *dst_fs,
+                         svn_revnum_t start_rev,
+                         svn_revnum_t end_rev,
+                         int max_files_per_dir,
+                         apr_pool_t *scratch_pool)
+{
+  SVN_ERR_ASSERT(start_rev <= end_rev);
+  SVN_ERR(hotcopy_remove_files(dst_fs,
+                               svn_dirent_join(dst_fs->path,
+                                               PATH_REVS_DIR,
+                                               scratch_pool),
+                               start_rev, end_rev,
+                               max_files_per_dir, scratch_pool));
+
+  return SVN_NO_ERROR;
+}
+
+/* Remove revision properties between START_REV (inclusive) and END_REV
+ * (non-inclusive) from DST_FS. Assume sharding as per MAX_FILES_PER_DIR.
+ * Use SCRATCH_POOL for temporary allocations.  Revision 0 revprops will
+ * not be deleted. */
+static svn_error_t *
+hotcopy_remove_revprop_files(svn_fs_t *dst_fs,
+                             svn_revnum_t start_rev,
+                             svn_revnum_t end_rev,
+                             int max_files_per_dir,
+                             apr_pool_t *scratch_pool)
+{
+  SVN_ERR_ASSERT(start_rev <= end_rev);
+
+  /* don't delete rev 0 props */
+  SVN_ERR(hotcopy_remove_files(dst_fs,
+                               svn_dirent_join(dst_fs->path,
+                                               PATH_REVPROPS_DIR,
+                                               scratch_pool),
+                               start_rev ? start_rev : 1, end_rev,
+                               max_files_per_dir, scratch_pool));
+
+  return SVN_NO_ERROR;
+}
+
 /* Verify that DST_FS is a suitable destination for an incremental
  * hotcopy from SRC_FS. */
 static svn_error_t *
@@ -11015,6 +11058,27 @@ hotcopy_incremental_check_preconditions(
   return SVN_NO_ERROR;
 }
 
+/* Remove folder PATH.  Ignore errors due to the sub-tree not being empty.
+ * CANCEL_FUNC and CANCEL_BATON do the usual thing.
+ * Use POOL for temporary allocations.
+ */
+static svn_error_t *
+remove_folder(const char *path,
+              svn_cancel_func_t cancel_func,
+              void *cancel_baton,
+              apr_pool_t *pool)
+{
+  svn_error_t *err = svn_io_remove_dir2(path, TRUE,
+                                        cancel_func, cancel_baton, pool);
+
+  if (err && APR_STATUS_IS_ENOTEMPTY(err->apr_err))
+    {
+      svn_error_clear(err);
+      err = SVN_NO_ERROR;
+    }
+
+  return svn_error_trace(err);
+}
 
 /* Baton for hotcopy_body(). */
 struct hotcopy_body_baton {
@@ -11205,8 +11269,6 @@ hotcopy_body(void *baton, apr_pool_t *po
   /* First, copy packed shards. */
   for (rev = 0; rev < src_min_unpacked_rev; rev += max_files_per_dir)
     {
-      svn_error_t *err;
-
       svn_pool_clear(iterpool);
 
       if (cancel_func)
@@ -11226,20 +11288,22 @@ hotcopy_body(void *baton, apr_pool_t *po
 
       /* Remove revision files which are now packed. */
       if (incremental)
-        SVN_ERR(hotcopy_remove_rev_files(dst_fs, rev, rev + max_files_per_dir,
-                                         max_files_per_dir, iterpool));
+        {
+          SVN_ERR(hotcopy_remove_rev_files(dst_fs, rev,
+                                           rev + max_files_per_dir,
+                                           max_files_per_dir, iterpool));
+          SVN_ERR(hotcopy_remove_revprop_files(dst_fs, rev,
+                                               rev + max_files_per_dir,
+                                               max_files_per_dir, iterpool));
+        }
 
       /* Now that all revisions have moved into the pack, the original
        * rev dir can be removed. */
-      err = svn_io_remove_dir2(path_rev_shard(dst_fs, rev, iterpool),
-                               TRUE, cancel_func, cancel_baton, iterpool);
-      if (err)
-        {
-          if (APR_STATUS_IS_ENOTEMPTY(err->apr_err))
-            svn_error_clear(err);
-          else
-            return svn_error_trace(err);
-        }
+      SVN_ERR(remove_folder(path_rev_shard(dst_fs, rev, iterpool),
+                            cancel_func, cancel_baton, iterpool));
+      if (rev > 0)
+        SVN_ERR(remove_folder(path_revprops_shard(dst_fs, rev, iterpool),
+                              cancel_func, cancel_baton, iterpool));
     }
 
   if (cancel_func)

Modified: subversion/branches/1.8.x/subversion/tests/cmdline/svnadmin_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/tests/cmdline/svnadmin_tests.py?rev=1520723&r1=1520722&r2=1520723&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/tests/cmdline/svnadmin_tests.py (original)
+++ subversion/branches/1.8.x/subversion/tests/cmdline/svnadmin_tests.py Sat Sep  7 04:01:13
2013
@@ -1616,7 +1616,7 @@ def hotcopy_incremental_packed(sbox):
   cwd = os.getcwd()
   # Configure two files per shard to trigger packing
   format_file = open(os.path.join(sbox.repo_dir, 'db', 'format'), 'wb')
-  format_file.write("4\nlayout sharded 2\n")
+  format_file.write("6\nlayout sharded 2\n")
   format_file.close()
 
   # Pack revisions 0 and 1.



Mime
View raw message