You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2010/04/15 23:42:13 UTC
svn commit: r934603 - in /subversion/trunk/subversion/libsvn_fs_fs: fs.h
rep-cache.c
Author: danielsh
Date: Thu Apr 15 21:42:12 2010
New Revision: 934603
URL: http://svn.apache.org/viewvc?rev=934603&view=rev
Log:
In FSFS, open the FS object's rep-cache atomically. Extend fs_fs_data_t
and svn_atomic__init_once() to support this. This is a follow-up to the
issue #3506 fixes.
Found by: philip
* subversion/libsvn_fs_fs/fs.h
(svn_atomic.h): Include.
(fs_fs_data_t): New member 'rep_cache_db_opened'.
* subversion/libsvn_fs_fs/rep-cache.c
(open_rep_cache):
Renamed from 'svn_fs_fs__open_rep_cache'.
Drop the "is the rep-cache DB already open" check.
(svn_fs_fs__open_rep_cache):
Now a wrapper around open_rep_cache(). Call it exactly once per FS
object, using the svn_atomic__init_once().
Modified:
subversion/trunk/subversion/libsvn_fs_fs/fs.h
subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c
Modified: subversion/trunk/subversion/libsvn_fs_fs/fs.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs.h?rev=934603&r1=934602&r2=934603&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/fs.h (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/fs.h Thu Apr 15 21:42:12 2010
@@ -30,6 +30,7 @@
#include "svn_fs.h"
#include "svn_config.h"
+#include "private/svn_atomic.h"
#include "private/svn_cache.h"
#include "private/svn_fs_private.h"
#include "private/svn_sqlite.h"
@@ -245,6 +246,9 @@ typedef struct
/* The sqlite database used for rep caching. */
svn_sqlite__db_t *rep_cache_db;
+ /* Thread-safe boolean */
+ svn_atomic_t rep_cache_db_opened;
+
/* The sqlite database used for revprops. */
svn_sqlite__db_t *revprop_db;
Modified: subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c?rev=934603&r1=934602&r2=934603&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c Thu Apr 15 21:42:12 2010
@@ -38,18 +38,15 @@
REP_CACHE_DB_SQL_DECLARE_STATEMENTS(statements);
-svn_error_t *
-svn_fs_fs__open_rep_cache(svn_fs_t *fs,
- apr_pool_t *pool)
+static svn_error_t *
+open_rep_cache(void *baton,
+ apr_pool_t *pool)
{
+ svn_fs_t *fs = baton;
fs_fs_data_t *ffd = fs->fsap_data;
const char *db_path;
int version;
- /* Be idempotent. */
- if (ffd->rep_cache_db)
- return SVN_NO_ERROR;
-
/* Open (or create) the sqlite database. It will be automatically
closed when fs->pool is destoyed. */
db_path = svn_dirent_join(fs->path, REP_CACHE_DB_NAME, pool);
@@ -71,6 +68,15 @@ svn_fs_fs__open_rep_cache(svn_fs_t *fs,
}
svn_error_t *
+svn_fs_fs__open_rep_cache(svn_fs_t *fs,
+ apr_pool_t *pool)
+{
+ fs_fs_data_t *ffd = fs->fsap_data;
+ return svn_error_return(svn_atomic__init_once(&ffd->rep_cache_db_opened,
+ open_rep_cache, fs, pool));
+}
+
+svn_error_t *
svn_fs_fs__get_rep_reference(representation_t **rep,
svn_fs_t *fs,
svn_checksum_t *checksum,