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

clone_mirror: refuse to clone from self #1464

Merged
merged 1 commit into from
Jul 1, 2021

Conversation

dveeden
Copy link
Contributor

@dveeden dveeden commented Jun 30, 2021

What problem does this PR solve?

When running something like this:

tiup mirror clone /tmp/tidb_mirror -a amd64 --prefix v5.1.0 --os linux
tiup mirror set /tmp/tidb_mirror
tiup mirror clone /tmp/tidb_mirror -a amd64 --prefix v5.1.0 --os linux

This results in metadata being changed/corrupted.

Then the next tiup mirror clone ... results in:

Error: read manifest from mirror(/tmp/tidb_mirror) failed: not enough signatures (0) for threshold 1 in timestamp.json

This can easily be fixed with tiup mirror set ..., but it is best to
avoid this. And also cloning from self is probably not what the user
wanted in the first place. So adding the source to the output to make
this easier to spot.

Related: https://tidbcommunity.slack.com/archives/C019S7HLP61/p1625059913130200

Check List

Tests

  • Manual test (add detailed scripts or steps below)

Release notes:

A clear error is given when trying to clone a mirror from itself

@ti-chi-bot ti-chi-bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jun 30, 2021
@codecov-commenter
Copy link

codecov-commenter commented Jun 30, 2021

Codecov Report

Merging #1464 (d029558) into master (6d88e56) will decrease coverage by 9.58%.
The diff coverage is 0.00%.

❗ Current head d029558 differs from pull request most recent head 5ecfe38. Consider uploading reports for the commit 5ecfe38 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1464      +/-   ##
==========================================
- Coverage   24.85%   15.26%   -9.59%     
==========================================
  Files         267      150     -117     
  Lines       21265    13075    -8190     
==========================================
- Hits         5285     1996    -3289     
+ Misses      15173    10570    -4603     
+ Partials      807      509     -298     
Flag Coverage Δ
integrate 15.26% <0.00%> (+0.02%) ⬆️
tiup 15.26% <0.00%> (+0.02%) ⬆️
unittest ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/repository/clone_mirror.go 0.00% <0.00%> (ø)
embed/embed.go 0.00% <0.00%> (-100.00%) ⬇️
pkg/utils/regexp.go 0.00% <0.00%> (-100.00%) ⬇️
pkg/cluster/spec/validate.go 0.00% <0.00%> (-89.97%) ⬇️
pkg/cluster/executor/checkpoint.go 0.00% <0.00%> (-82.61%) ⬇️
pkg/utils/semver.go 2.60% <0.00%> (-82.61%) ⬇️
pkg/utils/diff.go 0.00% <0.00%> (-82.50%) ⬇️
pkg/meta/err.go 0.00% <0.00%> (-81.25%) ⬇️
pkg/cluster/api/error.go 0.00% <0.00%> (-80.00%) ⬇️
pkg/cluster/spec/parse_topology.go 0.00% <0.00%> (-78.47%) ⬇️
... and 162 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6d88e56...5ecfe38. Read the comment docs.

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • AstroProfundis

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 1, 2021
When running something like this:
```
tiup mirror clone /tmp/tidb_mirror -a amd64 --prefix v5.1.0 --os linux
tiup mirror set /tmp/tidb_mirror
tiup mirror clone /tmp/tidb_mirror -a amd64 --prefix v5.1.0 --os linux
```
This results in metadata being changed/corrupted.

Then the next `tiup mirror clone ...` results in:
```
Error: read manifest from mirror(/tmp/tidb_mirror) failed: not enough signatures (0) for threshold 1 in timestamp.json
```

This can easily be fixed with `tiup mirror set ...`, but it is best to
avoid this. And also cloning from self is probably not what the user
wanted in the first place. So adding the source to the output to make
this easier to spot.

Related: https://tidbcommunity.slack.com/archives/C019S7HLP61/p1625059913130200
@dveeden dveeden requested a review from lucklove July 1, 2021 07:10
@AstroProfundis
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 5ecfe38

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jul 1, 2021
@ti-chi-bot ti-chi-bot merged commit a293227 into pingcap:master Jul 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants