You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2015/08/13 17:54:56 UTC
svn commit: r1695730 [3/9] - in /subversion/branches/move-tracking-2: ./
build/ build/ac-macros/ notes/ subversion/
subversion/bindings/javahl/native/ subversion/bindings/swig/
subversion/include/ subversion/include/private/ subversion/libsvn_client/
s...
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/dag.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/dag.c?rev=1695730&r1=1695729&r2=1695730&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/dag.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/dag.c Thu Aug 13 15:54:54 2015
@@ -1,4 +1,4 @@
-/* dag.c : DAG-like interface filesystem, private to libsvn_fs
+/* dag.c : DAG-like interface filesystem
*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
@@ -41,6 +41,7 @@
#include "svn_private_config.h"
#include "private/svn_temp_serializer.h"
#include "temp_serializer.h"
+#include "dag_cache.h"
/* Initializing a filesystem. */
@@ -50,34 +51,12 @@ struct dag_node_t
/* The filesystem this dag node came from. */
svn_fs_t *fs;
- /* The node revision ID for this dag node. */
- svn_fs_x__id_t id;
-
- /* In the special case that this node is the root of a transaction
- that has not yet been modified, the revision of this node is the
- respective txn's base rev. Otherwise, this is SVN_INVALID_REVNUM
- for txn nodes and the respective crev for committed nodes.
- (Used in svn_fs_node_created_rev.) */
- svn_revnum_t revision;
-
- /* The node's type (file, dir, etc.) */
- svn_node_kind_t kind;
-
- /* The node's NODE-REVISION, or NULL if we haven't read it in yet.
- This is allocated in this node's POOL.
-
- If you're willing to respect all the rules above, you can munge
- this yourself, but you're probably better off just calling
- `get_node_revision' and `set_node_revision', which take care of
- things for you. */
+ /* The node's NODE-REVISION. */
svn_fs_x__noderev_t *node_revision;
/* The pool to allocate NODE_REVISION in. */
apr_pool_t *node_pool;
- /* the path at which this node was created. */
- const char *created_path;
-
/* Directory entry lookup hint to speed up consecutive calls to
svn_fs_x__rep_contents_dir_entry(). Only used for directory nodes.
Any value is legal but should default to APR_SIZE_MAX. */
@@ -90,20 +69,20 @@ struct dag_node_t
svn_node_kind_t
svn_fs_x__dag_node_kind(dag_node_t *node)
{
- return node->kind;
+ return node->node_revision->kind;
}
const svn_fs_x__id_t *
svn_fs_x__dag_get_id(const dag_node_t *node)
{
- return &node->id;
+ return &node->node_revision->noderev_id;
}
const char *
svn_fs_x__dag_get_created_path(dag_node_t *node)
{
- return node->created_path;
+ return node->node_revision->created_path;
}
@@ -144,94 +123,35 @@ copy_node_revision(svn_fs_x__noderev_t *
}
-/* Set *NODEREV_P to the cached node-revision for NODE.
- If the node-revision was not already cached in NODE, read it in,
- allocating the cache in NODE->NODE_POOL.
-
- If you plan to change the contents of NODE, be careful! We're
- handing you a pointer directly to our cached node-revision, not
- your own copy. If you change it as part of some operation, but
- then some Berkeley DB function deadlocks or gets an error, you'll
- need to back out your changes, or else the cache will reflect
- changes that never got committed. It's probably best not to change
- the structure at all. */
-static svn_error_t *
-get_node_revision(svn_fs_x__noderev_t **noderev_p,
- dag_node_t *node)
-{
- /* If we've already got a copy, there's no need to read it in. */
- if (! node->node_revision)
- {
- svn_fs_x__noderev_t *noderev;
- apr_pool_t *scratch_pool = svn_pool_create(node->node_pool);
-
- SVN_ERR(svn_fs_x__get_node_revision(&noderev, node->fs, &node->id,
- node->node_pool, scratch_pool));
- node->node_revision = noderev;
- svn_pool_destroy(scratch_pool);
- }
-
- /* Now NODE->node_revision is set. */
- *noderev_p = node->node_revision;
- return SVN_NO_ERROR;
-}
-
-/* Return the node revision ID of NODE. The value returned is shared
- with NODE, and will be deallocated when NODE is. */
-svn_error_t *
-svn_fs_x__dag_get_node_id(svn_fs_x__id_t *node_id,
- dag_node_t *node)
+const svn_fs_x__id_t *
+svn_fs_x__dag_get_node_id(dag_node_t *node)
{
- svn_fs_x__noderev_t *noderev;
- SVN_ERR(get_node_revision(&noderev, node));
-
- *node_id = noderev->node_id;
- return SVN_NO_ERROR;
+ return &node->node_revision->node_id;
}
-/* Return the node revision ID of NODE. The value returned is shared
- with NODE, and will be deallocated when NODE is. */
-svn_error_t *
-svn_fs_x__dag_get_copy_id(svn_fs_x__id_t *copy_id,
- dag_node_t *node)
+const svn_fs_x__id_t *
+svn_fs_x__dag_get_copy_id(dag_node_t *node)
{
- svn_fs_x__noderev_t *noderev;
- SVN_ERR(get_node_revision(&noderev, node));
-
- *copy_id = noderev->copy_id;
- return SVN_NO_ERROR;
+ return &node->node_revision->copy_id;
}
-/* Return the node ID of NODE. The value returned is shared with NODE,
- and will be deallocated when NODE is. */
-svn_error_t *
-svn_fs_x__dag_related_node(svn_boolean_t *same,
- dag_node_t *lhs,
+svn_boolean_t
+svn_fs_x__dag_related_node(dag_node_t *lhs,
dag_node_t *rhs)
{
- svn_fs_x__id_t lhs_node, rhs_node;
-
- SVN_ERR(svn_fs_x__dag_get_node_id(&lhs_node, lhs));
- SVN_ERR(svn_fs_x__dag_get_node_id(&rhs_node, rhs));
- *same = svn_fs_x__id_eq(&lhs_node, &rhs_node);
-
- return SVN_NO_ERROR;
+ return svn_fs_x__id_eq(&lhs->node_revision->node_id,
+ &rhs->node_revision->node_id);
}
-svn_error_t *
-svn_fs_x__dag_same_line_of_history(svn_boolean_t *same,
- dag_node_t *lhs,
+svn_boolean_t
+svn_fs_x__dag_same_line_of_history(dag_node_t *lhs,
dag_node_t *rhs)
{
- svn_fs_x__noderev_t *lhs_noderev, *rhs_noderev;
-
- SVN_ERR(get_node_revision(&lhs_noderev, lhs));
- SVN_ERR(get_node_revision(&rhs_noderev, rhs));
-
- *same = svn_fs_x__id_eq(&lhs_noderev->node_id, &rhs_noderev->node_id)
- && svn_fs_x__id_eq(&lhs_noderev->copy_id, &rhs_noderev->copy_id);
+ svn_fs_x__noderev_t *lhs_noderev = lhs->node_revision;
+ svn_fs_x__noderev_t *rhs_noderev = rhs->node_revision;
- return SVN_NO_ERROR;
+ return svn_fs_x__id_eq(&lhs_noderev->node_id, &rhs_noderev->node_id)
+ && svn_fs_x__id_eq(&lhs_noderev->copy_id, &rhs_noderev->copy_id);
}
svn_boolean_t
@@ -240,7 +160,6 @@ svn_fs_x__dag_check_mutable(const dag_no
return svn_fs_x__is_txn(svn_fs_x__dag_get_id(node)->change_set);
}
-
svn_error_t *
svn_fs_x__dag_get_node(dag_node_t **node,
svn_fs_t *fs,
@@ -254,7 +173,6 @@ svn_fs_x__dag_get_node(dag_node_t **node
/* Construct the node. */
new_node = apr_pcalloc(result_pool, sizeof(*new_node));
new_node->fs = fs;
- new_node->id = *id;
new_node->hint = APR_SIZE_MAX;
/* Grab the contents so we can inspect the node's kind and created path. */
@@ -263,17 +181,6 @@ svn_fs_x__dag_get_node(dag_node_t **node
new_node->node_pool = result_pool;
new_node->node_revision = noderev;
- /* Initialize the KIND and CREATED_PATH attributes */
- new_node->kind = noderev->kind;
- new_node->created_path = noderev->created_path;
-
- /* Support our quirky svn_fs_node_created_rev API.
- Untouched txn roots report the base rev as theirs. */
- new_node->revision
- = ( svn_fs_x__is_fresh_txn_root(noderev)
- ? svn_fs_x__get_revnum(noderev->predecessor_id.change_set)
- : svn_fs_x__get_revnum(id->change_set));
-
/* Return a fresh new node */
*node = new_node;
return SVN_NO_ERROR;
@@ -283,76 +190,50 @@ svn_fs_x__dag_get_node(dag_node_t **node
svn_revnum_t
svn_fs_x__dag_get_revision(const dag_node_t *node)
{
- return node->revision;
+ svn_fs_x__noderev_t *noderev = node->node_revision;
+ return ( svn_fs_x__is_fresh_txn_root(noderev)
+ ? svn_fs_x__get_revnum(noderev->predecessor_id.change_set)
+ : svn_fs_x__get_revnum(noderev->noderev_id.change_set));
}
-
-svn_error_t *
-svn_fs_x__dag_get_predecessor_id(svn_fs_x__id_t *id_p,
- dag_node_t *node)
+const svn_fs_x__id_t *
+svn_fs_x__dag_get_predecessor_id(dag_node_t *node)
{
- svn_fs_x__noderev_t *noderev;
-
- SVN_ERR(get_node_revision(&noderev, node));
- *id_p = noderev->predecessor_id;
-
- return SVN_NO_ERROR;
+ return &node->node_revision->predecessor_id;
}
-
-svn_error_t *
-svn_fs_x__dag_get_predecessor_count(int *count,
- dag_node_t *node)
+int
+svn_fs_x__dag_get_predecessor_count(dag_node_t *node)
{
- svn_fs_x__noderev_t *noderev;
-
- SVN_ERR(get_node_revision(&noderev, node));
- *count = noderev->predecessor_count;
- return SVN_NO_ERROR;
+ return node->node_revision->predecessor_count;
}
-svn_error_t *
-svn_fs_x__dag_get_mergeinfo_count(apr_int64_t *count,
- dag_node_t *node)
+apr_int64_t
+svn_fs_x__dag_get_mergeinfo_count(dag_node_t *node)
{
- svn_fs_x__noderev_t *noderev;
-
- SVN_ERR(get_node_revision(&noderev, node));
- *count = noderev->mergeinfo_count;
- return SVN_NO_ERROR;
+ return node->node_revision->mergeinfo_count;
}
-svn_error_t *
-svn_fs_x__dag_has_mergeinfo(svn_boolean_t *has_mergeinfo,
- dag_node_t *node)
+svn_boolean_t
+svn_fs_x__dag_has_mergeinfo(dag_node_t *node)
{
- svn_fs_x__noderev_t *noderev;
-
- SVN_ERR(get_node_revision(&noderev, node));
- *has_mergeinfo = noderev->has_mergeinfo;
- return SVN_NO_ERROR;
+ return node->node_revision->has_mergeinfo;
}
-svn_error_t *
-svn_fs_x__dag_has_descendants_with_mergeinfo(svn_boolean_t *do_they,
- dag_node_t *node)
+svn_boolean_t
+svn_fs_x__dag_has_descendants_with_mergeinfo(dag_node_t *node)
{
- svn_fs_x__noderev_t *noderev;
+ svn_fs_x__noderev_t *noderev = node->node_revision;
- if (node->kind != svn_node_dir)
- {
- *do_they = FALSE;
- return SVN_NO_ERROR;
- }
+ if (noderev->kind != svn_node_dir)
+ return FALSE;
- SVN_ERR(get_node_revision(&noderev, node));
if (noderev->mergeinfo_count > 1)
- *do_they = TRUE;
+ return TRUE;
else if (noderev->mergeinfo_count == 1 && !noderev->has_mergeinfo)
- *do_they = TRUE;
- else
- *do_they = FALSE;
- return SVN_NO_ERROR;
+ return TRUE;
+
+ return FALSE;
}
@@ -362,16 +243,15 @@ svn_fs_x__dag_has_descendants_with_merge
/* Set *ID_P to the noderev-id for entry NAME in PARENT. If no such
entry, set *ID_P to NULL but do not error. */
-static svn_error_t *
-dir_entry_id_from_node(svn_fs_x__id_t *id_p,
+svn_error_t *
+svn_fs_x__dir_entry_id(svn_fs_x__id_t *id_p,
dag_node_t *parent,
const char *name,
apr_pool_t *scratch_pool)
{
svn_fs_x__dirent_t *dirent;
- svn_fs_x__noderev_t *noderev;
+ svn_fs_x__noderev_t *noderev = parent->node_revision;
- SVN_ERR(get_node_revision(&noderev, parent));
if (noderev->kind != svn_node_dir)
return svn_error_create(SVN_ERR_FS_NOT_DIRECTORY, NULL,
_("Can't get entries of non-directory"));
@@ -411,14 +291,16 @@ set_entry(dag_node_t *parent,
svn_fs_x__txn_id_t txn_id,
apr_pool_t *scratch_pool)
{
- svn_fs_x__noderev_t *parent_noderev;
-
- /* Get the parent's node-revision. */
- SVN_ERR(get_node_revision(&parent_noderev, parent));
+ svn_fs_x__noderev_t *parent_noderev = parent->node_revision;
/* Set the new entry. */
- return svn_fs_x__set_entry(parent->fs, txn_id, parent_noderev, name, id,
- kind, parent->node_pool, scratch_pool);
+ SVN_ERR(svn_fs_x__set_entry(parent->fs, txn_id, parent_noderev, name, id,
+ kind, parent->node_pool, scratch_pool));
+
+ /* Update cached data. */
+ svn_fs_x__update_dag_cache(parent);
+
+ return SVN_NO_ERROR;
}
@@ -439,7 +321,8 @@ make_entry(dag_node_t **child_p,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- svn_fs_x__noderev_t new_noderev, *parent_noderev;
+ svn_fs_x__noderev_t new_noderev;
+ svn_fs_x__noderev_t *parent_noderev = parent->node_revision;
/* Make sure that NAME is a single path component. */
if (! svn_path_is_single_path_component(name))
@@ -448,7 +331,7 @@ make_entry(dag_node_t **child_p,
_("Attempted to create a node with an illegal name '%s'"), name);
/* Make sure that parent is a directory */
- if (parent->kind != svn_node_dir)
+ if (parent_noderev->kind != svn_node_dir)
return svn_error_create
(SVN_ERR_FS_NOT_DIRECTORY, NULL,
_("Attempted to create entry in non-directory parent"));
@@ -464,7 +347,6 @@ make_entry(dag_node_t **child_p,
new_noderev.kind = is_dir ? svn_node_dir : svn_node_file;
new_noderev.created_path = svn_fspath__join(parent_path, name, result_pool);
- SVN_ERR(get_node_revision(&parent_noderev, parent));
new_noderev.copyroot_path = apr_pstrdup(result_pool,
parent_noderev->copyroot_path);
new_noderev.copyroot_rev = parent_noderev->copyroot_rev;
@@ -495,9 +377,7 @@ svn_fs_x__dag_dir_entries(apr_array_head
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- svn_fs_x__noderev_t *noderev;
-
- SVN_ERR(get_node_revision(&noderev, node));
+ svn_fs_x__noderev_t *noderev = node->node_revision;
if (noderev->kind != svn_node_dir)
return svn_error_create(SVN_ERR_FS_NOT_DIRECTORY, NULL,
@@ -517,7 +397,7 @@ svn_fs_x__dag_set_entry(dag_node_t *node
apr_pool_t *scratch_pool)
{
/* Check it's a directory. */
- if (node->kind != svn_node_dir)
+ if (node->node_revision->kind != svn_node_dir)
return svn_error_create
(SVN_ERR_FS_NOT_DIRECTORY, NULL,
_("Attempted to set entry in non-directory node"));
@@ -541,16 +421,8 @@ svn_fs_x__dag_get_proplist(apr_hash_t **
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- svn_fs_x__noderev_t *noderev;
- apr_hash_t *proplist = NULL;
-
- SVN_ERR(get_node_revision(&noderev, node));
-
- SVN_ERR(svn_fs_x__get_proplist(&proplist, node->fs, noderev, result_pool,
- scratch_pool));
-
- *proplist_p = proplist;
-
+ SVN_ERR(svn_fs_x__get_proplist(proplist_p, node->fs, node->node_revision,
+ result_pool, scratch_pool));
return SVN_NO_ERROR;
}
@@ -560,37 +432,51 @@ svn_fs_x__dag_set_proplist(dag_node_t *n
apr_hash_t *proplist,
apr_pool_t *scratch_pool)
{
- svn_fs_x__noderev_t *noderev;
-
/* Sanity check: this node better be mutable! */
if (! svn_fs_x__dag_check_mutable(node))
{
- svn_string_t *idstr = svn_fs_x__id_unparse(&node->id, scratch_pool);
+ svn_string_t *idstr
+ = svn_fs_x__id_unparse(&node->node_revision->noderev_id,
+ scratch_pool);
return svn_error_createf
(SVN_ERR_FS_NOT_MUTABLE, NULL,
"Can't set proplist on *immutable* node-revision %s",
idstr->data);
}
- /* Go get a fresh NODE-REVISION for this node. */
- SVN_ERR(get_node_revision(&noderev, node));
-
/* Set the new proplist. */
- return svn_fs_x__set_proplist(node->fs, noderev, proplist, scratch_pool);
+ SVN_ERR(svn_fs_x__set_proplist(node->fs, node->node_revision, proplist,
+ scratch_pool));
+ svn_fs_x__update_dag_cache(node);
+
+ return SVN_NO_ERROR;
}
+/* Write NODE's NODEREV element to disk. Update the DAG cache.
+ Use SCRATCH_POOL for temporary allocations. */
+static svn_error_t *
+noderev_changed(dag_node_t *node,
+ apr_pool_t *scratch_pool)
+{
+ SVN_ERR(svn_fs_x__put_node_revision(node->fs, node->node_revision,
+ scratch_pool));
+ svn_fs_x__update_dag_cache(node);
+
+ return SVN_NO_ERROR;
+}
svn_error_t *
svn_fs_x__dag_increment_mergeinfo_count(dag_node_t *node,
apr_int64_t increment,
apr_pool_t *scratch_pool)
{
- svn_fs_x__noderev_t *noderev;
+ svn_fs_x__noderev_t *noderev = node->node_revision;
/* Sanity check: this node better be mutable! */
if (! svn_fs_x__dag_check_mutable(node))
{
- svn_string_t *idstr = svn_fs_x__id_unparse(&node->id, scratch_pool);
+ svn_string_t *idstr = svn_fs_x__id_unparse(&noderev->noderev_id,
+ scratch_pool);
return svn_error_createf
(SVN_ERR_FS_NOT_MUTABLE, NULL,
"Can't increment mergeinfo count on *immutable* node-revision %s",
@@ -600,13 +486,11 @@ svn_fs_x__dag_increment_mergeinfo_count(
if (increment == 0)
return SVN_NO_ERROR;
- /* Go get a fresh NODE-REVISION for this node. */
- SVN_ERR(get_node_revision(&noderev, node));
-
noderev->mergeinfo_count += increment;
if (noderev->mergeinfo_count < 0)
{
- svn_string_t *idstr = svn_fs_x__id_unparse(&node->id, scratch_pool);
+ svn_string_t *idstr = svn_fs_x__id_unparse(&noderev->noderev_id,
+ scratch_pool);
return svn_error_createf
(SVN_ERR_FS_CORRUPT, NULL,
apr_psprintf(scratch_pool,
@@ -617,7 +501,8 @@ svn_fs_x__dag_increment_mergeinfo_count(
}
if (noderev->mergeinfo_count > 1 && noderev->kind == svn_node_file)
{
- svn_string_t *idstr = svn_fs_x__id_unparse(&node->id, scratch_pool);
+ svn_string_t *idstr = svn_fs_x__id_unparse(&noderev->noderev_id,
+ scratch_pool);
return svn_error_createf
(SVN_ERR_FS_CORRUPT, NULL,
apr_psprintf(scratch_pool,
@@ -628,7 +513,7 @@ svn_fs_x__dag_increment_mergeinfo_count(
}
/* Flush it out. */
- return svn_fs_x__put_node_revision(node->fs, noderev, scratch_pool);
+ return noderev_changed(node, scratch_pool);
}
svn_error_t *
@@ -636,55 +521,38 @@ svn_fs_x__dag_set_has_mergeinfo(dag_node
svn_boolean_t has_mergeinfo,
apr_pool_t *scratch_pool)
{
- svn_fs_x__noderev_t *noderev;
-
/* Sanity check: this node better be mutable! */
if (! svn_fs_x__dag_check_mutable(node))
{
- svn_string_t *idstr = svn_fs_x__id_unparse(&node->id, scratch_pool);
+ svn_string_t *idstr
+ = svn_fs_x__id_unparse(&node->node_revision->noderev_id,
+ scratch_pool);
return svn_error_createf
(SVN_ERR_FS_NOT_MUTABLE, NULL,
"Can't set mergeinfo flag on *immutable* node-revision %s",
idstr->data);
}
- /* Go get a fresh NODE-REVISION for this node. */
- SVN_ERR(get_node_revision(&noderev, node));
-
- noderev->has_mergeinfo = has_mergeinfo;
+ node->node_revision->has_mergeinfo = has_mergeinfo;
/* Flush it out. */
- return svn_fs_x__put_node_revision(node->fs, noderev, scratch_pool);
+ return noderev_changed(node, scratch_pool);
}
/*** Roots. ***/
svn_error_t *
-svn_fs_x__dag_revision_root(dag_node_t **node_p,
- svn_fs_t *fs,
- svn_revnum_t rev,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
-{
- svn_fs_x__id_t root_id;
-
- svn_fs_x__init_rev_root(&root_id, rev);
- return svn_fs_x__dag_get_node(node_p, fs, &root_id, result_pool,
- scratch_pool);
-}
-
-
-svn_error_t *
-svn_fs_x__dag_txn_root(dag_node_t **node_p,
- svn_fs_t *fs,
- svn_fs_x__txn_id_t txn_id,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
+svn_fs_x__dag_root(dag_node_t **node_p,
+ svn_fs_t *fs,
+ svn_fs_x__change_set_t change_set,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
svn_fs_x__id_t root_id;
+ root_id.change_set = change_set;
+ root_id.number = SVN_FS_X__ITEM_INDEX_ROOT_NODE;
- svn_fs_x__init_txn_root(&root_id, txn_id);
return svn_fs_x__dag_get_node(node_p, fs, &root_id, result_pool,
scratch_pool);
}
@@ -734,14 +602,11 @@ svn_fs_x__dag_clone_child(dag_node_t **c
}
else
{
- svn_fs_x__noderev_t *noderev, *parent_noderev;
-
- /* Go get a fresh NODE-REVISION for current child node. */
- SVN_ERR(get_node_revision(&noderev, cur_entry));
+ svn_fs_x__noderev_t *noderev = cur_entry->node_revision;
if (is_parent_copyroot)
{
- SVN_ERR(get_node_revision(&parent_noderev, parent));
+ svn_fs_x__noderev_t *parent_noderev = parent->node_revision;
noderev->copyroot_rev = parent_noderev->copyroot_rev;
noderev->copyroot_path = apr_pstrdup(scratch_pool,
parent_noderev->copyroot_path);
@@ -796,7 +661,7 @@ delete_if_mutable(svn_fs_t *fs,
return SVN_NO_ERROR;
/* Else it's mutable. Recurse on directories... */
- if (node->kind == svn_node_dir)
+ if (node->node_revision->kind == svn_node_dir)
{
apr_array_header_t *entries;
int i;
@@ -829,13 +694,13 @@ svn_fs_x__dag_delete(dag_node_t *parent,
svn_fs_x__txn_id_t txn_id,
apr_pool_t *scratch_pool)
{
- svn_fs_x__noderev_t *parent_noderev;
+ svn_fs_x__noderev_t *parent_noderev = parent->node_revision;
svn_fs_t *fs = parent->fs;
svn_fs_x__dirent_t *dirent;
apr_pool_t *subpool;
/* Make sure parent is a directory. */
- if (parent->kind != svn_node_dir)
+ if (parent_noderev->kind != svn_node_dir)
return svn_error_createf
(SVN_ERR_FS_NOT_DIRECTORY, NULL,
"Attempted to delete entry '%s' from *non*-directory node", name);
@@ -852,9 +717,9 @@ svn_fs_x__dag_delete(dag_node_t *parent,
(SVN_ERR_FS_NOT_SINGLE_PATH_COMPONENT, NULL,
"Attempted to delete a node with an illegal name '%s'", name);
- /* Get a fresh NODE-REVISION for the parent node. */
- SVN_ERR(get_node_revision(&parent_noderev, parent));
-
+ /* We allocate a few potentially heavy temporary objects (file buffers
+ and directories). Make sure we don't keep them around for longer
+ than necessary. */
subpool = svn_pool_create(scratch_pool);
/* Search this directory for a dirent with that NAME. */
@@ -871,13 +736,13 @@ svn_fs_x__dag_delete(dag_node_t *parent,
"Delete failed--directory has no entry '%s'", name);
/* If mutable, remove it and any mutable children from db. */
- SVN_ERR(delete_if_mutable(parent->fs, &dirent->id, scratch_pool));
- svn_pool_destroy(subpool);
+ SVN_ERR(delete_if_mutable(parent->fs, &dirent->id, subpool));
/* Remove this entry from its parent's entries list. */
- return svn_fs_x__set_entry(parent->fs, txn_id, parent_noderev, name,
- NULL, svn_node_unknown, parent->node_pool,
- scratch_pool);
+ SVN_ERR(set_entry(parent, name, NULL, svn_node_unknown, txn_id, subpool));
+
+ svn_pool_destroy(subpool);
+ return SVN_NO_ERROR;
}
@@ -916,23 +781,16 @@ svn_fs_x__dag_get_contents(svn_stream_t
dag_node_t *file,
apr_pool_t *result_pool)
{
- svn_fs_x__noderev_t *noderev;
- svn_stream_t *contents;
-
/* Make sure our node is a file. */
- if (file->kind != svn_node_file)
+ if (file->node_revision->kind != svn_node_file)
return svn_error_createf
(SVN_ERR_FS_NOT_FILE, NULL,
"Attempted to get textual contents of a *non*-file node");
- /* Go get a fresh node-revision for FILE. */
- SVN_ERR(get_node_revision(&noderev, file));
-
/* Get a stream to the contents. */
- SVN_ERR(svn_fs_x__get_contents(&contents, file->fs,
- noderev->data_rep, TRUE, result_pool));
-
- *contents_p = contents;
+ SVN_ERR(svn_fs_x__get_contents(contents_p, file->fs,
+ file->node_revision->data_rep, TRUE,
+ result_pool));
return SVN_NO_ERROR;
}
@@ -945,23 +803,16 @@ svn_fs_x__dag_get_file_delta_stream(svn_
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- svn_fs_x__noderev_t *src_noderev;
- svn_fs_x__noderev_t *tgt_noderev;
+ svn_fs_x__noderev_t *src_noderev = source ? source->node_revision : NULL;
+ svn_fs_x__noderev_t *tgt_noderev = target->node_revision;
/* Make sure our nodes are files. */
- if ((source && source->kind != svn_node_file)
- || target->kind != svn_node_file)
+ if ((source && src_noderev->kind != svn_node_file)
+ || tgt_noderev->kind != svn_node_file)
return svn_error_createf
(SVN_ERR_FS_NOT_FILE, NULL,
"Attempted to get textual contents of a *non*-file node");
- /* Go get fresh node-revisions for the nodes. */
- if (source)
- SVN_ERR(get_node_revision(&src_noderev, source));
- else
- src_noderev = NULL;
- SVN_ERR(get_node_revision(&tgt_noderev, target));
-
/* Get the delta stream. */
return svn_fs_x__get_file_delta_stream(stream_p, target->fs,
src_noderev, tgt_noderev,
@@ -976,13 +827,8 @@ svn_fs_x__dag_try_process_file_contents(
void* baton,
apr_pool_t *scratch_pool)
{
- svn_fs_x__noderev_t *noderev;
-
- /* Go get fresh node-revisions for the nodes. */
- SVN_ERR(get_node_revision(&noderev, node));
-
return svn_fs_x__try_process_file_contents(success, node->fs,
- noderev,
+ node->node_revision,
processor, baton, scratch_pool);
}
@@ -991,18 +837,13 @@ svn_error_t *
svn_fs_x__dag_file_length(svn_filesize_t *length,
dag_node_t *file)
{
- svn_fs_x__noderev_t *noderev;
-
/* Make sure our node is a file. */
- if (file->kind != svn_node_file)
+ if (file->node_revision->kind != svn_node_file)
return svn_error_createf
(SVN_ERR_FS_NOT_FILE, NULL,
"Attempted to get length of a *non*-file node");
- /* Go get a fresh node-revision for FILE, and . */
- SVN_ERR(get_node_revision(&noderev, file));
-
- return svn_fs_x__file_length(length, noderev);
+ return svn_fs_x__file_length(length, file->node_revision);
}
@@ -1012,16 +853,13 @@ svn_fs_x__dag_file_checksum(svn_checksum
svn_checksum_kind_t kind,
apr_pool_t *result_pool)
{
- svn_fs_x__noderev_t *noderev;
-
- if (file->kind != svn_node_file)
+ if (file->node_revision->kind != svn_node_file)
return svn_error_createf
(SVN_ERR_FS_NOT_FILE, NULL,
"Attempted to get checksum of a *non*-file node");
- SVN_ERR(get_node_revision(&noderev, file));
-
- return svn_fs_x__file_checksum(checksum, noderev, kind, result_pool);
+ return svn_fs_x__file_checksum(checksum, file->node_revision, kind,
+ result_pool);
}
@@ -1030,11 +868,8 @@ svn_fs_x__dag_get_edit_stream(svn_stream
dag_node_t *file,
apr_pool_t *result_pool)
{
- svn_fs_x__noderev_t *noderev;
- svn_stream_t *ws;
-
/* Make sure our node is a file. */
- if (file->kind != svn_node_file)
+ if (file->node_revision->kind != svn_node_file)
return svn_error_createf
(SVN_ERR_FS_NOT_FILE, NULL,
"Attempted to set textual contents of a *non*-file node");
@@ -1045,13 +880,8 @@ svn_fs_x__dag_get_edit_stream(svn_stream
(SVN_ERR_FS_NOT_MUTABLE, NULL,
"Attempted to set textual contents of an immutable node");
- /* Get the node revision. */
- SVN_ERR(get_node_revision(&noderev, file));
-
- SVN_ERR(svn_fs_x__set_contents(&ws, file->fs, noderev, result_pool));
-
- *contents = ws;
-
+ SVN_ERR(svn_fs_x__set_contents(contents, file->fs, file->node_revision,
+ result_pool));
return SVN_NO_ERROR;
}
@@ -1072,9 +902,10 @@ svn_fs_x__dag_finalize_edits(dag_node_t
return svn_checksum_mismatch_err(checksum, file_checksum,
scratch_pool,
_("Checksum mismatch for '%s'"),
- file->created_path);
+ file->node_revision->created_path);
}
+ svn_fs_x__update_dag_cache(file);
return SVN_NO_ERROR;
}
@@ -1086,101 +917,14 @@ svn_fs_x__dag_dup(const dag_node_t *node
/* Allocate our new node. */
dag_node_t *new_node = apr_pmemdup(result_pool, node, sizeof(*new_node));
- /* Only copy cached svn_fs_x__noderev_t for immutable nodes. */
- if (node->node_revision && !svn_fs_x__dag_check_mutable(node))
- {
- new_node->node_revision = copy_node_revision(node->node_revision,
- result_pool);
- new_node->created_path = new_node->node_revision->created_path;
- }
- else
- {
- new_node->node_revision = NULL;
- new_node->created_path = apr_pstrdup(result_pool, node->created_path);
- }
-
+ /* Copy sub-structures. */
+ new_node->node_revision = copy_node_revision(node->node_revision,
+ result_pool);
new_node->node_pool = result_pool;
return new_node;
}
-dag_node_t *
-svn_fs_x__dag_copy_into_pool(dag_node_t *node,
- apr_pool_t *result_pool)
-{
- return (node->node_pool == result_pool
- ? node
- : svn_fs_x__dag_dup(node, result_pool));
-}
-
-svn_error_t *
-svn_fs_x__dag_serialize(void **data,
- apr_size_t *data_len,
- void *in,
- apr_pool_t *pool)
-{
- dag_node_t *node = in;
- svn_stringbuf_t *serialized;
-
- /* create an serialization context and serialize the dag node as root */
- svn_temp_serializer__context_t *context =
- svn_temp_serializer__init(node,
- sizeof(*node),
- 1024 - SVN_TEMP_SERIALIZER__OVERHEAD,
- pool);
-
- /* for mutable nodes, we will _never_ cache the noderev */
- if (node->node_revision && !svn_fs_x__dag_check_mutable(node))
- {
- svn_fs_x__noderev_serialize(context, &node->node_revision);
- }
- else
- {
- svn_temp_serializer__set_null(context,
- (const void * const *)&node->node_revision);
- svn_temp_serializer__add_string(context, &node->created_path);
- }
-
- /* The deserializer will use its own pool. */
- svn_temp_serializer__set_null(context,
- (const void * const *)&node->node_pool);
-
- /* return serialized data */
- serialized = svn_temp_serializer__get(context);
- *data = serialized->data;
- *data_len = serialized->len;
-
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_fs_x__dag_deserialize(void **out,
- void *data,
- apr_size_t data_len,
- apr_pool_t *pool)
-{
- dag_node_t *node = (dag_node_t *)data;
- if (data_len == 0)
- return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
- _("Empty noderev in cache"));
-
- /* Copy the _full_ buffer as it also contains the sub-structures. */
- node->fs = NULL;
-
- /* fixup all references to sub-structures */
- svn_fs_x__noderev_deserialize(node, &node->node_revision, pool);
- node->node_pool = pool;
-
- if (node->node_revision)
- node->created_path = node->node_revision->created_path;
- else
- svn_temp_deserializer__resolve(node, (void**)&node->created_path);
-
- /* return result */
- *out = node;
-
- return SVN_NO_ERROR;
-}
svn_error_t *
svn_fs_x__dag_open(dag_node_t **child_p,
@@ -1192,7 +936,7 @@ svn_fs_x__dag_open(dag_node_t **child_p,
svn_fs_x__id_t node_id;
/* Ensure that NAME exists in PARENT's entry list. */
- SVN_ERR(dir_entry_id_from_node(&node_id, parent, name, scratch_pool));
+ SVN_ERR(svn_fs_x__dir_entry_id(&node_id, parent, name, scratch_pool));
if (! svn_fs_x__id_used(&node_id))
{
*child_p = NULL;
@@ -1219,13 +963,12 @@ svn_fs_x__dag_copy(dag_node_t *to_node,
if (preserve_history)
{
- svn_fs_x__noderev_t *from_noderev, *to_noderev;
+ svn_fs_x__noderev_t *to_noderev;
svn_fs_x__id_t copy_id;
svn_fs_t *fs = svn_fs_x__dag_get_fs(from_node);
/* Make a copy of the original node revision. */
- SVN_ERR(get_node_revision(&from_noderev, from_node));
- to_noderev = copy_node_revision(from_noderev, scratch_pool);
+ to_noderev = copy_node_revision(from_node->node_revision, scratch_pool);
/* Reserve a copy ID for this new copy. */
SVN_ERR(svn_fs_x__reserve_copy_id(©_id, fs, txn_id, scratch_pool));
@@ -1253,7 +996,8 @@ svn_fs_x__dag_copy(dag_node_t *to_node,
}
/* Set the entry in to_node to the new id. */
- return svn_fs_x__dag_set_entry(to_node, entry, id, from_node->kind,
+ return svn_fs_x__dag_set_entry(to_node, entry, id,
+ from_node->node_revision->kind,
txn_id, scratch_pool);
}
@@ -1269,7 +1013,8 @@ svn_fs_x__dag_things_different(svn_boole
svn_boolean_t strict,
apr_pool_t *scratch_pool)
{
- svn_fs_x__noderev_t *noderev1, *noderev2;
+ svn_fs_x__noderev_t *noderev1 = node1->node_revision;
+ svn_fs_x__noderev_t *noderev2 = node2->node_revision;
svn_fs_t *fs;
svn_boolean_t same;
@@ -1280,10 +1025,6 @@ svn_fs_x__dag_things_different(svn_boole
fs = svn_fs_x__dag_get_fs(node1);
- /* The node revision skels for these two nodes. */
- SVN_ERR(get_node_revision(&noderev1, node1));
- SVN_ERR(get_node_revision(&noderev2, node2));
-
/* Compare property keys. */
if (props_changed != NULL)
{
@@ -1300,48 +1041,25 @@ svn_fs_x__dag_things_different(svn_boole
return SVN_NO_ERROR;
}
-svn_error_t *
+void
svn_fs_x__dag_get_copyroot(svn_revnum_t *rev,
const char **path,
dag_node_t *node)
{
- svn_fs_x__noderev_t *noderev;
-
- /* Go get a fresh node-revision for NODE. */
- SVN_ERR(get_node_revision(&noderev, node));
-
- *rev = noderev->copyroot_rev;
- *path = noderev->copyroot_path;
-
- return SVN_NO_ERROR;
+ *rev = node->node_revision->copyroot_rev;
+ *path = node->node_revision->copyroot_path;
}
-svn_error_t *
-svn_fs_x__dag_get_copyfrom_rev(svn_revnum_t *rev,
- dag_node_t *node)
+svn_revnum_t
+svn_fs_x__dag_get_copyfrom_rev(dag_node_t *node)
{
- svn_fs_x__noderev_t *noderev;
-
- /* Go get a fresh node-revision for NODE. */
- SVN_ERR(get_node_revision(&noderev, node));
-
- *rev = noderev->copyfrom_rev;
-
- return SVN_NO_ERROR;
+ return node->node_revision->copyfrom_rev;
}
-svn_error_t *
-svn_fs_x__dag_get_copyfrom_path(const char **path,
- dag_node_t *node)
+const char *
+svn_fs_x__dag_get_copyfrom_path(dag_node_t *node)
{
- svn_fs_x__noderev_t *noderev;
-
- /* Go get a fresh node-revision for NODE. */
- SVN_ERR(get_node_revision(&noderev, node));
-
- *path = noderev->copyfrom_path;
-
- return SVN_NO_ERROR;
+ return node->node_revision->copyfrom_path;
}
svn_error_t *
@@ -1349,20 +1067,17 @@ svn_fs_x__dag_update_ancestry(dag_node_t
dag_node_t *source,
apr_pool_t *scratch_pool)
{
- svn_fs_x__noderev_t *source_noderev, *target_noderev;
+ svn_fs_x__noderev_t *source_noderev = source->node_revision;
+ svn_fs_x__noderev_t *target_noderev = target->node_revision;
if (! svn_fs_x__dag_check_mutable(target))
return svn_error_createf
(SVN_ERR_FS_NOT_MUTABLE, NULL,
_("Attempted to update ancestry of non-mutable node"));
- SVN_ERR(get_node_revision(&source_noderev, source));
- SVN_ERR(get_node_revision(&target_noderev, target));
-
target_noderev->predecessor_id = source_noderev->noderev_id;
target_noderev->predecessor_count = source_noderev->predecessor_count;
target_noderev->predecessor_count++;
- return svn_fs_x__put_node_revision(target->fs, target_noderev,
- scratch_pool);
+ return noderev_changed(target, scratch_pool);
}
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/dag.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/dag.h?rev=1695730&r1=1695729&r2=1695730&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/dag.h (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/dag.h Thu Aug 13 15:54:54 2015
@@ -1,4 +1,4 @@
-/* dag.h : DAG-like interface filesystem, private to libsvn_fs
+/* dag.h : DAG-like interface filesystem
*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
@@ -20,8 +20,8 @@
* ====================================================================
*/
-#ifndef SVN_LIBSVN_FS_DAG_H
-#define SVN_LIBSVN_FS_DAG_H
+#ifndef SVN_LIBSVN_FS_X_DAG_H
+#define SVN_LIBSVN_FS_X_DAG_H
#include "svn_fs.h"
#include "svn_delta.h"
@@ -82,28 +82,6 @@ dag_node_t *
svn_fs_x__dag_dup(const dag_node_t *node,
apr_pool_t *result_pool);
-/* If NODE has been allocated in POOL, return NODE. Otherwise, return
- a copy created in RESULT_POOL with svn_fs_fs__dag_dup. */
-dag_node_t *
-svn_fs_x__dag_copy_into_pool(dag_node_t *node,
- apr_pool_t *result_pool);
-
-/* Serialize a DAG node, except don't try to preserve the 'fs' member.
- Implements svn_cache__serialize_func_t */
-svn_error_t *
-svn_fs_x__dag_serialize(void **data,
- apr_size_t *data_len,
- void *in,
- apr_pool_t *pool);
-
-/* Deserialize a DAG node, leaving the 'fs' member as NULL.
- Implements svn_cache__deserialize_func_t */
-svn_error_t *
-svn_fs_x__dag_deserialize(void **out,
- void *data,
- apr_size_t data_len,
- apr_pool_t *pool);
-
/* Return the filesystem containing NODE. */
svn_fs_t *
svn_fs_x__dag_get_fs(dag_node_t *node);
@@ -128,27 +106,23 @@ svn_fs_x__dag_get_id(const dag_node_t *n
/* Return the node ID of NODE. The value returned is shared with NODE,
and will be deallocated when NODE is. */
-svn_error_t *
-svn_fs_x__dag_get_node_id(svn_fs_x__id_t *node_id,
- dag_node_t *node);
+const svn_fs_x__id_t *
+svn_fs_x__dag_get_node_id(dag_node_t *node);
/* Return the copy ID of NODE. The value returned is shared with NODE,
and will be deallocated when NODE is. */
-svn_error_t *
-svn_fs_x__dag_get_copy_id(svn_fs_x__id_t *copy_id,
- dag_node_t *node);
+const svn_fs_x__id_t *
+svn_fs_x__dag_get_copy_id(dag_node_t *node);
-/* Set *SAME to TRUE, if nodes LHS and RHS have the same node ID. */
-svn_error_t *
-svn_fs_x__dag_related_node(svn_boolean_t *same,
- dag_node_t *lhs,
+/* Return TRUE, iff nodes LHS and RHS have the same node ID. */
+svn_boolean_t
+svn_fs_x__dag_related_node(dag_node_t *lhs,
dag_node_t *rhs);
-/* Set *SAME to TRUE, if nodes LHS and RHS have the same node and copy IDs.
+/* Return TRUE, iff nodes LHS and RHS have the same node and copy IDs.
*/
-svn_error_t *
-svn_fs_x__dag_same_line_of_history(svn_boolean_t *same,
- dag_node_t *lhs,
+svn_boolean_t
+svn_fs_x__dag_same_line_of_history(dag_node_t *lhs,
dag_node_t *rhs);
/* Return the created path of NODE. The value returned is shared
@@ -157,41 +131,31 @@ const char *
svn_fs_x__dag_get_created_path(dag_node_t *node);
-/* Set *ID_P to the node revision ID of NODE's immediate predecessor.
+/* Return the node revision ID of NODE's immediate predecessor.
*/
-svn_error_t *
-svn_fs_x__dag_get_predecessor_id(svn_fs_x__id_t *id_p,
- dag_node_t *node);
-
+const svn_fs_x__id_t *
+svn_fs_x__dag_get_predecessor_id(dag_node_t *node);
-/* Set *COUNT to the number of predecessors NODE has (recursively).
+/* Return the number of predecessors NODE has (recursively).
*/
-/* ### This function is currently only used by 'verify'. */
-svn_error_t *
-svn_fs_x__dag_get_predecessor_count(int *count,
- dag_node_t *node);
+int
+svn_fs_x__dag_get_predecessor_count(dag_node_t *node);
-/* Set *COUNT to the number of node under NODE (inclusive) with
- svn:mergeinfo properties.
+/* Return the number of node under NODE (inclusive) with svn:mergeinfo
+ properties.
*/
-svn_error_t *
-svn_fs_x__dag_get_mergeinfo_count(apr_int64_t *count,
- dag_node_t *node);
+apr_int64_t
+svn_fs_x__dag_get_mergeinfo_count(dag_node_t *node);
-/* Set *DO_THEY to a flag indicating whether or not NODE is a
- directory with at least one descendant (not including itself) with
- svn:mergeinfo.
+/* Return TRUE, iff NODE is a directory with at least one descendant (not
+ including itself) with svn:mergeinfo.
*/
-svn_error_t *
-svn_fs_x__dag_has_descendants_with_mergeinfo(svn_boolean_t *do_they,
- dag_node_t *node);
+svn_boolean_t
+svn_fs_x__dag_has_descendants_with_mergeinfo(dag_node_t *node);
-/* Set *HAS_MERGEINFO to a flag indicating whether or not NODE itself
- has svn:mergeinfo set on it.
- */
-svn_error_t *
-svn_fs_x__dag_has_mergeinfo(svn_boolean_t *has_mergeinfo,
- dag_node_t *node);
+/* Return TRUE, iff NODE itself has svn:mergeinfo set on it. */
+svn_boolean_t
+svn_fs_x__dag_has_mergeinfo(dag_node_t *node);
/* Return non-zero IFF NODE is currently mutable. */
svn_boolean_t
@@ -252,25 +216,15 @@ svn_fs_x__dag_set_has_mergeinfo(dag_node
/* Revision and transaction roots. */
-/* Open the root of revision REV of filesystem FS, allocating from
+/* Open the root of change set CHANGE_SET of filesystem FS, allocating from
RESULT_POOL. Set *NODE_P to the new node. Use SCRATCH_POOL for
temporary allocations.*/
svn_error_t *
-svn_fs_x__dag_revision_root(dag_node_t **node_p,
- svn_fs_t *fs,
- svn_revnum_t rev,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool);
-
-
-/* Set *NODE_P to the root of transaction TXN_ID in FS, allocating
- from RESULT_POOL. Use SCRATCH_POOL for temporary allocations. */
-svn_error_t *
-svn_fs_x__dag_txn_root(dag_node_t **node_p,
- svn_fs_t *fs,
- svn_fs_x__txn_id_t txn_id,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool);
+svn_fs_x__dag_root(dag_node_t **node_p,
+ svn_fs_t *fs,
+ svn_fs_x__change_set_t change_set,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
/* Directories. */
@@ -289,6 +243,14 @@ svn_fs_x__dag_open(dag_node_t **child_p,
apr_pool_t *scratch_pool);
+/* Set *ID_P to the noderev-id for entry NAME in PARENT. If no such
+ entry exists, set *ID_P to "unused" but do not error. */
+svn_error_t *
+svn_fs_x__dir_entry_id(svn_fs_x__id_t *id_p,
+ dag_node_t *parent,
+ const char *name,
+ apr_pool_t *scratch_pool);
+
/* Set *ENTRIES_P to an array of NODE's entries, sorted by entry names,
and the values are svn_fs_x__dirent_t. The returned table (and elements)
is allocated in RESULT_POOL, temporaries in SCRATCH_POOL. */
@@ -548,22 +510,20 @@ svn_fs_x__dag_things_different(svn_boole
/* Set *REV and *PATH to the copyroot revision and path of node NODE, or
to SVN_INVALID_REVNUM and NULL if no copyroot exists.
*/
-svn_error_t *
+void
svn_fs_x__dag_get_copyroot(svn_revnum_t *rev,
const char **path,
dag_node_t *node);
-/* Set *REV to the copyfrom revision associated with NODE.
+/* Return the copyfrom revision associated with NODE.
*/
-svn_error_t *
-svn_fs_x__dag_get_copyfrom_rev(svn_revnum_t *rev,
- dag_node_t *node);
+svn_revnum_t
+svn_fs_x__dag_get_copyfrom_rev(dag_node_t *node);
-/* Set *PATH to the copyfrom path associated with NODE.
+/* Return the copyfrom path associated with NODE.
*/
-svn_error_t *
-svn_fs_x__dag_get_copyfrom_path(const char **path,
- dag_node_t *node);
+const char *
+svn_fs_x__dag_get_copyfrom_path(dag_node_t *node);
/* Update *TARGET so that SOURCE is it's predecessor.
@@ -577,4 +537,4 @@ svn_fs_x__dag_update_ancestry(dag_node_t
}
#endif /* __cplusplus */
-#endif /* SVN_LIBSVN_FS_DAG_H */
+#endif /* SVN_LIBSVN_FS_X_DAG_H */
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs.c?rev=1695730&r1=1695729&r2=1695730&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs.c Thu Aug 13 15:54:54 2015
@@ -32,6 +32,7 @@
#include "svn_delta.h"
#include "svn_version.h"
#include "svn_pools.h"
+#include "batch_fsync.h"
#include "fs.h"
#include "fs_x.h"
#include "pack.h"
@@ -663,6 +664,8 @@ svn_fs_x__init(const svn_version_t *load
loader_version->major);
SVN_ERR(svn_ver_check_list2(x_version(), checklist, svn_ver_equal));
+ SVN_ERR(svn_fs_x__batch_fsync_init());
+
*vtable = &library_vtable;
return SVN_NO_ERROR;
}
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs.h?rev=1695730&r1=1695729&r2=1695730&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs.h (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs.h Thu Aug 13 15:54:54 2015
@@ -1,4 +1,4 @@
-/* fs.h : interface to Subversion filesystem, private to libsvn_fs
+/* fs.h : interface to Subversion filesystem
*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
@@ -20,8 +20,8 @@
* ====================================================================
*/
-#ifndef SVN_LIBSVN_FS_X_H
-#define SVN_LIBSVN_FS_X_H
+#ifndef SVN_LIBSVN_FS_X_FS_H
+#define SVN_LIBSVN_FS_X_FS_H
#include <apr_pools.h>
#include <apr_hash.h>
@@ -53,14 +53,14 @@ extern "C" {
#define PATH_FORMAT "format" /* Contains format number */
#define PATH_UUID "uuid" /* Contains UUID */
#define PATH_CURRENT "current" /* Youngest revision */
+#define PATH_NEXT "next" /* Revision begin written. */
#define PATH_LOCK_FILE "write-lock" /* Revision lock file */
#define PATH_PACK_LOCK_FILE "pack-lock" /* Pack lock file */
#define PATH_REVS_DIR "revs" /* Directory of revisions */
-#define PATH_REVPROPS_DIR "revprops" /* Directory of revprops */
#define PATH_TXNS_DIR "transactions" /* Directory of transactions */
-#define PATH_NODE_ORIGINS_DIR "node-origins" /* Lazy node-origin cache */
#define PATH_TXN_PROTOS_DIR "txn-protorevs" /* Directory of proto-revs */
#define PATH_TXN_CURRENT "txn-current" /* File with next txn key */
+#define PATH_TXN_NEXT "txn-next" /* Will become txn-current */
#define PATH_TXN_CURRENT_LOCK "txn-current-lock" /* Lock for txn-current */
#define PATH_LOCKS_DIR "locks" /* Directory of locks */
#define PATH_MIN_UNPACKED_REV "min-unpacked-rev" /* Oldest revision which
@@ -81,8 +81,6 @@ extern "C" {
/* Names of special files and file extensions for transactions */
#define PATH_CHANGES "changes" /* Records changes made so far */
#define PATH_TXN_PROPS "props" /* Transaction properties */
-#define PATH_TXN_PROPS_FINAL "props-final" /* Final transaction properties
- before moving to revprops */
#define PATH_NEXT_IDS "next-ids" /* Next temporary ID assignments */
#define PATH_PREFIX_NODE "node." /* Prefix for node filename */
#define PATH_EXT_TXN ".txn" /* Extension of txn dir */
@@ -124,7 +122,11 @@ extern "C" {
Note: If you bump this, please update the switch statement in
svn_fs_x__create() as well.
*/
-#define SVN_FS_X__FORMAT_NUMBER 1
+#define SVN_FS_X__FORMAT_NUMBER 2
+
+/* Latest experimental format number. Experimental formats are only
+ compatible with themselves. */
+#define SVN_FS_X__EXPERIMENTAL_FORMAT_NUMBER 2
/* On most operating systems apr implements file locks per process, not
per file. On Windows apr implements the locking as per file handle
@@ -179,11 +181,15 @@ typedef struct svn_fs_x__shared_data_t
declaration here. Any subset may be acquired and held at any given
time but their relative acquisition order must not change.
- (lock 'txn-current' before 'pack' before 'write' before 'txn-list') */
+ (lock 'pack' before 'write' before 'txn-current' before 'txn-list') */
/* A lock for intra-process synchronization when accessing the TXNS list. */
svn_mutex__t *txn_list_lock;
+ /* A lock for intra-process synchronization when locking the
+ txn-current file. */
+ svn_mutex__t *txn_current_lock;
+
/* A lock for intra-process synchronization when grabbing the
repository write lock. */
svn_mutex__t *fs_write_lock;
@@ -192,10 +198,6 @@ typedef struct svn_fs_x__shared_data_t
repository pack operation lock. */
svn_mutex__t *fs_pack_lock;
- /* A lock for intra-process synchronization when locking the
- txn-current file. */
- svn_mutex__t *txn_current_lock;
-
/* The common pool, under which this object is allocated, subpools
of which are used to allocate the transaction objects. */
apr_pool_t *common_pool;
@@ -281,13 +283,9 @@ typedef struct svn_fs_x__data_t
e.g. memcached may be ignored as caching is an optional feature. */
svn_boolean_t fail_stop;
- /* Caches native dag_node_t* instances and acts as a 1st level cache */
+ /* Caches native dag_node_t* instances */
svn_fs_x__dag_cache_t *dag_node_cache;
- /* DAG node cache for immutable nodes. Maps (revision, fspath)
- to (dag_node_t *). This is the 2nd level cache for DAG nodes. */
- svn_cache__t *rev_node_cache;
-
/* A cache of the contents of immutable directories; maps from
unparsed FS ID to a apr_hash_t * mapping (const char *) dirent
names to (svn_fs_x__dirent_t *). */
@@ -307,12 +305,6 @@ typedef struct svn_fs_x__data_t
/* Node properties cache. Maps from rep key to apr_hash_t. */
svn_cache__t *properties_cache;
- /* Pack manifest cache; a cache mapping (svn_revnum_t) shard number to
- a manifest; and a manifest is a mapping from (svn_revnum_t) revision
- number offset within a shard to (apr_off_t) byte-offset in the
- respective pack file. */
- svn_cache__t *packed_offset_cache;
-
/* Cache for txdelta_window_t objects;
* the key is svn_fs_x__window_cache_key_t */
svn_cache__t *txdelta_window_cache;
@@ -345,15 +337,6 @@ typedef struct svn_fs_x__data_t
(revision, item index) pair */
svn_cache__t *rep_header_cache;
- /* Cache for svn_mergeinfo_t objects; the key is a combination of
- revision, inheritance flags and path. */
- svn_cache__t *mergeinfo_cache;
-
- /* Cache for presence of svn_mergeinfo_t on a noderev; the key is a
- combination of revision, inheritance flags and path; value is "1"
- if the node has mergeinfo, "0" if it doesn't. */
- svn_cache__t *mergeinfo_existence_cache;
-
/* Cache for l2p_header_t objects; the key is (revision, is-packed).
Will be NULL for pre-format7 repos */
svn_cache__t *l2p_header_cache;
@@ -420,6 +403,10 @@ typedef struct svn_fs_x__data_t
/* Pointer to svn_fs_open. */
svn_error_t *(*svn_fs_open_)(svn_fs_t **, const char *, apr_hash_t *,
apr_pool_t *, apr_pool_t *);
+
+ /* If not 0, this is a pre-allocated transaction ID that can just be
+ used for a new txn without needing to consult 'txn-current'. */
+ apr_uint64_t next_txn_id;
} svn_fs_x__data_t;
@@ -571,4 +558,4 @@ typedef struct svn_fs_x__change_t
}
#endif /* __cplusplus */
-#endif /* SVN_LIBSVN_FS_X_H */
+#endif /* SVN_LIBSVN_FS_X_FS_H */
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.c?rev=1695730&r1=1695729&r2=1695730&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.c Thu Aug 13 15:54:54 2015
@@ -95,13 +95,27 @@ check_format(int format)
{
/* Put blacklisted versions here. */
- /* We support all formats from 1-current simultaneously */
- if (1 <= format && format <= SVN_FS_X__FORMAT_NUMBER)
+ /* We support any format if it matches the current format. */
+ if (format == SVN_FS_X__FORMAT_NUMBER)
+ return SVN_NO_ERROR;
+
+ /* Experimental formats are only supported if they match the current, but
+ * that case has already been handled. So, reject any experimental format.
+ */
+ if (SVN_FS_X__EXPERIMENTAL_FORMAT_NUMBER >= format)
+ return svn_error_createf(SVN_ERR_FS_UNSUPPORTED_FORMAT, NULL,
+ _("Unsupported experimental FSX format '%d' found; current format is '%d'"),
+ format, SVN_FS_X__FORMAT_NUMBER);
+
+ /* By default, we will support any non-experimental format released so far.
+ */
+ if (format <= SVN_FS_X__FORMAT_NUMBER)
return SVN_NO_ERROR;
return svn_error_createf(SVN_ERR_FS_UNSUPPORTED_FORMAT, NULL,
- _("Expected FS format between '1' and '%d'; found format '%d'"),
- SVN_FS_X__FORMAT_NUMBER, format);
+ _("Expected FSX format between '%d' and '%d'; found format '%d'"),
+ SVN_FS_X__EXPERIMENTAL_FORMAT_NUMBER + 1, SVN_FS_X__FORMAT_NUMBER,
+ format);
}
/* Read the format file at PATH and set *PFORMAT to the format version found
@@ -850,6 +864,7 @@ write_revision_zero(svn_fs_t *fs,
apr_array_header_t *index_entries;
svn_fs_x__p2l_entry_t *entry;
svn_fs_x__revision_file_t *rev_file;
+ apr_file_t *apr_file;
const char *l2p_proto_index, *p2l_proto_index;
/* Construct a skeleton r0 with no indexes. */
@@ -896,15 +911,16 @@ write_revision_zero(svn_fs_t *fs,
/* Now re-open r0, create proto-index files from our entries and
rewrite the index section of r0. */
- SVN_ERR(svn_fs_x__open_pack_or_rev_file_writable(&rev_file, fs, 0,
- subpool, subpool));
+ SVN_ERR(svn_fs_x__rev_file_open_writable(&rev_file, fs, 0,
+ subpool, subpool));
SVN_ERR(svn_fs_x__p2l_index_from_p2l_entries(&p2l_proto_index, fs,
rev_file, index_entries,
subpool, subpool));
SVN_ERR(svn_fs_x__l2p_index_from_p2l_entries(&l2p_proto_index, fs,
index_entries,
subpool, subpool));
- SVN_ERR(svn_fs_x__add_index_data(fs, rev_file->file, l2p_proto_index,
+ SVN_ERR(svn_fs_x__rev_file_get(&apr_file, rev_file));
+ SVN_ERR(svn_fs_x__add_index_data(fs, apr_file, l2p_proto_index,
p2l_proto_index, 0, subpool));
SVN_ERR(svn_fs_x__close_revision_file(rev_file));
@@ -935,14 +951,9 @@ svn_fs_x__create_file_tree(svn_fs_t *fs,
/* Create the revision data directories. */
SVN_ERR(svn_io_make_dir_recursively(
- svn_fs_x__path_rev_shard(fs, 0, scratch_pool),
+ svn_fs_x__path_shard(fs, 0, scratch_pool),
scratch_pool));
- /* Create the revprops directory. */
- SVN_ERR(svn_io_make_dir_recursively(
- svn_fs_x__path_revprops_shard(fs, 0, scratch_pool),
- scratch_pool));
-
/* Create the transaction directory. */
SVN_ERR(svn_io_make_dir_recursively(
svn_fs_x__path_txns_dir(fs, scratch_pool),
@@ -1213,8 +1224,11 @@ svn_fs_x__info_format(int *fs_format,
{
case 1:
break;
+ case 2:
+ (*supports_version)->minor = 10;
+ break;
#ifdef SVN_DEBUG
-# if SVN_FS_X__FORMAT_NUMBER != 1
+# if SVN_FS_X__FORMAT_NUMBER != 2
# error "Need to add a 'case' statement here"
# endif
#endif
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.h?rev=1695730&r1=1695729&r2=1695730&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.h (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.h Thu Aug 13 15:54:54 2015
@@ -1,4 +1,4 @@
-/* fs_x.h : interface to the native filesystem layer
+/* fs_x.h : interface to the FSX layer
*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
@@ -20,8 +20,8 @@
* ====================================================================
*/
-#ifndef SVN_LIBSVN_FS__FS_X_H
-#define SVN_LIBSVN_FS__FS_X_H
+#ifndef SVN_LIBSVN_FS_X_FS_X_H
+#define SVN_LIBSVN_FS_X_FS_X_H
#include "fs.h"
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/hotcopy.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/hotcopy.c?rev=1695730&r1=1695729&r2=1695730&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/hotcopy.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/hotcopy.c Thu Aug 13 15:54:54 2015
@@ -243,6 +243,7 @@ hotcopy_io_copy_dir_recursively(svn_bool
* to DST_SUBDIR. Assume a sharding layout based on MAX_FILES_PER_DIR.
* Set *SKIPPED_P to FALSE only if the file was copied, do not change the
* value in *SKIPPED_P otherwise. SKIPPED_P may be NULL if not required.
+ * If PROPS is set, copy the revprops file, otherwise copy the rev data file.
* Use SCRATCH_POOL for temporary allocations. */
static svn_error_t *
hotcopy_copy_shard_file(svn_boolean_t *skipped_p,
@@ -250,6 +251,7 @@ hotcopy_copy_shard_file(svn_boolean_t *s
const char *dst_subdir,
svn_revnum_t rev,
int max_files_per_dir,
+ svn_boolean_t props,
apr_pool_t *scratch_pool)
{
const char *src_subdir_shard = src_subdir,
@@ -269,7 +271,9 @@ hotcopy_copy_shard_file(svn_boolean_t *s
SVN_ERR(hotcopy_io_dir_file_copy(skipped_p,
src_subdir_shard, dst_subdir_shard,
- apr_psprintf(scratch_pool, "%ld", rev),
+ apr_psprintf(scratch_pool, "%c%ld",
+ props ? 'p' : 'r',
+ rev),
scratch_pool));
return SVN_NO_ERROR;
}
@@ -296,9 +300,6 @@ hotcopy_copy_packed_shard(svn_boolean_t
const char *dst_subdir;
const char *packed_shard;
const char *src_subdir_packed_shard;
- svn_revnum_t revprop_rev;
- apr_pool_t *iterpool;
- svn_fs_x__data_t *src_ffd = src_fs->fsap_data;
/* Copy the packed shard. */
src_subdir = svn_dirent_join(src_fs->path, PATH_REVS_DIR, scratch_pool);
@@ -313,47 +314,6 @@ hotcopy_copy_packed_shard(svn_boolean_t
NULL /* cancel_func */, NULL,
scratch_pool));
- /* Copy revprops belonging to revisions in this pack. */
- src_subdir = svn_dirent_join(src_fs->path, PATH_REVPROPS_DIR, scratch_pool);
- dst_subdir = svn_dirent_join(dst_fs->path, PATH_REVPROPS_DIR, scratch_pool);
-
- if (src_ffd->min_unpacked_rev < rev + max_files_per_dir)
- {
- /* copy unpacked revprops rev by rev */
- iterpool = svn_pool_create(scratch_pool);
- for (revprop_rev = rev;
- revprop_rev < rev + max_files_per_dir;
- revprop_rev++)
- {
- svn_pool_clear(iterpool);
-
- SVN_ERR(hotcopy_copy_shard_file(skipped_p, src_subdir, dst_subdir,
- revprop_rev, max_files_per_dir,
- iterpool));
- }
- svn_pool_destroy(iterpool);
- }
- else
- {
- /* revprop for revision 0 will never be packed */
- if (rev == 0)
- SVN_ERR(hotcopy_copy_shard_file(skipped_p, src_subdir, dst_subdir,
- 0, max_files_per_dir,
- scratch_pool));
-
- /* packed revprops folder */
- packed_shard = apr_psprintf(scratch_pool, "%ld" PATH_EXT_PACKED_SHARD,
- rev / max_files_per_dir);
- src_subdir_packed_shard = svn_dirent_join(src_subdir, packed_shard,
- scratch_pool);
- SVN_ERR(hotcopy_io_copy_dir_recursively(skipped_p,
- src_subdir_packed_shard,
- dst_subdir, packed_shard,
- TRUE /* copy_perms */,
- NULL /* cancel_func */, NULL,
- scratch_pool));
- }
-
/* If necessary, update the min-unpacked rev file in the hotcopy. */
if (*dst_min_unpacked_rev < rev + max_files_per_dir)
{
@@ -366,111 +326,6 @@ hotcopy_copy_packed_shard(svn_boolean_t
return SVN_NO_ERROR;
}
-/* Remove file PATH, if it exists - even if it is read-only.
- * Use SCRATCH_POOL for temporary allocations. */
-static svn_error_t *
-hotcopy_remove_file(const char *path,
- apr_pool_t *scratch_pool)
-{
- /* Make the rev file writable and remove it. */
- SVN_ERR(svn_io_set_file_read_write(path, TRUE, scratch_pool));
- SVN_ERR(svn_io_remove_file2(path, TRUE, scratch_pool));
-
- return SVN_NO_ERROR;
-}
-
-
-/* Remove revision or revprop files between START_REV (inclusive) and
- * END_REV (non-inclusive) from folder DST_SUBDIR in DST_FS. Assume
- * sharding as per MAX_FILES_PER_DIR.
- * Use SCRATCH_POOL for temporary allocations. */
-static svn_error_t *
-hotcopy_remove_files(svn_fs_t *dst_fs,
- const char *dst_subdir,
- svn_revnum_t start_rev,
- svn_revnum_t end_rev,
- int max_files_per_dir,
- apr_pool_t *scratch_pool)
-{
- const char *shard;
- const char *dst_subdir_shard;
- svn_revnum_t rev;
- apr_pool_t *iterpool;
-
- /* Pre-compute paths for initial shard. */
- shard = apr_psprintf(scratch_pool, "%ld", start_rev / max_files_per_dir);
- dst_subdir_shard = svn_dirent_join(dst_subdir, shard, scratch_pool);
-
- iterpool = svn_pool_create(scratch_pool);
- for (rev = start_rev; rev < end_rev; rev++)
- {
- svn_pool_clear(iterpool);
-
- /* If necessary, update paths for shard. */
- if (rev != start_rev && rev % max_files_per_dir == 0)
- {
- shard = apr_psprintf(iterpool, "%ld", rev / max_files_per_dir);
- dst_subdir_shard = svn_dirent_join(dst_subdir, shard, scratch_pool);
- }
-
- /* remove files for REV */
- SVN_ERR(hotcopy_remove_file(svn_dirent_join(dst_subdir_shard,
- apr_psprintf(iterpool,
- "%ld", rev),
- iterpool),
- iterpool));
- }
-
- svn_pool_destroy(iterpool);
-
- return SVN_NO_ERROR;
-}
-
-/* Remove revisions between START_REV (inclusive) and END_REV (non-inclusive)
- * from DST_FS. Assume sharding as per MAX_FILES_PER_DIR.
- * Use SCRATCH_POOL for temporary allocations. */
-static svn_error_t *
-hotcopy_remove_rev_files(svn_fs_t *dst_fs,
- svn_revnum_t start_rev,
- svn_revnum_t end_rev,
- int max_files_per_dir,
- apr_pool_t *scratch_pool)
-{
- SVN_ERR_ASSERT(start_rev <= end_rev);
- SVN_ERR(hotcopy_remove_files(dst_fs,
- svn_dirent_join(dst_fs->path,
- PATH_REVS_DIR,
- scratch_pool),
- start_rev, end_rev,
- max_files_per_dir, scratch_pool));
-
- return SVN_NO_ERROR;
-}
-
-/* Remove revision properties between START_REV (inclusive) and END_REV
- * (non-inclusive) from DST_FS. Assume sharding as per MAX_FILES_PER_DIR.
- * Use SCRATCH_POOL for temporary allocations. Revision 0 revprops will
- * not be deleted. */
-static svn_error_t *
-hotcopy_remove_revprop_files(svn_fs_t *dst_fs,
- svn_revnum_t start_rev,
- svn_revnum_t end_rev,
- int max_files_per_dir,
- apr_pool_t *scratch_pool)
-{
- SVN_ERR_ASSERT(start_rev <= end_rev);
-
- /* don't delete rev 0 props */
- SVN_ERR(hotcopy_remove_files(dst_fs,
- svn_dirent_join(dst_fs->path,
- PATH_REVPROPS_DIR,
- scratch_pool),
- start_rev ? start_rev : 1, end_rev,
- max_files_per_dir, scratch_pool));
-
- return SVN_NO_ERROR;
-}
-
/* Verify that DST_FS is a suitable destination for an incremental
* hotcopy from SRC_FS. */
static svn_error_t *
@@ -506,29 +361,6 @@ hotcopy_incremental_check_preconditions(
return SVN_NO_ERROR;
}
-/* Remove folder PATH. Ignore errors due to the sub-tree not being empty.
- * CANCEL_FUNC and CANCEL_BATON do the usual thing.
- * Use SCRATCH_POOL for temporary allocations.
- */
-static svn_error_t *
-remove_folder(const char *path,
- svn_cancel_func_t cancel_func,
- void *cancel_baton,
- apr_pool_t *scratch_pool)
-{
- svn_error_t *err = svn_io_remove_dir2(path, TRUE,
- cancel_func, cancel_baton,
- scratch_pool);
-
- if (err && APR_STATUS_IS_ENOTEMPTY(err->apr_err))
- {
- svn_error_clear(err);
- err = SVN_NO_ERROR;
- }
-
- return svn_error_trace(err);
-}
-
/* Copy the revision and revprop files (possibly sharded / packed) from
* SRC_FS to DST_FS. Do not re-copy data which already exists in DST_FS.
* When copying packed or unpacked shards, checkpoint the result in DST_FS
@@ -545,8 +377,6 @@ hotcopy_revisions(svn_fs_t *src_fs,
svn_boolean_t incremental,
const char *src_revs_dir,
const char *dst_revs_dir,
- const char *src_revprops_dir,
- const char *dst_revprops_dir,
svn_fs_hotcopy_notify_t notify_func,
void* notify_baton,
svn_cancel_func_t cancel_func,
@@ -624,26 +454,10 @@ hotcopy_revisions(svn_fs_t *src_fs,
if (notify_func && !skipped)
notify_func(notify_baton, rev, pack_end_rev, iterpool);
- /* Remove revision files which are now packed. */
- if (incremental)
- {
- SVN_ERR(hotcopy_remove_rev_files(dst_fs, rev,
- rev + max_files_per_dir,
- max_files_per_dir, iterpool));
- SVN_ERR(hotcopy_remove_revprop_files(dst_fs, rev,
- rev + max_files_per_dir,
- max_files_per_dir,
- iterpool));
- }
-
/* Now that all revisions have moved into the pack, the original
* rev dir can be removed. */
- SVN_ERR(remove_folder(svn_fs_x__path_rev_shard(dst_fs, rev, iterpool),
- cancel_func, cancel_baton, iterpool));
- if (rev > 0)
- SVN_ERR(remove_folder(svn_fs_x__path_revprops_shard(dst_fs, rev,
- iterpool),
- cancel_func, cancel_baton, iterpool));
+ SVN_ERR(svn_io_remove_dir2(svn_fs_x__path_shard(dst_fs, rev, iterpool),
+ TRUE, cancel_func, cancel_baton, iterpool));
}
if (cancel_func)
@@ -677,13 +491,12 @@ hotcopy_revisions(svn_fs_t *src_fs,
/* Copy the rev file. */
SVN_ERR(hotcopy_copy_shard_file(&skipped, src_revs_dir, dst_revs_dir,
- rev, max_files_per_dir,
+ rev, max_files_per_dir, FALSE,
iterpool));
/* Copy the revprop file. */
- SVN_ERR(hotcopy_copy_shard_file(&skipped, src_revprops_dir,
- dst_revprops_dir,
- rev, max_files_per_dir,
+ SVN_ERR(hotcopy_copy_shard_file(&skipped, src_revs_dir, dst_revs_dir,
+ rev, max_files_per_dir, TRUE,
iterpool));
/* Whenever this revision did not previously exist in the destination,
@@ -752,8 +565,6 @@ hotcopy_body(void *baton,
void* cancel_baton = hbb->cancel_baton;
svn_revnum_t src_youngest;
svn_revnum_t dst_youngest;
- const char *src_revprops_dir;
- const char *dst_revprops_dir;
const char *src_revs_dir;
const char *dst_revs_dir;
const char *src_subdir;
@@ -793,16 +604,10 @@ hotcopy_body(void *baton,
src_revs_dir = svn_dirent_join(src_fs->path, PATH_REVS_DIR, scratch_pool);
dst_revs_dir = svn_dirent_join(dst_fs->path, PATH_REVS_DIR, scratch_pool);
- src_revprops_dir = svn_dirent_join(src_fs->path, PATH_REVPROPS_DIR,
- scratch_pool);
- dst_revprops_dir = svn_dirent_join(dst_fs->path, PATH_REVPROPS_DIR,
- scratch_pool);
/* Ensure that the required folders exist in the destination
* before actually copying the revisions and revprops. */
SVN_ERR(svn_io_make_dir_recursively(dst_revs_dir, scratch_pool));
- SVN_ERR(svn_io_make_dir_recursively(dst_revprops_dir, scratch_pool));
-
if (cancel_func)
SVN_ERR(cancel_func(cancel_baton));
@@ -812,7 +617,6 @@ hotcopy_body(void *baton,
* revision number, but also the next-ID counters). */
SVN_ERR(hotcopy_revisions(src_fs, dst_fs, src_youngest, dst_youngest,
incremental, src_revs_dir, dst_revs_dir,
- src_revprops_dir, dst_revprops_dir,
notify_func, notify_baton,
cancel_func, cancel_baton, scratch_pool));
SVN_ERR(svn_fs_x__write_current(dst_fs, src_youngest, scratch_pool));
@@ -832,16 +636,6 @@ hotcopy_body(void *baton,
cancel_func, cancel_baton,
scratch_pool));
- /* Now copy the node-origins cache tree. */
- src_subdir = svn_dirent_join(src_fs->path, PATH_NODE_ORIGINS_DIR,
- scratch_pool);
- SVN_ERR(svn_io_check_path(src_subdir, &kind, scratch_pool));
- if (kind == svn_node_dir)
- SVN_ERR(hotcopy_io_copy_dir_recursively(NULL, src_subdir, dst_fs->path,
- PATH_NODE_ORIGINS_DIR, TRUE,
- cancel_func, cancel_baton,
- scratch_pool));
-
/*
* NB: Data copied below is only read by writers, not readers.
* Writers are still locked out at this point.
@@ -909,11 +703,11 @@ hotcopy_create_empty_dest(svn_fs_t *src_
/* Remove revision 0 contents. Otherwise, it may not get overwritten
* due to having a newer timestamp. */
- SVN_ERR(hotcopy_remove_file(svn_fs_x__path_rev(dst_fs, 0, scratch_pool),
- scratch_pool));
- SVN_ERR(hotcopy_remove_file(svn_fs_x__path_revprops(dst_fs, 0,
+ SVN_ERR(svn_io_remove_file2(svn_fs_x__path_rev(dst_fs, 0, scratch_pool),
+ FALSE, scratch_pool));
+ SVN_ERR(svn_io_remove_file2(svn_fs_x__path_revprops(dst_fs, 0,
scratch_pool),
- scratch_pool));
+ FALSE, scratch_pool));
/* This filesystem is ready. Stamp it with a format number. Fail if
* the 'format' file should already exist. */
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/hotcopy.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/hotcopy.h?rev=1695730&r1=1695729&r2=1695730&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/hotcopy.h (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/hotcopy.h Thu Aug 13 15:54:54 2015
@@ -1,4 +1,4 @@
-/* hotcopy.h : interface to the native filesystem layer
+/* hotcopy.h : interface to the hot-copying functionality
*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
@@ -20,8 +20,8 @@
* ====================================================================
*/
-#ifndef SVN_LIBSVN_FS__HOTCOPY_H
-#define SVN_LIBSVN_FS__HOTCOPY_H
+#ifndef SVN_LIBSVN_FS_X_HOTCOPY_H
+#define SVN_LIBSVN_FS_X_HOTCOPY_H
#include "fs.h"