You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2014/02/26 13:45:04 UTC
svn commit: r1572034 - in /subversion/branches/fsfs-lock-many/subversion:
libsvn_ra_local/ra_plugin.c mod_dav_svn/version.c svnserve/serve.c
Author: philip
Date: Wed Feb 26 12:45:03 2014
New Revision: 1572034
URL: http://svn.apache.org/r1572034
Log:
On the fsfs-lock-many branch: convert the server-side unlocking that
happens after a commit to svn_repos_fs_unlock2.
* subversion/libsvn_ra_local/ra_plugin.c
(deltify_etc): Use svn_repos_fs_unlock2.
* subversion/mod_dav_svn/version.c
(release_locks): Use svn_repos_fs_unlock2.
* subversion/svnserve/serve.c
(unlock_paths): Use svn_repos_fs_unlock2.
Modified:
subversion/branches/fsfs-lock-many/subversion/libsvn_ra_local/ra_plugin.c
subversion/branches/fsfs-lock-many/subversion/mod_dav_svn/version.c
subversion/branches/fsfs-lock-many/subversion/svnserve/serve.c
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_ra_local/ra_plugin.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_ra_local/ra_plugin.c?rev=1572034&r1=1572033&r2=1572034&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_ra_local/ra_plugin.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_ra_local/ra_plugin.c Wed Feb 26 12:45:03 2014
@@ -409,28 +409,35 @@ deltify_etc(const svn_commit_info_t *com
/* Maybe unlock the paths. */
if (deb->lock_tokens)
{
- apr_pool_t *iterpool = svn_pool_create(scratch_pool);
+ apr_pool_t *subpool = svn_pool_create(scratch_pool);
+ apr_hash_t *targets = apr_hash_make(subpool);
+ apr_hash_t *results;
apr_hash_index_t *hi;
- for (hi = apr_hash_first(scratch_pool, deb->lock_tokens); hi;
+ for (hi = apr_hash_first(subpool, deb->lock_tokens); hi;
hi = apr_hash_next(hi))
{
const void *relpath = svn__apr_hash_index_key(hi);
const char *token = svn__apr_hash_index_val(hi);
const char *fspath;
- svn_pool_clear(iterpool);
+ fspath = svn_fspath__join(deb->fspath_base, relpath, subpool);
+ svn_hash_sets(targets, fspath, token);
+ }
- fspath = svn_fspath__join(deb->fspath_base, relpath, iterpool);
+ /* We may get errors here if the lock was broken or stolen
+ after the commit succeeded. This is fine and should be
+ ignored. */
+ svn_error_clear(svn_repos_fs_unlock2(&results, deb->repos, targets,
+ FALSE, subpool, subpool));
- /* We may get errors here if the lock was broken or stolen
- after the commit succeeded. This is fine and should be
- ignored. */
- svn_error_clear(svn_repos_fs_unlock(deb->repos, fspath, token,
- FALSE, iterpool));
+ for (hi = apr_hash_first(subpool, results); hi; hi = apr_hash_next(hi))
+ {
+ svn_fs_lock_result_t *result = svn__apr_hash_index_val(hi);
+ svn_error_clear(result->err);
}
- svn_pool_destroy(iterpool);
+ svn_pool_destroy(subpool);
}
/* But, deltification shouldn't be stopped just because someone's
Modified: subversion/branches/fsfs-lock-many/subversion/mod_dav_svn/version.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/mod_dav_svn/version.c?rev=1572034&r1=1572033&r2=1572034&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/mod_dav_svn/version.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/mod_dav_svn/version.c Wed Feb 26 12:45:03 2014
@@ -1365,27 +1365,33 @@ release_locks(apr_hash_t *locks,
apr_pool_t *pool)
{
apr_hash_index_t *hi;
- const void *key;
- void *val;
apr_pool_t *subpool = svn_pool_create(pool);
+ apr_hash_t *targets = apr_hash_make(subpool);
+ apr_hash_t *results;
svn_error_t *err;
- for (hi = apr_hash_first(pool, locks); hi; hi = apr_hash_next(hi))
+ for (hi = apr_hash_first(subpool, locks); hi; hi = apr_hash_next(hi))
{
- svn_pool_clear(subpool);
- apr_hash_this(hi, &key, NULL, &val);
+ const char *path = svn__apr_hash_index_key(hi);
+ const char *token = svn__apr_hash_index_val(hi);
- /* The lock may be stolen or broken sometime between
- svn_fs_commit_txn() and this post-commit cleanup. So ignore
- any errors from this command; just free as many locks as we can. */
- err = svn_repos_fs_unlock(repos, key, val, FALSE, subpool);
+ svn_hash_sets(targets, path, token);
+ }
- if (err) /* If we got an error, just log it and move along. */
- ap_log_rerror(APLOG_MARK, APLOG_ERR, err->apr_err, r,
- "%s", err->message);
+ err = svn_repos_fs_unlock2(&results, repos, targets, FALSE, subpool, subpool);
- svn_error_clear(err);
+ for (hi = apr_hash_first(subpool, results); hi; hi = apr_hash_next(hi))
+ {
+ svn_fs_lock_result_t *result = svn__apr_hash_index_val(hi);
+ if (result->err)
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, result->err->apr_err, r,
+ "%s", result->err->message);
+ svn_error_clear(result->err);
}
+ if (err) /* If we got an error, just log it and move along. */
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, err->apr_err, r,
+ "%s", err->message);
+ svn_error_clear(err);
svn_pool_destroy(subpool);
Modified: subversion/branches/fsfs-lock-many/subversion/svnserve/serve.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/svnserve/serve.c?rev=1572034&r1=1572033&r2=1572034&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/svnserve/serve.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/svnserve/serve.c Wed Feb 26 12:45:03 2014
@@ -1353,37 +1353,45 @@ static svn_error_t *unlock_paths(const a
apr_pool_t *pool)
{
int i;
- apr_pool_t *iterpool;
-
- iterpool = svn_pool_create(pool);
+ apr_pool_t *subpool = svn_pool_create(pool);
+ apr_hash_t *targets = apr_hash_make(subpool);
+ apr_hash_t *results;
+ apr_hash_index_t *hi;
+ svn_error_t *err;
for (i = 0; i < lock_tokens->nelts; ++i)
{
svn_ra_svn_item_t *item, *path_item, *token_item;
const char *path, *token, *full_path;
- svn_error_t *err;
- svn_pool_clear(iterpool);
item = &APR_ARRAY_IDX(lock_tokens, i, svn_ra_svn_item_t);
path_item = &APR_ARRAY_IDX(item->u.list, 0, svn_ra_svn_item_t);
token_item = &APR_ARRAY_IDX(item->u.list, 1, svn_ra_svn_item_t);
path = path_item->u.string->data;
+ full_path = svn_fspath__join(sb->repository->fs_path->data,
+ svn_relpath_canonicalize(path, subpool),
+ subpool);
token = token_item->u.string->data;
+ svn_hash_sets(targets, full_path, token);
+ }
- full_path = svn_fspath__join(sb->repository->fs_path->data,
- svn_relpath_canonicalize(path, iterpool),
- iterpool);
- /* The lock may have become defunct after the commit, so ignore such
- errors. */
- err = svn_repos_fs_unlock(sb->repository->repos, full_path, token,
- FALSE, iterpool);
- log_error(err, sb);
- svn_error_clear(err);
+ /* The lock may have become defunct after the commit, so ignore such
+ errors. */
+ err = svn_repos_fs_unlock2(&results, sb->repository->repos, targets,
+ FALSE, subpool, subpool);
+ for (hi = apr_hash_first(subpool, results); hi; hi = apr_hash_next(hi))
+ {
+ svn_fs_lock_result_t *result = svn__apr_hash_index_val(hi);
+
+ log_error(result->err, sb);
+ svn_error_clear(result->err);
}
+ log_error(err, sb);
+ svn_error_clear(err);
- svn_pool_destroy(iterpool);
+ svn_pool_destroy(subpool);
return SVN_NO_ERROR;
}