Commit Graph
132 Commits
Author SHA1 Message Date
Carl Johnsen da487182ae Connection pool in RestoreDatabase now has a transaction associated with each connection 2025-05-23 15:46:30 +02:00
Carl Johnsen 9693840611 Updated one call that went from Task<IEnumerable> to IAsyncEnumerable 2025-05-22 06:47:38 +02:00
Carl Johnsen d45e977d53 Found more factory construction inconsistencies 2025-05-21 08:47:24 +02:00
Carl Johnsen 3e3a9b5aa9 More SQL query restructuring 2025-05-20 06:07:45 +02:00
Carl Johnsen bdaa976f6b Changed LocalRestoreDatabase to pass the ReusableTransaction instead of its inner transaction 2025-05-19 10:49:22 +02:00
Carl Johnsen 2dabf56c82 Additional SQL query whitespaces 2025-05-19 10:46:50 +02:00
Carl Johnsen cb4e9eb657 Made the LocalDatabase constructor protected to ensure that derived classes won't call the obsolete warning throwing constructor. 2025-05-19 06:40:18 +02:00
Carl Johnsen 1a0c6dcb37 Restructered SQL statements, ensured all calls to the database are async, and that commands are created using a chan of method calls rather than a sequence of statements 2025-05-16 15:49:40 +02:00
Carl Johnsen 88f5fbb963 Moved async code from constructors to factory functions 2025-05-16 15:48:27 +02:00
Carl Johnsen 43dc194acd Changed heavy properties of LocalRestoreDatabase to methods instead 2025-05-16 15:40:04 +02:00
Carl Johnsen 44c037e864 Implemented factory construction of LocalRestoreDatabase 2025-05-16 13:44:57 +02:00
Carl Johnsen f443331cca Removed import to ensure old way of accessing database isn't hit 2025-05-16 12:21:24 +02:00
Carl Johnsen 19009011b2 Updated LocalRestoreDatabase to async using Microsoft.Data.Sqlite 2025-05-16 12:21:24 +02:00
Kenneth Skovhede a271183b44 Merge branch 'fix-restore-duplicate' of github.com:Jojo-1000/duplicati into Jojo-1000-fix-restore-duplicate 2025-04-30 18:32:43 +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 0b735d79ff More cleanup and a few bug fixes 2025-04-03 16:38:51 +02:00
Kenneth Skovhede 2006556778 Fixed some more nullable support in the database layer 2025-04-03 15:46:20 +02:00
Kenneth Skovhede defb5a385b Added LocalRestoreDatabase 2025-04-03 09:00:55 +02:00
Carl Johnsen f73d3390cd The FileProcessor now works in two phases: first it restores the files, then they restore the folder metadata, unless specified otherwise. 2025-03-24 20:24:37 +01:00
Carl Johnsen c19af329f4 Removed whitespace 2025-03-24 14:00:39 +01:00
Kenneth Skovhede fbe79b1ca3 Improve SQLite loading
This commit changes the way the new restore flow loads the extra database connections so these will also apply the temporary folder settings and custom pragmas.

This also changes the logic around the SQLite temporary folder. Previously, this folder would unconditionally be set to the general temporary folder, allowing only an override with a custom pragma.

No the setup checks if the system has the environment variable `SQLITE_TMPDIR` set already. If this variable is already set, it will NOT be overwritten.
Actual effects of this change depends on how SQLite internally resolves the temporary folder.
2025-03-20 10:05:10 +01:00
Kenneth Skovhede fac135d5a5 Updated restore database to not use positional arguments 2025-03-19 22:23:57 +01:00
Kenneth Skovhede 47afbbbdad Fixed a transitional issue 2025-03-19 21:42:08 +01:00
Kenneth Skovhede bb1aa8e1f7 Cosmetic cleanup
Removed superfluous namespaces.
Using `var` most places.
Using extension methods for common setup of commands.
2025-03-14 14:34:56 +01:00
Kenneth Skovhede 7234d43961 Fixed all SQL strings to use interpolation and forced them into the FormattableString handler using the invariant formatting. 2025-03-14 12:13:17 +01:00
Kenneth Skovhede f342d70819 Implemented forced invariant locale on all SQL strings.
This fixes #6023
2025-03-13 23:06:32 +01:00
Carl Johnsen 6e08affd1a Rather than having the tempfile database create new ID's for each entry, reuse the File.ID so the connections that do not have access to the temp table can access the same data. 2025-02-28 10:27:02 +01:00
Carl Johnsen a0eae4131b Cleaned up LocalRestoreDatabase 2025-02-27 14:14:07 +01:00
Carl Johnsen 692954ee97 Made the local restore database use a connection pool for getting block data 2025-02-26 16:08:55 +01:00
Carl Johnsen a49c66bcb5 Added caching of localrestoredatabase data 2025-02-25 17:42:30 +01:00
Carl Johnsen 6d7faf97bb Whitespace 2025-02-25 17:41:57 +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
Carl Johnsen 198e4d8e6e Refactor SQL query formatting 2025-01-03 11:06:49 +01:00
Carl Johnsen 661a73ff2a Merge remote-tracking branch 'upstream/master' into SlowBigRestore 2025-01-03 10:11:50 +01:00
Carl Johnsen 6ba956dfcd Moved all database operations to the LocalRestoreDatabase.
Also changed the old changes, so that the functions related to the legacy restore remains untouched.
2024-12-03 08:35:14 +01:00
Carl Johnsen f85ffabe3e Linux SQLite doesn't want values in quotes 2024-12-02 10:45:52 +01:00
Carl Johnsen 079598c2e8 Added database function for getting files alongside symlinks to restore 2024-11-29 03:41:41 +01:00
Carl Johnsen 7aa9db533e Added preliminary metadata restoration 2024-11-26 20:01:19 +01:00
Carl Johnsen ebac24ce04 Rather than specifying multiple guids for a restore, use the one that the restore database has. 2024-11-25 08:52:51 +01:00
Carl Johnsen 0cd9374bed Added comments and docstrings 2024-11-22 15:26:04 +01:00
Carl Johnsen 43a392f139 The tempfiletable name is also required externally from the database. 2024-11-22 11:26:25 +01:00
Carl Johnsen 50c6fb434c Got the list of block IDs per file 2024-11-08 05:56:48 +01:00
Jojo-1000 917e2cd0c4 Remove obsolete custom platform detection. 2024-05-30 02:14:05 +02:00
Kenneth Skovhede 49fb45859c Fixed some incorrectly quoted literals in SQL statements 2024-04-15 08:24:01 +02:00
Kenneth Skovhede 40dd3c6816 Updated all license mentions to MIT 2024-02-28 15:45:30 +01:00
Jojo-1000 c30d283188 Fix restore with blocks from different files.
Closes #4593

The logic for finding existing source blocks requires that the same target files and hashes are adjacent in query results, but this was not the case.
2023-10-11 23:32:39 +02:00
snamds 468d672d87 Improve performance of big restore datasets 2022-01-31 14:26:21 +01:00
snamds f9ea467939 Improve performance of big restore datasets 2022-01-31 14:22:50 +01:00