Justin Erenkrantz <justin@erenkrantz.com> writes:
> How did George resolve this for mod_db4? (This doesn't directly help
> ra_svn or SSH tunneling though, but can provide us with some
> insights.)
George said (in a private mail to me last week):
I use a shared-memory hash (the mm_hash.[ch] implementation which sits
on top of libmm, but which could sit on something else) that tracks
the reference count on the file. My wrapper around the open()
function in the DB_ENV struct then looks like this:
static int new_db_env_open(DB_ENV *dbenv, const char *db_home,
u_int32_t flags, int mode)
{
int ret =666;
DB_ENV *cached_dbenv;
flags |= DB_INIT_MPOOL;
/* if global ref count is 0, open for recovery */
if(global_ref_count_get(db_home) == 0) {
flags |= DB_RECOVER;
flags |= DB_INIT_TXN;
flags |= DB_CREATE;
}
if((cached_dbenv = retrieve_db_env(db_home)) != NULL) {
memcpy(dbenv, cached_dbenv, sizeof(DB_ENV));
ret = 0;
}
else if((ret = old_db_env_open(dbenv, db_home, flags, mode)) == 0) {
register_db_env(dbenv);
}
return ret;
}
If you have a single DBM file for a given subversion instance (I don't
know how svn exactly works internally), you can also just use a sysv
semaphore. The reason I didn't use that in mod_db4 is that it needed
to be able to support simultaneously managing an arbitrary number of
DB_ENVs.
I hope that helps, and I'm happy to participate further in the
discussion if that didn't fully answer your question.
George
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Dec 8 19:29:09 2004