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/01/20 16:40:26 UTC

svn commit: r1559748 - in /subversion/trunk/subversion/libsvn_fs_fs: fs.h fs_fs.c transaction.c

Author: stefan2
Date: Mon Jan 20 15:40:25 2014
New Revision: 1559748

URL: http://svn.apache.org/r1559748
Log:
Add an option in fsfs.conf to select the ZLIB compression level that we
apply with txdelta to new revisions.

For near-incompressible data like office documents, artwork etc, this fully
backward compatible option massively speeds up commits and slightly speeds
up exports / checkouts.  Deltification can be controlled independently.

* subversion/libsvn_fs_fs/fs.h
  (CONFIG_OPTION_COMPRESSION_LEVEL): Define the new config option name.
  (fs_fs_data_t): Add config option value.

* subversion/libsvn_fs_fs/fs_fs.c
  (read_config): Extend parser to read the new option.
  (write_config): Update config file template.

* subversion/libsvn_fs_fs/transaction.c
  (rep_write_get_baton,
   write_container_delta_rep): Use the new setting for txdelta compression.

Modified:
    subversion/trunk/subversion/libsvn_fs_fs/fs.h
    subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
    subversion/trunk/subversion/libsvn_fs_fs/transaction.c

Modified: subversion/trunk/subversion/libsvn_fs_fs/fs.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs.h?rev=1559748&r1=1559747&r2=1559748&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/fs.h (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/fs.h Mon Jan 20 15:40:25 2014
@@ -108,6 +108,7 @@ extern "C" {
 #define CONFIG_OPTION_ENABLE_PROPS_DELTIFICATION "enable-props-deltification"
 #define CONFIG_OPTION_MAX_DELTIFICATION_WALK     "max-deltification-walk"
 #define CONFIG_OPTION_MAX_LINEAR_DELTIFICATION   "max-linear-deltification"
+#define CONFIG_OPTION_COMPRESSION_LEVEL  "compression-level"
 #define CONFIG_SECTION_PACKED_REVPROPS   "packed-revprops"
 #define CONFIG_OPTION_REVPROP_PACK_SIZE  "revprop-pack-size"
 #define CONFIG_OPTION_COMPRESS_PACKED_REVPROPS  "compress-packed-revprops"
@@ -453,6 +454,9 @@ typedef struct fs_fs_data_t
    * deltification history after which skip deltas will be used. */
   apr_int64_t max_linear_deltification;
 
+  /* Compression level to use with txdelta storage format in new revs. */
+  int delta_compression_level;
+
   /* Pointer to svn_fs_open. */
   svn_error_t *(*svn_fs_open_)(svn_fs_t **, const char *, apr_hash_t *,
                                apr_pool_t *);

Modified: subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c?rev=1559748&r1=1559747&r2=1559748&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Mon Jan 20 15:40:25 2014
@@ -30,6 +30,7 @@
 #include "svn_props.h"
 #include "svn_time.h"
 #include "svn_dirent_uri.h"
+#include "svn_sorts.h"
 #include "svn_version.h"
 
 #include "cached_data.h"
@@ -481,6 +482,8 @@ read_config(fs_fs_data_t *ffd,
   /* Initialize deltification settings in ffd. */
   if (ffd->format >= SVN_FS_FS__MIN_DELTIFICATION_FORMAT)
     {
+      apr_int64_t compression_level;
+
       SVN_ERR(svn_config_get_bool(ffd->config, &ffd->deltify_directories,
                                   CONFIG_SECTION_DELTIFICATION,
                                   CONFIG_OPTION_ENABLE_DIR_DELTIFICATION,
@@ -497,6 +500,14 @@ read_config(fs_fs_data_t *ffd,
                                    CONFIG_SECTION_DELTIFICATION,
                                    CONFIG_OPTION_MAX_LINEAR_DELTIFICATION,
                                    SVN_FS_FS_MAX_LINEAR_DELTIFICATION));
+
+      SVN_ERR(svn_config_get_int64(ffd->config, &compression_level,
+                                   CONFIG_SECTION_DELTIFICATION,
+                                   CONFIG_OPTION_COMPRESSION_LEVEL,
+                                   SVN_DELTA_COMPRESSION_LEVEL_DEFAULT));
+      ffd->delta_compression_level
+        = (int)MIN(MAX(SVN_DELTA_COMPRESSION_LEVEL_NONE, compression_level),
+                   SVN_DELTA_COMPRESSION_LEVEL_MAX);
     }
   else
     {
@@ -504,6 +515,7 @@ read_config(fs_fs_data_t *ffd,
       ffd->deltify_properties = FALSE;
       ffd->max_deltification_walk = SVN_FS_FS_MAX_DELTIFICATION_WALK;
       ffd->max_linear_deltification = SVN_FS_FS_MAX_LINEAR_DELTIFICATION;
+      ffd->delta_compression_level = SVN_DELTA_COMPRESSION_LEVEL_DEFAULT;
     }
 
   /* Initialize revprop packing settings in ffd. */
@@ -663,6 +675,24 @@ write_config(svn_fs_t *fs,
 "### exclusive use of skip-deltas (as in pre-1.8)."                          NL
 "### For 1.8, the default value is 16; earlier versions use 1."              NL
 "# " CONFIG_OPTION_MAX_LINEAR_DELTIFICATION " = 16"                          NL
+"###"                                                                        NL
+"### After deltification, we compress the data through zlib to minimize on-" NL
+"### disk size.  That can be an expensive and ineffective process.  This"    NL
+"### setting controls the usage of zlib in future revisions."                NL
+"### Revisions with highly compressible data in them may shrink in size"     NL
+"### if the setting is increased but may take much longer to commit.  The"   NL
+"### time taken to uncompress that data again is widely independent of the"  NL
+"### compression level."                                                     NL
+"### Compression will be ineffective if the incoming content is already"     NL
+"### highly compressed.  In that case, disabling the compression entirely"   NL
+"### will speed up commits as well as reading the data.  Repositories with"  NL
+"### many small compressible files (source code) but also a high percentage" NL
+"### of large incompressible ones (artwork) may benefit from compression"    NL
+"### levels lowered to e.g. 1."                                              NL
+"### Valid values are 0 to 9 with 9 providing the highest compression ratio" NL
+"### and 0 disabling it altogether"                                          NL
+"### The default value is 5."                                                NL
+"# " CONFIG_OPTION_COMPRESSION_LEVEL " = 5"                                  NL
 ""                                                                           NL
 "[" CONFIG_SECTION_PACKED_REVPROPS "]"                                       NL
 "### This parameter controls the size (in kBytes) of packed revprop files."  NL

Modified: subversion/trunk/subversion/libsvn_fs_fs/transaction.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/transaction.c?rev=1559748&r1=1559747&r2=1559748&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/transaction.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/transaction.c Mon Jan 20 15:40:25 2014
@@ -2093,7 +2093,7 @@ rep_write_get_baton(struct rep_write_bat
                           &whb,
                           b->rep_stream,
                           diff_version,
-                          SVN_DELTA_COMPRESSION_LEVEL_DEFAULT,
+                          ffd->delta_compression_level,
                           pool);
 
   b->delta_stream = svn_txdelta_target_push(wh, whb, source, b->pool);
@@ -2684,7 +2684,7 @@ write_container_delta_rep(representation
                           &diff_whb,
                           file_stream,
                           diff_version,
-                          SVN_DELTA_COMPRESSION_LEVEL_DEFAULT,
+                          ffd->delta_compression_level,
                           pool);
 
   whb = apr_pcalloc(pool, sizeof(*whb));