Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial implementation of the new chunked upload #20118

Merged
merged 4 commits into from Apr 13, 2016

Conversation

DeepDiver1975
Copy link
Member

as specified in https://dragotin.wordpress.com/2015/06/22/owncloud-chunking-ng/

@dragotin here we go

@PVince81 @icewind1991 @schiesbn @rullzer @blizzz @nickvergessen

Please have a look - THX

Yes - more tests are to be written - on it

@ghost ghost added the in progress label Oct 28, 2015
@DeepDiver1975 DeepDiver1975 added this to the 9.0-current milestone Oct 28, 2015
@PVince81
Copy link
Contributor

How does this stream work and still exist between PHP requests ? I see fseek is disabled. Maybe not implemented yet ?

@DeepDiver1975
Copy link
Member Author

How does this stream work and still exist between PHP requests ? I see fseek is disabled. Maybe not implemented yet ?

the AssemblyStream will assembly the chunk files while the file is moved/copied to it's final destination.

There is no intent to have it available between requests.

Up to now I don't see the need to seek

@PVince81
Copy link
Contributor

I still don't understand. Is the AssemblyStream used for a single chunk then, and it would save each chunk as separate files like we did in the past ?

So basically when uploading 3 chunks, the client does 3 PUT requests, each gets its own AssemblyStream that saves the chunk contents into a file.

But then who puts the chunks together ?

@PVince81
Copy link
Contributor

How does this fit with:
PUT remote.php/uploads/upload-id/chunk-id
and
MOVE remote.php/uploads/upload-id /path/to/target-file

I can't seem to infer this from the code.

@DeepDiver1975
Copy link
Member Author

@DeepDiver1975
Copy link
Member Author

this magic .file file is implemented as this FutureFile which uses the AssemblyStream to stream all chunks to the destination.

@PVince81
Copy link
Contributor

Okay, so is the AssemblyStream internally putting the chunks into that file at the right position, doing a fseek internally ? I suppose those "nodes" are actually the ranges ? (that's why I asked about fseek)

@PVince81
Copy link
Contributor

So the AssemblyStream is actually simulating a single stream based on several chunk files, and is read by the MOVE operation (I thought AssemblyStream was for putting, not for reading, that's why I was confused). So the chunk files themselves simply get uploaded as if they were regular files.

Did I get it correctly ? 😄

@DeepDiver1975
Copy link
Member Author

So the AssemblyStream is actually simulating a single stream based on several chunk files, and is read by the MOVE operation

yes


use Sabre\DAV\IFile;

class AssemblyStream implements \Icewind\Streams\File {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment here to explain the AssemblyStream to avoid the many possible confusions ?

@PVince81
Copy link
Contributor

Cool stuff 😄

class AssemblyStream implements \Icewind\Streams\File {

/** @var resource */
private $context;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm reasonably sure this needs to be public

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@icewind1991 can you elaborate? I did not face any issues having this private

@karlitschek
Copy link
Contributor

do we really want to do this for 9.0 ? Not sure we have the capacity


// sort the nodes
$nodes = $this->nodes;
@usort($nodes, function(IFile $a, IFile $b) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the @?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea ;-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah - because of that:

usort(): Array was modified by the user comparison function

@DeepDiver1975
Copy link
Member Author

@karlitschek the code is ready since month. No reasons to wait any longer from my pov.

@schiessle
Copy link
Contributor

did you already tried this with encryption enabled? Wonder how this works if uploaded chunks don't meet the expected chunk size of a encryption block? For the last chunk of a file encryption apply padding to meet the expected size. So maybe we will just end up with some additional padded chunks in the middle of the file. So it could work, just increase the size of the encrypted file a bit... but will fseek work on such a file? We need to test this in detail if not already happened.

@DeepDiver1975
Copy link
Member Author

did you already tried this with encryption enabled? Wonder how this works if uploaded chunks are not meet the expected chunk size of a encryption block? For the last chunk of a file encryption apply padding to meet the expected size. So maybe we will just end up with some additional padded chunks in the middle of the file. So it could work, just increase the size of the encrypted file a bit... but will fseek work on such a file? We need to test this in detail if not already happened.

Nice input - thanks a lot! We need to add tests with encryption enabled.


list($node, $posInNode) = $this->getNodeForPosition($this->pos);
if (is_null($node)) {
return null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a string as indicated in PHP Doc

}

function createFile($name, $data = null) {
// TODO: verify name - should be a simple number
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intend to complete this before merging?

@blizzz
Copy link
Contributor

blizzz commented Oct 29, 2015

Overall this looks nice and clean, though information is a bit sparse, as pointed out by @PVince81.

@MTRichards
Copy link
Contributor

Estimation: 2 Days

DeepDiver1975 and others added 3 commits April 12, 2016 12:32
The same intergration tests as for the old endpoint.
But now using the new chunking.

We upload 3 chunks in different order and the result should be the same
in all three.
@DeepDiver1975
Copy link
Member Author

Unit and integration tests are passing - let's move this in

@DeepDiver1975
Copy link
Member Author

@rullzer @dragotin final review please - thx

@dragotin
Copy link
Contributor

For the record: We do not have the implementation on the client yet. It is not likely that it will be finished before this is released with the server.

@DeepDiver1975
Copy link
Member Author

For the record: We do not have the implementation on the client yet. It is not likely that it will be finished before this is released with the server.

as soon as there is anything in the client available we will start testing asap - got that.
In addition we will enhance our own integration tests over the upcoming months

@dragotin
Copy link
Contributor

integration test cool

*/
function checkMove($source, $destination) {
$sourceNode = $this->server->tree->getNodeForPath($source);
if ($sourceNode instanceof FutureFile) {
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't that a bit to liberal? What if the file we are uploading to does not allow updates?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a valid scenario we need to cover in the second part of the implementation which is know as 'Announcing the upload'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah OKIDOKI then.

@rullzer
Copy link
Contributor

rullzer commented Apr 13, 2016

Lets do this! 👍

@DeepDiver1975
Copy link
Member Author

THX

@DeepDiver1975 DeepDiver1975 merged commit 3c0a1d4 into master Apr 13, 2016
@DeepDiver1975 DeepDiver1975 deleted the chunked-upload-dav branch April 13, 2016 12:37
@rperezb
Copy link

rperezb commented May 17, 2016

@DeepDiver1975 @dragotin from a qa pov, is it needed further testing in addition to integration ones?
thx
@owncloud/qa

@DeepDiver1975
Copy link
Member Author

from a qa pov, is it needed further testing in addition to integration ones?
thx

no - we need a client supporting this to setup all the smashboxing and so on

@rperezb
Copy link

rperezb commented May 17, 2016

@mcastroSG this is of your interest, perhaps you may help with the smashbox too

@DeepDiver1975
Copy link
Member Author

perhaps you may help with the smashbox too

hold your horses - as said we first need a client supporting the new chunking and use the new webdav endpoint

@SergioBertolinSG
Copy link
Contributor

Apparently ownbrander can be used for creating a client with a custom endpoint. Not sure if that can be used with smashbox in jenkins though.

@DeepDiver1975
Copy link
Member Author

Ownbrander will not help. Support needs to be added to the client.

@lock
Copy link

lock bot commented Aug 5, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet