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
Interrupted compact can leave extra hashes in volumes #5184
Comments
I thought a bit more about this, especially how it will work with database recreate. I think the only possibility is to record the blocks in the To make this work properly, I suggest these changes:
Originally posted by @Jojo-1000 in #4967 (comment) An alternative solution is to temporarily allow an inconsistent database. In combination with #4982 the next compact would remove the extra blocks. However, the space calculation would be incorrect in the mean time. |
Thanks for the continuing work. I've been digging through history in 2022 and 2023 about this bug, as it's been a long story.
I assume this references PR of original post which got only partially merged in 2023, taking only more critical missing file error. I'll need to read this awhile longer to see if that has changed, but I'll say that one thing that bothers me about the collection of imperfections that Duplicati gains in its records over time worry me, as they might show up as mystery issues after more runs. They're also potential land mines for new code that makes assumptions about the data being by-the-book, when it isn't really. Having said that, finite resources tend to focus on the things that break right now, and I can't disagree. Glad we're catching up. Another option is to write a book, so "by-the-book" has meaning. Document all the oddities, e.g. the NULL and sentinel values. People coming in from the Duplicati Inc. side might want that as training, and the pieces that I post in the forum only go so far. So that's an editorial break, but going back to March 2022, I found one note in my files on a possible test case which might be test all with full-remote-verification shows "Extra" hashes from error in compact #4693 (but it's not the network error, as here) and has a note on it that it may be fixed by Fix "test" error: extra hashes #4982 which is still a draft and is not the OP PR. I find its note repeating editorial that I said above:
Ultimately I think we need some opinion on this that is more expert than either of us, and I'm glad that might be possible again. Even the top expert might still have some limits, as I've been asking annoying questions about correctness of the commit design, including how well it handles different threads doing commit based on their needs. Is a good time for one also good for the rest? Hoping to get a design document from someone sometime on the concurrency plan and its interaction with transaction scheme. |
Taken from merged PR, because the issue still exists. An interrupted compact operation can leave the database in an inconsistent state, where some blocks were deleted from the table but still exist in the actual dblock volume. This causes an error with full verification turned on.
Test case to reproduce: Jojo-1000@aab7c63
duplicati/Duplicati/Library/Main/Operation/CompactHandler.cs
Lines 146 to 203 in aab7c63
entry
) that should be compacted (Line 146)newvol
. In the database transaction, their volume IDs are moved fromentry
tonewvol
newvol
is full, it is uploaded and the deletable volumes are removed.DoDelete
causes a transaction commit, so that the backend changes are not lost if duplicati crashes (Line 194)newvol
is started and the rest of the blocks are addedentry
are handled, it is added todeleteableVolumes
(Line 201), which will be deleted after the next uploadentry
is finished, so a new volume is downloadednewvol
was not uploaded, so the volumes indeleteableVolumes
can't be deletedentry
withnewvol
, andnewvol
toentry
At least in my test, the verification always produced the extra blocks twice, for one index volume and one block volume. There is never more than one block volume with extra hashes. This is consistent with the above explanation.
The transaction commit points are not trivial to change:
entry
will move tonewvol
in the database, which is not yet uploaded correctlynewvol
wheneverentry
is finished, because that would prevent compact from combining smaller volumes into bigger onesUnless someone can come up with a different transaction scheme, that can resolve these issues, the moved blocks in
entry
have to be marked as either duplicate, obsolete (in a new separate table) or deleted, in the same transaction that moves them tonewvol
.If the blocks are set to deleted (which I would prefer on first thought), it needs to be verified that:
DeletedBlock
andBlock
tables can contain the same block hashes with different volumesDeletedBlock
entry
should finish compacting in the next compact operation that runs, otherwise a half-waste volume remains (this should not be an issue if the deleted blocks work correctly)Originally posted by @Jojo-1000 in #4967 (comment)
The text was updated successfully, but these errors were encountered: