Commit Graph
63 Commits
Author SHA1 Message Date
Kenneth SkovhedeandGitHub 0c4fffa6ce Merge branch 'master' into feature/add-sqlite-cache-value 2025-04-23 15:25:00 +02:00
Kenneth Skovhede e6ba6098d7 Implemented immediate transaction commits for almost all uploads.
This ensures that files cannot appear on the remote destination, despite terminating the host program.

This fixes #4485

There is still work needed to handle the repair and compact operations so they use transactions and can commit changes during transfer progress.
2025-04-23 12:11:16 +02:00
Kenneth Skovhede 0a7a1cd689 Added option to set the SQLite page cache
This adds an extra option to allow setting the SQLite page cache size as a regular option.

Prior to this commit it was only possible to set the SQLite page cache size via environment variables.

The option to use environment variables is preserved, and as options from the environment variable are applied after the new setting, environment variables take precedence.

The default value for the new option is to use 1% of the system memory for the page cache. For the restore process, a connection per worker may be made which defaults to half the number of cores, so the maximum amount of memory is 1% * half the CPU cores.

This is just the upper limit, and SQLite may choose not to use all of it.

This fixes #6178
2025-04-22 14:26:46 +02:00
Kenneth Skovhede faede65d8d Changed transactions to use a wrapper that ensures a transaction is allocated. 2025-04-14 12:04:00 +02:00
Kenneth Skovhede 8753e5dc85 Merge remote-tracking branch 'origin/master' into feature/improve-compact-block-use-check 2025-04-01 15:54:54 +02:00
Kenneth Skovhede 7f008341df Untangle the results and database
The code was using a two-way reference linking the database to the results and the results to the database.

However, this was not really used so it ended up just cluttering the code. With this commit, the results and databases are no longer keeping track of each other, and the only interaction is when the results are written to the database at the end of the operation.

To ensure result data is always written, this code has been moved into the controller, which will now flush the results for all operations. Prior to this, only some operations would write result data to the log.

The controller now also handles logic for cleaning old log data and invoking the vacuum command.

Fixed a bug due to using System.Text.Json where some attributes from NewtonSoft.Json were being applied and not picked up.
2025-03-20 09:51:49 +01:00
Kenneth Skovhede c1bdaa069e Async operation handlers
Rewrote all operation handlers to be async.
This moves the async/sync threshold out into the controller.

Fixed all the uses of cancellation token in the handlers to use the provided cancellation token.

Introduced a new ReusableTransaction that can be passed around, avoiding a ref parameter passing of the transaction instance.
2025-03-14 10:41:14 +01:00
Kenneth Skovhede 5edfcc5c6a Prevent blocksize near remote volume size
If the user selects the blocksize to be the same as the remote volume size, this will cause each block to be in a separate volume and will trigger repeated compact calls.

This commit adds a check that ensures the volume size is large enough to hold at least two blocks.

Also fixed an issue where the compact could create volumes larger than the set limit (at most one block larger).
2025-03-13 12:09:57 +01:00
Kenneth Skovhede 1de0a92413 Strategy is now to disallow compact/delete/purge if the remote state contains partial data.
Backup will auto-repair, and user otherwise need to call "repair" to recover the state, before invoking compact/delete/purge.
This is done to prevent cases where the remote state contiains partial data and the automatic cleanup process would remove remote files.
2025-03-08 15:28:02 +01:00
Kenneth Skovhede ca236f03e3 Renamed flag to more precisely describe the purpose 2025-03-06 14:56:35 +01:00
Kenneth Skovhede 1321488527 Improve failure detection
This commit adds extra logic to prevent cases where the backup reports success but leaves behind partial files.

