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 2015/12/15 00:20:53 UTC

svn commit: r1720045 - in /subversion/branches/parallel-put/subversion: include/svn_fs.h include/svn_repos.h libsvn_fs/fs-loader.c libsvn_fs/fs-loader.h libsvn_fs_base/fs.c libsvn_fs_fs/fs.c libsvn_fs_x/fs.c libsvn_repos/repos.c

Author: stefan2
Date: Mon Dec 14 23:20:52 2015
New Revision: 1720045

URL: http://svn.apache.org/viewvc?rev=1720045&view=rev
Log:
On the parallel-put branch:
Make the concurrent write support in FSFS txns a configurable repository
capability.

The feature needs to be enabled via the config hash upon svn_fs_t creation
and the actual capability will be reported through a new FS API function.
In FSFS, it can be enabled for any format because no format specific
features are needed.  All other backends don't support it ATM, FSX will
eventually get the feature ported.

* subversion/include/svn_fs.h
  (SVN_FS_CONFIG_CONCURRENT_WRITES): Define a new FS configuration option.
  (svn_fs_supports_concurrent_writes): New API to query the actual setting.

* subversion/libsvn_fs/fs-loader.h
  (fs_vtable_t): Add vtable entry for the new API function.

* subversion/libsvn_fs/fs-loader.c
  (svn_fs_supports_concurrent_writes): Implement. Provide a default for
                                       backends that don't support the
                                       new feature at all.

* subversion/libsvn_fs_base/fs.c
  (fs_vtable): Don't support concurrent txn writes at all.

* subversion/libsvn_fs_x/fs.c
  (fs_vtable): Same.

* subversion/libsvn_fs_fs/fs.c
  (fs_supports_concurrent_writes): Implement the new FS vtable function.
  (fs_vtable): Update.
  (initialize_fs_struct): 

* subversion/include/svn_repos.h
  (SVN_REPOS_CAPABILITY_CONCURRENT_WRITE): Define new capability.

* subversion/libsvn_repos/repos.c
  (svn_repos_has_capability): Detect the new capability.
  (svn_repos_capabilities): Extend list of potential capabilities.

Modified:
    subversion/branches/parallel-put/subversion/include/svn_fs.h
    subversion/branches/parallel-put/subversion/include/svn_repos.h
    subversion/branches/parallel-put/subversion/libsvn_fs/fs-loader.c
    subversion/branches/parallel-put/subversion/libsvn_fs/fs-loader.h
    subversion/branches/parallel-put/subversion/libsvn_fs_base/fs.c
    subversion/branches/parallel-put/subversion/libsvn_fs_fs/fs.c
    subversion/branches/parallel-put/subversion/libsvn_fs_x/fs.c
    subversion/branches/parallel-put/subversion/libsvn_repos/repos.c

Modified: subversion/branches/parallel-put/subversion/include/svn_fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/parallel-put/subversion/include/svn_fs.h?rev=1720045&r1=1720044&r2=1720045&view=diff
==============================================================================
--- subversion/branches/parallel-put/subversion/include/svn_fs.h (original)
+++ subversion/branches/parallel-put/subversion/include/svn_fs.h Mon Dec 14 23:20:52 2015
@@ -207,6 +207,18 @@ typedef struct svn_fs_t svn_fs_t;
  * @since New in 1.9.
  */
 #define SVN_FS_CONFIG_COMPATIBLE_VERSION        "compatible-version"
+
+/** Transactions created through the respective FS instance will allow
+ * for concurrent text and property modifications.
+ *
+ * This option may not be supported by all backends.
+ * Call #svn_fs_supports_concurrent_writes to check whether it got actually
+ * activated.
+ *
+ * @since New in 1.10.
+ */
+#define SVN_FS_CONFIG_CONCURRENT_WRITES         "concurrent-writes"
+
 /** @} */
 
 
@@ -488,6 +500,19 @@ svn_fs_config(svn_fs_t *fs,
               apr_pool_t *pool);
 
 /**
+ * Return TRUE if transactions opened through @a fs will support concurrent
+ * writes, i.e. #svn_fs_apply_text, #svn_fs_apply_textdelta and
+ * #svn_fs_change_node_prop from different processes and threads.
+ *
+ * Uses @a scratch_pool for temporary allocations.
+ *
+ * @since New in 1.10.
+ */
+svn_boolean_t
+svn_fs_supports_concurrent_writes(svn_fs_t *fs,
+                                  apr_pool_t *scratch_pool);
+
+/**
  * Delete the filesystem at @a path.
  *
  * @note: Deleting a filesystem that has an open svn_fs_t is not

Modified: subversion/branches/parallel-put/subversion/include/svn_repos.h
URL: http://svn.apache.org/viewvc/subversion/branches/parallel-put/subversion/include/svn_repos.h?rev=1720045&r1=1720044&r2=1720045&view=diff
==============================================================================
--- subversion/branches/parallel-put/subversion/include/svn_repos.h (original)
+++ subversion/branches/parallel-put/subversion/include/svn_repos.h Mon Dec 14 23:20:52 2015
@@ -585,6 +585,14 @@ svn_repos_capabilities(apr_hash_t **capa
  * @since New in 1.5.
  */
 #define SVN_REPOS_CAPABILITY_MERGEINFO "mergeinfo"
+
+/**
+ * The capability of doing the right thing with merge-tracking
+ * information, both storing it and responding to queries about it.
+ *
+ * @since New in 1.10.
+ */
+#define SVN_REPOS_CAPABILITY_CONCURRENT_WRITE "concurrent-write"
 /*       *** PLEASE READ THIS IF YOU ADD A NEW CAPABILITY ***
  *
  * @c SVN_REPOS_CAPABILITY_foo strings should not include colons, to

Modified: subversion/branches/parallel-put/subversion/libsvn_fs/fs-loader.c
URL: http://svn.apache.org/viewvc/subversion/branches/parallel-put/subversion/libsvn_fs/fs-loader.c?rev=1720045&r1=1720044&r2=1720045&view=diff
==============================================================================
--- subversion/branches/parallel-put/subversion/libsvn_fs/fs-loader.c (original)
+++ subversion/branches/parallel-put/subversion/libsvn_fs/fs-loader.c Mon Dec 14 23:20:52 2015
@@ -619,6 +619,15 @@ svn_fs_config(svn_fs_t *fs, apr_pool_t *
   return NULL;
 }
 
+svn_boolean_t
+svn_fs_supports_concurrent_writes(svn_fs_t *fs,
+                                  apr_pool_t *scratch_pool)
+{
+  return fs->vtable->supports_concurrent_writes
+    ? fs->vtable->supports_concurrent_writes(fs, scratch_pool)
+    : FALSE;
+}
+
 svn_error_t *
 svn_fs_delete_fs(const char *path, apr_pool_t *pool)
 {

Modified: subversion/branches/parallel-put/subversion/libsvn_fs/fs-loader.h
URL: http://svn.apache.org/viewvc/subversion/branches/parallel-put/subversion/libsvn_fs/fs-loader.h?rev=1720045&r1=1720044&r2=1720045&view=diff
==============================================================================
--- subversion/branches/parallel-put/subversion/libsvn_fs/fs-loader.h (original)
+++ subversion/branches/parallel-put/subversion/libsvn_fs/fs-loader.h Mon Dec 14 23:20:52 2015
@@ -266,6 +266,8 @@ typedef struct fs_vtable_t
   svn_error_t *(*bdb_set_errcall)(svn_fs_t *fs,
                                   void (*handler)(const char *errpfx,
                                                   char *msg));
+  svn_boolean_t (*supports_concurrent_writes)(svn_fs_t *fs,
+                                              apr_pool_t *scratch_pool);
 } fs_vtable_t;
 
 

Modified: subversion/branches/parallel-put/subversion/libsvn_fs_base/fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/parallel-put/subversion/libsvn_fs_base/fs.c?rev=1720045&r1=1720044&r2=1720045&view=diff
==============================================================================
--- subversion/branches/parallel-put/subversion/libsvn_fs_base/fs.c (original)
+++ subversion/branches/parallel-put/subversion/libsvn_fs_base/fs.c Mon Dec 14 23:20:52 2015
@@ -574,6 +574,7 @@ static fs_vtable_t fs_vtable = {
   base_bdb_verify_root,
   base_bdb_freeze,
   base_bdb_set_errcall,
+  NULL,
 };
 
 /* Where the format number is stored. */

Modified: subversion/branches/parallel-put/subversion/libsvn_fs_fs/fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/parallel-put/subversion/libsvn_fs_fs/fs.c?rev=1720045&r1=1720044&r2=1720045&view=diff
==============================================================================
--- subversion/branches/parallel-put/subversion/libsvn_fs_fs/fs.c (original)
+++ subversion/branches/parallel-put/subversion/libsvn_fs_fs/fs.c Mon Dec 14 23:20:52 2015
@@ -47,6 +47,7 @@
 #include "verify.h"
 #include "svn_private_config.h"
 #include "private/svn_fs_util.h"
+#include "private/svn_subr_private.h"
 
 #include "../libsvn_fs/fs-loader.h"
 
@@ -168,6 +169,14 @@ fs_set_errcall(svn_fs_t *fs,
   return SVN_NO_ERROR;
 }
 
+static svn_boolean_t
+fs_supports_concurrent_writes(svn_fs_t *fs,
+                              apr_pool_t *scratch_pool)
+{
+  fs_fs_data_t *ffd = fs->fsap_data;
+  return ffd->concurrent_txns;
+}
+
 struct fs_freeze_baton_t {
   svn_fs_t *fs;
   svn_fs_freeze_func_t freeze_func;
@@ -279,7 +288,8 @@ static fs_vtable_t fs_vtable = {
   fs_info,
   svn_fs_fs__verify_root,
   fs_freeze,
-  fs_set_errcall
+  fs_set_errcall,
+  fs_supports_concurrent_writes
 };
 
 
@@ -292,6 +302,9 @@ initialize_fs_struct(svn_fs_t *fs)
   fs_fs_data_t *ffd = apr_pcalloc(fs->pool, sizeof(*ffd));
   ffd->use_log_addressing = FALSE;
   ffd->revprop_prefix = 0;
+  ffd->concurrent_txns = svn_hash__get_bool(fs->config,
+                                            SVN_FS_CONFIG_CONCURRENT_WRITES,
+                                            FALSE);
 
   fs->vtable = &fs_vtable;
   fs->fsap_data = ffd;

Modified: subversion/branches/parallel-put/subversion/libsvn_fs_x/fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/parallel-put/subversion/libsvn_fs_x/fs.c?rev=1720045&r1=1720044&r2=1720045&view=diff
==============================================================================
--- subversion/branches/parallel-put/subversion/libsvn_fs_x/fs.c (original)
+++ subversion/branches/parallel-put/subversion/libsvn_fs_x/fs.c Mon Dec 14 23:20:52 2015
@@ -310,7 +310,8 @@ static fs_vtable_t fs_vtable = {
   x_info,
   svn_fs_x__verify_root,
   x_freeze,
-  x_set_errcall
+  x_set_errcall,
+  NULL
 };
 
 

Modified: subversion/branches/parallel-put/subversion/libsvn_repos/repos.c
URL: http://svn.apache.org/viewvc/subversion/branches/parallel-put/subversion/libsvn_repos/repos.c?rev=1720045&r1=1720044&r2=1720045&view=diff
==============================================================================
--- subversion/branches/parallel-put/subversion/libsvn_repos/repos.c (original)
+++ subversion/branches/parallel-put/subversion/libsvn_repos/repos.c Mon Dec 14 23:20:52 2015
@@ -1560,6 +1560,13 @@ svn_repos_has_capability(svn_repos_t *re
           *has = TRUE;
         }
     }
+  else if (strcmp(capability, SVN_REPOS_CAPABILITY_CONCURRENT_WRITE) == 0)
+    {
+      *has = svn_fs_supports_concurrent_writes(repos->fs, pool);
+      svn_hash_sets(repos->repository_capabilities,
+                    SVN_REPOS_CAPABILITY_MERGEINFO,
+                    *has ? capability_yes : capability_no);
+    }
   else
     {
       return svn_error_createf(SVN_ERR_UNKNOWN_CAPABILITY, 0,
@@ -1577,6 +1584,7 @@ svn_repos_capabilities(apr_hash_t **capa
 {
   static const char *const queries[] = {
     SVN_REPOS_CAPABILITY_MERGEINFO,
+    SVN_REPOS_CAPABILITY_CONCURRENT_WRITE,
     NULL
   };
   const char *const *i;