Skip to content

Chunking ng#5102

Merged
guruz merged 21 commits into
masterfrom
chunking-ng
Nov 15, 2016
Merged

Chunking ng#5102
guruz merged 21 commits into
masterfrom
chunking-ng

Conversation

@ogoffart

@ogoffart ogoffart commented Aug 3, 2016

Copy link
Copy Markdown
Contributor

No description provided.

@mention-bot

Copy link
Copy Markdown

@ogoffart, thanks for your PR! By analyzing the annotation information on this pull request, we identified @ckamm, @jturcotte and @dragotin to be potential reviewers

Comment thread src/libsync/account.h
void setSharedThis(AccountPtr sharedThis);
AccountPtr sharedFromThis();

/// The user that can be used in dav url

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please comment how this relates to the shibboleth user or the user name entered in the wizard

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't know exactly. the answer from @DeepDiver1975 on #engineering (17:26) was not enough for me to make a better comment.

Comment thread src/libsync/owncloudpropagator.cpp Outdated
return job;
} else {
auto job = new PropagateUploadFile(this, item);
static const bool isNg = !qgetenv("OWNCLOUD_CHUNK_NG").isEmpty(); // FIXME! use server version

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it should be rather decided by a server capability. @DeepDiver1975 does the new chunking already add something to the capabilities?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes of course, this is debug only right now.

@ogoffart ogoffart assigned guruz and ckamm and unassigned ogoffart Oct 31, 2016
@ogoffart

Copy link
Copy Markdown
Contributor Author

Ready to be reviewed

@guruz

guruz commented Oct 31, 2016

Copy link
Copy Markdown
Contributor

I think this code is not defensive enough, see my comment with regards to dynamic chunk sizes etc.

Does the server always check transmission checksums by now?

Also: Where are the tests for tx.pl and smashbox?

@PVince81

PVince81 commented Nov 2, 2016

Copy link
Copy Markdown

Does the server always check transmission checksums by now?

This is not implemented yet.

@ogoffart

ogoffart commented Nov 4, 2016

Copy link
Copy Markdown
Contributor Author

Latests commits added tests, and remove the extra chunks before starting an upload

Comment thread src/libsync/account.h

AccountPtr sharedFromThis();

/// The user that can be used in dav url

Copy link
Copy Markdown
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 explaining in what situations that would be different from credentials.user()?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't know. I was just told it could be different and that i had to do an API call even when using the HTTPCrendentials.

@DeepDiver1975 Can you clarify?

* slotComputeTransmissionChecksum()
* |
* v
* slotStartUpload() -> doStartUpload()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Documentation! Yay!

// (Only used from slotPropfindIterate/slotPropfindFinished because the LsColJob use signals to report data.)
QMap<int, quint64> _serverChunks;

quint64 chunkSize() const { return _propagator->chunkSize(); }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could move to Common?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Well, the idea would be that we could do dynamic chunking, so they would be different.


/*
State machine:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Again: very very helpful

* If chunk == -1, returns the URL of the parent folder containing the chunks
*/
void setDeleteExisting(bool enabled);
QUrl chunkUrl(int chunk = -1);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minor: I'd prefer if there was a chunkFolderUrl() and a chunkUrl(int)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah, that's true. But it's internal function anywaéy

_propagator->_journal->setUploadInfo(_item->_file, pi);
_propagator->_journal->commit("Upload info");
QMap<QByteArray, QByteArray> headers;
headers["OC-Total-Length"] = QByteArray::number(_item->_size);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

When we're resuming - is there a way for us to know that the directory we're resuming with has the same OC-Total-Length?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, because the _transferId would be different (the size is xor'ed with it)


quint64 fileSize = _item->_size;

quint64 currentChunkSize = qMin(chunkSize(), fileSize - _sent);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As pointed out above, in bad resumes fileSize might be smaller than _sent.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No, because the file need to be identical.

Comment thread src/libsync/propagateuploadng.cpp Outdated

quint64 currentChunkSize = qMin(chunkSize(), fileSize - _sent);

if (currentChunkSize <= 0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

<= 0 is a bit misleading, since this is a quint64

Comment thread src/libsync/propagateuploadng.cpp Outdated
Q_ASSERT(_jobs.isEmpty()); // There should be no running job anymore
_finished = true;
// Finish with a MOVE
// QString destination = _propagator->_remoteDir + _item->_file; // FIXME: _remoteDir currently is still using the old webdav path

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

outdated comment

Comment thread src/libsync/propagateuploadng.cpp Outdated
return;
}

bool finished = _sent >= _item->_size;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't sent > _item->_size be a fatal error? How would that happen?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You are right, this can't happen, i'll replace with a ==

@ogoffart

ogoffart commented Nov 7, 2016

Copy link
Copy Markdown
Contributor Author

@guruz the client send the checksum header (for the whole file) in the MOVE operation.
I think it would be overkill to do checksum check on every chunk.

@guruz

guruz commented Nov 8, 2016

Copy link
Copy Markdown
Contributor

I'm working on a server patch that does whole file (not chunk) checksum verifying for chunking ng (only).
Then the client code could check if Capabilities::supportedChecksumTypes returns something and only then enable chunking ng.

Comment thread test/testchunkingng.cpp

using namespace OCC;

class TestChunkingNG : public QObject

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see the tmp folder being polluted with folders named ChunkingNG-* - is there some cleanup missing?

root@ci:/tmp/ChunkingNgTest-AQJojC/A# ls -lh
total 287M
-rw-r--r-- 1 jenkins jenkins 287M Nov 11 02:34 a0
-rw-r--r-- 1 jenkins jenkins    4 Nov  4 02:35 a1
-rw-r--r-- 1 jenkins jenkins    4 Nov  4 02:35 a2

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The cleanup is there if the test does not crash. But it seems that the test is crashing. need to investigate why.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see - thanks!

As the file can be some hunreds of megabytes, allocating such big arrays may
cause problems.

Also make the timeout a bit bigger so the test can rununder valgrind.
@ogoffart

Copy link
Copy Markdown
Contributor Author

Checksuming is a server issue and is orthogonal to this problem

@guruz guruz merged commit 52552a4 into master Nov 15, 2016
@guruz guruz deleted the chunking-ng branch November 15, 2016 14:57
@guruz

guruz commented Nov 15, 2016

Copy link
Copy Markdown
Contributor

@SamuAlfageme This needs to be tested with a server 9.2 (e.g. a quite current master branch of the server), previous servers don't have this chunking ng support.

@SamuAlfageme

Copy link
Copy Markdown
Contributor

@guruz noted, will do 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants