You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2012/10/20 18:17:29 UTC

svn commit: r1400486 - in /subversion/trunk/subversion: include/svn_error_codes.h libsvn_fs_fs/fs_fs.c

Author: stefan2
Date: Sat Oct 20 16:17:28 2012
New Revision: 1400486

URL: http://svn.apache.org/viewvc?rev=1400486&view=rev
Log:
Write a server log entry if the revprop cache initialization has failed
or the cache would be inefficient.

* subversion/include/svn_error_codes.h
  (SVN_ERR_FS_REPPROP_CACHE_INIT_FAILURE): new error / warning code
* subversion/libsvn_fs_fs/fs_fs.c
  (ensure_revprop_generation): typo in comment
  (log_revprop_cache_init_warning): new utility
  (has_revprop_cache): log warnings if revprop infra failed to create

Modified:
    subversion/trunk/subversion/include/svn_error_codes.h
    subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c

Modified: subversion/trunk/subversion/include/svn_error_codes.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_error_codes.h?rev=1400486&r1=1400485&r2=1400486&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_error_codes.h (original)
+++ subversion/trunk/subversion/include/svn_error_codes.h Sat Oct 20 16:17:28 2012
@@ -782,6 +782,11 @@ SVN_ERROR_START
              SVN_ERR_FS_CATEGORY_START + 51,
              "A packed revprop could not be read")
 
+  /** @since New in 1.8. */
+  SVN_ERRDEF(SVN_ERR_FS_REPPROP_CACHE_INIT_FAILURE,
+             SVN_ERR_FS_CATEGORY_START + 52,
+             "Could not initialize the revprop caching infrastructure.")
+
   /* repos errors */
 
   SVN_ERRDEF(SVN_ERR_REPOS_LOCKED,

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=1400486&r1=1400485&r2=1400486&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Sat Oct 20 16:17:28 2012
@@ -3151,7 +3151,7 @@ ensure_revprop_generation(svn_fs_t *fs, 
                                     TRUE));
 
       /* If the generation is at 0, we just created a new namespace
-       * (it would be at least 2 otherwise). Read the lastest generation
+       * (it would be at least 2 otherwise). Read the latest generation
        * from disk and if we are the first one to initialize the atomic
        * (i.e. is still 0), set it to the value just gotten.
        */
@@ -3182,6 +3182,21 @@ ensure_revprop_timeout(svn_fs_t *fs)
     : SVN_NO_ERROR;
 }
 
+/* Create an error object with the given MESSAGE and pass it to the
+   WARNING member of FS. */
+static void
+log_revprop_cache_init_warning(svn_fs_t *fs, const char *message)
+{
+  svn_error_t *err = svn_error_createf(SVN_ERR_FS_REPPROP_CACHE_INIT_FAILURE,
+                                       NULL,
+                                       message, fs->path);
+
+  if (fs->warning)
+    (fs->warning)(fs->warning_baton, err);
+  
+  svn_error_clear(err);
+}
+
 /* Test whether revprop cache and necessary infrastructure are
    available in FS. */
 static svn_boolean_t
@@ -3201,6 +3216,9 @@ has_revprop_cache(svn_fs_t *fs, apr_pool
        * -> disable the revprop cache for good
        */
       ffd->revprop_cache = NULL;
+      log_revprop_cache_init_warning(fs, "Disable revprop caching for '%s'"
+                                         " because it is inefficient.");
+      
       return FALSE;
     }
 
@@ -3212,6 +3230,9 @@ has_revprop_cache(svn_fs_t *fs, apr_pool
 
       svn_error_clear(error);
       ffd->revprop_cache = NULL;
+      log_revprop_cache_init_warning(fs, "Failed to initialize SHM "
+                                         "infrastructure for revprop "
+                                         "caching in '%s'.");
 
       return FALSE;
     }