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 2014/05/16 04:19:16 UTC
svn commit: r1595088 - in /subversion/trunk/subversion/libsvn_fs_x: fs_x.c
fs_x.h util.c util.h
Author: stefan2
Date: Fri May 16 02:19:16 2014
New Revision: 1595088
URL: http://svn.apache.org/r1595088
Log:
Remove node-origin FSFS backward compat code from FSX.
Our data model always provides the copy root info that
would be missing in old FSFS formats.
* subversion/libsvn_fs_x/util.h
(svn_fs_x__path_node_origin): Drop. We don't need that cache file.
* subversion/libsvn_fs_x/util.c
(svn_fs_x__path_node_origin): Same.
* subversion/libsvn_fs_x/fs_x.h
(svn_fs_x__get_node_origin,
svn_fs_x__set_node_origin): Drop. Nobody calls these.
* subversion/libsvn_fs_x/fs_x.c
(get_node_origins_from_file,
svn_fs_x__get_node_origin,
set_node_origins_for_file,
svn_fs_x__set_node_origin): Remove their implemenation as well.
Modified:
subversion/trunk/subversion/libsvn_fs_x/fs_x.c
subversion/trunk/subversion/libsvn_fs_x/fs_x.h
subversion/trunk/subversion/libsvn_fs_x/util.c
subversion/trunk/subversion/libsvn_fs_x/util.h
Modified: subversion/trunk/subversion/libsvn_fs_x/fs_x.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/fs_x.c?rev=1595088&r1=1595087&r2=1595088&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/fs_x.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/fs_x.c Fri May 16 02:19:16 2014
@@ -970,144 +970,6 @@ svn_fs_x__ensure_dir_exists(const char *
return svn_io_copy_perms(fs_path, path, pool);
}
-/* Set *NODE_ORIGINS to a hash mapping 'const char *' node IDs to
- 'svn_string_t *' node revision IDs. Use POOL for allocations. */
-static svn_error_t *
-get_node_origins_from_file(svn_fs_t *fs,
- apr_hash_t **node_origins,
- const char *node_origins_file,
- apr_pool_t *pool)
-{
- apr_file_t *fd;
- svn_error_t *err;
- svn_stream_t *stream;
-
- *node_origins = NULL;
- err = svn_io_file_open(&fd, node_origins_file,
- APR_READ, APR_OS_DEFAULT, pool);
- if (err && APR_STATUS_IS_ENOENT(err->apr_err))
- {
- svn_error_clear(err);
- return SVN_NO_ERROR;
- }
- SVN_ERR(err);
-
- stream = svn_stream_from_aprfile2(fd, FALSE, pool);
- *node_origins = apr_hash_make(pool);
- SVN_ERR(svn_hash_read2(*node_origins, stream, SVN_HASH_TERMINATOR, pool));
- return svn_stream_close(stream);
-}
-
-svn_error_t *
-svn_fs_x__get_node_origin(const svn_fs_id_t **origin_id,
- svn_fs_t *fs,
- const svn_fs_x__id_part_t *node_id,
- apr_pool_t *pool)
-{
- apr_hash_t *node_origins;
-
- *origin_id = NULL;
- SVN_ERR(get_node_origins_from_file(fs, &node_origins,
- svn_fs_x__path_node_origin(fs, node_id, pool),
- pool));
- if (node_origins)
- {
- char node_id_ptr[SVN_INT64_BUFFER_SIZE];
- apr_size_t len = svn__ui64tobase36(node_id_ptr, node_id->number);
- svn_string_t *origin_id_str
- = apr_hash_get(node_origins, node_id_ptr, len);
-
- if (origin_id_str)
- *origin_id = svn_fs_x__id_parse(origin_id_str->data,
- origin_id_str->len, pool);
- }
- return SVN_NO_ERROR;
-}
-
-
-/* Helper for svn_fs_x__set_node_origin. Takes a NODE_ID/NODE_REV_ID
- pair and adds it to the NODE_ORIGINS_PATH file. */
-static svn_error_t *
-set_node_origins_for_file(svn_fs_t *fs,
- const char *node_origins_path,
- const svn_fs_x__id_part_t *node_id,
- svn_string_t *node_rev_id,
- apr_pool_t *pool)
-{
- const char *path_tmp;
- svn_stream_t *stream;
- apr_hash_t *origins_hash;
- svn_string_t *old_node_rev_id;
-
- /* the hash serialization functions require strings as keys */
- char node_id_ptr[SVN_INT64_BUFFER_SIZE];
- apr_size_t len = svn__ui64tobase36(node_id_ptr, node_id->number);
-
- SVN_ERR(svn_fs_x__ensure_dir_exists(svn_dirent_join(fs->path,
- PATH_NODE_ORIGINS_DIR,
- pool),
- fs->path, pool));
-
- /* Read the previously existing origins (if any), and merge our
- update with it. */
- SVN_ERR(get_node_origins_from_file(fs, &origins_hash,
- node_origins_path, pool));
- if (! origins_hash)
- origins_hash = apr_hash_make(pool);
-
- old_node_rev_id = apr_hash_get(origins_hash, node_id_ptr, len);
-
- if (old_node_rev_id && !svn_string_compare(node_rev_id, old_node_rev_id))
- return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
- _("Node origin for '%s' exists with a different "
- "value (%s) than what we were about to store "
- "(%s)"),
- node_id_ptr, old_node_rev_id->data,
- node_rev_id->data);
-
- apr_hash_set(origins_hash, node_id_ptr, len, node_rev_id);
-
- /* Sure, there's a race condition here. Two processes could be
- trying to add different cache elements to the same file at the
- same time, and the entries added by the first one to write will
- be lost. But this is just a cache of reconstructible data, so
- we'll accept this problem in return for not having to deal with
- locking overhead. */
-
- /* Create a temporary file, write out our hash, and close the file. */
- SVN_ERR(svn_stream_open_unique(&stream, &path_tmp,
- svn_dirent_dirname(node_origins_path, pool),
- svn_io_file_del_none, pool, pool));
- SVN_ERR(svn_hash_write2(origins_hash, stream, SVN_HASH_TERMINATOR, pool));
- SVN_ERR(svn_stream_close(stream));
-
- /* Rename the temp file as the real destination */
- return svn_io_file_rename(path_tmp, node_origins_path, pool);
-}
-
-
-svn_error_t *
-svn_fs_x__set_node_origin(svn_fs_t *fs,
- const svn_fs_x__id_part_t *node_id,
- const svn_fs_id_t *node_rev_id,
- apr_pool_t *pool)
-{
- svn_error_t *err;
- const char *filename = svn_fs_x__path_node_origin(fs, node_id, pool);
-
- err = set_node_origins_for_file(fs, filename,
- node_id,
- svn_fs_x__id_unparse(node_rev_id, pool),
- pool);
- if (err && APR_STATUS_IS_EACCES(err->apr_err))
- {
- /* It's just a cache; stop trying if I can't write. */
- svn_error_clear(err);
- err = NULL;
- }
- return svn_error_trace(err);
-}
-
/*** Revisions ***/
Modified: subversion/trunk/subversion/libsvn_fs_x/fs_x.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/fs_x.h?rev=1595088&r1=1595087&r2=1595088&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/fs_x.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/fs_x.h Fri May 16 02:19:16 2014
@@ -190,33 +190,6 @@ svn_error_t *svn_fs_x__ensure_dir_exists
const char *fs_path,
apr_pool_t *pool);
-/* Update the node origin index for FS, recording the mapping from
- NODE_ID to NODE_REV_ID. Use POOL for any temporary allocations.
-
- Because this is just an "optional" cache, this function does not
- return an error if the underlying storage is readonly; it still
- returns an error for other error conditions.
- */
-svn_error_t *
-svn_fs_x__set_node_origin(svn_fs_t *fs,
- const svn_fs_x__id_part_t *node_id,
- const svn_fs_id_t *node_rev_id,
- apr_pool_t *pool);
-
-/* Set *ORIGIN_ID to the node revision ID from which the history of
- all nodes in FS whose "Node ID" is NODE_ID springs, as determined
- by a look in the index. ORIGIN_ID needs to be parsed in an
- FS-backend-specific way. Use POOL for allocations.
-
- If there is no entry for NODE_ID in the cache, return NULL
- in *ORIGIN_ID. */
-svn_error_t *
-svn_fs_x__get_node_origin(const svn_fs_id_t **origin_id,
- svn_fs_t *fs,
- const svn_fs_x__id_part_t *node_id,
- apr_pool_t *pool);
-
-
/* Initialize all session-local caches in FS according to the global
cache settings. Use POOL for allocations.
Modified: subversion/trunk/subversion/libsvn_fs_x/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/util.c?rev=1595088&r1=1595087&r2=1595088&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/util.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/util.c Fri May 16 02:19:16 2014
@@ -414,21 +414,6 @@ svn_fs_x__path_txn_node_children(svn_fs_
PATH_EXT_CHILDREN, SVN_VA_NULL);
}
-const char *
-svn_fs_x__path_node_origin(svn_fs_t *fs,
- const svn_fs_x__id_part_t *node_id,
- apr_pool_t *pool)
-{
- char buffer[SVN_INT64_BUFFER_SIZE];
- apr_size_t len = svn__ui64tobase36(buffer, node_id->number);
-
- if (len > 1)
- buffer[len - 1] = '\0';
-
- return svn_dirent_join_many(pool, fs->path, PATH_NODE_ORIGINS_DIR,
- buffer, SVN_VA_NULL);
-}
-
/* Check that BUF, a nul-terminated buffer of text from file PATH,
contains only digits at OFFSET and beyond, raising an error if not.
Modified: subversion/trunk/subversion/libsvn_fs_x/util.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/util.h?rev=1595088&r1=1595087&r2=1595088&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/util.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/util.h Fri May 16 02:19:16 2014
@@ -239,11 +239,6 @@ svn_fs_x__path_txn_node_children(svn_fs_
const svn_fs_id_t *id,
apr_pool_t *pool);
-const char *
-svn_fs_x__path_node_origin(svn_fs_t *fs,
- const svn_fs_x__id_part_t *node_id,
- apr_pool_t *pool);
-
/* Check that BUF, a nul-terminated buffer of text from file PATH,
contains only digits at OFFSET and beyond, raising an error if not.
TITLE contains a user-visible description of the file, usually the