Commit Graph
1010 Commits
Author SHA1 Message Date
Kenneth Skovhede 8663f55e8b Fixed case-insensitive search
This PR fixes a bug that caused backup searching to be case-sensitive.

The PR also exposes the case sensitive-flag in the API endpoint so the UI can toggle case-sensitive searching.
2026-06-17 10:15:08 +02:00
Kenneth Skovhede 9f3ea8f805 Fixed isseus with restoring ADS correctly 2026-06-15 14:43:24 +02:00
Kenneth Skovhede a4820ccb62 Implement support for ADS
This PR implements support for reading and writing alternate data streams on Windows.

For now, the option is disabled by default and needs to be enabled with `--enable-ads-backup`. After this option is set, Duplicati will also extract any alternate datastreams from the filesystem and include them in the backup.

By default, ADS elements will be restored, but `--disable-ads-restore` can be used to ignore any ADS elements during the restore process.

This fixes #189
2026-06-08 19:33:01 +02:00
Kenneth Skovhede bc968cbaf0 Fix remote file locking on Windows
This fixes a locked database issue on Windows.

The issue was caused by the backup process having an open database, and then not passing that connection to the lock handler.
The lock handler would then attempt to open a new connection to the same database, which would fail.

This PR fixes the issue by passing an instance of the database to the lock handler.
Also addressed a logic issue where the dbpath was checked, even if an existing database connection was found.
Also fixed the lock results not setting the EndTime property, causing the reported lelapsed time to be off.
2026-06-03 12:45:57 +02:00
Kenneth Skovhede 179d1ceb47 Make controller Async
This PR has a large blast radius because it takes the final step and bumps up the Controller to be fully async.

We have historically done a piece-by-piece update, so all operations were already async but the controller interface was kept synchronous.

With this update, the controller is now fully async and all tests are updated.

Most places where the new C# compiler warns about function names not ending in `Async` were also adressed, giving a massive refactor change.

Functionally, no changes are done.
2026-05-13 15:04:13 +02:00
Kenneth Skovhede 89654c2474 Add safeguard to synthetic filelist
This adds an extra clause when building a synthetic filelist to avoid cases where the synthetic filelist fails to be generated because some entries are orphans.

The tests that reproduce this are quite slow and require some tampering with the database to get into the faulty state, so the tests will not run in CI testing but can manually be executed.
2026-05-12 13:00:02 +02:00
Kenneth Skovhede 308e8428c7 Add slow query monitor
When queries are slow on end-user machines it is hard to debug what the exact problem is.

The typical flow is to discover a "stuck" process. But since profiling logging was not enabled there is no output.

The user then has to re-run the problematic operation with profiling on, and locate the last output where the call gets stuck.

This PR introducces a monitor mechanism where all queries register themselves prior to execution, and then de-register once done.

At a fixed interval, the list of active queries is examined, and if a query is found to be running longer than the threshold, it will be logged as a warning.

This means the user can simply go view the live log for warnings, and the offending query will be emitted.

The default threshold is set at a conservative 30 minutes. Since the timer only checks at the interval, it can take at most 2x the interval before a message is logged. After this, a message is logged each time the interval is reached (e.g., a new warning is logged every 30 min).

The option `--long-database-query-threshold` can be used to set a different threshold.
2026-05-08 10:30:47 +02:00
Kenneth Skovhede 584884de0a Always log the append queries as they are not in the hot-path for backups 2026-05-06 15:20:16 +02:00
Kenneth Skovhede ab487bdde2 Optimize synthetic filelist creation
This PR adds a test that generates a synthentic filelist of a variable size, and then measures the time it takes to recreate the fileset.

As there was a reported slowdown, analysis indicated that the query would grow in the order of O=N^2, where N is the number of paths.

The code is then updated to instead use some temporary on-disk space to lay out the paths and then insert them as a new fileset. This should bring the time down to O=N.

Based on a test with 10k files, the query speed up is ~900x, but will be more on larger filesets.
2026-05-06 15:16:10 +02:00
Kenneth Skovhede 4244e71fee Improve SQL logging
This PR improves SQL logging by capturing many places where the calls would previously just hit the database and not produce any logging output.
2026-05-06 10:52:58 +02:00
Kenneth SkovhedeandCopilot 6e13cdbc53 More defensive delete
This PR adds a small clause the prevents the delete query from failing if there are inconsistencies where deleted blocks can exist and a volume has no blocks.

I was not able to reproduce the issue without manipulating the database, but it was reported happening on the forum.

