subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danie...@apache.org
Subject svn commit: r1148831 - in /subversion/trunk/subversion/libsvn_fs_fs: fs_fs.c rep-cache.c rep-cache.h
Date Wed, 20 Jul 2011 16:22:59 GMT
Author: danielsh
Date: Wed Jul 20 16:22:57 2011
New Revision: 1148831

URL: http://svn.apache.org/viewvc?rev=1148831&view=rev
Log:
Make 'svnadmin verify' not create rep-cache.db when it doesn't exist.

* subversion/libsvn_fs_fs/fs_fs.c
  (svn_fs_fs__verify): Check the rep-cache exists before walking it.
    (This check-and-walk is racy --- the file could be removed, or created,
    after we stat() it --- but that's not a concern.)

* subversion/libsvn_fs_fs/rep-cache.h,
  subversion/libsvn_fs_fs/rep-cache.c
  (svn_fs_fs__exists_rep_cache): New function.

Modified:
    subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
    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=1148831&r1=1148830&r2=1148831&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Wed Jul 20 16:22:57 2011
@@ -7804,14 +7804,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, NULL,
-                                        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/trunk/subversion/libsvn_fs_fs/rep-cache.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c?rev=1148831&r1=1148830&r2=1148831&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c Wed Jul 20 16:22:57 2011
@@ -125,6 +125,19 @@ 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 *,

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=1148831&r1=1148830&r2=1148831&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/rep-cache.h (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/rep-cache.h Wed Jul 20 16:22:57 2011
@@ -40,6 +40,11 @@ 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,



Mime
View raw message