You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2014/03/13 23:49:07 UTC

svn commit: r1577362 - in /subversion/trunk/subversion/libsvn_fs_fs: fs.h fs_fs.c tree.c

Author: breser
Date: Thu Mar 13 22:49:06 2014
New Revision: 1577362

URL: http://svn.apache.org/r1577362
Log:
FSFS: Add new config option to pack after every commit for debug purposes.

This option is deliberately not in our default config file because we don't
want to encourage people to use this for normal operation.  This option will
ultimately replace the -DPACK_AFTER_EVERY_COMMIT knob used for debugging
packing.

To Subversion Admins that find this commit: You want to continue using
post-commit hooks to trigger packing.  This option blocks commits from
showing as completed to users until the pack completes.  Which is probably
not desireable.

* subversion/libsvn_fs_fs/fs.h
  (CONFIG_SECTION_DEBUG, CONFIG_OPTION_PACK_AFTER_COMMIT): New.
  (fs_fs_data_t): Add pack_after_commit member.

* subversion/libsvn_fs_fs/fs_fs.c
  (read_config): Read the new option disabling it for formats that don't
    support packing.

* subversion/libsvn_fs_fs/tree.c
  (svn_fs_fs__commit_txn): Pack if configured to do so.

Modified:
    subversion/trunk/subversion/libsvn_fs_fs/fs.h
    subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
    subversion/trunk/subversion/libsvn_fs_fs/tree.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=1577362&r1=1577361&r2=1577362&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/fs.h (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/fs.h Thu Mar 13 22:49:06 2014
@@ -117,6 +117,8 @@ extern "C" {
 #define CONFIG_OPTION_BLOCK_SIZE         "block-size"
 #define CONFIG_OPTION_L2P_PAGE_SIZE      "l2p-page-size"
 #define CONFIG_OPTION_P2L_PAGE_SIZE      "p2l-page-size"
+#define CONFIG_SECTION_DEBUG             "debug"
+#define CONFIG_OPTION_PACK_AFTER_COMMIT  "pack-after-commit"
 
 /* The format number of this filesystem.
    This is independent of the repository format number, and
@@ -454,6 +456,9 @@ typedef struct fs_fs_data_t
   /* Compression level to use with txdelta storage format in new revs. */
   int delta_compression_level;
 
+  /* Pack after every commit. */
+  svn_boolean_t pack_after_commit;
+
   /* 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=1577362&r1=1577361&r2=1577362&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Thu Mar 13 22:49:06 2014
@@ -566,7 +566,19 @@ read_config(fs_fs_data_t *ffd,
       ffd->l2p_page_size = 0x2000;
       ffd->p2l_page_size = 0x1000;
     }
-  
+
+  if (ffd->format >= SVN_FS_FS__MIN_PACKED_FORMAT)
+    {
+      SVN_ERR(svn_config_get_bool(ffd->config, &ffd->pack_after_commit,
+                                  CONFIG_SECTION_DEBUG,
+                                  CONFIG_OPTION_PACK_AFTER_COMMIT,
+                                  FALSE));
+    }
+  else
+    {
+      ffd->pack_after_commit = FALSE;
+    }
+
   return SVN_NO_ERROR;
 }
 

Modified: subversion/trunk/subversion/libsvn_fs_fs/tree.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/tree.c?rev=1577362&r1=1577361&r2=1577362&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/tree.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/tree.c Thu Mar 13 22:49:06 2014
@@ -2174,6 +2174,7 @@ svn_fs_fs__commit_txn(const char **confl
   svn_error_t *err = SVN_NO_ERROR;
   svn_stringbuf_t *conflict = svn_stringbuf_create_empty(pool);
   svn_fs_t *fs = txn->fs;
+  fs_fs_data_t *ffd = fs->fsap_data;
 
   /* Limit memory usage when the repository has a high commit rate and
      needs to run the following while loop multiple times.  The memory
@@ -2256,7 +2257,15 @@ svn_fs_fs__commit_txn(const char **confl
   svn_fs_fs__reset_txn_caches(fs);
 
   svn_pool_destroy(iterpool);
-  return svn_error_trace(err);
+
+  SVN_ERR(err);
+
+  if (ffd->pack_after_commit)
+    {
+      SVN_ERR(svn_fs_fs__pack(fs, NULL, NULL, NULL, NULL, pool));
+    }
+
+  return SVN_NO_ERROR;
 }