Co-authored-by: Copilot <copilot@github.com>
2026-05-01 15:02:09 +02:00
Kenneth Skovhede c0f40e19ca Updated copyright year to 2026 across the project 2026-04-16 15:21:24 +02:00
Carl Johnsen 8c022b63dc Replacement strings for Regex.Replace cannot contain dollar signs followed by a number, as that is also being parsed. 2026-03-25 13:42:32 +01:00
Kenneth Skovhede d7f9981f49 Fixed a few nullable warnings 2026-02-17 10:37:08 +01:00
Kenneth Skovhede cf02c1addf Fixed large SQLite inputs
When performing queries with large inputs, there is a possibility that we reach the maximum number of possible parameters. If the query exceeds the maximum number of parameters the query fails.

This change uses a temporary table that will be created in the case the inputs exceed the total number available parameters, making sure the calls proceed as before with small inputs, but uses temporary tables on larger inputs.

Some tests were added to ensure the update works as expected, even with large inputs.
2026-02-11 13:34:58 +01:00
Kenneth Skovhede e7aa60fba0 Handle duplicate source paths
This PR adds guards to prevent creating filesets with multiple files that have the same path.

While it should technically be impossible to have multiple entries that have the same path, it could happend either due to glitches or because the source data (manual lists, remote sources, etc) returns duplicates.

This PR adds a simple check for each folder to ensure that on a folder-level, duplicate paths cannot be introduced.

There is also a post-backup check to evict any duplicates, and the recreate process will reject duplicate paths.

Finally, the repair command will remove duplicates if they somehow manage to get into the database anyway.

A database-level prevention is not currently feasible as it needs a cross-table check for uniqueness, which requires more work from the database to check for each added file. Since this is expected to be a very rare event, the added processing was not justified.
2026-02-05 11:06:41 +01:00
Kenneth SkovhedeandGitHub 1b1719e924 Merge pull request #6718 from duplicati/feature/add-office-365-backup
Add office 365 backup and restore
2026-02-01 13:12:44 +01:00
Kenneth SkovhedeandGitHub 3db18c923c Merge pull request #6739 from duplicati/feature/fix-issue-6425
Fixed purge size calculation.
2026-01-30 19:15:24 +01:00
Kenneth SkovhedeandGitHub 89cdb85a11 Merge pull request #6740 from duplicati/feature/fix-issue-6553
Add guard against invalid entries
2026-01-30 19:04:54 +01:00
Kenneth Skovhede ebbc564424 Added fix for manual changelist
This PR updates the logic for using `--changed-files` so the combined fileset no longer has additional (left-over) entries.

This fixes #6529
2026-01-30 17:33:32 +01:00
Kenneth Skovhede fa0c9c72a9 Add guard against invalid entries
This PR guards agains inserting entries into the DeletedVolume if they reference non-existing volumes, which can happen in error scenarios.

This fixes #6553
2026-01-30 16:49:03 +01:00
Kenneth SkovhedeandGitHub 4b2402d381 Merge pull request #6733 from duplicati/feature/fix-issue-6539
Fix issue with failed delete
2026-01-30 16:19:59 +01:00
Kenneth Skovhede 4a598019a8 Fixed purge size calculation.
This fixes the size calculation on purge to only include blocks once, and not include blocks that are still referenced elsewhere.
2026-01-30 16:08:39 +01:00
Kenneth Skovhede cee97bb01a Treat inconsistency state the same for both deleted and deleting, so a failed delete does not cause a database inconsistency 2026-01-30 15:09:17 +01:00
Kenneth SkovhedeandGitHub 4745aa464b Merge branch 'master' into feature/add-office-365-backup 2026-01-29 20:11:29 +01:00
Kenneth SkovhedeandGitHub 26f7dd8586 Merge branch 'master' into feature/add-office-365-backup 2026-01-29 20:04:42 +01:00
Kenneth Skovhede fa6be206ef Handle missing blocks on recreate
This PR handles a case where the `dindex` files may reference non-existing `dblock` files. In this case the recreate may register missing (and unused) blocks in the `DeletedBlock` table, which will later cause issues if the blocks are attempted used.

The fix is to remove missing blocks before the cleanup so there is no entry that references the missing volumes.

This fixes issue #6552
2026-01-28 21:03:03 +01:00
Carl-Johannes JohnsenandGitHub 6b02116bed Merge pull request #6708 from carljohnsen/feature/automatic-321
Feature/Automatic 3-2-1 backup
2026-01-28 17:21:33 +01:00
Kenneth SkovhedeandGitHub 1a19b6aa9b Merge pull request #6728 from duplicati/feature/issue-6538
Fixed issue with missing log
2026-01-28 15:20:04 +01:00
Kenneth Skovhede c765a5658b Improved query for purge broken files
This PR improves the query used to calculate the size of removed files when issuing the purge-broken-files command.

This PR also adds the option `--reduced-purge-statistics` which will fully skip the size calculation, in the event the query is still performing poorly.

