Closed Bug 507969 Opened 15 years ago Closed 15 years ago

Speed up checksetup for cases when it's doing nothing

Categories

(Bugzilla :: Installation & Upgrading, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 3.6

People

(Reporter: mkanat, Assigned: mkanat)

References

Details

(Whiteboard: [es-gnome])

Attachments

(1 file, 2 obsolete files)

There are a few queries in checksetup.pl that run every time you run it, whether you're upgrading or not, that are really slow.

There are workarounds that can speed them up.
Attached patch v1 (obsolete) — Splinter Review
This fixes the two major speed issues remaining in checksetup. I'm asking LpSolit for review because I touched the status_workflow initialization code slightly. The query that I had to fix there was the "SELECT DISTNICT bug_status FROM bugs" which can be very slow if you have 500,000 bugs, so I didn't want to run it if it wasn't needed.
Attachment #392212 - Flags: review?(LpSolit)
Comment on attachment 392212 [details] [diff] [review]
v1

>+    # Populate the status_workflow table. We do nothing if the table already
>+    # has entries. If all bug status transitions have been deleted, the
>+    # workflow will be restored to its default schema.
>+    my $count = $dbh->selectrow_array('SELECT COUNT(*) FROM status_workflow');
>+    return if $count;

Do not return now, because you miss the check about @closed_statuses below. My suggestion below will be safer.


>     # expected to be open statuses. Bug statuses we have no information about
>     # are left as 'open'.

This last comment has been truncated.


>     my @closed_statuses =
>       @{$dbh->selectcol_arrayref('SELECT DISTINCT bug_status FROM bugs

As this query may be slow, move it into the |if (!$num_closed_states)| block. This way it's only executed when needed, without any perf impact (because the query to get $num_closed_states is fast, and we will enter this block only once, when upgrading from < 3.2 to 3.2+).
Attachment #392212 - Flags: review?(LpSolit) → review-
Note that with my suggestion in comment 2, you can safely take it for 3.4, and even for 3.2.
Whiteboard: [es-gnome]
FWIW, I think the @closed_statuses bit is more likely to result in errors from when we could have "NEW RESOLVED" than to help people with their customizations. (This is what happened during the GNOME Bugzilla upgrade.)
Attached patch v2 (obsolete) — Splinter Review
Okay, here we go, I did what you suggested.

Also, I found a few more places that could use some optimization, thanks to Devel::NYTProf, and I optimized those. (Those don't need review, just the workflow part.)
Attachment #392212 - Attachment is obsolete: true
Attachment #393716 - Flags: review?(LpSolit)
Comment on attachment 393716 [details] [diff] [review]
v2

>Index: Bugzilla/DB/Mysql.pm

>+    if (grep($_ eq 'bugs', @tables) and !grep('bugs_fulltext', @tables)) {

I know this is not the part you asked me to review, but the 2nd grep() is wrong. It should be $_ eq 'bugs_fulltext'. The other grep() a few lines later is also wrong.



>Index: Bugzilla/Install/DB.pm

>+        my $have_events = $dbh->selectrow_arrayref(

Nit: selectrow_array() would make more sense as you just want a scalar.


Other than that, the part about the status workflow is fine. So you can r+ your updated patch.
Attachment #393716 - Flags: review?(LpSolit) → review-
Attachment #393716 - Attachment description: v1 → v2
Attached patch v3Splinter Review
Okay, fixed the issues LpSolit pointed out. Granting myself review.
Attachment #393716 - Attachment is obsolete: true
Attachment #395119 - Flags: review+
It's a minor perf enhancement, so I only checked it in on tip:

Checking in Bugzilla/DB/Mysql.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/DB/Mysql.pm,v  <--  Mysql.pm
new revision: 1.77; previous revision: 1.76
done
Checking in Bugzilla/Install/DB.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Install/DB.pm,v  <--  DB.pm
new revision: 1.69; previous revision: 1.68
done
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Flags: approval+
Resolution: --- → FIXED
Blocks: 518073
Keywords: relnote
Added to the release notes in bug 547466.
Keywords: relnote
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: