-
Notifications
You must be signed in to change notification settings - Fork 101
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
Add multiplatform (manifest list) proxying + fix concurrent writes to files + add concurrent download of layers #314
Add multiplatform (manifest list) proxying + fix concurrent writes to files + add concurrent download of layers #314
Conversation
Also replace fs::copy by fs::rename for performance and atomicity.
wow, great work with the filesystem corruption points. Thats a serious bug. I'm not a maintainer but I'm not sure I agree with "I think it's fair to assume that both these directories are on the same filesystem". It might be the case 90% of the time, but thats not a good argument. Perhaps a default and a flag? Or attempt a copy if the rename fails? |
@splitice keep in mind that the cli accepts a |
While I see your point @awoimbee I much prefer retaining compatibility and flexibility. Is there some reason attempting a move if the rename fails would be difficult or suboptimal? The errno could be checked. |
Anything can be done, the question is should it be done. I forgot to add that |
Just looking at this now. Thanks a lot for all the work here. |
Yeah, I think rename is better. I am worried there was a reason I didn't do it, but I suspect I just never noticed. This way makes things a lot simpler. Thanks for the tests as well, this was a great PR. @splitice thanks for bringing up those points; they both need to be thought about. In this case, I really don't see much impact on existing users. And @awoimbee is correct about the filesystem. This does make it harder to move to a system where those directories are on a different FS, but I don't expect that to be a requested feature in the short term at least. And if we're wrong we can always rework this. |
Sorry, I wanted this PR to be smaller but then went down the rabbithole of file integrity and concurrent writes.
Relevant changes are in
fn create_accept_header
andasync fn download_manifest_and_layers
+ newly createdasync fn download_blob
We have to download every layer of every platform because a client might ask for any random layer.
I ended up creating
lib/server/temporary_file.rs
, take a look attest_temporary_file_async_cancellation
;)Thanks to this wrapper:
fs::copy
to move blobs from the scratch to their destination, so I changed it tofs::rename
(I think it's fair to assume that both these directories are on the same filesystem), the speed increase is noticeable here too