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 2014/12/15 08:25:36 UTC

svn commit: r1645584 - in /subversion/trunk/subversion/libsvn_fs_x: ./ verify.c

Author: stefan2
Date: Mon Dec 15 07:25:35 2014
New Revision: 1645584

URL: http://svn.apache.org/r1645584
Log:
Sync FSX with FSFS.  Merge r1640061 from FSFS and resolve the usual
naming and text conflicts.

This ports the 'svnadmin verify --metadata-only' improvements to FSX.

Modified:
    subversion/trunk/subversion/libsvn_fs_x/   (props changed)
    subversion/trunk/subversion/libsvn_fs_x/verify.c

Propchange: subversion/trunk/subversion/libsvn_fs_x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Dec 15 07:25:35 2014
@@ -85,5 +85,5 @@
 /subversion/branches/verify-at-commit/subversion/libsvn_fs_x:1462039-1462408
 /subversion/branches/verify-keep-going/subversion/libsvn_fs_x:1439280-1492639,1546002-1546110
 /subversion/branches/wc-collate-path/subversion/libsvn_fs_x:1402685-1480384
-/subversion/trunk/subversion/libsvn_fs_fs:1415133-1596500,1596567,1597414,1597989,1598273,1599140,1600872,1601633,1603485-1603487,1603499,1603605,1604128,1604188,1604413-1604414,1604416-1604417,1604421,1604442,1604700,1604717,1604720,1604726,1604755,1604794,1604802,1604824,1604836,1604844,1604902-1604903,1604911,1604925,1604933,1604947,1605059-1605060,1605064-1605065,1605068,1605071-1605073,1605075,1605123,1605188-1605189,1605191,1605197,1605444,1605633,1606132,1606142,1606144,1606514,1606526,1606528,1606551,1606554,1606564,1606598-1606599,1606656,1606658,1606662,1606744,1606840,1607085,1607572,1612407,1612810,1613339,1613872,1614611,1615348,1615351-1615352,1615356,1616338-1616339,1616613,1617586,1617688,1618138,1618151,1618153,1618226,1618641,1618653,1618662,1619068,1619358,1619413,1619769,1619774,1620602,1620909,1620912,1620928,1620930,1621275,1621635,1622931,1622937,1622942,1622946,1622959-1622960,1622963,1622987,1623007,1623368,1623373,1623377,1623379,1623381,1623398,1623402,162
 4011,1624265,1624512,1626246,1626871,1626873,1626886,1627497-1627498,1627502,1627947-1627949,1627966,1628083,1628093,1628158-1628159,1628161,1628392-1628393,1628415,1628427,1628676,1628738,1628762,1628764,1629854-1629855,1629857,1629865,1629873,1629875,1629879,1630067,1630070,1631049-1631051,1631075,1631115,1631171,1631180,1631185-1631186,1631196-1631197,1631239-1631240,1631548,1631550,1631563,1631567,1631588,1631598,1632646,1632776,1632849,1632851-1632853,1632856-1632857,1632868,1632908,1632926,1633232,1633617-1633618,1634872,1634875,1634879-1634880,1634920,1636478,1636483,1636629,1637184,1637186,1637330,1637358,1637393,1639319,1639322,1639335,1639348,1639352,1639355,1639358,1639419,1639426,1639430,1639436,1639440,1639549,1640197,1640915,1641013,1643139,1643233
+/subversion/trunk/subversion/libsvn_fs_fs:1415133-1596500,1596567,1597414,1597989,1598273,1599140,1600872,1601633,1603485-1603487,1603499,1603605,1604128,1604188,1604413-1604414,1604416-1604417,1604421,1604442,1604700,1604717,1604720,1604726,1604755,1604794,1604802,1604824,1604836,1604844,1604902-1604903,1604911,1604925,1604933,1604947,1605059-1605060,1605064-1605065,1605068,1605071-1605073,1605075,1605123,1605188-1605189,1605191,1605197,1605444,1605633,1606132,1606142,1606144,1606514,1606526,1606528,1606551,1606554,1606564,1606598-1606599,1606656,1606658,1606662,1606744,1606840,1607085,1607572,1612407,1612810,1613339,1613872,1614611,1615348,1615351-1615352,1615356,1616338-1616339,1616613,1617586,1617688,1618138,1618151,1618153,1618226,1618641,1618653,1618662,1619068,1619358,1619413,1619769,1619774,1620602,1620909,1620912,1620928,1620930,1621275,1621635,1622931,1622937,1622942,1622946,1622959-1622960,1622963,1622987,1623007,1623368,1623373,1623377,1623379,1623381,1623398,1623402,162
 4011,1624265,1624512,1626246,1626871,1626873,1626886,1627497-1627498,1627502,1627947-1627949,1627966,1628083,1628093,1628158-1628159,1628161,1628392-1628393,1628415,1628427,1628676,1628738,1628762,1628764,1629854-1629855,1629857,1629865,1629873,1629875,1629879,1630067,1630070,1631049-1631051,1631075,1631115,1631171,1631180,1631185-1631186,1631196-1631197,1631239-1631240,1631548,1631550,1631563,1631567,1631588,1631598,1632646,1632776,1632849,1632851-1632853,1632856-1632857,1632868,1632908,1632926,1633232,1633617-1633618,1634872,1634875,1634879-1634880,1634920,1636478,1636483,1636629,1637184,1637186,1637330,1637358,1637393,1639319,1639322,1639335,1639348,1639352,1639355,1639358,1639419,1639426,1639430,1639436,1639440,1639549,1640061,1640197,1640915,1641013,1643139,1643233
 /subversion/trunk/subversion/libsvn_fs_x:1414756-1509914

