-
-
Notifications
You must be signed in to change notification settings - Fork 759
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
Chunk refcount limited to 2**31 (4e10) #169
Comments
True about the chunker table being randomly keyed with encryption. I don't find it suspicious that lots of zeros give 8MB chunks. The window contents of the rolling hash will always be all-zero in such a case and the probability that some specific data has a N-bits-of-zero-ending hash value is about 1 : 2^N. |
Some other ideas:
|
2^31 * 2^23 = 2^54 bytes = 16 EB of zeros could be a problem. |
Well, sparse files! (since sparse files are not yet handled in a real way by borg, and even once they are, apparently the same problem might still exist depending on the implementation). Also raw block device backups where sparse handling would not help. Also I don't claim I need to know how accurate the refcount value needs to be. Typically it's 0 or not 0 to decide if it should be deleted or not. So just have a "magic" value of "-1" or whatever else less sensical and every time you cross 0 (overflow), set it forcefully to the magic value. Never add or substract anything to the magic value, so it just means "this is a really in-high-demand chunk, never delete it". Similar things are done in the filesystems for directory refcounts. Typically as you create a directory, parent directory nlink is incremented, but to avoid pretty low 32k subdirectory limit, often once it's crossed, a filesystem code would set parent nlink to "1" which in itself is nonsensical for a directory and means "the nlink for this directory is not accurate, but who cares, just don't let it go to 0". |
Speaking of overflows, I just realized there are more (worth having separate ticket for that?) when chunks are converted to bytes and you have many chunks, something inside overflows and shows negative numbers which is nonsensical and a better handling would go a long way. |
We need to 1) check for overflow and 2) raise the limit.
I think this limit is a bit tight, and we need to add a quick check for this overflow :). (Note index implementation details may interfere a little. I think you're not allowed to use the bit pattern 0xffffffff or oxfffffffe anyway & there is no check there either).
To fix it I think we only need to change the index format. In theory the index can be rebuilt if your attic doesn't recognize it, so in some sense we'd already have backwards and forwards compatibility. (I know attic has some repair code, though I haven't tried just deleting the index ad seeing what happens yet :).
@ThomasWaldmann pointed out that my test results indicate very large chunks (8M, the maximum size?) for the zero data. (Which also sounds suspicious to me, but hey :). That should mitigate the problem somewhat. OTOH I believe the chunker is keyed when encryption is used, so the size should be variable.
See also: jborg/attic#315
The text was updated successfully, but these errors were encountered: