Commit Graph
80 Commits
Author SHA1 Message Date
Kenneth Skovhede 536e62275f Changed the logic in recreate to avoid opening the same zip file multiple times. 2025-02-06 21:34:02 +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 382ba172b3 Fixed duplicate entries in index files (#5856)
* Added test to verify that compression modules will mask duplicate entries, if present

* Because there are likely many, otherwise valid, dindex zip archives with duplicated blocklists out there, the log message is now verbose.

To make sure we no longer create archives with duplicated entries, the `--unittest-mode` option makes this a warning that is checked in most tests.

* Added guard in `IndexVolumeCreator` to prevent creating zip files with duplicated block lists.

* Added debug check for duplicates

* Fixed the duplicate test
2025-01-10 09:24:31 +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 Skovhede ff6757877f Fixing the inconsistency check on repair.
Update the SQL to also group on size (just in case).
Renamed the normal read method to signal that it is unverified.
Made the verified reader use enumeration state machine to avoid materializing the list.
`var`-ified some of the test code.
2024-09-09 15:27:37 +02:00
Kenneth Skovhede 17d9b89fbb Merge branch 'master' into fix-repair-index-consistency
# Conflicts:
#	Duplicati/Library/Main/Operation/RecreateDatabaseHandler.cs
2024-09-09 11:49:34 +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
Jojo-1000 6a85544fa5 Check blocklist consistency in recreate to prevent broken filesets.
Compact used broken LocalDatabase.GetBlocklists without a hash check, so some backups may contain invalid index files.
2023-12-12 21:28:15 +01:00
Jon Schewe e5f57e8f66 Remove unused LOGTAG field 2020-07-11 18:12:59 -05:00
Jon Schewe 2747f78c40 Remove unneeded catch statement
Using the finally block to close out the writer allows the exception to
show up in the log.
2020-07-11 17:33:38 -05:00
Jon Schewe 36336ac6f1 Rethrow exception after logging
This ensures that the backup properly fails.
2020-07-10 06:55:41 -05:00
Jon Schewe e41c0d8bf9 Catch compression errors and report them
When the file list is over 4GB one needs to have the zip64 option
enabled. This commit catches the exception and reports it as an error so
that the user knows what the problem is.

Fixes duplicati/duplicati#/4206
2020-07-08 07:55:25 -05:00
Sean Templeton 446120ae3e A synthetic filelist could not be uploaded due to the logic in UploadSyntheticFilelist. The code passing in the fileset id to the class would get the id based on if the volume was in the Temporary or Uploading states. If the volume was in the Uploading state, present on the remote backend, and of the right size it would get changed to Uploaded.
One of the first things UploadSyntheticFilelist does is throw an exception if the volume is not in the Uploaded state. Or if it is in the Uploaded state, the next check would prevent a synthetic filelist from being created if the volume was not in the Uploading or Temporary states.

Removed the check for the volume not being in the Uploaded state as the warning in the second check handles that case.

Removed the using statement as it would dispose of the FilesetVolumeWriter after passing it to the UploadChannel. The UploadChannel could not use it since it had been disposed.

Fixed the GetRemoteVolumeFromIDAsync taking a fileset id and matching it up against a volume id. Now it will use fileset id to get the volume that matches the fileset.

Change the StopNow disruption test to not use a synthetic file list. The test was written with it not working and therefore fails a check on the number of filesets after stopping a backup.

Bonus fix for a possible null exception in Dispose for VolumeWriterBase.
2020-02-23 16:50:36 -06:00
Kenneth Hsu d7e3ac9b10 Move CreateFilesetFile method to FilesetVolumeWriter class.
This only concerns filesets, so it does not belong in the base class.
2020-01-25 18:53:15 -08:00
Tyler Gill e14be62c2b Make the temp file the default and only bevavior - fileset volume no longer uses memory stream 2019-11-01 19:27:49 -06:00
Tyler Gill bc0686794a Cache to disk 2019-10-30 17:30:47 -06:00
Kenneth SkovhedeandGitHub 99d0cb3c57 Merge pull request #3953 from warwickmm/make_fields_readonly
Mark fields that don't need to be reassigned as readonly
2019-10-21 08:36:17 +02: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
Kenneth Hsu afab61a05b Use pattern matching to simplify casts. 2019-10-19 10:15:38 -07:00
Kenneth SkovhedeandGitHub 579f9911d5 Merge pull request #3938 from warwickmm/bugfix/wrong_dblock_in_dindex
Ensure that dindex references correct dblock file after renames
2019-10-19 14:19:11 +02:00
Kenneth Hsu 614ccaf79d Convert duplicated static methods into instance method. 2019-10-04 21:37:33 -07:00
Kenneth Hsu 8d7c6c6e21 Ensure that filelist is always written to dlist files.
This fixes a regression introduced around revisions e0899a2a91 ("add
method to add the filelist file") and 3b5af1cf01 ("add method to add
filelist file"), where the filelist was not written by all usages of the
FilesetVolumeWriter.  Previously, one would have to invoke
AddFilelistFile with each usage.  Now, we simply do so when the
FilesetVolumeWriter is closed.

We also modified the UploadSyntheticFilelist so that the usage of the
FilesetVolumeWriter is contained in a using statement, which will ensure
that it is disposed.

This fixes issue #3924.
2019-09-27 20:35:06 -07:00
BlueBlock e0899a2a91 add method to add the filelist file
this also fixes "control-files" being added to dlist
2019-09-10 13:09:25 -04:00
BlueBlock 6c05c19ca3 add methods to handle reading the fileset file 2019-09-10 13:07:57 -04:00
BlueBlock 075f9faa92 add method to create fileset file 2019-09-10 13:06:55 -04:00
BlueBlock a230e3b228 Revert "spelling fix"
This reverts commit 8bb4bfaeb4.
2019-09-09 18:26:01 -04:00
BlueBlock 8bb4bfaeb4 spelling fix 2019-09-09 18:25:29 -04:00
BlueBlock 74e4bcd8de add FilesetData object 2019-09-09 17:42:51 -04:00
Kenneth Hsu a1d8637c3a Fix typo in comment. 2019-03-11 21:37:42 -07:00
Kenneth Hsu e57c714ee8 Dispose of manually enumerated enumerator.
The IEnumerator<T> interface implements IDisposable, so the enumerator
should be disposed of after its use.
2019-03-11 21:15:00 -07:00
Kenneth Hsu daf0311bf8 Allow removal of VolumeWriterBase temp files.
This reverts a change made in revision 31ac40083a ("Prevent temp files
in VolumeWriterBase from being deleted prematurely" in pull request #2637).
It's unclear what issue was being worked around by preventing the
removal of the temporary files (based on comments in pull request #2637,
it appears to be related to tests that failed only on Travis).  However,
this workaround prevented the removal of temporary files created during
compact operations, which caused several users' temporary directories to
be filled up with files that should have been removed.

This concerns issue #3652.
2019-02-16 19:53:06 -08:00
Kenneth Hsu c27ea24826 Ensure that FilesetVolumeWriter removes temp file upon disposal.
This ensures the removal of the temporary file containing the
filelist.json that remained regardless if files needed to be uploaded or
not.

This concerns issue #3652.
2019-02-16 19:53:06 -08:00
Kenneth Hsu 9e0b031fee Remove unused members. 2018-10-15 21:20:30 -07:00
Kenneth Hsu 731a8b1644 Remove unused empty methods. 2018-10-10 21:20:40 -07:00
Kenneth Hsu d72128ec83 Remove unused method parameters. 2018-10-06 15:09:43 -07: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 20f2f37806 Remove unnecessary calls to String.Format. 2018-06-02 12:02:55 -07: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 52987da027 Improved error message when reading invalid blocklists 2018-05-09 17:37:54 +02:00
Kenneth Skovhede b0110acab6 Added a check to make sure we do not write invalid blocklist files 2018-05-09 17:21:50 +02:00
Kenneth Skovhede 79f7b22e0f Merge branch 'master' into concurrent_processing
Changed a few things on the way, removing the log process

# Conflicts:
#	Duplicati/Library/Main/Controller.cs
#	Duplicati/Library/Main/Database/ExtensionMethods.cs
#	Duplicati/Library/Main/Database/LocalBackupDatabase.cs
#	Duplicati/Library/Main/Duplicati.Library.Main.csproj
#	Duplicati/Library/Main/Operation/BackupHandler.cs
#	Duplicati/Library/Main/Operation/FilelistProcessor.cs
#	Duplicati/Library/Main/Operation/PurgeBrokenFilesHandler.cs
#	Duplicati/Library/Main/Operation/TestFilterHandler.cs
#	Duplicati/Library/Main/Options.cs
#	Duplicati/Library/Main/ResultClasses.cs
#	Duplicati/UnitTest/BasicSetupHelper.cs
2018-04-11 23:02:47 +02:00
Kenneth Hsu cb0a3ed2a1 Make constructors for abstract classes protected.
While this does not affect any behavior, it more accurately describes
the accessibility.  Since abstract classes can only be instantiated by
an instance of a derived type, the constructors should at most have
protected access.
2018-04-07 18:04:41 -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 bf07f70318 Added method to automatically create folder for async upload.
This fixes #1384
2018-01-26 09:22:21 +01:00
Kenneth Skovhede 75bf6857c1 Merge branch 'master' into concurrent_processing
# Conflicts:
#	.travis.yml
#	Duplicati/Library/Main/Database/LocalBackupDatabase.cs
#	Duplicati/Library/Main/Operation/BackupHandler.cs
#	Duplicati/Library/Main/ResultClasses.cs
#	Duplicati/Library/Main/Volumes/VolumeWriterBase.cs
#	Duplicati/Library/Utility/TempFile.cs
2018-01-20 15:02:41 +01:00
Kenneth Skovhede d9377bab7e Removed TempFileStram and fixed the two places that were using it, as they both had errors in the way it was used. 2018-01-18 14:25:25 +01:00
vnau 1c67118737 Type pattern conditions removed to compile with AppVeyor. 2017-12-25 23:51:10 +07:00
vnau 62a7901aca Compression modules refactored to work with streams instead of filenames;
Added unit test to check compression reversibility
2017-12-25 04:12:19 +07:00
Kenneth Hsu 604b6e4337 Dispose enumerators after manually iterating over elements.
Since the IEnumerator<T> interface implements IDisposable, we should
make sure to dispose of the enumerator when manually iterating over the
elements.
2017-10-07 12:27:11 -07:00