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 2013/01/28 01:10:38 UTC
svn commit: r1439212 - in /subversion/trunk/subversion/libsvn_fs_fs: fs_fs.c
rep-cache.c rep-cache.h
Author: stefan2
Date: Mon Jan 28 00:10:38 2013
New Revision: 1439212
URL: http://svn.apache.org/viewvc?rev=1439212&view=rev
Log:
Follow-up to r1435746: Push user notification in svn_fs_fs__verify
from svn_fs_fs__walk_rep_reference down to verify_walker. Also,
canonicalize svn_fs_fs__walk_rep_reference's parameter order.
* subversion/libsvn_fs_fs/fs_fs.c
(verify_walker_baton_t): add members required for user notification
(verify_walker): call user notification here
(svn_fs_fs__verify): init extended walker baton; do initial notification
* subversion/libsvn_fs_fs/rep-cache.h
(svn_fs_fs__walk_rep_reference): remove notify* params, reoder the rest
* subversion/libsvn_fs_fs/rep-cache.c
(svn_fs_fs__walk_rep_reference): update implementation
Suggested by: julianfoad
Modified:
subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c
subversion/trunk/subversion/libsvn_fs_fs/rep-cache.h
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=1439212&r1=1439211&r2=1439212&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Mon Jan 28 00:10:38 2013
@@ -10301,6 +10301,15 @@ typedef struct verify_walker_baton_t
/* number of files opened since the last clean */
int file_count;
+ /* progress notification callback to invoke periodically (may be NULL) */
+ svn_fs_progress_notify_func_t notify_func;
+
+ /* baton to use with NOTIFY_FUNC */
+ void *notify_baton;
+
+ /* remember the last revision for which we called notify_func */
+ svn_revnum_t last_notified_revision;
+
/* current file handle (or NULL) */
apr_file_t *file_hint;
@@ -10327,10 +10336,19 @@ verify_walker(representation_t *rep,
verify_walker_baton_t *walker_baton = baton;
apr_file_t * previous_file;
- /* free resources periodically */
+ /* notify and free resources periodically */
if ( walker_baton->iteration_count > 1000
|| walker_baton->file_count > 16)
{
+ if ( walker_baton->notify_func
+ && rep->revision != walker_baton->last_notified_revision)
+ {
+ walker_baton->notify_func(rep->revision,
+ walker_baton->notify_baton,
+ scratch_pool);
+ walker_baton->last_notified_revision = rep->revision;
+ }
+
svn_pool_clear(walker_baton->pool);
walker_baton->iteration_count = 0;
@@ -10394,14 +10412,20 @@ svn_fs_fs__verify(svn_fs_t *fs,
verify_walker_baton_t *baton = apr_pcalloc(pool, sizeof(*baton));
baton->rev_hint = SVN_INVALID_REVNUM;
baton->pool = svn_pool_create(pool);
+ baton->last_notified_revision = SVN_INVALID_REVNUM;
+ baton->notify_func = notify_func;
+ baton->notify_baton = notify_baton;
+ /* tell the user that we are now read to do *something* */
+ if (notify_func)
+ notify_func(SVN_INVALID_REVNUM, notify_baton, baton->pool);
+
/* Do not attempt to walk the rep-cache database if its file does
not exist, since doing so would create it --- which may confuse
the administrator. Don't take any lock. */
- SVN_ERR(svn_fs_fs__walk_rep_reference(fs, verify_walker, baton,
+ SVN_ERR(svn_fs_fs__walk_rep_reference(fs, start, end,
+ verify_walker, baton,
cancel_func, cancel_baton,
- notify_func, notify_baton,
- start, end,
pool));
/* walker resource cleanup */
Modified: subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c?rev=1439212&r1=1439211&r2=1439212&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c Mon Jan 28 00:10:38 2013
@@ -128,6 +128,8 @@ svn_fs_fs__exists_rep_cache(svn_boolean_
svn_error_t *
svn_fs_fs__walk_rep_reference(svn_fs_t *fs,
+ svn_revnum_t start,
+ svn_revnum_t end,
svn_error_t *(*walker)(representation_t *,
void *,
svn_fs_t *,
@@ -135,17 +137,12 @@ svn_fs_fs__walk_rep_reference(svn_fs_t *
void *walker_baton,
svn_cancel_func_t cancel_func,
void *cancel_baton,
- svn_fs_progress_notify_func_t notify_func,
- void *notify_baton,
- svn_revnum_t start,
- svn_revnum_t end,
apr_pool_t *pool)
{
fs_fs_data_t *ffd = fs->fsap_data;
svn_sqlite__stmt_t *stmt;
svn_boolean_t have_row;
int iterations = 0;
- svn_revnum_t last_notified_revision = SVN_INVALID_REVNUM;
apr_pool_t *iterpool = svn_pool_create(pool);
@@ -167,9 +164,6 @@ svn_fs_fs__walk_rep_reference(svn_fs_t *
SVN_ERR(svn_sqlite__reset(stmt));
if (SVN_IS_VALID_REVNUM(max)) /* The rep-cache could be empty. */
SVN_ERR(svn_fs_fs__revision_exists(max, fs, iterpool));
-
- if (notify_func)
- notify_func(SVN_INVALID_REVNUM, notify_baton, iterpool);
}
SVN_ERR(svn_sqlite__get_statement(&stmt, ffd->rep_cache_db,
@@ -216,16 +210,6 @@ svn_fs_fs__walk_rep_reference(svn_fs_t *
return svn_error_compose_create(err, svn_sqlite__reset(stmt));
SVN_ERR(svn_sqlite__step(&have_row, stmt));
-
- /* Notify (occasionally, because walking is fast and we can't
- guarantee a properly ordered notification sequence anyway) */
- if ( notify_func
- && (iterations % 1024 == 0)
- && (rep->revision != last_notified_revision))
- {
- notify_func(rep->revision, notify_baton, iterpool);
- last_notified_revision = rep->revision;
- }
}
SVN_ERR(svn_sqlite__reset(stmt));
Modified: subversion/trunk/subversion/libsvn_fs_fs/rep-cache.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/rep-cache.h?rev=1439212&r1=1439211&r2=1439212&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/rep-cache.h (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/rep-cache.h Mon Jan 28 00:10:38 2013
@@ -48,6 +48,8 @@ svn_fs_fs__exists_rep_cache(svn_boolean_
/* Iterate all representations currently in FS's cache. */
svn_error_t *
svn_fs_fs__walk_rep_reference(svn_fs_t *fs,
+ svn_revnum_t start,
+ svn_revnum_t end,
svn_error_t *(*walker)(representation_t *rep,
void *walker_baton,
svn_fs_t *fs,
@@ -55,10 +57,6 @@ svn_fs_fs__walk_rep_reference(svn_fs_t *
void *walker_baton,
svn_cancel_func_t cancel_func,
void *cancel_baton,
- svn_fs_progress_notify_func_t notify_func,
- void *notify_baton,
- svn_revnum_t start,
- svn_revnum_t end,
apr_pool_t *pool);
/* Return the representation REP in FS which has fulltext CHECKSUM.