#1079 closed defect (fixed)
upload of file into dir doesn't appear on Recent Uploads and Downloads
Reported by: | zooko | Owned by: | Brian Warner <warner@…> |
---|---|---|---|
Priority: | major | Milestone: | 1.9.0 |
Component: | code-frontend | Version: | 1.7β |
Keywords: | upload usability statistics wui easy | Cc: | |
Launchpad Bug: |
Description
When I upload a file into a directory, such as this one: http://pubgrid.tahoe-lafs.org/uri/URI:DIR2-RO:ixqhc4kdbjxc7o65xjnveoewym:5x6lwoxghrd5rxhwunzavft2qygfkt27oj3fbxlq4c6p45z5uneq/ , which the timestamps show got linked into this directory at 2010-06-12_03:45:30.369968, the upload of the immutable file doesn't appear on the Recent Uploads and Downloads page:
21:45:38 11-Jun-2010 retrieve up4mutkj52kcm2l7c7nvg5j2ua No 314B 100.0% Finished 21:45:38 11-Jun-2010 mapupdate MODE_READ up4mutkj52kcm2l7c7nvg5j2ua No -NA- 100.0% Finished 21:45:31 11-Jun-2010 retrieve up4mutkj52kcm2l7c7nvg5j2ua No 314B 100.0% Finished 21:45:31 11-Jun-2010 mapupdate MODE_READ up4mutkj52kcm2l7c7nvg5j2ua No -NA- 100.0% Finished 21:45:30 11-Jun-2010 publish up4mutkj52kcm2l7c7nvg5j2ua No 314B 100.0% Finished 21:45:30 11-Jun-2010 retrieve up4mutkj52kcm2l7c7nvg5j2ua No 624B 100.0% Finished 21:45:30 11-Jun-2010 mapupdate MODE_WRITE up4mutkj52kcm2l7c7nvg5j2ua No -NA- 100.0% Finished 21:45:30 11-Jun-2010 publish up4mutkj52kcm2l7c7nvg5j2ua No 624B 100.0% Finished 21:45:30 11-Jun-2010 retrieve up4mutkj52kcm2l7c7nvg5j2ua No 310B 100.0% Finished 21:45:30 11-Jun-2010 mapupdate MODE_WRITE up4mutkj52kcm2l7c7nvg5j2ua No -NA- 100.0% Finished 21:45:30 11-Jun-2010 retrieve up4mutkj52kcm2l7c7nvg5j2ua No 310B 100.0% Finished 21:45:29 11-Jun-2010 mapupdate MODE_READ up4mutkj52kcm2l7c7nvg5j2ua No -NA- 100.0% Finished 21:45:24 11-Jun-2010 retrieve up4mutkj52kcm2l7c7nvg5j2ua No 310B 100.0% Finished 21:45:24 11-Jun-2010 mapupdate MODE_READ up4mutkj52kcm2l7c7nvg5j2ua No -NA- 100.0% Finished 21:45:24 11-Jun-2010 publish up4mutkj52kcm2l7c7nvg5j2ua No 310B 100.0% Finished 21:45:23 11-Jun-2010 retrieve up4mutkj52kcm2l7c7nvg5j2ua No 620B 100.0% Finished 21:45:23 11-Jun-2010 mapupdate MODE_WRITE up4mutkj52kcm2l7c7nvg5j2ua No -NA- 100.0% Finished 21:45:14 11-Jun-2010 retrieve up4mutkj52kcm2l7c7nvg5j2ua No 620B 100.0% Finished 21:45:13 11-Jun-2010 mapupdate MODE_READ up4mutkj52kcm2l7c7nvg5j2ua No -NA- 100.0% Finished 21:32:56 11-Jun-2010 retrieve up4mutkj52kcm2l7c7nvg5j2ua No 620B 100.0% Finished
Argh! These timestamps are in different timezones and neither of them have explicit timezone indicators. Grumble. Also they are of different and non-standard formatting. I just created #1077 (consistent timestamp format and timezone).
Anyway, making some educated guesses about what these timestamps mean, the upload that I completed at around 2010-06-12 03:45:30Z should have appeared in the list as "11-Jun-2010 21:45:30".
It seems like immutable file uploads into a directory never appear on Recent Uploads/Downloads, but immutable file downloads and unlinked immutable file uploads do.
Change History (7)
comment:1 Changed at 2010-07-26T07:00:52Z by zooko
- Keywords easy added
- Milestone changed from undecided to 1.8β
comment:2 Changed at 2010-09-11T00:37:26Z by davidsarah
- Milestone changed from 1.8β to 1.9.0
Out of time for 1.8.
comment:3 Changed at 2011-08-09T17:44:11Z by warner
I did some digging. The problem is that we aren't being consistent in passing the "History" object to all cases of file upload. (to get into the "Recent Uploads and Downloads" RUaD page, the Uploader must be given access to the History object, so it can call History.add_upload).
Client.upload(uploadable) does the right thing. The webapi has several different code paths that result in an immutable upload:
- PUT /uri : hits PUTUnlinkedCHK (unlinked.py#L11) which calls client.upload, ok
- PUT /uri/DIRCAP/childname: hits filenode.py#L37 which calls self.parentnode.add_file(), which does *not* handle history
- POST /uri/DIRCAP/newchildname?t=upload and POST /uri/DIRCAP/oldchildname?t=upload&replace=true : both hit replace_me_with_a_formpost (filenode.py#L86), uses self.parentnode.add_file(), *no* history
The root problem is that DirectoryNode.add_file(), while convenient, doesn't have access to the History object. The best fix is probably to delete this method, and rewrite web/filenode.py to make two separate calls: client.upload and self.parentnode.set_uri.
OTOH, add_file() is used in an awful lot of unit tests, because it's so darned convenient. It'd be easier to change DirectoryNode.add_file to use client.upload, since the client knows about History, but DirectoryNode doesn't currently hold a reference to the client (just the nodemaker and the uploader). Maybe we should move client.upload over to the nodemaker?
comment:4 follow-up: ↓ 5 Changed at 2011-08-10T06:36:32Z by davidsarah
The SFTP and FTP frontends also use add_file.
comment:5 in reply to: ↑ 4 Changed at 2011-08-10T14:51:58Z by davidsarah
Replying to davidsarah:
The SFTP and FTP frontends also use add_file.
As does the drop-upload frontend. All of these have access to the Client, so one possibility would be to add a client= argument to add_file. But since all uploads should be included in the history, I would think (without having looked in detail at the code) that the uploader should have (that is, be instantiated with) a reference to the History.
comment:6 Changed at 2011-08-29T06:33:11Z by Brian Warner <warner@…>
- Owner set to Brian Warner <warner@…>
- Resolution set to fixed
- Status changed from new to closed
In fd676a5846fce5da:
(The changeset message doesn't reference this ticket)
comment:7 Changed at 2011-08-29T06:35:23Z by warner
excellent idea! Just landed it. I don't know why I didn't think of that before.. it might be that I've been hoping to get rid of the Uploader service (as we did with the old Downloader service), and so I didn't want to add anything extra to it. But that's a project for another day, and adding History to the Uploader is the perfect solution for this. Thanks!
This shouldn't be hard to fix and it would be a big help with evaluating and improving Tahoe-LAFS performance if we could tell how fast uploads were.