Closed Bug 339667 Opened 18 years ago Closed 18 years ago

Attachment data not deleted when deleting a component or a product

Categories

(Bugzilla :: Attachments & Requests, defect)

2.22
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 2.22

People

(Reporter: lorenzo.marcon, Assigned: LpSolit)

Details

(Keywords: regression)

Attachments

(1 file, 1 obsolete file)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; it; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; it; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3 I've deleted a component, and everything is gone right. Bugs and attachments were deleted too. Then I went looking into the file attach_data.MYD in the mysql database and I found that the file continue to keep an attachment that was related to a bug just deleted by the process. I could clearly see that because the attachment datas were only text. Reproducible: Always Steps to Reproduce: 1. Create a new product and a new component 2. File a bug for that component, including a text attachment 3 [review]. Delete the just created component/product. 4. Go to open attach_data.MYD with a text-editor and you will find the text of the attachment you've submitted Actual Results: Attachment datas related to a bug still remains when bug is deleted Expected Results: Attachment datas related to a bug should be deleted at bug deletion The version of Bugzilla I'm using is 2.22 The DBMS i'm using is MySQL 4.1
you should be well aware that this is unsupported. we're accepting patches.
Version: unspecified → 2.22
This is completely supported! This is a regression from bug 305333. We forgot to update Bugzilla::Bug->remove_from_db() to remove data from the attach_data table. Moreover, sanitycheck.cgi should complain that data exist in attach_data which point to an inexistant attachment in the attachments table.
Assignee: attach-and-request → LpSolit
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: regression
OS: Windows 2000 → All
Hardware: PC → All
Summary: Attachment data not deleted when deleting a component → Attachment data not deleted when deleting a component or a product
Target Milestone: --- → Bugzilla 2.22
Attached patch patch, v1 (obsolete) (deleted) — Splinter Review
Tested on 2.22 and tip.
Attachment #223817 - Flags: review?(bugreport)
Comment on attachment 223817 [details] [diff] [review] patch, v1 just in case wicked is faster...
Attachment #223817 - Flags: review?(wicked+bz)
Status: NEW → ASSIGNED
Attachment are now removed from the attach_data table, but datas still remains in file attach_data.MYD
(In reply to comment #5) > Attachment are now removed from the attach_data table, but datas still remains > in file attach_data.MYD The way MySQL works internally has nothing to do with Bugzilla.
You shouldn't be looking at MySQL data files directly. Rather fire up a mysql console client (normally named mysql surprisingly, or you can use your favorite GUI client) and do some SELECT SQL clauses from attachment and/or attach_data table.
Comment on attachment 223817 [details] [diff] [review] patch, v1 >Index: Bugzilla/Bug.pm >=================================================================== >+ # The attach_data table doesn't depend on bugs.bug_id directly. >+ my $attach_ids = >+ $dbh->selectcol_arrayref("SELECT attach_id FROM attachments >+ WHERE bug_id = ?", undef, $bug_id); >+ >+ $dbh->do("DELETE FROM attach_data WHERE id IN (" . join(",", @$attach_ids) . ")"); Crashes when there's no attachments. And besides, running this kind of delete without an if scares me. >Index: sanitycheck.cgi >=================================================================== >+ $dbh->do('DELETE FROM attach_data WHERE id IN (' . join(',', @$attach_ids) . ')'); Same here.
Attachment #223817 - Flags: review?(wicked+bz)
Attachment #223817 - Flags: review?(bugreport)
Attachment #223817 - Flags: review-
Attached patch patch, v2 (deleted) — Splinter Review
Attachment #223817 - Attachment is obsolete: true
Attachment #224625 - Flags: review?(wicked+bz)
Attachment #224625 - Flags: review?(wicked+bz) → review+
Flags: approval?
Flags: approval2.22?
Flags: approval?
Flags: approval2.22?
Flags: approval2.22+
Flags: approval+
tip: Checking in sanitycheck.cgi; /cvsroot/mozilla/webtools/bugzilla/sanitycheck.cgi,v <-- sanitycheck.cgi new revision: 1.114; previous revision: 1.113 done Checking in Bugzilla/Bug.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Bug.pm,v <-- Bug.pm new revision: 1.119; previous revision: 1.118 done 2.22: Checking in sanitycheck.cgi; /cvsroot/mozilla/webtools/bugzilla/sanitycheck.cgi,v <-- sanitycheck.cgi new revision: 1.110.2.1; previous revision: 1.110 done Checking in Bugzilla/Bug.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Bug.pm,v <-- Bug.pm new revision: 1.104.2.3; previous revision: 1.104.2.2 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: