[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] fsfs: pack revs without packing revprops, or vice-versa

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Tue, 9 Feb 2010 17:32:28 +0200 (Jerusalem Standard Time)

Since the fsfs logics of rev-packing and revprop-packing are entirely
separate (e.g., min-unpacked-rev and min-unpacked-revprop are separate),
one could reasonably want to enable one without enabling the other. The
attached patch implements this.

I took it for a spin: it seems to work as intended on a test repository,
and the fs/repos C tests still pass.

Daniel

(Patch generated by 'svn diff -x-w' to make the next-to-last hunk
reviewable.)

[[[
Index: subversion/libsvn_fs_fs/fs.h
===================================================================
--- subversion/libsvn_fs_fs/fs.h (revision 908057)
+++ subversion/libsvn_fs_fs/fs.h (working copy)
@@ -85,6 +85,9 @@ extern "C" {
 #define CONFIG_OPTION_FAIL_STOP "fail-stop"
 #define CONFIG_SECTION_REP_SHARING "rep-sharing"
 #define CONFIG_OPTION_ENABLE_REP_SHARING "enable-rep-sharing"
+#define CONFIG_SECTION_PACKING "packing"
+#define CONFIG_OPTION_PACK_REVS "pack-revision-shards"
+#define CONFIG_OPTION_PACK_REVPROPS "pack-revprop-shards"
 
 /* The format number of this filesystem.
    This is independent of the repository format number, and
@@ -257,6 +260,14 @@ typedef struct
   /* Whether rep-sharing is supported by the filesystem
    * and allowed by the configuration. */
   svn_boolean_t rep_sharing_allowed;
+
+ /* Whether packing of revision shards is allowed by the configuration
+ * (regardless of the filesystem's format). */
+ svn_boolean_t may_pack_revs;
+
+ /* Whether packing of revprop shards is allowed by the configuration
+ * (regardless of the filesystem's format). */
+ svn_boolean_t may_pack_revprops;
 } fs_fs_data_t;
 
 
Index: subversion/libsvn_fs_fs/fs_fs.c
===================================================================
--- subversion/libsvn_fs_fs/fs_fs.c (revision 908057)
+++ subversion/libsvn_fs_fs/fs_fs.c (working copy)
@@ -1096,6 +1096,14 @@ read_config(svn_fs_t *fs,
   else
     ffd->rep_sharing_allowed = FALSE;
 
+ /* Initialize packing configuration bits. */
+ SVN_ERR(svn_config_get_bool(ffd->config, &ffd->may_pack_revs,
+ CONFIG_SECTION_PACKING,
+ CONFIG_OPTION_PACK_REVS, TRUE));
+ SVN_ERR(svn_config_get_bool(ffd->config, &ffd->may_pack_revprops,
+ CONFIG_SECTION_PACKING,
+ CONFIG_OPTION_PACK_REVPROPS, TRUE));
+
   return SVN_NO_ERROR;
 }
 
@@ -1142,6 +1150,15 @@ write_config(svn_fs_t *fs,
 "### be switched on and off at will, but for best space-saving results" NL
 "### should be enabled consistently over the life of the repository." NL
 "# " CONFIG_OPTION_ENABLE_REP_SHARING " = true" NL
+"" NL
+"[" CONFIG_SECTION_PACKING "]" NL
+"### The following parameters cause future runs of 'svnadmin pack' to skip" NL
+"### packing the revision shards or the revprop shards, respectively. They" NL
+"### have no effect on already-packed shards. They can be changed at any" NL
+"### time, but the change will only affect future runs; it will not affect" NL
+"### shards that had been packed previously." NL
+"# " CONFIG_OPTION_PACK_REVS " = true" NL
+"# " CONFIG_OPTION_PACK_REVPROPS " = true" NL
 
 ;
 #undef NL
@@ -7496,6 +7513,7 @@ pack_body(void *baton,
   const char *data_path, *revprops_path;
   svn_revnum_t min_unpacked_rev;
   svn_revnum_t min_unpacked_revprop;
+ fs_fs_data_t *ffd = pb->fs->fsap_data;
 
   SVN_ERR(read_format(&format, &max_files_per_dir,
                       svn_dirent_join(pb->fs->path, PATH_FORMAT, pool),
@@ -7537,10 +7555,17 @@ pack_body(void *baton,
       min_unpacked_revprop == (completed_shards * max_files_per_dir))
     return SVN_NO_ERROR;
 
+ /* Are we allowed to do anything? */
+ if (ffd->may_pack_revs == FALSE && ffd->may_pack_revprops == FALSE)
+ return SVN_NO_ERROR;
+
   data_path = svn_dirent_join(pb->fs->path, PATH_REVS_DIR, pool);
   revprops_path = svn_dirent_join(pb->fs->path, PATH_REVPROPS_DIR, pool);
 
   iterpool = svn_pool_create(pool);
+
+ SVN_ERR_ASSERT(format >= SVN_FS_FS__MIN_PACKED_FORMAT);
+ if (ffd->may_pack_revs)
   for (i = min_unpacked_rev / max_files_per_dir; i < completed_shards; i++)
     {
       svn_pool_clear(iterpool);
@@ -7553,7 +7578,7 @@ pack_body(void *baton,
                          pb->cancel_func, pb->cancel_baton, iterpool));
     }
 
- if (format >= SVN_FS_FS__MIN_PACKED_REVPROP_FORMAT)
+ if (format >= SVN_FS_FS__MIN_PACKED_REVPROP_FORMAT && ffd->may_pack_revprops)
     for (i = min_unpacked_revprop / max_files_per_dir; i < completed_shards; i++)
       {
         svn_pool_clear(iterpool);
]]]
Received on 2010-02-09 16:32:48 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.