summaryrefslogtreecommitdiff
path: root/subversion/libsvn_fs_base
diff options
context:
space:
mode:
Diffstat (limited to 'subversion/libsvn_fs_base')
-rw-r--r--subversion/libsvn_fs_base/bdb/bdb-err.c2
-rw-r--r--subversion/libsvn_fs_base/bdb/changes-table.c33
-rw-r--r--subversion/libsvn_fs_base/bdb/checksum-reps-table.c8
-rw-r--r--subversion/libsvn_fs_base/bdb/copies-table.c10
-rw-r--r--subversion/libsvn_fs_base/bdb/env.c195
-rw-r--r--subversion/libsvn_fs_base/bdb/lock-tokens-table.c10
-rw-r--r--subversion/libsvn_fs_base/bdb/locks-table.c23
-rw-r--r--subversion/libsvn_fs_base/bdb/miscellaneous-table.c6
-rw-r--r--subversion/libsvn_fs_base/bdb/node-origins-table.c4
-rw-r--r--subversion/libsvn_fs_base/bdb/nodes-table.c10
-rw-r--r--subversion/libsvn_fs_base/bdb/reps-table.c10
-rw-r--r--subversion/libsvn_fs_base/bdb/rev-table.c12
-rw-r--r--subversion/libsvn_fs_base/bdb/strings-table.c42
-rw-r--r--subversion/libsvn_fs_base/bdb/txn-table.c16
-rw-r--r--subversion/libsvn_fs_base/bdb/uuids-table.c4
-rw-r--r--subversion/libsvn_fs_base/dag.c17
-rw-r--r--subversion/libsvn_fs_base/dag.h2
-rw-r--r--subversion/libsvn_fs_base/err.c3
-rw-r--r--subversion/libsvn_fs_base/fs.c194
-rw-r--r--subversion/libsvn_fs_base/fs.h3
-rw-r--r--subversion/libsvn_fs_base/id.c15
-rw-r--r--subversion/libsvn_fs_base/lock.c68
-rw-r--r--subversion/libsvn_fs_base/notes/structure4
-rw-r--r--subversion/libsvn_fs_base/reps-strings.c15
-rw-r--r--subversion/libsvn_fs_base/revs-txns.c11
-rw-r--r--subversion/libsvn_fs_base/trail.c6
-rw-r--r--subversion/libsvn_fs_base/tree.c142
-rw-r--r--subversion/libsvn_fs_base/util/fs_skels.c13
-rw-r--r--subversion/libsvn_fs_base/uuid.c29
-rw-r--r--subversion/libsvn_fs_base/uuid.h9
30 files changed, 464 insertions, 452 deletions
diff --git a/subversion/libsvn_fs_base/bdb/bdb-err.c b/subversion/libsvn_fs_base/bdb/bdb-err.c
index dce98f3..3d51711 100644
--- a/subversion/libsvn_fs_base/bdb/bdb-err.c
+++ b/subversion/libsvn_fs_base/bdb/bdb-err.c
@@ -102,5 +102,5 @@ svn_fs_bdb__wrap_db(svn_fs_t *fs, const char *operation, int db_err)
return svn_fs_bdb__dberrf
(bfd->bdb, db_err,
_("Berkeley DB error for filesystem '%s' while %s:\n"),
- fs->path ? fs->path : "(none)", operation);
+ fs->path ? fs->path : "(none)", _(operation));
}
diff --git a/subversion/libsvn_fs_base/bdb/changes-table.c b/subversion/libsvn_fs_base/bdb/changes-table.c
index fa0bfee..80ff468 100644
--- a/subversion/libsvn_fs_base/bdb/changes-table.c
+++ b/subversion/libsvn_fs_base/bdb/changes-table.c
@@ -25,6 +25,7 @@
#include <apr_hash.h>
#include <apr_tables.h>
+#include "svn_hash.h"
#include "svn_fs.h"
#include "svn_pools.h"
#include "svn_path.h"
@@ -90,7 +91,7 @@ svn_fs_bdb__changes_add(svn_fs_t *fs,
svn_fs_base__str_to_dbt(&query, key);
svn_fs_base__skel_to_dbt(&value, skel, pool);
svn_fs_base__trail_debug(trail, "changes", "put");
- return BDB_WRAP(fs, _("creating change"),
+ return BDB_WRAP(fs, N_("creating change"),
bfd->changes->put(bfd->changes, trail->db_txn,
&query, &value, 0));
}
@@ -114,7 +115,7 @@ svn_fs_bdb__changes_delete(svn_fs_t *fs,
error should be propagated to the caller, though. */
if ((db_err) && (db_err != DB_NOTFOUND))
{
- SVN_ERR(BDB_WRAP(fs, _("deleting changes"), db_err));
+ SVN_ERR(BDB_WRAP(fs, N_("deleting changes"), db_err));
}
return SVN_NO_ERROR;
@@ -132,7 +133,7 @@ fold_change(apr_hash_t *changes,
svn_fs_path_change2_t *old_change, *new_change;
const char *path;
- if ((old_change = apr_hash_get(changes, change->path, APR_HASH_KEY_STRING)))
+ if ((old_change = svn_hash_gets(changes, change->path)))
{
/* This path already exists in the hash, so we have to merge
this change into the already existing one. */
@@ -244,7 +245,7 @@ fold_change(apr_hash_t *changes,
}
/* Add (or update) this path. */
- apr_hash_set(changes, path, APR_HASH_KEY_STRING, new_change);
+ svn_hash_sets(changes, path, new_change);
return SVN_NO_ERROR;
}
@@ -268,7 +269,7 @@ svn_fs_bdb__changes_fetch(apr_hash_t **changes_p,
/* Get a cursor on the first record matching KEY, and then loop over
the records, adding them to the return array. */
svn_fs_base__trail_debug(trail, "changes", "cursor");
- SVN_ERR(BDB_WRAP(fs, _("creating cursor for reading changes"),
+ SVN_ERR(BDB_WRAP(fs, N_("creating cursor for reading changes"),
bfd->changes->cursor(bfd->changes, trail->db_txn,
&cursor, 0)));
@@ -325,14 +326,14 @@ svn_fs_bdb__changes_fetch(apr_hash_t **changes_p,
/* KEY is the path. */
const void *hashkey;
apr_ssize_t klen;
- apr_hash_this(hi, &hashkey, &klen, NULL);
+ const char *child_relpath;
- /* If we come across our own path, ignore it. */
- if (strcmp(change->path, hashkey) == 0)
- continue;
+ apr_hash_this(hi, &hashkey, &klen, NULL);
- /* If we come across a child of our path, remove it. */
- if (svn_fspath__is_child(change->path, hashkey, subpool))
+ /* If we come across our own path, ignore it.
+ If we come across a child of our path, remove it. */
+ child_relpath = svn_fspath__skip_ancestor(change->path, hashkey);
+ if (child_relpath && *child_relpath)
apr_hash_set(changes, hashkey, klen, NULL);
}
}
@@ -352,7 +353,7 @@ svn_fs_bdb__changes_fetch(apr_hash_t **changes_p,
finished. Just return the (possibly empty) array. Any other
error, however, needs to get handled appropriately. */
if (db_err && (db_err != DB_NOTFOUND))
- err = BDB_WRAP(fs, _("fetching changes"), db_err);
+ err = BDB_WRAP(fs, N_("fetching changes"), db_err);
cleanup:
/* Close the cursor. */
@@ -365,7 +366,7 @@ svn_fs_bdb__changes_fetch(apr_hash_t **changes_p,
/* If our only error thus far was when we closed the cursor, return
that error. */
if (db_c_err)
- SVN_ERR(BDB_WRAP(fs, _("closing changes cursor"), db_c_err));
+ SVN_ERR(BDB_WRAP(fs, N_("closing changes cursor"), db_c_err));
/* Finally, set our return variable and get outta here. */
*changes_p = changes;
@@ -391,7 +392,7 @@ svn_fs_bdb__changes_fetch_raw(apr_array_header_t **changes_p,
/* Get a cursor on the first record matching KEY, and then loop over
the records, adding them to the return array. */
svn_fs_base__trail_debug(trail, "changes", "cursor");
- SVN_ERR(BDB_WRAP(fs, _("creating cursor for reading changes"),
+ SVN_ERR(BDB_WRAP(fs, N_("creating cursor for reading changes"),
bfd->changes->cursor(bfd->changes, trail->db_txn,
&cursor, 0)));
@@ -435,7 +436,7 @@ svn_fs_bdb__changes_fetch_raw(apr_array_header_t **changes_p,
finished. Just return the (possibly empty) array. Any other
error, however, needs to get handled appropriately. */
if (db_err && (db_err != DB_NOTFOUND))
- err = BDB_WRAP(fs, _("fetching changes"), db_err);
+ err = BDB_WRAP(fs, N_("fetching changes"), db_err);
cleanup:
/* Close the cursor. */
@@ -448,7 +449,7 @@ svn_fs_bdb__changes_fetch_raw(apr_array_header_t **changes_p,
/* If our only error thus far was when we closed the cursor, return
that error. */
if (db_c_err)
- SVN_ERR(BDB_WRAP(fs, _("closing changes cursor"), db_c_err));
+ SVN_ERR(BDB_WRAP(fs, N_("closing changes cursor"), db_c_err));
/* Finally, set our return variable and get outta here. */
*changes_p = changes;
diff --git a/subversion/libsvn_fs_base/bdb/checksum-reps-table.c b/subversion/libsvn_fs_base/bdb/checksum-reps-table.c
index d985830..f4a34c3 100644
--- a/subversion/libsvn_fs_base/bdb/checksum-reps-table.c
+++ b/subversion/libsvn_fs_base/bdb/checksum-reps-table.c
@@ -139,7 +139,7 @@ svn_error_t *svn_fs_bdb__set_checksum_rep(svn_fs_t *fs,
/* Create a value from our REP_KEY, and add this record to the table. */
svn_fs_base__str_to_dbt(&value, rep_key);
svn_fs_base__trail_debug(trail, "checksum-reps", "put");
- SVN_ERR(BDB_WRAP(fs, _("storing checksum-reps record"),
+ SVN_ERR(BDB_WRAP(fs, N_("storing checksum-reps record"),
bfd->checksum_reps->put(bfd->checksum_reps, trail->db_txn,
&key, &value, 0)));
return SVN_NO_ERROR;
@@ -161,7 +161,7 @@ svn_error_t *svn_fs_bdb__delete_checksum_rep(svn_fs_t *fs,
svn_fs_base__checksum_to_dbt(&key, checksum);
svn_fs_base__trail_debug(trail, "checksum-reps", "del");
- SVN_ERR(BDB_WRAP(fs, "deleting entry from 'checksum-reps' table",
+ SVN_ERR(BDB_WRAP(fs, N_("deleting entry from 'checksum-reps' table"),
bfd->checksum_reps->del(bfd->checksum_reps,
trail->db_txn, &key, 0)));
return SVN_NO_ERROR;
@@ -183,7 +183,7 @@ svn_error_t *svn_fs_bdb__reserve_rep_reuse_id(const char **id_p,
/* Get the current value associated with the `next-key' key in the
`checksum-reps' table. */
svn_fs_base__trail_debug(trail, "checksum-reps", "get");
- SVN_ERR(BDB_WRAP(fs, _("allocating new representation reuse ID "
+ SVN_ERR(BDB_WRAP(fs, N_("allocating new representation reuse ID "
"(getting 'next-key')"),
bfd->checksum_reps->get(bfd->checksum_reps, trail->db_txn,
&query,
@@ -204,5 +204,5 @@ svn_error_t *svn_fs_bdb__reserve_rep_reuse_id(const char **id_p,
svn_fs_base__str_to_dbt(&result, next_key),
0);
- return BDB_WRAP(fs, _("bumping next representation reuse ID"), db_err);
+ return BDB_WRAP(fs, N_("bumping next representation reuse ID"), db_err);
}
diff --git a/subversion/libsvn_fs_base/bdb/copies-table.c b/subversion/libsvn_fs_base/bdb/copies-table.c
index 919a390..7bf6ca8 100644
--- a/subversion/libsvn_fs_base/bdb/copies-table.c
+++ b/subversion/libsvn_fs_base/bdb/copies-table.c
@@ -89,7 +89,7 @@ put_copy(svn_fs_t *fs,
svn_fs_base__str_to_dbt(&key, copy_id);
svn_fs_base__skel_to_dbt(&value, copy_skel, pool);
svn_fs_base__trail_debug(trail, "copies", "put");
- return BDB_WRAP(fs, _("storing copy record"),
+ return BDB_WRAP(fs, N_("storing copy record"),
bfd->copies->put(bfd->copies, trail->db_txn,
&key, &value, 0));
}
@@ -112,7 +112,7 @@ svn_fs_bdb__reserve_copy_id(const char **id_p,
/* Get the current value associated with the `next-key' key in the
copies table. */
svn_fs_base__trail_debug(trail, "copies", "get");
- SVN_ERR(BDB_WRAP(fs, _("allocating new copy ID (getting 'next-key')"),
+ SVN_ERR(BDB_WRAP(fs, N_("allocating new copy ID (getting 'next-key')"),
bfd->copies->get(bfd->copies, trail->db_txn, &query,
svn_fs_base__result_dbt(&result),
0)));
@@ -130,7 +130,7 @@ svn_fs_bdb__reserve_copy_id(const char **id_p,
svn_fs_base__str_to_dbt(&result, next_key),
0);
- return BDB_WRAP(fs, _("bumping next copy key"), db_err);
+ return BDB_WRAP(fs, N_("bumping next copy key"), db_err);
}
@@ -168,7 +168,7 @@ svn_fs_bdb__delete_copy(svn_fs_t *fs,
db_err = bfd->copies->del(bfd->copies, trail->db_txn, &key, 0);
if (db_err == DB_NOTFOUND)
return svn_fs_base__err_no_such_copy(fs, copy_id);
- return BDB_WRAP(fs, _("deleting entry from 'copies' table"), db_err);
+ return BDB_WRAP(fs, N_("deleting entry from 'copies' table"), db_err);
}
@@ -196,7 +196,7 @@ svn_fs_bdb__get_copy(copy_t **copy_p,
if (db_err == DB_NOTFOUND)
return svn_fs_base__err_no_such_copy(fs, copy_id);
- SVN_ERR(BDB_WRAP(fs, _("reading copy"), db_err));
+ SVN_ERR(BDB_WRAP(fs, N_("reading copy"), db_err));
/* Unparse COPY skel */
skel = svn_skel__parse(value.data, value.size, pool);
diff --git a/subversion/libsvn_fs_base/bdb/env.c b/subversion/libsvn_fs_base/bdb/env.c
index 436247e..7309a80 100644
--- a/subversion/libsvn_fs_base/bdb/env.c
+++ b/subversion/libsvn_fs_base/bdb/env.c
@@ -24,7 +24,6 @@
#include <apr.h>
#if APR_HAS_THREADS
-#include <apr_thread_mutex.h>
#include <apr_thread_proc.h>
#include <apr_time.h>
#endif
@@ -32,10 +31,12 @@
#include <apr_strings.h>
#include <apr_hash.h>
+#include "svn_hash.h"
#include "svn_path.h"
#include "svn_pools.h"
#include "svn_utf.h"
#include "private/svn_atomic.h"
+#include "private/svn_mutex.h"
#include "bdb-err.h"
#include "bdb_compat.h"
@@ -226,7 +227,7 @@ bdb_error_gatherer(const DB_ENV *dbenv, const char *baton, const char *msg)
SVN_BDB_ERROR_GATHERER_IGNORE(dbenv);
- new_err = svn_error_createf(SVN_NO_ERROR, NULL, "bdb: %s", msg);
+ new_err = svn_error_createf(SVN_ERR_FS_BERKELEY_DB, NULL, "bdb: %s", msg);
if (error_info->pending_errors)
svn_error_compose(error_info->pending_errors, new_err);
else
@@ -358,12 +359,11 @@ static apr_pool_t *bdb_cache_pool = NULL;
/* The cache. The items are bdb_env_t structures. */
static apr_hash_t *bdb_cache = NULL;
-#if APR_HAS_THREADS
/* The mutex that protects bdb_cache. */
-static apr_thread_mutex_t *bdb_cache_lock = NULL;
+static svn_mutex__t *bdb_cache_lock = NULL;
-/* Cleanup callback to NULL out the cache and its lock, so we don't try to
- use them after the pool has been cleared during global shutdown. */
+/* Cleanup callback to NULL out the cache, so we don't try to use it after
+ the pool has been cleared during global shutdown. */
static apr_status_t
clear_cache(void *data)
{
@@ -371,31 +371,18 @@ clear_cache(void *data)
bdb_cache_lock = NULL;
return APR_SUCCESS;
}
-#endif /* APR_HAS_THREADS */
static volatile svn_atomic_t bdb_cache_state = 0;
static svn_error_t *
bdb_init_cb(void *baton, apr_pool_t *pool)
{
-#if APR_HAS_THREADS
- apr_status_t apr_err;
-#endif
bdb_cache_pool = svn_pool_create(pool);
bdb_cache = apr_hash_make(bdb_cache_pool);
-#if APR_HAS_THREADS
- apr_err = apr_thread_mutex_create(&bdb_cache_lock,
- APR_THREAD_MUTEX_DEFAULT,
- bdb_cache_pool);
- if (apr_err)
- {
- return svn_error_create(apr_err, NULL,
- "Couldn't initialize the cache of"
- " Berkeley DB environment descriptors");
- }
+
+ SVN_ERR(svn_mutex__init(&bdb_cache_lock, TRUE, bdb_cache_pool));
apr_pool_cleanup_register(bdb_cache_pool, NULL, clear_cache,
apr_pool_cleanup_null);
-#endif /* APR_HAS_THREADS */
return SVN_NO_ERROR;
}
@@ -406,26 +393,6 @@ svn_fs_bdb__init(apr_pool_t* pool)
return svn_atomic__init_once(&bdb_cache_state, bdb_init_cb, NULL, pool);
}
-static APR_INLINE void
-acquire_cache_mutex(void)
-{
-#if APR_HAS_THREADS
- if (bdb_cache_lock)
- apr_thread_mutex_lock(bdb_cache_lock);
-#endif
-}
-
-
-static APR_INLINE void
-release_cache_mutex(void)
-{
-#if APR_HAS_THREADS
- if (bdb_cache_lock)
- apr_thread_mutex_unlock(bdb_cache_lock);
-#endif
-}
-
-
/* Construct a cache key for the BDB environment at PATH in *KEYP.
if DBCONFIG_FILE is not NULL, return the opened file handle.
Allocate from POOL. */
@@ -523,13 +490,41 @@ bdb_close(bdb_env_t *bdb)
}
+static svn_error_t *
+svn_fs_bdb__close_internal(bdb_env_t *bdb)
+{
+ svn_error_t *err = SVN_NO_ERROR;
+
+ if (--bdb->refcount != 0)
+ {
+ /* If the environment is panicked and automatic recovery is not
+ enabled, return an appropriate error. */
+#if !SVN_BDB_AUTO_RECOVER
+ if (svn_atomic_read(&bdb->panic))
+ err = svn_error_create(SVN_ERR_FS_BERKELEY_DB, NULL,
+ db_strerror(DB_RUNRECOVERY));
+#endif
+ }
+ else
+ {
+ /* If the bdb cache has been set to NULL that means we are
+ shutting down, and the pool that holds the bdb cache has
+ already been destroyed, so accessing it here would be a Bad
+ Thing (tm) */
+ if (bdb_cache)
+ apr_hash_set(bdb_cache, &bdb->key, sizeof bdb->key, NULL);
+ err = bdb_close(bdb);
+ }
+ return svn_error_trace(err);
+}
+
svn_error_t *
svn_fs_bdb__close(bdb_env_baton_t *bdb_baton)
{
- svn_error_t *err = SVN_NO_ERROR;
bdb_env_t *bdb = bdb_baton->bdb;
SVN_ERR_ASSERT(bdb_baton->env == bdb_baton->bdb->env);
+ SVN_ERR_ASSERT(bdb_baton->error_info->refcount > 0);
/* Neutralize bdb_baton's pool cleanup to prevent double-close. See
cleanup_env_baton(). */
@@ -548,31 +543,10 @@ svn_fs_bdb__close(bdb_env_baton_t *bdb_baton)
#endif
}
- acquire_cache_mutex();
- if (--bdb->refcount != 0)
- {
- release_cache_mutex();
+ /* This may run during final pool cleanup when the lock is NULL. */
+ SVN_MUTEX__WITH_LOCK(bdb_cache_lock, svn_fs_bdb__close_internal(bdb));
- /* If the environment is panicked and automatic recovery is not
- enabled, return an appropriate error. */
-#if !SVN_BDB_AUTO_RECOVER
- if (svn_atomic_read(&bdb->panic))
- err = svn_error_create(SVN_ERR_FS_BERKELEY_DB, NULL,
- db_strerror(DB_RUNRECOVERY));
-#endif
- }
- else
- {
- /* If the bdb cache has been set to NULL that means we are
- shutting down, and the pool that holds the bdb cache has
- already been destroyed, so accessing it here would be a Bad
- Thing (tm) */
- if (bdb_cache)
- apr_hash_set(bdb_cache, &bdb->key, sizeof bdb->key, NULL);
- err = bdb_close(bdb);
- release_cache_mutex();
- }
- return svn_error_trace(err);
+ return SVN_NO_ERROR;
}
@@ -614,44 +588,32 @@ cleanup_env_baton(void *data)
}
-svn_error_t *
-svn_fs_bdb__open(bdb_env_baton_t **bdb_batonp, const char *path,
- u_int32_t flags, int mode,
- apr_pool_t *pool)
+static svn_error_t *
+svn_fs_bdb__open_internal(bdb_env_baton_t **bdb_batonp,
+ const char *path,
+ u_int32_t flags, int mode,
+ apr_pool_t *pool)
{
- svn_error_t *err = SVN_NO_ERROR;
bdb_env_key_t key;
bdb_env_t *bdb;
svn_boolean_t panic;
- acquire_cache_mutex();
-
/* We can safely discard the open DB_CONFIG file handle. If the
environment descriptor is in the cache, the key's immutability is
guaranteed. If it's not, we don't care if the key changes,
between here and the actual insertion of the newly-created
environment into the cache, because no other thread can touch the
cache in the meantime. */
- err = bdb_cache_key(&key, NULL, path, pool);
- if (err)
- {
- release_cache_mutex();
- return svn_error_trace(err);
- }
+ SVN_ERR(bdb_cache_key(&key, NULL, path, pool));
bdb = bdb_cache_get(&key, &panic);
if (panic)
- {
- release_cache_mutex();
- return svn_error_create(SVN_ERR_FS_BERKELEY_DB, NULL,
- db_strerror(DB_RUNRECOVERY));
- }
+ return svn_error_create(SVN_ERR_FS_BERKELEY_DB, NULL,
+ db_strerror(DB_RUNRECOVERY));
/* Make sure that the environment's open flags haven't changed. */
if (bdb && bdb->flags != flags)
{
- release_cache_mutex();
-
/* Handle changes to the DB_PRIVATE flag specially */
if ((flags ^ bdb->flags) & DB_PRIVATE)
{
@@ -673,41 +635,50 @@ svn_fs_bdb__open(bdb_env_baton_t **bdb_batonp, const char *path,
if (!bdb)
{
- err = create_env(&bdb, path, svn_pool_create(bdb_cache_pool));
- if (!err)
+ svn_error_t *err;
+
+ SVN_ERR(create_env(&bdb, path, svn_pool_create(bdb_cache_pool)));
+ err = bdb_open(bdb, flags, mode);
+ if (err)
{
- err = bdb_open(bdb, flags, mode);
- if (!err)
- {
- apr_hash_set(bdb_cache, &bdb->key, sizeof bdb->key, bdb);
- bdb->flags = flags;
- bdb->refcount = 1;
- }
- else
- {
- /* Clean up, and we can't do anything about returned errors. */
- svn_error_clear(bdb_close(bdb));
- }
+ /* Clean up, and we can't do anything about returned errors. */
+ svn_error_clear(bdb_close(bdb));
+ return svn_error_trace(err);
}
+
+ apr_hash_set(bdb_cache, &bdb->key, sizeof bdb->key, bdb);
+ bdb->flags = flags;
+ bdb->refcount = 1;
}
else
{
++bdb->refcount;
}
- if (!err)
- {
- *bdb_batonp = apr_palloc(pool, sizeof **bdb_batonp);
- (*bdb_batonp)->env = bdb->env;
- (*bdb_batonp)->bdb = bdb;
- (*bdb_batonp)->error_info = get_error_info(bdb);
- ++(*bdb_batonp)->error_info->refcount;
- apr_pool_cleanup_register(pool, *bdb_batonp, cleanup_env_baton,
- apr_pool_cleanup_null);
- }
+ *bdb_batonp = apr_palloc(pool, sizeof **bdb_batonp);
+ (*bdb_batonp)->env = bdb->env;
+ (*bdb_batonp)->bdb = bdb;
+ (*bdb_batonp)->error_info = get_error_info(bdb);
+ ++(*bdb_batonp)->error_info->refcount;
+ apr_pool_cleanup_register(pool, *bdb_batonp, cleanup_env_baton,
+ apr_pool_cleanup_null);
- release_cache_mutex();
- return svn_error_trace(err);
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_fs_bdb__open(bdb_env_baton_t **bdb_batonp, const char *path,
+ u_int32_t flags, int mode,
+ apr_pool_t *pool)
+{
+ SVN_MUTEX__WITH_LOCK(bdb_cache_lock,
+ svn_fs_bdb__open_internal(bdb_batonp,
+ path,
+ flags,
+ mode,
+ pool));
+
+ return SVN_NO_ERROR;
}
diff --git a/subversion/libsvn_fs_base/bdb/lock-tokens-table.c b/subversion/libsvn_fs_base/bdb/lock-tokens-table.c
index 1de9ddd..e70ef17 100644
--- a/subversion/libsvn_fs_base/bdb/lock-tokens-table.c
+++ b/subversion/libsvn_fs_base/bdb/lock-tokens-table.c
@@ -84,7 +84,7 @@ svn_fs_bdb__lock_token_add(svn_fs_t *fs,
svn_fs_base__str_to_dbt(&key, path);
svn_fs_base__str_to_dbt(&value, lock_token);
svn_fs_base__trail_debug(trail, "lock-tokens", "add");
- return BDB_WRAP(fs, "storing lock token record",
+ return BDB_WRAP(fs, N_("storing lock token record"),
bfd->lock_tokens->put(bfd->lock_tokens, trail->db_txn,
&key, &value, 0));
}
@@ -104,8 +104,8 @@ svn_fs_bdb__lock_token_delete(svn_fs_t *fs,
svn_fs_base__trail_debug(trail, "lock-tokens", "del");
db_err = bfd->lock_tokens->del(bfd->lock_tokens, trail->db_txn, &key, 0);
if (db_err == DB_NOTFOUND)
- return SVN_FS__ERR_NO_SUCH_LOCK(fs, path, pool);
- return BDB_WRAP(fs, "deleting entry from 'lock-tokens' table", db_err);
+ return SVN_FS__ERR_NO_SUCH_LOCK(fs, path);
+ return BDB_WRAP(fs, N_("deleting entry from 'lock-tokens' table"), db_err);
}
@@ -131,8 +131,8 @@ svn_fs_bdb__lock_token_get(const char **lock_token_p,
svn_fs_base__track_dbt(&value, pool);
if (db_err == DB_NOTFOUND)
- return SVN_FS__ERR_NO_SUCH_LOCK(fs, path, pool);
- SVN_ERR(BDB_WRAP(fs, "reading lock token", db_err));
+ return SVN_FS__ERR_NO_SUCH_LOCK(fs, path);
+ SVN_ERR(BDB_WRAP(fs, N_("reading lock token"), db_err));
lock_token = apr_pstrmemdup(pool, value.data, value.size);
diff --git a/subversion/libsvn_fs_base/bdb/locks-table.c b/subversion/libsvn_fs_base/bdb/locks-table.c
index 9ffe694..a22663f 100644
--- a/subversion/libsvn_fs_base/bdb/locks-table.c
+++ b/subversion/libsvn_fs_base/bdb/locks-table.c
@@ -26,6 +26,7 @@
#include "bdb_compat.h"
#include "svn_pools.h"
+#include "svn_path.h"
#include "private/svn_skel.h"
#include "dbt.h"
@@ -89,7 +90,7 @@ svn_fs_bdb__lock_add(svn_fs_t *fs,
svn_fs_base__str_to_dbt(&key, lock_token);
svn_fs_base__skel_to_dbt(&value, lock_skel, pool);
svn_fs_base__trail_debug(trail, "lock", "add");
- return BDB_WRAP(fs, "storing lock record",
+ return BDB_WRAP(fs, N_("storing lock record"),
bfd->locks->put(bfd->locks, trail->db_txn,
&key, &value, 0));
}
@@ -112,7 +113,7 @@ svn_fs_bdb__lock_delete(svn_fs_t *fs,
if (db_err == DB_NOTFOUND)
return svn_fs_base__err_bad_lock_token(fs, lock_token);
- return BDB_WRAP(fs, "deleting lock from 'locks' table", db_err);
+ return BDB_WRAP(fs, N_("deleting lock from 'locks' table"), db_err);
}
@@ -139,7 +140,7 @@ svn_fs_bdb__lock_get(svn_lock_t **lock_p,
if (db_err == DB_NOTFOUND)
return svn_fs_base__err_bad_lock_token(fs, lock_token);
- SVN_ERR(BDB_WRAP(fs, "reading lock", db_err));
+ SVN_ERR(BDB_WRAP(fs, N_("reading lock"), db_err));
/* Parse TRANSACTION skel */
skel = svn_skel__parse(value.data, value.size, pool);
@@ -153,7 +154,7 @@ svn_fs_bdb__lock_get(svn_lock_t **lock_p,
if (lock->expiration_date && (apr_time_now() > lock->expiration_date))
{
SVN_ERR(svn_fs_bdb__lock_delete(fs, lock_token, trail, pool));
- return SVN_FS__ERR_LOCK_EXPIRED(fs, lock_token, pool);
+ return SVN_FS__ERR_LOCK_EXPIRED(fs, lock_token);
}
*lock_p = lock;
@@ -242,7 +243,8 @@ svn_fs_bdb__locks_get(svn_fs_t *fs,
svn_fs_base__trail_debug(trail, "lock-tokens", "cursor");
db_err = bfd->lock_tokens->cursor(bfd->lock_tokens, trail->db_txn,
&cursor, 0);
- SVN_ERR(BDB_WRAP(fs, "creating cursor for reading lock tokens", db_err));
+ SVN_ERR(BDB_WRAP(fs, N_("creating cursor for reading lock tokens"),
+ db_err));
/* Since the key is going to be returned as well as the value make
sure BDB malloc's the returned key. */
@@ -254,12 +256,12 @@ svn_fs_bdb__locks_get(svn_fs_t *fs,
db_err = svn_bdb_dbc_get(cursor, &key, svn_fs_base__result_dbt(&value),
DB_SET_RANGE);
- /* As long as the prefix of the returned KEY matches LOOKUP_PATH we
- know it is either LOOKUP_PATH or a decendant thereof. */
if (!svn_fspath__is_root(path, strlen(path)))
lookup_path = apr_pstrcat(pool, path, "/", (char *)NULL);
lookup_len = strlen(lookup_path);
+ /* As long as the prefix of the returned KEY matches LOOKUP_PATH we
+ know it is either LOOKUP_PATH or a decendant thereof. */
while ((! db_err)
&& lookup_len < key.size
&& strncmp(lookup_path, key.data, lookup_len) == 0)
@@ -282,7 +284,7 @@ svn_fs_bdb__locks_get(svn_fs_t *fs,
same set of results. So just see if CHILD_PATH is an
immediate child of PATH. If not, we don't care about
this item. */
- const char *rel_path = svn_fspath__is_child(path, child_path, subpool);
+ const char *rel_path = svn_fspath__skip_ancestor(path, child_path);
if (!rel_path || (svn_path_component_count(rel_path) != 1))
goto loop_it;
}
@@ -316,9 +318,10 @@ svn_fs_bdb__locks_get(svn_fs_t *fs,
db_c_err = svn_bdb_dbc_close(cursor);
if (db_err && (db_err != DB_NOTFOUND))
- SVN_ERR(BDB_WRAP(fs, "fetching lock tokens", db_err));
+ SVN_ERR(BDB_WRAP(fs, N_("fetching lock tokens"), db_err));
if (db_c_err)
- SVN_ERR(BDB_WRAP(fs, "fetching lock tokens (closing cursor)", db_c_err));
+ SVN_ERR(BDB_WRAP(fs, N_("fetching lock tokens (closing cursor)"),
+ db_c_err));
return SVN_NO_ERROR;
}
diff --git a/subversion/libsvn_fs_base/bdb/miscellaneous-table.c b/subversion/libsvn_fs_base/bdb/miscellaneous-table.c
index c1baedd..21a05ca 100644
--- a/subversion/libsvn_fs_base/bdb/miscellaneous-table.c
+++ b/subversion/libsvn_fs_base/bdb/miscellaneous-table.c
@@ -92,7 +92,7 @@ svn_fs_bdb__miscellaneous_set(svn_fs_t *fs,
if (val == NULL)
{
svn_fs_base__trail_debug(trail, "miscellaneous", "del");
- return BDB_WRAP(fs, "deleting record from 'miscellaneous' table",
+ return BDB_WRAP(fs, N_("deleting record from 'miscellaneous' table"),
bfd->miscellaneous->del(bfd->miscellaneous,
trail->db_txn, &key, 0));
}
@@ -100,7 +100,7 @@ svn_fs_bdb__miscellaneous_set(svn_fs_t *fs,
{
svn_fs_base__str_to_dbt(&value, val);
svn_fs_base__trail_debug(trail, "miscellaneous", "add");
- return BDB_WRAP(fs, "storing miscellaneous record",
+ return BDB_WRAP(fs, N_("storing miscellaneous record"),
bfd->miscellaneous->put(bfd->miscellaneous,
trail->db_txn,
&key, &value, 0));
@@ -128,7 +128,7 @@ svn_fs_bdb__miscellaneous_get(const char **val,
if (db_err != DB_NOTFOUND)
{
- SVN_ERR(BDB_WRAP(fs, "fetching miscellaneous record", db_err));
+ SVN_ERR(BDB_WRAP(fs, N_("fetching miscellaneous record"), db_err));
*val = apr_pstrmemdup(pool, value.data, value.size);
}
return SVN_NO_ERROR;
diff --git a/subversion/libsvn_fs_base/bdb/node-origins-table.c b/subversion/libsvn_fs_base/bdb/node-origins-table.c
index 4715dd2..48dc43b 100644
--- a/subversion/libsvn_fs_base/bdb/node-origins-table.c
+++ b/subversion/libsvn_fs_base/bdb/node-origins-table.c
@@ -124,7 +124,7 @@ svn_error_t *svn_fs_bdb__set_node_origin(svn_fs_t *fs,
/* Create a value from our ORIGIN_ID, and add this record to the table. */
svn_fs_base__id_to_dbt(&value, origin_id, pool);
svn_fs_base__trail_debug(trail, "node-origins", "put");
- return BDB_WRAP(fs, _("storing node-origins record"),
+ return BDB_WRAP(fs, N_("storing node-origins record"),
bfd->node_origins->put(bfd->node_origins, trail->db_txn,
&key, &value, 0));
}
@@ -139,7 +139,7 @@ svn_error_t *svn_fs_bdb__delete_node_origin(svn_fs_t *fs,
svn_fs_base__str_to_dbt(&key, node_id);
svn_fs_base__trail_debug(trail, "node-origins", "del");
- return BDB_WRAP(fs, "deleting entry from 'node-origins' table",
+ return BDB_WRAP(fs, N_("deleting entry from 'node-origins' table"),
bfd->node_origins->del(bfd->node_origins,
trail->db_txn, &key, 0));
}
diff --git a/subversion/libsvn_fs_base/bdb/nodes-table.c b/subversion/libsvn_fs_base/bdb/nodes-table.c
index ba84964..d0f475f 100644
--- a/subversion/libsvn_fs_base/bdb/nodes-table.c
+++ b/subversion/libsvn_fs_base/bdb/nodes-table.c
@@ -99,7 +99,7 @@ svn_fs_bdb__new_node_id(svn_fs_id_t **id_p,
/* Get the current value associated with the `next-key' key in the table. */
svn_fs_base__str_to_dbt(&query, NEXT_KEY_KEY);
svn_fs_base__trail_debug(trail, "nodes", "get");
- SVN_ERR(BDB_WRAP(fs, _("allocating new node ID (getting 'next-key')"),
+ SVN_ERR(BDB_WRAP(fs, N_("allocating new node ID (getting 'next-key')"),
bfd->nodes->get(bfd->nodes, trail->db_txn,
&query,
svn_fs_base__result_dbt(&result),
@@ -117,7 +117,7 @@ svn_fs_bdb__new_node_id(svn_fs_id_t **id_p,
svn_fs_base__str_to_dbt(&query, NEXT_KEY_KEY),
svn_fs_base__str_to_dbt(&result, next_key),
0);
- SVN_ERR(BDB_WRAP(fs, _("bumping next node ID key"), db_err));
+ SVN_ERR(BDB_WRAP(fs, N_("bumping next node ID key"), db_err));
/* Create and return the new node id. */
*id_p = svn_fs_base__id_create(next_node_id, copy_id, txn_id, pool);
@@ -179,7 +179,7 @@ svn_fs_bdb__delete_nodes_entry(svn_fs_t *fs,
DBT key;
svn_fs_base__trail_debug(trail, "nodes", "del");
- return BDB_WRAP(fs, _("deleting entry from 'nodes' table"),
+ return BDB_WRAP(fs, N_("deleting entry from 'nodes' table"),
bfd->nodes->del(bfd->nodes,
trail->db_txn,
svn_fs_base__id_to_dbt(&key, id, pool),
@@ -217,7 +217,7 @@ svn_fs_bdb__get_node_revision(node_revision_t **noderev_p,
return svn_fs_base__err_dangling_id(fs, id);
/* Handle any other error conditions. */
- SVN_ERR(BDB_WRAP(fs, _("reading node revision"), db_err));
+ SVN_ERR(BDB_WRAP(fs, N_("reading node revision"), db_err));
/* If our caller doesn't really care about the return value here,
just return successfully. */
@@ -250,7 +250,7 @@ svn_fs_bdb__put_node_revision(svn_fs_t *fs,
SVN_ERR(svn_fs_base__unparse_node_revision_skel(&skel, noderev,
bfd->format, pool));
svn_fs_base__trail_debug(trail, "nodes", "put");
- return BDB_WRAP(fs, _("storing node revision"),
+ return BDB_WRAP(fs, N_("storing node revision"),
bfd->nodes->put(bfd->nodes, db_txn,
svn_fs_base__id_to_dbt(&key, id, pool),
svn_fs_base__skel_to_dbt(&value, skel,
diff --git a/subversion/libsvn_fs_base/bdb/reps-table.c b/subversion/libsvn_fs_base/bdb/reps-table.c
index 1e83d2a..1c8ea6d 100644
--- a/subversion/libsvn_fs_base/bdb/reps-table.c
+++ b/subversion/libsvn_fs_base/bdb/reps-table.c
@@ -98,7 +98,7 @@ svn_fs_bdb__read_rep(representation_t **rep_p,
_("No such representation '%s'"), key);
/* Handle any other error conditions. */
- SVN_ERR(BDB_WRAP(fs, _("reading representation"), db_err));
+ SVN_ERR(BDB_WRAP(fs, N_("reading representation"), db_err));
/* Parse the REPRESENTATION skel. */
skel = svn_skel__parse(result.data, result.size, pool);
@@ -125,7 +125,7 @@ svn_fs_bdb__write_rep(svn_fs_t *fs,
/* Now write the record. */
svn_fs_base__trail_debug(trail, "representations", "put");
- return BDB_WRAP(fs, _("storing representation"),
+ return BDB_WRAP(fs, N_("storing representation"),
bfd->representations->put
(bfd->representations, trail->db_txn,
svn_fs_base__str_to_dbt(&query, key),
@@ -153,7 +153,7 @@ svn_fs_bdb__write_new_rep(const char **key,
/* Get the current value associated with `next-key'. */
svn_fs_base__str_to_dbt(&query, NEXT_KEY_KEY);
svn_fs_base__trail_debug(trail, "representations", "get");
- SVN_ERR(BDB_WRAP(fs, _("allocating new representation (getting next-key)"),
+ SVN_ERR(BDB_WRAP(fs, N_("allocating new representation (getting next-key)"),
bfd->representations->get
(bfd->representations, trail->db_txn, &query,
svn_fs_base__result_dbt(&result), 0)));
@@ -174,7 +174,7 @@ svn_fs_bdb__write_new_rep(const char **key,
svn_fs_base__str_to_dbt(&result, next_key),
0);
- return BDB_WRAP(fs, _("bumping next representation key"), db_err);
+ return BDB_WRAP(fs, N_("bumping next representation key"), db_err);
}
@@ -200,5 +200,5 @@ svn_fs_bdb__delete_rep(svn_fs_t *fs,
_("No such representation '%s'"), key);
/* Handle any other error conditions. */
- return BDB_WRAP(fs, _("deleting representation"), db_err);
+ return BDB_WRAP(fs, N_("deleting representation"), db_err);
}
diff --git a/subversion/libsvn_fs_base/bdb/rev-table.c b/subversion/libsvn_fs_base/bdb/rev-table.c
index 69e7446..b752249 100644
--- a/subversion/libsvn_fs_base/bdb/rev-table.c
+++ b/subversion/libsvn_fs_base/bdb/rev-table.c
@@ -92,7 +92,7 @@ svn_fs_bdb__get_rev(revision_t **revision_p,
return svn_fs_base__err_dangling_rev(fs, rev);
/* Handle any other error conditions. */
- SVN_ERR(BDB_WRAP(fs, _("reading filesystem revision"), db_err));
+ SVN_ERR(BDB_WRAP(fs, N_("reading filesystem revision"), db_err));
/* Parse REVISION skel. */
skel = svn_skel__parse(value.data, value.size, pool);
@@ -138,7 +138,7 @@ svn_fs_bdb__put_rev(svn_revnum_t *rev,
(bfd->revisions, trail->db_txn,
svn_fs_base__set_dbt(&query, &recno, sizeof(recno)),
svn_fs_base__skel_to_dbt(&result, skel, pool), 0);
- return BDB_WRAP(fs, "updating filesystem revision", db_err);
+ return BDB_WRAP(fs, N_("updating filesystem revision"), db_err);
}
svn_fs_base__trail_debug(trail, "revisions", "put");
@@ -146,7 +146,7 @@ svn_fs_bdb__put_rev(svn_revnum_t *rev,
svn_fs_base__recno_dbt(&key, &recno),
svn_fs_base__skel_to_dbt(&value, skel, pool),
DB_APPEND);
- SVN_ERR(BDB_WRAP(fs, "storing filesystem revision", db_err));
+ SVN_ERR(BDB_WRAP(fs, N_("storing filesystem revision"), db_err));
/* Turn the record number into a Subversion revision number.
Revisions are numbered starting with zero; Berkeley DB record
@@ -176,7 +176,7 @@ svn_fs_bdb__youngest_rev(svn_revnum_t *youngest_p,
/* Create a database cursor. */
svn_fs_base__trail_debug(trail, "revisions", "cursor");
- SVN_ERR(BDB_WRAP(fs, "getting youngest revision (creating cursor)",
+ SVN_ERR(BDB_WRAP(fs, N_("getting youngest revision (creating cursor)"),
bfd->revisions->cursor(bfd->revisions, trail->db_txn,
&cursor, 0)));
@@ -200,7 +200,7 @@ svn_fs_bdb__youngest_rev(svn_revnum_t *youngest_p,
"Corrupt DB: revision 0 missing from 'revisions' table, in "
"filesystem '%s'", fs->path);
- SVN_ERR(BDB_WRAP(fs, "getting youngest revision (finding last entry)",
+ SVN_ERR(BDB_WRAP(fs, N_("getting youngest revision (finding last entry)"),
db_err));
}
@@ -210,7 +210,7 @@ svn_fs_bdb__youngest_rev(svn_revnum_t *youngest_p,
reasons, and txn_commit shouldn't fail that way, and
2) using a cursor after committing its transaction can cause
undetectable database corruption. */
- SVN_ERR(BDB_WRAP(fs, "getting youngest revision (closing cursor)",
+ SVN_ERR(BDB_WRAP(fs, N_("getting youngest revision (closing cursor)"),
svn_bdb_dbc_close(cursor)));
/* Turn the record number into a Subversion revision number.
diff --git a/subversion/libsvn_fs_base/bdb/strings-table.c b/subversion/libsvn_fs_base/bdb/strings-table.c
index 032d789..f5348e7 100644
--- a/subversion/libsvn_fs_base/bdb/strings-table.c
+++ b/subversion/libsvn_fs_base/bdb/strings-table.c
@@ -91,7 +91,7 @@ locate_key(apr_size_t *length,
DBT result;
svn_fs_base__trail_debug(trail, "strings", "cursor");
- SVN_ERR(BDB_WRAP(fs, _("creating cursor for reading a string"),
+ SVN_ERR(BDB_WRAP(fs, N_("creating cursor for reading a string"),
bfd->strings->cursor(bfd->strings, trail->db_txn,
cursor, 0)));
@@ -121,7 +121,7 @@ locate_key(apr_size_t *length,
if (db_err != SVN_BDB_DB_BUFFER_SMALL)
{
svn_bdb_dbc_close(*cursor);
- return BDB_WRAP(fs, "moving cursor", db_err);
+ return BDB_WRAP(fs, N_("moving cursor"), db_err);
}
/* We got an SVN_BDB_DB_BUFFER_SMALL (typical since we have a
@@ -133,7 +133,7 @@ locate_key(apr_size_t *length,
if (db_err)
{
svn_bdb_dbc_close(*cursor);
- return BDB_WRAP(fs, "rerunning cursor move", db_err);
+ return BDB_WRAP(fs, N_("rerunning cursor move"), db_err);
}
}
@@ -225,7 +225,7 @@ svn_fs_bdb__string_read(svn_fs_t *fs,
return SVN_NO_ERROR;
}
if (db_err)
- return BDB_WRAP(fs, "reading string", db_err);
+ return BDB_WRAP(fs, N_("reading string"), db_err);
}
/* The current record contains OFFSET. Fetch the contents now. Note that
@@ -244,14 +244,14 @@ svn_fs_bdb__string_read(svn_fs_t *fs,
if (db_err)
{
svn_bdb_dbc_close(cursor);
- return BDB_WRAP(fs, "reading string", db_err);
+ return BDB_WRAP(fs, N_("reading string"), db_err);
}
bytes_read += result.size;
if (bytes_read == *len)
{
/* Done with the cursor. */
- SVN_ERR(BDB_WRAP(fs, "closing string-reading cursor",
+ SVN_ERR(BDB_WRAP(fs, N_("closing string-reading cursor"),
svn_bdb_dbc_close(cursor)));
break;
}
@@ -262,7 +262,7 @@ svn_fs_bdb__string_read(svn_fs_t *fs,
if (db_err == DB_NOTFOUND)
break;
if (db_err)
- return BDB_WRAP(fs, "reading string", db_err);
+ return BDB_WRAP(fs, N_("reading string"), db_err);
/* We'll be reading from the beginning of the next record */
offset = 0;
@@ -297,7 +297,7 @@ get_key_and_bump(svn_fs_t *fs,
write the new value -- that would append, not overwrite. */
svn_fs_base__trail_debug(trail, "strings", "cursor");
- SVN_ERR(BDB_WRAP(fs, "creating cursor for reading a string",
+ SVN_ERR(BDB_WRAP(fs, N_("creating cursor for reading a string"),
bfd->strings->cursor(bfd->strings, trail->db_txn,
&cursor, 0)));
@@ -310,7 +310,7 @@ get_key_and_bump(svn_fs_t *fs,
if (db_err)
{
svn_bdb_dbc_close(cursor);
- return BDB_WRAP(fs, "getting next-key value", db_err);
+ return BDB_WRAP(fs, N_("getting next-key value"), db_err);
}
svn_fs_base__track_dbt(&result, pool);
@@ -328,10 +328,10 @@ get_key_and_bump(svn_fs_t *fs,
{
svn_bdb_dbc_close(cursor); /* ignore the error, the original is
more important. */
- return BDB_WRAP(fs, "bumping next string key", db_err);
+ return BDB_WRAP(fs, N_("bumping next string key"), db_err);
}
- return BDB_WRAP(fs, "closing string-reading cursor",
+ return BDB_WRAP(fs, N_("closing string-reading cursor"),
svn_bdb_dbc_close(cursor));
}
@@ -355,7 +355,7 @@ svn_fs_bdb__string_append(svn_fs_t *fs,
/* Store a new record into the database. */
svn_fs_base__trail_debug(trail, "strings", "put");
- return BDB_WRAP(fs, "appending string",
+ return BDB_WRAP(fs, N_("appending string"),
bfd->strings->put
(bfd->strings, trail->db_txn,
svn_fs_base__str_to_dbt(&query, *key),
@@ -387,7 +387,7 @@ svn_fs_bdb__string_clear(svn_fs_t *fs,
"No such string '%s'", key);
/* Handle any other error conditions. */
- SVN_ERR(BDB_WRAP(fs, "clearing string", db_err));
+ SVN_ERR(BDB_WRAP(fs, N_("clearing string"), db_err));
/* Shove empty data back in for this key. */
svn_fs_base__clear_dbt(&result);
@@ -396,7 +396,7 @@ svn_fs_bdb__string_clear(svn_fs_t *fs,
result.flags |= DB_DBT_USERMEM;
svn_fs_base__trail_debug(trail, "strings", "put");
- return BDB_WRAP(fs, "storing empty contents",
+ return BDB_WRAP(fs, N_("storing empty contents"),
bfd->strings->put(bfd->strings, trail->db_txn,
&query, &result, 0));
}
@@ -433,7 +433,7 @@ svn_fs_bdb__string_size(svn_filesize_t *size,
return SVN_NO_ERROR;
}
if (db_err)
- return BDB_WRAP(fs, "fetching string length", db_err);
+ return BDB_WRAP(fs, N_("fetching string length"), db_err);
total += length;
}
@@ -463,7 +463,7 @@ svn_fs_bdb__string_delete(svn_fs_t *fs,
"No such string '%s'", key);
/* Handle any other error conditions. */
- return BDB_WRAP(fs, "deleting string", db_err);
+ return BDB_WRAP(fs, N_("deleting string"), db_err);
}
@@ -488,7 +488,7 @@ svn_fs_bdb__string_copy(svn_fs_t *fs,
SVN_ERR(get_key_and_bump(fs, new_key, trail, pool));
svn_fs_base__trail_debug(trail, "strings", "cursor");
- SVN_ERR(BDB_WRAP(fs, "creating cursor for reading a string",
+ SVN_ERR(BDB_WRAP(fs, N_("creating cursor for reading a string"),
bfd->strings->cursor(bfd->strings, trail->db_txn,
&cursor, 0)));
@@ -502,7 +502,7 @@ svn_fs_bdb__string_copy(svn_fs_t *fs,
if (db_err)
{
svn_bdb_dbc_close(cursor);
- return BDB_WRAP(fs, "getting next-key value", db_err);
+ return BDB_WRAP(fs, N_("getting next-key value"), db_err);
}
while (1)
@@ -521,7 +521,7 @@ svn_fs_bdb__string_copy(svn_fs_t *fs,
if (db_err)
{
svn_bdb_dbc_close(cursor);
- return BDB_WRAP(fs, "writing copied data", db_err);
+ return BDB_WRAP(fs, N_("writing copied data"), db_err);
}
/* Read the next chunk. Terminate loop if we're done. */
@@ -532,10 +532,10 @@ svn_fs_bdb__string_copy(svn_fs_t *fs,
if (db_err)
{
svn_bdb_dbc_close(cursor);
- return BDB_WRAP(fs, "fetching string data for a copy", db_err);
+ return BDB_WRAP(fs, N_("fetching string data for a copy"), db_err);
}
}
- return BDB_WRAP(fs, "closing string-reading cursor",
+ return BDB_WRAP(fs, N_("closing string-reading cursor"),
svn_bdb_dbc_close(cursor));
}
diff --git a/subversion/libsvn_fs_base/bdb/txn-table.c b/subversion/libsvn_fs_base/bdb/txn-table.c
index e19e89a..54a0e28 100644
--- a/subversion/libsvn_fs_base/bdb/txn-table.c
+++ b/subversion/libsvn_fs_base/bdb/txn-table.c
@@ -96,7 +96,7 @@ svn_fs_bdb__put_txn(svn_fs_t *fs,
svn_fs_base__str_to_dbt(&key, txn_name);
svn_fs_base__skel_to_dbt(&value, txn_skel, pool);
svn_fs_base__trail_debug(trail, "transactions", "put");
- return BDB_WRAP(fs, _("storing transaction record"),
+ return BDB_WRAP(fs, N_("storing transaction record"),
bfd->transactions->put(bfd->transactions, trail->db_txn,
&key, &value, 0));
}
@@ -120,7 +120,7 @@ allocate_txn_id(const char **id_p,
/* Get the current value associated with the `next-key' key in the table. */
svn_fs_base__trail_debug(trail, "transactions", "get");
- SVN_ERR(BDB_WRAP(fs, "allocating new transaction ID (getting 'next-key')",
+ SVN_ERR(BDB_WRAP(fs, N_("allocating new transaction ID (getting 'next-key')"),
bfd->transactions->get(bfd->transactions, trail->db_txn,
&query,
svn_fs_base__result_dbt(&result),
@@ -139,7 +139,7 @@ allocate_txn_id(const char **id_p,
db_err = bfd->transactions->put(bfd->transactions, trail->db_txn,
&query, &result, 0);
- return BDB_WRAP(fs, "bumping next transaction key", db_err);
+ return BDB_WRAP(fs, N_("bumping next transaction key"), db_err);
}
@@ -185,7 +185,7 @@ svn_fs_bdb__delete_txn(svn_fs_t *fs,
/* Delete the transaction from the `transactions' table. */
svn_fs_base__str_to_dbt(&key, txn_name);
svn_fs_base__trail_debug(trail, "transactions", "del");
- return BDB_WRAP(fs, "deleting entry from 'transactions' table",
+ return BDB_WRAP(fs, N_("deleting entry from 'transactions' table"),
bfd->transactions->del(bfd->transactions,
trail->db_txn, &key, 0));
}
@@ -215,7 +215,7 @@ svn_fs_bdb__get_txn(transaction_t **txn_p,
if (db_err == DB_NOTFOUND)
return svn_fs_base__err_no_such_txn(fs, txn_name);
- SVN_ERR(BDB_WRAP(fs, "reading transaction", db_err));
+ SVN_ERR(BDB_WRAP(fs, N_("reading transaction"), db_err));
/* Parse TRANSACTION skel */
skel = svn_skel__parse(value.data, value.size, pool);
@@ -248,7 +248,7 @@ svn_fs_bdb__get_txn_list(apr_array_header_t **names_p,
/* Create a database cursor to list the transaction names. */
svn_fs_base__trail_debug(trail, "transactions", "cursor");
- SVN_ERR(BDB_WRAP(fs, "reading transaction list (opening cursor)",
+ SVN_ERR(BDB_WRAP(fs, N_("reading transaction list (opening cursor)"),
bfd->transactions->cursor(bfd->transactions,
trail->db_txn, &cursor, 0)));
@@ -311,10 +311,10 @@ svn_fs_bdb__get_txn_list(apr_array_header_t **names_p,
db_c_err = svn_bdb_dbc_close(cursor);
if (db_err != DB_NOTFOUND)
{
- SVN_ERR(BDB_WRAP(fs, "reading transaction list (listing keys)",
+ SVN_ERR(BDB_WRAP(fs, N_("reading transaction list (listing keys)"),
db_err));
}
- SVN_ERR(BDB_WRAP(fs, "reading transaction list (closing cursor)",
+ SVN_ERR(BDB_WRAP(fs, N_("reading transaction list (closing cursor)"),
db_c_err));
/* Destroy the per-iteration subpool */
diff --git a/subversion/libsvn_fs_base/bdb/uuids-table.c b/subversion/libsvn_fs_base/bdb/uuids-table.c
index ecc967b..0481894 100644
--- a/subversion/libsvn_fs_base/bdb/uuids-table.c
+++ b/subversion/libsvn_fs_base/bdb/uuids-table.c
@@ -116,7 +116,7 @@ svn_error_t *svn_fs_bdb__get_uuid(svn_fs_t *fs,
value.flags |= DB_DBT_USERMEM;
svn_fs_base__trail_debug(trail, "uuids", "get");
- SVN_ERR(BDB_WRAP(fs, _("get repository uuid"),
+ SVN_ERR(BDB_WRAP(fs, N_("get repository uuid"),
uuids->get(uuids, trail->db_txn, &key, &value, 0)));
*uuid = apr_pstrmemdup(pool, value.data, value.size);
@@ -144,6 +144,6 @@ svn_error_t *svn_fs_bdb__set_uuid(svn_fs_t *fs,
value.data = apr_pstrmemdup(pool, uuid, value.size + 1);
svn_fs_base__trail_debug(trail, "uuids", "put");
- return BDB_WRAP(fs, _("set repository uuid"),
+ return BDB_WRAP(fs, N_("set repository uuid"),
uuids->put(uuids, trail->db_txn, &key, &value, 0));
}
diff --git a/subversion/libsvn_fs_base/dag.c b/subversion/libsvn_fs_base/dag.c
index 284838d..510ccbb 100644
--- a/subversion/libsvn_fs_base/dag.c
+++ b/subversion/libsvn_fs_base/dag.c
@@ -350,7 +350,7 @@ dir_entry_id_from_node(const svn_fs_id_t **id_p,
SVN_ERR(svn_fs_base__dag_dir_entries(&entries, parent, trail, pool));
if (entries)
- dirent = apr_hash_get(entries, name, APR_HASH_KEY_STRING);
+ dirent = svn_hash_gets(entries, name);
else
dirent = NULL;
@@ -421,7 +421,7 @@ set_entry(dag_node_t *parent,
entries = apr_hash_make(pool);
/* Now, add our new entry to the entries list. */
- apr_hash_set(entries, name, APR_HASH_KEY_STRING, id);
+ svn_hash_sets(entries, name, id);
/* Finally, replace the old entries list with the new one. */
SVN_ERR(svn_fs_base__unparse_entries_skel(&entries_skel, entries,
@@ -579,7 +579,7 @@ svn_fs_base__dag_get_proplist(apr_hash_t **proplist_p,
svn_error_t *
svn_fs_base__dag_set_proplist(dag_node_t *node,
- apr_hash_t *proplist,
+ const apr_hash_t *proplist,
const char *txn_id,
trail_t *trail,
apr_pool_t *pool)
@@ -910,7 +910,7 @@ svn_fs_base__dag_delete(dag_node_t *parent,
/* Find NAME in the ENTRIES skel. */
if (entries)
- id = apr_hash_get(entries, name, APR_HASH_KEY_STRING);
+ id = svn_hash_gets(entries, name);
/* If we never found ID in ENTRIES (perhaps because there are no
ENTRIES, perhaps because ID just isn't in the existing ENTRIES
@@ -929,7 +929,7 @@ svn_fs_base__dag_delete(dag_node_t *parent,
trail, pool));
/* Remove this entry from its parent's entries list. */
- apr_hash_set(entries, name, APR_HASH_KEY_STRING, NULL);
+ svn_hash_sets(entries, name, NULL);
/* Replace the old entries list with the new one. */
{
@@ -1593,12 +1593,11 @@ svn_fs_base__dag_commit_txn(svn_revnum_t *new_rev,
*new_rev = SVN_INVALID_REVNUM;
SVN_ERR(svn_fs_bdb__put_rev(new_rev, fs, &revision, trail, pool));
- if (apr_hash_get(txnprops, SVN_FS__PROP_TXN_CHECK_OOD, APR_HASH_KEY_STRING))
+ if (svn_hash_gets(txnprops, SVN_FS__PROP_TXN_CHECK_OOD))
SVN_ERR(svn_fs_base__set_txn_prop
(fs, txn_id, SVN_FS__PROP_TXN_CHECK_OOD, NULL, trail, pool));
- if (apr_hash_get(txnprops, SVN_FS__PROP_TXN_CHECK_LOCKS,
- APR_HASH_KEY_STRING))
+ if (svn_hash_gets(txnprops, SVN_FS__PROP_TXN_CHECK_LOCKS))
SVN_ERR(svn_fs_base__set_txn_prop
(fs, txn_id, SVN_FS__PROP_TXN_CHECK_LOCKS, NULL, trail, pool));
@@ -1632,7 +1631,7 @@ svn_fs_base__things_different(svn_boolean_t *props_changed,
if (! props_changed && ! contents_changed)
return SVN_NO_ERROR;
- /* The the node revision skels for these two nodes. */
+ /* The node revision skels for these two nodes. */
SVN_ERR(svn_fs_bdb__get_node_revision(&noderev1, node1->fs, node1->id,
trail, pool));
SVN_ERR(svn_fs_bdb__get_node_revision(&noderev2, node2->fs, node2->id,
diff --git a/subversion/libsvn_fs_base/dag.h b/subversion/libsvn_fs_base/dag.h
index 4d23a23..4c50c84 100644
--- a/subversion/libsvn_fs_base/dag.h
+++ b/subversion/libsvn_fs_base/dag.h
@@ -150,7 +150,7 @@ svn_error_t *svn_fs_base__dag_get_proplist(apr_hash_t **proplist_p,
node being changed must be mutable. TXN_ID is the Subversion
transaction under which this occurs. */
svn_error_t *svn_fs_base__dag_set_proplist(dag_node_t *node,
- apr_hash_t *proplist,
+ const apr_hash_t *proplist,
const char *txn_id,
trail_t *trail,
apr_pool_t *pool);
diff --git a/subversion/libsvn_fs_base/err.c b/subversion/libsvn_fs_base/err.c
index dc58bb6..c1e691d 100644
--- a/subversion/libsvn_fs_base/err.c
+++ b/subversion/libsvn_fs_base/err.c
@@ -62,10 +62,11 @@ svn_fs_base__err_dangling_id(svn_fs_t *fs, const svn_fs_id_t *id)
svn_error_t *
svn_fs_base__err_dangling_rev(svn_fs_t *fs, svn_revnum_t rev)
{
+ /* Log the UUID as this error may be reported to the client. */
return svn_error_createf
(SVN_ERR_FS_NO_SUCH_REVISION, 0,
_("No such revision %ld in filesystem '%s'"),
- rev, fs->path);
+ rev, fs->uuid);
}
diff --git a/subversion/libsvn_fs_base/fs.c b/subversion/libsvn_fs_base/fs.c
index 30a8217..4ad9e6f 100644
--- a/subversion/libsvn_fs_base/fs.c
+++ b/subversion/libsvn_fs_base/fs.c
@@ -28,6 +28,7 @@
#include <apr_pools.h>
#include <apr_file_io.h>
+#include "svn_hash.h"
#include "svn_pools.h"
#include "svn_fs.h"
#include "svn_path.h"
@@ -64,6 +65,8 @@
#include "../libsvn_fs/fs-loader.h"
#include "private/svn_fs_util.h"
+#include "private/svn_subr_private.h"
+
/* Checking for return values, and reporting errors. */
@@ -333,9 +336,10 @@ bdb_write_config(svn_fs_t *fs)
"#\n"
"# Make sure you read the documentation at:\n"
"#\n"
- "# http://www.oracle.com/technology/documentation/berkeley-db/db/ref/lock/max.html\n"
+ "# http://docs.oracle.com/cd/E17076_02/html/programmer_reference/lock_max.html\n"
"#\n"
"# before tweaking these values.\n"
+ "#\n"
"set_lk_max_locks 2000\n"
"set_lk_max_lockers 2000\n"
"set_lk_max_objects 2000\n"
@@ -344,9 +348,9 @@ bdb_write_config(svn_fs_t *fs)
"#\n"
"# Make sure you read the documentation at:\n"
"#\n"
- "# http://www.oracle.com/technology/documentation/berkeley-db/db/api_c/env_set_lg_bsize.html\n"
- "# http://www.oracle.com/technology/documentation/berkeley-db/db/api_c/env_set_lg_max.html\n"
- "# http://www.oracle.com/technology/documentation/berkeley-db/db/ref/log/limits.html\n"
+ "# http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_lg_bsize.html\n"
+ "# http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_lg_max.html\n"
+ "# http://docs.oracle.com/cd/E17076_02/html/programmer_reference/log_limits.html\n"
"#\n"
"# Increase the size of the in-memory log buffer from the default\n"
"# of 32 Kbytes to 256 Kbytes. Decrease the log file size from\n"
@@ -354,24 +358,28 @@ bdb_write_config(svn_fs_t *fs)
"# space required for hot backups. The size of the log file must be\n"
"# at least four times the size of the in-memory log buffer.\n"
"#\n"
- "# Note: Decreasing the in-memory buffer size below 256 Kbytes\n"
- "# will hurt commit performance. For details, see this post from\n"
- "# Daniel Berlin <dan@dberlin.org>:\n"
+ "# Note: Decreasing the in-memory buffer size below 256 Kbytes will hurt\n"
+ "# hurt commit performance. For details, see:\n"
+ "#\n"
+ "# http://svn.haxx.se/dev/archive-2002-02/0141.shtml\n"
"#\n"
- "# http://subversion.tigris.org/servlets/ReadMsg?list=dev&msgId=161960\n"
"set_lg_bsize 262144\n"
"set_lg_max 1048576\n"
"#\n"
"# If you see \"log region out of memory\" errors, bump lg_regionmax.\n"
- "# See http://www.oracle.com/technology/documentation/berkeley-db/db/ref/log/config.html\n"
- "# and http://svn.haxx.se/users/archive-2004-10/1001.shtml for more.\n"
+ "# For more information, see:\n"
+ "#\n"
+ "# http://docs.oracle.com/cd/E17076_02/html/programmer_reference/log_config.html\n"
+ "# http://svn.haxx.se/users/archive-2004-10/1000.shtml\n"
+ "#\n"
"set_lg_regionmax 131072\n"
"#\n"
/* ### Configure this with "svnadmin create --bdb-cache-size" */
"# The default cache size in BDB is only 256k. As explained in\n"
- "# http://svn.haxx.se/dev/archive-2004-12/0369.shtml, this is too\n"
+ "# http://svn.haxx.se/dev/archive-2004-12/0368.shtml, this is too\n"
"# small for most applications. Bump this number if \"db_stat -m\"\n"
"# shows too many cache misses.\n"
+ "#\n"
"set_cachesize 0 1048576 1\n";
/* Run-time configurable options.
@@ -397,11 +405,12 @@ bdb_write_config(svn_fs_t *fs)
"# Disable fsync of log files on transaction commit. Read the\n"
"# documentation about DB_TXN_NOSYNC at:\n"
"#\n"
- "# http://www.oracle.com/technology/documentation/berkeley-db/db/ref/log/config.html\n"
+ "# http://docs.oracle.com/cd/E17076_02/html/programmer_reference/log_config.html\n"
"#\n"
- "# [requires Berkeley DB 4.0]\n",
+ "# [requires Berkeley DB 4.0]\n"
+ "#\n",
/* inactive */
- "# set_flags DB_TXN_NOSYNC\n",
+ "#set_flags DB_TXN_NOSYNC\n",
/* active */
"set_flags DB_TXN_NOSYNC\n" },
/* Controlled by "svnadmin create --bdb-log-keep" */
@@ -411,11 +420,12 @@ bdb_write_config(svn_fs_t *fs)
"# Enable automatic removal of unused transaction log files.\n"
"# Read the documentation about DB_LOG_AUTOREMOVE at:\n"
"#\n"
- "# http://www.oracle.com/technology/documentation/berkeley-db/db/ref/log/config.html\n"
+ "# http://docs.oracle.com/cd/E17076_02/html/programmer_reference/log_config.html\n"
"#\n"
- "# [requires Berkeley DB 4.2]\n",
+ "# [requires Berkeley DB 4.2]\n"
+ "#\n",
/* inactive */
- "# set_flags DB_LOG_AUTOREMOVE\n",
+ "#set_flags DB_LOG_AUTOREMOVE\n",
/* active */
"set_flags DB_LOG_AUTOREMOVE\n" },
};
@@ -439,9 +449,7 @@ bdb_write_config(svn_fs_t *fs)
if (fs->config)
{
- value = apr_hash_get(fs->config,
- dbconfig_options[i].config_key,
- APR_HASH_KEY_STRING);
+ value = svn_hash_gets(fs->config, dbconfig_options[i].config_key);
}
SVN_ERR(svn_io_file_write_full(dbconfig_file,
@@ -464,15 +472,22 @@ bdb_write_config(svn_fs_t *fs)
return svn_io_file_close(dbconfig_file, fs->pool);
}
-
-
static svn_error_t *
-base_serialized_init(svn_fs_t *fs, apr_pool_t *common_pool, apr_pool_t *pool)
+base_bdb_verify_root(svn_fs_root_t *root,
+ apr_pool_t *scratch_pool)
{
- /* Nothing to do here. */
+ /* Verifying is currently a no op for BDB. */
return SVN_NO_ERROR;
}
+static svn_error_t *
+base_bdb_freeze(svn_fs_t *fs,
+ svn_fs_freeze_func_t freeze_func,
+ void *freeze_baton,
+ apr_pool_t *pool)
+{
+ SVN__NOT_IMPLEMENTED();
+}
/* Creating a new filesystem */
@@ -482,7 +497,6 @@ static fs_vtable_t fs_vtable = {
svn_fs_base__revision_prop,
svn_fs_base__revision_proplist,
svn_fs_base__change_rev_prop,
- svn_fs_base__get_uuid,
svn_fs_base__set_uuid,
svn_fs_base__revision_root,
svn_fs_base__begin_txn,
@@ -495,6 +509,8 @@ static fs_vtable_t fs_vtable = {
svn_fs_base__unlock,
svn_fs_base__get_lock,
svn_fs_base__get_locks,
+ base_bdb_verify_root,
+ base_bdb_freeze,
base_bdb_set_errcall,
};
@@ -555,62 +571,62 @@ open_databases(svn_fs_t *fs,
/* Create the databases in the environment. */
SVN_ERR(BDB_WRAP(fs, (create
- ? "creating 'nodes' table"
- : "opening 'nodes' table"),
+ ? N_("creating 'nodes' table")
+ : N_("opening 'nodes' table")),
svn_fs_bdb__open_nodes_table(&bfd->nodes,
bfd->bdb->env,
create)));
SVN_ERR(BDB_WRAP(fs, (create
- ? "creating 'revisions' table"
- : "opening 'revisions' table"),
+ ? N_("creating 'revisions' table")
+ : N_("opening 'revisions' table")),
svn_fs_bdb__open_revisions_table(&bfd->revisions,
bfd->bdb->env,
create)));
SVN_ERR(BDB_WRAP(fs, (create
- ? "creating 'transactions' table"
- : "opening 'transactions' table"),
+ ? N_("creating 'transactions' table")
+ : N_("opening 'transactions' table")),
svn_fs_bdb__open_transactions_table(&bfd->transactions,
bfd->bdb->env,
create)));
SVN_ERR(BDB_WRAP(fs, (create
- ? "creating 'copies' table"
- : "opening 'copies' table"),
+ ? N_("creating 'copies' table")
+ : N_("opening 'copies' table")),
svn_fs_bdb__open_copies_table(&bfd->copies,
bfd->bdb->env,
create)));
SVN_ERR(BDB_WRAP(fs, (create
- ? "creating 'changes' table"
- : "opening 'changes' table"),
+ ? N_("creating 'changes' table")
+ : N_("opening 'changes' table")),
svn_fs_bdb__open_changes_table(&bfd->changes,
bfd->bdb->env,
create)));
SVN_ERR(BDB_WRAP(fs, (create
- ? "creating 'representations' table"
- : "opening 'representations' table"),
+ ? N_("creating 'representations' table")
+ : N_("opening 'representations' table")),
svn_fs_bdb__open_reps_table(&bfd->representations,
bfd->bdb->env,
create)));
SVN_ERR(BDB_WRAP(fs, (create
- ? "creating 'strings' table"
- : "opening 'strings' table"),
+ ? N_("creating 'strings' table")
+ : N_("opening 'strings' table")),
svn_fs_bdb__open_strings_table(&bfd->strings,
bfd->bdb->env,
create)));
SVN_ERR(BDB_WRAP(fs, (create
- ? "creating 'uuids' table"
- : "opening 'uuids' table"),
+ ? N_("creating 'uuids' table")
+ : N_("opening 'uuids' table")),
svn_fs_bdb__open_uuids_table(&bfd->uuids,
bfd->bdb->env,
create)));
SVN_ERR(BDB_WRAP(fs, (create
- ? "creating 'locks' table"
- : "opening 'locks' table"),
+ ? N_("creating 'locks' table")
+ : N_("opening 'locks' table")),
svn_fs_bdb__open_locks_table(&bfd->locks,
bfd->bdb->env,
create)));
SVN_ERR(BDB_WRAP(fs, (create
- ? "creating 'lock-tokens' table"
- : "opening 'lock-tokens' table"),
+ ? N_("creating 'lock-tokens' table")
+ : N_("opening 'lock-tokens' table")),
svn_fs_bdb__open_lock_tokens_table(&bfd->lock_tokens,
bfd->bdb->env,
create)));
@@ -618,8 +634,8 @@ open_databases(svn_fs_t *fs,
if (format >= SVN_FS_BASE__MIN_NODE_ORIGINS_FORMAT)
{
SVN_ERR(BDB_WRAP(fs, (create
- ? "creating 'node-origins' table"
- : "opening 'node-origins' table"),
+ ? N_("creating 'node-origins' table")
+ : N_("opening 'node-origins' table")),
svn_fs_bdb__open_node_origins_table(&bfd->node_origins,
bfd->bdb->env,
create)));
@@ -628,8 +644,8 @@ open_databases(svn_fs_t *fs,
if (format >= SVN_FS_BASE__MIN_MISCELLANY_FORMAT)
{
SVN_ERR(BDB_WRAP(fs, (create
- ? "creating 'miscellaneous' table"
- : "opening 'miscellaneous' table"),
+ ? N_("creating 'miscellaneous' table")
+ : N_("opening 'miscellaneous' table")),
svn_fs_bdb__open_miscellaneous_table(&bfd->miscellaneous,
bfd->bdb->env,
create)));
@@ -638,8 +654,8 @@ open_databases(svn_fs_t *fs,
if (format >= SVN_FS_BASE__MIN_REP_SHARING_FORMAT)
{
SVN_ERR(BDB_WRAP(fs, (create
- ? "creating 'checksum-reps' table"
- : "opening 'checksum-reps' table"),
+ ? N_("creating 'checksum-reps' table")
+ : N_("opening 'checksum-reps' table")),
svn_fs_bdb__open_checksum_reps_table(&bfd->checksum_reps,
bfd->bdb->env,
create)));
@@ -649,6 +665,15 @@ open_databases(svn_fs_t *fs,
}
+/* Called by functions that initialize an svn_fs_t struct, after that
+ initialization is done, to populate svn_fs_t->uuid. */
+static svn_error_t *
+populate_opened_fs(svn_fs_t *fs, apr_pool_t *scratch_pool)
+{
+ SVN_ERR(svn_fs_base__populate_uuid(fs, scratch_pool));
+ return SVN_NO_ERROR;
+}
+
static svn_error_t *
base_create(svn_fs_t *fs, const char *path, apr_pool_t *pool,
apr_pool_t *common_pool)
@@ -659,14 +684,11 @@ base_create(svn_fs_t *fs, const char *path, apr_pool_t *pool,
/* See if compatibility with older versions was explicitly requested. */
if (fs->config)
{
- if (apr_hash_get(fs->config, SVN_FS_CONFIG_PRE_1_4_COMPATIBLE,
- APR_HASH_KEY_STRING))
+ if (svn_hash_gets(fs->config, SVN_FS_CONFIG_PRE_1_4_COMPATIBLE))
format = 1;
- else if (apr_hash_get(fs->config, SVN_FS_CONFIG_PRE_1_5_COMPATIBLE,
- APR_HASH_KEY_STRING))
+ else if (svn_hash_gets(fs->config, SVN_FS_CONFIG_PRE_1_5_COMPATIBLE))
format = 2;
- else if (apr_hash_get(fs->config, SVN_FS_CONFIG_PRE_1_6_COMPATIBLE,
- APR_HASH_KEY_STRING))
+ else if (svn_hash_gets(fs->config, SVN_FS_CONFIG_PRE_1_6_COMPATIBLE))
format = 3;
}
@@ -684,7 +706,9 @@ base_create(svn_fs_t *fs, const char *path, apr_pool_t *pool,
if (svn_err) goto error;
((base_fs_data_t *) fs->fsap_data)->format = format;
- return base_serialized_init(fs, common_pool, pool);
+
+ SVN_ERR(populate_opened_fs(fs, pool));
+ return SVN_NO_ERROR;;
error:
svn_error_clear(cleanup_fs(fs));
@@ -768,7 +792,8 @@ base_open(svn_fs_t *fs, const char *path, apr_pool_t *pool,
if (svn_err) goto error;
}
- return base_serialized_init(fs, common_pool, pool);
+ SVN_ERR(populate_opened_fs(fs, pool));
+ return SVN_NO_ERROR;
error:
svn_error_clear(cleanup_fs(fs));
@@ -873,6 +898,21 @@ base_upgrade(svn_fs_t *fs, const char *path, apr_pool_t *pool,
}
static svn_error_t *
+base_verify(svn_fs_t *fs, const char *path,
+ svn_revnum_t start,
+ svn_revnum_t end,
+ svn_fs_progress_notify_func_t notify_func,
+ void *notify_baton,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *pool,
+ apr_pool_t *common_pool)
+{
+ /* Verifying is currently a no op for BDB. */
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
base_bdb_recover(svn_fs_t *fs,
svn_cancel_func_t cancel_func, void *cancel_baton,
apr_pool_t *pool)
@@ -889,7 +929,8 @@ base_bdb_pack(svn_fs_t *fs,
void *notify_baton,
svn_cancel_func_t cancel,
void *cancel_baton,
- apr_pool_t *pool)
+ apr_pool_t *pool,
+ apr_pool_t *common_pool)
{
/* Packing is currently a no op for BDB. */
return SVN_NO_ERROR;
@@ -984,7 +1025,7 @@ svn_fs_base__clean_logs(const char *live_path,
sub_pool));
/* If log files do not match, go to the next log file. */
- if (files_match == FALSE)
+ if (!files_match)
continue;
}
@@ -1092,7 +1133,7 @@ copy_db_file_safely(const char *src_dir,
/* Open source file. If it's missing and that's allowed, there's
nothing more to do here. */
err = svn_io_file_open(&s, file_src_path,
- (APR_READ | APR_LARGEFILE | APR_BINARY),
+ (APR_READ | APR_LARGEFILE),
APR_OS_DEFAULT, pool);
if (err && APR_STATUS_IS_ENOENT(err->apr_err) && allow_missing)
{
@@ -1103,7 +1144,7 @@ copy_db_file_safely(const char *src_dir,
/* Open destination file. */
SVN_ERR(svn_io_file_open(&d, file_dst_path, (APR_WRITE | APR_CREATE |
- APR_LARGEFILE | APR_BINARY),
+ APR_LARGEFILE),
APR_OS_DEFAULT, pool));
/* Allocate our read/write buffer. */
@@ -1154,9 +1195,14 @@ copy_db_file_safely(const char *src_dir,
static svn_error_t *
-base_hotcopy(const char *src_path,
+base_hotcopy(svn_fs_t *src_fs,
+ svn_fs_t *dst_fs,
+ const char *src_path,
const char *dest_path,
svn_boolean_t clean_logs,
+ svn_boolean_t incremental,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
apr_pool_t *pool)
{
svn_error_t *err;
@@ -1164,6 +1210,11 @@ base_hotcopy(const char *src_path,
svn_boolean_t log_autoremove = FALSE;
int format;
+ if (incremental)
+ return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
+ _("BDB repositories do not support incremental "
+ "hotcopy"));
+
/* Check the FS format number to be certain that we know how to
hotcopy this FS. Pre-1.2 filesystems did not have a format file (you
could say they were format "0"), so we will error here. This is not
@@ -1332,6 +1383,15 @@ base_get_description(void)
return _("Module for working with a Berkeley DB repository.");
}
+static svn_error_t *
+base_set_svn_fs_open(svn_fs_t *fs,
+ svn_error_t *(*svn_fs_open_)(svn_fs_t **,
+ const char *,
+ apr_hash_t *,
+ apr_pool_t *))
+{
+ return SVN_NO_ERROR;
+}
/* Base FS library vtable, used by the FS loader library. */
@@ -1341,13 +1401,15 @@ static fs_library_vtable_t library_vtable = {
base_open,
base_open_for_recovery,
base_upgrade,
+ base_verify,
base_delete_fs,
base_hotcopy,
base_get_description,
base_bdb_recover,
base_bdb_pack,
base_bdb_logfiles,
- svn_fs_base__id_parse
+ svn_fs_base__id_parse,
+ base_set_svn_fs_open
};
svn_error_t *
@@ -1367,7 +1429,7 @@ svn_fs_base__init(const svn_version_t *loader_version,
return svn_error_createf(SVN_ERR_VERSION_MISMATCH, NULL,
_("Unsupported FS loader version (%d) for bdb"),
loader_version->major);
- SVN_ERR(svn_ver_check_list(base_version(), checklist));
+ SVN_ERR(svn_ver_check_list2(base_version(), checklist, svn_ver_equal));
SVN_ERR(check_bdb_version());
SVN_ERR(svn_fs_bdb__init(common_pool));
diff --git a/subversion/libsvn_fs_base/fs.h b/subversion/libsvn_fs_base/fs.h
index dc07ee1..017c898 100644
--- a/subversion/libsvn_fs_base/fs.h
+++ b/subversion/libsvn_fs_base/fs.h
@@ -108,9 +108,6 @@ typedef struct base_fs_data_t
transaction trail alive. */
svn_boolean_t in_txn_trail;
- /* The filesystem UUID (or NULL if not-yet-known; see svn_fs_get_uuid). */
- const char *uuid;
-
/* The format number of this FS. */
int format;
diff --git a/subversion/libsvn_fs_base/id.c b/subversion/libsvn_fs_base/id.c
index 0e34540..c063d02 100644
--- a/subversion/libsvn_fs_base/id.c
+++ b/subversion/libsvn_fs_base/id.c
@@ -168,7 +168,7 @@ svn_fs_base__id_parse(const char *data,
{
svn_fs_id_t *id;
id_private_t *pvt;
- char *data_copy, *str, *last_str;
+ char *data_copy, *str;
/* Dup the ID data into POOL. Our returned ID will have references
into this memory. */
@@ -181,24 +181,25 @@ svn_fs_base__id_parse(const char *data,
id->fsap_data = pvt;
/* Now, we basically just need to "split" this data on `.'
- characters. We will use apr_strtok, which will put terminators
- where each of the '.'s used to be. Then our new id field will
- reference string locations inside our duplicate string.*/
+ characters. We will use svn_cstring_tokenize, which will put
+ terminators where each of the '.'s used to be. Then our new
+ id field will reference string locations inside our duplicate
+ string.*/
/* Node Id */
- str = apr_strtok(data_copy, ".", &last_str);
+ str = svn_cstring_tokenize(".", &data_copy);
if (str == NULL)
return NULL;
pvt->node_id = str;
/* Copy Id */
- str = apr_strtok(NULL, ".", &last_str);
+ str = svn_cstring_tokenize(".", &data_copy);
if (str == NULL)
return NULL;
pvt->copy_id = str;
/* Txn Id */
- str = apr_strtok(NULL, ".", &last_str);
+ str = svn_cstring_tokenize(".", &data_copy);
if (str == NULL)
return NULL;
pvt->txn_id = str;
diff --git a/subversion/libsvn_fs_base/lock.c b/subversion/libsvn_fs_base/lock.c
index f1d05e5..79f72cc 100644
--- a/subversion/libsvn_fs_base/lock.c
+++ b/subversion/libsvn_fs_base/lock.c
@@ -21,6 +21,7 @@
*/
+#include "svn_hash.h"
#include "svn_pools.h"
#include "svn_error.h"
#include "svn_fs.h"
@@ -36,6 +37,8 @@
#include "util/fs_skels.h"
#include "../libsvn_fs/fs-loader.h"
#include "private/svn_fs_util.h"
+#include "private/svn_subr_private.h"
+#include "private/svn_dep_compat.h"
/* Add LOCK and its associated LOCK_TOKEN (associated with PATH) as
@@ -93,7 +96,7 @@ txn_body_lock(void *baton, trail_t *trail)
/* Until we implement directory locks someday, we only allow locks
on files or non-existent paths. */
if (kind == svn_node_dir)
- return SVN_FS__ERR_NOT_FILE(trail->fs, args->path, trail->pool);
+ return SVN_FS__ERR_NOT_FILE(trail->fs, args->path);
/* While our locking implementation easily supports the locking of
nonexistent paths, we deliberately choose not to allow such madness. */
@@ -113,7 +116,7 @@ txn_body_lock(void *baton, trail_t *trail)
/* There better be a username attached to the fs. */
if (!trail->fs->access_ctx || !trail->fs->access_ctx->username)
- return SVN_FS__ERR_NO_USER(trail->fs, trail->pool);
+ return SVN_FS__ERR_NO_USER(trail->fs);
/* Is the caller attempting to lock an out-of-date working file? */
if (SVN_IS_VALID_REVNUM(args->current_rev))
@@ -179,8 +182,7 @@ txn_body_lock(void *baton, trail_t *trail)
{
/* Sorry, the path is already locked. */
return SVN_FS__ERR_PATH_ALREADY_LOCKED(trail->fs,
- existing_lock,
- trail->pool);
+ existing_lock);
}
else
{
@@ -282,22 +284,21 @@ txn_body_unlock(void *baton, trail_t *trail)
if (args->token == NULL)
return svn_fs_base__err_no_lock_token(trail->fs, args->path);
else if (strcmp(lock_token, args->token) != 0)
- return SVN_FS__ERR_NO_SUCH_LOCK(trail->fs, args->path, trail->pool);
+ return SVN_FS__ERR_NO_SUCH_LOCK(trail->fs, args->path);
SVN_ERR(svn_fs_bdb__lock_get(&lock, trail->fs, lock_token,
trail, trail->pool));
/* There better be a username attached to the fs. */
if (!trail->fs->access_ctx || !trail->fs->access_ctx->username)
- return SVN_FS__ERR_NO_USER(trail->fs, trail->pool);
+ return SVN_FS__ERR_NO_USER(trail->fs);
/* And that username better be the same as the lock's owner. */
if (strcmp(trail->fs->access_ctx->username, lock->owner) != 0)
return SVN_FS__ERR_LOCK_OWNER_MISMATCH(
trail->fs,
trail->fs->access_ctx->username,
- lock->owner,
- trail->pool);
+ lock->owner);
}
/* Remove a row from each of the locking tables. */
@@ -396,9 +397,9 @@ svn_fs_base__get_lock(svn_lock_t **lock,
}
/* Implements `svn_fs_get_locks_callback_t', spooling lock information
- to disk as the filesystem provides it. BATON is an 'apr_file_t *'
- object pointing to open, writable spool file. We'll write the
- spool file with a format like so:
+ to a stream as the filesystem provides it. BATON is an 'svn_stream_t *'
+ object pointing to the stream. We'll write the spool stream with a
+ format like so:
SKEL1_LEN "\n" SKEL1 "\n" SKEL2_LEN "\n" SKEL2 "\n" ...
@@ -410,18 +411,20 @@ spool_locks_info(void *baton,
apr_pool_t *pool)
{
svn_skel_t *lock_skel;
- apr_file_t *spool_file = (apr_file_t *)baton;
+ svn_stream_t *stream = baton;
const char *skel_len;
svn_stringbuf_t *skel_buf;
+ apr_size_t len;
SVN_ERR(svn_fs_base__unparse_lock_skel(&lock_skel, lock, pool));
skel_buf = svn_skel__unparse(lock_skel, pool);
skel_len = apr_psprintf(pool, "%" APR_SIZE_T_FMT "\n", skel_buf->len);
- SVN_ERR(svn_io_file_write_full(spool_file, skel_len, strlen(skel_len),
- NULL, pool));
- SVN_ERR(svn_io_file_write_full(spool_file, skel_buf->data,
- skel_buf->len, NULL, pool));
- return svn_io_file_write_full(spool_file, "\n", 1, NULL, pool);
+ len = strlen(skel_len);
+ SVN_ERR(svn_stream_write(stream, skel_len, &len));
+ len = skel_buf->len;
+ SVN_ERR(svn_stream_write(stream, skel_buf->data, &len));
+ len = 1;
+ return svn_stream_write(stream, "\n", &len);
}
@@ -429,7 +432,7 @@ struct locks_get_args
{
const char *path;
svn_depth_t depth;
- apr_file_t *spool_file;
+ svn_stream_t *stream;
};
@@ -438,7 +441,7 @@ txn_body_get_locks(void *baton, trail_t *trail)
{
struct locks_get_args *args = baton;
return svn_fs_bdb__locks_get(trail->fs, args->path, args->depth,
- spool_locks_info, args->spool_file,
+ spool_locks_info, args->stream,
trail, trail->pool);
}
@@ -452,7 +455,6 @@ svn_fs_base__get_locks(svn_fs_t *fs,
apr_pool_t *pool)
{
struct locks_get_args args;
- apr_off_t offset = 0;
svn_stream_t *stream;
svn_stringbuf_t *buf;
svn_boolean_t eof;
@@ -462,21 +464,23 @@ svn_fs_base__get_locks(svn_fs_t *fs,
args.path = svn_fs__canonicalize_abspath(path, pool);
args.depth = depth;
- SVN_ERR(svn_io_open_uniquely_named(&(args.spool_file), NULL, NULL, NULL,
- NULL, svn_io_file_del_on_close,
- pool, pool));
+ /* Enough for 100+ locks if the comments are small. */
+ args.stream = svn_stream__from_spillbuf(4 * 1024 /* blocksize */,
+ 64 * 1024 /* maxsize */,
+ pool);
SVN_ERR(svn_fs_base__retry_txn(fs, txn_body_get_locks, &args, FALSE, pool));
- /* Rewind the spool file, then re-read it, calling GET_LOCKS_FUNC(). */
- SVN_ERR(svn_io_file_seek(args.spool_file, APR_SET, &offset, pool));
- stream = svn_stream_from_aprfile2(args.spool_file, FALSE, pool);
+ /* Read the stream calling GET_LOCKS_FUNC(). */
+ stream = args.stream;
while (1)
{
apr_size_t len, skel_len;
- char c, *end, *skel_buf;
+ char c, *skel_buf;
svn_skel_t *lock_skel;
svn_lock_t *lock;
+ apr_uint64_t ui64;
+ svn_error_t *err;
svn_pool_clear(iterpool);
@@ -484,9 +488,10 @@ svn_fs_base__get_locks(svn_fs_t *fs,
SVN_ERR(svn_stream_readline(stream, &buf, "\n", &eof, iterpool));
if (eof)
break;
- skel_len = (size_t) strtoul(buf->data, &end, 10);
- if (skel_len == (size_t) ULONG_MAX || *end != '\0')
- return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL, NULL);
+ err = svn_cstring_strtoui64(&ui64, buf->data, 0, APR_SIZE_MAX, 10);
+ if (err)
+ return svn_error_create(SVN_ERR_MALFORMED_FILE, err, NULL);
+ skel_len = (apr_size_t)ui64;
/* Now read that much into a buffer. */
skel_buf = apr_palloc(pool, skel_len + 1);
@@ -541,8 +546,7 @@ verify_lock(svn_fs_t *fs,
_("User '%s' does not own lock on path '%s' (currently locked by '%s')"),
fs->access_ctx->username, lock->path, lock->owner);
- else if (apr_hash_get(fs->access_ctx->lock_tokens, lock->token,
- APR_HASH_KEY_STRING) == NULL)
+ else if (svn_hash_gets(fs->access_ctx->lock_tokens, lock->token) == NULL)
return svn_error_createf
(SVN_ERR_FS_BAD_LOCK_TOKEN, NULL,
_("Cannot verify lock on path '%s'; no matching lock-token available"),
diff --git a/subversion/libsvn_fs_base/notes/structure b/subversion/libsvn_fs_base/notes/structure
index 89fdc43..8e2159f 100644
--- a/subversion/libsvn_fs_base/notes/structure
+++ b/subversion/libsvn_fs_base/notes/structure
@@ -104,8 +104,8 @@ structure summary" section of this document.
NODE-REVISION: how we represent a node revision
We represent a given revision of a file or directory node using a list
-skel (see skel.h for an explanation of skels). A node revision skel
-has the form:
+skel (see include/private/svn_skel.h for an explanation of skels).
+A node revision skel has the form:
(HEADER PROP-KEY KIND-SPECIFIC ...)
diff --git a/subversion/libsvn_fs_base/reps-strings.c b/subversion/libsvn_fs_base/reps-strings.c
index dd395a4..553075d 100644
--- a/subversion/libsvn_fs_base/reps-strings.c
+++ b/subversion/libsvn_fs_base/reps-strings.c
@@ -489,8 +489,7 @@ rep_read_range(svn_fs_t *fs,
/* Make a list of all the rep's we need to undeltify this range.
We'll have to read them within this trail anyway, so we might
as well do it once and up front. */
- apr_array_header_t *reps = /* ### what constant here? */
- apr_array_make(pool, 666, sizeof(rep));
+ apr_array_header_t *reps = apr_array_make(pool, 30, sizeof(rep));
do
{
const rep_delta_chunk_t *const first_chunk
@@ -1465,14 +1464,16 @@ svn_fs_base__rep_deltify(svn_fs_t *fs,
TRUE, trail, pool));
/* Setup a stream to convert the textdelta data into svndiff windows. */
- svn_txdelta(&txdelta_stream, source_stream, target_stream, pool);
+ svn_txdelta2(&txdelta_stream, source_stream, target_stream, TRUE, pool);
if (bfd->format >= SVN_FS_BASE__MIN_SVNDIFF1_FORMAT)
- svn_txdelta_to_svndiff2(&new_target_handler, &new_target_handler_baton,
- new_target_stream, 1, pool);
+ svn_txdelta_to_svndiff3(&new_target_handler, &new_target_handler_baton,
+ new_target_stream, 1,
+ SVN_DELTA_COMPRESSION_LEVEL_DEFAULT, pool);
else
- svn_txdelta_to_svndiff2(&new_target_handler, &new_target_handler_baton,
- new_target_stream, 0, pool);
+ svn_txdelta_to_svndiff3(&new_target_handler, &new_target_handler_baton,
+ new_target_stream, 0,
+ SVN_DELTA_COMPRESSION_LEVEL_DEFAULT, pool);
/* subpool for the windows */
wpool = svn_pool_create(pool);
diff --git a/subversion/libsvn_fs_base/revs-txns.c b/subversion/libsvn_fs_base/revs-txns.c
index c4be0e5..d218843 100644
--- a/subversion/libsvn_fs_base/revs-txns.c
+++ b/subversion/libsvn_fs_base/revs-txns.c
@@ -230,7 +230,7 @@ svn_fs_base__revision_prop(svn_string_t **value_p,
FALSE, pool));
/* And then the prop from that list (if there was a list). */
- *value_p = apr_hash_get(table, propname, APR_HASH_KEY_STRING);
+ *value_p = svn_hash_gets(table, propname);
return SVN_NO_ERROR;
}
@@ -262,8 +262,7 @@ svn_fs_base__set_rev_prop(svn_fs_t *fs,
if (old_value_p)
{
const svn_string_t *wanted_value = *old_value_p;
- const svn_string_t *present_value = apr_hash_get(txn->proplist, name,
- APR_HASH_KEY_STRING);
+ const svn_string_t *present_value = svn_hash_gets(txn->proplist, name);
if ((!wanted_value != !present_value)
|| (wanted_value && present_value
&& !svn_string_compare(wanted_value, present_value)))
@@ -276,7 +275,7 @@ svn_fs_base__set_rev_prop(svn_fs_t *fs,
}
/* Fall through. */
}
- apr_hash_set(txn->proplist, name, APR_HASH_KEY_STRING, value);
+ svn_hash_sets(txn->proplist, name, value);
/* Overwrite the revision. */
return put_txn(fs, txn, txn_id, trail, pool);
@@ -537,7 +536,7 @@ svn_fs_base__txn_prop(svn_string_t **value_p,
FALSE, pool));
/* And then the prop from that list (if there was a list). */
- *value_p = apr_hash_get(table, propname, APR_HASH_KEY_STRING);
+ *value_p = svn_hash_gets(table, propname);
return SVN_NO_ERROR;
}
@@ -575,7 +574,7 @@ svn_fs_base__set_txn_prop(svn_fs_t *fs,
txn->proplist = apr_hash_make(pool);
/* Set the property. */
- apr_hash_set(txn->proplist, name, APR_HASH_KEY_STRING, value);
+ svn_hash_sets(txn->proplist, name, value);
/* Now overwrite the transaction. */
return put_txn(fs, txn, txn_name, trail, pool);
diff --git a/subversion/libsvn_fs_base/trail.c b/subversion/libsvn_fs_base/trail.c
index 4a0d8c9..8fdf9be 100644
--- a/subversion/libsvn_fs_base/trail.c
+++ b/subversion/libsvn_fs_base/trail.c
@@ -96,7 +96,7 @@ begin_trail(trail_t **trail_p,
a coding problem (and will likely hang the repository anyway). */
SVN_ERR_ASSERT(! bfd->in_txn_trail);
- SVN_ERR(BDB_WRAP(fs, "beginning Berkeley DB transaction",
+ SVN_ERR(BDB_WRAP(fs, N_("beginning Berkeley DB transaction"),
bfd->bdb->env->txn_begin(bfd->bdb->env, 0,
&trail->db_txn, 0)));
bfd->in_txn_trail = TRUE;
@@ -131,7 +131,7 @@ abort_trail(trail_t *trail)
see the returned error than to abort. An obvious example is
when DB_TXN->abort() returns DB_RUNRECOVERY. */
bfd->in_txn_trail = FALSE;
- SVN_ERR(BDB_WRAP(fs, "aborting Berkeley DB transaction",
+ SVN_ERR(BDB_WRAP(fs, N_("aborting Berkeley DB transaction"),
trail->db_txn->abort(trail->db_txn)));
}
svn_pool_destroy(trail->pool);
@@ -155,7 +155,7 @@ commit_trail(trail_t *trail)
/* See comment [**] in abort_trail() above.
An error during txn commit will abort the transaction anyway. */
bfd->in_txn_trail = FALSE;
- SVN_ERR(BDB_WRAP(fs, "committing Berkeley DB transaction",
+ SVN_ERR(BDB_WRAP(fs, N_("committing Berkeley DB transaction"),
trail->db_txn->commit(trail->db_txn, 0)));
}
diff --git a/subversion/libsvn_fs_base/tree.c b/subversion/libsvn_fs_base/tree.c
index 25fa69c..046ab5d 100644
--- a/subversion/libsvn_fs_base/tree.c
+++ b/subversion/libsvn_fs_base/tree.c
@@ -39,6 +39,7 @@
#include <string.h>
#include <assert.h>
#include "svn_private_config.h"
+#include "svn_hash.h"
#include "svn_pools.h"
#include "svn_error.h"
#include "svn_path.h"
@@ -160,7 +161,7 @@ dag_node_cache_get(svn_fs_root_t *root,
return NULL;
/* Look in the cache for our desired item. */
- cache_item = apr_hash_get(brd->node_cache, path, APR_HASH_KEY_STRING);
+ cache_item = svn_hash_gets(brd->node_cache, path);
if (cache_item)
return svn_fs_base__dag_dup(cache_item->node, pool);
@@ -208,7 +209,7 @@ dag_node_cache_set(svn_fs_root_t *root,
root, and that only happens once under that root. So, we'll be a
little bit sloppy here, and count on callers doing the right
thing. */
- cache_item = apr_hash_get(brd->node_cache, path, APR_HASH_KEY_STRING);
+ cache_item = svn_hash_gets(brd->node_cache, path);
if (cache_item)
{
/* ### This section is somehow broken. I don't know how, but it
@@ -250,9 +251,8 @@ dag_node_cache_set(svn_fs_root_t *root,
{
/* No room. Expire the oldest thing. */
cache_path = brd->node_cache_keys[brd->node_cache_idx];
- cache_item = apr_hash_get(brd->node_cache, cache_path,
- APR_HASH_KEY_STRING);
- apr_hash_set(brd->node_cache, cache_path, APR_HASH_KEY_STRING, NULL);
+ cache_item = svn_hash_gets(brd->node_cache, cache_path);
+ svn_hash_sets(brd->node_cache, cache_path, NULL);
cache_pool = cache_item->pool;
svn_pool_clear(cache_pool);
}
@@ -269,7 +269,7 @@ dag_node_cache_set(svn_fs_root_t *root,
/* Now add it to the cache. */
cache_path = apr_pstrdup(cache_pool, path);
- apr_hash_set(brd->node_cache, cache_path, APR_HASH_KEY_STRING, cache_item);
+ svn_hash_sets(brd->node_cache, cache_path, cache_item);
brd->node_cache_keys[brd->node_cache_idx] = cache_path;
/* Advance the cache pointer. */
@@ -309,11 +309,10 @@ txn_body_txn_root(void *baton,
/* Look for special txn props that represent the 'flags' behavior of
the transaction. */
SVN_ERR(svn_fs_base__txn_proplist_in_trail(&txnprops, svn_txn_id, trail));
- if (apr_hash_get(txnprops, SVN_FS__PROP_TXN_CHECK_OOD, APR_HASH_KEY_STRING))
+ if (svn_hash_gets(txnprops, SVN_FS__PROP_TXN_CHECK_OOD))
flags |= SVN_FS_TXN_CHECK_OOD;
- if (apr_hash_get(txnprops, SVN_FS__PROP_TXN_CHECK_LOCKS,
- APR_HASH_KEY_STRING))
+ if (svn_hash_gets(txnprops, SVN_FS__PROP_TXN_CHECK_LOCKS))
flags |= SVN_FS_TXN_CHECK_LOCKS;
root = make_txn_root(fs, svn_txn_id, txn->base_rev, flags, trail->pool);
@@ -431,7 +430,7 @@ mutable_root_node(dag_node_t **node_p,
trail, pool);
else
/* If it's not a transaction root, we can't change its contents. */
- return SVN_FS__ERR_NOT_MUTABLE(root->fs, root->rev, error_path, pool);
+ return SVN_FS__ERR_NOT_MUTABLE(root->fs, root->rev, error_path);
}
@@ -769,7 +768,7 @@ open_path(parent_path_t **parent_path_p,
/* The path isn't finished yet; we'd better be in a directory. */
if (svn_fs_base__dag_node_kind(child) != svn_node_dir)
- SVN_ERR_W(SVN_FS__ERR_NOT_DIRECTORY(fs, path_so_far, pool),
+ SVN_ERR_W(SVN_FS__ERR_NOT_DIRECTORY(fs, path_so_far),
apr_psprintf(pool, _("Failure opening '%s'"), path));
rest = next;
@@ -1191,8 +1190,7 @@ txn_body_node_prop(void *baton,
trail, trail->pool));
*(args->value_p) = NULL;
if (proplist)
- *(args->value_p) = apr_hash_get(proplist, args->propname,
- APR_HASH_KEY_STRING);
+ *(args->value_p) = svn_hash_gets(proplist, args->propname);
return SVN_NO_ERROR;
}
@@ -1304,7 +1302,7 @@ txn_body_change_node_prop(void *baton,
proplist = apr_hash_make(trail->pool);
/* Set the property. */
- apr_hash_set(proplist, args->name, APR_HASH_KEY_STRING, args->value);
+ svn_hash_sets(proplist, args->name, args->value);
/* Overwrite the node's proplist. */
SVN_ERR(svn_fs_base__dag_set_proplist(parent_path->node, proplist,
@@ -2523,11 +2521,11 @@ verify_locks(const char *txn_name,
/* If this path has already been verified as part of a recursive
check of one of its parents, no need to do it again. */
if (last_recursed
- && svn_fspath__is_child(last_recursed->data, path, subpool))
+ && svn_fspath__skip_ancestor(last_recursed->data, path))
continue;
/* Fetch the change associated with our path. */
- change = apr_hash_get(changes, path, APR_HASH_KEY_STRING);
+ change = svn_hash_gets(changes, path);
/* What does it mean to succeed at lock verification for a given
path? For an existing file or directory getting modified
@@ -2722,7 +2720,7 @@ svn_fs_base__commit_txn(const char **conflict_p,
merge_args.ancestor_node = NULL;
merge_args.source_node = youngish_root_node;
merge_args.txn = txn;
- merge_args.conflict = svn_stringbuf_create("", pool); /* use pool */
+ merge_args.conflict = svn_stringbuf_create_empty(pool); /* use pool */
err = svn_fs_base__retry_txn(fs, txn_body_merge, &merge_args,
FALSE, subpool);
if (err)
@@ -2832,7 +2830,7 @@ base_merge(const char **conflict_p,
merge_args.source_node = source;
merge_args.ancestor_node = ancestor;
merge_args.txn = txn;
- merge_args.conflict = svn_stringbuf_create("", pool);
+ merge_args.conflict = svn_stringbuf_create_empty(pool);
err = svn_fs_base__retry_txn(fs, txn_body_merge, &merge_args, FALSE, pool);
if (err)
{
@@ -2926,7 +2924,7 @@ txn_body_make_dir(void *baton,
/* If there's already a sub-directory by that name, complain. This
also catches the case of trying to make a subdirectory named `/'. */
if (parent_path->node)
- return SVN_FS__ALREADY_EXISTS(root, path, trail->pool);
+ return SVN_FS__ALREADY_EXISTS(root, path);
/* Check to see if some lock is 'reserving' a file-path or dir-path
at that location, or even some child-path; if so, check that we
@@ -3192,17 +3190,7 @@ fs_same_p(svn_boolean_t *same_p,
svn_fs_t *fs2,
apr_pool_t *pool)
{
- const char *uuid1;
- const char *uuid2;
-
- /* Random thought: if fetching UUIDs to compare filesystems is too
- expensive, one solution would be to cache the UUID in each fs
- object (copying the UUID into fs->pool, of course). */
-
- SVN_ERR(fs1->vtable->get_uuid(fs1, &uuid1, pool));
- SVN_ERR(fs2->vtable->get_uuid(fs2, &uuid2, pool));
-
- *same_p = ! strcmp(uuid1, uuid2);
+ *same_p = ! strcmp(fs1->uuid, fs2->uuid);
return SVN_NO_ERROR;
}
@@ -3379,7 +3367,7 @@ txn_body_make_file(void *baton,
/* If there's already a file by that name, complain.
This also catches the case of trying to make a file named `/'. */
if (parent_path->node)
- return SVN_FS__ALREADY_EXISTS(root, path, trail->pool);
+ return SVN_FS__ALREADY_EXISTS(root, path);
/* Check to see if some lock is 'reserving' a file-path or dir-path
at that location, or even some child-path; if so, check that we
@@ -3686,7 +3674,7 @@ window_consumer(svn_txdelta_window_t *window, void *baton)
SVN_ERR(svn_stream_write(tb->target_stream,
tb->target_string->data,
&len));
- svn_stringbuf_set(tb->target_string, "");
+ svn_stringbuf_setempty(tb->target_string);
}
/* Is the window NULL? If so, we're done. */
@@ -3742,8 +3730,7 @@ txn_body_apply_textdelta(void *baton, trail_t *trail)
we're calculating both SHA1 and MD5 checksums somewhere in
reps-strings.c. Could we keep them both around somehow so this
check could be more comprehensive? */
- if (tb->base_checksum->kind == checksum->kind
- && !svn_checksum_match(tb->base_checksum, checksum))
+ if (!svn_checksum_match(tb->base_checksum, checksum))
return svn_checksum_mismatch_err(tb->base_checksum, checksum,
trail->pool,
_("Base checksum mismatch on '%s'"),
@@ -3762,7 +3749,7 @@ txn_body_apply_textdelta(void *baton, trail_t *trail)
/* Make a writable "string" stream which writes data to
tb->target_string. */
- tb->target_string = svn_stringbuf_create("", tb->pool);
+ tb->target_string = svn_stringbuf_create_empty(tb->pool);
tb->string_stream = svn_stream_create(tb, tb->pool);
svn_stream_set_write(tb->string_stream, write_to_string);
@@ -3793,16 +3780,8 @@ base_apply_textdelta(svn_txdelta_window_handler_t *contents_p,
tb->root = root;
tb->path = path;
tb->pool = pool;
-
- if (base_checksum)
- tb->base_checksum = svn_checksum_dup(base_checksum, pool);
- else
- tb->base_checksum = NULL;
-
- if (result_checksum)
- tb->result_checksum = svn_checksum_dup(result_checksum, pool);
- else
- tb->result_checksum = NULL;
+ tb->base_checksum = svn_checksum_dup(base_checksum, pool);
+ tb->result_checksum = svn_checksum_dup(result_checksum, pool);
SVN_ERR(svn_fs_base__retry_txn(root->fs, txn_body_apply_textdelta, tb,
FALSE, pool));
@@ -3943,11 +3922,7 @@ base_apply_text(svn_stream_t **contents_p,
tb->root = root;
tb->path = path;
tb->pool = pool;
-
- if (result_checksum)
- tb->result_checksum = svn_checksum_dup(result_checksum, pool);
- else
- tb->result_checksum = NULL;
+ tb->result_checksum = svn_checksum_dup(result_checksum, pool);
SVN_ERR(svn_fs_base__retry_txn(root->fs, txn_body_apply_text, tb,
FALSE, pool));
@@ -4046,7 +4021,7 @@ base_get_file_delta_stream(svn_txdelta_stream_t **stream_p,
SVN_ERR(base_file_contents(&target, target_root, target_path, pool));
/* Create a delta stream that turns the ancestor into the target. */
- svn_txdelta(&delta_stream, source, target, pool);
+ svn_txdelta2(&delta_stream, source, target, TRUE, pool);
*stream_p = delta_stream;
return SVN_NO_ERROR;
@@ -4349,10 +4324,7 @@ txn_body_history_prev(void *baton, trail_t *trail)
the copy source. Finally, if our current path doesn't meet
one of these other criteria ... ### for now just fallback to
the old copy hunt algorithm. */
- if (strcmp(path, copy_dst) == 0)
- remainder = "";
- else
- remainder = svn_fspath__is_child(copy_dst, path, trail->pool);
+ remainder = svn_fspath__skip_ancestor(copy_dst, path);
if (remainder)
{
@@ -4745,7 +4717,7 @@ prev_location(const char **prev_path,
const char *path,
apr_pool_t *pool)
{
- const char *copy_path, *copy_src_path, *remainder = "";
+ const char *copy_path, *copy_src_path, *remainder;
svn_fs_root_t *copy_root;
svn_revnum_t copy_src_rev;
@@ -4774,8 +4746,7 @@ prev_location(const char **prev_path,
*/
SVN_ERR(base_copied_from(&copy_src_rev, &copy_src_path,
copy_root, copy_path, pool));
- if (! strcmp(copy_path, path) == 0)
- remainder = svn_fspath__is_child(copy_path, path, pool);
+ remainder = svn_fspath__skip_ancestor(copy_path, path);
*prev_path = svn_fspath__join(copy_src_path, remainder, pool);
*prev_rev = copy_src_rev;
return SVN_NO_ERROR;
@@ -4840,6 +4811,13 @@ base_node_origin_rev(svn_revnum_t *revision,
prev_location() does below will work. */
path = svn_fs__canonicalize_abspath(path, pool);
+ /* Special-case the root node (for performance reasons) */
+ if (strcmp(path, "/") == 0)
+ {
+ *revision = 0;
+ return SVN_NO_ERROR;
+ }
+
/* If we have support for the node-origins table, we'll try to use
it. */
if (bfd->format >= SVN_FS_BASE__MIN_NODE_ORIGINS_FORMAT)
@@ -5026,7 +5004,7 @@ txn_body_get_mergeinfo_data_and_entries(void *baton, trail_t *trail)
SVN_ERR(svn_fs_base__dag_get_proplist(&plist, child_node,
trail, iterpool));
- pval = apr_hash_get(plist, SVN_PROP_MERGEINFO, APR_HASH_KEY_STRING);
+ pval = svn_hash_gets(plist, SVN_PROP_MERGEINFO);
if (! pval)
{
svn_string_t *id_str = svn_fs_base__id_unparse(child_id,
@@ -5050,11 +5028,10 @@ txn_body_get_mergeinfo_data_and_entries(void *baton, trail_t *trail)
}
else
{
- apr_hash_set(args->result_catalog,
- svn_fspath__join(args->node_path, dirent->name,
- result_pool),
- APR_HASH_KEY_STRING,
- child_mergeinfo);
+ svn_hash_sets(args->result_catalog,
+ svn_fspath__join(args->node_path, dirent->name,
+ result_pool),
+ child_mergeinfo);
}
}
@@ -5074,10 +5051,9 @@ txn_body_get_mergeinfo_data_and_entries(void *baton, trail_t *trail)
"but is not a directory"),
id_str->data);
}
- apr_hash_set(args->children_atop_mergeinfo_trees,
- apr_pstrdup(children_pool, dirent->name),
- APR_HASH_KEY_STRING,
- svn_fs_base__dag_dup(child_node, children_pool));
+ svn_hash_sets(args->children_atop_mergeinfo_trees,
+ apr_pstrdup(children_pool, dirent->name),
+ svn_fs_base__dag_dup(child_node, children_pool));
}
}
@@ -5142,6 +5118,7 @@ struct get_mergeinfo_for_path_baton
svn_fs_root_t *root;
const char *path;
svn_mergeinfo_inheritance_t inherit;
+ svn_boolean_t adjust_inherited_mergeinfo;
apr_pool_t *pool;
};
@@ -5202,8 +5179,7 @@ txn_body_get_mergeinfo_for_path(void *baton, trail_t *trail)
svn_pool_destroy(iterpool);
SVN_ERR(svn_fs_base__dag_get_proplist(&proplist, node, trail, trail->pool));
- mergeinfo_string = apr_hash_get(proplist, SVN_PROP_MERGEINFO,
- APR_HASH_KEY_STRING);
+ mergeinfo_string = svn_hash_gets(proplist, SVN_PROP_MERGEINFO);
if (! mergeinfo_string)
{
svn_string_t *id_str =
@@ -5237,7 +5213,7 @@ txn_body_get_mergeinfo_for_path(void *baton, trail_t *trail)
can return the mergeinfo results directly. Otherwise, we're
inheriting the mergeinfo, so we need to a) remove non-inheritable
ranges and b) telescope the merged-from paths. */
- if (nearest_ancestor != parent_path)
+ if (args->adjust_inherited_mergeinfo && (nearest_ancestor != parent_path))
{
svn_mergeinfo_t tmp_mergeinfo;
@@ -5291,10 +5267,12 @@ get_mergeinfos_for_paths(svn_fs_root_t *root,
const apr_array_header_t *paths,
svn_mergeinfo_inheritance_t inherit,
svn_boolean_t include_descendants,
- apr_pool_t *pool)
+ svn_boolean_t adjust_inherited_mergeinfo,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
- svn_mergeinfo_catalog_t result_catalog = apr_hash_make(pool);
- apr_pool_t *iterpool = svn_pool_create(pool);
+ svn_mergeinfo_catalog_t result_catalog = apr_hash_make(result_pool);
+ apr_pool_t *iterpool = svn_pool_create(scratch_pool);
int i;
for (i = 0; i < paths->nelts; i++)
@@ -5312,14 +5290,14 @@ get_mergeinfos_for_paths(svn_fs_root_t *root,
gmfp_args.root = root;
gmfp_args.path = path;
gmfp_args.inherit = inherit;
- gmfp_args.pool = pool;
+ gmfp_args.pool = result_pool;
+ gmfp_args.adjust_inherited_mergeinfo = adjust_inherited_mergeinfo;
SVN_ERR(svn_fs_base__retry_txn(root->fs,
txn_body_get_mergeinfo_for_path,
&gmfp_args, FALSE, iterpool));
if (path_mergeinfo)
- apr_hash_set(result_catalog, apr_pstrdup(pool, path),
- APR_HASH_KEY_STRING,
- path_mergeinfo);
+ svn_hash_sets(result_catalog, apr_pstrdup(result_pool, path),
+ path_mergeinfo);
/* If we're including descendants, do so. */
if (include_descendants)
@@ -5363,7 +5341,9 @@ base_get_mergeinfo(svn_mergeinfo_catalog_t *catalog,
const apr_array_header_t *paths,
svn_mergeinfo_inheritance_t inherit,
svn_boolean_t include_descendants,
- apr_pool_t *pool)
+ svn_boolean_t adjust_inherited_mergeinfo,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
/* Verify that our filesystem version supports mergeinfo stuff. */
SVN_ERR(svn_fs_base__test_required_feature_format
@@ -5376,7 +5356,8 @@ base_get_mergeinfo(svn_mergeinfo_catalog_t *catalog,
/* Retrieve a path -> mergeinfo mapping. */
return get_mergeinfos_for_paths(root, catalog, paths,
inherit, include_descendants,
- pool);
+ adjust_inherited_mergeinfo,
+ result_pool, scratch_pool);
}
@@ -5406,6 +5387,7 @@ static root_vtable_t root_vtable = {
base_file_length,
base_file_checksum,
base_file_contents,
+ NULL,
base_make_file,
base_apply_textdelta,
base_apply_text,
diff --git a/subversion/libsvn_fs_base/util/fs_skels.c b/subversion/libsvn_fs_base/util/fs_skels.c
index 9ea2167..f3466b9 100644
--- a/subversion/libsvn_fs_base/util/fs_skels.c
+++ b/subversion/libsvn_fs_base/util/fs_skels.c
@@ -32,6 +32,7 @@
#include "private/svn_skel.h"
#include "private/svn_dep_compat.h"
+#include "private/svn_subr_private.h"
#include "svn_checksum.h"
#include "fs_skels.h"
@@ -511,18 +512,18 @@ svn_fs_base__parse_representation_skel(representation_t **rep_p,
{
svn_skel_t *checksum_skel = header_skel->children->next->next;
rep->md5_checksum =
- svn_checksum__from_digest((const unsigned char *)
- (checksum_skel->children->next->data),
- svn_checksum_md5, pool);
+ svn_checksum__from_digest_md5((const unsigned char *)
+ (checksum_skel->children->next->data),
+ pool);
/* SHA1 */
if (header_skel->children->next->next->next)
{
checksum_skel = header_skel->children->next->next->next;
rep->sha1_checksum =
- svn_checksum__from_digest((const unsigned char *)
- (checksum_skel->children->next->data),
- svn_checksum_sha1, pool);
+ svn_checksum__from_digest_sha1(
+ (const unsigned char *)(checksum_skel->children->next->data),
+ pool);
}
}
diff --git a/subversion/libsvn_fs_base/uuid.c b/subversion/libsvn_fs_base/uuid.c
index e002522..c865df3 100644
--- a/subversion/libsvn_fs_base/uuid.c
+++ b/subversion/libsvn_fs_base/uuid.c
@@ -48,39 +48,27 @@ txn_body_get_uuid(void *baton, trail_t *trail)
svn_error_t *
-svn_fs_base__get_uuid(svn_fs_t *fs,
- const char **uuid,
- apr_pool_t *pool)
+svn_fs_base__populate_uuid(svn_fs_t *fs,
+ apr_pool_t *scratch_pool)
{
- base_fs_data_t *bfd = fs->fsap_data;
SVN_ERR(svn_fs__check_fs(fs, TRUE));
- /* Check for a cached UUID first. Failing that, we hit the
- database. */
- if (bfd->uuid)
- {
- *uuid = apr_pstrdup(pool, bfd->uuid);
- }
- else
+ /* We hit the database. */
{
+ const char *uuid;
struct get_uuid_args args;
- apr_pool_t *scratch_pool = svn_pool_create(pool);
args.idx = 1;
- args.uuid = uuid;
+ args.uuid = &uuid;
SVN_ERR(svn_fs_base__retry_txn(fs, txn_body_get_uuid, &args,
FALSE, scratch_pool));
- if (*uuid)
+ if (uuid)
{
- *uuid = apr_pstrdup(pool, *uuid);
-
/* Toss what we find into the cache. */
- bfd->uuid = apr_pstrdup(fs->pool, *uuid);
+ fs->uuid = apr_pstrdup(fs->pool, uuid);
}
-
- svn_pool_destroy(scratch_pool);
}
return SVN_NO_ERROR;
@@ -109,7 +97,6 @@ svn_fs_base__set_uuid(svn_fs_t *fs,
apr_pool_t *pool)
{
struct set_uuid_args args;
- base_fs_data_t *bfd = fs->fsap_data;
SVN_ERR(svn_fs__check_fs(fs, TRUE));
@@ -122,7 +109,7 @@ svn_fs_base__set_uuid(svn_fs_t *fs,
/* Toss our value into the cache. */
if (uuid)
- bfd->uuid = apr_pstrdup(fs->pool, uuid);
+ fs->uuid = apr_pstrdup(fs->pool, uuid);
return SVN_NO_ERROR;
}
diff --git a/subversion/libsvn_fs_base/uuid.h b/subversion/libsvn_fs_base/uuid.h
index f30b548..453a390 100644
--- a/subversion/libsvn_fs_base/uuid.h
+++ b/subversion/libsvn_fs_base/uuid.h
@@ -29,12 +29,15 @@ extern "C" {
+/* Set FS->UUID to the value read from the database, allocated
+ in FS->POOL. Use SCRATCH_POOL for temporary allocations. */
+svn_error_t *svn_fs_base__populate_uuid(svn_fs_t *fs,
+ apr_pool_t *scratch_pool);
+
+
/* These functions implement some of the calls in the FS loader
library's fs vtable. */
-svn_error_t *svn_fs_base__get_uuid(svn_fs_t *fs, const char **uuid,
- apr_pool_t *pool);
-
svn_error_t *svn_fs_base__set_uuid(svn_fs_t *fs, const char *uuid,
apr_pool_t *pool);