Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change query for GetBlocklists in LocalDatabase.cs #5066

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gpatel-fr
Copy link
Contributor

to avoid duplicates caused by versions using the same block(s)

credits (https://forum.duplicati.com/t/any-way-to-recover-backup-repair-and-purge-broken-files-dont-help/17048): ts678 for the use case, @Jojo-1000 for the fix

to avoid duplicates caused by versions using the same block(s)

credits (https://forum.duplicati.com/t/any-way-to-recover-backup-repair-and-purge-broken-files-dont-help/17048):
ts678 for the use case, @Jojo-1000 for the fix
blocksize / hashsize
// DISTINCT is used to remove duplicates that can happen when several backup versions uses the same block
var sql = string.Format(
@"SELECT DISTINCT A.Hash AS BlocklistHash, C.Hash AS BlockHash, B.""Index"" " +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, I don't think a select distinct is going to work here. The "Index" is not guaranteed to always be the same:

Example: fill file with 32769 "a" characters (one full blocklist + "a"), then change to 65536 "b" (two full blocklists) + "a" at the end (total 65537), the second "a" blocklist will have index 2 and your query will fail (I tested this just now). This is why I resorted to GROUP BY in my fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants