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 2010/08/08 17:39:01 UTC
svn commit: r983437 -
/subversion/branches/performance/subversion/svnadmin/main.c
Author: stefan2
Date: Sun Aug 8 15:39:01 2010
New Revision: 983437
URL: http://svn.apache.org/viewvc?rev=983437&view=rev
Log:
Add memory-cache-size and open-file-count command line options to svnadmin.
Enable txdelta window caching instead of fulltext caching (FSFS only).
* subversion/svnadmin/main.c
(options_table): add new command line options
(cmd_table): make them available for deltify, dump, load and verify sub-commands
(svnadmin_opt_state): add members to hold the new options
(main): default to larger caches then the FSFS default; parse new CL options;
configure caches
Modified:
subversion/branches/performance/subversion/svnadmin/main.c
Modified: subversion/branches/performance/subversion/svnadmin/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/svnadmin/main.c?rev=983437&r1=983436&r2=983437&view=diff
==============================================================================
--- subversion/branches/performance/subversion/svnadmin/main.c (original)
+++ subversion/branches/performance/subversion/svnadmin/main.c Sun Aug 8 15:39:01 2010
@@ -45,6 +45,11 @@
#include "svn_private_config.h"
+#ifdef SVN_LIBSVN_FS_LINKS_FS_FS
+#include "libsvn_fs_fs/fs_fs.h"
+#endif
+
+
/*** Code. ***/
@@ -321,6 +326,18 @@ static const apr_getopt_option_t options
N_("use format compatible with Subversion versions\n"
" earlier than 1.7")},
+#ifdef SVN_LIBSVN_FS_LINKS_FS_FS
+ {"memory-cache-size", 'M', 1,
+ N_("size of the extra in-memory cache in MB used to\n"
+ " minimize redundant operations. Default: 256.\n"
+ " [used for FSFS repositories only]")},
+
+ {"open-file-count", 'F', 1,
+ N_("maximum number of files kept open after usage\n"
+ " to reduce OS and I/O overhead. Default: 64.\n"
+ " [used for FSFS repositories only]")},
+#endif
+
{NULL}
};
@@ -351,7 +368,7 @@ static const svn_opt_subcommand_desc2_t
"essence compresses the repository by only storing the differences or\n"
"delta from the preceding revision. If no revisions are specified,\n"
"this will simply deltify the HEAD revision.\n"),
- {'r', 'q'} },
+ {'r', 'q', 'M', 'F'} },
{"dump", subcommand_dump, {0}, N_
("usage: svnadmin dump REPOS_PATH [-r LOWER[:UPPER] [--incremental]]\n\n"
@@ -364,7 +381,7 @@ static const svn_opt_subcommand_desc2_t
"every path present in the repository as of that revision. (In either\n"
"case, the second and subsequent revisions, if any, describe only paths\n"
"changed in those revisions.)\n"),
- {'r', svnadmin__incremental, svnadmin__deltas, 'q'} },
+ {'r', 'M', 'F', svnadmin__incremental, svnadmin__deltas, 'q', 'M', 'F'} },
{"help", subcommand_help, {"?", "h"}, N_
("usage: svnadmin help [SUBCOMMAND...]\n\n"
@@ -396,7 +413,7 @@ static const svn_opt_subcommand_desc2_t
"one specified in the stream. Progress feedback is sent to stdout.\n"),
{'q', svnadmin__ignore_uuid, svnadmin__force_uuid,
svnadmin__use_pre_commit_hook, svnadmin__use_post_commit_hook,
- svnadmin__parent_dir} },
+ svnadmin__parent_dir, 'M', 'F'} },
{"lslocks", subcommand_lslocks, {0}, N_
("usage: svnadmin lslocks REPOS_PATH [PATH-IN-REPOS]\n\n"
@@ -479,7 +496,7 @@ static const svn_opt_subcommand_desc2_t
{"verify", subcommand_verify, {0}, N_
("usage: svnadmin verify REPOS_PATH\n\n"
"Verifies the data stored in the repository.\n"),
- {'r', 'q'} },
+ {'r', 'q', 'M', 'F'} },
{ NULL, NULL, {0}, NULL, {0} }
};
@@ -512,6 +529,8 @@ struct svnadmin_opt_state
svn_boolean_t wait; /* --wait */
enum svn_repos_load_uuid uuid_action; /* --ignore-uuid,
--force-uuid */
+ apr_uint64_t memory_cache_size; /* --memory-cache-size M */
+ apr_size_t open_file_count; /* --open-file-count F */
const char *parent_dir;
const char *config_dir; /* Overriding Configuration Directory */
@@ -1602,6 +1621,8 @@ main(int argc, const char *argv[])
/* Initialize opt_state. */
opt_state.start_revision.kind = svn_opt_revision_unspecified;
opt_state.end_revision.kind = svn_opt_revision_unspecified;
+ opt_state.memory_cache_size = 0x10000000; /* 256 MB */
+ opt_state.open_file_count = 64;
/* Parse options. */
err = svn_cmdline__getopt_init(&os, argc, argv, pool);
@@ -1661,6 +1682,13 @@ main(int argc, const char *argv[])
case '?':
opt_state.help = TRUE;
break;
+ case 'M':
+ opt_state.memory_cache_size
+ = 0x100000 * apr_strtoi64(opt_arg, NULL, 0);
+ break;
+ case 'F':
+ opt_state.open_file_count = apr_strtoi64(opt_arg, NULL, 0);
+ break;
case svnadmin__version:
opt_state.version = TRUE;
break;
@@ -1863,6 +1891,22 @@ main(int argc, const char *argv[])
apr_signal(SIGXFSZ, SIG_IGN);
#endif
+#ifdef SVN_LIBSVN_FS_LINKS_FS_FS
+ /* Configure FSFS caches for maximum efficiency with svnadmin.
+ * Also, apply the respective command line parameters, if given. */
+ {
+ svn_fs_fs__cache_config_t settings = *svn_fs_fs__get_cache_config();
+
+ settings.cache_size = opt_state.memory_cache_size;
+ settings.file_handle_count = opt_state.open_file_count;
+ settings.cache_fulltexts = subcommand->cmd_func == subcommand_load;
+ settings.cache_txdeltas = TRUE;
+ settings.single_threaded = TRUE;
+
+ svn_fs_fs__set_cache_config(&settings);
+ }
+#endif
+
/* Run the subcommand. */
err = (*subcommand->cmd_func)(os, &opt_state, pool);
if (err)