Author: kotkov
Date: Thu Aug 10 09:18:14 2017
New Revision: 1804646

URL: http://svn.apache.org/viewvc?rev=1804646&view=rev
Log:
Following up on r1803639, allow using the new fsfs 'compression'
config option in formats >= 4, instead of enabling it just for format 8.

This is similar to how other existing ([deltification], 'compression-level')
options currently work, and should make the configuration easier by not
splitting the ways to configure compression based on the format numbers.

See the related discussion in:
  
https://lists.apache.org/thread.html/bfab57fceef8d6bea6573d1ad4b04ea2bb3bcd28c6144453e8752978@%3Ccommits.subversion.apache.org%3E

* subversion/libsvn_fs_fs/fs_fs.c
  (read_config): Parse and use the 'compression' option for filesystem
   formats >= 4.  Prohibit using LZ4 compression in formats that do not
   support it.
  (write_config): Add the relevant note to the documentation.

* subversion/tests/cmdline/svntest/main.py
  (parse_options): Remove the validation for --fsfs-compression that
   only allowed using it with --server-minor-version=10.

Modified:
    subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
    subversion/trunk/subversion/tests/cmdline/svntest/main.py

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=1804646&r1=1804645&r2=1804646&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Thu Aug 10 09:18:14 2017
@@ -861,7 +861,7 @@ read_config(fs_fs_data_t *ffd,
     }
 
   /* Initialize compression settings in ffd. */
-  if (ffd->format >= SVN_FS_FS__MIN_SVNDIFF2_FORMAT)
+  if (ffd->format >= SVN_FS_FS__MIN_DELTIFICATION_FORMAT)
     {
       const char *compression_val;
       const char *compression_level_val;
@@ -878,6 +878,13 @@ read_config(fs_fs_data_t *ffd,
           SVN_ERR(parse_compression_option(&ffd->delta_compression_type,
                                            &ffd->delta_compression_level,
                                            compression_val));
+          if (ffd->delta_compression_type == compression_type_lz4 &&
+              ffd->format < SVN_FS_FS__MIN_SVNDIFF2_FORMAT)
+            {
+              return svn_error_create(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
+                                      _("Ñompression type 'lz4' requires "
+                                        "filesystem format 8 or higher"));
+            }
         }
       else if (compression_level_val)
         {
@@ -897,19 +904,6 @@ read_config(fs_fs_data_t *ffd,
           ffd->delta_compression_level = SVN_DELTA_COMPRESSION_LEVEL_DEFAULT;
         }
     }
-  else if (ffd->format >= SVN_FS_FS__MIN_DELTIFICATION_FORMAT)
-    {
-      apr_int64_t compression_level;
-
-      SVN_ERR(svn_config_get_int64(config, &compression_level,
-                                   CONFIG_SECTION_DELTIFICATION,
-                                   CONFIG_OPTION_COMPRESSION_LEVEL,
-                                   SVN_DELTA_COMPRESSION_LEVEL_DEFAULT));
-      ffd->delta_compression_type = compression_type_zlib;
-      ffd->delta_compression_level =
-        (int)MIN(MAX(SVN_DELTA_COMPRESSION_LEVEL_NONE, compression_level),
-                 SVN_DELTA_COMPRESSION_LEVEL_MAX);
-    }
   else if (ffd->format >= SVN_FS_FS__MIN_SVNDIFF1_FORMAT)
     {
       ffd->delta_compression_type = compression_type_zlib;
@@ -1062,6 +1056,7 @@ write_config(svn_fs_t *fs,
 "### significantly speed up commits as well as reading the data."            NL
 "### The syntax of this option is:"                                          NL
 "###   " CONFIG_OPTION_COMPRESSION " = none | lz4 | zlib | zlib-1 ... zlib-9" 
NL
+"### Versions prior to Subversion 1.10 will ignore this option."             NL
 "### The default value is 'zlib', which is currently equivalent to 'zlib-5'." 
NL
 "# " CONFIG_OPTION_COMPRESSION " = zlib"                                     NL
 "###"                                                                        NL

Modified: subversion/trunk/subversion/tests/cmdline/svntest/main.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/main.py?rev=1804646&r1=1804645&r2=1804646&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/main.py Thu Aug 10 
09:18:14 2017
@@ -2202,10 +2202,6 @@ def parse_options(arglist=sys.argv[1:],
   if options.fsfs_packing and not options.fsfs_sharding:
     parser.error("--fsfs-packing requires --fsfs-sharding")
 
-  if options.fsfs_compression is not None and \
-     options.server_minor_version < 10:
-    parser.error("--fsfs-compression requires --server-minor-version=10")
-
   if options.server_minor_version not in range(3, SVN_VER_MINOR+1):
     parser.error("test harness only supports server minor versions 3-%d"
                  % SVN_VER_MINOR)


Reply via email to