You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2016/04/29 20:38:56 UTC
svn commit: r1741682 [13/26] - in /subversion/branches/authzperf: ./ build/
build/ac-macros/ build/generator/ contrib/server-side/svncutter/ notes/
notes/api-errata/1.9/ notes/move-tracking/ subversion/
subversion/bindings/ctypes-python/ subversion/bin...
Modified: subversion/branches/authzperf/subversion/libsvn_fs_x/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_fs_x/util.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_fs_x/util.c (original)
+++ subversion/branches/authzperf/subversion/libsvn_fs_x/util.c Fri Apr 29 18:38:53 2016
@@ -124,13 +124,6 @@ svn_fs_x__path_txn_current(svn_fs_t *fs,
}
const char *
-svn_fs_x__path_txn_next(svn_fs_t *fs,
- apr_pool_t *result_pool)
-{
- return svn_dirent_join(fs->path, PATH_TXN_NEXT, result_pool);
-}
-
-const char *
svn_fs_x__path_txn_current_lock(svn_fs_t *fs,
apr_pool_t *result_pool)
{
@@ -598,7 +591,13 @@ svn_fs_x__write_current(svn_fs_t *fs,
scratch_pool));
SVN_ERR(svn_io_file_close(file, scratch_pool));
- return svn_fs_x__move_into_place(tmp_name, name, name, scratch_pool);
+ /* Copying permissions is a no-op on WIN32. */
+ SVN_ERR(svn_io_copy_perms(name, tmp_name, scratch_pool));
+
+ /* Move the file into place. */
+ SVN_ERR(svn_io_file_rename2(tmp_name, name, TRUE, scratch_pool));
+
+ return SVN_NO_ERROR;
}
@@ -645,22 +644,6 @@ svn_fs_x__try_stringbuf_from_file(svn_st
/* Fetch the current offset of FILE into *OFFSET_P. */
svn_error_t *
-svn_fs_x__get_file_offset(apr_off_t *offset_p,
- apr_file_t *file,
- apr_pool_t *scratch_pool)
-{
- apr_off_t offset;
-
- /* Note that, for buffered files, one (possibly surprising) side-effect
- of this call is to flush any unwritten data to disk. */
- offset = 0;
- SVN_ERR(svn_io_file_seek(file, APR_CUR, &offset, scratch_pool));
- *offset_p = offset;
-
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
svn_fs_x__read_content(svn_stringbuf_t **content,
const char *fname,
apr_pool_t *result_pool)
@@ -716,66 +699,33 @@ svn_fs_x__read_number_from_stream(apr_in
return SVN_NO_ERROR;
}
-
-/* Move a file into place from OLD_FILENAME in the transactions
- directory to its final location NEW_FILENAME in the repository. On
- Unix, match the permissions of the new file to the permissions of
- PERMS_REFERENCE. Temporary allocations are from SCRATCH_POOL.
-
- This function almost duplicates svn_io_file_move(), but it tries to
- guarantee a flush. */
svn_error_t *
svn_fs_x__move_into_place(const char *old_filename,
const char *new_filename,
const char *perms_reference,
+ svn_fs_x__batch_fsync_t *batch,
apr_pool_t *scratch_pool)
{
- svn_error_t *err;
-
+ /* Copying permissions is a no-op on WIN32. */
SVN_ERR(svn_io_copy_perms(perms_reference, old_filename, scratch_pool));
+ /* We use specific 'fsyncing move' Win32 API calls on Windows while the
+ * directory update fsync is POSIX-only. Moreover, there tend to be only
+ * a few moved files (1 or 2) per batch.
+ *
+ * Therefore, we use the platform-optimized "immediate" fsyncs on all
+ * non-POSIX platforms and the "scheduled" fsyncs on POSIX only.
+ */
+#if defined(SVN_ON_POSIX)
/* Move the file into place. */
- err = svn_io_file_rename2(old_filename, new_filename, FALSE, scratch_pool);
- if (err && APR_STATUS_IS_EXDEV(err->apr_err))
- {
- apr_file_t *file;
-
- /* Can't rename across devices; fall back to copying. */
- svn_error_clear(err);
- err = SVN_NO_ERROR;
- SVN_ERR(svn_io_copy_file(old_filename, new_filename, TRUE,
- scratch_pool));
-
- /* Flush the target of the copy to disk. */
- SVN_ERR(svn_io_file_open(&file, new_filename, APR_READ,
- APR_OS_DEFAULT, scratch_pool));
- /* ### BH: Does this really guarantee a flush of the data written
- ### via a completely different handle on all operating systems?
- ###
- ### Maybe we should perform the copy ourselves instead of making
- ### apr do that and flush the real handle? */
- SVN_ERR(svn_io_file_flush_to_disk(file, scratch_pool));
- SVN_ERR(svn_io_file_close(file, scratch_pool));
- }
- if (err)
- return svn_error_trace(err);
+ SVN_ERR(svn_io_file_rename2(old_filename, new_filename, FALSE,
+ scratch_pool));
-#ifdef __linux__
- {
- /* Linux has the unusual feature that fsync() on a file is not
- enough to ensure that a file's directory entries have been
- flushed to disk; you have to fsync the directory as well.
- On other operating systems, we'd only be asking for trouble
- by trying to open and fsync a directory. */
- const char *dirname;
- apr_file_t *file;
-
- dirname = svn_dirent_dirname(new_filename, scratch_pool);
- SVN_ERR(svn_io_file_open(&file, dirname, APR_READ, APR_OS_DEFAULT,
- scratch_pool));
- SVN_ERR(svn_io_file_flush_to_disk(file, scratch_pool));
- SVN_ERR(svn_io_file_close(file, scratch_pool));
- }
+ /* Schedule for synchronization. */
+ SVN_ERR(svn_fs_x__batch_fsync_new_path(batch, new_filename, scratch_pool));
+#else
+ SVN_ERR(svn_io_file_rename2(old_filename, new_filename, TRUE,
+ scratch_pool));
#endif
return SVN_NO_ERROR;
Modified: subversion/branches/authzperf/subversion/libsvn_fs_x/util.h
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_fs_x/util.h?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_fs_x/util.h (original)
+++ subversion/branches/authzperf/subversion/libsvn_fs_x/util.h Fri Apr 29 18:38:53 2016
@@ -25,6 +25,7 @@
#include "svn_fs.h"
#include "id.h"
+#include "batch_fsync.h"
/* Functions for dealing with recoverable errors on mutable files
*
@@ -122,13 +123,6 @@ const char *
svn_fs_x__path_txn_current(svn_fs_t *fs,
apr_pool_t *result_pool);
-/* Return the full path of the "txn-next" file in FS.
- * The result will be allocated in RESULT_POOL.
- */
-const char *
-svn_fs_x__path_txn_next(svn_fs_t *fs,
- apr_pool_t *result_pool);
-
/* Return the full path of the "txn-current-lock" file in FS.
* The result will be allocated in RESULT_POOL.
*/
@@ -428,13 +422,6 @@ svn_fs_x__try_stringbuf_from_file(svn_st
svn_boolean_t last_attempt,
apr_pool_t *result_pool);
-/* Fetch the current offset of FILE into *OFFSET_P.
- * Perform temporary allocations in SCRATCH_POOL. */
-svn_error_t *
-svn_fs_x__get_file_offset(apr_off_t *offset_p,
- apr_file_t *file,
- apr_pool_t *scratch_pool);
-
/* Read the file FNAME and store the contents in *BUF.
Allocations are performed in RESULT_POOL. */
svn_error_t *
@@ -454,10 +441,12 @@ svn_fs_x__read_number_from_stream(apr_in
svn_stream_t *stream,
apr_pool_t *scratch_pool);
-/* Move a file into place from OLD_FILENAME in the transactions
- directory to its final location NEW_FILENAME in the repository. On
- Unix, match the permissions of the new file to the permissions of
- PERMS_REFERENCE. Temporary allocations are from SCRATCH_POOL.
+/* Move a file into place from temporary OLD_FILENAME to its final
+ location NEW_FILENAME, which must be on to the same volume. Schedule
+ any necessary fsync calls in BATCH. On Unix, match the permissions
+ of the new file to the permissions of PERMS_REFERENCE.
+
+ Temporary allocations are from SCRATCH_POOL.
This function almost duplicates svn_io_file_move(), but it tries to
guarantee a flush. */
@@ -465,6 +454,7 @@ svn_error_t *
svn_fs_x__move_into_place(const char *old_filename,
const char *new_filename,
const char *perms_reference,
+ svn_fs_x__batch_fsync_t *batch,
apr_pool_t *scratch_pool);
#endif
Modified: subversion/branches/authzperf/subversion/libsvn_fs_x/verify.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_fs_x/verify.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_fs_x/verify.c (original)
+++ subversion/branches/authzperf/subversion/libsvn_fs_x/verify.c Fri Apr 29 18:38:53 2016
@@ -27,6 +27,7 @@
#include "cached_data.h"
#include "rep-cache.h"
+#include "revprops.h"
#include "util.h"
#include "index.h"
@@ -691,6 +692,10 @@ verify_revprops(svn_fs_t *fs,
svn_revnum_t revision;
apr_pool_t *iterpool = svn_pool_create(scratch_pool);
+ /* Invalidate the revprop generation once.
+ * Use the cache inside the loop to speed up packed revprop access. */
+ svn_fs_x__invalidate_revprop_generation(fs);
+
for (revision = start; revision < end; ++revision)
{
svn_string_t *date;
@@ -701,7 +706,7 @@ verify_revprops(svn_fs_t *fs,
/* Access the svn:date revprop.
* This implies parsing all revprops for that revision. */
SVN_ERR(svn_fs_x__revision_prop(&date, fs, revision,
- SVN_PROP_REVISION_DATE,
+ SVN_PROP_REVISION_DATE, FALSE,
iterpool, iterpool));
/* The time stamp is the only revprop that, if given, needs to
@@ -778,8 +783,15 @@ verify_metadata_consistency(svn_fs_t *fs
/* concurrent packing is one of the reasons why verification may fail.
Make sure, we operate on up-to-date information. */
if (err)
- SVN_ERR(svn_fs_x__read_min_unpacked_rev(&ffd->min_unpacked_rev,
- fs, scratch_pool));
+ {
+ svn_error_t *err2
+ = svn_fs_x__read_min_unpacked_rev(&ffd->min_unpacked_rev,
+ fs, scratch_pool);
+
+ /* Be careful to not leak ERR. */
+ if (err2)
+ return svn_error_trace(svn_error_compose_create(err, err2));
+ }
/* retry the whole shard if it got packed in the meantime */
if (err && count != svn_fs_x__pack_size(fs, revision))
@@ -812,14 +824,14 @@ svn_fs_x__verify(svn_fs_t *fs,
void *cancel_baton,
apr_pool_t *scratch_pool)
{
- svn_fs_x__data_t *ffd = fs->fsap_data;
- svn_revnum_t youngest = ffd->youngest_rev_cache; /* cache is current */
-
/* Input validation. */
if (! SVN_IS_VALID_REVNUM(start))
start = 0;
if (! SVN_IS_VALID_REVNUM(end))
- end = youngest;
+ {
+ SVN_ERR(svn_fs_x__youngest_rev(&end, fs, scratch_pool));
+ }
+
SVN_ERR(svn_fs_x__ensure_revision_exists(start, fs, scratch_pool));
SVN_ERR(svn_fs_x__ensure_revision_exists(end, fs, scratch_pool));
Modified: subversion/branches/authzperf/subversion/libsvn_ra/ra_loader.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_ra/ra_loader.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_ra/ra_loader.c (original)
+++ subversion/branches/authzperf/subversion/libsvn_ra/ra_loader.c Fri Apr 29 18:38:53 2016
@@ -80,7 +80,7 @@ static const struct ra_lib_defn {
{
"svn",
svn_schemes,
-#ifdef SVN_LIBSVN_CLIENT_LINKS_RA_SVN
+#ifdef SVN_LIBSVN_RA_LINKS_RA_SVN
svn_ra_svn__init,
svn_ra_svn__deprecated_init
#endif
@@ -89,7 +89,7 @@ static const struct ra_lib_defn {
{
"local",
local_schemes,
-#ifdef SVN_LIBSVN_CLIENT_LINKS_RA_LOCAL
+#ifdef SVN_LIBSVN_RA_LINKS_RA_LOCAL
svn_ra_local__init,
svn_ra_local__deprecated_init
#endif
@@ -98,7 +98,7 @@ static const struct ra_lib_defn {
{
"serf",
dav_schemes,
-#ifdef SVN_LIBSVN_CLIENT_LINKS_RA_SERF
+#ifdef SVN_LIBSVN_RA_LINKS_RA_SERF
svn_ra_serf__init,
svn_ra_serf__deprecated_init
#endif
@@ -410,6 +410,9 @@ svn_error_t *svn_ra_open4(svn_ra_session
return SVN_NO_ERROR;
}
+ if (vtable->set_svn_ra_open)
+ SVN_ERR(vtable->set_svn_ra_open(session, svn_ra_open4));
+
/* Check the UUID. */
if (uuid)
{
@@ -468,6 +471,9 @@ svn_ra__dup_session(svn_ra_session_t **n
result_pool,
scratch_pool));
+ if (session->vtable->set_svn_ra_open)
+ SVN_ERR(session->vtable->set_svn_ra_open(session, svn_ra_open4));
+
*new_session = session;
return SVN_NO_ERROR;
}
@@ -1528,7 +1534,7 @@ svn_ra_get_ra_library(svn_ra_plugin_t **
implementation for svn_ra_foo_init which returns a "not implemented"
error. */
-#ifndef SVN_LIBSVN_CLIENT_LINKS_RA_NEON
+#ifndef SVN_LIBSVN_RA_LINKS_RA_NEON
svn_error_t *
svn_ra_dav_init(int abi_version,
apr_pool_t *pool,
@@ -1536,9 +1542,9 @@ svn_ra_dav_init(int abi_version,
{
return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, NULL, NULL);
}
-#endif /* ! SVN_LIBSVN_CLIENT_LINKS_RA_NEON */
+#endif /* ! SVN_LIBSVN_RA_LINKS_RA_NEON */
-#ifndef SVN_LIBSVN_CLIENT_LINKS_RA_SVN
+#ifndef SVN_LIBSVN_RA_LINKS_RA_SVN
svn_error_t *
svn_ra_svn_init(int abi_version,
apr_pool_t *pool,
@@ -1546,9 +1552,9 @@ svn_ra_svn_init(int abi_version,
{
return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, NULL, NULL);
}
-#endif /* ! SVN_LIBSVN_CLIENT_LINKS_RA_SVN */
+#endif /* ! SVN_LIBSVN_RA_LINKS_RA_SVN */
-#ifndef SVN_LIBSVN_CLIENT_LINKS_RA_LOCAL
+#ifndef SVN_LIBSVN_RA_LINKS_RA_LOCAL
svn_error_t *
svn_ra_local_init(int abi_version,
apr_pool_t *pool,
@@ -1556,9 +1562,9 @@ svn_ra_local_init(int abi_version,
{
return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, NULL, NULL);
}
-#endif /* ! SVN_LIBSVN_CLIENT_LINKS_RA_LOCAL */
+#endif /* ! SVN_LIBSVN_RA_LINKS_RA_LOCAL */
-#ifndef SVN_LIBSVN_CLIENT_LINKS_RA_SERF
+#ifndef SVN_LIBSVN_RA_LINKS_RA_SERF
svn_error_t *
svn_ra_serf_init(int abi_version,
apr_pool_t *pool,
@@ -1566,4 +1572,4 @@ svn_ra_serf_init(int abi_version,
{
return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, NULL, NULL);
}
-#endif /* ! SVN_LIBSVN_CLIENT_LINKS_RA_SERF */
+#endif /* ! SVN_LIBSVN_RA_LINKS_RA_SERF */
Modified: subversion/branches/authzperf/subversion/libsvn_ra/ra_loader.h
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_ra/ra_loader.h?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_ra/ra_loader.h (original)
+++ subversion/branches/authzperf/subversion/libsvn_ra/ra_loader.h Fri Apr 29 18:38:53 2016
@@ -38,6 +38,17 @@
extern "C" {
#endif
+/* Prototype of most recent version of svn_ra_openX() api, optionally
+ handed to the ra api to allow opening other ra sessions. */
+typedef svn_error_t * (*svn_ra__open_func_t)(svn_ra_session_t **session_p,
+ const char **corrected_url,
+ const char *repos_URL,
+ const char *uuid,
+ const svn_ra_callbacks2_t *callbacks,
+ void *callback_baton,
+ apr_hash_t *config,
+ apr_pool_t *pool);
+
/* The RA layer vtable. */
typedef struct svn_ra__vtable_t {
/* This field should always remain first in the vtable. */
@@ -308,10 +319,6 @@ typedef struct svn_ra__vtable_t {
svn_revnum_t end_revision,
svn_revnum_t *revision_deleted,
apr_pool_t *pool);
-
- /* See svn_ra__register_editor_shim_callbacks() */
- svn_error_t *(*register_editor_shim_callbacks)(svn_ra_session_t *session,
- svn_delta_shim_callbacks_t *callbacks);
/* See svn_ra_get_inherited_props(). */
svn_error_t *(*get_inherited_props)(svn_ra_session_t *session,
apr_array_header_t **iprops,
@@ -319,6 +326,17 @@ typedef struct svn_ra__vtable_t {
svn_revnum_t revision,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
+ /* If not NULL, receives a pointer to svn_ra_open, to alllow opening
+ a new ra session from inside the ra layer without a circular
+ library dependency*/
+ svn_error_t *(*set_svn_ra_open)(svn_ra_session_t *session,
+ svn_ra__open_func_t func);
+
+ /* Experimental support below here */
+
+ /* See svn_ra__register_editor_shim_callbacks() */
+ svn_error_t *(*register_editor_shim_callbacks)(svn_ra_session_t *session,
+ svn_delta_shim_callbacks_t *callbacks);
/* See svn_ra__get_commit_ev2() */
svn_error_t *(*get_commit_ev2)(
svn_editor_t **editor,
Modified: subversion/branches/authzperf/subversion/libsvn_ra_local/ra_plugin.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_ra_local/ra_plugin.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_ra_local/ra_plugin.c (original)
+++ subversion/branches/authzperf/subversion/libsvn_ra_local/ra_plugin.c Fri Apr 29 18:38:53 2016
@@ -360,8 +360,13 @@ make_reporter(svn_ra_session_t *session,
edit_baton,
NULL,
NULL,
- 1024 * 1024, /* process-local transfers
- should be fast */
+ 0, /* Disable zero-copy codepath, because
+ RA API users are unaware about the
+ zero-copy code path limitation (do
+ not access FSFS data structures
+ and, hence, caches). See notes
+ to svn_repos_begin_report3() for
+ additional details. */
result_pool));
/* Wrap the report baton given us by the repos layer with our own
@@ -1357,7 +1362,7 @@ svn_ra_local__get_dir(svn_ra_session_t *
if (dirent_fields & SVN_DIRENT_SIZE)
{
/* size */
- if (entry->kind == svn_node_dir)
+ if (fs_entry->kind == svn_node_dir)
entry->size = 0;
else
SVN_ERR(svn_fs_file_length(&(entry->size), root,
@@ -1833,9 +1838,11 @@ static const svn_ra__vtable_t ra_local_v
svn_ra_local__has_capability,
svn_ra_local__replay_range,
svn_ra_local__get_deleted_rev,
- svn_ra_local__register_editor_shim_callbacks,
svn_ra_local__get_inherited_props,
- svn_ra_local__get_commit_ev2
+ NULL /* set_svn_ra_open */,
+ svn_ra_local__register_editor_shim_callbacks,
+ svn_ra_local__get_commit_ev2,
+ NULL /* replay_range_ev2 */
};
@@ -1868,7 +1875,7 @@ svn_ra_local__init(const svn_version_t *
SVN_ERR(svn_ver_check_list2(ra_local_version(), checklist, svn_ver_equal));
-#ifndef SVN_LIBSVN_CLIENT_LINKS_RA_LOCAL
+#ifndef SVN_LIBSVN_RA_LINKS_RA_LOCAL
/* This means the library was loaded as a DSO, so use the DSO pool. */
SVN_ERR(svn_fs_initialize(svn_dso__pool()));
#endif
Modified: subversion/branches/authzperf/subversion/libsvn_ra_serf/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_ra_serf/commit.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_ra_serf/commit.c (original)
+++ subversion/branches/authzperf/subversion/libsvn_ra_serf/commit.c Fri Apr 29 18:38:53 2016
@@ -170,11 +170,11 @@ typedef struct file_context_t {
const char *copy_path;
svn_revnum_t copy_revision;
- /* stream */
+ /* Stream for collecting the svndiff. */
svn_stream_t *stream;
- /* Temporary file containing the svndiff. */
- apr_file_t *svndiff;
+ /* Buffer holding the svndiff (can spill to disk). */
+ svn_ra_serf__request_body_t *svndiff;
/* Our base checksum as reported by the WC. */
const char *base_checksum;
@@ -841,6 +841,7 @@ proppatch_resource(svn_ra_serf__session_
handler->body_delegate = create_proppatch_body;
handler->body_delegate_baton = proppatch;
+ handler->body_type = "text/xml";
handler->response_handler = svn_ra_serf__handle_multistatus_only;
handler->response_baton = handler;
@@ -868,35 +869,6 @@ proppatch_resource(svn_ra_serf__session_
/* Implements svn_ra_serf__request_body_delegate_t */
static svn_error_t *
-create_put_body(serf_bucket_t **body_bkt,
- void *baton,
- serf_bucket_alloc_t *alloc,
- apr_pool_t *pool /* request pool */,
- apr_pool_t *scratch_pool)
-{
- file_context_t *ctx = baton;
- apr_off_t offset;
-
- /* We need to flush the file, make it unbuffered (so that it can be
- * zero-copied via mmap), and reset the position before attempting to
- * deliver the file.
- *
- * N.B. If we have APR 1.3+, we can unbuffer the file to let us use mmap
- * and zero-copy the PUT body. However, on older APR versions, we can't
- * check the buffer status; but serf will fall through and create a file
- * bucket for us on the buffered svndiff handle.
- */
- SVN_ERR(svn_io_file_flush(ctx->svndiff, pool));
- apr_file_buffer_set(ctx->svndiff, NULL, 0);
- offset = 0;
- SVN_ERR(svn_io_file_seek(ctx->svndiff, APR_SET, &offset, pool));
-
- *body_bkt = serf_bucket_file_create(ctx->svndiff, alloc);
- return SVN_NO_ERROR;
-}
-
-/* Implements svn_ra_serf__request_body_delegate_t */
-static svn_error_t *
create_empty_put_body(serf_bucket_t **body_bkt,
void *baton,
serf_bucket_alloc_t *alloc,
@@ -1443,7 +1415,6 @@ delete_entry(const char *path,
delete_context_t *delete_ctx;
svn_ra_serf__handler_t *handler;
const char *delete_target;
- svn_error_t *err;
if (USING_HTTPV2_COMMIT_SUPPORT(dir->commit_ctx))
{
@@ -1477,24 +1448,36 @@ delete_entry(const char *path,
handler->method = "DELETE";
handler->path = delete_target;
+ handler->no_fail_on_http_failure_status = TRUE;
- err = svn_ra_serf__context_run_one(handler, pool);
- if (err && err->apr_err == SVN_ERR_RA_DAV_REQUEST_FAILED
- && handler->sline.code == 400)
- {
- svn_error_clear(err);
+ SVN_ERR(svn_ra_serf__context_run_one(handler, pool));
+ if (handler->sline.code == 400)
+ {
/* Try again with non-standard body to overcome Apache Httpd
header limit */
delete_ctx->non_recursive_if = TRUE;
+
+ handler = svn_ra_serf__create_handler(dir->commit_ctx->session, pool);
+
+ handler->response_handler = svn_ra_serf__expect_empty_body;
+ handler->response_baton = handler;
+
+ handler->header_delegate = setup_delete_headers;
+ handler->header_delegate_baton = delete_ctx;
+
+ handler->method = "DELETE";
+ handler->path = delete_target;
+
handler->body_type = "text/xml";
handler->body_delegate = create_delete_body;
handler->body_delegate_baton = delete_ctx;
SVN_ERR(svn_ra_serf__context_run_one(handler, pool));
}
- else
- SVN_ERR(err);
+
+ if (handler->server_error)
+ return svn_ra_serf__server_error_create(handler, pool);
/* 204 No Content: item successfully deleted */
if (handler->sline.code != 204)
@@ -1876,23 +1859,6 @@ open_file(const char *path,
return SVN_NO_ERROR;
}
-/* Implements svn_stream_lazyopen_func_t for apply_textdelta */
-static svn_error_t *
-delayed_commit_stream_open(svn_stream_t **stream,
- void *baton,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
-{
- file_context_t *file_ctx = baton;
-
- SVN_ERR(svn_io_open_unique_file3(&file_ctx->svndiff, NULL, NULL,
- svn_io_file_del_on_pool_cleanup,
- file_ctx->pool, scratch_pool));
-
- *stream = svn_stream_from_aprfile2(file_ctx->svndiff, TRUE, result_pool);
- return SVN_NO_ERROR;
-}
-
static svn_error_t *
apply_textdelta(void *file_baton,
const char *base_checksum,
@@ -1904,17 +1870,28 @@ apply_textdelta(void *file_baton,
int svndiff_version;
int compression_level;
- /* Store the stream in a temporary file; we'll give it to serf when we
+ /* Construct a holder for the request body; we'll give it to serf when we
* close this file.
*
* TODO: There should be a way we can stream the request body instead of
- * writing to a temporary file (ugh). A special svn stream serf bucket
- * that returns EAGAIN until we receive the done call? But, when
+ * possibly writing to a temporary file (ugh). A special svn stream serf
+ * bucket that returns EAGAIN until we receive the done call? But, when
* would we run through the serf context? Grr.
+ *
+ * BH: If you wait to a specific event... why not use that event to
+ * trigger the operation?
+ * Having a request (body) bucket return EAGAIN until done stalls
+ * the entire HTTP pipeline after writing the first part of the
+ * request. It is not like we can interrupt some part of a request
+ * and continue later. Or somebody else must use tempfiles and
+ * always assume that clients work this bad... as it only knows
+ * for sure after the request is completely available.
*/
- ctx->stream = svn_stream_lazyopen_create(delayed_commit_stream_open,
- ctx, FALSE, ctx->pool);
+ ctx->svndiff =
+ svn_ra_serf__request_body_create(SVN_RA_SERF__REQUEST_BODY_IN_MEM_SIZE,
+ ctx->pool);
+ ctx->stream = svn_ra_serf__request_body_get_stream(ctx->svndiff);
if (ctx->commit_ctx->session->supports_svndiff1 &&
ctx->commit_ctx->session->using_compression)
@@ -1939,7 +1916,9 @@ apply_textdelta(void *file_baton,
compression_level = SVN_DELTA_COMPRESSION_LEVEL_NONE;
}
- svn_txdelta_to_svndiff3(handler, handler_baton, ctx->stream,
+ /* Disown the stream; we'll close it explicitly in close_file(). */
+ svn_txdelta_to_svndiff3(handler, handler_baton,
+ svn_stream_disown(ctx->stream, pool),
svndiff_version, compression_level, pool);
if (base_checksum)
@@ -2006,8 +1985,11 @@ close_file(void *file_baton,
}
else
{
- handler->body_delegate = create_put_body;
- handler->body_delegate_baton = ctx;
+ SVN_ERR(svn_stream_close(ctx->stream));
+
+ svn_ra_serf__request_body_get_delegate(&handler->body_delegate,
+ &handler->body_delegate_baton,
+ ctx->svndiff);
handler->body_type = SVN_SVNDIFF_MIME_TYPE;
}
@@ -2025,8 +2007,9 @@ close_file(void *file_baton,
return svn_error_trace(svn_ra_serf__unexpected_status(handler));
}
+ /* Don't keep open file handles longer than necessary. */
if (ctx->svndiff)
- SVN_ERR(svn_io_file_close(ctx->svndiff, scratch_pool));
+ SVN_ERR(svn_ra_serf__request_body_cleanup(ctx->svndiff, scratch_pool));
/* If we had any prop changes, push them via PROPPATCH. */
if (apr_hash_count(ctx->prop_changes))
Modified: subversion/branches/authzperf/subversion/libsvn_ra_serf/eagain_bucket.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_ra_serf/eagain_bucket.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_ra_serf/eagain_bucket.c (original)
+++ subversion/branches/authzperf/subversion/libsvn_ra_serf/eagain_bucket.c Fri Apr 29 18:38:53 2016
@@ -66,7 +66,7 @@ eagain_bucket_read(serf_bucket_t *bucket
return APR_EAGAIN;
}
-
+#if !SERF_VERSION_AT_LEAST(1, 4, 0)
static apr_status_t
eagain_bucket_readline(serf_bucket_t *bucket,
int acceptable,
@@ -79,6 +79,7 @@ eagain_bucket_readline(serf_bucket_t *bu
"Not implemented."));
return APR_ENOTIMPL;
}
+#endif
static apr_status_t
@@ -98,7 +99,11 @@ eagain_bucket_peek(serf_bucket_t *bucket
static const serf_bucket_type_t delay_bucket_vtable = {
"BUF-EAGAIN",
eagain_bucket_read,
+#if SERF_VERSION_AT_LEAST(1, 4, 0)
+ serf_default_readline,
+#else
eagain_bucket_readline,
+#endif
serf_default_read_iovec,
serf_default_read_for_sendfile,
serf_default_read_bucket,
Modified: subversion/branches/authzperf/subversion/libsvn_ra_serf/inherited_props.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_ra_serf/inherited_props.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_ra_serf/inherited_props.c (original)
+++ subversion/branches/authzperf/subversion/libsvn_ra_serf/inherited_props.c Fri Apr 29 18:38:53 2016
@@ -143,9 +143,7 @@ iprops_closed(svn_ra_serf__xml_estate_t
return svn_error_create(SVN_ERR_XML_MALFORMED, NULL, NULL);
iprops_ctx->curr_iprop->path_or_url =
- svn_path_url_add_component2(iprops_ctx->repos_root_url,
- cdata->data,
- iprops_ctx->pool);
+ apr_pstrdup(iprops_ctx->pool, cdata->data);
}
else if (leaving_state == IPROPS_PROPNAME)
{
Modified: subversion/branches/authzperf/subversion/libsvn_ra_serf/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_ra_serf/lock.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_ra_serf/lock.c (original)
+++ subversion/branches/authzperf/subversion/libsvn_ra_serf/lock.c Fri Apr 29 18:38:53 2016
@@ -267,10 +267,9 @@ run_locks(svn_ra_serf__session_t *sess,
/* ### Authz can also lead to 403. */
err = svn_error_createf(SVN_ERR_FS_LOCK_OWNER_MISMATCH,
NULL,
- _("Unlock of '%s' failed (%d %s)"),
- ctx->path,
- ctx->handler->sline.code,
- ctx->handler->sline.reason);
+ _("Not authorized to perform lock "
+ "operation on '%s'"),
+ ctx->path);
break;
case 405:
err = svn_error_createf(SVN_ERR_FS_OUT_OF_DATE,
@@ -282,13 +281,20 @@ run_locks(svn_ra_serf__session_t *sess,
ctx->handler->sline.reason);
break;
case 423:
- err = svn_error_createf(SVN_ERR_FS_PATH_ALREADY_LOCKED,
- NULL,
- _("Path '%s' already locked "
- "(%d %s)"),
- ctx->path,
- ctx->handler->sline.code,
- ctx->handler->sline.reason);
+ if (server_err
+ && SVN_ERROR_IN_CATEGORY(server_err->apr_err,
+ SVN_ERR_FS_CATEGORY_START))
+ {
+ err = NULL;
+ }
+ else
+ err = svn_error_createf(SVN_ERR_FS_PATH_ALREADY_LOCKED,
+ NULL,
+ _("Path '%s' already locked "
+ "(%d %s)"),
+ ctx->path,
+ ctx->handler->sline.code,
+ ctx->handler->sline.reason);
break;
case 404:
Modified: subversion/branches/authzperf/subversion/libsvn_ra_serf/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_ra_serf/merge.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_ra_serf/merge.c (original)
+++ subversion/branches/authzperf/subversion/libsvn_ra_serf/merge.c Fri Apr 29 18:38:53 2016
@@ -427,6 +427,7 @@ svn_ra_serf__run_merge(const svn_commit_
handler->path = merge_ctx->merge_url;
handler->body_delegate = create_merge_body;
handler->body_delegate_baton = merge_ctx;
+ handler->body_type = "text/xml";
handler->header_delegate = setup_merge_headers;
handler->header_delegate_baton = merge_ctx;
Modified: subversion/branches/authzperf/subversion/libsvn_ra_serf/multistatus.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_ra_serf/multistatus.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_ra_serf/multistatus.c (original)
+++ subversion/branches/authzperf/subversion/libsvn_ra_serf/multistatus.c Fri Apr 29 18:38:53 2016
@@ -707,7 +707,16 @@ svn_ra_serf__handle_server_error(svn_ra_
clear the error and return - allowing serf to wait for more data.
*/
if (!err || SERF_BUCKET_READ_ERROR(err->apr_err))
- return svn_error_trace(err);
+ {
+ /* Perhaps we already parsed some server generated message. Let's pass
+ all information we can get.*/
+ if (err)
+ err = svn_error_compose_create(
+ svn_ra_serf__server_error_create(handler, scratch_pool),
+ err);
+
+ return svn_error_trace(err);
+ }
if (!APR_STATUS_IS_EOF(err->apr_err))
{
Modified: subversion/branches/authzperf/subversion/libsvn_ra_serf/property.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_ra_serf/property.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_ra_serf/property.c (original)
+++ subversion/branches/authzperf/subversion/libsvn_ra_serf/property.c Fri Apr 29 18:38:53 2016
@@ -390,6 +390,26 @@ create_propfind_body(serf_bucket_t **bkt
requested_allprop = TRUE;
}
+ prop++;
+ }
+
+ tmp = SERF_BUCKET_SIMPLE_STRING_LEN(PROPFIND_HEADER,
+ sizeof(PROPFIND_HEADER)-1,
+ alloc);
+ serf_bucket_aggregate_append(body_bkt, tmp);
+
+ /* If we're not doing an allprop, add <prop> tags. */
+ if (!requested_allprop)
+ {
+ tmp = SERF_BUCKET_SIMPLE_STRING_LEN("<prop>",
+ sizeof("<prop>")-1,
+ alloc);
+ serf_bucket_aggregate_append(body_bkt, tmp);
+ }
+
+ prop = ctx->find_props;
+ while (prop && prop->xmlns)
+ {
/* <*propname* xmlns="*propns*" /> */
tmp = SERF_BUCKET_SIMPLE_STRING_LEN("<", 1, alloc);
serf_bucket_aggregate_append(body_bkt, tmp);
@@ -412,21 +432,6 @@ create_propfind_body(serf_bucket_t **bkt
prop++;
}
- /* If we're not doing an allprop, add <prop> tags. */
- if (!requested_allprop)
- {
- tmp = SERF_BUCKET_SIMPLE_STRING_LEN("<prop>",
- sizeof("<prop>")-1,
- alloc);
- serf_bucket_aggregate_prepend(body_bkt, tmp);
- }
-
- tmp = SERF_BUCKET_SIMPLE_STRING_LEN(PROPFIND_HEADER,
- sizeof(PROPFIND_HEADER)-1,
- alloc);
-
- serf_bucket_aggregate_prepend(body_bkt, tmp);
-
if (!requested_allprop)
{
tmp = SERF_BUCKET_SIMPLE_STRING_LEN("</prop>",
Modified: subversion/branches/authzperf/subversion/libsvn_ra_serf/ra_serf.h
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_ra_serf/ra_serf.h?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/branches/authzperf/subversion/libsvn_ra_serf/ra_serf.h Fri Apr 29 18:38:53 2016
@@ -137,6 +137,10 @@ struct svn_ra_serf__session_t {
HTTP/1.0. Thus, we cannot send chunked requests. */
svn_boolean_t http10;
+ /* We are talking to the server via http/2. Responses of scheduled
+ requests may come in any order */
+ svn_boolean_t http20;
+
/* Should we use Transfer-Encoding: chunked for HTTP/1.1 servers. */
svn_boolean_t using_chunked_requests;
@@ -1518,6 +1522,11 @@ svn_ra_serf__error_on_status(serf_status
svn_error_t *
svn_ra_serf__unexpected_status(svn_ra_serf__handler_t *handler);
+/* Make sure handler is no longer scheduled on its connection. Resetting
+ the connection if necessary */
+void
+svn_ra_serf__unschedule_handler(svn_ra_serf__handler_t *handler);
+
/* ###? */
svn_error_t *
@@ -1561,6 +1570,39 @@ svn_ra_serf__uri_parse(apr_uri_t *uri,
apr_pool_t *result_pool);
+/* Default limit for in-memory size of a request body. */
+#define SVN_RA_SERF__REQUEST_BODY_IN_MEM_SIZE 256 * 1024
+
+/* An opaque structure used to prepare a request body. */
+typedef struct svn_ra_serf__request_body_t svn_ra_serf__request_body_t;
+
+/* Constructor for svn_ra_serf__request_body_t. Creates a new writable
+ buffer for the request body. Request bodies under IN_MEMORY_SIZE
+ bytes will be held in memory, otherwise, the body content will be
+ spilled to a temporary file. */
+svn_ra_serf__request_body_t *
+svn_ra_serf__request_body_create(apr_size_t in_memory_size,
+ apr_pool_t *result_pool);
+
+/* Get the writable stream associated with BODY. */
+svn_stream_t *
+svn_ra_serf__request_body_get_stream(svn_ra_serf__request_body_t *body);
+
+/* Get a svn_ra_serf__request_body_delegate_t and baton for BODY. */
+void
+svn_ra_serf__request_body_get_delegate(svn_ra_serf__request_body_delegate_t *del,
+ void **baton,
+ svn_ra_serf__request_body_t *body);
+
+/* Release intermediate resources associated with BODY. These resources
+ (such as open file handles) will be automatically released when the
+ pool used to construct BODY is cleared or destroyed, but this optional
+ function allows doing that explicitly. */
+svn_error_t *
+svn_ra_serf__request_body_cleanup(svn_ra_serf__request_body_t *body,
+ apr_pool_t *scratch_pool);
+
+
#if defined(SVN_DEBUG)
/* Wrapper macros to collect file and line information */
#define svn_ra_serf__wrap_err \
Modified: subversion/branches/authzperf/subversion/libsvn_ra_serf/replay.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_ra_serf/replay.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_ra_serf/replay.c (original)
+++ subversion/branches/authzperf/subversion/libsvn_ra_serf/replay.c Fri Apr 29 18:38:53 2016
@@ -649,6 +649,24 @@ svn_ra_serf__replay_range(svn_ra_session
svn_boolean_t done;
apr_pool_t *subpool = svn_pool_create(scratch_pool);
+ if (session->http20) {
+ /* ### Auch... this doesn't work yet...
+
+ This code relies on responses coming in in an exact order, while
+ http2 does everything to deliver responses as fast as possible.
+
+ With http/1.1 we were quite lucky that this worked, as serf doesn't
+ promise in order delivery.... (Please do not use authz with keys
+ that expire)
+
+ For now fall back to the legacy callback in libsvn_ra that is
+ used by all the other ra layers as workaround.
+
+ ### TODO: Optimize
+ */
+ return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, NULL, NULL);
+ }
+
SVN_ERR(svn_ra_serf__report_resource(&report_target, session,
subpool));
@@ -758,6 +776,7 @@ svn_ra_serf__replay_range(svn_ra_session
handler->path = replay_target;
handler->body_delegate = create_replay_body;
handler->body_delegate_baton = rev_ctx;
+ handler->body_type = "text/xml";
handler->done_delegate = replay_done;
handler->done_delegate_baton = rev_ctx;
Modified: subversion/branches/authzperf/subversion/libsvn_ra_serf/sb_bucket.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_ra_serf/sb_bucket.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_ra_serf/sb_bucket.c (original)
+++ subversion/branches/authzperf/subversion/libsvn_ra_serf/sb_bucket.c Fri Apr 29 18:38:53 2016
@@ -117,7 +117,7 @@ sb_bucket_read(serf_bucket_t *bucket, ap
return *data == NULL ? APR_EOF : APR_SUCCESS;
}
-
+#if !SERF_VERSION_AT_LEAST(1, 4, 0)
static apr_status_t
sb_bucket_readline(serf_bucket_t *bucket, int acceptable,
int *found,
@@ -128,6 +128,7 @@ sb_bucket_readline(serf_bucket_t *bucket
"Not implemented."));
return APR_ENOTIMPL;
}
+#endif
static apr_status_t
@@ -159,7 +160,11 @@ sb_bucket_peek(serf_bucket_t *bucket,
static const serf_bucket_type_t sb_bucket_vtable = {
"SPILLBUF",
sb_bucket_read,
+#if SERF_VERSION_AT_LEAST(1, 4, 0)
+ serf_default_readline,
+#else
sb_bucket_readline,
+#endif
serf_default_read_iovec,
serf_default_read_for_sendfile,
serf_default_read_bucket,
Modified: subversion/branches/authzperf/subversion/libsvn_ra_serf/serf.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_ra_serf/serf.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_ra_serf/serf.c (original)
+++ subversion/branches/authzperf/subversion/libsvn_ra_serf/serf.c Fri Apr 29 18:38:53 2016
@@ -530,6 +530,7 @@ svn_ra_serf__open(svn_ra_session_t *sess
/* We have to assume that the server only supports HTTP/1.0. Once it's clear
HTTP/1.1 is supported, we can upgrade. */
serf_sess->http10 = TRUE;
+ serf_sess->http20 = FALSE;
/* If we switch to HTTP/1.1, then we will use chunked requests. We may disable
this, if we find an intervening proxy does not support chunked requests. */
@@ -636,6 +637,7 @@ ra_serf_dup_session(svn_ra_session_t *ne
/* using_ssl */
/* using_compression */
/* http10 */
+ /* http20 */
/* using_chunked_requests */
/* detect_chunking */
@@ -1048,8 +1050,11 @@ static const svn_ra__vtable_t serf_vtabl
svn_ra_serf__has_capability,
svn_ra_serf__replay_range,
svn_ra_serf__get_deleted_rev,
+ svn_ra_serf__get_inherited_props,
+ NULL /* set_svn_ra_open */,
svn_ra_serf__register_editor_shim_callbacks,
- svn_ra_serf__get_inherited_props
+ NULL /* commit_ev2 */,
+ NULL /* replay_range_ev2 */
};
svn_error_t *
Modified: subversion/branches/authzperf/subversion/libsvn_ra_serf/update.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_ra_serf/update.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/branches/authzperf/subversion/libsvn_ra_serf/update.c Fri Apr 29 18:38:53 2016
@@ -433,13 +433,11 @@ struct report_context_t {
const svn_delta_editor_t *editor;
void *editor_baton;
- /* The file holding request body for the REPORT.
- *
- * ### todo: It will be better for performance to store small
- * request bodies (like 4k) in memory and bigger bodies on disk.
- */
+ /* Stream for collecting the request body. */
svn_stream_t *body_template;
- body_create_baton_t *body;
+
+ /* Buffer holding request body for the REPORT (can spill to disk). */
+ svn_ra_serf__request_body_t *body;
/* number of pending GET requests */
unsigned int num_active_fetches;
@@ -457,148 +455,6 @@ struct report_context_t {
svn_boolean_t closed_root;
};
-/* Baton for collecting REPORT body. Depending on the size this
- work is backed by a memory buffer (via serf buckets) or by
- a file */
-struct body_create_baton_t
-{
- apr_pool_t *result_pool;
- apr_size_t total_bytes;
-
- apr_pool_t *scratch_pool;
-
- serf_bucket_alloc_t *alloc;
- serf_bucket_t *collect_bucket;
-
- const void *all_data;
- apr_file_t *file;
-};
-
-
-#define MAX_BODY_IN_RAM (256*1024)
-
-/* Fold all previously collected data in a single buffer allocated in
- RESULT_POOL and clear all intermediate state */
-static const char *
-body_allocate_all(body_create_baton_t *body,
- apr_pool_t *result_pool)
-{
- char *buffer = apr_pcalloc(result_pool, body->total_bytes);
- const char *data;
- apr_size_t sz;
- apr_status_t s;
- apr_size_t remaining = body->total_bytes;
- char *next = buffer;
-
- while (!(s = serf_bucket_read(body->collect_bucket, remaining, &data, &sz)))
- {
- memcpy(next, data, sz);
- remaining -= sz;
- next += sz;
-
- if (! remaining)
- break;
- }
-
- if (!SERF_BUCKET_READ_ERROR(s))
- {
- memcpy(next, data, sz);
- }
-
- serf_bucket_destroy(body->collect_bucket);
- body->collect_bucket = NULL;
-
- return (s != APR_EOF) ? NULL : buffer;
-}
-
-/* Noop function. Make serf take care of freeing in error situations */
-static void serf_free_no_error(void *unfreed_baton, void *block) {}
-
-/* Stream write function for body creation */
-static svn_error_t *
-body_write_fn(void *baton,
- const char *data,
- apr_size_t *len)
-{
- body_create_baton_t *bcb = baton;
-
- if (!bcb->scratch_pool)
- bcb->scratch_pool = svn_pool_create(bcb->result_pool);
-
- if (bcb->file)
- {
- SVN_ERR(svn_io_file_write_full(bcb->file, data, *len, NULL,
- bcb->scratch_pool));
- svn_pool_clear(bcb->scratch_pool);
-
- bcb->total_bytes += *len;
- }
- else if (*len + bcb->total_bytes > MAX_BODY_IN_RAM)
- {
- SVN_ERR(svn_io_open_unique_file3(&bcb->file, NULL, NULL,
- svn_io_file_del_on_pool_cleanup,
- bcb->result_pool, bcb->scratch_pool));
-
- if (bcb->total_bytes)
- {
- const char *all = body_allocate_all(bcb, bcb->scratch_pool);
-
- SVN_ERR(svn_io_file_write_full(bcb->file, all, bcb->total_bytes,
- NULL, bcb->scratch_pool));
- }
-
- SVN_ERR(svn_io_file_write_full(bcb->file, data, *len, NULL,
- bcb->scratch_pool));
- bcb->total_bytes += *len;
- }
- else
- {
- if (!bcb->alloc)
- bcb->alloc = serf_bucket_allocator_create(bcb->scratch_pool,
- serf_free_no_error, NULL);
-
- if (!bcb->collect_bucket)
- bcb->collect_bucket = serf_bucket_aggregate_create(bcb->alloc);
-
- serf_bucket_aggregate_append(bcb->collect_bucket,
- serf_bucket_simple_copy_create(data, *len,
- bcb->alloc));
-
- bcb->total_bytes += *len;
- }
-
- return SVN_NO_ERROR;
-}
-
-/* Stream close function for collecting body */
-static svn_error_t *
-body_done_fn(void *baton)
-{
- body_create_baton_t *bcb = baton;
- if (bcb->file)
- {
- /* We need to flush the file, make it unbuffered (so that it can be
- * zero-copied via mmap), and reset the position before attempting
- * to deliver the file.
- *
- * N.B. If we have APR 1.3+, we can unbuffer the file to let us use
- * mmap and zero-copy the PUT body. However, on older APR versions,
- * we can't check the buffer status; but serf will fall through and
- * create a file bucket for us on the buffered handle.
- */
-
- SVN_ERR(svn_io_file_flush(bcb->file, bcb->scratch_pool));
- apr_file_buffer_set(bcb->file, NULL, 0);
- }
- else if (bcb->collect_bucket)
- bcb->all_data = body_allocate_all(bcb, bcb->result_pool);
-
- if (bcb->scratch_pool)
- svn_pool_destroy(bcb->scratch_pool);
-
- return SVN_NO_ERROR;
-}
-
static svn_error_t *
create_dir_baton(dir_baton_t **new_dir,
report_context_t *ctx,
@@ -941,8 +797,17 @@ headers_fetch(serf_bucket_t *headers,
{
serf_bucket_headers_setn(headers, SVN_DAV_DELTA_BASE_HEADER,
fetch_ctx->delta_base);
- serf_bucket_headers_setn(headers, "Accept-Encoding",
- "svndiff1;q=0.9,svndiff;q=0.8");
+ if (fetch_ctx->using_compression)
+ {
+ serf_bucket_headers_setn(headers, "Accept-Encoding",
+ "svndiff1;q=0.9,svndiff;q=0.8");
+ }
+ else
+ {
+ /* Do not advertise svndiff1 support if we're not interested in
+ compression. */
+ serf_bucket_headers_setn(headers, "Accept-Encoding", "svndiff");
+ }
}
else if (fetch_ctx->using_compression)
{
@@ -2304,37 +2169,6 @@ link_path(void *report_baton,
return APR_SUCCESS;
}
-/* Serf callback to create update request body bucket.
- Implements svn_ra_serf__request_body_delegate_t */
-static svn_error_t *
-create_update_report_body(serf_bucket_t **body_bkt,
- void *baton,
- serf_bucket_alloc_t *alloc,
- apr_pool_t *pool /* request pool */,
- apr_pool_t *scratch_pool)
-{
- report_context_t *report = baton;
- body_create_baton_t *body = report->body;
-
- if (body->file)
- {
- apr_off_t offset;
-
- offset = 0;
- SVN_ERR(svn_io_file_seek(body->file, APR_SET, &offset, pool));
-
- *body_bkt = serf_bucket_file_create(report->body->file, alloc);
- }
- else
- {
- *body_bkt = serf_bucket_simple_create(body->all_data,
- body->total_bytes,
- NULL, NULL, alloc);
- }
-
- return SVN_NO_ERROR;
-}
-
/* Serf callback to setup update request headers. */
static svn_error_t *
setup_update_report_headers(serf_bucket_t *headers,
@@ -2351,8 +2185,9 @@ setup_update_report_headers(serf_bucket_
}
else
{
- serf_bucket_headers_setn(headers, "Accept-Encoding",
- "svndiff1;q=0.9,svndiff;q=0.8");
+ /* Do not advertise svndiff1 support if we're not interested in
+ compression. */
+ serf_bucket_headers_setn(headers, "Accept-Encoding", "svndiff");
}
return SVN_NO_ERROR;
@@ -2674,10 +2509,11 @@ finish_report(void *report_baton,
handler = svn_ra_serf__create_expat_handler(sess, xmlctx, NULL,
scratch_pool);
+ svn_ra_serf__request_body_get_delegate(&handler->body_delegate,
+ &handler->body_delegate_baton,
+ report->body);
handler->method = "REPORT";
handler->path = report_target;
- handler->body_delegate = create_update_report_body;
- handler->body_delegate_baton = report;
handler->body_type = "text/xml";
handler->custom_accept_encoding = TRUE;
handler->header_delegate = setup_update_report_headers;
@@ -2792,11 +2628,10 @@ make_update_reporter(svn_ra_session_t *r
*reporter = &ra_serf_reporter;
*report_baton = report;
- report->body = apr_pcalloc(report->pool, sizeof(*report->body));
- report->body->result_pool = report->pool;
- report->body_template = svn_stream_create(report->body, report->pool);
- svn_stream_set_write(report->body_template, body_write_fn);
- svn_stream_set_close(report->body_template, body_done_fn);
+ report->body =
+ svn_ra_serf__request_body_create(SVN_RA_SERF__REQUEST_BODY_IN_MEM_SIZE,
+ report->pool);
+ report->body_template = svn_ra_serf__request_body_get_stream(report->body);
if (sess->bulk_updates == svn_tristate_true)
{
Modified: subversion/branches/authzperf/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_ra_serf/util.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/branches/authzperf/subversion/libsvn_ra_serf/util.c Fri Apr 29 18:38:53 2016
@@ -480,6 +480,38 @@ load_authorities(svn_ra_serf__connection
return SVN_NO_ERROR;
}
+#if SERF_VERSION_AT_LEAST(1, 4, 0) && defined(SVN__SERF_TEST_HTTP2)
+/* Implements serf_ssl_protocol_result_cb_t */
+static apr_status_t
+conn_negotiate_protocol(void *data,
+ const char *protocol)
+{
+ svn_ra_serf__connection_t *conn = data;
+
+ if (!strcmp(protocol, "h2"))
+ {
+ serf_connection_set_framing_type(
+ conn->conn,
+ SERF_CONNECTION_FRAMING_TYPE_HTTP2);
+
+ /* Disable generating content-length headers. */
+ conn->session->http10 = FALSE;
+ conn->session->http20 = TRUE;
+ conn->session->using_chunked_requests = TRUE;
+ conn->session->detect_chunking = FALSE;
+ }
+ else
+ {
+ /* protocol should be "" or "http/1.1" */
+ serf_connection_set_framing_type(
+ conn->conn,
+ SERF_CONNECTION_FRAMING_TYPE_HTTP1);
+ }
+
+ return APR_SUCCESS;
+}
+#endif
+
static svn_error_t *
conn_setup(apr_socket_t *sock,
serf_bucket_t **read_bkt,
@@ -525,6 +557,16 @@ conn_setup(apr_socket_t *sock,
SVN_ERR(load_authorities(conn, conn->session->ssl_authorities,
conn->session->pool));
}
+#if SERF_VERSION_AT_LEAST(1, 4, 0) && defined(SVN__SERF_TEST_HTTP2)
+ if (APR_SUCCESS ==
+ serf_ssl_negotiate_protocol(conn->ssl_context, "h2,http/1.1",
+ conn_negotiate_protocol, conn))
+ {
+ serf_connection_set_framing_type(
+ conn->conn,
+ SERF_CONNECTION_FRAMING_TYPE_NONE);
+ }
+#endif
}
if (write_bkt)
@@ -959,7 +1001,7 @@ svn_ra_serf__context_run_wait(svn_boolea
will cancel all outstanding requests and prepare the connection
for re-use.
*/
-static void
+void
svn_ra_serf__unschedule_handler(svn_ra_serf__handler_t *handler)
{
serf_connection_reset(handler->conn->conn);
@@ -1295,6 +1337,10 @@ handle_response(serf_request_t *request,
/* HTTP/1.1? (or later) */
if (sl.version != SERF_HTTP_10)
handler->session->http10 = FALSE;
+
+ if (sl.version >= SERF_HTTP_VERSION(2, 0)) {
+ handler->session->http20 = TRUE;
+ }
}
/* Keep reading from the network until we've read all the headers. */
Modified: subversion/branches/authzperf/subversion/libsvn_ra_svn/client.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_ra_svn/client.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_ra_svn/client.c (original)
+++ subversion/branches/authzperf/subversion/libsvn_ra_svn/client.c Fri Apr 29 18:38:53 2016
@@ -50,6 +50,7 @@
#include "svn_private_config.h"
#include "private/svn_fspath.h"
+#include "private/svn_string_private.h"
#include "private/svn_subr_private.h"
#include "../libsvn_ra/ra_loader.h"
@@ -204,7 +205,7 @@ static svn_error_t *parse_prop_diffs(con
return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
_("Prop diffs element not a list"));
prop = apr_array_push(*diffs);
- SVN_ERR(svn_ra_svn__parse_tuple(&elt->u.list, pool, "c(?s)",
+ SVN_ERR(svn_ra_svn__parse_tuple(&elt->u.list, "c(?s)",
&prop->name, &prop->value));
}
return SVN_NO_ERROR;
@@ -218,7 +219,7 @@ static svn_error_t *parse_lock(const svn
{
const char *cdate, *edate;
*lock = svn_lock_create(pool);
- SVN_ERR(svn_ra_svn__parse_tuple(list, pool, "ccc(?c)c(?c)", &(*lock)->path,
+ SVN_ERR(svn_ra_svn__parse_tuple(list, "ccc(?c)c(?c)", &(*lock)->path,
&(*lock)->token, &(*lock)->owner,
&(*lock)->comment, &cdate, &edate));
(*lock)->path = svn_fspath__canonicalize((*lock)->path, pool);
@@ -470,9 +471,9 @@ static void handle_child_process_error(a
in_stream = svn_stream_from_aprfile2(in_file, FALSE, pool);
out_stream = svn_stream_from_aprfile2(out_file, FALSE, pool);
- conn = svn_ra_svn_create_conn4(NULL, in_stream, out_stream,
+ conn = svn_ra_svn_create_conn5(NULL, in_stream, out_stream,
SVN_DELTA_COMPRESSION_LEVEL_DEFAULT, 0,
- 0, pool);
+ 0, 0, 0, pool);
err = svn_error_wrap_apr(status, _("Error in child process: %s"), desc);
svn_error_clear(svn_ra_svn__write_cmd_failure(conn, pool, err));
svn_error_clear(err);
@@ -541,13 +542,13 @@ static svn_error_t *make_tunnel(const ch
apr_file_inherit_unset(proc->out);
/* Guard against dotfile output to stdout on the server. */
- *conn = svn_ra_svn_create_conn4(NULL,
+ *conn = svn_ra_svn_create_conn5(NULL,
svn_stream_from_aprfile2(proc->out, FALSE,
pool),
svn_stream_from_aprfile2(proc->in, FALSE,
pool),
SVN_DELTA_COMPRESSION_LEVEL_DEFAULT,
- 0, 0, pool);
+ 0, 0, 0, 0, pool);
err = svn_ra_svn__skip_leading_garbage(*conn, pool);
if (err)
return svn_error_quick_wrap(
@@ -673,9 +674,9 @@ static svn_error_t *open_session(svn_ra_
apr_pool_cleanup_register(pool, td, close_tunnel_cleanup,
apr_pool_cleanup_null);
- conn = svn_ra_svn_create_conn4(NULL, td->response, td->request,
+ conn = svn_ra_svn_create_conn5(NULL, td->response, td->request,
SVN_DELTA_COMPRESSION_LEVEL_DEFAULT,
- 0, 0, pool);
+ 0, 0, 0, 0, pool);
SVN_ERR(svn_ra_svn__skip_leading_garbage(conn, pool));
}
}
@@ -687,9 +688,9 @@ static svn_error_t *open_session(svn_ra_
SVN_ERR(make_connection(uri->hostname,
uri->port ? uri->port : SVN_RA_SVN_PORT,
&sock, pool));
- conn = svn_ra_svn_create_conn4(sock, NULL, NULL,
+ conn = svn_ra_svn_create_conn5(sock, NULL, NULL,
SVN_DELTA_COMPRESSION_LEVEL_DEFAULT,
- 0, 0, pool);
+ 0, 0, 0, 0, pool);
}
/* Build the useragent string, querying the client for any
@@ -1192,7 +1193,6 @@ parse_iproplist(apr_array_header_t **inh
{
int i;
- const char *repos_root_url;
apr_pool_t *iterpool;
if (iproplist == NULL)
@@ -1205,8 +1205,6 @@ parse_iproplist(apr_array_header_t **inh
return SVN_NO_ERROR;
}
- SVN_ERR(ra_svn_get_repos_root(session, &repos_root_url, scratch_pool));
-
*inherited_props = apr_array_make(
result_pool, iproplist->nelts, sizeof(svn_prop_inherited_item_t *));
@@ -1228,12 +1226,10 @@ parse_iproplist(apr_array_header_t **inh
svn_pool_clear(iterpool);
- SVN_ERR(svn_ra_svn__parse_tuple(&elt->u.list, iterpool, "cl",
+ SVN_ERR(svn_ra_svn__parse_tuple(&elt->u.list, "cl",
&parent_rel_path, &iprop_list));
SVN_ERR(svn_ra_svn__parse_proplist(iprop_list, iterpool, &iprops));
- new_iprop->path_or_url = svn_path_url_add_component2(repos_root_url,
- parent_rel_path,
- result_pool);
+ new_iprop->path_or_url = apr_pstrdup(result_pool, parent_rel_path);
new_iprop->prop_hash = svn_hash__make(result_pool);
for (hi = apr_hash_first(iterpool, iprops);
hi;
@@ -1389,7 +1385,7 @@ static svn_error_t *ra_svn_get_dir(svn_r
if (elt->kind != SVN_RA_SVN_LIST)
return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
_("Dirlist element not a list"));
- SVN_ERR(svn_ra_svn__parse_tuple(&elt->u.list, pool, "cwnbr(?c)(?c)",
+ SVN_ERR(svn_ra_svn__parse_tuple(&elt->u.list, "cwnbr(?c)(?c)",
&name, &kind, &size, &has_props,
&crev, &cdate, &cauthor));
@@ -1481,7 +1477,7 @@ static svn_error_t *ra_svn_get_mergeinfo
if (elt->kind != SVN_RA_SVN_LIST)
return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
_("Mergeinfo element is not a list"));
- SVN_ERR(svn_ra_svn__parse_tuple(&elt->u.list, pool, "cc",
+ SVN_ERR(svn_ra_svn__parse_tuple(&elt->u.list, "cc",
&path, &to_parse));
SVN_ERR(svn_mergeinfo_parse(&for_path, to_parse, pool));
/* Correct for naughty servers that send "relative" paths
@@ -1604,6 +1600,16 @@ static svn_error_t *ra_svn_diff(svn_ra_s
return SVN_NO_ERROR;
}
+/* Return TRUE if ITEM matches the word "done". */
+static svn_boolean_t
+is_done_response(const svn_ra_svn__item_t *item)
+{
+ static const svn_string_t str_done = SVN__STATIC_STRING("done");
+
+ return ( item->kind == SVN_RA_SVN_WORD
+ && svn_string_compare(&item->u.word, &str_done));
+}
+
static svn_error_t *
perform_ra_svn_log(svn_error_t **outer_error,
@@ -1695,12 +1701,12 @@ perform_ra_svn_log(svn_error_t **outer_e
svn_pool_clear(iterpool);
SVN_ERR(svn_ra_svn__read_item(conn, iterpool, &item));
- if (item->kind == SVN_RA_SVN_WORD && strcmp(item->u.word, "done") == 0)
+ if (is_done_response(item))
break;
if (item->kind != SVN_RA_SVN_LIST)
return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
_("Log entry not a list"));
- SVN_ERR(svn_ra_svn__parse_tuple(&item->u.list, iterpool,
+ SVN_ERR(svn_ra_svn__parse_tuple(&item->u.list,
"lr(?s)(?s)(?s)?BBnl?B",
&cplist, &rev, &author, &date,
&message, &has_children_param,
@@ -1915,7 +1921,7 @@ static svn_error_t *ra_svn_stat(svn_ra_s
svn_revnum_t crev;
apr_uint64_t size;
- SVN_ERR(svn_ra_svn__parse_tuple(list, pool, "wnbr(?c)(?c)",
+ SVN_ERR(svn_ra_svn__parse_tuple(list, "wnbr(?c)(?c)",
&kind, &size, &has_props,
&crev, &cdate, &cauthor));
@@ -1945,6 +1951,7 @@ static svn_error_t *ra_svn_get_locations
svn_ra_svn_conn_t *conn = sess_baton->conn;
svn_revnum_t revision;
svn_boolean_t is_done;
+ apr_pool_t *iterpool;
int i;
/* Transmit the parameters. */
@@ -1965,21 +1972,25 @@ static svn_error_t *ra_svn_get_locations
/* Read the hash items. */
is_done = FALSE;
*locations = apr_hash_make(pool);
+ iterpool = svn_pool_create(pool);
while (!is_done)
{
svn_ra_svn__item_t *item;
const char *ret_path;
- SVN_ERR(svn_ra_svn__read_item(conn, pool, &item));
- if (item->kind == SVN_RA_SVN_WORD && strcmp(item->u.word, "done") == 0)
+ svn_pool_clear(iterpool);
+ SVN_ERR(svn_ra_svn__read_item(conn, iterpool, &item));
+ if (is_done_response(item))
is_done = 1;
else if (item->kind != SVN_RA_SVN_LIST)
return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
_("Location entry not a list"));
else
{
- SVN_ERR(svn_ra_svn__parse_tuple(&item->u.list, pool, "rc",
+ SVN_ERR(svn_ra_svn__parse_tuple(&item->u.list, "rc",
&revision, &ret_path));
+
+ /* This also makes RET_PATH live in POOL rather than ITERPOOL. */
ret_path = svn_fspath__canonicalize(ret_path, pool);
apr_hash_set(*locations, apr_pmemdup(pool, &revision,
sizeof(revision)),
@@ -1987,6 +1998,8 @@ static svn_error_t *ra_svn_get_locations
}
}
+ svn_pool_destroy(iterpool);
+
/* Read the response. This is so the server would have a chance to
* report an error. */
return svn_error_trace(svn_ra_svn__read_cmd_response(conn, pool, ""));
@@ -2028,7 +2041,7 @@ perform_get_location_segments(svn_error_
svn_pool_clear(iterpool);
SVN_ERR(svn_ra_svn__read_item(conn, iterpool, &item));
- if (item->kind == SVN_RA_SVN_WORD && strcmp(item->u.word, "done") == 0)
+ if (is_done_response(item))
is_done = 1;
else if (item->kind != SVN_RA_SVN_LIST)
return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
@@ -2037,7 +2050,7 @@ perform_get_location_segments(svn_error_
{
svn_location_segment_t *segment = apr_pcalloc(iterpool,
sizeof(*segment));
- SVN_ERR(svn_ra_svn__parse_tuple(&item->u.list, iterpool, "rr(?c)",
+ SVN_ERR(svn_ra_svn__parse_tuple(&item->u.list, "rr(?c)",
&range_start, &range_end, &ret_path));
if (! (SVN_IS_VALID_REVNUM(range_start)
&& SVN_IS_VALID_REVNUM(range_end)))
@@ -2131,7 +2144,7 @@ static svn_error_t *ra_svn_get_file_revs
svn_pool_clear(rev_pool);
svn_pool_clear(chunk_pool);
SVN_ERR(svn_ra_svn__read_item(sess_baton->conn, rev_pool, &item));
- if (item->kind == SVN_RA_SVN_WORD && strcmp(item->u.word, "done") == 0)
+ if (is_done_response(item))
break;
/* Either we've got a correct revision or we will error out below. */
had_revision = TRUE;
@@ -2139,7 +2152,7 @@ static svn_error_t *ra_svn_get_file_revs
return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
_("Revision entry not a list"));
- SVN_ERR(svn_ra_svn__parse_tuple(&item->u.list, rev_pool,
+ SVN_ERR(svn_ra_svn__parse_tuple(&item->u.list,
"crll?B", &p, &rev, &rev_proplist,
&proplist, &merged_rev_param));
p = svn_fspath__canonicalize(p, rev_pool);
@@ -2400,18 +2413,17 @@ static svn_error_t *ra_svn_lock(svn_ra_s
the middle of the request list. If this happens, it will
transmit "done" to end the lock-info early, and then the
overall command response will talk about the fatal error. */
- if (elt->kind == SVN_RA_SVN_WORD && strcmp(elt->u.word, "done") == 0)
+ if (is_done_response(elt))
break;
if (elt->kind != SVN_RA_SVN_LIST)
return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
_("Lock response not a list"));
- SVN_ERR(svn_ra_svn__parse_tuple(&elt->u.list, iterpool, "wl", &status,
- &list));
+ SVN_ERR(svn_ra_svn__parse_tuple(&elt->u.list, "wl", &status, &list));
if (strcmp(status, "failure") == 0)
- err = svn_ra_svn__handle_failure_status(list, iterpool);
+ err = svn_ra_svn__handle_failure_status(list);
else if (strcmp(status, "success") == 0)
{
SVN_ERR(parse_lock(list, iterpool, &lock));
@@ -2441,7 +2453,7 @@ static svn_error_t *ra_svn_lock(svn_ra_s
svn_ra_svn__item_t *elt;
SVN_ERR(svn_ra_svn__read_item(conn, pool, &elt));
- if (elt->kind != SVN_RA_SVN_WORD || strcmp(elt->u.word, "done") != 0)
+ if (!is_done_response(elt))
return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
_("Didn't receive end marker for lock "
"responses"));
@@ -2525,7 +2537,7 @@ static svn_error_t *ra_svn_unlock(svn_ra
the middle of the request list. If this happens, it will
transmit "done" to end the lock-info early, and then the
overall command response will talk about the fatal error. */
- if (elt->kind == SVN_RA_SVN_WORD && (strcmp(elt->u.word, "done") == 0))
+ if (is_done_response(elt))
break;
apr_hash_this(hi, &key, NULL, NULL);
@@ -2535,14 +2547,13 @@ static svn_error_t *ra_svn_unlock(svn_ra
return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
_("Unlock response not a list"));
- SVN_ERR(svn_ra_svn__parse_tuple(&elt->u.list, iterpool, "wl", &status,
- &list));
+ SVN_ERR(svn_ra_svn__parse_tuple(&elt->u.list, "wl", &status, &list));
if (strcmp(status, "failure") == 0)
- err = svn_ra_svn__handle_failure_status(list, iterpool);
+ err = svn_ra_svn__handle_failure_status(list);
else if (strcmp(status, "success") == 0)
{
- SVN_ERR(svn_ra_svn__parse_tuple(list, iterpool, "c", &path));
+ SVN_ERR(svn_ra_svn__parse_tuple(list, "c", &path));
err = SVN_NO_ERROR;
}
else
@@ -2568,7 +2579,7 @@ static svn_error_t *ra_svn_unlock(svn_ra
svn_ra_svn__item_t *elt;
SVN_ERR(svn_ra_svn__read_item(conn, pool, &elt));
- if (elt->kind != SVN_RA_SVN_WORD || strcmp(elt->u.word, "done") != 0)
+ if (! is_done_response(elt))
return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
_("Didn't receive end marker for unlock "
"responses"));
@@ -2754,7 +2765,7 @@ ra_svn_replay_range(svn_ra_session_t *se
if (strcmp(word, "revprops") != 0)
{
if (strcmp(word, "failure") == 0)
- SVN_ERR(svn_ra_svn__handle_failure_status(list, iterpool));
+ SVN_ERR(svn_ra_svn__handle_failure_status(list));
return svn_error_createf(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
_("Expected 'revprops', found '%s'"),
@@ -2935,8 +2946,11 @@ static const svn_ra__vtable_t ra_svn_vta
ra_svn_has_capability,
ra_svn_replay_range,
ra_svn_get_deleted_rev,
+ ra_svn_get_inherited_props,
+ NULL /* ra_set_svn_ra_open */,
ra_svn_register_editor_shim_callbacks,
- ra_svn_get_inherited_props
+ NULL /* commit_ev2 */,
+ NULL /* replay_range_ev2 */
};
svn_error_t *
Modified: subversion/branches/authzperf/subversion/libsvn_ra_svn/cyrus_auth.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_ra_svn/cyrus_auth.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_ra_svn/cyrus_auth.c (original)
+++ subversion/branches/authzperf/subversion/libsvn_ra_svn/cyrus_auth.c Fri Apr 29 18:38:53 2016
@@ -68,7 +68,7 @@ static apr_status_t sasl_done_cb(void *d
apr_initialize()/apr_terminate() more than once. */
svn_ra_svn__sasl_status = 0;
if (svn_atomic_dec(&sasl_ctx_count) == 0)
- sasl_done();
+ svn_sasl__done();
return APR_SUCCESS;
}
@@ -174,10 +174,10 @@ svn_ra_svn__sasl_common_init(apr_pool_t
apr_pool_cleanup_register(sasl_pool, NULL, sasl_done_cb,
apr_pool_cleanup_null);
#if APR_HAS_THREADS
- sasl_set_mutex(sasl_mutex_alloc_cb,
- sasl_mutex_lock_cb,
- sasl_mutex_unlock_cb,
- sasl_mutex_free_cb);
+ svn_sasl__set_mutex(sasl_mutex_alloc_cb,
+ sasl_mutex_lock_cb,
+ sasl_mutex_unlock_cb,
+ sasl_mutex_free_cb);
free_mutexes = apr_array_make(sasl_pool, 0, sizeof(svn_mutex__t *));
SVN_ERR(svn_mutex__init(&array_mutex, TRUE, sasl_pool));
@@ -223,7 +223,7 @@ get_sasl_error(sasl_conn_t *sasl_ctx, in
return apr_psprintf(result_pool,
_("SASL authentication error: %s%s"),
- sasl_errdetail(sasl_ctx), sasl_errno_msg);
+ svn_sasl__errdetail(sasl_ctx), sasl_errno_msg);
}
static svn_error_t *sasl_init_cb(void *baton, apr_pool_t *pool)
@@ -232,7 +232,7 @@ static svn_error_t *sasl_init_cb(void *b
SVN_ERR(svn_ra_svn__sasl_common_init(pool));
clear_sasl_errno();
- result = sasl_client_init(NULL);
+ result = svn_sasl__client_init(NULL);
if (result != SASL_OK)
{
const char *sasl_errno_msg = get_sasl_errno_msg(result, pool);
@@ -240,7 +240,7 @@ static svn_error_t *sasl_init_cb(void *b
return svn_error_createf
(SVN_ERR_RA_NOT_AUTHORIZED, NULL,
_("Could not initialized the SASL library: %s%s"),
- sasl_errstring(result, NULL, NULL),
+ svn_sasl__errstring(result, NULL, NULL),
sasl_errno_msg);
}
@@ -257,9 +257,9 @@ svn_error_t *svn_ra_svn__sasl_init(void)
static apr_status_t sasl_dispose_cb(void *data)
{
sasl_conn_t *sasl_ctx = data;
- sasl_dispose(&sasl_ctx);
+ svn_sasl__dispose(&sasl_ctx);
if (svn_atomic_dec(&sasl_ctx_count) == 0)
- sasl_done();
+ svn_sasl__done();
return APR_SUCCESS;
}
@@ -403,17 +403,17 @@ static svn_error_t *new_sasl_ctx(sasl_co
int result;
clear_sasl_errno();
- result = sasl_client_new(SVN_RA_SVN_SASL_NAME,
- hostname, local_addrport, remote_addrport,
- callbacks, SASL_SUCCESS_DATA,
- sasl_ctx);
+ result = svn_sasl__client_new(SVN_RA_SVN_SASL_NAME,
+ hostname, local_addrport, remote_addrport,
+ callbacks, SASL_SUCCESS_DATA,
+ sasl_ctx);
if (result != SASL_OK)
{
const char *sasl_errno_msg = get_sasl_errno_msg(result, pool);
return svn_error_createf(SVN_ERR_RA_NOT_AUTHORIZED, NULL,
_("Could not create SASL context: %s%s"),
- sasl_errstring(result, NULL, NULL),
+ svn_sasl__errstring(result, NULL, NULL),
sasl_errno_msg);
}
svn_atomic_inc(&sasl_ctx_count);
@@ -427,8 +427,8 @@ static svn_error_t *new_sasl_ctx(sasl_co
should be the username, but since SASL doesn't seem
to use it on the client side, any non-empty string will do. */
clear_sasl_errno();
- result = sasl_setprop(*sasl_ctx,
- SASL_AUTH_EXTERNAL, " ");
+ result = svn_sasl__setprop(*sasl_ctx,
+ SASL_AUTH_EXTERNAL, " ");
if (result != SASL_OK)
return svn_error_create(SVN_ERR_RA_NOT_AUTHORIZED, NULL,
get_sasl_error(*sasl_ctx, result, pool));
@@ -436,7 +436,7 @@ static svn_error_t *new_sasl_ctx(sasl_co
/* Set security properties. */
svn_ra_svn__default_secprops(&secprops);
- sasl_setprop(*sasl_ctx, SASL_SEC_PROPS, &secprops);
+ svn_sasl__setprop(*sasl_ctx, SASL_SEC_PROPS, &secprops);
return SVN_NO_ERROR;
}
@@ -460,12 +460,12 @@ static svn_error_t *try_auth(svn_ra_svn_
{
again = FALSE;
clear_sasl_errno();
- result = sasl_client_start(sasl_ctx,
- mechstring,
- &client_interact,
- &out,
- &outlen,
- &mech);
+ result = svn_sasl__client_start(sasl_ctx,
+ mechstring,
+ &client_interact,
+ &out,
+ &outlen,
+ &mech);
switch (result)
{
case SASL_OK:
@@ -531,12 +531,12 @@ static svn_error_t *try_auth(svn_ra_svn_
in = svn_base64_decode_string(in, pool);
clear_sasl_errno();
- result = sasl_client_step(sasl_ctx,
- in->data,
- (const unsigned int) in->len,
- &client_interact,
- &out, /* Filled in by SASL. */
- &outlen);
+ result = svn_sasl__client_step(sasl_ctx,
+ in->data,
+ (const unsigned int) in->len,
+ &client_interact,
+ &out, /* Filled in by SASL. */
+ &outlen);
if (result != SASL_OK && result != SASL_CONTINUE)
return svn_error_create(SVN_ERR_RA_NOT_AUTHORIZED, NULL,
@@ -620,9 +620,9 @@ static svn_error_t *sasl_read_cb(void *b
return SVN_NO_ERROR;
}
clear_sasl_errno();
- result = sasl_decode(sasl_baton->ctx, buffer, (unsigned int) len2,
- &sasl_baton->read_buf,
- &sasl_baton->read_len);
+ result = svn_sasl__decode(sasl_baton->ctx, buffer, (unsigned int) len2,
+ &sasl_baton->read_buf,
+ &sasl_baton->read_len);
if (result != SASL_OK)
return svn_error_create(SVN_ERR_RA_NOT_AUTHORIZED, NULL,
get_sasl_error(sasl_baton->ctx, result,
@@ -662,9 +662,9 @@ sasl_write_cb(void *baton, const char *b
/* Make sure we don't write too much. */
*len = (*len > sasl_baton->maxsize) ? sasl_baton->maxsize : *len;
clear_sasl_errno();
- result = sasl_encode(sasl_baton->ctx, buffer, (unsigned int) *len,
- &sasl_baton->write_buf,
- &sasl_baton->write_len);
+ result = svn_sasl__encode(sasl_baton->ctx, buffer, (unsigned int) *len,
+ &sasl_baton->write_buf,
+ &sasl_baton->write_len);
if (result != SASL_OK)
return svn_error_create(SVN_ERR_RA_NOT_AUTHORIZED, NULL,
@@ -725,7 +725,7 @@ svn_error_t *svn_ra_svn__enable_sasl_enc
/* Get the strength of the security layer. */
clear_sasl_errno();
- result = sasl_getprop(sasl_ctx, SASL_SSF, (void*) &ssfp);
+ result = svn_sasl__getprop(sasl_ctx, SASL_SSF, (void*) &ssfp);
if (result != SASL_OK)
return svn_error_create(SVN_ERR_RA_NOT_AUTHORIZED, NULL,
get_sasl_error(sasl_ctx, result, pool));
@@ -745,7 +745,7 @@ svn_error_t *svn_ra_svn__enable_sasl_enc
/* Find out the maximum input size for sasl_encode. */
clear_sasl_errno();
- result = sasl_getprop(sasl_ctx, SASL_MAXOUTBUF, &maxsize);
+ result = svn_sasl__getprop(sasl_ctx, SASL_MAXOUTBUF, &maxsize);
if (result != SASL_OK)
return svn_error_create(SVN_ERR_RA_NOT_AUTHORIZED, NULL,
get_sasl_error(sasl_ctx, result, pool));
@@ -756,9 +756,10 @@ svn_error_t *svn_ra_svn__enable_sasl_enc
if (conn->read_end > conn->read_ptr)
{
clear_sasl_errno();
- result = sasl_decode(sasl_ctx, conn->read_ptr,
- (unsigned int) (conn->read_end - conn->read_ptr),
- &sasl_baton->read_buf, &sasl_baton->read_len);
+ result = svn_sasl__decode(
+ sasl_ctx, conn->read_ptr,
+ (unsigned int) (conn->read_end - conn->read_ptr),
+ &sasl_baton->read_buf, &sasl_baton->read_len);
if (result != SASL_OK)
return svn_error_create(SVN_ERR_RA_NOT_AUTHORIZED, NULL,
get_sasl_error(sasl_ctx, result, pool));
@@ -860,7 +861,7 @@ svn_ra_svn__do_cyrus_auth(svn_ra_svn__se
mechstring = apr_pstrcat(pool,
mechstring,
i == 0 ? "" : " ",
- elt->u.word, SVN_VA_NULL);
+ elt->u.word.data, SVN_VA_NULL);
}
}
Modified: subversion/branches/authzperf/subversion/libsvn_ra_svn/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_ra_svn/deprecated.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_ra_svn/deprecated.c (original)
+++ subversion/branches/authzperf/subversion/libsvn_ra_svn/deprecated.c Fri Apr 29 18:38:53 2016
@@ -135,7 +135,7 @@ svn_ra_svn_parse_tuple(const apr_array_h
svn_ra_svn__list_t *internal = svn_ra_svn__to_private_array(list, pool);
va_start(va, fmt);
- err = svn_ra_svn__parse_tuple(internal, pool, fmt, va);
+ err = svn_ra_svn__parse_tuple(internal, fmt, va);
va_end(va);
return svn_error_trace(err);
@@ -262,6 +262,20 @@ svn_ra_svn_write_cmd_failure(svn_ra_svn_
/* From marshal.c */
svn_ra_svn_conn_t *
+svn_ra_svn_create_conn4(apr_socket_t *sock,
+ svn_stream_t *in_stream,
+ svn_stream_t *out_stream,
+ int compression_level,
+ apr_size_t zero_copy_limit,
+ apr_size_t error_check_interval,
+ apr_pool_t *pool)
+{
+ return svn_ra_svn_create_conn5(sock, in_stream, out_stream,
+ compression_level, zero_copy_limit,
+ error_check_interval, 0, 0, pool);
+}
+
+svn_ra_svn_conn_t *
svn_ra_svn_create_conn3(apr_socket_t *sock,
apr_file_t *in_file,
apr_file_t *out_file,
@@ -279,7 +293,8 @@ svn_ra_svn_create_conn3(apr_socket_t *so
out_stream = svn_stream_from_aprfile2(out_file, FALSE, pool);
return svn_ra_svn_create_conn4(sock, in_stream, out_stream,
- compression_level, 0, 0, pool);
+ compression_level, zero_copy_limit,
+ error_check_interval, pool);
}
svn_ra_svn_conn_t *