Author: danielsh
Date: Wed Jul 20 16:28:57 2011
New Revision: 1148833

URL: http://svn.apache.org/viewvc?rev=1148833&view=rev
Log:
On the 1.7.x-fs-verify branch, merge r1146534 r1148830 r1148831 from trunk.

Modified:
    subversion/branches/1.7.x-fs-verify/   (props changed)
    subversion/branches/1.7.x-fs-verify/subversion/libsvn_fs_fs/fs_fs.c
    subversion/branches/1.7.x-fs-verify/subversion/libsvn_fs_fs/rep-cache.c
    subversion/branches/1.7.x-fs-verify/subversion/libsvn_fs_fs/rep-cache.h

Propchange: subversion/branches/1.7.x-fs-verify/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul 20 16:28:57 2011
@@ -53,4 +53,4 @@
 /subversion/branches/tree-conflicts:868291-873154
 /subversion/branches/tree-conflicts-notify:873926-874008
 /subversion/branches/uris-as-urls:1060426-1064427
-/subversion/trunk:1146131,1146134,1146149,1146153,1146222,1146225-1146226,1146251,1146507,1146510-1146512,1146525,1146528,1146770
+/subversion/trunk:1146131,1146134,1146149,1146153,1146222,1146225-1146226,1146251,1146507,1146510-1146512,1146525,1146528,1146534,1146770,1148830-1148831

Modified: subversion/branches/1.7.x-fs-verify/subversion/libsvn_fs_fs/fs_fs.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/1.7.x-fs-verify/subversion/libsvn_fs_fs/fs_fs.c?rev=1148833&r1=1148832&r2=1148833&view=diff
==============================================================================
--- subversion/branches/1.7.x-fs-verify/subversion/libsvn_fs_fs/fs_fs.c 
(original)
+++ subversion/branches/1.7.x-fs-verify/subversion/libsvn_fs_fs/fs_fs.c Wed Jul 
20 16:28:57 2011
@@ -7789,6 +7789,7 @@ svn_fs_fs__pack(svn_fs_t *fs,
    Implements svn_fs_fs__walk_rep_reference().walker.  */
 static svn_error_t *
 verify_walker(representation_t *rep,
+              void *baton,
               svn_fs_t *fs,
               apr_pool_t *scratch_pool)
 {
@@ -7808,14 +7809,19 @@ svn_fs_fs__verify(svn_fs_t *fs,
                   apr_pool_t *pool)
 {
   fs_fs_data_t *ffd = fs->fsap_data;
+  svn_boolean_t exists;
 
   if (ffd->format < SVN_FS_FS__MIN_REP_SHARING_FORMAT)
     return SVN_NO_ERROR;
 
-  /* Don't take any lock. */
-  SVN_ERR(svn_fs_fs__walk_rep_reference(fs, verify_walker,
-                                        cancel_func, cancel_baton,
-                                        pool));
+  /* Do not attempt to walk the rep-cache database if its file does not exists,
+     since doing so would create it --- which may confuse the administrator. */
+  SVN_ERR(svn_fs_fs__exists_rep_cache(&exists, fs, pool));
+  if (exists)
+    /* Don't take any lock. */
+    SVN_ERR(svn_fs_fs__walk_rep_reference(fs, verify_walker, NULL,
+                                          cancel_func, cancel_baton,
+                                          pool));
 
   return SVN_NO_ERROR;
 }

Modified: 
subversion/branches/1.7.x-fs-verify/subversion/libsvn_fs_fs/rep-cache.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/1.7.x-fs-verify/subversion/libsvn_fs_fs/rep-cache.c?rev=1148833&r1=1148832&r2=1148833&view=diff
==============================================================================
--- subversion/branches/1.7.x-fs-verify/subversion/libsvn_fs_fs/rep-cache.c 
(original)
+++ subversion/branches/1.7.x-fs-verify/subversion/libsvn_fs_fs/rep-cache.c Wed 
Jul 20 16:28:57 2011
@@ -43,7 +43,12 @@ REP_CACHE_DB_SQL_DECLARE_STATEMENTS(stat
 
 
 /** Helper functions. **/
-
+static APR_INLINE const char *
+path_rep_cache_db(const char *fs_path,
+                  apr_pool_t *result_pool)
+{
+  return svn_dirent_join(fs_path, REP_CACHE_DB_NAME, result_pool);
+}
 
 /* Check that REP refers to a revision that exists in FS. */
 static svn_error_t *
@@ -91,7 +96,7 @@ open_rep_cache(void *baton,
 
   /* 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);
+  db_path = path_rep_cache_db(fs->path, pool);
   SVN_ERR(svn_sqlite__open(&ffd->rep_cache_db, db_path,
                            svn_sqlite__mode_rwcreate, statements,
                            0, NULL,
@@ -120,10 +125,25 @@ svn_fs_fs__open_rep_cache(svn_fs_t *fs,
 }
 
 svn_error_t *
+svn_fs_fs__exists_rep_cache(svn_boolean_t *exists,
+                            svn_fs_t *fs, apr_pool_t *pool)
+{
+  svn_node_kind_t kind;
+
+  SVN_ERR(svn_io_check_path(path_rep_cache_db(fs->path, pool),
+                            &kind, pool));
+
+  *exists = (kind != svn_node_none);
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
 svn_fs_fs__walk_rep_reference(svn_fs_t *fs,
                               svn_error_t *(*walker)(representation_t *,
+                                                     void *,
                                                      svn_fs_t *, 
                                                      apr_pool_t *),
+                              void *walker_baton,
                               svn_cancel_func_t cancel_func,
                               void *cancel_baton,
                               apr_pool_t *pool)
@@ -176,7 +196,7 @@ svn_fs_fs__walk_rep_reference(svn_fs_t *
         SVN_ERR(rep_has_been_born(rep, fs, iterpool));
 
       /* Walk. */
-      SVN_ERR(walker(rep, fs, iterpool));
+      SVN_ERR(walker(rep, walker_baton, fs, iterpool));
 
       SVN_ERR(svn_sqlite__step(&have_row, stmt));
     }

Modified: 
subversion/branches/1.7.x-fs-verify/subversion/libsvn_fs_fs/rep-cache.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/1.7.x-fs-verify/subversion/libsvn_fs_fs/rep-cache.h?rev=1148833&r1=1148832&r2=1148833&view=diff
==============================================================================
--- subversion/branches/1.7.x-fs-verify/subversion/libsvn_fs_fs/rep-cache.h 
(original)
+++ subversion/branches/1.7.x-fs-verify/subversion/libsvn_fs_fs/rep-cache.h Wed 
Jul 20 16:28:57 2011
@@ -40,12 +40,19 @@ svn_error_t *
 svn_fs_fs__open_rep_cache(svn_fs_t *fs,
                           apr_pool_t *pool);
 
+/* Set *EXISTS to TRUE iff the rep-cache DB file exists. */
+svn_error_t *
+svn_fs_fs__exists_rep_cache(svn_boolean_t *exists,
+                            svn_fs_t *fs, apr_pool_t *pool);
+
 /* Iterate all representations currently in FS's cache. */
 svn_error_t *
 svn_fs_fs__walk_rep_reference(svn_fs_t *fs,
                               svn_error_t *(*walker)(representation_t *rep,
+                                                     void *walker_baton,
                                                      svn_fs_t *fs, 
                                                      apr_pool_t *scratch_pool),
+                              void *walker_baton,
                               svn_cancel_func_t cancel_func,
                               void *cancel_baton,
                               apr_pool_t *pool);


Reply via email to