RT 3.6.5 Bug/Patch - Group Creation

RT 3.6.5, Oracle 9i

I discovered a bug in html/Admin/Groups/Modify.html that causes a
performance problem. In our RT, if we go to Config -> Admin -> Groups
-> New Group, the page takes 3s+ to display, which is slow for a blank form.

I discovered that most of the time was taken by Oracle doing this query:

SELECT *
FROM
Principals WHERE lower(PrincipalType) = :p1 AND (ObjectId IS NULL OR
ObjectId = :p2)

This involves a full scan of the Principals table.

This query appeared to be inside a call to $Group->Disabled() near
the end of the INIT section. This shouldn’t be happening on a create,
because there’s no $Group object yet.

I moved around the logic that determines the ‘enabled’ checkbox
setting so that the $Group object is queried only when appropriate.
The ‘enabled’ checkbox will always be checked for a Create action.

Incidentally, I do wonder why the ObjectId columns on Principals is
nullable - we don;t appear to have any rows with a null value in the
column in our large-ish database.

Steve

diff -u $RT_HOME/share/html/Admin/Groups/Modify.html Modify2.html
— /usr/local/rt3/share/html/Admin/Groups/Modify.html Tue Apr 24
13:21:42 2007
+++ Modify2.html Tue Apr 22 12:07:21 2008
@@ -99,6 +99,7 @@
if ($Create) {
$current_tab = ‘Admin/Groups/Modify.html?Create=1’;
$title = loc(“Create a new group”);

  • $EnabledChecked =“CHECKED”;
    }

else {
@@ -138,22 +139,23 @@
ARGSRef => %ARGS );
push (@results,@fieldresults);
push @results, ProcessObjectCustomFieldUpdates( ARGSRef =>
%ARGS, Object => $Group );
-}

#we’re asking about enabled on the web page but really care about disabled.
-if ($Enabled == 1) {

  • $Disabled = 0;
    -}
    -else {
  • $Disabled = 1;
    -}
    -if ( ($SetEnabled) and ( $Disabled != $Group->Disabled) ) {
  • my ($code, $msg) = $Group->SetDisabled($Disabled);
  • push @results, loc(‘Enabled status [_1]’, loc_fuzzy($msg));
    -}
  • if ($Enabled == 1) {
  •   $Disabled = 0;
    
  • }
  • else {
  •   $Disabled = 1;
    
  • }
  • if ( ($SetEnabled) and ( $Disabled != $Group->Disabled) ) {
  •   my  ($code, $msg) = $Group->SetDisabled($Disabled);
    
  •   push @results, loc('Enabled status [_1]', loc_fuzzy($msg));
    
  • }
  • unless ($Group->Disabled()) {
  •   $EnabledChecked ="CHECKED";
    
  • }

-unless ($Group->Disabled()) {

  • $EnabledChecked =“CHECKED”;
    }

Stephen Turner
Senior Programmer/Analyst - SAIS
MIT Information Services and Technology (IS&T)