upload of file into dir doesn't appear on Recent Uploads and Downloads #1079

Closed
opened 2010-06-12 04:29:09 +00:00 by zooko · 7 comments

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.

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.
zooko added the
code-frontend
major
defect
1.7β
labels 2010-06-12 04:29:09 +00:00
zooko added this to the undecided milestone 2010-06-12 04:29:09 +00:00
Author

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.

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.
zooko modified the milestone from undecided to 1.8β 2010-07-26 07:00:52 +00:00
davidsarah commented 2010-09-11 00:37:26 +00:00
Owner

Out of time for 1.8.

Out of time for 1.8.
tahoe-lafs modified the milestone from 1.8β to 1.9.0 2010-09-11 00:37:26 +00:00

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?

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?
davidsarah commented 2011-08-10 06:36:32 +00:00
Owner

The SFTP and FTP frontends also use add_file.

The SFTP and FTP frontends also use `add_file`.
davidsarah commented 2011-08-10 14:51:58 +00:00
Owner

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.

Replying to [davidsarah](/tahoe-lafs/trac-2024-07-25/issues/1079#issuecomment-77935): > 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`.
Brian Warner <warner@lothar.com> commented 2011-08-29 06:33:11 +00:00
Owner

In changeset:fd676a5846fce5da:

Let Uploader retain History instead of passing it into upload(). Fixes #1079.

This consistently records all immutable uploads in the Recent Uploads And
Downloads page, regardless of code path. Previously, certain webapi upload
operations (like PUT /uri/$DIRCAP/newchildname) failed to pass the History
object and were left out.
In changeset:fd676a5846fce5da: ``` Let Uploader retain History instead of passing it into upload(). Fixes #1079. This consistently records all immutable uploads in the Recent Uploads And Downloads page, regardless of code path. Previously, certain webapi upload operations (like PUT /uri/$DIRCAP/newchildname) failed to pass the History object and were left out. ```
tahoe-lafs added the
fixed
label 2011-08-29 06:33:11 +00:00
Brian Warner <warner@lothar.com> closed this issue 2011-08-29 06:33:11 +00:00

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!

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!
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Reference: tahoe-lafs/trac-2024-07-25#1079
No description provided.