You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2012/03/14 20:40:24 UTC
svn commit: r1300696 [2/6] - in /subversion/branches/fix-rdump-editor: ./
build/generator/ build/win32/ notes/ notes/directory-index/
subversion/bindings/javahl/ subversion/bindings/javahl/native/
subversion/bindings/javahl/tests/org/apache/subversion/...
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_delta/xdelta.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_delta/xdelta.c?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_delta/xdelta.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_delta/xdelta.c Wed Mar 14 19:40:19 2012
@@ -257,14 +257,18 @@ reverse_match_length(const char *a, cons
break;
pos -= sizeof(apr_size_t);
-
+
#endif
+ /* If we find a mismatch at -pos, pos-1 characters matched.
+ */
while (++pos <= max_len)
- if (a[-pos] != b[-pos])
- break;
-
- return pos-1;
+ if (a[0-pos] != b[0-pos])
+ return pos - 1;
+
+ /* No mismatch found -> at least MAX_LEN machting chars.
+ */
+ return max_len;
}
@@ -390,7 +394,7 @@ compute_delta(svn_txdelta__ops_baton_t *
apr_size_t lo = 0, pending_insert_start = 0;
/* Optimization: directly compare window starts. If more than 4
- * bytes match, we can immediately create a matching windows.
+ * bytes match, we can immediately create a matching windows.
* Shorter sequences result in a net data increase. */
lo = match_length(a, b, asize > bsize ? bsize : asize);
if ((lo > 4) || (lo == bsize))
@@ -442,7 +446,7 @@ compute_delta(svn_txdelta__ops_baton_t *
svn_txdelta__insert_op(build_baton, svn_txdelta_new,
0, lo - pending_insert_start,
b + pending_insert_start, pool);
- else
+ else
{
/* the match borders on the previous op. Maybe, we found a
* match that is better than / overlapping the previous one. */
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_fs/fs-loader.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_fs/fs-loader.c?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_fs/fs-loader.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_fs/fs-loader.c Wed Mar 14 19:40:19 2012
@@ -155,7 +155,7 @@ get_library_vtable_direct(fs_library_vta
/* Invoke the FS module's initfunc function with the common
pool protected by a lock. */
- SVN_MUTEX__WITH_LOCK(common_pool_lock,
+ SVN_MUTEX__WITH_LOCK(common_pool_lock,
initfunc(my_version, vtable, common_pool));
}
fs_version = (*vtable)->get_version();
@@ -357,7 +357,7 @@ svn_fs_create(svn_fs_t **fs_p, const cha
/* Perform the actual creation. */
*fs_p = fs_new(fs_config, pool);
-
+
SVN_MUTEX__WITH_LOCK(common_pool_lock,
vtable->create(*fs_p, path, pool, common_pool));
return SVN_NO_ERROR;
@@ -394,7 +394,9 @@ svn_error_t *
svn_fs_verify(const char *path,
svn_cancel_func_t cancel_func,
void *cancel_baton,
- apr_pool_t *pool)
+ svn_revnum_t start,
+ svn_revnum_t end,
+ apr_pool_t *pool)
{
fs_library_vtable_t *vtable;
svn_fs_t *fs;
@@ -404,7 +406,7 @@ svn_fs_verify(const char *path,
SVN_MUTEX__WITH_LOCK(common_pool_lock,
vtable->verify_fs(fs, path, cancel_func, cancel_baton,
- pool, common_pool));
+ start, end, pool, common_pool));
return SVN_NO_ERROR;
}
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_fs/fs-loader.h
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_fs/fs-loader.h?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_fs/fs-loader.h (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_fs/fs-loader.h Wed Mar 14 19:40:19 2012
@@ -90,6 +90,8 @@ typedef struct fs_library_vtable_t
svn_error_t *(*verify_fs)(svn_fs_t *fs, const char *path,
/* ### notification? */
svn_cancel_func_t cancel_func, void *cancel_baton,
+ svn_revnum_t start,
+ svn_revnum_t end,
apr_pool_t *pool,
apr_pool_t *common_pool);
svn_error_t *(*delete_fs)(const char *path, apr_pool_t *pool);
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_fs_base/bdb/env.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_fs_base/bdb/env.c?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_fs_base/bdb/env.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_fs_base/bdb/env.c Wed Mar 14 19:40:19 2012
@@ -378,7 +378,7 @@ bdb_init_cb(void *baton, apr_pool_t *poo
{
bdb_cache_pool = svn_pool_create(pool);
bdb_cache = apr_hash_make(bdb_cache_pool);
-
+
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);
@@ -493,7 +493,7 @@ 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
@@ -543,7 +543,7 @@ svn_fs_bdb__close(bdb_env_baton_t *bdb_b
/* 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));
-
+
return SVN_NO_ERROR;
}
@@ -587,7 +587,7 @@ cleanup_env_baton(void *data)
static svn_error_t *
-svn_fs_bdb__open_internal(bdb_env_baton_t **bdb_batonp,
+svn_fs_bdb__open_internal(bdb_env_baton_t **bdb_batonp,
const char *path,
u_int32_t flags, int mode,
apr_pool_t *pool)
@@ -643,7 +643,7 @@ svn_fs_bdb__open_internal(bdb_env_baton_
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;
@@ -669,11 +669,11 @@ svn_fs_bdb__open(bdb_env_baton_t **bdb_b
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,
+ SVN_MUTEX__WITH_LOCK(bdb_cache_lock,
+ svn_fs_bdb__open_internal(bdb_batonp,
+ path,
+ flags,
+ mode,
pool));
return SVN_NO_ERROR;
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_fs_base/fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_fs_base/fs.c?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_fs_base/fs.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_fs_base/fs.c Wed Mar 14 19:40:19 2012
@@ -333,9 +333,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 +345,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 +355,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 <da...@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 +402,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 +417,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" },
};
@@ -876,6 +883,8 @@ static svn_error_t *
base_verify(svn_fs_t *fs, const char *path,
svn_cancel_func_t cancel_func,
void *cancel_baton,
+ svn_revnum_t start,
+ svn_revnum_t end,
apr_pool_t *pool,
apr_pool_t *common_pool)
{
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_fs_base/notes/structure
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_fs_base/notes/structure?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_fs_base/notes/structure (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_fs_base/notes/structure Wed Mar 14 19:40:19 2012
@@ -104,8 +104,8 @@ structure summary" section of this docum
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 ...)
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/fs.c?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/fs.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/fs.c Wed Mar 14 19:40:19 2012
@@ -92,7 +92,7 @@ fs_serialized_init(svn_fs_t *fs, apr_poo
SVN_FS_FS__USE_LOCK_MUTEX, common_pool));
/* ... not to mention locking the txn-current file. */
- SVN_ERR(svn_mutex__init(&ffsd->txn_current_lock,
+ SVN_ERR(svn_mutex__init(&ffsd->txn_current_lock,
SVN_FS_FS__USE_LOCK_MUTEX, common_pool));
SVN_ERR(svn_mutex__init(&ffsd->txn_list_lock,
@@ -243,6 +243,8 @@ static svn_error_t *
fs_verify(svn_fs_t *fs, const char *path,
svn_cancel_func_t cancel_func,
void *cancel_baton,
+ svn_revnum_t start,
+ svn_revnum_t end,
apr_pool_t *pool,
apr_pool_t *common_pool)
{
@@ -251,7 +253,7 @@ fs_verify(svn_fs_t *fs, const char *path
SVN_ERR(svn_fs_fs__open(fs, path, pool));
SVN_ERR(svn_fs_fs__initialize_caches(fs, pool));
SVN_ERR(fs_serialized_init(fs, common_pool, pool));
- return svn_fs_fs__verify(fs, cancel_func, cancel_baton, pool);
+ return svn_fs_fs__verify(fs, cancel_func, cancel_baton, start, end, pool);
}
static svn_error_t *
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/fs.h?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/fs.h (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/fs.h Wed Mar 14 19:40:19 2012
@@ -224,15 +224,17 @@ typedef struct fs_fs_data_t
(svn_fs_id_t *). (Not threadsafe.) */
svn_cache__t *rev_root_id_cache;
- /* DAG node cache for immutable nodes */
+ /* DAG node cache for immutable nodes. Maps (revision, fspath)
+ to (dag_node_t *). */
svn_cache__t *rev_node_cache;
/* A cache of the contents of immutable directories; maps from
- unparsed FS ID to ###x. */
+ unparsed FS ID to a apr_hash_t * mapping (const char *) dirent
+ names to (svn_fs_dirent_t *). */
svn_cache__t *dir_cache;
/* Fulltext cache; currently only used with memcached. Maps from
- rep key to svn_string_t. */
+ rep key (revision/offset) to svn_string_t. */
svn_cache__t *fulltext_cache;
/* Pack manifest cache; a cache mapping (svn_revnum_t) shard number to
@@ -244,7 +246,7 @@ typedef struct fs_fs_data_t
/* Cache for txdelta_window_t objects; the key is (revFilePath, offset) */
svn_cache__t *txdelta_window_cache;
- /* Cache for combined windows as svn_stringbuf_t objects;
+ /* Cache for combined windows as svn_stringbuf_t objects;
the key is (revFilePath, offset) */
svn_cache__t *combined_window_cache;
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/fs_fs.c?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/fs_fs.c Wed Mar 14 19:40:19 2012
@@ -81,7 +81,7 @@
/* Begin deltification after a node history exceeded this this limit.
Useful values are 4 to 64 with 16 being a good compromise between
computational overhead and pository size savings.
- Should be a power of 2.
+ Should be a power of 2.
Values < 2 will result in standard skip-delta behavior. */
#define SVN_FS_FS_MAX_LINEAR_DELTIFICATION 16
@@ -800,7 +800,7 @@ get_writable_proto_rev_body(svn_fs_t *fs
err = svn_error_compose_create(
err,
unlock_proto_rev_list_locked(fs, txn_id, *lockcookie, pool));
-
+
*lockcookie = NULL;
}
@@ -1548,6 +1548,16 @@ ensure_revision_exists(svn_fs_t *fs,
_("No such revision %ld"), rev);
}
+svn_error_t *
+svn_fs_fs__revision_exists(svn_revnum_t rev,
+ svn_fs_t *fs,
+ apr_pool_t *pool)
+{
+ /* Different order of parameters. */
+ SVN_ERR(ensure_revision_exists(fs, rev, pool));
+ return SVN_NO_ERROR;
+}
+
/* Open the correct revision file for REV. If the filesystem FS has
been packed, *FILE will be set to the packed file; otherwise, set *FILE
to the revision file for REV. Return SVN_ERR_FS_NO_SUCH_REVISION if the
@@ -2879,7 +2889,7 @@ create_rep_state(struct rep_state **rep_
### going to jump straight to this comment anyway! */
return svn_error_createf(SVN_ERR_FS_CORRUPT, err,
"Corrupt representation '%s'",
- rep
+ rep
? representation_string(rep, ffd->format, TRUE,
TRUE, pool)
: "(null)");
@@ -2895,7 +2905,7 @@ struct rep_read_baton
/* If not NULL, this is the base for the first delta window in rs_list */
svn_stringbuf_t *base_window;
-
+
/* The state of all prior delta representations. */
apr_array_header_t *rs_list;
@@ -3139,14 +3149,14 @@ build_rep_list(apr_array_header_t **list
SVN_ERR(get_cached_combined_window(window_p, rs, &is_cached, pool));
if (is_cached)
{
- /* We already have a reconstructed window in our cache.
+ /* We already have a reconstructed window in our cache.
Write a pseudo rep_state with the full length. */
rs->off = rs->start;
rs->end = rs->start + (*window_p)->len;
*src_state = rs;
return SVN_NO_ERROR;
}
-
+
if (rep_args->is_delta == FALSE)
{
/* This is a plaintext, so just return the current rep_state. */
@@ -3205,7 +3215,7 @@ rep_read_get_baton(struct rep_read_baton
else
b->current_fulltext = NULL;
- SVN_ERR(build_rep_list(&b->rs_list, &b->base_window,
+ SVN_ERR(build_rep_list(&b->rs_list, &b->base_window,
&b->src_state, fs, rep,
b->filehandle_pool));
@@ -3286,7 +3296,7 @@ get_combined_window(svn_stringbuf_t **re
{
rs = APR_ARRAY_IDX(rb->rs_list, i, struct rep_state *);
SVN_ERR(read_window(&window, rb->chunk_index, rs, window_pool));
-
+
APR_ARRAY_PUSH(windows, svn_txdelta_window_t *) = window;
if (window->src_ops == 0)
{
@@ -3294,7 +3304,7 @@ get_combined_window(svn_stringbuf_t **re
break;
}
}
-
+
/* Combine in the windows from the other delta reps. */
pool = svn_pool_create(rb->pool);
for (--i; i >= 0; --i)
@@ -3307,7 +3317,7 @@ get_combined_window(svn_stringbuf_t **re
new_pool = svn_pool_create(rb->pool);
buf = svn_stringbuf_create_ensure(window->tview_len, new_pool);
buf->len = window->tview_len;
-
+
svn_txdelta_apply_instructions(window, source ? source->data : NULL,
buf->data, &buf->len);
if (buf->len != window->tview_len)
@@ -3327,7 +3337,7 @@ get_combined_window(svn_stringbuf_t **re
}
svn_pool_destroy(window_pool);
-
+
*result = buf;
return SVN_NO_ERROR;
}
@@ -3519,7 +3529,7 @@ read_representation(svn_stream_t **conte
else
{
fs_fs_data_t *ffd = fs->fsap_data;
- const char *fulltext_key = NULL;
+ const char *fulltext_cache_key = NULL;
svn_filesize_t len = rep->expanded_size ? rep->expanded_size : rep->size;
struct rep_read_baton *rb;
@@ -3528,10 +3538,11 @@ read_representation(svn_stream_t **conte
{
svn_stringbuf_t *fulltext;
svn_boolean_t is_cached;
- fulltext_key = apr_psprintf(pool, "%ld/%" APR_OFF_T_FMT,
+ fulltext_cache_key = apr_psprintf(pool, "%ld/%" APR_OFF_T_FMT,
rep->revision, rep->offset);
SVN_ERR(svn_cache__get((void **) &fulltext, &is_cached,
- ffd->fulltext_cache, fulltext_key, pool));
+ ffd->fulltext_cache, fulltext_cache_key,
+ pool));
if (is_cached)
{
*contents_p = svn_stream_from_stringbuf(fulltext, pool);
@@ -3539,7 +3550,7 @@ read_representation(svn_stream_t **conte
}
}
- SVN_ERR(rep_read_get_baton(&rb, fs, rep, fulltext_key, pool));
+ SVN_ERR(rep_read_get_baton(&rb, fs, rep, fulltext_cache_key, pool));
*contents_p = svn_stream_create(rb, pool);
svn_stream_set_read(*contents_p, rep_read_contents);
@@ -5268,7 +5279,7 @@ choose_delta_base(representation_t **rep
count = noderev->predecessor_count;
count = count & (count - 1);
- /* We use skip delta for limiting the number of delta operations
+ /* We use skip delta for limiting the number of delta operations
along very long node histories. Close to HEAD however, we create
a linear history to minimize delta size. */
walk = noderev->predecessor_count - count;
@@ -5387,8 +5398,8 @@ rep_write_get_baton(struct rep_write_bat
limited by both, POOL and REP lifetime.
*/
static svn_error_t *
-get_shared_rep(representation_t **old_rep,
- svn_fs_t *fs,
+get_shared_rep(representation_t **old_rep,
+ svn_fs_t *fs,
representation_t *rep,
apr_hash_t *reps_hash,
apr_pool_t *pool)
@@ -5408,7 +5419,7 @@ get_shared_rep(representation_t **old_re
*old_rep = apr_hash_get(reps_hash,
rep->sha1_checksum->digest,
APR_SHA1_DIGESTSIZE);
-
+
/* If we haven't found anything yet, try harder and consult our DB. */
if (*old_rep == NULL)
{
@@ -5447,7 +5458,7 @@ get_shared_rep(representation_t **old_re
(*old_rep)->md5_checksum = rep->md5_checksum;
(*old_rep)->uniquifier = rep->uniquifier;
}
-
+
return SVN_NO_ERROR;
}
@@ -5771,7 +5782,7 @@ write_hash_delta_rep(representation_t *r
{
svn_txdelta_window_handler_t diff_wh;
void *diff_whb;
-
+
svn_stream_t *file_stream;
svn_stream_t *stream;
representation_t *base_rep;
@@ -5779,8 +5790,8 @@ write_hash_delta_rep(representation_t *r
svn_stream_t *source;
const char *header;
- apr_off_t rep_end = 0;
- apr_off_t delta_start = 0;
+ apr_off_t rep_end = 0;
+ apr_off_t delta_start = 0;
struct write_hash_baton *whb;
fs_fs_data_t *ffd = fs->fsap_data;
@@ -5809,7 +5820,7 @@ write_hash_delta_rep(representation_t *r
SVN_ERR(get_file_offset(&delta_start, file, pool));
file_stream = svn_stream_from_aprfile2(file, TRUE, pool);
-
+
/* Prepare to write the svndiff data. */
svn_txdelta_to_svndiff3(&diff_wh,
&diff_whb,
@@ -5865,6 +5876,8 @@ write_hash_delta_rep(representation_t *r
/* Sanity check ROOT_NODEREV, a candidate for being the root node-revision
of (not yet committed) revision REV in FS. Use POOL for temporary
allocations.
+
+ If you change this function, consider updating svn_fs_fs__verify() too.
*/
static svn_error_t *
validate_root_noderev(svn_fs_t *fs,
@@ -5911,8 +5924,11 @@ validate_root_noderev(svn_fs_t *fs,
return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
_("predecessor count for "
"the root node-revision is wrong: "
- "found %d, committing r%ld"),
- root_noderev->predecessor_count, rev);
+ "found (%d+%ld != %d), committing r%ld"),
+ head_predecessor_count,
+ rev - head_revnum, /* This is equal to 1. */
+ root_noderev->predecessor_count,
+ rev);
}
return SVN_NO_ERROR;
@@ -6053,7 +6069,7 @@ write_final_rev(const svn_fs_id_t **new_
proplist, fs, noderev, reps_hash,
pool));
#else
- SVN_ERR(write_hash_rep(noderev->prop_rep, file, proplist,
+ SVN_ERR(write_hash_rep(noderev->prop_rep, file, proplist,
fs, reps_hash, pool));
#endif
}
@@ -6112,15 +6128,15 @@ write_final_rev(const svn_fs_id_t **new_
if (noderev->prop_rep && noderev->prop_rep->revision == rev)
{
/* Add new property reps to hash and on-disk cache. */
- representation_t *copy
+ representation_t *copy
= svn_fs_fs__rep_copy(noderev->prop_rep, reps_pool);
SVN_ERR_ASSERT(reps_to_cache && reps_pool);
APR_ARRAY_PUSH(reps_to_cache, representation_t *) = copy;
- apr_hash_set(reps_hash,
- copy->sha1_checksum->digest,
- APR_SHA1_DIGESTSIZE,
+ apr_hash_set(reps_hash,
+ copy->sha1_checksum->digest,
+ APR_SHA1_DIGESTSIZE,
copy);
}
}
@@ -7878,7 +7894,7 @@ svn_fs_fs__pack(svn_fs_t *fs,
/** Verifying. **/
-/* Body of svn_fs_fs__verify().
+/* Used by svn_fs_fs__verify().
Implements svn_fs_fs__walk_rep_reference().walker. */
static svn_error_t *
verify_walker(representation_t *rep,
@@ -7899,23 +7915,93 @@ svn_error_t *
svn_fs_fs__verify(svn_fs_t *fs,
svn_cancel_func_t cancel_func,
void *cancel_baton,
+ svn_revnum_t start,
+ svn_revnum_t end,
apr_pool_t *pool)
{
fs_fs_data_t *ffd = fs->fsap_data;
svn_boolean_t exists;
+ svn_revnum_t youngest = ffd->youngest_rev_cache; /* cache is current */
+ apr_pool_t *iterpool = svn_pool_create(pool);
if (ffd->format < SVN_FS_FS__MIN_REP_SHARING_FORMAT)
return SVN_NO_ERROR;
- /* Do not attempt to walk the rep-cache database if its file does not exists,
- since doing so would create it --- which may confuse the administrator. */
+ /* Input validation. */
+ if (! SVN_IS_VALID_REVNUM(start))
+ start = 0;
+ if (! SVN_IS_VALID_REVNUM(end))
+ end = youngest;
+ SVN_ERR(ensure_revision_exists(fs, start, iterpool));
+ SVN_ERR(ensure_revision_exists(fs, end, iterpool));
+
+ /* rep-cache verification. */
SVN_ERR(svn_fs_fs__exists_rep_cache(&exists, fs, pool));
if (exists)
- /* Don't take any lock. */
+ /* Do not attempt to walk the rep-cache database if its file does not exist,
+ since doing so would create it --- which may confuse the administrator.
+ Don't take any lock. */
SVN_ERR(svn_fs_fs__walk_rep_reference(fs, verify_walker, NULL,
cancel_func, cancel_baton,
+ start, end,
pool));
+ /* Issue #4129: bogus pred-counts on the root node-rev. */
+ {
+ svn_revnum_t i;
+ int predecessor_predecessor_count;
+
+ /* Compute PREDECESSOR_PREDECESSOR_COUNT. */
+ if (start == 0)
+ /* The value that passes the if() at the end of the loop. */
+ predecessor_predecessor_count = -1;
+ else
+ {
+ svn_fs_id_t *root_id;
+ node_revision_t *root_noderev;
+ SVN_ERR(svn_fs_fs__rev_get_root(&root_id, fs, start-1, iterpool));
+ SVN_ERR(svn_fs_fs__get_node_revision(&root_noderev, fs, root_id,
+ iterpool));
+ predecessor_predecessor_count = root_noderev->predecessor_count;
+ }
+
+ for (i = start; i <= end; i++)
+ {
+ /* ### Caching.
+
+ svn_fs_fs__rev_get_root() consults caches, which in verify we
+ don't want. But we can't easily bypass that, as
+ svn_fs_revision_root()+svn_fs_node_id()'s implementation uses
+ svn_fs_fs__rev_get_root() too.
+
+ ### A future revision will make fs_verify() disable caches when it
+ ### opens ffd.
+ */
+ svn_fs_id_t *root_id;
+ node_revision_t *root_noderev;
+
+ if ((i % 128) == 0) /* uneducated guess */
+ svn_pool_clear(iterpool);
+
+ /* Fetch ROOT_NODEREV. */
+ SVN_ERR(svn_fs_fs__rev_get_root(&root_id, fs, i, iterpool));
+ SVN_ERR(svn_fs_fs__get_node_revision(&root_noderev, fs, root_id,
+ iterpool));
+
+ /* Check correctness. (Compare validate_root_noderev().) */
+ if (1+predecessor_predecessor_count != root_noderev->predecessor_count)
+ return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
+ _("predecessor count for "
+ "the root node-revision is wrong: "
+ "r%ld has %d, but r%ld has %d"),
+ i, root_noderev->predecessor_count,
+ i-1, predecessor_predecessor_count);
+
+ predecessor_predecessor_count = root_noderev->predecessor_count;
+ }
+ }
+
+ svn_pool_destroy(iterpool);
return SVN_NO_ERROR;
}
@@ -8079,7 +8165,7 @@ hotcopy_io_copy_dir_recursively(const ch
else if (this_entry.filetype == APR_DIR) /* recurse */
{
const char *src_target;
-
+
/* Prevent infinite recursion by filtering off our
newly created destination path. */
if (strcmp(src, dst_parent) == 0
@@ -8284,7 +8370,7 @@ hotcopy_remove_rev_files(svn_fs_t *dst_f
for (rev = start_rev; rev < end_rev; rev++)
{
const char *rev_path;
-
+
svn_pool_clear(iterpool);
/* If necessary, update paths for shard. */
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/fs_fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/fs_fs.h?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/fs_fs.h (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/fs_fs.h Wed Mar 14 19:40:19 2012
@@ -42,6 +42,8 @@ svn_error_t *svn_fs_fs__upgrade(svn_fs_t
svn_error_t *svn_fs_fs__verify(svn_fs_t *fs,
svn_cancel_func_t cancel_func,
void *cancel_baton,
+ svn_revnum_t start,
+ svn_revnum_t end,
apr_pool_t *pool);
/* Copy the fsfs filesystem SRC_FS at SRC_PATH into a new copy DST_FS at
@@ -106,6 +108,12 @@ svn_error_t *svn_fs_fs__youngest_rev(svn
svn_fs_t *fs,
apr_pool_t *pool);
+/* Return an error iff REV does not exist in FS. */
+svn_error_t *
+svn_fs_fs__revision_exists(svn_revnum_t rev,
+ svn_fs_t *fs,
+ apr_pool_t *pool);
+
/* Set *ROOT_ID to the node-id for the root of revision REV in
filesystem FS. Do any allocations in POOL. */
svn_error_t *svn_fs_fs__rev_get_root(svn_fs_id_t **root_id,
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/rep-cache-db.sql
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/rep-cache-db.sql?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/rep-cache-db.sql (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/rep-cache-db.sql Wed Mar 14 19:40:19 2012
@@ -33,6 +33,11 @@ CREATE TABLE rep_cache (
expanded_size INTEGER NOT NULL
);
+/* There isn't an implicit index on a TEXT column, so create an explicit one. */
+CREATE INDEX I_HASH on REP_CACHE (hash);
+
+/* The index didn't exist until 1.7.5; therefore, some USER_VERSION=1
+ rep-cache.db files out there DO NOT contain an I_HASH index. */
PRAGMA USER_VERSION = 1;
@@ -47,9 +52,15 @@ INSERT OR FAIL INTO rep_cache (hash, rev
VALUES (?1, ?2, ?3, ?4, ?5)
--- STMT_GET_ALL_REPS
+-- STMT_GET_REPS_FOR_RANGE
SELECT hash, revision, offset, size, expanded_size
FROM rep_cache
+WHERE revision >= ?1 AND revision <= ?2
+
+
+-- STMT_GET_MAX_REV
+SELECT MAX(revision)
+FROM rep_cache
-- STMT_DEL_REPS_YOUNGER_THAN_REV
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/rep-cache.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/rep-cache.c?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/rep-cache.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/rep-cache.c Wed Mar 14 19:40:19 2012
@@ -56,24 +56,9 @@ rep_has_been_born(representation_t *rep,
svn_fs_t *fs,
apr_pool_t *pool)
{
- fs_fs_data_t *ffd = fs->fsap_data;
- svn_revnum_t youngest;
-
SVN_ERR_ASSERT(rep);
- youngest = ffd->youngest_rev_cache;
- if (youngest < rep->revision)
- {
- /* Stale cache. */
- SVN_ERR(svn_fs_fs__youngest_rev(&youngest, fs, pool));
-
- /* Fresh cache. */
- if (youngest < rep->revision)
- return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
- _("Youngest revision is r%ld, but "
- "rep-cache contains r%ld"),
- youngest, rep->revision);
- }
+ SVN_ERR(svn_fs_fs__revision_exists(rep->revision, fs, pool));
return SVN_NO_ERROR;
}
@@ -141,11 +126,13 @@ svn_error_t *
svn_fs_fs__walk_rep_reference(svn_fs_t *fs,
svn_error_t *(*walker)(representation_t *,
void *,
- svn_fs_t *,
+ svn_fs_t *,
apr_pool_t *),
void *walker_baton,
svn_cancel_func_t cancel_func,
void *cancel_baton,
+ svn_revnum_t start,
+ svn_revnum_t end,
apr_pool_t *pool)
{
fs_fs_data_t *ffd = fs->fsap_data;
@@ -161,9 +148,25 @@ svn_fs_fs__walk_rep_reference(svn_fs_t *
if (! ffd->rep_cache_db)
SVN_ERR(svn_fs_fs__open_rep_cache(fs, pool));
+ /* Check global invariants. */
+ if (start == 0)
+ {
+ svn_sqlite__stmt_t *stmt2;
+ svn_revnum_t max;
+
+ SVN_ERR(svn_sqlite__get_statement(&stmt2, ffd->rep_cache_db,
+ STMT_GET_MAX_REV));
+ SVN_ERR(svn_sqlite__step(&have_row, stmt2));
+ max = svn_sqlite__column_revnum(stmt2, 0);
+ SVN_ERR(svn_fs_fs__revision_exists(max, fs, iterpool));
+ SVN_ERR(svn_sqlite__reset(stmt2));
+ }
+
/* Get the statement. (There are no arguments to bind.) */
SVN_ERR(svn_sqlite__get_statement(&stmt, ffd->rep_cache_db,
- STMT_GET_ALL_REPS));
+ STMT_GET_REPS_FOR_RANGE));
+ SVN_ERR(svn_sqlite__bindf(stmt, "rr",
+ start, end));
/* Walk the cache entries. */
SVN_ERR(svn_sqlite__step(&have_row, stmt));
@@ -171,7 +174,7 @@ svn_fs_fs__walk_rep_reference(svn_fs_t *
{
representation_t *rep;
const char *sha1_digest;
-
+
/* Clear ITERPOOL occasionally. */
if (iterations++ % 16 == 0)
svn_pool_clear(iterpool);
@@ -191,10 +194,6 @@ svn_fs_fs__walk_rep_reference(svn_fs_t *
rep->size = svn_sqlite__column_int64(stmt, 3);
rep->expanded_size = svn_sqlite__column_int64(stmt, 4);
- /* Sanity check. */
- if (rep)
- SVN_ERR(rep_has_been_born(rep, fs, iterpool));
-
/* Walk. */
SVN_ERR(walker(rep, walker_baton, fs, iterpool));
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/rep-cache.h
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/rep-cache.h?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/rep-cache.h (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/rep-cache.h Wed Mar 14 19:40:19 2012
@@ -50,11 +50,13 @@ svn_error_t *
svn_fs_fs__walk_rep_reference(svn_fs_t *fs,
svn_error_t *(*walker)(representation_t *rep,
void *walker_baton,
- svn_fs_t *fs,
+ svn_fs_t *fs,
apr_pool_t *scratch_pool),
void *walker_baton,
svn_cancel_func_t cancel_func,
void *cancel_baton,
+ svn_revnum_t start,
+ svn_revnum_t end,
apr_pool_t *pool);
/* Return the representation REP in FS which has fulltext CHECKSUM.
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/temp_serializer.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/temp_serializer.c?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/temp_serializer.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/temp_serializer.c Wed Mar 14 19:40:19 2012
@@ -136,7 +136,7 @@ serialize_svn_string(svn_temp_serializer
* Thus, we cannot use svn_temp_serializer__add_string. */
svn_temp_serializer__push(context,
(const void * const *)&string->data,
- string->len);
+ string->len + 1);
/* back to the caller's nesting level */
svn_temp_serializer__pop(context);
@@ -579,6 +579,142 @@ svn_fs_fs__deserialize_manifest(void **o
return SVN_NO_ERROR;
}
+/* Auxilliary structure representing the content of a properties hash.
+ This structure is much easier to (de-)serialize than an apr_hash.
+ */
+typedef struct properties_data_t
+{
+ /* number of entries in the hash */
+ apr_size_t count;
+
+ /* reference to the keys */
+ const char **keys;
+
+ /* reference to the values */
+ const svn_string_t **values;
+} properties_data_t;
+
+/* Serialize COUNT C-style strings from *STRINGS into CONTEXT. */
+static void
+serialize_cstring_array(svn_temp_serializer__context_t *context,
+ const char ***strings,
+ apr_size_t count)
+{
+ apr_size_t i;
+ const char **entries = *strings;
+
+ /* serialize COUNT entries pointers (the array) */
+ svn_temp_serializer__push(context,
+ (const void * const *)strings,
+ count * sizeof(const char*));
+
+ /* serialize array elements */
+ for (i = 0; i < count; ++i)
+ svn_temp_serializer__add_string(context, &entries[i]);
+
+ svn_temp_serializer__pop(context);
+}
+
+/* Serialize COUNT svn_string_t* items from *STRINGS into CONTEXT. */
+static void
+serialize_svn_string_array(svn_temp_serializer__context_t *context,
+ const svn_string_t ***strings,
+ apr_size_t count)
+{
+ apr_size_t i;
+ const svn_string_t **entries = *strings;
+
+ /* serialize COUNT entries pointers (the array) */
+ svn_temp_serializer__push(context,
+ (const void * const *)strings,
+ count * sizeof(const char*));
+
+ /* serialize array elements */
+ for (i = 0; i < count; ++i)
+ serialize_svn_string(context, &entries[i]);
+
+ svn_temp_serializer__pop(context);
+}
+
+svn_error_t *
+svn_fs_fs__serialize_properties(char **data,
+ apr_size_t *data_len,
+ void *in,
+ apr_pool_t *pool)
+{
+ apr_hash_t *hash = in;
+ properties_data_t properties;
+ svn_temp_serializer__context_t *context;
+ apr_hash_index_t *hi;
+ svn_stringbuf_t *serialized;
+ apr_size_t i;
+
+ /* create our auxilliary data structure */
+ properties.count = apr_hash_count(hash);
+ properties.keys = apr_palloc(pool, sizeof(const char*) * (properties.count + 1));
+ properties.values = apr_palloc(pool, sizeof(const char*) * properties.count);
+
+ /* populate it with the hash entries */
+ for (hi = apr_hash_first(pool, hash), i=0; hi; hi = apr_hash_next(hi), ++i)
+ {
+ properties.keys[i] = svn__apr_hash_index_key(hi);
+ properties.values[i] = svn__apr_hash_index_val(hi);
+ }
+
+ /* serialize it */
+ context = svn_temp_serializer__init(&properties,
+ sizeof(properties),
+ properties.count * 100,
+ pool);
+
+ properties.keys[i] = "";
+ serialize_cstring_array(context, &properties.keys, properties.count + 1);
+ serialize_svn_string_array(context, &properties.values, properties.count);
+
+ /* return the serialized result */
+ serialized = svn_temp_serializer__get(context);
+
+ *data = serialized->data;
+ *data_len = serialized->len;
+
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_fs_fs__deserialize_properties(void **out,
+ char *data,
+ apr_size_t data_len,
+ apr_pool_t *pool)
+{
+ apr_hash_t *hash = apr_hash_make(pool);
+ properties_data_t *properties = (properties_data_t *)data;
+ size_t i;
+
+ /* de-serialize our auxilliary data structure */
+ svn_temp_deserializer__resolve(properties, (void**)&properties->keys);
+ svn_temp_deserializer__resolve(properties, (void**)&properties->values);
+
+ /* de-serialize each entry and put it into the hash */
+ for (i = 0; i < properties->count; ++i)
+ {
+ apr_size_t len = properties->keys[i+1] - properties->keys[i] - 1;
+ svn_temp_deserializer__resolve(properties->keys,
+ (void**)&properties->keys[i]);
+
+ deserialize_svn_string(properties->values,
+ (svn_string_t **)&properties->values[i]);
+
+ apr_hash_set(hash,
+ properties->keys[i], len,
+ properties->values[i]);
+ }
+
+ /* done */
+ *out = hash;
+
+ return SVN_NO_ERROR;
+}
+
svn_error_t *
svn_fs_fs__serialize_id(char **data,
apr_size_t *data_len,
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/temp_serializer.h
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/temp_serializer.h?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/temp_serializer.h (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/temp_serializer.h Wed Mar 14 19:40:19 2012
@@ -113,6 +113,26 @@ svn_fs_fs__deserialize_manifest(void **o
apr_pool_t *pool);
/**
+ * Implements #svn_cache__serialize_func_t for a properties hash
+ * (@a in is an #apr_hash_t of svn_string_t elements, keyed by const char*).
+ */
+svn_error_t *
+svn_fs_fs__serialize_properties(char **data,
+ apr_size_t *data_len,
+ void *in,
+ apr_pool_t *pool);
+
+/**
+ * Implements #svn_cache__deserialize_func_t for a properties hash
+ * (@a *out is an #apr_hash_t of svn_string_t elements, keyed by const char*).
+ */
+svn_error_t *
+svn_fs_fs__deserialize_properties(void **out,
+ char *data,
+ apr_size_t data_len,
+ apr_pool_t *pool);
+
+/**
* Implements #svn_cache__serialize_func_t for #svn_fs_id_t
*/
svn_error_t *
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/tree.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/tree.c?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/tree.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_fs_fs/tree.c Wed Mar 14 19:40:19 2012
@@ -115,7 +115,7 @@ typedef struct fs_rev_root_data_t
typedef struct fs_txn_root_data_t
{
/* Cache of txn DAG nodes (without their nested noderevs, because
- * it's mutable). */
+ * it's mutable). Same keys/values as ffd->rev_node_cache. */
svn_cache__t *txn_node_cache;
} fs_txn_root_data_t;
@@ -2807,8 +2807,10 @@ find_youngest_copyroot(svn_revnum_t *rev
parent_path_t *parent_path,
apr_pool_t *pool)
{
- svn_revnum_t rev_mine, rev_parent = -1;
- const char *path_mine, *path_parent;
+ svn_revnum_t rev_mine;
+ svn_revnum_t rev_parent = SVN_INVALID_REVNUM;
+ const char *path_mine;
+ const char *path_parent = NULL;
/* First find our parent's youngest copyroot. */
if (parent_path->parent)
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_ra_local/ra_plugin.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_ra_local/ra_plugin.c?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_ra_local/ra_plugin.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_ra_local/ra_plugin.c Wed Mar 14 19:40:19 2012
@@ -153,7 +153,7 @@ cache_init(void *baton, apr_pool_t *pool
SVN_ERR(svn_error_quick_wrap(svn_cstring_atoui64(&memory_cache_size,
memory_cache_size_str),
_("memory-cache-size invalid")));
- settings.cache_size = 1024 * 1024 * memory_cache_size;
+ settings.cache_size = 1024 * 1024 * memory_cache_size;
svn_cache_config_set(&settings);
}
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_ra_neon/log.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_ra_neon/log.c?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_ra_neon/log.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_ra_neon/log.c Wed Mar 14 19:40:19 2012
@@ -166,7 +166,7 @@ log_start_element(int *elem, void *baton
lb->want_cdata = lb->cdata;
svn_stringbuf_setempty(lb->cdata);
lb->cdata_encoding = NULL;
-
+
/* Some tags might contain encoded CDATA. */
if ((elm->id == ELEM_comment) ||
(elm->id == ELEM_creator_displayname) ||
@@ -280,7 +280,7 @@ maybe_decode_log_cdata(const svn_string_
return SVN_NO_ERROR;
}
-
+
/*
* This implements the `svn_ra_neon__xml_endelm_cb' prototype.
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_ra_serf/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_ra_serf/commit.c?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_ra_serf/commit.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_ra_serf/commit.c Wed Mar 14 19:40:19 2012
@@ -328,7 +328,7 @@ checkout_dir(dir_context_t *dir)
return SVN_NO_ERROR;
}
- /* Is this directory or one of our parent dirs newly added?
+ /* Is this directory or one of our parent dirs newly added?
* If so, we're already implicitly checked out. */
while (p_dir)
{
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_ra_serf/locks.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_ra_serf/locks.c?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_ra_serf/locks.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_ra_serf/locks.c Wed Mar 14 19:40:19 2012
@@ -716,8 +716,6 @@ svn_ra_serf__unlock(svn_ra_session_t *ra
token = existing_lock->token;
if (!token)
{
- svn_error_t *err;
-
err = svn_error_createf(SVN_ERR_RA_NOT_LOCKED, NULL,
_("'%s' is not locked in the repository"),
path);
@@ -728,11 +726,15 @@ svn_ra_serf__unlock(svn_ra_session_t *ra
err2 = lock_func(lock_baton, path, FALSE, NULL, err,
iterpool);
svn_error_clear(err);
+ err = NULL;
if (err2)
return svn_error_trace(err2);
}
else
- svn_error_clear(err);
+ {
+ svn_error_clear(err);
+ err = NULL;
+ }
continue;
}
}
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_ra_svn/cyrus_auth.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_ra_svn/cyrus_auth.c?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_ra_svn/cyrus_auth.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_ra_svn/cyrus_auth.c Wed Mar 14 19:40:19 2012
@@ -125,7 +125,7 @@ static int check_result(svn_error_t *err
svn_error_clear(err);
return -1;
}
-
+
return 0;
}
@@ -180,9 +180,9 @@ svn_ra_svn__sasl_common_init(apr_pool_t
sasl_mutex_free_cb);
free_mutexes = apr_array_make(sasl_pool, 0, sizeof(svn_mutex__t *));
return svn_mutex__init(&array_mutex, TRUE, sasl_pool);
-
+
#endif /* APR_HAS_THREADS */
-
+
return SVN_NO_ERROR;
}
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_ra_svn/marshal.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_ra_svn/marshal.c?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_ra_svn/marshal.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_ra_svn/marshal.c Wed Mar 14 19:40:19 2012
@@ -125,6 +125,14 @@ svn_error_t *svn_ra_svn_set_capabilities
return SVN_NO_ERROR;
}
+svn_error_t *
+svn_ra_svn__set_shim_callbacks(svn_ra_svn_conn_t *conn,
+ svn_delta_shim_callbacks_t *shim_callbacks)
+{
+ conn->shim_callbacks = shim_callbacks;
+ return SVN_NO_ERROR;
+}
+
svn_boolean_t svn_ra_svn_has_capability(svn_ra_svn_conn_t *conn,
const char *capability)
{
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_repos/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_repos/commit.c?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_repos/commit.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_repos/commit.c Wed Mar 14 19:40:19 2012
@@ -783,31 +783,45 @@ abort_edit(void *edit_baton,
static svn_error_t *
-prop_fetch_func(apr_hash_t **props,
- void *baton,
- const char *path,
- svn_revnum_t base_revision,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
+rationalize_shim_path(const char **fs_path,
+ struct edit_baton *eb,
+ const char *path,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
- struct edit_baton *eb = baton;
- svn_fs_root_t *fs_root;
- svn_error_t *err;
-
if (svn_path_is_url(path))
{
/* This is a copyfrom URL. */
path = svn_uri_skip_ancestor(eb->repos_url, path, scratch_pool);
- path = svn_fspath__canonicalize(path, scratch_pool);
+ *fs_path = svn_fspath__canonicalize(path, scratch_pool);
}
else
{
/* This is a base-relative path. */
if (path[0] != '/')
/* Get an absolute path for use in the FS. */
- path = svn_fspath__join(eb->base_path, path, scratch_pool);
+ *fs_path = svn_fspath__join(eb->base_path, path, scratch_pool);
+ else
+ *fs_path = path;
}
+ return SVN_NO_ERROR;
+}
+
+
+static svn_error_t *
+fetch_props_func(apr_hash_t **props,
+ void *baton,
+ const char *path,
+ svn_revnum_t base_revision,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ struct edit_baton *eb = baton;
+ svn_fs_root_t *fs_root;
+ svn_error_t *err;
+
+ SVN_ERR(rationalize_shim_path(&path, eb, path, scratch_pool, scratch_pool));
SVN_ERR(svn_fs_revision_root(&fs_root, eb->fs,
svn_fs_txn_base_revision(eb->txn),
scratch_pool));
@@ -825,7 +839,7 @@ prop_fetch_func(apr_hash_t **props,
}
static svn_error_t *
-kind_fetch_func(svn_kind_t *kind,
+fetch_kind_func(svn_kind_t *kind,
void *baton,
const char *path,
svn_revnum_t base_revision,
@@ -838,27 +852,14 @@ kind_fetch_func(svn_kind_t *kind,
if (!SVN_IS_VALID_REVNUM(base_revision))
base_revision = svn_fs_txn_base_revision(eb->txn);
- if (svn_path_is_url(path))
- {
- /* This is a copyfrom URL. */
- path = svn_uri_skip_ancestor(eb->repos_url, path, scratch_pool);
- path = svn_fspath__canonicalize(path, scratch_pool);
- }
- else
- {
- /* This is a base-relative path. */
- if (path[0] != '/')
- /* Get an absolute path for use in the FS. */
- path = svn_fspath__join(eb->base_path, path, scratch_pool);
- }
-
+ SVN_ERR(rationalize_shim_path(&path, eb, path, scratch_pool, scratch_pool));
SVN_ERR(svn_fs_revision_root(&fs_root, eb->fs, base_revision, scratch_pool));
SVN_ERR(svn_fs_check_path(&node_kind, fs_root, path, scratch_pool));
*kind = svn__kind_from_node_kind(node_kind, FALSE);
return SVN_NO_ERROR;
-}
+}
static svn_error_t *
fetch_base_func(const char **filename,
@@ -878,20 +879,7 @@ fetch_base_func(const char **filename,
if (!SVN_IS_VALID_REVNUM(base_revision))
base_revision = svn_fs_txn_base_revision(eb->txn);
- if (svn_path_is_url(path))
- {
- /* This is a copyfrom URL. */
- path = svn_uri_skip_ancestor(eb->repos_url, path, scratch_pool);
- path = svn_fspath__canonicalize(path, scratch_pool);
- }
- else
- {
- /* This is a base-relative path. */
- if (path[0] != '/')
- /* Get an absolute path for use in the FS. */
- path = svn_fspath__join(eb->base_path, path, scratch_pool);
- }
-
+ SVN_ERR(rationalize_shim_path(&path, eb, path, scratch_pool, scratch_pool));
SVN_ERR(svn_fs_revision_root(&fs_root, eb->fs, base_revision, scratch_pool));
err = svn_fs_file_contents(&contents, fs_root, path, scratch_pool);
@@ -987,8 +975,8 @@ svn_repos_get_commit_editor5(const svn_d
*edit_baton = eb;
*editor = e;
- shim_callbacks->fetch_props_func = prop_fetch_func;
- shim_callbacks->fetch_kind_func = kind_fetch_func;
+ shim_callbacks->fetch_props_func = fetch_props_func;
+ shim_callbacks->fetch_kind_func = fetch_kind_func;
shim_callbacks->fetch_base_func = fetch_base_func;
shim_callbacks->fetch_baton = eb;
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_repos/dump.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_repos/dump.c?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_repos/dump.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_repos/dump.c Wed Mar 14 19:40:19 2012
@@ -1395,10 +1395,9 @@ svn_repos_verify_fs2(svn_repos_t *repos,
"(youngest revision is %ld)"),
end_rev, youngest);
- /* Verify global/auxiliary data before verifying revisions. */
- if (start_rev == 0)
- SVN_ERR(svn_fs_verify(svn_fs_path(fs, pool), cancel_func, cancel_baton,
- pool));
+ /* Verify global/auxiliary data and backend-specific data first. */
+ SVN_ERR(svn_fs_verify(svn_fs_path(fs, pool), cancel_func, cancel_baton,
+ start_rev, end_rev, pool));
/* Create a notify object that we can reuse within the loop. */
if (notify_func)
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_repos/hooks.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_repos/hooks.c?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_repos/hooks.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_repos/hooks.c Wed Mar 14 19:40:19 2012
@@ -171,7 +171,7 @@ env_from_env_hash(apr_hash_t *env_hash,
apr_hash_index_t *hi;
const char **env;
const char **envp;
-
+
if (!env_hash || apr_hash_count(env_hash) == 0)
return NULL;
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_repos/load-fs-vtable.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_repos/load-fs-vtable.c?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_repos/load-fs-vtable.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_repos/load-fs-vtable.c Wed Mar 14 19:40:19 2012
@@ -487,7 +487,7 @@ new_revision_record(void **revision_bato
several separate operations. It is highly susceptible to race conditions.
Calculate the revision 'offset' for finding copyfrom sources.
It might be positive or negative. */
- rb->rev_offset = (apr_int32_t) (rb->rev) - (head_rev + 1);
+ rb->rev_offset = (apr_int32_t) ((rb->rev) - (head_rev + 1));
if ((rb->rev > 0) && (! rb->skipped))
{
@@ -506,7 +506,7 @@ new_revision_record(void **revision_bato
if (!SVN_IS_VALID_REVNUM(pb->oldest_old_rev))
pb->oldest_old_rev = rb->rev;
}
-
+
/* If we're skipping this revision, try to notify someone. */
if (rb->skipped && pb->notify_func)
{
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_repos/log.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_repos/log.c?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_repos/log.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_repos/log.c Wed Mar 14 19:40:19 2012
@@ -1180,7 +1180,7 @@ send_log(svn_revnum_t rev,
apr_array_header_t *rangelist =
svn__apr_hash_index_val(hi2);
- /* Check whether CHANGED_PATH at revision REV is a child of
+ /* Check whether CHANGED_PATH at revision REV is a child of
a (path, revision) tuple in LOG_TARGET_HISTORY_AS_MERGEINFO. */
if (svn_fspath__skip_ancestor(mergeinfo_path, changed_path))
{
@@ -1811,7 +1811,7 @@ store_search(svn_mergeinfo_t processed,
sizeof(svn_merge_range_t*));
svn_merge_range_t *range = apr_palloc(processed_pool,
sizeof(svn_merge_range_t));
-
+
range->start = start;
range->end = end;
range->inheritable = TRUE;
@@ -2281,7 +2281,7 @@ svn_repos_get_logs4(svn_repos_t *repos,
svn_boolean_t readable;
svn_fs_root_t *rev_root;
- SVN_ERR(svn_fs_revision_root(&rev_root, fs,
+ SVN_ERR(svn_fs_revision_root(&rev_root, fs,
descending_order ? end : start, pool));
SVN_ERR(authz_read_func(&readable, rev_root, "",
authz_read_baton, pool));
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_repos/replay.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_repos/replay.c?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_repos/replay.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_repos/replay.c Wed Mar 14 19:40:19 2012
@@ -367,7 +367,7 @@ was_readable(svn_boolean_t *readable,
{
svn_fs_root_t *inquire_root;
const char *inquire_path;
- struct copy_info *info;
+ struct copy_info *info = NULL;
const char *relpath;
/* Short circuit. */
@@ -378,7 +378,7 @@ was_readable(svn_boolean_t *readable,
}
if (copies->nelts != 0)
- info = &APR_ARRAY_IDX(copies, copies->nelts - 1, struct copy_info);
+ info = APR_ARRAY_IDX(copies, copies->nelts - 1, struct copy_info *);
/* Are we under a copy? */
if (info && (relpath = svn_relpath_skip_ancestor(info->path, path)))
@@ -493,9 +493,9 @@ path_driver_cb_func(void **dir_baton,
while (cb->copies->nelts > 0
&& ! svn_dirent_is_ancestor(APR_ARRAY_IDX(cb->copies,
cb->copies->nelts - 1,
- struct copy_info).path,
+ struct copy_info *)->path,
edit_path))
- cb->copies->nelts--;
+ apr_array_pop(cb->copies);
change = apr_hash_get(cb->changed_paths, edit_path, APR_HASH_KEY_STRING);
if (! change)
@@ -613,11 +613,13 @@ path_driver_cb_func(void **dir_baton,
(possibly nested) copy operation. */
if (change->node_kind == svn_node_dir)
{
- struct copy_info *info = &APR_ARRAY_PUSH(cb->copies,
- struct copy_info);
+ struct copy_info *info = apr_pcalloc(cb->pool, sizeof(*info));
+
info->path = apr_pstrdup(cb->pool, edit_path);
info->copyfrom_path = apr_pstrdup(cb->pool, copyfrom_path);
info->copyfrom_rev = copyfrom_rev;
+
+ APR_ARRAY_PUSH(cb->copies, struct copy_info *) = info;
}
/* Save the source so that we can use it later, when we
@@ -633,11 +635,13 @@ path_driver_cb_func(void **dir_baton,
past... */
if (change->node_kind == svn_node_dir && cb->copies->nelts > 0)
{
- struct copy_info *info = &APR_ARRAY_PUSH(cb->copies,
- struct copy_info);
+ struct copy_info *info = apr_pcalloc(cb->pool, sizeof(*info));
+
info->path = apr_pstrdup(cb->pool, edit_path);
info->copyfrom_path = NULL;
info->copyfrom_rev = SVN_INVALID_REVNUM;
+
+ APR_ARRAY_PUSH(cb->copies, struct copy_info *) = info;
}
source_root = NULL;
source_fspath = NULL;
@@ -670,9 +674,9 @@ path_driver_cb_func(void **dir_baton,
delta source. */
if (cb->copies->nelts > 0)
{
- struct copy_info *info = &APR_ARRAY_IDX(cb->copies,
- cb->copies->nelts - 1,
- struct copy_info);
+ struct copy_info *info = APR_ARRAY_IDX(cb->copies,
+ cb->copies->nelts - 1,
+ struct copy_info *);
if (info->copyfrom_path)
{
const char *relpath = svn_relpath_skip_ancestor(info->path,
@@ -894,7 +898,7 @@ svn_repos_replay2(svn_fs_root_t *root,
pool));
}
- cb_baton.copies = apr_array_make(pool, 4, sizeof(struct copy_info));
+ cb_baton.copies = apr_array_make(pool, 4, sizeof(struct copy_info *));
cb_baton.pool = pool;
/* Determine the revision to use throughout the edit, and call
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_repos/rev_hunt.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_repos/rev_hunt.c?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_repos/rev_hunt.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_repos/rev_hunt.c Wed Mar 14 19:40:19 2012
@@ -154,6 +154,8 @@ svn_repos_get_committed_info(svn_revnum_
const char *path,
apr_pool_t *pool)
{
+ apr_hash_t *revprops;
+
svn_fs_t *fs = svn_fs_root_fs(root);
/* ### It might be simpler just to declare that revision
@@ -164,13 +166,16 @@ svn_repos_get_committed_info(svn_revnum_
/* Get the CR field out of the node's skel. */
SVN_ERR(svn_fs_node_created_rev(committed_rev, root, path, pool));
- /* Get the date property of this revision. */
- SVN_ERR(svn_fs_revision_prop(&committed_date_s, fs, *committed_rev,
- SVN_PROP_REVISION_DATE, pool));
-
- /* Get the author property of this revision. */
- SVN_ERR(svn_fs_revision_prop(&last_author_s, fs, *committed_rev,
- SVN_PROP_REVISION_AUTHOR, pool));
+ /* Get the revision properties of this revision. */
+ SVN_ERR(svn_fs_revision_proplist(&revprops, fs, *committed_rev, pool));
+
+ /* Extract date and author from these revprops. */
+ committed_date_s = apr_hash_get(revprops,
+ SVN_PROP_REVISION_DATE,
+ sizeof(SVN_PROP_REVISION_DATE)-1);
+ last_author_s = apr_hash_get(revprops,
+ SVN_PROP_REVISION_AUTHOR,
+ sizeof(SVN_PROP_REVISION_AUTHOR)-1);
*committed_date = committed_date_s ? committed_date_s->data : NULL;
*last_author = last_author_s ? last_author_s->data : NULL;
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/cache-inprocess.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/cache-inprocess.c?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/cache-inprocess.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/cache-inprocess.c Wed Mar 14 19:40:19 2012
@@ -201,7 +201,7 @@ inprocess_cache_get_internal(char **buff
*size = entry->size;
}
-
+
return SVN_NO_ERROR;
}
@@ -223,7 +223,7 @@ inprocess_cache_get(void **value_p,
cache,
key,
result_pool));
-
+
/* deserialize the buffer content. Usually, this will directly
modify the buffer content directly.
*/
@@ -445,7 +445,7 @@ inprocess_cache_iter(svn_boolean_t *comp
b.user_baton = user_baton;
SVN_MUTEX__WITH_LOCK(cache->mutex,
- svn_iter_apr_hash(completed, cache->hash,
+ svn_iter_apr_hash(completed, cache->hash,
iter_cb, &b, scratch_pool));
return SVN_NO_ERROR;
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/cache-membuffer.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/cache-membuffer.c?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/cache-membuffer.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/cache-membuffer.c Wed Mar 14 19:40:19 2012
@@ -136,6 +136,13 @@
*/
#define NO_OFFSET APR_UINT64_MAX
+/* To save space in our group structure, we only use 32 bit size values
+ * and, therefore, limit the size of each entry to just below 4GB.
+ * Supporting larger items is not a good idea as the data transfer
+ * to and from the cache would block other threads for a very long time.
+ */
+#define MAX_ITEM_SIZE ((apr_uint32_t)(0 - ITEM_ALIGNMENT))
+
/* Debugging / corruption detection support.
* If you define this macro, the getter functions will performed expensive
* checks on the item data, requested keys and entry types. If there is
@@ -395,6 +402,11 @@ struct svn_membuffer_t
*/
apr_uint64_t data_used;
+ /* Largest entry size that we would accept. For total cache sizes
+ * less than 4TB (sic!), this is determined by the total cache size.
+ */
+ apr_uint64_t max_entry_size;
+
/* Number of used dictionary entries, i.e. number of cached items.
* In conjunction with hit_count, this is used calculate the average
@@ -591,7 +603,7 @@ get_group_index(svn_membuffer_t **cache,
if (key == NULL)
return NO_INDEX;
-
+
err = svn_checksum(&checksum, svn_checksum_md5, key, len, pool);
if (err != NULL)
{
@@ -949,6 +961,7 @@ svn_cache__membuffer_cache_create(svn_me
apr_uint32_t group_count;
apr_uint32_t group_init_size;
apr_uint64_t data_size;
+ apr_uint64_t max_entry_size;
/* Determine a reasonable number of cache segments. Segmentation is
* only useful for multi-threaded / multi-core servers as it reduces
@@ -992,8 +1005,19 @@ svn_cache__membuffer_cache_create(svn_me
*/
data_size = total_size - directory_size;
+ /* For cache sizes > 4TB, individual cache segments will be larger
+ * than 16GB allowing for >4GB entries. But caching chunks larger
+ * than 4GB is simply not supported.
+ */
+ max_entry_size = data_size / 4 > MAX_ITEM_SIZE
+ ? MAX_ITEM_SIZE
+ : data_size / 4;
+
/* to keep the entries small, we use 32 bit indices only
- * -> we need to ensure that no more then 4G entries exist
+ * -> we need to ensure that no more then 4G entries exist.
+ *
+ * Note, that this limit could only be exceeded in a very
+ * theoretical setup with about 1EB of cache.
*/
group_count = directory_size / sizeof(entry_group_t);
if (group_count >= (APR_UINT32_MAX / GROUP_SIZE))
@@ -1024,6 +1048,7 @@ svn_cache__membuffer_cache_create(svn_me
c[seg].data = secure_aligned_alloc(pool, (apr_size_t)data_size, FALSE);
c[seg].current_data = 0;
c[seg].data_used = 0;
+ c[seg].max_entry_size = max_entry_size;
c[seg].used_entries = 0;
c[seg].hit_count = 0;
@@ -1055,14 +1080,14 @@ svn_cache__membuffer_cache_create(svn_me
/* Try to insert the serialized item given in BUFFER with SIZE into
- * the group GROUP_INDEX of CACHE and uniquely identify it by hash
- * value TO_FIND.
- *
+ * the group GROUP_INDEX of CACHE and uniquely identify it by hash
+ * value TO_FIND.
+ *
* However, there is no guarantee that it will actually be put into
* the cache. If there is already some data associated with TO_FIND,
* it will be removed from the cache even if the new data cannot
* be inserted.
- *
+ *
* Note: This function requires the caller to serialization access.
* Don't call it directly, call membuffer_cache_get_partial instead.
*/
@@ -1078,7 +1103,7 @@ membuffer_cache_set_internal(svn_membuff
/* if necessary, enlarge the insertion window.
*/
if ( buffer != NULL
- && cache->data_size / 4 > size
+ && cache->max_entry_size >= size
&& ensure_data_insertable(cache, size))
{
/* Remove old data for this key, if that exists.
@@ -1165,11 +1190,11 @@ membuffer_cache_set(svn_membuffer_t *cac
}
/* Look for the cache entry in group GROUP_INDEX of CACHE, identified
- * by the hash value TO_FIND. If no item has been stored for KEY,
+ * by the hash value TO_FIND. If no item has been stored for KEY,
* *BUFFER will be NULL. Otherwise, return a copy of the serialized
- * data in *BUFFER and return its size in *ITEM_SIZE. Allocations will
+ * data in *BUFFER and return its size in *ITEM_SIZE. Allocations will
* be done in POOL.
- *
+ *
* Note: This function requires the caller to serialization access.
* Don't call it directly, call membuffer_cache_get_partial instead.
*/
@@ -1195,10 +1220,10 @@ membuffer_cache_get_internal(svn_membuff
*/
*buffer = NULL;
*item_size = 0;
-
+
return SVN_NO_ERROR;
}
-
+
size = ALIGN_VALUE(entry->size);
*buffer = ALIGN_POINTER(apr_palloc(result_pool, size + ITEM_ALIGNMENT-1));
memcpy(*buffer, (const char*)cache->data + entry->offset, size);
@@ -1225,7 +1250,7 @@ membuffer_cache_get_internal(svn_membuff
cache->total_hits++;
*item_size = entry->size;
-
+
return SVN_NO_ERROR;
}
@@ -1275,18 +1300,18 @@ membuffer_cache_get(svn_membuffer_t *cac
*item = NULL;
return SVN_NO_ERROR;
}
-
+
return deserializer(item, buffer, size, result_pool);
}
/* Look for the cache entry in group GROUP_INDEX of CACHE, identified
* by the hash value TO_FIND. FOUND indicates whether that entry exists.
* If not found, *ITEM will be NULL.
- *
- * Otherwise, the DESERIALIZER is called with that entry and the BATON
+ *
+ * Otherwise, the DESERIALIZER is called with that entry and the BATON
* provided and will extract the desired information. The result is set
* in *ITEM. Allocations will be done in POOL.
- *
+ *
* Note: This function requires the caller to serialization access.
* Don't call it directly, call membuffer_cache_get_partial instead.
*/
@@ -1307,7 +1332,7 @@ membuffer_cache_get_partial_internal(svn
{
*item = NULL;
*found = FALSE;
-
+
return SVN_NO_ERROR;
}
else
@@ -1379,10 +1404,10 @@ membuffer_cache_get_partial(svn_membuffe
/* Look for the cache entry in group GROUP_INDEX of CACHE, identified
* by the hash value TO_FIND. If no entry has been found, the function
* returns without modifying the cache.
- *
+ *
* Otherwise, FUNC is called with that entry and the BATON provided
* and may modify the cache entry. Allocations will be done in POOL.
- *
+ *
* Note: This function requires the caller to serialization access.
* Don't call it directly, call membuffer_cache_set_partial instead.
*/
@@ -1452,7 +1477,7 @@ membuffer_cache_set_partial_internal(svn
/* Remove the old entry and try to make space for the new one.
*/
drop_entry(cache, entry);
- if ( (cache->data_size / 4 > size)
+ if ( (cache->max_entry_size >= size)
&& ensure_data_insertable(cache, size))
{
/* Write the new entry.
@@ -1823,8 +1848,7 @@ svn_membuffer_cache_is_cachable(void *ca
* must be small enough to be stored in a 32 bit value.
*/
svn_membuffer_cache_t *cache = cache_void;
- return (size < cache->membuffer->data_size / 4)
- && (size < APR_UINT32_MAX - ITEM_ALIGNMENT);
+ return size <= cache->membuffer->max_entry_size;
}
/* Add statistics of SEGMENT to INFO.
@@ -1872,7 +1896,7 @@ svn_membuffer_cache_get_info(void *cache
for (i = 0; i < cache->membuffer->segment_count; ++i)
{
svn_membuffer_t *segment = cache->membuffer + i;
- SVN_MUTEX__WITH_LOCK(segment->mutex,
+ SVN_MUTEX__WITH_LOCK(segment->mutex,
svn_membuffer_get_segment_info(segment, info));
}
@@ -1902,13 +1926,13 @@ svn_membuffer_cache_get_synced(void **va
apr_pool_t *result_pool)
{
svn_membuffer_cache_t *cache = cache_void;
- SVN_MUTEX__WITH_LOCK(cache->mutex,
+ SVN_MUTEX__WITH_LOCK(cache->mutex,
svn_membuffer_cache_get(value_p,
found,
cache_void,
key,
result_pool));
-
+
return SVN_NO_ERROR;
}
@@ -1921,12 +1945,12 @@ svn_membuffer_cache_set_synced(void *cac
apr_pool_t *scratch_pool)
{
svn_membuffer_cache_t *cache = cache_void;
- SVN_MUTEX__WITH_LOCK(cache->mutex,
+ SVN_MUTEX__WITH_LOCK(cache->mutex,
svn_membuffer_cache_set(cache_void,
key,
value,
scratch_pool));
-
+
return SVN_NO_ERROR;
}
@@ -1942,7 +1966,7 @@ svn_membuffer_cache_get_partial_synced(v
apr_pool_t *result_pool)
{
svn_membuffer_cache_t *cache = cache_void;
- SVN_MUTEX__WITH_LOCK(cache->mutex,
+ SVN_MUTEX__WITH_LOCK(cache->mutex,
svn_membuffer_cache_get_partial(value_p,
found,
cache_void,
@@ -1950,7 +1974,7 @@ svn_membuffer_cache_get_partial_synced(v
func,
baton,
result_pool));
-
+
return SVN_NO_ERROR;
}
@@ -1964,13 +1988,13 @@ svn_membuffer_cache_set_partial_synced(v
apr_pool_t *scratch_pool)
{
svn_membuffer_cache_t *cache = cache_void;
- SVN_MUTEX__WITH_LOCK(cache->mutex,
+ SVN_MUTEX__WITH_LOCK(cache->mutex,
svn_membuffer_cache_set_partial(cache_void,
key,
func,
baton,
scratch_pool));
-
+
return SVN_NO_ERROR;
}
@@ -2057,7 +2081,7 @@ svn_cache__create_membuffer_cache(svn_ca
cache->alloc_counter = 0;
SVN_ERR(svn_mutex__init(&cache->mutex, thread_safe, pool));
-
+
/* for performance reasons, we don't actually store the full prefix but a
* hash value of it
*/
@@ -2078,7 +2102,7 @@ svn_cache__create_membuffer_cache(svn_ca
/* initialize the generic cache wrapper
*/
- wrapper->vtable = thread_safe ? &membuffer_cache_synced_vtable
+ wrapper->vtable = thread_safe ? &membuffer_cache_synced_vtable
: &membuffer_cache_vtable;
wrapper->cache_internal = cache;
wrapper->error_handler = 0;
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/cache-memcache.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/cache-memcache.c?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/cache-memcache.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/cache-memcache.c Wed Mar 14 19:40:19 2012
@@ -148,7 +148,7 @@ memcache_internal_get(char **data,
*found = FALSE;
return SVN_NO_ERROR;
}
-
+
subpool = svn_pool_create(pool);
SVN_ERR(build_key(&mc_key, cache, key, subpool));
@@ -253,7 +253,7 @@ memcache_set(void *cache_void,
if (key == NULL)
return SVN_NO_ERROR;
-
+
if (cache->serialize_func)
{
SVN_ERR((cache->serialize_func)(&data, &data_len, value, subpool));
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/gpg_agent.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/gpg_agent.c?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/gpg_agent.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/gpg_agent.c Wed Mar 14 19:40:19 2012
@@ -169,7 +169,7 @@ password_get_gpg_agent(svn_boolean_t *do
const char *p = NULL;
char *ep = NULL;
char *buffer;
-
+
apr_array_header_t *socket_details;
const char *request = NULL;
const char *cache_id = NULL;
@@ -204,7 +204,7 @@ password_get_gpg_agent(svn_boolean_t *do
sd = socket(AF_UNIX, SOCK_STREAM, 0);
if (sd == -1)
return SVN_NO_ERROR;
-
+
if (connect(sd, (struct sockaddr *)&addr, sizeof(addr)) == -1)
{
close(sd);
@@ -363,7 +363,7 @@ password_get_gpg_agent(svn_boolean_t *do
if (strncmp(buffer, "ERR", 3) == 0)
return SVN_NO_ERROR;
-
+
p = NULL;
if (strncmp(buffer, "D", 1) == 0)
p = &buffer[2];
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/mergeinfo.c?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/mergeinfo.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/mergeinfo.c Wed Mar 14 19:40:19 2012
@@ -1112,12 +1112,12 @@ svn_rangelist_merge2(apr_array_header_t
j++;
}
}
- else
+ else
{
/* CHANGE and RANGE share the same start rev, but
CHANGE is considered older because its end rev
is older.
-
+
Insert the intersection of RANGE and CHANGE into
RANGELIST and then set RANGE to the non-intersecting
portion of RANGE. */
@@ -2111,7 +2111,6 @@ svn_mergeinfo__remove_prefix_from_catalo
apr_pool_t *pool)
{
apr_hash_index_t *hi;
- apr_ssize_t prefix_len = strlen(prefix_path);
SVN_ERR_ASSERT(prefix_path[0] == '/');
@@ -2120,23 +2119,13 @@ svn_mergeinfo__remove_prefix_from_catalo
for (hi = apr_hash_first(pool, in_catalog); hi; hi = apr_hash_next(hi))
{
const char *original_path = svn__apr_hash_index_key(hi);
- apr_ssize_t klen = svn__apr_hash_index_klen(hi);
svn_mergeinfo_t value = svn__apr_hash_index_val(hi);
- apr_ssize_t padding = 0;
-
- SVN_ERR_ASSERT(klen >= prefix_len);
- SVN_ERR_ASSERT(svn_fspath__skip_ancestor(prefix_path, original_path));
+ const char *new_path;
- /* If the ORIGINAL_PATH doesn't match the PREFIX_PATH exactly
- and we're not simply removing a single leading slash (such as
- when PREFIX_PATH is "/"), we advance our string offset by an
- extra character (to get past the directory separator that
- follows the prefix). */
- if ((strcmp(original_path, prefix_path) != 0) && (prefix_len != 1))
- padding = 1;
+ new_path = svn_fspath__skip_ancestor(prefix_path, original_path);
+ SVN_ERR_ASSERT(new_path);
- apr_hash_set(*out_catalog, original_path + prefix_len + padding,
- klen - prefix_len - padding, value);
+ apr_hash_set(*out_catalog, new_path, APR_HASH_KEY_STRING, value);
}
return SVN_NO_ERROR;
Modified: subversion/branches/fix-rdump-editor/subversion/libsvn_subr/skel.c
URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/libsvn_subr/skel.c?rev=1300696&r1=1300695&r2=1300696&view=diff
==============================================================================
--- subversion/branches/fix-rdump-editor/subversion/libsvn_subr/skel.c (original)
+++ subversion/branches/fix-rdump-editor/subversion/libsvn_subr/skel.c Wed Mar 14 19:40:19 2012
@@ -138,7 +138,7 @@ getsize(const char *data, apr_size_t len
/* Store the ASCII decimal representation of VALUE at DATA. Return
the length of the representation if all goes well; return zero if
the result doesn't fit in LEN bytes. */
-static int
+static apr_size_t
putsize(char *data, apr_size_t len, apr_size_t value)
{
apr_size_t i = 0;
@@ -157,7 +157,7 @@ putsize(char *data, apr_size_t len, apr_
/* Put the digits in most-significant-first order. */
{
- int left, right;
+ apr_size_t left, right;
for (left = 0, right = i-1; left < right; left++, right--)
{
@@ -492,7 +492,7 @@ unparse(const svn_skel_t *skel, svn_stri
{
/* Append the length to STR. */
char buf[200];
- int length_len;
+ apr_size_t length_len;
length_len = putsize(buf, sizeof(buf), skel->len);