This repository has been archived by the owner on Jun 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
refactor(backup): straighten the execution path of download_file #631
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
levy5307
reviewed
Sep 23, 2020
hycdong
previously approved these changes
Sep 25, 2020
zhangyifan27
approved these changes
Oct 20, 2020
acelyc111
approved these changes
Oct 22, 2020
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The block_service API provides only async interfaces. It causes the callers must write code from bottom-up unnaturally.
This PR turns the async calls (
block_file::download
) inblock_service_manager::download_file
into sync functions (download_block_file_sync
).It doesn't change the original behavior, because
download_file
is actually synchronous at all. But it reverses the code to top-down, which is more readable for humans and more debuggable.Another significant change in this PR is that
download_file
does not verify checksum with remote FS anymore.A md5 verification of local file with remote:
Since in both restore and bulk-load, there's a meta file storing the checksums, which we use to compare with the local file checksum after the download completes. We do not need another verification between the local file and the remote file.
The remote file md5 is generally provided by the filesystem service.
But it doesn't mean that every filesystem has such capability to produce md5. Some may use by native an uncommon checksum algorithm, HDFS for example: https://blog.woopi.org/wordpress/files/hadoop-2.6.0-javadoc/org/apache/hadoop/fs/MD5MD5CRC32FileChecksum.html.
So md5 should not be in our presumption of the filesystem abstraction. I may remove
block_file::get_md5sum
in future PR.