Closed
Bug 290089
Opened 20 years ago
Closed 20 years ago
Move timestamp updates to happen before any other Schema updates
Categories
(Bugzilla :: Installation & Upgrading, defect, P1)
Tracking
()
RESOLVED
FIXED
Bugzilla 2.20
People
(Reporter: mkanat, Assigned: mkanat)
References
Details
Attachments
(1 file, 2 obsolete files)
|
11.78 KB,
patch
|
Tomas.Kopal
:
review+
|
Details | Diff | Splinter Review |
The new checksetup-upgrade-by-Schema code involves some silent UPDATE statements in order to make it work properly. (Yes, they are very much needed.) This is fine, except for the fact that old Bugzillas have timestamp fields, so these silent updates will change the delta_ts on various tables when they really shouldn't. It should actually be very straightforward to move the timestamp updates to happen before any other Schema updates, by moving them into Bugzilla::DB::Mysql::bz_setup_database.
| Assignee | ||
Updated•20 years ago
|
| Assignee | ||
Updated•20 years ago
|
Whiteboard: Check in after bug 287986
| Assignee | ||
Comment 1•20 years ago
|
||
OK, this is practically just a straight cut-and-paste. I did change the names of the $fielddef variables, and I had to change all the $dbh vars to $self. But those are the only changes in the moved code. The rest of the patch is just a cleanup of "delta_ts = delta_ts", which no longer needs to exist in checksetup.
Attachment #180520 -
Flags: review?(Tomas.Kopal)
| Assignee | ||
Updated•20 years ago
|
Whiteboard: Check in after bug 287986
Comment 2•20 years ago
|
||
Comment on attachment 180520 [details] [diff] [review] Move timestamp changes >--- checksetup.pl 12 Apr 2005 01:30:44 -0000 1.390 >+++ checksetup.pl 12 Apr 2005 22:08:23 -0000 You missed one occurence at line 2177: if ($table eq "bugs") { $extra = ", delta_ts = delta_ts"; } Also, there are places where we are currently modifying the bugs table, but the statement does not contain "delta_ts = delta_ts". I am pretty sure we should not change the timestamp by these updates so it's more an old bug you are fixing here, but it's a change in functionality so I would like you to look at this and confirm that not adding "delta_ts = NOW()" is correct and intentional. Other tables which had timestamp columns sometime in the past (attachments, logincookies) does not seem to be affected. >--- Bugzilla/DB/Mysql.pm 6 Apr 2005 00:18:04 -0000 1.8 >+++ Bugzilla/DB/Mysql.pm 12 Apr 2005 22:08:23 -0000 >@@ -371,6 +371,79 @@ > } # foreach table > } # if old-name indexes > >+ # The old timestample fields need to be adjusted here instead of in Typo: timestample => timestamp >+ # 2002-08-14 - bbaetz@student.usyd.edu.au - bug 153578 >+ # attachments creation time needs to be a datetime, not a timestamp >+ my $attach_creation = >+ $self->bz_get_field_def("attachments", "creation_ts"); >+ if ($attach_creation->[1] =~ /^timestamp/) { # If type is timestamp You changed the code here: are your sure the bz_get_field_def() can't return undef? >+ my $login_lastused = $self->bz_get_field_def("logincookies", "lastused"); >+ if ($login_lastused->[1] =~ /^timestamp/) { Dtto. >+ my $bugs_deltats = $self->bz_get_field_def("bugs", "delta_ts"); >+ if ($bugs_deltats->[1] =~ /^timestamp/) { Dtto. Otherwise, it looks pretty good and I will be happy to add my r+.
Attachment #180520 -
Flags: review?(Tomas.Kopal) → review-
| Assignee | ||
Comment 3•20 years ago
|
||
OK, you were right about the undef checks, and I also removed the other delta_ts bit. :-) Anywhere else in checksetup that was missing a "delta_ts = delta_ts" was a bug. :-)
| Assignee | ||
Updated•20 years ago
|
Attachment #180520 -
Attachment is obsolete: true
Attachment #180546 -
Flags: review?(Tomas.Kopal)
Comment 4•20 years ago
|
||
Comment on attachment 180546 [details] [diff] [review] v2 >+ while (my ($bug_id, $attach_id, $submitter_id) >+ = $sth->fetchrow_array()) >+ { >+ $sth2->execute($bug_id, $submitter_id, >+ "Created an attachment (id=$attach_id)%"); >+ my ($when) = $sth2->fetchrow_array(); >+ if ($when) { >+ $self->do("UPDATE attachments " . >+ "SET creation_ts='$when' " . >+ "WHERE attach_id=$attach_id"); Hmmm, maybe this is a good time for a bit of cleanup too. This should be probably prepare()d before the loop starts. But that's minor optimization and I am happy if you ignore it.
Attachment #180546 -
Flags: review?(Tomas.Kopal) → review+
| Assignee | ||
Updated•20 years ago
|
Flags: approval?
Updated•20 years ago
|
Flags: approval? → approval+
| Assignee | ||
Comment 5•20 years ago
|
||
Checking in checksetup.pl; /cvsroot/mozilla/webtools/bugzilla/checksetup.pl,v <-- checksetup.pl new revision: 1.393; previous revision: 1.392 done Checking in Bugzilla/DB/Mysql.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/DB/Mysql.pm,v <-- Mysql.pm new revision: 1.9; previous revision: 1.8 done
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
| Assignee | ||
Comment 6•20 years ago
|
||
OK, backed out the patch, it causes the test-checksetup tinderbox to burn.
Creating a new database is broken, because bz_get_field_def dies if you call it
on a table that doesn't exist. (Which is silly.)
DBD::mysql::st execute failed: Table 'bugs_checksetup.attachments' doesn't exist
[for Statement "SHOW COLUMNS FROM attachments"] at Bugzilla/DB.pm line 593
Bugzilla::DB::bz_get_field_def('Bugzilla::DB::Mysql=HASH(0xa253944)','attachments','creation_ts')
called at Bugzilla/DB/Mysql.pm line 381
Bugzilla::DB::Mysql::bz_setup_database('Bugzilla::DB::Mysql=HASH(0xa253944)')
called at ./checksetup.pl line 1579Status: RESOLVED → REOPENED
Resolution: FIXED → ---
| Assignee | ||
Comment 7•20 years ago
|
||
This is so silly, since I'm going to *remove* this function in a few days, but I guess I have to fix it for now. :-)
Attachment #180546 -
Attachment is obsolete: true
Attachment #180688 -
Flags: review?(Tomas.Kopal)
Updated•20 years ago
|
Attachment #180688 -
Flags: review?(Tomas.Kopal) → review+
Updated•20 years ago
|
Flags: approval+
Updated•20 years ago
|
Flags: approval+
| Assignee | ||
Comment 8•20 years ago
|
||
Checking in checksetup.pl; /cvsroot/mozilla/webtools/bugzilla/checksetup.pl,v <-- checksetup.pl new revision: 1.395; previous revision: 1.394 done Checking in Bugzilla/DB.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/DB.pm,v <-- DB.pm new revision: 1.44; previous revision: 1.43 done Checking in Bugzilla/DB/Mysql.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/DB/Mysql.pm,v <-- Mysql.pm new revision: 1.11; previous revision: 1.10 done
Status: REOPENED → RESOLVED
Closed: 20 years ago → 20 years ago
Resolution: --- → FIXED
Summary: Move timestamp updates to happen before any other Schema updates → https://bugzilla.mozilla.org/attachment.cgi?id=180688
| Assignee | ||
Updated•20 years ago
|
Summary: https://bugzilla.mozilla.org/attachment.cgi?id=180688 → Move timestamp updates to happen before any other Schema updates
You need to log in
before you can comment on or make changes to this bug.
Description
•