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

Fix "Index consistency check failed" when running repair #5068

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Jojo-1000
Copy link
Contributor

Closes #3202

Forum discussion

  • Uses GROUP BY Hash to select any one of the possible blocklists in the database for each blocklist hash, so that re-use of blocks is ignored
  • Add a test case to reproduce the bug
  • Add a hash check when reading blocklists from index files, to prevent issues in recreate due to existing incorrect index files that might be caused by compact

Steps to test recreate hash check

  • Create unencrypted backup with at least one file larger than a block
  • Make backup version
  • Edit an index zip file on the destination, list/[hash] and duplicate the contents of the file (append to the back)
  • Run database recreate

Old behavior

  • Recreate fails with error Recreated database has missing blocks and 2 broken filelists. Consider using "list-broken-files" and "purge-broken-files" to purge broken data from the remote store and the database.
  • The database cannot be used to continue the backup

New behavior

  • Recreate finishes with warning [file] had invalid blocklists which could not be used. Consider deleting this index file and run repair to recreate it.
  • The dblock file is used to get the correct blocklist
  • The database can be used as normal

Impact

This modifies a core SQL statement that will be used in repair, compact and to recreate missing index files. It should be tested that these work correctly for a backup with some data and a compact history.

Closes duplicati#3202

Also add test to ensure that repair works as intended.
Compact used broken LocalDatabase.GetBlocklists without a hash check, so some backups may contain invalid index files.
@duplicatibot
Copy link

This pull request has been mentioned on Duplicati. There might be relevant details there:

https://forum.duplicati.com/t/backup-valid-but-still-unrestorable/6441/54

@duplicatibot
Copy link

This pull request has been mentioned on Duplicati. There might be relevant details there:

https://forum.duplicati.com/t/250gb-downloaded-to-restore-a-2gb-backup/17827/9

@duplicatibot
Copy link

This pull request has been mentioned on Duplicati. There might be relevant details there:

https://forum.duplicati.com/t/2-0-8-1-update-issue-broken-file-and-no-more-backup/17920/14

@duplicatibot
Copy link

This pull request has been mentioned on Duplicati. There might be relevant details there:

https://forum.duplicati.com/t/2-0-8-1-update-issue-broken-file-and-no-more-backup/17920/24

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

Successfully merging this pull request may close these issues.

Internal consistency check failed, generated index block has wrong hash
2 participants