FreeBSD/contrib/subversion/subversion/libsvn_fs_x/verify.c
/* 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.
 */
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.
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 *scratch_pool)
{
  svn_error_t *err;
  svn_fs_x__data_t *ffd = fs->fsap_data;
  svn_revnum_t revision, next_revision;
  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
  for (revision = start; revision <= end; revision = next_revision)
    {
      svn_revnum_t count = svn_fs_x__packed_base_rev(fs, revision);
      svn_revnum_t pack_start = count;
      svn_revnum_t pack_end = pack_start + svn_fs_x__pack_size(fs, revision);
      svn_pool_clear(iterpool);
      if (notify_func && (pack_start % ffd->max_files_per_dir == 0))
        notify_func(pack_start, notify_baton, iterpool);
      err = verify_index_checksums(fs, pack_start, cancel_func,
                                   cancel_baton, iterpool);
      if (!err)
        err = compare_l2p_to_p2l_index(fs, pack_start, pack_end - pack_start,
                                       cancel_func, cancel_baton, iterpool);
      if (!err)
        err = compare_p2l_to_l2p_index(fs, pack_start, pack_end - pack_start,
                                       cancel_func, cancel_baton, iterpool);
      if (!err)
        err = compare_p2l_to_rev(fs, pack_start, pack_end - pack_start,
                                 cancel_func, cancel_baton, iterpool);
      if (!err)
        err = verify_revprops(fs, pack_start, pack_end,
                              cancel_func, cancel_baton, iterpool);
      if (err)
        SVN_ERR(svn_fs_x__read_min_unpacked_rev(&ffd->min_unpacked_rev,
                                                fs, scratch_pool));
      if (err && count != svn_fs_x__pack_size(fs, revision))
        {
          svn_error_clear(err);
          next_revision = svn_fs_x__packed_base_rev(fs, revision);
        }
      else
        {
          SVN_ERR(err);
          next_revision = pack_end;
        }
    }
  svn_pool_destroy(iterpool);
  return SVN_NO_ERROR;
}
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 * scratch_pool ) { svn_error_t * err ; svn_fs_x__data_t * ffd = fs -> fsap_data ; svn_revnum_t revision , next_revision ; apr_pool_t * iterpool = svn_pool_create ( scratch_pool ) ; for ( revision = start ; revision <= end ; revision = next_revision ) { svn_revnum_t count = svn_fs_x__packed_base_rev ( fs , revision ) ; svn_revnum_t pack_start = count ; svn_revnum_t pack_end = pack_start + svn_fs_x__pack_size ( fs , revision ) ; svn_pool_clear ( iterpool ) ; if ( notify_func && ( pack_start % ffd -> max_files_per_dir == 0 ) ) notify_func ( pack_start , notify_baton , iterpool ) ; err = verify_index_checksums ( fs , pack_start , cancel_func , cancel_baton , iterpool ) ; if ( ! err ) err = compare_l2p_to_p2l_index ( fs , pack_start , pack_end - pack_start , cancel_func , cancel_baton , iterpool ) ; if ( ! err ) err = compare_p2l_to_l2p_index ( fs , pack_start , pack_end - pack_start , cancel_func , cancel_baton , iterpool ) ; if ( ! err ) err = compare_p2l_to_rev ( fs , pack_start , pack_end - pack_start , cancel_func , cancel_baton , iterpool ) ; if ( ! err ) err = verify_revprops ( fs , pack_start , pack_end , cancel_func , cancel_baton , iterpool ) ; if ( err ) SVN_ERR ( svn_fs_x__read_min_unpacked_rev ( & ffd -> min_unpacked_rev , fs , scratch_pool ) ) ; if ( err && count != svn_fs_x__pack_size ( fs , revision ) ) { svn_error_clear ( err ) ; next_revision = svn_fs_x__packed_base_rev ( fs , revision ) ; } else { SVN_ERR ( err ) ; next_revision = pack_end ; } } 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).
Verify that on - disk representation has not been tempered with ( in a way that leaves the repository in a corrupted state ) .
/* Check for external corruption to the indexes. */ /* two-way index check */ /* verify in-index checksums and types vs. actual rev / pack files */ /* ensure that revprops are available and accessible */ /* concurrent packing is one of the reasons why verification may fail.
         Make sure, we operate on up-to-date information. */ /* retry the whole shard if it got packed in the meantime */ /* We could simply assign revision here but the code below is
             more intuitive to maintainers. */