subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1614037 - in /subversion/branches/authzperf: BRANCH-README subversion/libsvn_repos/authz.c
Date Mon, 28 Jul 2014 14:11:28 GMT
Author: stefan2
Date: Mon Jul 28 14:11:28 2014
New Revision: 1614037

URL: http://svn.apache.org/r1614037
Log:
On the authzperf branch:  Use the min / max sub-tree rights info
to exit the lookup early whenever we can.

* BRANCH-README
  (TODO, DONE): One more down.

* subversion/libsvn_repos/authz.c
  (lookup): Track MAX_RIGHTS alongside MIN_RIGHTS and use both
            to check for various early-out conditions.

Modified:
    subversion/branches/authzperf/BRANCH-README
    subversion/branches/authzperf/subversion/libsvn_repos/authz.c

Modified: subversion/branches/authzperf/BRANCH-README
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/BRANCH-README?rev=1614037&r1=1614036&r2=1614037&view=diff
==============================================================================
--- subversion/branches/authzperf/BRANCH-README (original)
+++ subversion/branches/authzperf/BRANCH-README Mon Jul 28 14:11:28 2014
@@ -4,7 +4,6 @@ allows much faster authz resolving and a
 
 TODO:
 
-* implement evaluation shortcuts
 * implement precedence rules
 * add support for full-segment wildcards ("/*/")
 * add support for variable length full-segment wildcards ("/**/")
@@ -18,3 +17,4 @@ DONE:
 * construct a prefix tree from the path rules
 * pre-calculate rule sets for the given user
 * implement recursive tree checks
+* implement evaluation shortcuts

Modified: subversion/branches/authzperf/subversion/libsvn_repos/authz.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_repos/authz.c?rev=1614037&r1=1614036&r2=1614037&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_repos/authz.c (original)
+++ subversion/branches/authzperf/subversion/libsvn_repos/authz.c Mon Jul 28 14:11:28 2014
@@ -667,6 +667,9 @@ lookup(node_t *root,
    * all paths of the current sub-tree. */
   svn_repos_authz_access_t min_rights = root->min_rights;
 
+  /* Same for maximum rights. */
+  svn_repos_authz_access_t max_rights = root->max_rights;
+
   /* Normalize start and end of PATH.  Most paths will be fully normalized,
    * so keep the overhead as low as possible. */
   if (path_len && path[path_len-1] == '/')
@@ -690,6 +693,18 @@ lookup(node_t *root,
       svn_stringbuf_t *segment = scratch_pad;
       path = next_segment(segment, path);
 
+      /* Shortcut 1: We could nowhere find enough rights in this sub-tree. */
+      if ((max_rights & required) != required)
+        return FALSE;
+
+      /* Shortcut 2: We will fine enough rights everywhere in this sub-tree. */
+      if ((min_rights & required) == required)
+        return TRUE;
+
+      /* Shortcut 3: The rights are the same everywhere in this sub-tree . */
+      if ((min_rights & required) == (max_rights & required))
+        return (min_rights & required) == required;
+
       /* Reached the bottom of the tree? */
       if (current->sub_nodes)
         {
@@ -705,12 +720,14 @@ lookup(node_t *root,
                 access = next->access;
 
               min_rights = next->min_rights;
+              max_rights = next->max_rights;
             }
           else
             {
               /* There are no more subtrees.  The access rights are fully
                * dictated by the parent. */
               min_rights = access->rights;
+              max_rights = access->rights;
             }
 
           current = next;



Mime
View raw message