Commit Graph
49 Commits
Author SHA1 Message Date
Carl Johnsen 3d11a05400 Added .ConfigureAwait(false) to all of the await statements 2025-06-12 08:34:29 +02:00
Carl Johnsen fd5823a2f4 Found unformatted SQL queries in LocalTestDatabase 2025-06-11 10:54:02 +02:00
Carl Johnsen f373880c5a Renamed ExpandInClauseParameterAsync, as one of them isn't actually async.
Postfix mssqlite has been added as well to not clash with the IDb implementation
2025-06-11 10:47:40 +02:00
Carl Johnsen caa3c13dbe Post master merge fixes 2025-06-02 11:50:35 +02:00
Carl Johnsen bd493638af Merge branch 'master' into performance/mssqlite-async 2025-06-02 10:39:33 +02:00
Kenneth Skovhede 3ebc50a89d Adding repair for index files
Since index files only contains information related to recreating the database, they can be recreated directly from a working database.

This PR adds an automatic repair feature that replaces index files if they are missing content. This will gradually repair remote index files if they are affected by the compact bug that re-wrote index files without the blocklists.

To fully repair, it is possible to run the `Test` command with the option `--full-remote-verification=indexonly` and a large number of samples. Since the new option `--replace-faulty-index-files` is default set to `true` this will repair any defective index files and ignore all others.

This update uncovered that the Test method would previously not verify the presence of blocklists in the index files. This is likely a very old bug, caused by the fact that the original implementation did not place blocklisthashes in the index files. The omission of this check is the reason the extent of the compact issue was not discovered earlier.

With this PR it is now also visible that there is ample room for error in creating the index files during the backup process. This is caused by the parallel processing and carry-over, where the index files are created on-the-go, so they are ready to upload once the blocks are filled.

While this is likely good for performance, it has some drawbacks.
- A failed block upload will cause a rewrite of the index file
- An elaborate callback system is needed to update the index file
- It is possible to race against the database and create extra blocklist hashes, bloating the index files (causes problems on verification)

A subsequent task is to rewrite the logic to not touch the index files outside the backend manager, so the backend manager will just use the database to create the index file. This means the same code will be invoked for both the create, the recreate, and the replacement.

For now, extra content in index files is logged with the verbose log level.

