Commit Graph
37 Commits
Author SHA1 Message Date
Kenneth Skovhede 40dd3c6816 Updated all license mentions to MIT 2024-02-28 15:45:30 +01:00
Riccardo Paolo Bestetti 528478fda4 Implement exponential backoff for backend errors 2022-01-20 23:22:08 +01:00
Sean Templeton a9c16fcefa Upload filesets last during a backup
If parallel uploads are enabled it is possible for the fileset to be uploaded before all dblocks are uploaded.
When the fileset is placed in the queue to be uploaded place it in a separate list and only upload it after all dblocks have been uploaded.

Fixes #4341
2020-10-29 21:19:15 -05:00
Kenneth Hsu 197a15e032 Fix log message for retried upload operations.
The number of attempts is one (the first attempt) plus the number of
retries.
2020-03-01 12:07:05 -08:00
Kenneth Hsu 1c492647ae Rename method parameter for consistency. 2019-10-05 11:25:22 -07:00
Kenneth Hsu 0cdc5b9159 Ensure that dindex contains correct dblock file after renames.
When support for parallel uploads was implemented, we overlooked a case
where a failed put of a dblock file is retried with a different
filename.  In this case, an instance of TemporaryIndexVolume was created
in the DataBlockProcessor or SpillCollectorProcess prior to the
attempted put.  The put would fail, and then retried with a different
filename.  While the Remotevolume table in the database would reflect
the new filename, the TemporaryIndexVolume still contained a reference
to the old dblock filename.  This would cause issues in direct restores,
etc., when the referenced dblock file could not be found.

Now, the TemporaryIndexVolume is only created after the dblock put has
completed.

This addresses issue #3932.
2019-10-05 10:46:39 -07:00
Kenneth Hsu 7fd815b56e Simplify comment. 2019-07-06 15:34:46 -07:00
Kenneth Hsu c149792973 Dispose Backends after upload operations.
This addresses issue #3808.
2019-07-06 15:33:59 -07:00
Kenneth Hsu bfa3c120e5 Make Worker implement IDisposable.
This will allow the underlying Task and Backend to be disposed.
2019-07-06 12:50:37 -07:00
Kenneth Hsu 914203c071 Reorder methods alphabetically. 2019-04-06 21:42:01 -07:00
Kenneth Hsu e3c16c58fd Set flushed result after all tasks have completed. 2019-03-31 19:41:09 -07:00
Kenneth Hsu be21e09db1 Cancel the FlushBackend task if upload exception occurs.
This should avoid the problem of something awaiting a
FlushBackend.LastWriteSizeAync task that may never complete.
2019-03-31 19:41:09 -07:00
Kenneth Hsu 9a80e422e9 Remove unnecessary try-finally.
The only code in the finally block was to set the result of the
FlushRequest if the completed task was not faulted.  This could be done
without the try-finally.
2019-03-31 19:38:42 -07:00
Kenneth Hsu fdb2c6788c Ensure that failed put operations throw exception.
The FlushBackend method uses Task.WhenAny to await the first completion
of the uploader task or the flush request.  Since the uploader was
setting the status of the flush request in the finally block, the flush
request would complete first when an exception was thrown, causing the
uploader's exception to be unobserved.  To resolve this,  we check that
the uploader's status is not faulted before setting the flush request
status.

This addresses issue #3673.
2019-03-31 19:38:40 -07:00
Kenneth Hsu da4dabe838 Fix typo in async property name. 2019-03-28 20:53:55 -07:00
Sean Templeton b02b19e683 Change Put method name to PutAsync 2019-03-17 18:28:45 -05:00
Sean Templeton 19c1c908df Check upload throttle speed every 2 seconds
The upload throttle speed was being checked on average once every
5 milliseconds.

Changed a few variable names.
2019-03-13 21:51:06 -05:00
Sean Templeton cc3e94fece Fix code review comments and other minor changes
- Rename indexVolume to indexVolumeWriter in DataBlockProcessor to reduce
confusion.

- When flushing the remaining uploads, check the tasks for exceptions in
completion order rather than waiting for them all at once. If there is an
exception all other uploads are cancelled anyway.

- Remove setting the operation progress as Backup_WaitForUpload in the
BackendUploader since the BackupHandler sets it.

- Use an exception filter in BackendUploader.

