Commit Graph
87 Commits
Author SHA1 Message Date
Carl Johnsen b3fe276a13 Ensured that all temporary tables uset the same type of generated guid name 2025-09-05 14:06:55 +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 c496d0bf8c Made the LocalDeleteDatabase methods accept a cancellation token 2025-06-18 16:07:46 +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
Carl Johnsen 3d11a05400 Added .ConfigureAwait(false) to all of the await statements 2025-06-12 08:34:29 +02:00
Carl Johnsen 09251284ab Removed TODOs 2025-06-11 11:07:54 +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 2cd1692532 Temporary fix to distinguish between new and legacy extension method 2025-05-22 13:25:42 +02:00
Carl Johnsen cc2f9740ae Reintroduced the helper method for constructing a
LocalDeleteDatabase.BlockQuery
2025-05-21 14:51:22 +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 9776e8ba33 Found inconsintensies in how the purge and delete databases are constructed now, through the create methods compared to the previous constructors. 2025-05-20 21:41:47 +02:00
Carl Johnsen 88db9676b4 Restructured SQL queries in LocalDeleteDatabase and made everything async where applicable 2025-05-19 21:51:28 +02:00
Carl Johnsen ed6cee24d1 Changed a heavy property in LocalDeleteDatabase to a function to convey the heavyness 2025-05-19 21:03:40 +02:00
Carl Johnsen 2c9bc49b3d Changed LocalDeleteDatabase to use factory construction 2025-05-19 20:43:45 +02:00
Carl Johnsen af2b1565b5 Removed whitespace 2025-05-19 20:38:34 +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 52fc144580 Merge branch 'master' into feature/improve-compact-block-use-check 2025-04-04 14:41:58 +02:00
Kenneth Skovhede 2006556778 Fixed some more nullable support in the database layer 2025-04-03 15:46:20 +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 a6a6790395 Updated LocalDeleteDatabase 2025-04-02 13:49:21 +02:00
Kenneth Skovhede 8753e5dc85 Merge remote-tracking branch 'origin/master' into feature/improve-compact-block-use-check 2025-04-01 15:54:54 +02: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 ceae46f395 Fixed a long-standing bug that could cause errors on delete due to pending delete of filesets 2025-03-10 22:01:14 +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 07843c6c2d This adds additional checks to the check if a block is in use, by checking if it is in use by the volume that we are examining.
This is taken from #4982
2024-11-01 16:45:25 +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
Suguru Hirahara ae57dee0f0 Remove redundant space characters from *.cs and *.html 2024-07-26 00:10:31 -04:00
Kenneth Skovhede 40dd3c6816 Updated all license mentions to MIT 2024-02-28 15:45:30 +01:00
aureliandevel baf489e8a9 Fix column name typo 2021-03-20 13:26:53 +11:00
Kenneth Hsu 5951047ff1 Fix incorrect or misleading indentations.
This also adds braces to clarify scope where beneficial.
2020-11-21 13:58:16 -08:00
Sean Templeton 19010e6314 Fix unexpected difference in fileset when using Stop Now
The exception could occur due to the existing delete for FilesetEntry
deleting based on volume ids, which would only match a filelist.
The bsIdsSubQuery would return BlocksetIds that should
be deleted and would delete from the FileLookup table.

FilesetEntry would then have a higher count of rows
than what would be returned by the LEFT OUTER JOINS on all of the
other tables in VerifyConsistency() since more rows had been deleted
from FileLookup.

To fix this when rows are deleted in FileLookup, use the associated metadata id
to delete from FilesetEntry and other tables based on the blockset id for the
metadata id.

Some existing delete statements were moved, none were deleted.
The existing FileLookup delete had the match on metadata id removed as
a blockset id does not equal a metadata id.
2020-03-01 18:16:33 -06:00
Kenneth Hsu 610fa4ffea Generate backup version numbers manually instead of in query.
The ROW_NUMBER window function is not available in SQLite versions prior
to 3.25.  In some cases, I think we do fall back to the system SQLite
libraries, and many distributions do not have versions that support the
window functions.  To be safe, we will generate the backup versions
manually.
2019-12-15 13:28:44 -08:00
Kenneth Hsu 60b4c8479c Fix bug where filesets considered for deletion had wrong version.
The ID in the Fileset table is the auto-incremented integer.  When
considering filesets for deletion (in particular, when deleting specific
versions), we need to reference the backup version number that is
exposed to the user (integers where the newest backup version is 0).
2019-12-12 18:38:17 -08:00
Kenneth Hsu 68ffd86594 Refactor fileset deletion code.
This extracts the logic for various fileset deletion strategies into
separate classes.  This simplifies the code and makes it easier to test
the individual functionalities.
2019-12-11 17:59:20 -08: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 0a390bd31a Move NormalizeDateTimeToEpochSeconds method to Utility class. 2019-09-01 12:38:23 -07:00
drwtsn32x b8d71b7ada Remove debug message 2019-07-31 07:11:00 -07:00
drwtsn32x 065ca97e7d Fix for issue 3308 - deletion of too many Filesets 2019-07-31 07:09:37 -07:00
Kenneth Hsu 3e0f1d5e5e Fix issue where block was not recognized as being used.
This fixes an occurrence of the "Unexpected difference in fileset
version" error due to a deleted block having the same hash as one that
is currently in-use.

This fixes issue #3800.
2019-06-22 09:51:57 -07:00
Kenneth Skovhede 03722fcba1 Merge branch 'master' into feature/fix_path_storage2
# Conflicts:
#	Duplicati/Library/Main/Database/LocalRecreateDatabase.cs
2018-10-23 11:33:35 +02:00
Kenneth Hsu 9e0b031fee Remove unused members. 2018-10-15 21:20:30 -07:00
Kenneth Hsu d72128ec83 Remove unused method parameters. 2018-10-06 15:09:43 -07:00
Kenneth Skovhede cbc18970d5 Re-applied the path-storage fix as the merge failed somehow 2018-06-14 10:12:24 +02: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