This fixes #6296
2025-05-27 17:15:02 +02:00
Carl Johnsen 5ffff0e32e Fixed a method being synchronous in LocalTestDatabase 2025-05-21 14:51:47 +02:00
Carl Johnsen e4cffd5735 Restructured SQL queries in LocalTestDatabase 2025-05-21 09:40:32 +02:00
Carl Johnsen ef2f856c61 Made everything in LocalTestDatabase async 2025-05-21 09:22:29 +02:00
Carl Johnsen d6889569bb Removed FormatInvariant as it's now handled by the extension methods 2025-05-21 09:13:01 +02:00
Carl Johnsen 602a30d8e2 Purged IDb from LocalTestDatabase 2025-05-21 09:11:25 +02:00
Carl Johnsen 60b8df6474 Changed LocalTestDatabase to use factory construction 2025-05-21 09:05:34 +02:00
Carl Johnsen 8c11cc9f71 Removed whitespace 2025-05-21 09:05:15 +02:00
Kenneth SkovhedeandGitHub 1bbe04a782 Merge branch 'master' into feature/add-sqlite-cache-value 2025-04-25 13:58:24 +02:00
Kenneth Skovhede 2ef04e43ee Simplified new ArchiveTime column to not allow null 2025-04-24 20:30:08 +02:00
Kenneth Skovhede 46f5efd178 Merge branch 'master' into feature/support-glacier-style-non-readable-files 2025-04-23 22:37:31 +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 0945657a29 Fixed transaction issue with test handler 2025-04-15 23:24:35 +02:00
Kenneth Skovhede 4773914639 Rewrote testing to use an externally supplied transaction, to avoid temporary transactions from clearing the active transaction.
This is needed because SQLite does not support multiple active transactions.
2025-04-14 12:05:10 +02:00
Kenneth Skovhede 2006556778 Fixed some more nullable support in the database layer 2025-04-03 15:46:20 +02:00
Kenneth Skovhede 7c8571ed33 Added LocalTestDatabase 2025-04-03 09:03:22 +02:00
Kenneth Skovhede fe1cef3be8 Move away from positional parameters in SQL statements.
This is a move away from using positional parameters in SQL statements and rok towards only using named parameters.
2025-03-18 22:41:11 +01:00
Kenneth Skovhede dd07dabee1 Merge commit 'b1f705f71a39e4ea79c7dae56bfd0fb345af5110' into feature/support-glacier-style-non-readable-files 2025-03-18 20:44:05 +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
Kenneth Skovhede 71b3152f71 Implemented support for not testing archived files 2025-01-29 11:36:45 +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 db517a300b Implemented a fix for compaction issues that could cause inconsistent views of the remote storage. 2024-11-01 14:50:26 +01: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
gpatel-frandGitHub 0de4cb7968 allow full-remote-verification to target only list and index files (#5037)
The option is turned into an enum with values True, False, ListIndexes
True and False are for compatibility with the existing backups.
ListIndexes is equivalent to True but don't handle block volumes.
This is to make more workable a strategy of full remote testing
after each backup.
2023-12-10 00:24:07 +01: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 6f231f9190 Avoid referencing virtual members in Basiclist constructor.
When referencing virtual members in a constructor, the behavior may be
ill-defined as the overridden implementation may depend on uninitialized
instance members.

Since the TABLE_PREFIX, TABLEFORMAT, INSERTCOMMAND, and INSERTARGUMENTS
properties were only referenced in the Basiclist constructor, we can
remove the abstract keyword and provide the values as constructor
parameters.
2018-10-17 20:11:06 -07: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 5919309da9 Added additional checks to attempt to gather information from the remote destination, if the local database is somehow missing the size or hash 2017-02-27 00:43:06 +01:00
Kenneth Skovhede 742eab0913 Fixed multiple cases where connections and command instances were not disposed.
This should fix all cases of "File is locked" on windows.
2016-04-06 20:40:34 +02: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 74bbf0f1f8 Added support for handling null values in the remotevolume table.
This fixes #1334.
2015-05-17 13:38:25 +02:00
Kenneth Skovhede 4846ffa103 Now using the file modification timestamp and the filesize as indicators that trigger file scanning.
This fixes #1099.
2015-01-24 21:59:53 +01:00
Kenneth Skovhede 8d13e698eb Updated copyright notices 2015-01-20 21:44:52 +01:00
Kenneth Skovhede bc0417906f Fixed to include files with no hashes in the verify process. 2014-08-26 12:50:03 +02:00
Kenneth Skovhede 4f968a592a Fixed a bug with some version of SQLite that did not correctly detect the implicit column names 2013-09-13 13:27:19 +02:00
Kenneth Skovhede 78bfd56001 Updated the TEST command to also include data from DeletedBlock 2013-08-26 12:44:58 +02:00
Kenneth Skovhede 1a44eab08b Added automatic backend volume testing with each backup 2013-08-24 20:59:09 +02:00
Kenneth Skovhede 4c217b57d9 Fixed a number of dispose errors that would mask real errors 2013-08-23 23:36:25 +02:00
Kenneth Skovhede a229de8e23 Cleaned up some output with Backup and compacting.
Implemented better output for Restore.
Fixed a problem with errors during dispose, and a problem with selecting filesets that do not exist.
Fixed a bug with restore if a file existed with some correct data, a copy would be restored with partial data.
Added check to try to avoid excessive restores of the same files if a file in another version already exists.
2013-08-22 20:56:03 +02:00
Kenneth Skovhede 7e1ea91760 Added rolling checks to ensure equal testing of all files. 2013-07-30 22:42:59 +02:00
Kenneth Skovhede f0d0dfb586 Implemented the test command 2013-06-26 21:59:01 +02:00