subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1674673 - /subversion/trunk/subversion/libsvn_fs_fs/transaction.c
Date Sun, 19 Apr 2015 19:10:39 GMT
Author: stefan2
Date: Sun Apr 19 19:10:39 2015
New Revision: 1674673

URL: http://svn.apache.org/r1674673
Log:
Issue a warning when we had a rep-cache hit on SHA1 but
the fulltext sizes don't match (likely corruption).

Completely halting service by returning an error seems
inappropriate b/c we know how to handle the situation
gracefully and an admin may not always be available to
fix the problem in a timely manner.  Repeated attempts
on committing the "offending" change would likely tigger
the error over and over again.

* subversion/libsvn_fs_fs/transaction.c
  (get_shared_rep): Log the details of the mismatch.

Suggested by: julianfoad

Modified:
    subversion/trunk/subversion/libsvn_fs_fs/transaction.c

Modified: subversion/trunk/subversion/libsvn_fs_fs/transaction.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/transaction.c?rev=1674673&r1=1674672&r2=1674673&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/transaction.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/transaction.c Sun Apr 19 19:10:39 2015
@@ -25,6 +25,7 @@
 #include <assert.h>
 #include <apr_sha1.h>
 
+#include "svn_error_codes.h"
 #include "svn_hash.h"
 #include "svn_props.h"
 #include "svn_sorts.h"
@@ -2214,6 +2215,33 @@ get_shared_rep(representation_t **old_re
   /* A simple guard against general rep-cache induced corruption. */
   if ((*old_rep)->expanded_size != rep->expanded_size)
     {
+      /* Make the problem show up in the server log.
+
+         Because not sharing reps is always a save option,
+         completely terminating the server process would
+         be inappropriate.
+       */
+      svn_checksum_t checksum;
+      checksum.digest = rep->sha1_digest;
+      checksum.kind = svn_checksum_sha1;
+
+      err = svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
+                              "Rep size %s mismatches rep-cache.db value %s "
+                              "for SHA1 %s.\n"
+                              "You should delete the rep-cache.db and "
+                              "verify the repository. The cached rep will "
+                              "not be shared.",
+                              apr_psprintf(scratch_pool, "%" APR_OFF_T_FMT,
+                                           rep->expanded_size),
+                              apr_psprintf(scratch_pool, "%" APR_OFF_T_FMT,
+                                           (*old_rep)->expanded_size),
+                              svn_checksum_to_cstring_display(&checksum,
+                                                              scratch_pool));
+
+      (fs->warning)(fs->warning_baton, err);
+      svn_error_clear(err);
+
+      /* Ignore the shared rep. */
       *old_rep = NULL;
     }
   else



Mime
View raw message