- Use Options property MaxUploadPrSecond instead of getting the raw value.
2019-03-13 21:51:06 -05:00
Sean Templeton 8bd4b825c8 Fix several Codacy issues 2019-03-13 21:51:05 -05:00
Sean Templeton 61f511c087 Properly catch exceptions from an upload and cancel all other uploads
If a backend throws an exception while uploading, cancel other uploads and
throw an exception from the BackendUploader. Exceptions from cancelled
uploads are caught and not thrown so as to not spam the user with useless
information.
2019-03-13 21:51:02 -05:00
Sean Templeton ac08aa2fb1 Dynamically throttle and track the progress of concurrent uploads
Changed AddBackendEvent() in ResultClasses to allow the option to not update
the backend progress. This allows the  BackendUploader to log the act of starting
an upload without changing the backend progress. The backend progress is now
handled by a new class, FileProgressThrottler, which will determine the transfer
rate of all uploads currently in progress.

This class also handles throttling the upload streams. The algorithm will try
to decrease or increase the streams throttle rates as appropriate by changing
the value based on the over/under amount or based on a percentage to prevent
throttling one stream directly to zero.
2019-03-05 21:25:35 -06:00
Sean Templeton 12b15c09c8 Add asynchronous-concurrent-upload-limit option
This new option limits the number of concurrent uploads allowed when
performing asynchronous uploads. The default value is 4.
2019-03-05 21:25:35 -06:00
Sean Templeton 0c122ff550 Change IBackend and IStreamingBackend to return Task for Put() 2019-03-03 21:43:10 -06:00
Sean Templeton 3de04da39e Run each upload on a separate thread
Added a small Worker class, private to the BackendUploader, to track the
upload tasks and the backend for each task.
2019-03-03 21:43:00 -06:00
Sean Templeton 1029d99e10 Simplify BackendUploader and remove unnecessary code 2019-03-03 21:42:58 -06:00
Sean Templeton 05c3f4808c Move encrypting, hashing, and creating index volumes out of BackendUploader
Encrypting, hashing, and creating index volumes are now done
in the DataBlockProcessor and the SpillCollectorProcess. This allows
uploads to always be transferring data and not have to stop to create
a file, encrypt data, etc.
2019-03-03 21:41:09 -06:00
Sean Templeton 4f4529a88a Move upload related code from BackendHandler to BackendUploader
As the BackendUploader is in charge of uploads the code has been moved
there to centralize the responsibility and prepare for parallel uploads.
2019-03-03 21:35:09 -06:00
Kenneth Skovhede bce1db123a Merge branch 'master' into feature/speedup_backup_index_files
# Conflicts:
#	Duplicati/Library/Utility/Utility.cs
2018-06-08 10:31:27 +02:00
Kenneth Hsu f12858e6a5 Mark fields that shouldn't be reassigned as readonly.
This makes it explicit at compile-time that these fields should not be
reassigned outside the constructor.
2018-05-25 10:04:52 -07:00
Kenneth Skovhede 3081447271 Added an on-the-fly index builder to avoid querying the database for each volume 2018-04-30 14:04:30 +02:00
Kenneth Skovhede 860924bb62 Updated main functions to new CoCoL library 2017-09-20 21:03:24 +02:00
Kenneth Skovhede 21b7a98dc3 Implemented the blocking flag in the uploader 2017-09-19 14:18:54 +02:00
Kenneth Skovhede a3f2b39d23 Implemented handling of pause/stop/abort in the concurrent code.
Implemented the dry-run feature for backups.
2016-02-29 21:52:11 +01:00
Kenneth Skovhede 537fe20838 Added a lot of comments.
Fixed a few issues that caused parallel uploads.
Fixed the use of the encryption module so the encryption module is not re-used for multiple jobs.
2016-02-25 19:15:51 +01:00
Kenneth Skovhede 20f7b42945 Fixed channels to use type-safe initializations.
Updated logging channel to use a wrapper for later early-filter optimizations.
Various bug fixes and optimizations.
2016-02-24 23:48:42 +01:00
Kenneth Skovhede 37d04b7b19 More work on making the backup process use the concurrent constructs 2016-02-22 22:40:27 +01:00
Kenneth Skovhede 3ff2f1eb98 The concurrent processing now seems to work, at least in the base case.
Rewrote the handling of index volumes to create them on-demand instead of in-advance.
This makes it much simpler to handle upload failures.
2016-02-22 21:27:12 +01:00