Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0BF5B200BC0 for ; Tue, 15 Nov 2016 21:09:57 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 0A7F1160B03; Tue, 15 Nov 2016 20:09:57 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id F2908160AF2 for ; Tue, 15 Nov 2016 21:09:55 +0100 (CET) Received: (qmail 27040 invoked by uid 500); 15 Nov 2016 20:09:55 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 27030 invoked by uid 99); 15 Nov 2016 20:09:55 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Nov 2016 20:09:55 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id BE60E185F21 for ; Tue, 15 Nov 2016 20:09:54 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.199 X-Spam-Level: X-Spam-Status: No, score=-1.199 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id FNpMv65rR64A for ; Tue, 15 Nov 2016 20:09:52 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id F30525F47D for ; Tue, 15 Nov 2016 20:09:51 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id E9988E0652 for ; Tue, 15 Nov 2016 20:09:50 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id AB3EF3A27EE for ; Tue, 15 Nov 2016 20:09:50 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1769875 - in /subversion/branches/authzperf/subversion: libsvn_repos/authz.c libsvn_repos/authz.h libsvn_repos/authz_info.c libsvn_repos/authz_parse.c tests/libsvn_repos/authz-test.c Date: Tue, 15 Nov 2016 20:09:50 -0000 To: commits@subversion.apache.org From: stefan2@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20161115200950.AB3EF3A27EE@svn01-us-west.apache.org> archived-at: Tue, 15 Nov 2016 20:09:57 -0000 Author: stefan2 Date: Tue Nov 15 20:09:50 2016 New Revision: 1769875 URL: http://svn.apache.org/viewvc?rev=1769875&view=rev Log: On the authzperf branch: Prepare the parsed authz struct for caching. To be cacheable and shareable, we need it to be read-only but the svn_authz_t contains dynamic information as well. Therefore, move the parsed authz file (full model) into a new sub-struct that is truly accessed read-only. * subversion/libsvn_repos/authz.h (authz_full_t): The parser output and actually read-only part, factored out from ... (svn_authz_t): ... this. (svn_authz__parse): Return (svn_authz__get_global_rights): The operates on the parsed model only. * subversion/libsvn_repos/authz_parse.c (ctor_baton_t, create_ctor_baton): Update the data type to use. * subversion/libsvn_repos/authz_info.c (svn_authz__get_global_rights): Same. * subversion/tests/libsvn_repos/authz-test.c (test_authz_parse): Same. * subversion/libsvn_repos/authz.c (get_filtered_tree): Same. Update model access. (svn_repos_authz_read2, svn_repos_authz_parse): Create the now svn_authz_t wrapper around the parsed model. Modified: subversion/branches/authzperf/subversion/libsvn_repos/authz.c subversion/branches/authzperf/subversion/libsvn_repos/authz.h subversion/branches/authzperf/subversion/libsvn_repos/authz_info.c subversion/branches/authzperf/subversion/libsvn_repos/authz_parse.c subversion/branches/authzperf/subversion/tests/libsvn_repos/authz-test.c Modified: subversion/branches/authzperf/subversion/libsvn_repos/authz.c URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_repos/authz.c?rev=1769875&r1=1769874&r2=1769875&view=diff ============================================================================== --- subversion/branches/authzperf/subversion/libsvn_repos/authz.c (original) +++ subversion/branches/authzperf/subversion/libsvn_repos/authz.c Tue Nov 15 20:09:50 2016 @@ -779,7 +779,7 @@ finalize_tree(node_t *node, * Return the filtered rule tree. */ static node_t * -create_user_authz(svn_authz_t *authz, +create_user_authz(authz_full_t *authz, const char *repository, const char *user, apr_pool_t *result_pool, @@ -1467,7 +1467,7 @@ get_filtered_tree(svn_authz_t *authz, authz->user_rules[i]->pool = pool; authz->user_rules[i]->repository = apr_pstrdup(pool, repos_name); authz->user_rules[i]->user = user ? apr_pstrdup(pool, user) : NULL; - authz->user_rules[i]->root = create_user_authz(authz, + authz->user_rules[i]->root = create_user_authz(authz->full, repos_name, user, pool, scratch_pool); authz->user_rules[i]->lookup_state = create_lookup_state(pool); @@ -1550,7 +1550,7 @@ svn_repos__retrieve_config(svn_config_t undefined. If MUST_EXIST is TRUE, a missing authz or global groups file is also an error. */ svn_error_t * -authz_read(svn_authz_t **authz_p, +authz_read(authz_full_t **authz_p, const char *path, const char *groups_path, svn_boolean_t must_exist, @@ -1594,11 +1594,15 @@ svn_repos_authz_read2(svn_authz_t **auth apr_pool_t *pool) { apr_pool_t *scratch_pool = svn_pool_create(pool); + svn_authz_t *authz = apr_pcalloc(pool, sizeof(*authz)); + authz->pool = pool; - SVN_ERR(authz_read(authz_p, path, groups_path, must_exist, pool, + SVN_ERR(authz_read(&authz->full, path, groups_path, must_exist, pool, scratch_pool)); svn_pool_destroy(scratch_pool); + + *authz_p = authz; return SVN_NO_ERROR; } @@ -1608,12 +1612,16 @@ svn_repos_authz_parse(svn_authz_t **auth svn_stream_t *groups_stream, apr_pool_t *pool) { apr_pool_t *scratch_pool = svn_pool_create(pool); + svn_authz_t *authz = apr_pcalloc(pool, sizeof(*authz)); + authz->pool = pool; /* Parse the configuration and construct the full authz model from it. */ - SVN_ERR(svn_authz__parse(authz_p, stream, groups_stream, pool, + SVN_ERR(svn_authz__parse(&authz->full, stream, groups_stream, pool, scratch_pool)); svn_pool_destroy(scratch_pool); + + *authz_p = authz; return SVN_NO_ERROR; } Modified: subversion/branches/authzperf/subversion/libsvn_repos/authz.h URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_repos/authz.h?rev=1769875&r1=1769874&r2=1769875&view=diff ============================================================================== --- subversion/branches/authzperf/subversion/libsvn_repos/authz.h (original) +++ subversion/branches/authzperf/subversion/libsvn_repos/authz.h Tue Nov 15 20:09:50 2016 @@ -138,7 +138,7 @@ typedef struct authz_global_rights_t /* Immutable authorization info */ -struct svn_authz_t +typedef struct authz_full_t { /* All ACLs from the authz file, in the order of definition. */ apr_array_header_t *acls; @@ -156,6 +156,22 @@ struct svn_authz_t an authz_global_rights_t*. */ apr_hash_t *user_rights; + /* The pool from which all the parsed authz data is allocated. + This is the RESULT_POOL passed to svn_authz__tng_parse. + + It's a good idea to dedicate a pool for the authz structure, so + that the whole authz representation can be deallocated by + destroying the pool. */ + apr_pool_t *pool; +} authz_full_t; + + +/* Dynamic authorization info */ +struct svn_authz_t +{ + /* The parsed and pre-processed contents of the authz file. */ + authz_full_t *full; + /* A cache of rules filtered for a particular user. These will be generated on-demand. */ authz_user_rules_t *user_rules[AUTHZ_FILTERED_CACHE_SIZE]; @@ -292,7 +308,7 @@ typedef struct authz_ace_t * The function uses SCRATCH_POOL for temporary allocations. */ svn_error_t * -svn_authz__parse(svn_authz_t **authz, +svn_authz__parse(authz_full_t **authz, svn_stream_t *rules, svn_stream_t *groups, apr_pool_t *result_pool, @@ -337,7 +353,7 @@ svn_authz__get_acl_access(authz_access_t */ svn_boolean_t svn_authz__get_global_rights(authz_rights_t *rights, - const svn_authz_t *authz, + const authz_full_t *authz, const char *user, const char *repos); Modified: subversion/branches/authzperf/subversion/libsvn_repos/authz_info.c URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_repos/authz_info.c?rev=1769875&r1=1769874&r2=1769875&view=diff ============================================================================== --- subversion/branches/authzperf/subversion/libsvn_repos/authz_info.c (original) +++ subversion/branches/authzperf/subversion/libsvn_repos/authz_info.c Tue Nov 15 20:09:50 2016 @@ -119,7 +119,7 @@ resolve_global_rights(authz_rights_t *ri svn_boolean_t svn_authz__get_global_rights(authz_rights_t *rights_p, - const svn_authz_t *authz, + const authz_full_t *authz, const char *user, const char *repos) { if (!user || 0 == strcmp(user, AUTHZ_ANONYMOUS_USER)) Modified: subversion/branches/authzperf/subversion/libsvn_repos/authz_parse.c URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_repos/authz_parse.c?rev=1769875&r1=1769874&r2=1769875&view=diff ============================================================================== --- subversion/branches/authzperf/subversion/libsvn_repos/authz_parse.c (original) +++ subversion/branches/authzperf/subversion/libsvn_repos/authz_parse.c Tue Nov 15 20:09:50 2016 @@ -75,7 +75,7 @@ typedef struct parsed_group_t typedef struct ctor_baton_t { /* The final output of the parser. */ - svn_authz_t *authz; + authz_full_t *authz; /* Interned-string set, allocated in AUTHZ->pool. Stores singleton instances of user, group and repository names, @@ -205,7 +205,7 @@ create_ctor_baton(apr_pool_t *result_poo apr_pool_t *const parser_pool = svn_pool_create(scratch_pool); ctor_baton_t *const cb = apr_pcalloc(parser_pool, sizeof(*cb)); - svn_authz_t *const authz = apr_pcalloc(result_pool, sizeof(*authz)); + authz_full_t *const authz = apr_pcalloc(result_pool, sizeof(*authz)); init_global_rights(&authz->anon_rights, anon_access_token, result_pool); init_global_rights(&authz->authn_rights, authn_access_token, result_pool); authz->user_rights = svn_hash__make(result_pool); @@ -1293,7 +1293,7 @@ compare_parsed_acls(const void *va, cons svn_error_t * -svn_authz__parse(svn_authz_t **authz, +svn_authz__parse(authz_full_t **authz, svn_stream_t *rules, svn_stream_t *groups, apr_pool_t *result_pool, Modified: subversion/branches/authzperf/subversion/tests/libsvn_repos/authz-test.c URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/libsvn_repos/authz-test.c?rev=1769875&r1=1769874&r2=1769875&view=diff ============================================================================== --- subversion/branches/authzperf/subversion/tests/libsvn_repos/authz-test.c (original) +++ subversion/branches/authzperf/subversion/tests/libsvn_repos/authz-test.c Tue Nov 15 20:09:50 2016 @@ -188,7 +188,7 @@ test_authz_parse(const svn_test_opts_t * const char *groups_path; apr_file_t *groups_file; svn_stream_t *groups; - svn_authz_t *authz; + authz_full_t *authz; apr_hash_t *groupdefs = svn_hash__make(pool); int i;