Closed
Bug 252272
Opened 21 years ago
Closed 20 years ago
Allow extremely large attachments to be stored locally
Categories
(Bugzilla :: Attachments & Requests, enhancement, P2)
Tracking
()
RESOLVED
FIXED
Bugzilla 2.20
People
(Reporter: bugreport, Assigned: bugreport)
Details
Attachments
(2 files, 7 obsolete files)
14.39 KB,
patch
|
Wurblzap
:
review+
|
Details | Diff | Splinter Review |
2.99 KB,
patch
|
cso
:
review+
bugreport
:
review+
|
Details | Diff | Splinter Review |
Tracefiles can often FAR exceed 16M and are only temporarily needed. Storing
them on the local fielsystem can help.
Assignee | ||
Comment 1•21 years ago
|
||
This patch does work, but it needs further refinement. Specifically, it needs
to handle the sizes int he attachment table better.
Assignee | ||
Comment 2•21 years ago
|
||
Actually, getting that to work properly is a lot easier than it looked.
Attachment #153770 -
Attachment is obsolete: true
Assignee | ||
Updated•21 years ago
|
Summary: Allow extremelty large attachments to be stored locally → Allow extremely large attachments to be stored locally
Assignee | ||
Comment 3•21 years ago
|
||
Attachment #153771 -
Attachment is obsolete: true
Assignee | ||
Comment 4•21 years ago
|
||
Comment on attachment 153826 [details] [diff] [review]
patch v3
This feature is off by default. It certainly has no place on BMO, but it is
essential for those who need it.
Is this something that can land??
Attachment #153826 -
Flags: review?
Comment 5•21 years ago
|
||
Not without some comments and a spell-checking session :-)
Also, why does the _user_ get to specify which files are big files? What would
entice them ever to check the checkbox? And what's all this "purging" business?
How does this work with groups?
Gerv
Comment 6•21 years ago
|
||
Without reading the patch (yet), I think I could find some use for this feature.
Data dumps etc. frequently exceed the rational maximum attachment size for a
MySQL blob.
Assignee | ||
Comment 7•21 years ago
|
||
The user would check the box if they want to upload a file that would otherwise
not be permitted. They might do it out of good housekeeping also since they may
be aware that the file will not be important years from now. That is true of
many trace files that are no longer needed once analyzed.
The reason that we need the user to specify this is we avoid reading the entire
file into a perl variable andtransfer it, a buffer at a time, to the local file.
This is independent of groups. Everything about managing the attachments
follows the same logic as attachments stored in the DB.
Comment 8•21 years ago
|
||
> The user would check the box if they want to upload a file that would
> otherwise not be permitted.
But that wouldn't know that unless they'd tried to upload it first, waited five
minutes for however much data to be sent, and then got an error. Not shockingly
user-friendly. Why not automatically switch to this mode when we go over a
certain size?
> They might do it out of good housekeeping also since they may
> be aware that the file will not be important years from now.
How can anyone know that? Maybe only 1 in 100 old bugs need further work later
(we thought we fixed it but we didn't, or whatever), but you don't know _which_
one. Given how cheap disk space is these days, is there _ever_ a need to throw
away data attached to old bugs?
Gerv
Assignee | ||
Comment 9•21 years ago
|
||
It probably makes sense to have the limits stated on the upload form. (this is
true even without this feature)
Like I said, I dont expect this to be activated on BMO
Assignee | ||
Updated•21 years ago
|
Status: NEW → ASSIGNED
Priority: -- → P2
Target Milestone: --- → Bugzilla 2.20
Comment 10•21 years ago
|
||
Comment on attachment 153826 [details] [diff] [review]
patch v3
Needs some comments and a spell-checking session :)
Attachment #153826 -
Flags: review? → review-
Assignee | ||
Comment 11•21 years ago
|
||
Attachment #153826 -
Attachment is obsolete: true
Assignee | ||
Updated•21 years ago
|
Attachment #158268 -
Flags: review?(vladd)
Comment 12•21 years ago
|
||
Bugzilla 2.20 feature set is now frozen as of 15 Sept 2004. Anything flagged
enhancement that hasn't already landed is being pushed out. If this bug is
otherwise ready to land, we'll handle it on a case-by-case basis, please set the
blocking2.20 flag to '?' if you think it qualifies.
Target Milestone: Bugzilla 2.20 → Bugzilla 2.22
Updated•21 years ago
|
Attachment #158268 -
Flags: review?(vladd) → review?
Comment 13•21 years ago
|
||
Comment on attachment 158268 [details] [diff] [review]
v4 - With spelling fixes and comments
This crashes on me when I try to open an attachment I removed on the file
system :(
The remainder are nits...
Do you think it's good to speak of "local storage"? To me, when looking at my
browser, I read that as "on my personal computer". If it's not too technical,
maybe "on the server's file system"? Or simply "outside the database"? Other
ideas?
Generally, I think there should be a space following a comma.
+ # Skip uploading into a local variable if the user want to upload huge
s/want/wants/
Good patch. I think I'd use this functionality :)
Attachment #158268 -
Flags: review? → review-
Assignee | ||
Comment 14•20 years ago
|
||
Fixed removed file and fixed permissions of directory so bugzilla user can
remove files without being root.
Attachment #158268 -
Attachment is obsolete: true
Attachment #173955 -
Flags: review?(wurblzap)
Comment 15•20 years ago
|
||
Comment on attachment 173955 [details] [diff] [review]
Revised to catch removed attachments
Tested; works.
If I view the "edit" page of a deleted image attachment, I see an embedded
Bugzilla error page in the place where the image would be. I'd like a
placeholder image or a some text without the Bugzilla header, footer and
"Please press Back" message a lot better. But that's probably not that easy, so
I think that's something for a follow-up bug.
I'm really not happy with the usage of the word "local". I still think it's
misleading, letting the user think of the desktop PC instead of the server. If
you don't want to address this now, we can have a follow-up bug on this, too.
The space-after-commas nit is a nit, but it's that kind of nit I expect you to
fix :)
http://www.bugzilla.org/docs/developer.html plus
http://www.perldoc.com/perl5.6/pod/perlstyle.html; please put up a new patch
and carry r+ forward.
Attachment #173955 -
Flags: review?(wurblzap) → review+
Comment 16•20 years ago
|
||
shouldn't you be setting binmode on AH?
right now it works as the file is translated when writing to and reading from
disk, however this results in the file on disk being corrupt.
Assignee | ||
Comment 17•20 years ago
|
||
hmm... sounds like a win32 thing :-)
Assignee | ||
Comment 18•20 years ago
|
||
Cleaned up comment nits and added binmode
Attachment #173955 -
Attachment is obsolete: true
Attachment #174018 -
Flags: review?(wurblzap)
Updated•20 years ago
|
Attachment #173955 -
Flags: review+
Comment 19•20 years ago
|
||
Comment on attachment 174018 [details] [diff] [review]
Added binmode to keep win32 happy
I'm sorry, it seems I failed to catch a couple of points last time.
The directory name should imho be a variable. It could be put into
Bugzilla/Config.pm at $webdotdir's side.
And I think that data/files/ (or perhaps even data/attachments/) is better than
files/.
>Index: attachment.cgi
>@@ -504,6 +511,22 @@
> # Return the appropriate HTTP response headers.
> $filename =~ s/^.*[\/\\]//;
> my $filesize = length($thedata);
>+ # A zero length attachment in the database means the attachment is
>+ # stored in a local file
>+ if ($filesize == 0)
>+ {
>+ my $attachid = $::FORM{'id'};
>+ my $hash = ($attachid % 100) + 100;
>+ $hash =~ s/.*(\d\d)$/group.$1/;
>+ open(AH, "files/$hash/attachment.$attachid");
>+ binmode AH;
>+ $filesize = (stat(AH))[7];
>+ }
>+ if ($filesize == 0)
>+ {
>+ ThrowUserError("attachment_removed");
>+ }
If the file has been purged, binmode and stat issue warnings. You should move
ThrowUserError up so that binmode and stat don't happen if open fails, like
open() || ThrowUserError.
>+ # If the file is to be stored locally, stream the file from the webserver
>+ # to the local file without reading it into a local variable.
>+ if ($::FORM{'bigfile'})
>+ {
>+ my $fh = $cgi->upload('data');
>+ my $hash = ($attachid % 100) + 100;
>+ $hash =~ s/.*(\d\d)$/group.$1/;
>+ mkdir 'files',0770;
>+ mkdir "files/$hash",0770;
>+ chmod 0770,"files/$hash";
Why are you trying to create the directory here? Somebody should have run
checksetup.pl, and you're creating it there. It shouldn't even work here, at
least not for systems properly set up, because the webserver shouldn't have
write access to the Bugzilla directory.
And while you're here, please put a blank after the commas here that seem to
have been missed.
>Index: Bugzilla/Attachment.pm
>@@ -92,6 +92,16 @@
> # Retrieve a list of flags for this attachment.
> $a{'flags'} = Bugzilla::Flag::match({ 'attach_id' => $a{'attachid'},
> 'is_active' => 1 });
>+
>+ # A zero size indicates that the attachment is stored locally.
>+ if ($a{'datasize'} == 0) {
>+ my $attachid = $a{'attachid'};
>+ my $hash = ($attachid % 100) + 100;
>+ $hash =~ s/.*(\d\d)$/group.$1/;
>+ open(AH,"files/$hash/attachment.$attachid");
>+ $a{'datasize'} |= (stat(AH))[7];
>+ close(AH);
>+ }
The calls to stat and close issue warnings when the file doesn't exist any
more. A failing open() needs to be caught here.
You need to replace |= by =, too.
And a comma after AH is missing :)
Attachment #174018 -
Flags: review?(wurblzap) → review-
Assignee | ||
Comment 20•20 years ago
|
||
OK... got all that. $attachdir is the place
Attachment #174018 -
Attachment is obsolete: true
Attachment #174118 -
Flags: review?(wurblzap)
Comment 21•20 years ago
|
||
Comment on attachment 174118 [details] [diff] [review]
take 3
Ok, there's only one thing left :)
>Index: attachment.cgi
>@@ -514,6 +539,11 @@
> print $thedata;
>+ while (<AH>) {
>+ print $_;
>+ }
>+ close(AH);
We get warnings here when viewing *db-based* attachments ("unopened
filehandle"), so the loop needs to be conditional here.
Attachment #174118 -
Flags: review?(wurblzap) → review-
Assignee | ||
Comment 22•20 years ago
|
||
Attachment #174118 -
Attachment is obsolete: true
Assignee | ||
Updated•20 years ago
|
Attachment #174577 -
Flags: review?(wurblzap)
Comment 23•20 years ago
|
||
Comment on attachment 174577 [details] [diff] [review]
take 4 - check for warnings
That's it. Thank you.
Attachment #174577 -
Flags: review?(wurblzap) → review+
Updated•20 years ago
|
Flags: approval?
Updated•20 years ago
|
Flags: approval? → approval+
QA Contact: mattyt-bugzilla → default-qa
Target Milestone: Bugzilla 2.22 → Bugzilla 2.20
Assignee | ||
Comment 24•20 years ago
|
||
checked in
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Flags: documentation?
Resolution: --- → FIXED
Comment 26•20 years ago
|
||
There were two areas mentioning MySQL config and attachments, I added notes
saying that those do not apply to Big Files. Also updated the Hints & Tips
section.
Requesting review from documentation@.
Attachment #188987 -
Flags: review?(documentation)
Comment 27•20 years ago
|
||
Comment on attachment 188987 [details] [diff] [review]
Docs Patch v1
Requesting review from joel to make sure what I actually wrote is correct.
I notably did not cover anything on what information remains in Bugzilla when
the Big File is deleted, how to delete Big Files, who can delete Big Files, how
to enable Big Files, or the fact that Big Files may not work as well as
expected when running Bugzilla over multiple machines accessing one database.
If requested to do so, I can put that in.
Attachment #188987 -
Flags: review?(bugreport)
Assignee | ||
Comment 28•20 years ago
|
||
Comment on attachment 188987 [details] [diff] [review]
Docs Patch v1
r=joel for content
Someone should make sure the docs build before checkin.
Attachment #188987 -
Flags: review?(bugreport) → review+
Comment 29•20 years ago
|
||
Comment on attachment 188987 [details] [diff] [review]
Docs Patch v1
r=me on the fact the docs compile - joel has given r on the contents.
Attachment #188987 -
Flags: review?(documentation) → review+
Comment 30•20 years ago
|
||
I've checked in Patch v1, but I think the comments you made when you attached it
are valid; there should be documentation on how to enable it etc. would be useful.
2.20
Checking in installation.xml;
/cvsroot/mozilla/webtools/bugzilla/docs/xml/installation.xml,v <--
installation.xml
new revision: 1.98.2.2; previous revision: 1.98.2.1
done
Checking in using.xml;
/cvsroot/mozilla/webtools/bugzilla/docs/xml/using.xml,v <-- using.xml
new revision: 1.33.2.1; previous revision: 1.33
done
Trunk
Checking in installation.xml;
/cvsroot/mozilla/webtools/bugzilla/docs/xml/installation.xml,v <--
installation.xml
new revision: 1.100; previous revision: 1.99
done
Checking in using.xml;
/cvsroot/mozilla/webtools/bugzilla/docs/xml/using.xml,v <-- using.xml
new revision: 1.34; previous revision: 1.33
done
Updated•19 years ago
|
Flags: documentation? → documentation+
You need to log in
before you can comment on or make changes to this bug.
Description
•