Author: stefan2
Date: Mon Dec 14 13:43:32 2015
New Revision: 1719911
URL: http://svn.apache.org/viewvc?rev=1719911&view=rev
Log:
On the parallel-put branch:
Synchronize prop sets as well. All representation changes are now
fully synchronized and can be issued concurrently from different
threads and processes.
* subversion/libsvn_fs_fs/tree.c
(change_node_prop_body_baton_t): New baton type.
(change_node_prop_body): New function containing the exact same
logic that fs_change_node_prop had so far.
(fs_change_node_prop): Now a mere locking wrapper around the above.
Modified:
subversion/branches/parallel-put/subversion/libsvn_fs_fs/tree.c
Modified: subversion/branches/parallel-put/subversion/libsvn_fs_fs/tree.c
URL:
http://svn.apache.org/viewvc/subversion/branches/parallel-put/subversion/libsvn_fs_fs/tree.c?rev=1719911&r1=1719910&r2=1719911&view=diff
==============================================================================
--- subversion/branches/parallel-put/subversion/libsvn_fs_fs/tree.c (original)
+++ subversion/branches/parallel-put/subversion/libsvn_fs_fs/tree.c Mon Dec 14
13:43:32 2015
@@ -1595,84 +1595,118 @@ increment_mergeinfo_up_tree(parent_path_
return SVN_NO_ERROR;
}
-/* Change, add, or delete a node's property value. The affected node
- is PATH under ROOT, the property value to modify is NAME, and VALUE
- points to either a string value to set the new contents to, or NULL
- if the property should be deleted. Perform temporary allocations
- in POOL. */
+/* Baton type to be used with change_node_prop_body.
+ It contains the parameters pass to fs_change_node_prop as-is. */
+typedef struct change_node_prop_body_baton_t
+{
+ svn_fs_root_t *root;
+ const char *path;
+ const char *name;
+ const svn_string_t *value;
+} change_node_prop_body_baton_t;
+
+/* Core of fs_change_node_prop taking all its parameters from the
+ change_node_prop_body_baton_t in BATON. */
static svn_error_t *
-fs_change_node_prop(svn_fs_root_t *root,
- const char *path,
- const char *name,
- const svn_string_t *value,
- apr_pool_t *pool)
+change_node_prop_body(void *baton,
+ apr_pool_t *pool)
{
+ change_node_prop_body_baton_t *b = baton;
+
parent_path_t *parent_path;
apr_hash_t *proplist;
const svn_fs_fs__id_part_t *txn_id;
svn_boolean_t mergeinfo_mod = FALSE;
- if (! root->is_txn_root)
+ if (! b->root->is_txn_root)
return SVN_FS__NOT_TXN(root);
- txn_id = root_txn_id(root);
+ txn_id = root_txn_id(b->root);
- path = svn_fs__canonicalize_abspath(path, pool);
- SVN_ERR(open_path(&parent_path, root, path, 0, TRUE, pool));
+ b->path = svn_fs__canonicalize_abspath(b->path, pool);
+ SVN_ERR(open_path(&parent_path, b->root, b->path, 0, TRUE, pool));
/* Check (non-recursively) to see if path is locked; if so, check
that we can use it. */
- if (root->txn_flags & SVN_FS_TXN_CHECK_LOCKS)
- SVN_ERR(svn_fs_fs__allow_locked_operation(path, root->fs, FALSE, FALSE,
- pool));
+ if (b->root->txn_flags & SVN_FS_TXN_CHECK_LOCKS)
+ SVN_ERR(svn_fs_fs__allow_locked_operation(b->path, b->root->fs, FALSE,
+ FALSE, pool));
- SVN_ERR(make_path_mutable(root, parent_path, path, pool));
+ SVN_ERR(make_path_mutable(b->root, parent_path, b->path, pool));
SVN_ERR(svn_fs_fs__dag_get_proplist(&proplist, parent_path->node, pool));
/* If there's no proplist, but we're just deleting a property, exit now. */
- if ((! proplist) && (! value))
+ if ((! proplist) && (! b->value))
return SVN_NO_ERROR;
/* Now, if there's no proplist, we know we need to make one. */
if (! proplist)
proplist = apr_hash_make(pool);
- if (svn_fs_fs__fs_supports_mergeinfo(root->fs)
- && strcmp (name, SVN_PROP_MERGEINFO) == 0)
+ if (svn_fs_fs__fs_supports_mergeinfo(b->root->fs)
+ && strcmp (b->name, SVN_PROP_MERGEINFO) == 0)
{
apr_int64_t increment = 0;
svn_boolean_t had_mergeinfo;
SVN_ERR(svn_fs_fs__dag_has_mergeinfo(&had_mergeinfo, parent_path->node));
- if (value && !had_mergeinfo)
+ if (b->value && !had_mergeinfo)
increment = 1;
- else if (!value && had_mergeinfo)
+ else if (!b->value && had_mergeinfo)
increment = -1;
if (increment != 0)
{
SVN_ERR(increment_mergeinfo_up_tree(parent_path, increment, pool));
SVN_ERR(svn_fs_fs__dag_set_has_mergeinfo(parent_path->node,
- (value != NULL), pool));
+ (b->value != NULL), pool));
}
mergeinfo_mod = TRUE;
}
/* Set the property. */
- svn_hash_sets(proplist, name, value);
+ svn_hash_sets(proplist, b->name, b->value);
/* Overwrite the node's proplist. */
SVN_ERR(svn_fs_fs__dag_set_proplist(parent_path->node, proplist,
pool));
/* Make a record of this modification in the changes table. */
- return add_change(root->fs, txn_id, path,
- svn_fs_fs__dag_get_id(parent_path->node),
- svn_fs_path_change_modify, FALSE, TRUE, mergeinfo_mod,
- svn_fs_fs__dag_node_kind(parent_path->node),
- SVN_INVALID_REVNUM, NULL, pool);
+ SVN_ERR(add_change(b->root->fs, txn_id, b->path,
+ svn_fs_fs__dag_get_id(parent_path->node),
+ svn_fs_path_change_modify, FALSE, TRUE, mergeinfo_mod,
+ svn_fs_fs__dag_node_kind(parent_path->node),
+ SVN_INVALID_REVNUM, NULL, pool));
+
+ return SVN_NO_ERROR;
}
+/* Change, add, or delete a node's property value. The affected node
+ is PATH under ROOT, the property value to modify is NAME, and VALUE
+ points to either a string value to set the new contents to, or NULL
+ if the property should be deleted. Perform temporary allocations
+ in POOL. */
+static svn_error_t *
+fs_change_node_prop(svn_fs_root_t *root,
+ const char *path,
+ const char *name,
+ const svn_string_t *value,
+ apr_pool_t *pool)
+{
+ const svn_fs_fs__id_part_t *txn_id = root_txn_id(root);
+
+ change_node_prop_body_baton_t baton;
+ baton.root = root;
+ baton.path = path;
+ baton.name = name;
+ baton.value = value;
+
+ SVN_ERR(svn_fs_fs__with_txn_auto_lock(root->fs, txn_id,
+ change_node_prop_body, &baton,
+ pool));
+
+ return SVN_NO_ERROR;
+}
/* Determine if the properties of two path/root combinations are
different. Set *CHANGED_P to TRUE if the properties at PATH1 under