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 2016/11/18 18:30:12 UTC

svn commit: r1770420 - in /subversion/branches/authzperf/subversion: include/svn_repos.h libsvn_repos/authz.c libsvn_repos/deprecated.c svnserve/serve.c

Author: stefan2
Date: Fri Nov 18 18:30:12 2016
New Revision: 1770420

URL: http://svn.apache.org/viewvc?rev=1770420&view=rev
Log:
On the authzperf branch:
Bump the svn_repos_authz_read API to be able to provide the repository
hint for faster in-repo authz lookup.

* subversion/include/svn_repos.h
  (svn_repos_authz_read3): Bumped version.
  (svn_repos_authz_read2): Deprecate.

* subversion/libsvn_repos/authz.c
  (svn_repos_authz_read3): Bump.

* subversion/libsvn_repos/deprecated.c
  (svn_repos_authz_read2): Implement in terms of the newer API.

* subversion/svnserve/serve.c
  (load_authz_config): Call the new API instead of the old caching code.

Modified:
    subversion/branches/authzperf/subversion/include/svn_repos.h
    subversion/branches/authzperf/subversion/libsvn_repos/authz.c
    subversion/branches/authzperf/subversion/libsvn_repos/deprecated.c
    subversion/branches/authzperf/subversion/svnserve/serve.c

Modified: subversion/branches/authzperf/subversion/include/svn_repos.h
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/include/svn_repos.h?rev=1770420&r1=1770419&r2=1770420&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/include/svn_repos.h (original)
+++ subversion/branches/authzperf/subversion/include/svn_repos.h Fri Nov 18 18:30:12 2016
@@ -3912,8 +3912,29 @@ svn_repos_authz_initialize(apr_pool_t *p
  * is also an error other than #SVN_ERR_AUTHZ_INVALID_CONFIG (exact error
  * depends on the access type).
  *
+ * For efficient access of in-repository authz, you may provide @a repos_hint
+ * which will be tried first and may remove the need to open a temporary
+ * repository instance.  Otherwise, set it to NULL and the repositories will
+ * be opened as needed.
+ *
+ * @since New in 1.10.
+ */
+svn_error_t *
+svn_repos_authz_read3(svn_authz_t **authz_p,
+                      const char *path,
+                      const char *groups_path,
+                      svn_boolean_t must_exist,
+                      svn_repos_t *repos_hint,
+                      apr_pool_t *result_pool,
+                      apr_pool_t *scratch_pool);
+
+/**
+ * Similar to svn_repos_authz_read3(), but with @a repos_hint set to @c NULL.
+ *
  * @since New in 1.8.
+ * @deprecated Provided for backward compatibility with the 1.9 API.
  */
+SVN_DEPRECATED
 svn_error_t *
 svn_repos_authz_read2(svn_authz_t **authz_p,
                       const char *path,

Modified: subversion/branches/authzperf/subversion/libsvn_repos/authz.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_repos/authz.c?rev=1770420&r1=1770419&r2=1770420&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_repos/authz.c (original)
+++ subversion/branches/authzperf/subversion/libsvn_repos/authz.c Fri Nov 18 18:30:12 2016
@@ -1512,18 +1512,19 @@ authz_read(authz_full_t **authz_p,
 /*** Public functions. ***/
 
 svn_error_t *
-svn_repos_authz_read2(svn_authz_t **authz_p, const char *path,
-                      const char *groups_path, svn_boolean_t must_exist,
-                      apr_pool_t *pool)
+svn_repos_authz_read3(svn_authz_t **authz_p,
+                      const char *path,
+                      const char *groups_path,
+                      svn_boolean_t must_exist,
+                      svn_repos_t *repos_hint,
+                      apr_pool_t *result_pool,
+                      apr_pool_t *scratch_pool)
 {
-  apr_pool_t *scratch_pool = svn_pool_create(pool);
-  svn_authz_t *authz = apr_pcalloc(pool, sizeof(*authz));
-  authz->pool = pool;
+  svn_authz_t *authz = apr_pcalloc(result_pool, sizeof(*authz));
+  authz->pool = result_pool;
 
-  SVN_ERR(authz_read(&authz->full, path, groups_path, must_exist, NULL,
-                     pool, scratch_pool));
-
-  svn_pool_destroy(scratch_pool);
+  SVN_ERR(authz_read(&authz->full, path, groups_path, must_exist,
+                     repos_hint, result_pool, scratch_pool));
 
   *authz_p = authz;
   return SVN_NO_ERROR;

Modified: subversion/branches/authzperf/subversion/libsvn_repos/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_repos/deprecated.c?rev=1770420&r1=1770419&r2=1770420&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_repos/deprecated.c (original)
+++ subversion/branches/authzperf/subversion/libsvn_repos/deprecated.c Fri Nov 18 18:30:12 2016
@@ -1173,6 +1173,22 @@ svn_repos_fs_begin_txn_for_update(svn_fs
 /*** From authz.c ***/
 
 svn_error_t *
+svn_repos_authz_read2(svn_authz_t **authz_p,
+                      const char *path,
+                      const char *groups_path,
+                      svn_boolean_t must_exist,
+                      apr_pool_t *pool)
+{
+  apr_pool_t *scratch_pool = svn_pool_create(pool);
+  svn_error_t *err = svn_repos_authz_read3(authz_p, path, groups_path,
+                                           must_exist, NULL,
+                                           pool, scratch_pool);
+  svn_pool_destroy(scratch_pool);
+
+  return svn_error_trace(err);
+}
+
+svn_error_t *
 svn_repos_authz_read(svn_authz_t **authz_p, const char *file,
                      svn_boolean_t must_exist, apr_pool_t *pool)
 {

Modified: subversion/branches/authzperf/subversion/svnserve/serve.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/svnserve/serve.c?rev=1770420&r1=1770419&r2=1770420&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/svnserve/serve.c (original)
+++ subversion/branches/authzperf/subversion/svnserve/serve.c Fri Nov 18 18:30:12 2016
@@ -322,9 +322,9 @@ load_authz_config(repository_t *reposito
                                        repos_root, pool);
 
       if (!err)
-        err = svn_repos__authz_pool_get(&repository->authzdb, authz_pool,
-                                        authzdb_path, groupsdb_path, TRUE,
-                                        repository->repos, pool);
+        err = svn_repos_authz_read3(&repository->authzdb, authzdb_path,
+                                    groupsdb_path, TRUE, repository->repos,
+                                    pool, pool);
 
       if (err)
         return svn_error_create(SVN_ERR_AUTHZ_INVALID_CONFIG, err, NULL);