Commit Graph
54 Commits
Author SHA1 Message Date
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
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 b3fe276a13 Ensured that all temporary tables uset the same type of generated guid name 2025-09-05 14:06:55 +02:00
Kenneth Skovhede 35347a7161 Handle a case where a missing hash would cause a crash 2025-08-14 09:27:37 +02:00
Carl Johnsen f6ac30e831 Merge remote-tracking branch 'upstream/master' into performance/mssqlite-async 2025-06-19 12:17:30 +02:00
Carl Johnsen 2412800c0c Removed the sqlite page cache option. It should be set through the environment variable, or some other way of providing a custom database configurotion 2025-06-19 11:41:39 +02:00
Carl Johnsen 42877ebf96 Made the LocalListBrokenFilesDatabase methods accept a cancellation token 2025-06-18 16:23:10 +02:00
Carl Johnsen bc97eaf71b Removed redundant calls to a SqliteCommand.Parameters.Clear() 2025-06-18 12:06:20 +02:00
Carl Johnsen 9ac583db94 Made all relevant using statements use await to use DisposeAsync 2025-06-18 11:53:11 +02:00
Carl Johnsen 859b65054d Simplified using statements that uses databases or accesses their methods 2025-06-18 11:52:05 +02:00
Carl Johnsen f221098c28 Formatted SQL queries - mainly adding double quotes where they were missing. 2025-06-18 10:42:08 +02:00
Carl Johnsen a32a5acaed Added more docstrings 2025-06-17 18:01:12 +02:00
Kenneth Skovhede 2c5c01160c Added a check and repair for empty metadata
This PR adds a check for empty metadatasets (length = 0) and replaces such sets with a default metadataset.

This fixes #6350
2025-06-16 16:35:07 +02:00
Carl Johnsen 3d11a05400 Added .ConfigureAwait(false) to all of the await statements 2025-06-12 08:34:29 +02:00
Carl Johnsen e5337e4d26 Formatted SQL queries 2025-06-11 12:09:58 +02:00
Carl Johnsen 95dc884ab3 Removed unnecessary casts 2025-06-11 11:27:15 +02:00
Carl Johnsen da9334d174 Made ExpandInClaseParameterMssqlite generic to avoid casting 2025-06-11 11:07:41 +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 ee40767412 Merge branch 'master' into performance/mssqlite-async 2025-05-27 12:04:50 +02:00
Carl Johnsen 259f3dcf74 Fixed typo in SQL query parameter names 2025-05-27 09:39:35 +02:00
Kenneth Skovhede 721e497e69 Fixed nullability warnings 2025-05-23 11:46:37 +02:00
Carl Johnsen 2cd1692532 Temporary fix to distinguish between new and legacy extension method 2025-05-22 13:25:42 +02:00
Carl Johnsen d11b4e58e7 Reworked the factory construction chains to forward an instantiated object where applicable 2025-05-21 07:24:36 +02:00
Carl Johnsen caf5bddc0c Restructured SQL queries in LocalListBrokenFilesDatabase 2025-05-20 07:07:44 +02:00
Carl Johnsen ef717048e8 Purged IDb from LocalListBrokenFilesDatabase 2025-05-20 06:54:09 +02:00
Carl Johnsen f7a0e17110 Made LocalListBrokenFilesDatabase async 2025-05-20 06:46:45 +02:00
Carl Johnsen 5622547abb Removed calls to FormatInvariant as the extension methods handle this now 2025-05-20 06:41:51 +02:00
Carl Johnsen 7cdee45c30 Changed LocalListBrokenFilesDatabase to use factory construction 2025-05-20 06:38:55 +02:00
Carl Johnsen b292756eb9 Removed whitespace 2025-05-20 06:36:54 +02:00
Kenneth Skovhede bb628ba6ee Fixed nullability 2025-05-16 14:14:06 +02:00
Kenneth Skovhede 51bcec3efc Style cleanup, named tuples.
Fix indentation.
Move metadata check up.
2025-05-09 17:34:09 +02:00
Kenneth Skovhede fe866ceb9f Implemented support for repairing the database when only parts of the source data is available.
This repair will leave the database in a still-broken state, but if this is run prior to purge-broken-files, less data will be lost.

Also updated the purge-broken-files operation to keep files and directories in the set, if they are only missing metadata.
2025-05-09 11:12:29 +02:00
Kenneth Skovhede 39dca1eb79 Improve list-broken-files output
This hand-picks the changes from #5049 by @gpatel-fr.

The change is to use a left-join to include all broken files, even if there are no entries in the Blockset table.

The update is only visual but makes the results consistent with the actual operation performed by purge-broken-files.

This close #5049
2025-04-30 09:22:24 +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 0b735d79ff More cleanup and a few bug fixes 2025-04-03 16:38:51 +02:00
Kenneth Skovhede 0638afb8b8 Fixed some nullable support 2025-04-03 15:25:20 +02:00
Kenneth Skovhede 7b948a2f1d Fixed issue with SQLite bindings not supporting arrays.
Added helper class to wrap values in a temporary table if they exceeed the maximum number of parameters.
2025-04-02 23:26:20 +02:00
Kenneth Skovhede 53a1d2a723 Added LocalListBrokenFilesDatabase 2025-04-02 14:06:06 +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 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 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 448b6e0e03 Fixed typo 2024-11-01 16:54:39 +01:00
Kenneth Skovhede a7e57c2ffb Added DuplicateBlock to the list of items purged. 2024-11-01 16:06:41 +01:00
Kenneth Skovhede 1809ffac09 Added a fix from #4982 that deletes additional information from the database when removing broken files. 2024-11-01 16:06:20 +01:00
Jojo-1000 55284410c7 Fix sql queries that use double quoted strings.
Closes #5202
2024-05-30 00:00:48 +02:00
Kenneth Skovhede 40dd3c6816 Updated all license mentions to MIT 2024-02-28 15:45:30 +01:00
Kenneth Skovhede 8ac99e83b7 Merge branch 'master' into feature/fix_path_storage2 2018-06-28 10:51:11 +02:00
Kenneth Skovhede cbc18970d5 Re-applied the path-storage fix as the merge failed somehow 2018-06-14 10:12:24 +02:00