subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danie...@apache.org
Subject svn commit: r1213331 - in /subversion/trunk/subversion/libsvn_fs_fs: fs_fs.c rep-cache-db.sql rep-cache.c rep-cache.h
Date Mon, 12 Dec 2011 17:29:11 GMT
Author: danielsh
Date: Mon Dec 12 17:29:10 2011
New Revision: 1213331

URL: http://svn.apache.org/viewvc?rev=1213331&view=rev
Log:
Fix issue #4077: make 'svnadmin recover' truncate the rep-cache at the right point.

* subversion/libsvn_fs_fs/rep-cache.h
  (svn_fs_fs__del_rep_reference): New declaration.

* subversion/libsvn_fs_fs/rep-cache-db.sql
  (STMT_DEL_REPS_YOUNGER_THAN_REV): New statement.

* subversion/libsvn_fs_fs/rep-cache.c
  (svn_fs_fs__del_rep_reference): New definition.

* subversion/libsvn_fs_fs/fs_fs.c
  (recover_body): Call svn_fs_fs__del_rep_reference().

Modified:
    subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
    subversion/trunk/subversion/libsvn_fs_fs/rep-cache-db.sql
    subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c
    subversion/trunk/subversion/libsvn_fs_fs/rep-cache.h

Modified: subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c?rev=1213331&r1=1213330&r2=1213331&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Mon Dec 12 17:29:10 2011
@@ -7053,6 +7053,9 @@ recover_body(void *baton, apr_pool_t *po
                                max_rev);
     }
 
+  /* Prune younger-than-(newfound-youngest) revisions from the rep cache. */
+  SVN_ERR(svn_fs_fs__del_rep_reference(fs, max_rev, pool));
+
   /* Now store the discovered youngest revision, and the next IDs if
      relevant, in a new 'current' file. */
   return write_current(fs, max_rev, next_node_id, next_copy_id, pool);

Modified: subversion/trunk/subversion/libsvn_fs_fs/rep-cache-db.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/rep-cache-db.sql?rev=1213331&r1=1213330&r2=1213331&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/rep-cache-db.sql (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/rep-cache-db.sql Mon Dec 12 17:29:10 2011
@@ -52,3 +52,8 @@ SELECT hash, revision, offset, size, exp
 FROM rep_cache
 
 
+-- STMT_DEL_REPS_YOUNGER_THAN_REV
+DELETE FROM rep_cache
+WHERE revision >= ?1
+
+

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=1213331&r1=1213330&r2=1213331&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c Mon Dec 12 17:29:10 2011
@@ -331,3 +331,27 @@ svn_fs_fs__set_rep_reference(svn_fs_t *f
 
   return SVN_NO_ERROR;
 }
+
+
+svn_error_t *
+svn_fs_fs__del_rep_reference(svn_fs_t *fs,
+                             svn_revnum_t youngest,
+                             apr_pool_t *pool)
+{
+  fs_fs_data_t *ffd = fs->fsap_data;
+  svn_sqlite__stmt_t *stmt;
+  svn_boolean_t have_row;
+
+  SVN_ERR_ASSERT(ffd->rep_sharing_allowed);
+  if (! ffd->rep_cache_db)
+    SVN_ERR(svn_fs_fs__open_rep_cache(fs, pool));
+
+  SVN_ERR(svn_sqlite__get_statement(&stmt, ffd->rep_cache_db,
+                                    STMT_DEL_REPS_YOUNGER_THAN_REV));
+  SVN_ERR(svn_sqlite__bindf(stmt, "r", youngest+1));
+  SVN_ERR(svn_sqlite__step(&have_row, stmt));
+  /* ignore HAVE_ROW */
+
+  SVN_ERR(svn_sqlite__reset(stmt));
+  return SVN_NO_ERROR;
+}

Modified: subversion/trunk/subversion/libsvn_fs_fs/rep-cache.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/rep-cache.h?rev=1213331&r1=1213330&r2=1213331&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/rep-cache.h (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/rep-cache.h Mon Dec 12 17:29:10 2011
@@ -79,6 +79,13 @@ svn_fs_fs__set_rep_reference(svn_fs_t *f
                              svn_boolean_t reject_dup,
                              apr_pool_t *pool);
 
+/* Delete from the cache all reps corresponding to revisions younger
+   than YOUNGEST. */
+svn_error_t *
+svn_fs_fs__del_rep_reference(svn_fs_t *fs,
+                             svn_revnum_t youngest,
+                             apr_pool_t *pool);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */



Mime
View raw message