-
Notifications
You must be signed in to change notification settings - Fork 668
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
Group requests to ensure balance between bandwidth utilization and bookkeeping #5391 #5390 #4498 #1633 #4454 #5440
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -313,6 +313,13 @@ void OwncloudPropagator::start(const SyncFileItemVector& items) | |
directories.push(qMakePair(QString(), _rootJob.data())); | ||
QVector<PropagatorJob*> directoriesToRemove; | ||
QString removedDirectory; | ||
|
||
// This needs to be changed before marging - capability to switch on/off scheduling, since | ||
// server needs to decide if to do that - scheduling will also bring more features in the future | ||
// TODO: change it before marging to -> bool enableScheduledRequests = account()->capabilities().scheduling(); | ||
bool enableScheduledRequests = true; | ||
|
||
PropagateFiles* filesJob = new PropagateFiles(this); | ||
foreach(const SyncFileItemPtr &item, items) { | ||
|
||
if (!removedDirectory.isEmpty() && item->_file.startsWith(removedDirectory)) { | ||
|
@@ -389,6 +396,9 @@ void OwncloudPropagator::start(const SyncFileItemVector& items) | |
currentDirJob->append(dir); | ||
} | ||
directories.push(qMakePair(item->destination() + "/" , dir)); | ||
} else if (enableScheduledRequests | ||
&& (item->_instruction == CSYNC_INSTRUCTION_NEW || item->_instruction == CSYNC_INSTRUCTION_SYNC)) { | ||
filesJob->append(item); | ||
} else if (PropagateItemJob* current = createJob(item)) { | ||
if (item->_instruction == CSYNC_INSTRUCTION_TYPE_CHANGE) { | ||
// will delete directories, so defer execution | ||
|
@@ -400,6 +410,13 @@ void OwncloudPropagator::start(const SyncFileItemVector& items) | |
} | ||
} | ||
|
||
if (enableScheduledRequests && !filesJob->isEmpty()){ | ||
// This job has parallelism WaitForFinished to allow directoriesToRemove be last | ||
_rootJob->append(filesJob); | ||
} else { | ||
delete filesJob; | ||
} | ||
|
||
foreach(PropagatorJob* it, directoriesToRemove) { | ||
_rootJob->append(it); | ||
} | ||
|
@@ -459,6 +476,20 @@ quint64 OwncloudPropagator::chunkSize() | |
return chunkSize; | ||
} | ||
|
||
quint64 OwncloudPropagator::smallFileSize() | ||
{ | ||
// A small filesize item is a file whose transfer time | ||
// typically will be lower than its bookkeeping time. | ||
static uint smallFileSize; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer explicit There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, copy from ChunkingNG |
||
if (!smallFileSize) { | ||
smallFileSize = qgetenv("OWNCLOUD_SMALLFILE_SIZE").toUInt(); | ||
if (smallFileSize == 0) { | ||
ConfigFile cfg; | ||
smallFileSize = cfg.smallFileSize(); | ||
} | ||
} | ||
return smallFileSize; | ||
} | ||
|
||
bool OwncloudPropagator::localFileNameClash( const QString& relFile ) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes one purpose of the PropagateDirectory structure: update the directory's etag in the database only once child files have been synced properly.
I can't wrap my head about the conditions where this could be an issue, but @ogoffart should know if this could cause concrete problems.
See e.g.
client/src/libsync/owncloudpropagator.cpp
Line 705 in 1cec2ca
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing out, did not know about this, dont think it is difficult to resolve but let @ogoffart see this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mrow4a @jturcotte @ogoffart If I'm not mistaken the following is a situation in which that dependency structure could lead to an abort-related problem:
now when someone touches /A/F on the server, the server state becomes
but if I understand correctly the propagation dependency graph is
meaning that /A and /A/F run independently of each other. So it would be possible to completely finish propagating /A before the file transfer /A/F is done. Then aborting the sync run could lead to the db tree
Which means a follow up sync would probably not pick up on /A/F being out of date.
Maybe this hints at a second dependency problem: Currently local and remote MkDir are FullParallelism - so isn't there a chance that with this change one could run into a case where the client wants to download or upload into a non-existant directory?
Possibly I'm missing something, feel free to point out incorrectness.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it wont upload to non-existent directory, because directory structure / resolving conflicts etc are done before any transfers, and directory deletions are done after https://github.com/owncloud/client/pull/5440/files#diff-c9731f430e8a29b13deaaf73bc4a4e22R56
https://github.com/owncloud/client/pull/5440/files#diff-20b960bb10cf3c0781a80fb3e5775241R493
https://github.com/owncloud/client/pull/5440/files#diff-7e5082f89a138020f2b1d37fc97d17dbR420
About the etag propagation did not look into the problem yet, because we dont have yet smashbox automation for PRs (it is nearly done) and I am busy on the server side before the release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mrow4a Okay, I didn't see that. (btw, _runningNow is gone, so this branch doesn't compile - probably was rebased at some point?) In that case the second problem can indeed not happen.