-
Notifications
You must be signed in to change notification settings - Fork 3
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
[bug] Creating new parity files: "panic: too many shards" #7
Comments
That error is when the number of data shards is >256, which is a par2 limitation. I suspect it has to do with the default block size not being intelligently picked, but fixed at 2000. Can you try with |
It is also happens when I'm cracking my head a second time over how par2cmdline calculates blocksize and blockcount from a redundancy level (percentage of protection). I believe the blockcount is always 2000 if you specify a redundancy: https://github.com/brenthuisman/libpar2/blob/master/src/commandline.cpp#L1099 On the other hand, there's a https://github.com/brenthuisman/libpar2/blob/master/src/commandline.cpp#L1223 In summary it is this:
Remaining question is how to get the blocksize. Assuming blockcount = 2000, I think we're almost always in this block: https://github.com/brenthuisman/libpar2/blob/master/src/commandline.cpp#L1151 Unfortunately I'm struggling to read along there. Do you have any idea for a heuristic for |
This seems pretty robust and doing what I think it does:
|
I'll keep this open as a reminder to do calculate the parameters a bit more intelligently. The snippet you posted looks plausible, I assume you're gonna calculate that in your external app and pass that in. (Also, I misspoke above, the shard limit for par2 is 65536, not 256 (which is par1).) |
OK, good idea. Indeed, this is what I calculate and pass in. Made a small modification to handle very small files. The shard limit I found in par2cmdline is 2**15 (~32k), not 65536. I tested this, and gopar too showed a threshold there. Hence the 2**15 in the snippet. |
Ah, yes you're right! Forgot there was a smaller limit for data shards. |
A nicer place for the snippet would be in gopars own flags of course, but I didn't do that because I felt that having different logic from par2cmdline for the -r flag could be confusing. On the other hand, maybe that's taking legacy compatibility a bit too far. What's your opinion on that? |
Yeah I don't think there's any real need to implement par2cmdline's computation exactly -- in fact, it seems pretty ad hoc, and I think if I think about it for a bit I can come up with a more systematic way. The calculation above is only for single files, right? In general, par2 would have handle multiple files, which might change thing a bit. |
Correct, this is only for single files, and therefore not ready for inclusion. I think I only work with single file parity (that's the whole idea of par2deep). |
For larger files (the threshold is somewhere between 9.2 and 77MB) I consistently get this error when I try to create parity. Looking at memory usage, all files (one is 2.7GB) seem to be loaded in full. The error seems to come right after loading:
The text was updated successfully, but these errors were encountered: