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 2011/02/08 23:41:32 UTC
svn commit: r1068651 - in /subversion/branches/integrate-compression-level:
./ subversion/include/ subversion/libsvn_delta/ subversion/libsvn_ra_svn/
subversion/svnserve/ subversion/tests/libsvn_delta/
Author: stefan2
Date: Tue Feb 8 22:41:31 2011
New Revision: 1068651
URL: http://svn.apache.org/viewvc?rev=1068651&view=rev
Log:
Introduce svn_txdelta_to_svndiff3() that introduces an additional ZIP
compression level parameter. Do all the plumbing to set that value on
the svnserve command line. For compression level 0, deactivate compression
entirely (instead of using a zlib's "store" mode).
Merged revisions from /branches/performance:
981287, 981827, 982057 (partial), 1029339 (svn_ra_svn.h only)
Modified:
subversion/branches/integrate-compression-level/ (props changed)
subversion/branches/integrate-compression-level/subversion/include/svn_delta.h
subversion/branches/integrate-compression-level/subversion/include/svn_ra_svn.h
subversion/branches/integrate-compression-level/subversion/libsvn_delta/svndiff.c
subversion/branches/integrate-compression-level/subversion/libsvn_ra_svn/editorp.c
subversion/branches/integrate-compression-level/subversion/libsvn_ra_svn/marshal.c
subversion/branches/integrate-compression-level/subversion/libsvn_ra_svn/ra_svn.h
subversion/branches/integrate-compression-level/subversion/svnserve/main.c
subversion/branches/integrate-compression-level/subversion/svnserve/serve.c
subversion/branches/integrate-compression-level/subversion/svnserve/server.h
subversion/branches/integrate-compression-level/subversion/tests/libsvn_delta/random-test.c
subversion/branches/integrate-compression-level/subversion/tests/libsvn_delta/svndiff-test.c
Propchange: subversion/branches/integrate-compression-level/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 8 22:41:31 2011
@@ -27,7 +27,7 @@
/subversion/branches/log-g-performance:870941-871032
/subversion/branches/merge-skips-obstructions:874525-874615
/subversion/branches/nfc-nfd-aware-client:870276,870376
-/subversion/branches/performance:979193,980118,981087,981684,982043,982355,983764,983766,984927,984973,984984,985014,985037,985046,985472,985477,985482,985500,985606,985669,986453,987888,987893,988319,990541,990568,990572,990600,990759,992899,992911,993127,993141,994956,995478,995507,995603,998858,999098,1001413,1001417,1004291,1022668,1022670,1022676,1022715,1022719,1025660,1025672,1027193,1027203,1027206,1027214,1027227,1028077,1028092,1028094,1028104,1028107,1028111,1028354,1029038,1029042-1029043,1029078,1029080,1029090,1029092-1029093,1029111,1029151,1029158,1029232,1029335,1029340,1029342,1029344,1030763,1030827,1031203,1031235,1032285,1032333,1033040,1033057,1033294,1035869,1039511,1043705,1053735,1056015,1066452,1067683
+/subversion/branches/performance:979193,980118,981087,981287,981684,981827,982043,982355,983764,983766,984927,984973,984984,985014,985037,985046,985472,985477,985482,985500,985606,985669,986453,987888,987893,988319,990541,990568,990572,990600,990759,992899,992911,993127,993141,994956,995478,995507,995603,998858,999098,1001413,1001417,1004291,1022668,1022670,1022676,1022715,1022719,1025660,1025672,1027193,1027203,1027206,1027214,1027227,1028077,1028092,1028094,1028104,1028107,1028111,1028354,1029038,1029042-1029043,1029078,1029080,1029090,1029092-1029093,1029111,1029151,1029158,1029232,1029335,1029339-1029340,1029342,1029344,1030763,1030827,1031203,1031235,1032285,1032333,1033040,1033057,1033294,1035869,1039511,1043705,1053735,1056015,1066452,1067683
/subversion/branches/py-tests-as-modules:956579-1033052
/subversion/branches/ra_serf-digest-authn:875693-876404
/subversion/branches/reintegrate-improvements:873853-874164
Modified: subversion/branches/integrate-compression-level/subversion/include/svn_delta.h
URL: http://svn.apache.org/viewvc/subversion/branches/integrate-compression-level/subversion/include/svn_delta.h?rev=1068651&r1=1068650&r2=1068651&view=diff
==============================================================================
--- subversion/branches/integrate-compression-level/subversion/include/svn_delta.h (original)
+++ subversion/branches/integrate-compression-level/subversion/include/svn_delta.h Tue Feb 8 22:41:31 2011
@@ -49,6 +49,12 @@ extern "C" {
+/** This is the default compression level we pass to zlib. It
+ * should be between 0 and 9, with higher numbers being greater
+ * compression.
+ */
+#define SVNDIFF1_COMPRESS_LEVEL 5
+
/**
* Get libsvn_delta version information.
*
@@ -453,11 +459,25 @@ svn_txdelta_apply(svn_stream_t *source,
* Allocation takes place in a sub-pool of @a pool. On return, @a *handler
* is set to a window handler function and @a *handler_baton is set to
* the value to pass as the @a baton argument to @a *handler. The svndiff
- * version is @a svndiff_version.
+ * version is @a svndiff_version. @a compression_level is the zlib
+ * compression level from 0 (no compression) and 9 (maximum compression).
*
- * @since New in 1.4.
+ * @since New in 1.7.
*/
void
+svn_txdelta_to_svndiff3(svn_txdelta_window_handler_t *handler,
+ void **handler_baton,
+ svn_stream_t *output,
+ int svndiff_version,
+ int compression_level,
+ apr_pool_t *pool);
+
+ /** Similar to svn_txdelta_to_svndiff3, but always using the SVN default
+ * compression level (@ref SVNDIFF1_COMPRESS_LEVEL).
+ *
+ * @since New in 1.4.
+ */
+void
svn_txdelta_to_svndiff2(svn_txdelta_window_handler_t *handler,
void **handler_baton,
svn_stream_t *output,
Modified: subversion/branches/integrate-compression-level/subversion/include/svn_ra_svn.h
URL: http://svn.apache.org/viewvc/subversion/branches/integrate-compression-level/subversion/include/svn_ra_svn.h?rev=1068651&r1=1068650&r2=1068651&view=diff
==============================================================================
--- subversion/branches/integrate-compression-level/subversion/include/svn_ra_svn.h (original)
+++ subversion/branches/integrate-compression-level/subversion/include/svn_ra_svn.h Tue Feb 8 22:41:31 2011
@@ -161,7 +161,24 @@ typedef svn_error_t *(*svn_ra_svn_edit_c
* input/output files.
*
* Either @a sock or @a in_file/@a out_file must be set, not both.
+ * Specify the desired network data compression level (zlib) from
+ * 0 (no compression) to 9 (best but slowest).
+ *
+ * @since New in 1.7.
+ */
+svn_ra_svn_conn_t *
+svn_ra_svn_create_conn2(apr_socket_t *sock,
+ apr_file_t *in_file,
+ apr_file_t *out_file,
+ int compression_level,
+ apr_pool_t *pool);
+
+/** Similar to @ref svn_ra_svn_create_conn2() but uses default
+ * compression level (#SVNDIFF1_COMPRESS_LEVEL) for network transmissions.
+ *
+ * @deprecated Provided for backward compatibility with the 1.6 API.
*/
+SVN_DEPRECATED
svn_ra_svn_conn_t *
svn_ra_svn_create_conn(apr_socket_t *sock,
apr_file_t *in_file,
@@ -185,6 +202,13 @@ svn_boolean_t
svn_ra_svn_has_capability(svn_ra_svn_conn_t *conn,
const char *capability);
+/** Return the data compression level to use for network transmissions
+ *
+ * @since New in 1.7.
+ */
+int
+svn_ra_svn_compression_level(svn_ra_svn_conn_t *conn);
+
/** Returns the remote address of the connection as a string, if known,
* or NULL if inapplicable. */
const char *
Modified: subversion/branches/integrate-compression-level/subversion/libsvn_delta/svndiff.c
URL: http://svn.apache.org/viewvc/subversion/branches/integrate-compression-level/subversion/libsvn_delta/svndiff.c?rev=1068651&r1=1068650&r2=1068651&view=diff
==============================================================================
--- subversion/branches/integrate-compression-level/subversion/libsvn_delta/svndiff.c (original)
+++ subversion/branches/integrate-compression-level/subversion/libsvn_delta/svndiff.c Tue Feb 8 22:41:31 2011
@@ -42,23 +42,16 @@
be compressed using zlib as a secondary compressor. */
#define MIN_COMPRESS_SIZE 512
-/* For svndiff, this is the compression level we pass to zlib. It
- should be between 0 and 9, with higher numbers being greater
- compression. */
-#define SVNDIFF1_COMPRESS_LEVEL 5
-#define NORMAL_BITS 7
-#define LENGTH_BITS 5
-
-
/* ----- Text delta to svndiff ----- */
/* We make one of these and get it passed back to us in calls to the
window handler. We only use it to record the write function and
- baton passed to svn_txdelta_to_svndiff2(). */
+ baton passed to svn_txdelta_to_svndiff3(). */
struct encoder_baton {
svn_stream_t *output;
svn_boolean_t header_done;
int version;
+ int compression_level;
apr_pool_t *pool;
};
@@ -140,7 +133,10 @@ append_encoded_int(svn_stringbuf_t *head
version of IN was no smaller than the original IN, OUT will be a copy
of IN with the size prepended as an integer. */
static svn_error_t *
-zlib_encode(const char *data, apr_size_t len, svn_stringbuf_t *out)
+zlib_encode(const char *data,
+ apr_size_t len,
+ svn_stringbuf_t *out,
+ int compression_level)
{
unsigned long endlen;
apr_size_t intlen;
@@ -159,7 +155,7 @@ zlib_encode(const char *data, apr_size_t
if (compress2((unsigned char *)out->data + intlen, &endlen,
(const unsigned char *)data, len,
- SVNDIFF1_COMPRESS_LEVEL) != Z_OK)
+ compression_level) != Z_OK)
return svn_error_create(SVN_ERR_SVNDIFF_INVALID_COMPRESSED_DATA,
NULL,
_("Compression of svndiff data failed"));
@@ -245,7 +241,8 @@ window_handler(svn_txdelta_window_t *win
append_encoded_int(header, window->tview_len);
if (eb->version == 1)
{
- SVN_ERR(zlib_encode(instructions->data, instructions->len, i1));
+ SVN_ERR(zlib_encode(instructions->data, instructions->len,
+ i1, eb->compression_level));
instructions = i1;
}
append_encoded_int(header, instructions->len);
@@ -254,7 +251,7 @@ window_handler(svn_txdelta_window_t *win
svn_stringbuf_t *temp = svn_stringbuf_create("", pool);
svn_string_t *tempstr = svn_string_create("", pool);
SVN_ERR(zlib_encode(window->new_data->data, window->new_data->len,
- temp));
+ temp, eb->compression_level));
tempstr->data = temp->data;
tempstr->len = temp->len;
newdata = tempstr;
@@ -283,10 +280,11 @@ window_handler(svn_txdelta_window_t *win
}
void
-svn_txdelta_to_svndiff2(svn_txdelta_window_handler_t *handler,
+svn_txdelta_to_svndiff3(svn_txdelta_window_handler_t *handler,
void **handler_baton,
svn_stream_t *output,
int svndiff_version,
+ int compression_level,
apr_pool_t *pool)
{
apr_pool_t *subpool = svn_pool_create(pool);
@@ -297,18 +295,31 @@ svn_txdelta_to_svndiff2(svn_txdelta_wind
eb->header_done = FALSE;
eb->pool = subpool;
eb->version = svndiff_version;
+ eb->compression_level = compression_level;
*handler = window_handler;
*handler_baton = eb;
}
void
+svn_txdelta_to_svndiff2(svn_txdelta_window_handler_t *handler,
+ void **handler_baton,
+ svn_stream_t *output,
+ int svndiff_version,
+ apr_pool_t *pool)
+{
+ svn_txdelta_to_svndiff3(handler, handler_baton, output,
+ svndiff_version, SVNDIFF1_COMPRESS_LEVEL, pool);
+}
+
+void
svn_txdelta_to_svndiff(svn_stream_t *output,
apr_pool_t *pool,
svn_txdelta_window_handler_t *handler,
void **handler_baton)
{
- svn_txdelta_to_svndiff2(handler, handler_baton, output, 0, pool);
+ svn_txdelta_to_svndiff3(handler, handler_baton, output,
+ 0, SVNDIFF1_COMPRESS_LEVEL, pool);
}
Modified: subversion/branches/integrate-compression-level/subversion/libsvn_ra_svn/editorp.c
URL: http://svn.apache.org/viewvc/subversion/branches/integrate-compression-level/subversion/libsvn_ra_svn/editorp.c?rev=1068651&r1=1068650&r2=1068651&view=diff
==============================================================================
--- subversion/branches/integrate-compression-level/subversion/libsvn_ra_svn/editorp.c (original)
+++ subversion/branches/integrate-compression-level/subversion/libsvn_ra_svn/editorp.c Tue Feb 8 22:41:31 2011
@@ -316,10 +316,16 @@ static svn_error_t *ra_svn_apply_textdel
diff_stream = svn_stream_create(b, pool);
svn_stream_set_write(diff_stream, ra_svn_svndiff_handler);
svn_stream_set_close(diff_stream, ra_svn_svndiff_close_handler);
- if (svn_ra_svn_has_capability(b->conn, SVN_RA_SVN_CAP_SVNDIFF1))
- svn_txdelta_to_svndiff2(wh, wh_baton, diff_stream, 1, pool);
+
+ /* If the connection does not support SVNDIFF1 or if we don't want to use
+ * compression, use the non-compressing "version 0" implementation */
+ if ( svn_ra_svn_compression_level(b->conn) > 0
+ && svn_ra_svn_has_capability(b->conn, SVN_RA_SVN_CAP_SVNDIFF1))
+ svn_txdelta_to_svndiff3(wh, wh_baton, diff_stream, 1,
+ b->conn->compression_level, pool);
else
- svn_txdelta_to_svndiff2(wh, wh_baton, diff_stream, 0, pool);
+ svn_txdelta_to_svndiff3(wh, wh_baton, diff_stream, 0,
+ b->conn->compression_level, pool);
return SVN_NO_ERROR;
}
Modified: subversion/branches/integrate-compression-level/subversion/libsvn_ra_svn/marshal.c
URL: http://svn.apache.org/viewvc/subversion/branches/integrate-compression-level/subversion/libsvn_ra_svn/marshal.c?rev=1068651&r1=1068650&r2=1068651&view=diff
==============================================================================
--- subversion/branches/integrate-compression-level/subversion/libsvn_ra_svn/marshal.c (original)
+++ subversion/branches/integrate-compression-level/subversion/libsvn_ra_svn/marshal.c Tue Feb 8 22:41:31 2011
@@ -52,10 +52,11 @@
/* --- CONNECTION INITIALIZATION --- */
-svn_ra_svn_conn_t *svn_ra_svn_create_conn(apr_socket_t *sock,
- apr_file_t *in_file,
- apr_file_t *out_file,
- apr_pool_t *pool)
+svn_ra_svn_conn_t *svn_ra_svn_create_conn2(apr_socket_t *sock,
+ apr_file_t *in_file,
+ apr_file_t *out_file,
+ int compression_level,
+ apr_pool_t *pool)
{
svn_ra_svn_conn_t *conn = apr_palloc(pool, sizeof(*conn));
@@ -71,6 +72,7 @@ svn_ra_svn_conn_t *svn_ra_svn_create_con
conn->block_handler = NULL;
conn->block_baton = NULL;
conn->capabilities = apr_hash_make(pool);
+ conn->compression_level = compression_level;
conn->pool = pool;
if (sock != NULL)
@@ -90,6 +92,16 @@ svn_ra_svn_conn_t *svn_ra_svn_create_con
return conn;
}
+/* backward-compatible implementation using the default compression level */
+svn_ra_svn_conn_t *svn_ra_svn_create_conn(apr_socket_t *sock,
+ apr_file_t *in_file,
+ apr_file_t *out_file,
+ apr_pool_t *pool)
+{
+ return svn_ra_svn_create_conn2(sock, in_file, out_file,
+ SVNDIFF1_COMPRESS_LEVEL, pool);
+}
+
svn_error_t *svn_ra_svn_set_capabilities(svn_ra_svn_conn_t *conn,
const apr_array_header_t *list)
{
@@ -116,6 +128,12 @@ svn_boolean_t svn_ra_svn_has_capability(
APR_HASH_KEY_STRING) != NULL);
}
+int
+svn_ra_svn_compression_level(svn_ra_svn_conn_t *conn)
+{
+ return conn->compression_level;
+}
+
const char *svn_ra_svn_conn_remote_host(svn_ra_svn_conn_t *conn)
{
return conn->remote_ip;
Modified: subversion/branches/integrate-compression-level/subversion/libsvn_ra_svn/ra_svn.h
URL: http://svn.apache.org/viewvc/subversion/branches/integrate-compression-level/subversion/libsvn_ra_svn/ra_svn.h?rev=1068651&r1=1068650&r2=1068651&view=diff
==============================================================================
--- subversion/branches/integrate-compression-level/subversion/libsvn_ra_svn/ra_svn.h (original)
+++ subversion/branches/integrate-compression-level/subversion/libsvn_ra_svn/ra_svn.h Tue Feb 8 22:41:31 2011
@@ -85,6 +85,7 @@ struct svn_ra_svn_conn_st {
ra_svn_block_handler_t block_handler;
void *block_baton;
apr_hash_t *capabilities;
+ int compression_level;
char *remote_ip;
apr_pool_t *pool;
};
Modified: subversion/branches/integrate-compression-level/subversion/svnserve/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/integrate-compression-level/subversion/svnserve/main.c?rev=1068651&r1=1068650&r2=1068651&view=diff
==============================================================================
--- subversion/branches/integrate-compression-level/subversion/svnserve/main.c (original)
+++ subversion/branches/integrate-compression-level/subversion/svnserve/main.c Tue Feb 8 22:41:31 2011
@@ -189,6 +189,12 @@ static const apr_getopt_option_t svnserv
"at the same time is not supported in daemon mode.\n"
" "
"Use inetd mode or tunnel mode if you need this.]")},
+ {"compression", 'c', 1,
+ N_("compression level to use for network transmissions\n"
+ " "
+ "[0 .. no compression, 5 .. default, \n"
+ " "
+ " 9 .. maximum compresssion]")},
{"memory-cache-size", 'M', 1,
N_("size of the extra in-memory cache in MB used to\n"
" "
@@ -445,6 +451,7 @@ int main(int argc, const char *argv[])
params.cfg = NULL;
params.pwdb = NULL;
params.authzdb = NULL;
+ params.compression_level = SVNDIFF1_COMPRESS_LEVEL;
params.log_file = NULL;
params.username_case = CASE_ASIS;
params.memory_cache_size = (apr_uint64_t)-1;
@@ -560,6 +567,14 @@ int main(int argc, const char *argv[])
handling_mode = connection_mode_thread;
break;
+ case 'c':
+ params.compression_level = atoi(arg);
+ if (params.compression_level < 0)
+ params.compression_level = 0;
+ if (params.compression_level > 9)
+ params.compression_level = 9;
+ break;
+
case 'M':
params.memory_cache_size = 0x100000 * apr_strtoi64(arg, NULL, 0);
break;
@@ -662,7 +677,8 @@ int main(int argc, const char *argv[])
return svn_cmdline_handle_exit_error(err, pool, "svnserve: ");
}
- conn = svn_ra_svn_create_conn(NULL, in_file, out_file, pool);
+ conn = svn_ra_svn_create_conn2(NULL, in_file, out_file,
+ params.compression_level, pool);
svn_error_clear(serve(conn, ¶ms, pool));
exit(0);
}
@@ -908,7 +924,9 @@ int main(int argc, const char *argv[])
/* It's not a fatal error if we cannot enable keep-alives. */
}
- conn = svn_ra_svn_create_conn(usock, NULL, NULL, connection_pool);
+ conn = svn_ra_svn_create_conn2(usock, NULL, NULL,
+ params.compression_level,
+ connection_pool);
if (run_mode == run_mode_listen_once)
{
Modified: subversion/branches/integrate-compression-level/subversion/svnserve/serve.c
URL: http://svn.apache.org/viewvc/subversion/branches/integrate-compression-level/subversion/svnserve/serve.c?rev=1068651&r1=1068650&r2=1068651&view=diff
==============================================================================
--- subversion/branches/integrate-compression-level/subversion/svnserve/serve.c (original)
+++ subversion/branches/integrate-compression-level/subversion/svnserve/serve.c Tue Feb 8 22:41:31 2011
@@ -2363,10 +2363,15 @@ static svn_error_t *file_rev_handler(voi
svn_stream_set_write(stream, svndiff_handler);
svn_stream_set_close(stream, svndiff_close_handler);
- if (svn_ra_svn_has_capability(frb->conn, SVN_RA_SVN_CAP_SVNDIFF1))
- svn_txdelta_to_svndiff2(d_handler, d_baton, stream, 1, pool);
+ /* If the connection does not support SVNDIFF1 or if we don't want to use
+ * compression, use the non-compressing "version 0" implementation */
+ if ( svn_ra_svn_compression_level(frb->conn) > 0
+ && svn_ra_svn_has_capability(frb->conn, SVN_RA_SVN_CAP_SVNDIFF1))
+ svn_txdelta_to_svndiff3(d_handler, d_baton, stream, 1,
+ svn_ra_svn_compression_level(frb->conn), pool);
else
- svn_txdelta_to_svndiff2(d_handler, d_baton, stream, 0, pool);
+ svn_txdelta_to_svndiff3(d_handler, d_baton, stream, 0,
+ svn_ra_svn_compression_level(frb->conn), pool);
}
else
SVN_ERR(svn_ra_svn_write_cstring(frb->conn, pool, ""));
@@ -3088,17 +3093,27 @@ svn_error_t *serve(svn_ra_svn_conn_t *co
/* Send greeting. We don't support version 1 any more, so we can
* send an empty mechlist. */
- /* Server-side capabilities list: */
- SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, "nn()(wwwwwwww)",
- (apr_uint64_t) 2, (apr_uint64_t) 2,
- SVN_RA_SVN_CAP_EDIT_PIPELINE,
- SVN_RA_SVN_CAP_SVNDIFF1,
- SVN_RA_SVN_CAP_ABSENT_ENTRIES,
- SVN_RA_SVN_CAP_COMMIT_REVPROPS,
- SVN_RA_SVN_CAP_DEPTH,
- SVN_RA_SVN_CAP_LOG_REVPROPS,
- SVN_RA_SVN_CAP_ATOMIC_REVPROPS,
- SVN_RA_SVN_CAP_PARTIAL_REPLAY));
+ if (params->compression_level > 0)
+ SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, "nn()(wwwwwwww)",
+ (apr_uint64_t) 2, (apr_uint64_t) 2,
+ SVN_RA_SVN_CAP_EDIT_PIPELINE,
+ SVN_RA_SVN_CAP_SVNDIFF1,
+ SVN_RA_SVN_CAP_ABSENT_ENTRIES,
+ SVN_RA_SVN_CAP_COMMIT_REVPROPS,
+ SVN_RA_SVN_CAP_DEPTH,
+ SVN_RA_SVN_CAP_LOG_REVPROPS,
+ SVN_RA_SVN_CAP_ATOMIC_REVPROPS,
+ SVN_RA_SVN_CAP_PARTIAL_REPLAY));
+ else
+ SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, "nn()(wwwwwww)",
+ (apr_uint64_t) 2, (apr_uint64_t) 2,
+ SVN_RA_SVN_CAP_EDIT_PIPELINE,
+ SVN_RA_SVN_CAP_ABSENT_ENTRIES,
+ SVN_RA_SVN_CAP_COMMIT_REVPROPS,
+ SVN_RA_SVN_CAP_DEPTH,
+ SVN_RA_SVN_CAP_LOG_REVPROPS,
+ SVN_RA_SVN_CAP_ATOMIC_REVPROPS,
+ SVN_RA_SVN_CAP_PARTIAL_REPLAY));
/* Read client response, which we assume to be in version 2 format:
* version, capability list, and client URL; then we do an auth
Modified: subversion/branches/integrate-compression-level/subversion/svnserve/server.h
URL: http://svn.apache.org/viewvc/subversion/branches/integrate-compression-level/subversion/svnserve/server.h?rev=1068651&r1=1068650&r2=1068651&view=diff
==============================================================================
--- subversion/branches/integrate-compression-level/subversion/svnserve/server.h (original)
+++ subversion/branches/integrate-compression-level/subversion/svnserve/server.h Tue Feb 8 22:41:31 2011
@@ -112,6 +112,12 @@ typedef struct serve_params_t {
/* Size of the in-memory cache (used by FSFS only). */
apr_uint64_t memory_cache_size;
+ /* Data compression level to reduce for network traffic. If this
+ is 0, no compression should be applied and the protocol may
+ fall back to txdelta "version 0" bypassing zlib entirely.
+ Defaults to SVNDIFF1_COMPRESS_LEVEL. */
+ int compression_level;
+
} serve_params_t;
/* Serve the connection CONN according to the parameters PARAMS. */
Modified: subversion/branches/integrate-compression-level/subversion/tests/libsvn_delta/random-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/integrate-compression-level/subversion/tests/libsvn_delta/random-test.c?rev=1068651&r1=1068650&r2=1068651&view=diff
==============================================================================
--- subversion/branches/integrate-compression-level/subversion/tests/libsvn_delta/random-test.c (original)
+++ subversion/branches/integrate-compression-level/subversion/tests/libsvn_delta/random-test.c Tue Feb 8 22:41:31 2011
@@ -330,8 +330,9 @@ random_test(apr_pool_t *pool)
stream = svn_txdelta_parse_svndiff(handler, handler_baton, TRUE,
delta_pool);
- /* Make stage 2: encode the text delta in svndiff format. */
- svn_txdelta_to_svndiff2(&handler, &handler_baton, stream, 1,
+ /* Make stage 2: encode the text delta in svndiff format using
+ varying compression levels. */
+ svn_txdelta_to_svndiff3(&handler, &handler_baton, stream, 1, i % 10,
delta_pool);
/* Make stage 1: create the text delta. */
@@ -412,8 +413,9 @@ do_random_combine_test(apr_pool_t *pool,
stream = svn_txdelta_parse_svndiff(handler, handler_baton, TRUE,
delta_pool);
- /* Make stage 2: encode the text delta in svndiff format. */
- svn_txdelta_to_svndiff2(&handler, &handler_baton, stream, 1,
+ /* Make stage 2: encode the text delta in svndiff format using
+ varying compression levels. */
+ svn_txdelta_to_svndiff3(&handler, &handler_baton, stream, 1, i % 10,
delta_pool);
/* Make stage 1: create the text deltas. */
Modified: subversion/branches/integrate-compression-level/subversion/tests/libsvn_delta/svndiff-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/integrate-compression-level/subversion/tests/libsvn_delta/svndiff-test.c?rev=1068651&r1=1068650&r2=1068651&view=diff
==============================================================================
--- subversion/branches/integrate-compression-level/subversion/tests/libsvn_delta/svndiff-test.c (original)
+++ subversion/branches/integrate-compression-level/subversion/tests/libsvn_delta/svndiff-test.c Tue Feb 8 22:41:31 2011
@@ -89,8 +89,9 @@ main(int argc, char **argv)
#else
encoder = svn_base64_encode(stdout_stream, pool);
#endif
- svn_txdelta_to_svndiff2(&svndiff_handler, &svndiff_baton,
- encoder, version, pool);
+ /* use maximum compression level */
+ svn_txdelta_to_svndiff3(&svndiff_handler, &svndiff_baton,
+ encoder, version, 9, pool);
err = svn_txdelta_send_txstream(txdelta_stream,
svndiff_handler,
svndiff_baton,
Re: svn commit: r1068651 - in
/subversion/branches/integrate-compression-level: ./ subversion/include/
subversion/libsvn_delta/ subversion/libsvn_ra_svn/ subversion/svnserve/
subversion/tests/libsvn_delta/
Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
I've read just the diff, not the patched source. Overall, +1, and
a couple of minor nits below:
stefan2@apache.org wrote on Tue, Feb 08, 2011 at 22:41:32 -0000:
> Author: stefan2
> Date: Tue Feb 8 22:41:31 2011
> New Revision: 1068651
>
> URL: http://svn.apache.org/viewvc?rev=1068651&view=rev
> Log:
> Introduce svn_txdelta_to_svndiff3() that introduces an additional ZIP
> compression level parameter. Do all the plumbing to set that value on
> the svnserve command line. For compression level 0, deactivate compression
> entirely (instead of using a zlib's "store" mode).
>
> Merged revisions from /branches/performance:
> 981287, 981827, 982057 (partial), 1029339 (svn_ra_svn.h only)
>
> Modified:
> subversion/branches/integrate-compression-level/ (props changed)
> subversion/branches/integrate-compression-level/subversion/include/svn_delta.h
> subversion/branches/integrate-compression-level/subversion/include/svn_ra_svn.h
> subversion/branches/integrate-compression-level/subversion/libsvn_delta/svndiff.c
> subversion/branches/integrate-compression-level/subversion/libsvn_ra_svn/editorp.c
> subversion/branches/integrate-compression-level/subversion/libsvn_ra_svn/marshal.c
> subversion/branches/integrate-compression-level/subversion/libsvn_ra_svn/ra_svn.h
> subversion/branches/integrate-compression-level/subversion/svnserve/main.c
> subversion/branches/integrate-compression-level/subversion/svnserve/serve.c
> subversion/branches/integrate-compression-level/subversion/svnserve/server.h
> subversion/branches/integrate-compression-level/subversion/tests/libsvn_delta/random-test.c
> subversion/branches/integrate-compression-level/subversion/tests/libsvn_delta/svndiff-test.c
>
mod_dav_svn support?
> @@ -445,6 +451,7 @@ int main(int argc, const char *argv[])
> + params.compression_level = SVNDIFF1_COMPRESS_LEVEL;
SVN_SVNDIFF1_COMPRESS_LEVEL ?
> @@ -560,6 +567,14 @@ int main(int argc, const char *argv[])
> + case 'c':
> + params.compression_level = atoi(arg);
> + if (params.compression_level < 0)
> + params.compression_level = 0;
> + if (params.compression_level > 9)
> + params.compression_level = 9;
Magic number.
> @@ -112,6 +112,12 @@ typedef struct serve_params_t {
> /* Size of the in-memory cache (used by FSFS only). */
> apr_uint64_t memory_cache_size;
>
> + /* Data compression level to reduce for network traffic. If this
> + is 0, no compression should be applied and the protocol may
> + fall back to txdelta "version 0" bypassing zlib entirely.
s/txdelta/svndiff/
Re: svn commit: r1068651 - in
/subversion/branches/integrate-compression-level: ./ subversion/include/
subversion/libsvn_delta/ subversion/libsvn_ra_svn/ subversion/svnserve/
subversion/tests/libsvn_delta/
Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
I've read just the diff, not the patched source. Overall, +1, and
a couple of minor nits below:
stefan2@apache.org wrote on Tue, Feb 08, 2011 at 22:41:32 -0000:
> Author: stefan2
> Date: Tue Feb 8 22:41:31 2011
> New Revision: 1068651
>
> URL: http://svn.apache.org/viewvc?rev=1068651&view=rev
> Log:
> Introduce svn_txdelta_to_svndiff3() that introduces an additional ZIP
> compression level parameter. Do all the plumbing to set that value on
> the svnserve command line. For compression level 0, deactivate compression
> entirely (instead of using a zlib's "store" mode).
>
> Merged revisions from /branches/performance:
> 981287, 981827, 982057 (partial), 1029339 (svn_ra_svn.h only)
>
> Modified:
> subversion/branches/integrate-compression-level/ (props changed)
> subversion/branches/integrate-compression-level/subversion/include/svn_delta.h
> subversion/branches/integrate-compression-level/subversion/include/svn_ra_svn.h
> subversion/branches/integrate-compression-level/subversion/libsvn_delta/svndiff.c
> subversion/branches/integrate-compression-level/subversion/libsvn_ra_svn/editorp.c
> subversion/branches/integrate-compression-level/subversion/libsvn_ra_svn/marshal.c
> subversion/branches/integrate-compression-level/subversion/libsvn_ra_svn/ra_svn.h
> subversion/branches/integrate-compression-level/subversion/svnserve/main.c
> subversion/branches/integrate-compression-level/subversion/svnserve/serve.c
> subversion/branches/integrate-compression-level/subversion/svnserve/server.h
> subversion/branches/integrate-compression-level/subversion/tests/libsvn_delta/random-test.c
> subversion/branches/integrate-compression-level/subversion/tests/libsvn_delta/svndiff-test.c
>
mod_dav_svn support?
> @@ -445,6 +451,7 @@ int main(int argc, const char *argv[])
> + params.compression_level = SVNDIFF1_COMPRESS_LEVEL;
SVN_SVNDIFF1_COMPRESS_LEVEL ?
> @@ -560,6 +567,14 @@ int main(int argc, const char *argv[])
> + case 'c':
> + params.compression_level = atoi(arg);
> + if (params.compression_level < 0)
> + params.compression_level = 0;
> + if (params.compression_level > 9)
> + params.compression_level = 9;
Magic number.
> @@ -112,6 +112,12 @@ typedef struct serve_params_t {
> /* Size of the in-memory cache (used by FSFS only). */
> apr_uint64_t memory_cache_size;
>
> + /* Data compression level to reduce for network traffic. If this
> + is 0, no compression should be applied and the protocol may
> + fall back to txdelta "version 0" bypassing zlib entirely.
s/txdelta/svndiff/