Modified: subversion/trunk/subversion/libsvn_fs_x/verify.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/verify.c?rev=1645584&r1=1645583&r2=1645584&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/verify.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/verify.c Mon Dec 15 07:25:35 2014
@@ -22,6 +22,7 @@
 
 #include "verify.h"
 #include "fs_x.h"
+#include "svn_time.h"
 #include "private/svn_subr_private.h"
 
 #include "cached_data.h"
@@ -668,22 +669,67 @@ compare_p2l_to_rev(svn_fs_t *fs,
   return SVN_NO_ERROR;
 }
 
-/* Verify that the log-to-phys indexes and phys-to-log indexes are
- * consistent with each other.  The function signature is similar to
- * svn_fs_x__verify.
+/* Verify that the revprops of the revisions START to END in FS can be
+ * accessed.  Invoke CANCEL_FUNC with CANCEL_BATON at regular intervals.
  *
  * The values of START and END have already been auto-selected and
- * verified.  You may call this for format7 or higher repos.
+ * verified.
  */
 static svn_error_t *
-verify_index_consistency(svn_fs_t *fs,
-                         svn_revnum_t start,
-                         svn_revnum_t end,
-                         svn_fs_progress_notify_func_t notify_func,
-                         void *notify_baton,
-                         svn_cancel_func_t cancel_func,
-                         void *cancel_baton,
-                         apr_pool_t *pool)
+verify_revprops(svn_fs_t *fs,
+                svn_revnum_t start,
+                svn_revnum_t end,
+                svn_cancel_func_t cancel_func,
+                void *cancel_baton,
+                apr_pool_t *pool)
+{
+  svn_revnum_t revision;
+  apr_pool_t *iterpool = svn_pool_create(pool);
+
+  for (revision = start; revision < end; ++revision)
+    {
+      svn_string_t *date;
+      apr_time_t timetemp;
+
+      svn_pool_clear(iterpool);
+
+      /* Access the svn:date revprop.
+       * This implies parsing all revprops for that revision. */
+      SVN_ERR(svn_fs_x__revision_prop(&date, fs, revision,
+                                      SVN_PROP_REVISION_DATE, iterpool));
+
+      /* The time stamp is the only revprop that, if given, needs to
+       * have a valid content. */
+      if (date)
+        SVN_ERR(svn_time_from_cstring(&timetemp, date->data, iterpool));
+
+      if (cancel_func)
+        SVN_ERR(cancel_func(cancel_baton));
+    }
+
+  svn_pool_destroy(iterpool);
+
+  return SVN_NO_ERROR;
+}
+
+/* Verify that on-disk representation has not been tempered with (in a way
+ * that leaves the repository in a corrupted state).  This compares log-to-
+ * phys with phys-to-log indexes, verifies the low-level checksums and
+ * checks that all revprops are available.  The function signature is
+ * similar to svn_fs_x__verify.
+ *
+ * The values of START and END have already been auto-selected and
+ * verified.
+ */
+static svn_error_t *
+verify_metadata_consistency(svn_fs_t *fs,
+                            svn_revnum_t start,
+                            svn_revnum_t end,
+                            svn_fs_progress_notify_func_t notify_func,
+                            void *notify_baton,
+                            svn_cancel_func_t cancel_func,
+                            void *cancel_baton,
+                            apr_pool_t *pool)
 {
   svn_error_t *err;
   fs_x_data_t *ffd = fs->fsap_data;
@@ -718,6 +764,11 @@ verify_index_consistency(svn_fs_t *fs,
         err = compare_p2l_to_rev(fs, pack_start, pack_end - pack_start,
                                  cancel_func, cancel_baton, iterpool);
 
+      /* ensure that revprops are available and accessible */
+      if (!err)
+        err = verify_revprops(fs, pack_start, pack_end,
+                              cancel_func, cancel_baton, iterpool);
+
       /* concurrent packing is one of the reasons why verification may fail.
          Make sure, we operate on up-to-date information. */
       if (err)
@@ -768,9 +819,9 @@ svn_fs_x__verify(svn_fs_t *fs,
 
   /* log/phys index consistency.  We need to check them first to make
      sure we can access the rev / pack files in format7. */
-  SVN_ERR(verify_index_consistency(fs, start, end,
-                                   notify_func, notify_baton,
-                                   cancel_func, cancel_baton, pool));
+  SVN_ERR(verify_metadata_consistency(fs, start, end,
+                                      notify_func, notify_baton,
+                                      cancel_func, cancel_baton, pool));
 
   /* rep cache consistency */
   SVN_ERR(verify_rep_cache(fs, start, end, notify_func, notify_baton,