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 2012/02/28 08:43:39 UTC

svn commit: r1294501 - in /subversion/trunk/subversion: include/svn_fs.h libsvn_fs_fs/rep-cache-db.sql libsvn_fs_fs/rep-cache.c

Author: danielsh
Date: Tue Feb 28 07:43:39 2012
New Revision: 1294501

URL: http://svn.apache.org/viewvc?rev=1294501&view=rev
Log:
Follow-up to r1294495: re-teach svn_fs_fs__walk_rep_reference() to check
that rep-cache.db doesn't contain revisions younger than the youngest.

* subversion/include/svn_fs.h
  (svn_fs_verify):
    Document that 'verify -r0' verifies global invariants.

* subversion/libsvn_fs_fs/rep-cache.c
  (svn_fs_fs__walk_rep_reference):
    Verify the above-mentioned global invariant when START == r0.
    Don't bother verifying REP's validity -- the change to the WHERE
    clause in r1294495 makes that redundant.

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

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

Modified: subversion/trunk/subversion/include/svn_fs.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_fs.h?rev=1294501&r1=1294500&r2=1294501&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_fs.h (original)
+++ subversion/trunk/subversion/include/svn_fs.h Tue Feb 28 07:43:39 2012
@@ -251,7 +251,8 @@ svn_fs_upgrade(const char *path,
  * Use @a pool for necessary allocations.
  *
  * @a start and @a end may be #SVN_INVALID_REVNUM, in which case
- * svn_repos_verify_fs2()'s semantics apply.
+ * svn_repos_verify_fs2()'s semantics apply.  When @c r0 is being
+ * verified, global invariants may be verified as well.
  *
  * @note You probably don't want to use this directly.  Take a look at
  * svn_repos_verify_fs2() instead, which does non-backend-specific

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=1294501&r1=1294500&r2=1294501&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/rep-cache-db.sql (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/rep-cache-db.sql Tue Feb 28 07:43:39 2012
@@ -53,6 +53,11 @@ FROM rep_cache
 WHERE revision >= ?1 AND revision <= ?2
 
 
+-- STMT_GET_MAX_REV
+SELECT MAX(revision)
+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=1294501&r1=1294500&r2=1294501&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c Tue Feb 28 07:43:39 2012
@@ -148,6 +148,20 @@ svn_fs_fs__walk_rep_reference(svn_fs_t *
   if (! ffd->rep_cache_db)
     SVN_ERR(svn_fs_fs__open_rep_cache(fs, pool));
 
+  /* Check global invariants. */
+  if (start == 0)
+    {
+      svn_sqlite__stmt_t *stmt2;
+      svn_revnum_t max;
+
+      SVN_ERR(svn_sqlite__get_statement(&stmt2, ffd->rep_cache_db,
+                                        STMT_GET_MAX_REV));
+      SVN_ERR(svn_sqlite__step(&have_row, stmt2));
+      max = svn_sqlite__column_revnum(stmt2, 0);
+      SVN_ERR(svn_fs_fs__revision_exists(max, fs, iterpool));
+      SVN_ERR(svn_sqlite__reset(stmt2));
+    }
+
   /* Get the statement. (There are no arguments to bind.) */
   SVN_ERR(svn_sqlite__get_statement(&stmt, ffd->rep_cache_db,
                                     STMT_GET_REPS_FOR_RANGE));
@@ -180,10 +194,6 @@ svn_fs_fs__walk_rep_reference(svn_fs_t *
       rep->size = svn_sqlite__column_int64(stmt, 3);
       rep->expanded_size = svn_sqlite__column_int64(stmt, 4);
 
-      /* Sanity check. */
-      if (rep)
-        SVN_ERR(rep_has_been_born(rep, fs, iterpool));
-
       /* Walk. */
       SVN_ERR(walker(rep, walker_baton, fs, iterpool));