Author: stefan2
Date: Fri Aug 22 16:55:51 2014
New Revision: 1619862

URL: http://svn.apache.org/r1619862
Log:
On the revprop-caching-ng branch:  Make the atomic revprop change API
work even in the case of stale caches.

When writing revprops, always read the original from disk instead of
from cache.

* subversion/libsvn_fs_fs/revprops.h
  (svn_fs_fs__get_revision_proplist): Add BYPASS_CACHE option.

* subversion/libsvn_fs_fs/revprops.c
  (svn_fs_fs__get_revision_proplist): Skip cache lookup when the
                                      bypass option is set.

* subversion/libsvn_fs_fs/fs_fs.c
  (svn_fs_fs__revision_prop): r/o access may use the cache.
  (change_rev_prop_body): r/w access shall bypass them.

* subversion/libsvn_fs_fs/fs.c
  (fs_revision_proplist): New simple signature adapter.
  (fs_vtable): Call the adapter as it has the correct signature.

Modified:
    subversion/branches/revprop-caching-ng/subversion/libsvn_fs_fs/fs.c
    subversion/branches/revprop-caching-ng/subversion/libsvn_fs_fs/fs_fs.c
    subversion/branches/revprop-caching-ng/subversion/libsvn_fs_fs/revprops.c
    subversion/branches/revprop-caching-ng/subversion/libsvn_fs_fs/revprops.h

Modified: subversion/branches/revprop-caching-ng/subversion/libsvn_fs_fs/fs.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/revprop-caching-ng/subversion/libsvn_fs_fs/fs.c?rev=1619862&r1=1619861&r2=1619862&view=diff
==============================================================================
--- subversion/branches/revprop-caching-ng/subversion/libsvn_fs_fs/fs.c 
(original)
+++ subversion/branches/revprop-caching-ng/subversion/libsvn_fs_fs/fs.c Fri Aug 
22 16:55:51 2014
@@ -214,6 +214,20 @@ fs_info(const void **fsfs_info,
   return SVN_NO_ERROR;
 }
 
+/* Wrapper around svn_fs_fs__get_revision_proplist() adapting between function
+   signatures. */
+static svn_error_t *
+fs_revision_proplist(apr_hash_t **proplist_p,
+                     svn_fs_t *fs,
+                     svn_revnum_t rev,
+                     apr_pool_t *pool)
+{
+  /* No need to bypass the caches for r/o access to revprops. */
+  return svn_error_trace(svn_fs_fs__get_revision_proplist(proplist_p, fs,
+                                                          rev, FALSE, pool));
+}
+
+
 /* Wrapper around svn_fs_fs__set_uuid() adapting between function
    signatures. */
 static svn_error_t *
@@ -232,7 +246,7 @@ fs_set_uuid(svn_fs_t *fs,
 static fs_vtable_t fs_vtable = {
   svn_fs_fs__youngest_rev,
   svn_fs_fs__revision_prop,
-  svn_fs_fs__get_revision_proplist,
+  fs_revision_proplist,
   svn_fs_fs__change_rev_prop,
   fs_set_uuid,
   svn_fs_fs__revision_root,

Modified: subversion/branches/revprop-caching-ng/subversion/libsvn_fs_fs/fs_fs.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/revprop-caching-ng/subversion/libsvn_fs_fs/fs_fs.c?rev=1619862&r1=1619861&r2=1619862&view=diff
==============================================================================
--- subversion/branches/revprop-caching-ng/subversion/libsvn_fs_fs/fs_fs.c 
(original)
+++ subversion/branches/revprop-caching-ng/subversion/libsvn_fs_fs/fs_fs.c Fri 
Aug 22 16:55:51 2014
@@ -1946,7 +1946,7 @@ svn_fs_fs__revision_prop(svn_string_t **
   apr_hash_t *table;
 
   SVN_ERR(svn_fs__check_fs(fs, TRUE));
-  SVN_ERR(svn_fs_fs__get_revision_proplist(&table, fs, rev, pool));
+  SVN_ERR(svn_fs_fs__get_revision_proplist(&table, fs, rev, FALSE, pool));
 
   *value_p = svn_hash_gets(table, propname);
 
@@ -1972,7 +1972,8 @@ change_rev_prop_body(void *baton, apr_po
   struct change_rev_prop_baton *cb = baton;
   apr_hash_t *table;
 
-  SVN_ERR(svn_fs_fs__get_revision_proplist(&table, cb->fs, cb->rev, pool));
+  SVN_ERR(svn_fs_fs__get_revision_proplist(&table, cb->fs, cb->rev, TRUE,
+                                           pool));
 
   if (cb->old_value_p)
     {

Modified: 
subversion/branches/revprop-caching-ng/subversion/libsvn_fs_fs/revprops.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/revprop-caching-ng/subversion/libsvn_fs_fs/revprops.c?rev=1619862&r1=1619861&r2=1619862&view=diff
==============================================================================
--- subversion/branches/revprop-caching-ng/subversion/libsvn_fs_fs/revprops.c 
(original)
+++ subversion/branches/revprop-caching-ng/subversion/libsvn_fs_fs/revprops.c 
Fri Aug 22 16:55:51 2014
@@ -911,6 +911,7 @@ svn_error_t *
 svn_fs_fs__get_revision_proplist(apr_hash_t **proplist_p,
                                  svn_fs_t *fs,
                                  svn_revnum_t rev,
+                                 svn_boolean_t bypass_cache,
                                  apr_pool_t *pool)
 {
   fs_fs_data_t *ffd = fs->fsap_data;
@@ -923,7 +924,7 @@ svn_fs_fs__get_revision_proplist(apr_has
   SVN_ERR(svn_fs_fs__ensure_revision_exists(rev, fs, pool));
 
   /* Try cache lookup first. */
-  if (has_revprop_cache(fs, pool))
+  if (!bypass_cache && has_revprop_cache(fs, pool))
     {
       svn_boolean_t is_cached;
       pair_cache_key_t key = { 0 };

Modified: 
subversion/branches/revprop-caching-ng/subversion/libsvn_fs_fs/revprops.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/revprop-caching-ng/subversion/libsvn_fs_fs/revprops.h?rev=1619862&r1=1619861&r2=1619862&view=diff
==============================================================================
--- subversion/branches/revprop-caching-ng/subversion/libsvn_fs_fs/revprops.h 
(original)
+++ subversion/branches/revprop-caching-ng/subversion/libsvn_fs_fs/revprops.h 
Fri Aug 22 16:55:51 2014
@@ -68,6 +68,7 @@ svn_fs_fs__upgrade_cleanup_pack_revprops
                                          apr_pool_t *scratch_pool);
 
 /* Read the revprops for revision REV in FS and return them in *PROPERTIES_P.
+ * If BYPASS_CACHE is set, don't consult the disks but always read from disk.
  *
  * Allocations will be done in POOL.
  */
@@ -75,6 +76,7 @@ svn_error_t *
 svn_fs_fs__get_revision_proplist(apr_hash_t **proplist_p,
                                  svn_fs_t *fs,
                                  svn_revnum_t rev,
+                                 svn_boolean_t bypass_cache,
                                  apr_pool_t *pool);
 
 /* Set the revision property list of revision REV in filesystem FS to


Reply via email to