This fixes #6366
2026-01-27 21:15:50 +01:00
Kenneth Skovhede bb2be7966e Fixed issue with missing log
When an error occurred, the log would be written to the database, but the transaction would then be rolled back, causing the log to disappear.

This adds explicit commit to the log when handling error cases.

This fixes #6538
2026-01-27 21:08:36 +01:00
Kenneth Skovhede 1523f730e3 Added support for storing metadata in the database 2026-01-14 10:01:20 +01:00
Carl Johnsen 177272ecd9 Merge branch 'master' into feature/automatic-321 2026-01-08 20:55:31 +01:00
Carl Johnsen 50f18dca84 Moved ResultSerialization from builtin modules to a shared library 2026-01-08 14:34:11 +01:00
Kenneth Skovhede 557fbd12d9 Fixed nullable issues 2026-01-06 10:22:53 +01:00
Kenneth Skovhede 625c56b5c1 Updated new column to be not null, for consistency with other columns 2025-12-17 23:04:47 +01:00
Kenneth Skovhede 6e6e993765 Fixed issues with database transaction not being comitted.
Renamed the options to be more descriptive.
Rewrote the dependency query to be more readable and also check for metadata dependency.

Fixed an edge case where there were no modified files, and no new backup is created.

Fixed some issues with local/utc datetime compares.

Fixed logic for deleting filesets to only look at the filesets themselves. This makes the version lock follow the dlist file, and can create "dangling" volumes that have no filesets, but these will be picked up by compaction.

Updated tests to work correctly.

Added lock-info update option for the backup recreate call, so the UI can also re-create lock information on database rebuilds.
2025-12-17 22:27:38 +01:00
Kenneth Skovhede 0f81b42146 Add support for remote locks
This PR adds support for locking files if the backend supports it.

To activate locking, set the option `--file-lock-duration=30D` and the backup will lock the files.

If the database is rebuilt with the intention of continuing the backups, use the option `--repair-refresh-lock-info` which will update lock information in the database after recreating the database.

The locking works by asking the backend to lock files after a backup has completed.

The implementation keeps track of which files are currently assigned a lock and prevents attempting to delete the files that are currently locked.

Note that the bucket should not have a default lock policy as Duplicati needs to finish the backup before the locking is applied.

In this initial version, Azure Blob Storage, B2, S3 and iDrive are supported with locking.

The CLI is updated to allow setting locks on a specific version. The backend tool is updated to allow setting locks on specific files.
2025-12-14 17:17:48 +01:00
Kenneth Skovhede 7322c46861 Pre-execution check for RemoveRemoteVolumes
This PR adds a check before entering the RemoveRemoteVolumes that checks if there are dangling FilesetEntry records when calling the function.

This makes it possible to figure out if the problem is created by the RemoveRemoteVolumes code, or an already existing problem in the database.

Also added a few tests that check that the condition is correctly detected.
2025-12-03 11:34:30 +01:00
Kenneth SkovhedeandGitHub 2632ba8164 Merge pull request #6625 from duplicati/bugfix/restore-deadlock-timer-better-start
Bugfix/Better starting time for restore deadlock detection.
2025-11-15 11:04:25 +01:00
Kenneth Skovhede 43d38efdd3 Fixed remaining warnings 2025-11-14 16:09:05 +01:00
Carl Johnsen d48afd7496 Check the database for volume sizes reported in remotevolume 2025-11-10 14:56:20 +01:00
Kenneth Skovhede b0bd9c121f Fixed reading the size of files in restore
This significantly speeds up the restore file listing speed.
2025-09-26 13:54:06 +02:00
Kenneth Skovhede 39cca5c24f Simplified calling code to not rely on extension methods 2025-09-25 11:33:56 +02:00
Kenneth Skovhede 230d80642a Fixed invariant formatting helpers
This fixes an issue with formatting for invariant values that was caused by incrorrect function overload selection.

To avoid future issues, the two similar functions have been renamed to clarify what they are working for.
2025-09-25 11:14:54 +02:00
Kenneth Skovhede f0d8677ef5 Include duplicated blocks in recreated index files
This fixes #6504
2025-09-23 11:12:36 +02:00
Kenneth Skovhede b2c6ef73c5 Improve logging of SQL statements
This updates the logging code to do invariant formatting of the SQL statements
2025-09-22 14:39:46 +02:00
Carl Johnsen 7670ea9a58 Ensured that all values that are passed to interpolation strings have been passed through FormatInvariant to prevent SQLite errors related to string formatting cultures. 2025-09-05 14:11:05 +02:00
Carl Johnsen 1a5fef36d7 Removed whitespace 2025-09-05 14:07:58 +02:00
Carl Johnsen b3fe276a13 Ensured that all temporary tables uset the same type of generated guid name 2025-09-05 14:06:55 +02:00