Closed Bug 339385 Opened 18 years ago Closed 18 years ago

Make Bugzilla::Version use Bugzilla::Object

Categories

(Bugzilla :: Bugzilla-General, enhancement)

2.23
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 3.0

People

(Reporter: mkanat, Assigned: mkanat)

References

(Blocks 1 open bug)

Details

(Keywords: perf)

Attachments

(3 files, 1 obsolete file)

 
Versions have neither an ID nor a name. How do you plan to use Bugzilla::Object in this case?
Oh, I could come up with some way. Maybe we could add a product_id to Bugzilla::Object, and we could make "value" into the name field.
Blocks: bz-object
We are in "soft freeze" mode to prepare 3.0 RC1.
Target Milestone: Bugzilla 3.0 → Bugzilla 3.2
Blocks: 364237
Retargeting to 3.0 for perf reasons.
Depends on: 339380
Target Milestone: Bugzilla 3.2 → Bugzilla 3.0
Attached patch v1 (obsolete) — Splinter Review
This one requires the component-object patch to be applied first.
Assignee: general → mkanat
Status: NEW → ASSIGNED
Attachment #249033 - Flags: review?(LpSolit)
The Component patch was applied as well.
Decreased --number to 25. The rest is just noise anyway.
From attachment 249037 [details] you can see the *total* queries ran by query.cgi for my testcase is a staggering 7021 (this is after applying the patch in bug 339380). After applying the patch, query.cgi now runs 4458 queries in total (see attachment 249043 [details]). So just this one patch decreases the total number of queries executed by query.cgi (for 345 products) by 2563. See the attachments for details.

The total time taken to run all queries executed by query.cgi decreased from 7.62 to 4.80 (2.82 seconds faster). This is of course not the total execution time of query.cgi (just the time spent on database calls).
Keywords: perf
Comment on attachment 249033 [details] [diff] [review]
v1

>diff -u Bugzilla/Object.pm Bugzilla/Object.pm

>-sub id                { return $_[0]->{'id'};          }
>-sub name              { return $_[0]->{'name'};        }
>+sub id   { return $_[0]->{$_[0]->ID_FIELD};   }
>+sub name { return $_[0]->{$_[0]->NAME_FIELD}; }

This change seems to break User.pm. When viewing a bug with this patch applied, no reporter and no assignee is displayed, my saved searches are gone and the UI is the one you get when being logged out, despite I'm logged in as an admin. Maybe some conflict with

use constant NAME_FIELD => 'login_name';
use constant ID_FIELD   => 'userid';

defined in User.pm?
Attachment #249033 - Flags: review?(LpSolit) → review-
My web server error log if full of:

show_bug.cgi: Use of uninitialized value in numeric eq (==) at Bugzilla/Bug.pm line 1890.
show_bug.cgi: Use of uninitialized value in numeric eq (==) at Bugzilla/Bug.pm line 1934.

which are respectively:

if ($self->{'assigned_to_id'} == $user->id)
and
if (!$self->{'error'} && $self->{'reporter_id'} == $user->id)

so the problem seems related to $class->ID_FIELD vs 'id'.
Attached patch v2Splinter Review
Okay, I haven't had a chance to test this, but it should fix it.
Attachment #249033 - Attachment is obsolete: true
Attachment #249051 - Flags: review?(LpSolit)
Comment on attachment 249051 [details] [diff] [review]
v2

>Index: Bugzilla/Version.pm

>@@ -110,7 +108,7 @@

>-    my $version = new Bugzilla::Version($self->product_id, $name);
>+    my $version = new Bugzilla::Version($self->id);

This change is wrong. We cannot edit versions anymore, because $version will always exists and an error will be thrown. $name is the *new* name for the version, not the current one, so you really want to check if the new $name is not already in use. You must write:

 { product => $product, name => $name }


r=LpSolit with this fix on checkin.
Attachment #249051 - Flags: review?(LpSolit) → review+
Flags: approval?
Flags: approval? → approval+
Okay, I did the checkin fix.

Checking in importxml.pl;
/cvsroot/mozilla/webtools/bugzilla/importxml.pl,v  <--  importxml.pl
new revision: 1.69; previous revision: 1.68
done
Checking in Bugzilla/Product.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Product.pm,v  <--  Product.pm
new revision: 1.23; previous revision: 1.22
done
Checking in Bugzilla/Version.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Version.pm,v  <--  Version.pm
new revision: 1.11; previous revision: 1.10
done
Checking in Bugzilla/DB/Schema.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/DB/Schema.pm,v  <--  Schema.pm
new revision: 1.79; previous revision: 1.78
done
Checking in Bugzilla/Install/DB.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Install/DB.pm,v  <--  DB.pm
new revision: 1.24; previous revision: 1.23
done
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: