[Rt-commit] [svn] r1974 - in rt/branches/3.3-TESTING: . bin lib/RT lib/t

jesse at pallas.eruditorum.org jesse at pallas.eruditorum.org
Wed Dec 8 20:05:43 EST 2004


Author: jesse
Date: Wed Dec  8 20:05:42 2004
New Revision: 1974

Modified:
   rt/branches/3.3-TESTING/   (props changed)
   rt/branches/3.3-TESTING/bin/standalone_httpd.in
   rt/branches/3.3-TESTING/bin/webmux.pl.in
   rt/branches/3.3-TESTING/lib/RT/ACE_Overlay.pm
   rt/branches/3.3-TESTING/lib/RT/GroupMember_Overlay.pm
   rt/branches/3.3-TESTING/lib/RT/Group_Overlay.pm
   rt/branches/3.3-TESTING/lib/RT/Principal_Overlay.pm
   rt/branches/3.3-TESTING/lib/RT/Ticket_Overlay.pm
   rt/branches/3.3-TESTING/lib/t/06mailgateway.pl.in
   rt/branches/3.3-TESTING/lib/t/07acl.pl.in
Log:
 r1978 at hualien:  jesse | 2004-12-09T01:05:21.233709Z
 Core:
 
 * Promoted ACL cache invalidation to a public method.
 
 Web:
 
 * Web UI now invalidates ACL cache after each HTTP hit. This means 
   more consistent ACL checks at the expense marginally more database lookups
 
 Test Suite:
 
 * Removed delays from the test suite which were there to deal with the ACL 
   cache. The test suite now completes in approximately one minute on my 
   laptop.
 
 
 


Modified: rt/branches/3.3-TESTING/bin/standalone_httpd.in
==============================================================================
--- rt/branches/3.3-TESTING/bin/standalone_httpd.in	(original)
+++ rt/branches/3.3-TESTING/bin/standalone_httpd.in	Wed Dec  8 20:05:42 2004
@@ -155,6 +155,9 @@
                 $RT::Logger->crit( "Transaction not committed. Usually indicates a software fault. Data loss may have occurred");
             }
 
+	    # Let's clear out RT's ACL cache. The perf impact should
+	    # be marginal and the consistency is a good thing.
+	    RT::Principal->InvalidateACLCache();
             DBIx::SearchBuilder::Record::Cachable->FlushCache
               if (
                 $RT::WebFlushDbCacheEveryRequest

Modified: rt/branches/3.3-TESTING/bin/webmux.pl.in
==============================================================================
--- rt/branches/3.3-TESTING/bin/webmux.pl.in	(original)
+++ rt/branches/3.3-TESTING/bin/webmux.pl.in	Wed Dec  8 20:05:42 2004
@@ -142,7 +142,9 @@
 "Transaction not committed. Usually indicates a software fault. Data loss may have occurred"
         );
     }
-
+    # Clean out the ACL cache. the performance impact should be marginal. 
+    # Consistency is imprived, too.
+    RT::Principal->InvalidateACLCache();
     DBIx::SearchBuilder::Record::Cachable->FlushCache
       if (
         $RT::WebFlushDbCacheEveryRequest

Modified: rt/branches/3.3-TESTING/lib/RT/ACE_Overlay.pm
==============================================================================
--- rt/branches/3.3-TESTING/lib/RT/ACE_Overlay.pm	(original)
+++ rt/branches/3.3-TESTING/lib/RT/ACE_Overlay.pm	Wed Dec  8 20:05:42 2004
@@ -327,7 +327,7 @@
                                    DelegatedFrom => 0 );
 
     #Clear the key cache. TODO someday we may want to just clear a little bit of the keycache space. 
-    RT::Principal->_InvalidateACLCache();
+    RT::Principal->InvalidateACLCache();
 
     if ( $id > 0 ) {
         return ( $id, $self->loc('Right Granted') );
@@ -637,7 +637,7 @@
 
     #Clear the key cache. TODO someday we may want to just clear a little bit of the keycache space. 
     # TODO what about the groups key cache?
-    RT::Principal->_InvalidateACLCache();
+    RT::Principal->InvalidateACLCache();
 
     if ( $id > 0 ) {
         return ( $id, $self->loc('Right Delegated') );
@@ -712,7 +712,7 @@
 
     #Clear the key cache. TODO someday we may want to just clear a little bit of the keycache space. 
     # TODO what about the groups key cache?
-    RT::Principal->_InvalidateACLCache();
+    RT::Principal->InvalidateACLCache();
 
     if ($val) {
         $RT::Handle->Commit() unless $InsideTransaction;

Modified: rt/branches/3.3-TESTING/lib/RT/GroupMember_Overlay.pm
==============================================================================
--- rt/branches/3.3-TESTING/lib/RT/GroupMember_Overlay.pm	(original)
+++ rt/branches/3.3-TESTING/lib/RT/GroupMember_Overlay.pm	Wed Dec  8 20:05:42 2004
@@ -123,7 +123,7 @@
 
     #Clear the key cache. TODO someday we may want to just clear a little bit of the keycache space. 
     # TODO what about the groups key cache?
-    RT::Principal->_InvalidateACLCache();
+    RT::Principal->InvalidateACLCache();
 
     $RT::Handle->BeginTransaction() unless ($args{'InsideTransaction'});
 
@@ -232,7 +232,7 @@
 
     #Clear the key cache. TODO someday we may want to just clear a little bit of the keycache space. 
     # TODO what about the groups key cache?
-    RT::Principal->_InvalidateACLCache();
+    RT::Principal->InvalidateACLCache();
 
 
     # We really need to make sure we don't add any members to this group
@@ -308,7 +308,7 @@
 
     #Clear the key cache. TODO someday we may want to just clear a little bit of the keycache space. 
     # TODO what about the groups key cache?
-    RT::Principal->_InvalidateACLCache();
+    RT::Principal->InvalidateACLCache();
 
 
 

Modified: rt/branches/3.3-TESTING/lib/RT/Group_Overlay.pm
==============================================================================
--- rt/branches/3.3-TESTING/lib/RT/Group_Overlay.pm	(original)
+++ rt/branches/3.3-TESTING/lib/RT/Group_Overlay.pm	Wed Dec  8 20:05:42 2004
@@ -763,7 +763,7 @@
 
     #Clear the key cache. TODO someday we may want to just clear a little bit of the keycache space. 
     # TODO what about the groups key cache?
-    RT::Principal->_InvalidateACLCache();
+    RT::Principal->InvalidateACLCache();
 
 
 

Modified: rt/branches/3.3-TESTING/lib/RT/Principal_Overlay.pm
==============================================================================
--- rt/branches/3.3-TESTING/lib/RT/Principal_Overlay.pm	(original)
+++ rt/branches/3.3-TESTING/lib/RT/Principal_Overlay.pm	Wed Dec  8 20:05:42 2004
@@ -61,7 +61,7 @@
 
 # Set up the ACL cache on startup
 our $_ACL_CACHE;
-_InvalidateACLCache();
+InvalidateACLCache();
 
 # {{{ IsGroup
 
@@ -490,15 +490,15 @@
 # {{{ ACL caching
 
 
-# {{{ _InvalidateACLCache
+# {{{ InvalidateACLCache
 
-=head2 _InvalidateACLCache
+=head2 InvalidateACLCache
 
-Cleans out and reinitializes the user rights key cache
+Cleans out and reinitializes the user rights cache
 
 =cut
 
-sub _InvalidateACLCache {
+sub InvalidateACLCache {
     $_ACL_CACHE = Cache::Simple::TimedExpiry->new();
     $_ACL_CACHE->expire_after($RT::ACLCacheLifetime||60);
 

Modified: rt/branches/3.3-TESTING/lib/RT/Ticket_Overlay.pm
==============================================================================
--- rt/branches/3.3-TESTING/lib/RT/Ticket_Overlay.pm	(original)
+++ rt/branches/3.3-TESTING/lib/RT/Ticket_Overlay.pm	Wed Dec  8 20:05:42 2004
@@ -2527,7 +2527,6 @@
 ok ($id,$msg);
 ($id,$msg) = $u1->PrincipalObj->GrantRight ( Object => $q2, Right => 'ModifyTicket');
 ok ($id,$msg);
-sleep(15);
 ($id,$msg) =$ticket->AddLink(Type => 'RefersTo', Target => $ticket2->id);
 ok($id,$msg);
 

Modified: rt/branches/3.3-TESTING/lib/t/06mailgateway.pl.in
==============================================================================
--- rt/branches/3.3-TESTING/lib/t/06mailgateway.pl.in	(original)
+++ rt/branches/3.3-TESTING/lib/t/06mailgateway.pl.in	Wed Dec  8 20:05:42 2004
@@ -134,7 +134,6 @@
 my ($val,$msg) = $g->PrincipalObj->GrantRight(Right => 'CreateTicket');
 ok ($val, "Granted everybody the right to create tickets - $msg");
 
-sleep(60); # gotta sleep so the remote process' ACL cache times out
 
 ok(open(MAIL, "|@RT_BIN_PATH@/rt-mailgate --url http://localhost".$RT::WebPath."/ --queue general --action correspond"), "Opened the mailgate - $@");
 print MAIL <<EOF;
@@ -168,7 +167,6 @@
 
 #($val,$msg) = $g->PrincipalObj->GrantRight(Right => 'CreateTicket');
 #ok ($val, "Granted everybody the right to create tickets - $msg");
-#sleep(60); # gotta sleep so the remote process' ACL cache times out
 
 ok(open(MAIL, "|@RT_BIN_PATH@/rt-mailgate --url http://localhost".$RT::WebPath."/ --queue general --action correspond"), "Opened the mailgate - $@");
 print MAIL <<EOF;
@@ -194,7 +192,6 @@
 
 ($val,$msg) = $g->PrincipalObj->GrantRight(Right => 'ReplyToTicket');
 ok ($val, "Granted everybody the right to reply to  tickets - $msg");
-sleep(60); # gotta sleep so the remote process' ACL cache times out
 
 ok(open(MAIL, "|@RT_BIN_PATH@/rt-mailgate --url http://localhost".$RT::WebPath."/ --queue general --action correspond"), "Opened the mailgate - $@");
 print MAIL <<EOF;
@@ -221,7 +218,6 @@
 
 #($val,$msg) = $g->PrincipalObj->GrantRight(Right => 'CreateTicket');
 #ok ($val, "Granted everybody the right to create tickets - $msg");
-#sleep(60); # gotta sleep so the remote process' ACL cache times out
 
 ok(open(MAIL, "|@RT_BIN_PATH@/rt-mailgate --url http://localhost".$RT::WebPath."/ --queue general --action comment"), "Opened the mailgate - $@");
 print MAIL <<EOF;
@@ -247,7 +243,6 @@
 
 ($val,$msg) = $g->PrincipalObj->GrantRight(Right => 'CommentOnTicket');
 ok ($val, "Granted everybody the right to reply to  tickets - $msg");
-sleep(60); # gotta sleep so the remote process' ACL cache times out
 
 ok(open(MAIL, "|@RT_BIN_PATH@/rt-mailgate --url http://localhost".$RT::WebPath."/ --queue general --action comment"), "Opened the mailgate - $@");
 print MAIL <<EOF;

Modified: rt/branches/3.3-TESTING/lib/t/07acl.pl.in
==============================================================================
--- rt/branches/3.3-TESTING/lib/t/07acl.pl.in	(original)
+++ rt/branches/3.3-TESTING/lib/t/07acl.pl.in	Wed Dec  8 20:05:42 2004
@@ -52,20 +52,17 @@
 # Now test for their presence, one at a time.  Sleep for a bit after
 # ACL changes, thanks to the 10s ACL cache.
 $user_obj->PrincipalObj->GrantRight(Right => 'ShowConfigTab');
-sleep(10);
 $agent->reload();
 ok($agent->{'content'} =~ /Logout/i, "Reloaded page successfully");
 ok($agent->find_link( url => '/Admin/',
 		       text => 'Configuration'), "Found config tab" );
 $user_obj->PrincipalObj->RevokeRight(Right => 'ShowConfigTab');
 $user_obj->PrincipalObj->GrantRight(Right => 'ModifySelf');
-sleep(10);
 $agent->reload();
 ok($agent->{'content'} =~ /Logout/i, "Reloaded page successfully");
 ok($agent->find_link( url => '/User/Prefs.html',
 		       text => 'Preferences'), "Found prefs pane" );
 $user_obj->PrincipalObj->RevokeRight(Right => 'ModifySelf');
-sleep(10);
 
 # Good.  Now load the search page and test Load/Save Search.
 $agent->follow_link( url => '/Search/Build.html',
@@ -75,14 +72,12 @@
 ok($agent->{'content'} !~ /Saved searches/i, "No saved searches box");
 
 $user_obj->PrincipalObj->GrantRight(Right => 'LoadSavedSearch');
-sleep(10);
 $agent->reload();
 ok($agent->{'content'} =~ /Load saved search/i, "Search loading box exists");
 ok($agent->{'content'} !~ /input\s+type=.submit.\s+name=.Save./i, 
    "Still no saved searches box");
 
 $user_obj->PrincipalObj->GrantRight(Right => 'CreateSavedSearch');
-sleep(10);
 $agent->reload();
 ok($agent->{'content'} =~ /Load saved search/i, 
    "Search loading box still exists");
@@ -108,7 +103,6 @@
 				     Object => $queue_obj);
 $group_obj->PrincipalObj->GrantRight(Right => 'SeeQueue',
 				     Object => $queue_obj);
-sleep(10);
 
 # Now.  When we look at the search page we should be able to see
 # ourself in the list of possible owners.


More information about the Rt-commit mailing list