You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2011/07/14 03:41:44 UTC
svn commit: r1146539 - in
/subversion/branches/fs-progress/subversion/libsvn_fs_fs: fs_fs.c
rep-cache-db.sql rep-cache.c rep-cache.h
Author: danielsh
Date: Thu Jul 14 01:41:43 2011
New Revision: 1146539
URL: http://svn.apache.org/viewvc?rev=1146539&view=rev
Log:
On the fs-progress branch, pass the approximate number of rep-cache rows to
the walker.
* subversion/libsvn_fs_fs/rep-cache-db.sql
(STMT_COUNT_REPS): New statement.
* subversion/libsvn_fs_fs/rep-cache.h
(svn_fs_fs__walk_rep_reference.walker): Add REPS_COUNT parameter.
* subversion/libsvn_fs_fs/rep-cache.c
(svn_fs_fs__walk_rep_reference):
Count representations and pass them to the walker.
* subversion/libsvn_fs_fs/fs_fs.c
Modified:
subversion/branches/fs-progress/subversion/libsvn_fs_fs/fs_fs.c
subversion/branches/fs-progress/subversion/libsvn_fs_fs/rep-cache-db.sql
subversion/branches/fs-progress/subversion/libsvn_fs_fs/rep-cache.c
subversion/branches/fs-progress/subversion/libsvn_fs_fs/rep-cache.h
Modified: subversion/branches/fs-progress/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/fs-progress/subversion/libsvn_fs_fs/fs_fs.c?rev=1146539&r1=1146538&r2=1146539&view=diff
==============================================================================
--- subversion/branches/fs-progress/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/branches/fs-progress/subversion/libsvn_fs_fs/fs_fs.c Thu Jul 14 01:41:43 2011
@@ -7786,6 +7786,7 @@ static svn_error_t *
verify_walker(representation_t *rep,
void *baton,
svn_fs_t *fs,
+ apr_int64_t reps_count,
apr_pool_t *scratch_pool)
{
struct rep_state *rs;
Modified: subversion/branches/fs-progress/subversion/libsvn_fs_fs/rep-cache-db.sql
URL: http://svn.apache.org/viewvc/subversion/branches/fs-progress/subversion/libsvn_fs_fs/rep-cache-db.sql?rev=1146539&r1=1146538&r2=1146539&view=diff
==============================================================================
--- subversion/branches/fs-progress/subversion/libsvn_fs_fs/rep-cache-db.sql (original)
+++ subversion/branches/fs-progress/subversion/libsvn_fs_fs/rep-cache-db.sql Thu Jul 14 01:41:43 2011
@@ -52,3 +52,8 @@ SELECT hash, revision, offset, size, exp
FROM rep_cache
+-- STMT_COUNT_REPS
+SELECT COUNT(*)
+FROM rep_cache
+
+
Modified: subversion/branches/fs-progress/subversion/libsvn_fs_fs/rep-cache.c
URL: http://svn.apache.org/viewvc/subversion/branches/fs-progress/subversion/libsvn_fs_fs/rep-cache.c?rev=1146539&r1=1146538&r2=1146539&view=diff
==============================================================================
--- subversion/branches/fs-progress/subversion/libsvn_fs_fs/rep-cache.c (original)
+++ subversion/branches/fs-progress/subversion/libsvn_fs_fs/rep-cache.c Thu Jul 14 01:41:43 2011
@@ -124,6 +124,7 @@ svn_fs_fs__walk_rep_reference(svn_fs_t *
svn_error_t *(*walker)(representation_t *,
void *,
svn_fs_t *,
+ apr_int64_t,
apr_pool_t *),
void *walker_baton,
svn_cancel_func_t cancel_func,
@@ -134,6 +135,7 @@ svn_fs_fs__walk_rep_reference(svn_fs_t *
svn_sqlite__stmt_t *stmt;
svn_boolean_t have_row;
int iterations = 0;
+ apr_int64_t reps_count;
apr_pool_t *iterpool = svn_pool_create(pool);
@@ -143,6 +145,15 @@ svn_fs_fs__walk_rep_reference(svn_fs_t *
if (! ffd->rep_cache_db)
SVN_ERR(svn_fs_fs__open_rep_cache(fs, pool));
+ /* Count the statements. (This is done without a transaction, so the number
+ might change by the time we get to STMT_GET_ALL_REPS.) */
+ SVN_ERR(svn_sqlite__get_statement(&stmt, ffd->rep_cache_db,
+ STMT_COUNT_REPS));
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
+ SVN_ERR_ASSERT(have_row);
+ reps_count = svn_sqlite__column_int64(stmt, 0);
+ SVN_ERR(svn_sqlite__reset(stmt));
+
/* Get the statement. (There are no arguments to bind.) */
SVN_ERR(svn_sqlite__get_statement(&stmt, ffd->rep_cache_db,
STMT_GET_ALL_REPS));
@@ -178,7 +189,7 @@ svn_fs_fs__walk_rep_reference(svn_fs_t *
SVN_ERR(rep_has_been_born(rep, fs, pool));
/* Walk. */
- SVN_ERR(walker(rep, walker_baton, fs, iterpool));
+ SVN_ERR(walker(rep, walker_baton, fs, reps_count, iterpool));
SVN_ERR(svn_sqlite__step(&have_row, stmt));
}
Modified: subversion/branches/fs-progress/subversion/libsvn_fs_fs/rep-cache.h
URL: http://svn.apache.org/viewvc/subversion/branches/fs-progress/subversion/libsvn_fs_fs/rep-cache.h?rev=1146539&r1=1146538&r2=1146539&view=diff
==============================================================================
--- subversion/branches/fs-progress/subversion/libsvn_fs_fs/rep-cache.h (original)
+++ subversion/branches/fs-progress/subversion/libsvn_fs_fs/rep-cache.h Thu Jul 14 01:41:43 2011
@@ -40,12 +40,14 @@ svn_error_t *
svn_fs_fs__open_rep_cache(svn_fs_t *fs,
apr_pool_t *pool);
-/* Iterate all representations currently in FS's cache. */
+/* Iterate all representations currently in FS's cache.
+ REPS_COUNT is approximate only. */
svn_error_t *
svn_fs_fs__walk_rep_reference(svn_fs_t *fs,
svn_error_t *(*walker)(representation_t *rep,
void *walker_baton,
svn_fs_t *fs,
+ apr_int64_t reps_count,
apr_pool_t *scratch_pool),
void *walker_baton,
svn_cancel_func_t cancel_func,