A new flag is recorded to track if partial files are possible. If no partial files are possible, the verification will fail if any are found.
2025-03-06 12:02:11 +01:00
Kenneth Skovhede 7031bc57b6 Adding ConfigureAwait(false) to all async enumerations 2025-02-18 09:18:36 +01:00
Kenneth SkovhedeandGitHub d99f74ed94 Rewrite the backend manager. (#5896)
* Rewrite the backend manager.

This creates a new more logic backend manager that handles all backend operations.

For each top-level operation, there is now a single backend manager instance that is passed to sub-commands.

The internals of the backend manager are now rewritten to use async logic instead of threading.

The design uses a single task runner that dispatches operations and honors concurrent settings and limits from one place.

The logic for each operation has been moved into a separate files/classes to make it easier to understand each operation.

This fixes #5804

* Fixed a few issues with not awaiting tasks

* Fixed not creating empty databases

* Fixed an issue with hashes not being recorded on download

* Reworked the download logic to avoid attempting to decrypt the file if it has been modified.

* Review fixes

* Renamed db collector to better reflect the purpose.

* Review fixes
2025-01-28 08:54:50 +01:00
Kenneth SkovhedeandGitHub 9464caf622 Feature/update license 2025 (#5851)
* Fixed some minor whitespace issues

* Updated all copyright to 2025
2025-01-07 09:40:39 +01:00
Kenneth SkovhedeandGitHub ff1b2b7990 Simplified task control (#5753)
* Simplified task control by having all logic in a single class and using async control mechanism
* Fixed the tests
* Made the marking of a backup partial explicitly communicated if the enumeration process is stopped.
* Added support for pausing active transfers
* Introduced transfer token to abort operations.
* Updated the way LiveControl is emitting events.
* Retains the paused state of the server across reboots, this fixes #5760.
* Reworked the way throttle speeds are propagated through LiveControls.
* Added option to pause transfers in the UI.
* Removed throttle settings from the LiveControls class so it is exclusively handled by the ApplicationSettings.
* Removed `thread-priority` as it does not work at all when tasks are used.
* Fixed the stop dialog and API to only support stop and abort.
* Removed unused variables
2024-12-18 08:27:59 +01:00
Kenneth Skovhede 07843c6c2d This adds additional checks to the check if a block is in use, by checking if it is in use by the volume that we are examining.
This is taken from #4982
2024-11-01 16:45:25 +01:00
Kenneth Skovhede db517a300b Implemented a fix for compaction issues that could cause inconsistent views of the remote storage. 2024-11-01 14:50:26 +01:00
Carl Johnsen 20aea95007 Fixed inconsistent variable naming 2024-10-21 17:50:18 +02:00
Carl Johnsen ce64b7e549 Sped up preliminary work in DoCompact.
The first optimization was to add guards around the queries in case the second collection is empty (which is was when the slow path was found).
The second optimization is to use a HashSet for the second collection, as this speeds up lookup, compared to using two List of string.
2024-10-21 14:27:18 +02:00
Kenneth Skovhede c890e824ee Implemented test for reproducing issue #5196
Fixed issue by changing order options are written and verified.
Some whitespace changes due to renaming a method
2024-05-21 15:48:29 +02:00
Kenneth Skovhede 40dd3c6816 Updated all license mentions to MIT 2024-02-28 15:45:30 +01:00
Janandgpatel-fr b894a197a9 Fix missing file error caused by interrupted compact.
Before the dindex files are deleted on the remote, update the state in the database to Deleting. Previously, only dblock files were handled this way.
Patch by warwickmm
Closes #4129
2023-09-21 22:56:52 +02:00
Kenneth Hsu b53770b589 Add VerifyRemoteList overload to reduce duplicated code. 2020-04-05 11:46:08 -07:00
Sean Templeton d5e064ae45 Fix a few more issues with stop now
When a backup is interrupted it will now show as a partial backup in the list of backups on the restore files page.

Temporary filelist volumes are protected from deletion in several places. All but the RestoreHandler
only protect the most recent filelist. The RestoreHandler protects all temporary filelist volumes as the user
might be restoring from one that would be deleted.

Prevent the CoCoL BackendRequests channel is retired exception from appearing when the backup is stopped by checking
if the channel is retired before trying to add the FlushRequest to the channel. Any exceptions from the BackendUploader
task will still be thrown.
2020-03-01 21:19:07 -06:00
Sean Templeton 04662bace1 Write blocklists when compacting files
The list folder was not being written to dindex files when performing a
compact operation. After the data blocks have been moved to a new volume
and the new volume data is finished being written to the new index file,
read the blocklists from the database and write them to the new index
file.
2020-01-19 21:57:08 -06:00
Kenneth Hsu 2aa76881a5 Mark fields that don't need to be reassigned as readonly.
This makes it explicit at compile-time that these fields should not be
reassigned outside the constructor.
2019-10-19 13:59:22 -07:00
drwtsn32x cfeabfb2dd Add auto vacuum interval option 2019-07-29 17:56:43 -07:00
Kenneth Hsu 457254d9e1 Remove unused local variables. 2019-04-17 20:10:53 -07:00
Kenneth Hsu e82c11b39b Avoid possible null reference exception. 2019-02-16 20:43:05 -08:00
Kenneth Hsu 3fc9276cdd Remove temp files when compact operation is not performed.
This concerns issue #3652.
2019-02-16 19:53:06 -08:00
Kenneth Hsu d72128ec83 Remove unused method parameters. 2018-10-06 15:09:43 -07:00
Kenneth Hsu 9c6bccf478 Use braces to improve readability.
Previously, the indentation of the following code block gave the
impression that it was part of the foreach loop when in fact it would
only be executed once.
2018-05-13 14:24:13 -07:00
Kenneth Skovhede 842fd96543 Implemented a new logging system that is more transparent and allows a more granular way of picking log messages.
Added ID's to each log message and each exception to allow later introduction of a Knowledgebase service that explains each error in more detail.
2018-03-15 09:12:34 +01:00
Kenneth Skovhede 7c14ea338d Merge branch 'feature/fix-compact-size-reports' 2017-09-18 14:38:37 +02:00
Kenneth Skovhede 10ef42ce39 Fixed an issue with reporting incorrect file size for uploads 2017-09-18 13:27:30 +02:00
Kenneth Skovhede e0d8a57ccc Added re-use of the backend across the operations in the backup step.
This should fix the AmzCD consistency issue where it does not wait for the listing after performing a delete.
2017-09-18 11:54:48 +02:00
Dan Stahr 58a95e03e6 Autovacuum option added 2017-08-04 12:09:01 +01:00
Kenneth Skovhede 4bf4871427 Added commandline operation to purge select files from filesets.
This fixes #1009.
This paves the way for #1337.
2016-12-29 22:41:13 +01:00
Kenneth Skovhede 32423d78b5 Added EndTime value in a few places.
This fixes #2127
2016-12-02 00:08:09 +01:00
Kenneth Skovhede 0c68daff6c Fixed all whitespace to be 4 spaces instead of tabs 2016-09-15 11:39:27 +02:00
Kenneth Skovhede 2ce8b4d8c7 Fixed an error message that did not report any information 2016-06-22 11:21:13 +02:00
Kenneth Skovhede 9bfc39120a Improved handling the compaction process with errors, such that deletes are marked and commited to the database before actually being deleted, causing fewer issues when resuming the operation afterwards. 2015-11-17 21:32:55 +01:00
Kenneth Skovhede 6fa57528a9 Fixed some cases where an interrupted upload would cause a deleted remote file to be attempted verified repeatedly. 2015-09-16 21:25:32 +02:00
Kenneth Skovhede e13978d1c0 Improved handling of non-standard blocksize and hashing algorithms 2015-04-08 20:33:30 +02:00
Kenneth Skovhede 3c595b61c9 Fixed duplicate logging of operation results 2014-07-16 00:57:57 +02:00
Kenneth Skovhede bd53090ae7 Implemented the pause/resume/stop/start methods throughout the calls to allow for interactive control over the tasks 2014-05-15 12:47:16 +02:00
Kenneth Skovhede d6e53e47a7 Added option to read more than --blocksize bytes from a file at a time 2013-08-30 22:46:34 +02:00
Kenneth Skovhede 9cac8edaec Fixed issue with compact not registering indexblocklinks 2013-08-27 10:23:21 +02:00
Kenneth Skovhede 140b3575ee Fixed output from delete command so it includes size 2013-08-25 07:49:31 +02:00
Kenneth Skovhede 15ab57f81f Inverted compact messags from dry-run vs normal run 2013-08-24 22:31:16 +02:00