-
-
Notifications
You must be signed in to change notification settings - Fork 372
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
Support Acquire-By-Hash for index files #551
Conversation
I wonder if we should expose "symlinking" for S3/Swift supported publishing destinations (it could be as simple as |
S3 does not support symlinks, so we could put the name of the hash into the file instead of creating a symlink. We could also do this for the local file system, or keep the symlinks there. What would you prefer? |
I think we should try to avoid going with special-case depending on PublishedStorage. I would rather add new method |
Agree, I suggest to add the following to the PublishedStorage interface:
Does this sound reasonable? |
Oh, I didn't know we can put filename as fallback option. I think this would work the best and that even doesn't require any changes to PublishedStorage interface? I'm trying to keep it simple if possible. |
The fallback is only for the houskeeping. The interface has to be extended to support creating hardlinks (or a copy of the file when hardlinks are not available) with an arbitrary (hash) name. I agree on keeping the interface simple, but I think the acquire-by-hash support needs these 4 extensions in the interface. What do you prefer? |
Hi,
This allows the Acquire-By-Hash to be implemented by other the storage backends s3 and swift. If hardlinks are not supported, the file can simply be copied, if symlinks are not supported, the destination can be written to a file, which can be read and returned by ReadLink. FileExists is for convenience. If this is OK with you, I'll implement the s3 support, maybe someone else can implement these functions for swift. |
Thanks, @neolynx. Plan sounds good to me. I didn't quite get to the point where I can do through review, but I keep this PR on my radar. |
The added "aptly publish repo" option "-access-by-hash" publishes the index files (Packages*, Sources*) also as hardlinked hashes. Example: /dists/yakkety/main/binary-amd64/by-hash/SHA512/31833ec39acc... The Release files indicate this with the option "Acquire-By-Hash: yes" This is used by apt >= 1.2.0 and prevents the "Hash sum mismatch" race condition between a server side "aptly publish repo" and "apt-get update" on a client. See: http://www.chiark.greenend.org.uk/~cjwatson/blog/no-more-hash-sum-mismatch-errors.html This implementation uses symlinks in the by-hash/*/ directory for keeping only two versions of the index files and deleting older files automatically. Note: this only works with aptly.FileSystemPublishedStorage Closes: #536 Signed-off-by: André Roth <neolynx@gmail.com>
Signed-off-by: André Roth <neolynx@gmail.com>
Closing in favor of #664 |
The added "aptly publish repo" option "-access-by-hash" publishes
the index files (Packages*, Sources*) also as hardlinked hashes.
Example:
/dists/yakkety/main/binary-amd64/by-hash/SHA512/31833ec39acc...
The Release files indicate this with the option "Acquire-By-Hash: yes"
This is used by apt >= 1.2.0 and prevents the "Hash sum mismatch" race
condition between a server side "aptly publish repo" and "apt-get update"
on a client.
See: http://www.chiark.greenend.org.uk/~cjwatson/blog/no-more-hash-sum-mismatch-errors.html
This implementation uses symlinks in the by-hash/*/ directory for keeping
only two versions of the index files and deleting older files
automatically.
Note: this only works with aptly.FileSystemPublishedStorage
Closes: #536
Signed-off-by: André Roth neolynx@gmail.com