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

Fix the issue meta backup is failed when symbolic links exist in meta dir. #2255

Merged
merged 2 commits into from
Aug 18, 2023

Conversation

KanShiori
Copy link
Collaborator

@KanShiori KanShiori commented Aug 18, 2023

What problem does this PR solve?

Close #2241

What is changed and how it works?

  • Use the relative path to create a symbolic link when executing tiup cluster patch --overwrte.
  • Support packaging symbolic links when executing tiup cluster meta backup.

Check List

Tests

  • Patch the pd and check the symbolic link is a relative path.
$ ./tiup-cluster patch my-cluster pd-v5.1.0-linux-amd64.tar.gz --overwrite -R pd
...

$ ll /root/.tiup/storage/cluster/clusters/my-cluster/patch/
total 40M
-rw-r--r-- 1 root root 40M Aug 18 06:58 pd-b64365c.tar.gz
lrwxrwxrwx 1 root root  17 Aug 18 06:58 pd.tar.gz -> pd-b64365c.tar.gz
  • Backup cluster meta.
$ /tiup-cluster meta backup my-cluster
successfully backup meta of cluster my-cluster on tiup-cluster_my-cluster_metabackup_2023-08-18T07-00-21Z.tar.gz
  • Restore to a new cluster and check the symbolic link.
$ ./tiup-cluster meta restore my-cluster-restore tiup-cluster_my-cluster_metabackup_2023-08-18T07-00-21Z.tar.gz
meta of cluster my-cluster-restore didn't exist before restore
the given tarball was last modified at 2023-08-18T07:00:32Z
restore meta of cluster my-cluster-restore successfully.

$ ll /root/.tiup/storage/cluster/clusters/my-cluster-restore/patch
total 40M
-rw-r--r-- 1 root root 40M Aug 18 07:01 pd-b64365c.tar.gz
lrwxrwxrwx 1 root root  17 Aug 18 07:01 pd.tar.gz -> pd-b64365c.tar.gz

Release notes:

Fix the issue meta backup is failed when symbolic links exist in meta dir.

@ti-chi-bot ti-chi-bot bot requested a review from srstack August 18, 2023 06:53
@ti-chi-bot ti-chi-bot bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Aug 18, 2023
@KanShiori KanShiori changed the title Fix the issue meta backup is failed when dirs contains symbolic link. Fix the issue meta backup is failed when symbolic links exist in meta dir. Aug 18, 2023
@codecov-commenter
Copy link

codecov-commenter commented Aug 18, 2023

Codecov Report

Patch coverage: 14.29% and project coverage change: +0.11% 🎉

Comparison is base (f73a527) 55.97% compared to head (91a804e) 56.09%.

❗ Current head 91a804e differs from pull request most recent head 0dd5b49. Consider uploading reports for the commit 0dd5b49 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2255      +/-   ##
==========================================
+ Coverage   55.97%   56.09%   +0.11%     
==========================================
  Files         320      320              
  Lines       33866    33877      +11     
==========================================
+ Hits        18956    19000      +44     
+ Misses      12641    12606      -35     
- Partials     2269     2271       +2     
Flag Coverage Δ
cluster 44.91% <14.29%> (+0.09%) ⬆️
dm 25.65% <0.00%> (-0.04%) ⬇️
playground 15.81% <0.00%> (+0.07%) ⬆️
tiup 15.90% <0.00%> (+0.02%) ⬆️
unittest 22.65% <0.00%> (-0.01%) ⬇️

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

Files Changed Coverage Δ
pkg/utils/ioutil.go 54.67% <0.00%> (-1.31%) ⬇️
pkg/cluster/manager/patch.go 42.24% <40.00%> (-0.44%) ⬇️

... and 8 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Aug 18, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kaaaaaaang

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

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the lgtm label Aug 18, 2023
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Aug 18, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-08-18 09:32:24.741726749 +0000 UTC m=+882709.290742735: ☑️ agreed by kaaaaaaang.

@ti-chi-bot ti-chi-bot bot added the approved label Aug 18, 2023
@ti-chi-bot ti-chi-bot bot merged commit 0a60bc3 into pingcap:master Aug 18, 2023
18 checks passed
@kaaaaaaang kaaaaaaang added this to the 1.13.0 milestone Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cluster meta backup failed if soft link exist
3 participants