Of course, I really meant this patch, instead, which uses the apr_thread
functions. :)
Index: ./fs.c
===================================================================
--- ./fs.c
+++ ./fs.c Mon Feb 4 11:58:26 2002
@@ -38,6 +38,42 @@
#include "svn_private_config.h"
+static void *
+logfile_thread (apr_thread_t *thd, void *arg)
+{
+ DB_ENV **argenv;
+ DB_ENV *dbenv;
+ int ret;
+ char **begin, **list;
+ argenv = arg;
+ dbenv = *argenv;
+
+ /* Check once every minute. */
+ for (;; sleep(60))
+ {
+ if (!*argenv)
+ apr_thread_exit(thd, 1);
+ /* Get the list of log files. */
+ if ((ret = dbenv->log_archive(dbenv, &list, DB_ARCH_ABS)) != 0)
+ {
+ dbenv->err(dbenv, ret, "DB_ENV->log_archive");
+ apr_thread_exit(thd, 1);
+ }
+
+ /* Remove the log files. */
+ if (list != NULL)
+ {
+ for (begin = list; *list != NULL; ++list)
+ if ((ret = remove(*list)) != 0)
+ {
+ dbenv->err(dbenv, ret, "remove %s", *list);
+ apr_thread_exit(thd, 1);
+ }
+ free (begin);
+ }
+ }
+}
+
/* Checking for return values, and reporting errors. */
@@ -355,7 +391,11 @@
from those participating in the deadlock. */
SVN_ERR (DB_WRAP (fs, "setting deadlock detection policy",
fs->env->set_lk_detect (fs->env, DB_LOCK_RANDOM)));
-
+ /* For our purposes, 32k is too small of a log file buffer.
+ Kick it up to 256k to increase throughput. */
+ SVN_ERR (DB_WRAP (fs, "setting log file buffer size",
+ fs->env->set_lg_bsize (fs->env, 256 * 1024)));
+
return SVN_NO_ERROR;
}
@@ -441,8 +481,9 @@
svn_error_t *
svn_fs_open_berkeley (svn_fs_t *fs, const char *path)
{
+ apr_thread_t *tid;
svn_error_t *svn_err;
-
+ int ret;
SVN_ERR (check_already_open (fs));
/* Initialize paths. */
@@ -459,8 +500,12 @@
| DB_INIT_MPOOL
| DB_INIT_TXN),
0666));
+ if (svn_err) goto error;
+ ret = apr_thread_create (&tid, NULL, logfile_thread, (void *)(&fs->env), fs->pool);
+ if (ret != 0)
+ svn_err = svn_error_createf (SVN_ERR_BERKELEY_DB, 0, 0, fs->pool, "spawning log file removal thread");
if (svn_err) goto error;
-
+
/* Open the various databases. */
svn_err = DB_WRAP (fs, "opening `nodes' table",
svn_fs__open_nodes_table (&fs->nodes, fs->env, 0));
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:37:04 2006