Skip to content
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

HDDS-3093. Allow forced overwrite of local file #800

Merged
merged 10 commits into from
Apr 10, 2020

Conversation

adoroszlai
Copy link
Contributor

@adoroszlai adoroszlai commented Apr 9, 2020

What changes were proposed in this pull request?

Add -f (--force) flag for ozone sh key get, to allow force overwrite of local file. This is useful for testing:

  • download the same key multiple times without having to manually delete the target
  • download to /dev/null (which already exists), only to verify existence and checksum of the key

Hash cannot be calculated for /dev/null.

This PR is based on top of #775, so that one should be merged first. The only change here is 2ca1fe2.

https://issues.apache.org/jira/browse/HDDS-3093

How was this patch tested?

$ ozone freon ockg -n 1 -p test
...

$ ozone sh key get /vol1/bucket1/test/0 /tmp/asdf

$ ozone sh key get /vol1/bucket1/test/0 /tmp/asdf
/tmp/asdf exists. Download would overwrite an existing file. Aborting.

$ ozone sh key get --force /vol1/bucket1/test/0 /tmp/asdf

$ ozone sh --verbose key get --force /vol1/bucket1/test/0 /tmp/asdf
Volume Name : vol1
Bucket Name : bucket1
Key Name : test/0
Downloaded file hash : 528e4f96633a453d18ee01fdb5d7c536

$ ozone sh --verbose key get --force /vol1/bucket1/test/0 /dev/null
Volume Name : vol1
Bucket Name : bucket1
Key Name : test/0

Added smoke test for overwrite case.

@adoroszlai adoroszlai self-assigned this Apr 9, 2020
Copy link
Contributor

@xiaoyuyao xiaoyuyao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall, comments added inline.

@adoroszlai
Copy link
Contributor Author

Thanks @xiaoyuyao for the review.

Copy link
Contributor

@dineshchitlangia dineshchitlangia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 @adoroszlai thanks for working on this, @xiaoyuyao thanks for reviewing.

@dineshchitlangia dineshchitlangia merged commit 90c29d7 into apache:master Apr 10, 2020
@adoroszlai
Copy link
Contributor Author

Thanks @dineshchitlangia for reviewing and merging it.

@adoroszlai adoroszlai deleted the HDDS-3093 branch April 14, 2020 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants