You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by iv...@apache.org on 2012/11/09 18:06:50 UTC
svn commit: r1407545 - /subversion/trunk/subversion/libsvn_ra_serf/update.c
Author: ivan
Date: Fri Nov 9 17:06:50 2012
New Revision: 1407545
URL: http://svn.apache.org/viewvc?rev=1407545&view=rev
Log:
ra_serf: Improve connection usage in update_editor. This change makes svn
checkout and export twice faster.
* subversion/libsvn_ra_serf/update.c
(get_best_connection): New. Return best connection for GET/PROPFIND.
(fetch_file, end_report): Use get_best_connection().
(finish_report): Remove code for switching connection. Now
get_best_connection() is responsible for connection switching.
Modified:
subversion/trunk/subversion/libsvn_ra_serf/update.c
Modified: subversion/trunk/subversion/libsvn_ra_serf/update.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/update.c?rev=1407545&r1=1407544&r2=1407545&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/update.c Fri Nov 9 17:06:50 2012
@@ -376,7 +376,26 @@ struct report_context_t {
svn_boolean_t closed_root;
};
-
+
+/* Returns best connection for fetching files/properities. */
+static svn_ra_serf__connection_t *
+get_best_connection(report_context_t *ctx)
+{
+ svn_ra_serf__connection_t * conn;
+
+ /* Currently just cycle connection. In future we could store number of
+ * pending request on each connection for better connection usage. */
+ conn = ctx->sess->conns[ctx->sess->cur_conn];
+
+ /* Switch our connection. */
+ ctx->sess->cur_conn++;
+
+ if (ctx->sess->cur_conn >= ctx->sess->num_conns)
+ ctx->sess->cur_conn = 1;
+
+ return conn;
+}
+
/** Report state management helper **/
static report_info_t *
@@ -1273,7 +1292,7 @@ fetch_file(report_context_t *ctx, report
svn_ra_serf__handler_t *handler;
/* What connection should we go on? */
- conn = ctx->sess->conns[ctx->sess->cur_conn];
+ conn = get_best_connection(ctx);
/* go fetch info->name from DAV:checked-in */
info->url = svn_ra_serf__get_ver_prop(info->props, info->base_name,
@@ -1989,7 +2008,7 @@ end_report(svn_ra_serf__xml_parser_t *pa
SVN_ERR(svn_ra_serf__deliver_props(&info->dir->propfind_handler,
info->dir->props, ctx->sess,
- ctx->sess->conns[ctx->sess->cur_conn],
+ get_best_connection(ctx),
info->dir->url,
ctx->target_rev, "0",
all_props,
@@ -2556,11 +2575,6 @@ finish_report(void *report_baton,
SVN_ERR(open_connection_if_needed(sess, report->active_fetches +
report->active_propfinds));
- /* Switch our connection. */
- if (!report->done)
- if (++sess->cur_conn == sess->num_conns)
- sess->cur_conn = 1;
-
/* Prune directory propfinds that are finished. */
done_list = report->done_dir_propfinds;
while (done_list)