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

br: add some log to record the CR we are processing #5711

Merged
merged 2 commits into from
Aug 23, 2024

Conversation

csuzhangxc
Copy link
Member

@csuzhangxc csuzhangxc commented Aug 23, 2024

What problem does this PR solve?

Add some log to record the CR we are processing, so that even the CR is deleted in K8s, we can still get this information from our log.

What is changed and how does it work?

Backup with .spec.from

I0823 04:07:07.095130      15 backup.go:77] start to process backup default/bk-after-restart
I0823 04:07:07.096848      15 manager.go:103] start to process backup: {"kind":"Backup","apiVersion":"pingcap.com/v1alpha1","metadata":{"name":"bk-after-restart","namespace":"default","uid":"b0c40f67-71c9-48dd-9f6d-00cd16185fbb","resourceVersion":"6697723","generation":2,"creationTimestamp":"2024-08-23T04:07:05Z","annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"pingcap.com/v1alpha1\",\"kind\":\"Backup\",\"metadata\":{\"annotations\":{},\"name\":\"bk-after-restart\",\"namespace\":\"default\"},\"spec\":{\"backupType\":\"full\",\"br\":{\"cluster\":\"basic\"},\"from\":{\"host\":\"basic-tidb.default.svc\",\"port\":4000,\"secretName\":\"tidb-secret\",\"user\":\"root\"},\"s3\":{\"bucket\":\"transfer\",\"endpoint\":\"https://s3.zhangxc.com\",\"prefix\":\"bk-after-restart\",\"provider\":\"aws\",\"region\":\"us-west-1\",\"secretName\":\"s3-secret\",\"storageClass\":\"STANDARD\"}}}\n"},"managedFields":[{"manager":"kubectl-client-side-apply","operation":"Update","apiVersion":"pingcap.com/v1alpha1","time":"2024-08-23T04:07:05Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{".":{},"f:kubectl.kubernetes.io/last-applied-configuration":{}}},"f:spec":{".":{},"f:backupMode":{},"f:backupType":{},"f:br":{".":{},"f:cluster":{}},"f:from":{".":{},"f:host":{},"f:port":{},"f:secretName":{},"f:user":{}},"f:s3":{".":{},"f:bucket":{},"f:endpoint":{},"f:prefix":{},"f:provider":{},"f:region":{},"f:secretName":{},"f:storageClass":{}}}}},{"manager":"tidb-controller-manager","operation":"Update","apiVersion":"pingcap.com/v1alpha1","time":"2024-08-23T04:07:05Z","fieldsType":"FieldsV1","fieldsV1":{"f:spec":{"f:backoffRetryPolicy":{".":{},"f:maxRetryTimes":{},"f:minRetryDuration":{},"f:retryTimeout":{}},"f:resources":{}},"f:status":{".":{},"f:conditions":{},"f:phase":{},"f:timeCompleted":{},"f:timeStarted":{}}}}]},"spec":{"resources":{},"from":{"host":"basic-tidb.default.svc","port":4000,"user":"root","secretName":"tidb-secret"},"backupType":"full","backupMode":"snapshot","s3":{"provider":"aws","region":"us-west-1","bucket":"transfer","endpoint":"https://s3.zhangxc.com","storageClass":"STANDARD","secretName":"s3-secret","prefix":"bk-after-restart"},"br":{"cluster":"basic"},"backoffRetryPolicy":{"minRetryDuration":"300s","maxRetryTimes":2,"retryTimeout":"30m"}},"status":{"timeStarted":null,"timeCompleted":null,"phase":"Scheduled","conditions":[{"type":"Scheduled","status":"True","lastTransitionTime":"2024-08-23T04:07:05Z"}]}}
I0823 04:07:07.096876      15 manager.go:133] start to connect to tidb server (basic-tidb.default.svc:4000) as the .spec.from field is specified

Backup without .spec.from

I0823 06:19:30.613517      15 backup.go:77] start to process backup default/bk-after-restart
I0823 06:19:30.616603      15 manager.go:103] start to process backup: {"kind":"Backup","apiVersion":"pingcap.com/v1alpha1","metadata":{"name":"bk-after-restart","namespace":"default","uid":"73c051f9-22fd-416f-bfa6-df255d44207f","resourceVersion":"6718147","generation":2,"creationTimestamp":"2024-08-23T06:19:28Z","annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"pingcap.com/v1alpha1\",\"kind\":\"Backup\",\"metadata\":{\"annotations\":{},\"name\":\"bk-after-restart\",\"namespace\":\"default\"},\"spec\":{\"backupType\":\"full\",\"br\":{\"cluster\":\"basic\"},\"s3\":{\"bucket\":\"transfer\",\"endpoint\":\"https://s3.zhangxc.com\",\"prefix\":\"bk-after-restart\",\"provider\":\"aws\",\"region\":\"us-west-1\",\"secretName\":\"s3-secret\",\"storageClass\":\"STANDARD\"}}}\n"},"managedFields":[{"manager":"kubectl-client-side-apply","operation":"Update","apiVersion":"pingcap.com/v1alpha1","time":"2024-08-23T06:19:28Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{".":{},"f:kubectl.kubernetes.io/last-applied-configuration":{}}},"f:spec":{".":{},"f:backupMode":{},"f:backupType":{},"f:br":{".":{},"f:cluster":{}},"f:s3":{".":{},"f:bucket":{},"f:endpoint":{},"f:prefix":{},"f:provider":{},"f:region":{},"f:secretName":{},"f:storageClass":{}}}}},{"manager":"tidb-controller-manager","operation":"Update","apiVersion":"pingcap.com/v1alpha1","time":"2024-08-23T06:19:28Z","fieldsType":"FieldsV1","fieldsV1":{"f:spec":{"f:backoffRetryPolicy":{".":{},"f:maxRetryTimes":{},"f:minRetryDuration":{},"f:retryTimeout":{}},"f:resources":{}},"f:status":{".":{},"f:conditions":{},"f:phase":{},"f:timeCompleted":{},"f:timeStarted":{}}}}]},"spec":{"resources":{},"backupType":"full","backupMode":"snapshot","s3":{"provider":"aws","region":"us-west-1","bucket":"transfer","endpoint":"https://s3.zhangxc.com","storageClass":"STANDARD","secretName":"s3-secret","prefix":"bk-after-restart"},"br":{"cluster":"basic"},"backoffRetryPolicy":{"minRetryDuration":"300s","maxRetryTimes":2,"retryTimeout":"30m"}},"status":{"timeStarted":null,"timeCompleted":null,"phase":"Scheduled","conditions":[{"type":"Scheduled","status":"True","lastTransitionTime":"2024-08-23T06:19:28Z"}]}}

Restore with .spec.to

I0823 06:40:21.039956      15 restore.go:79] start to process restore default/restore
I0823 06:40:21.042993      15 manager.go:105] start to process restore: {"kind":"Restore","apiVersion":"pingcap.com/v1alpha1","metadata":{"name":"restore","namespace":"default","uid":"f1e6d309-995c-40c4-8253-d1159669c2c7","resourceVersion":"6721380","generation":2,"creationTimestamp":"2024-08-23T06:40:17Z","annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"pingcap.com/v1alpha1\",\"kind\":\"Restore\",\"metadata\":{\"annotations\":{},\"name\":\"restore\",\"namespace\":\"default\"},\"spec\":{\"br\":{\"cluster\":\"basic\"},\"s3\":{\"bucket\":\"transfer\",\"endpoint\":\"https://s3.zhangxc.com\",\"prefix\":\"bk-after-restart\",\"provider\":\"aws\",\"region\":\"us-west-1\",\"secretName\":\"s3-secret\",\"storageClass\":\"STANDARD\"},\"storageSize\":\"1Gi\",\"to\":{\"host\":\"basic-tidb.default.svc\",\"port\":4000,\"secretName\":\"tidb-secret\",\"user\":\"root\"}}}\n"},"managedFields":[{"manager":"kubectl-client-side-apply","operation":"Update","apiVersion":"pingcap.com/v1alpha1","time":"2024-08-23T06:40:17Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{".":{},"f:kubectl.kubernetes.io/last-applied-configuration":{}}},"f:spec":{".":{},"f:br":{".":{},"f:cluster":{}},"f:restoreMode":{},"f:s3":{".":{},"f:bucket":{},"f:endpoint":{},"f:prefix":{},"f:provider":{},"f:region":{},"f:secretName":{},"f:storageClass":{}},"f:storageSize":{},"f:to":{".":{},"f:host":{},"f:port":{},"f:secretName":{},"f:user":{}}}}},{"manager":"tidb-controller-manager","operation":"Update","apiVersion":"pingcap.com/v1alpha1","time":"2024-08-23T06:40:17Z","fieldsType":"FieldsV1","fieldsV1":{"f:spec":{"f:pitrFullBackupStorageProvider":{},"f:resources":{}},"f:status":{".":{},"f:conditions":{},"f:phase":{},"f:timeCompleted":{},"f:timeStarted":{}}}}]},"spec":{"resources":{},"to":{"host":"basic-tidb.default.svc","port":4000,"user":"root","secretName":"tidb-secret"},"restoreMode":"snapshot","s3":{"provider":"aws","region":"us-west-1","bucket":"transfer","endpoint":"https://s3.zhangxc.com","storageClass":"STANDARD","secretName":"s3-secret","prefix":"bk-after-restart"},"pitrFullBackupStorageProvider":{},"storageSize":"1Gi","br":{"cluster":"basic"}},"status":{"timeStarted":null,"timeCompleted":null,"phase":"Scheduled","conditions":[{"type":"Scheduled","status":"True","lastTransitionTime":"2024-08-23T06:40:17Z"}]}}
I0823 06:40:21.043205      15 manager.go:115] start to connect to tidb server (basic-tidb.default.svc:4000) as the .spec.to field is specified

Restore without .spec.to

I0823 06:47:20.101781      15 restore.go:79] start to process restore default/restore
I0823 06:47:20.104161      15 manager.go:105] start to process restore: {"kind":"Restore","apiVersion":"pingcap.com/v1alpha1","metadata":{"name":"restore","namespace":"default","uid":"1b9c07c0-5349-4baa-9da2-70321b49f5a9","resourceVersion":"6722487","generation":2,"creationTimestamp":"2024-08-23T06:47:18Z","annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"pingcap.com/v1alpha1\",\"kind\":\"Restore\",\"metadata\":{\"annotations\":{},\"name\":\"restore\",\"namespace\":\"default\"},\"spec\":{\"br\":{\"cluster\":\"basic\"},\"s3\":{\"bucket\":\"transfer\",\"endpoint\":\"https://s3.zhangxc.com\",\"prefix\":\"bk-after-restart\",\"provider\":\"aws\",\"region\":\"us-west-1\",\"secretName\":\"s3-secret\",\"storageClass\":\"STANDARD\"},\"storageSize\":\"1Gi\"}}\n"},"managedFields":[{"manager":"kubectl-client-side-apply","operation":"Update","apiVersion":"pingcap.com/v1alpha1","time":"2024-08-23T06:47:18Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{".":{},"f:kubectl.kubernetes.io/last-applied-configuration":{}}},"f:spec":{".":{},"f:br":{".":{},"f:cluster":{}},"f:restoreMode":{},"f:s3":{".":{},"f:bucket":{},"f:endpoint":{},"f:prefix":{},"f:provider":{},"f:region":{},"f:secretName":{},"f:storageClass":{}},"f:storageSize":{}}}},{"manager":"tidb-controller-manager","operation":"Update","apiVersion":"pingcap.com/v1alpha1","time":"2024-08-23T06:47:18Z","fieldsType":"FieldsV1","fieldsV1":{"f:spec":{"f:pitrFullBackupStorageProvider":{},"f:resources":{}},"f:status":{".":{},"f:conditions":{},"f:phase":{},"f:timeCompleted":{},"f:timeStarted":{}}}}]},"spec":{"resources":{},"restoreMode":"snapshot","s3":{"provider":"aws","region":"us-west-1","bucket":"transfer","endpoint":"https://s3.zhangxc.com","storageClass":"STANDARD","secretName":"s3-secret","prefix":"bk-after-restart"},"pitrFullBackupStorageProvider":{},"storageSize":"1Gi","br":{"cluster":"basic"}},"status":{"timeStarted":null,"timeCompleted":null,"phase":"Scheduled","conditions":[{"type":"Scheduled","status":"True","lastTransitionTime":"2024-08-23T06:47:18Z"}]}}

Code changes

  • Has Go code change
  • Has CI related scripts change

Tests

  • Unit test
  • E2E test
  • Manual test
  • No code

Side effects

  • Breaking backward compatibility
  • Other side effects:

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation

Release Notes

Please refer to Release Notes Language Style Guide before writing the release note.


@ti-chi-bot ti-chi-bot bot added the size/M label Aug 23, 2024
@csuzhangxc
Copy link
Member Author

/run-pull-e2e-kind-br

@csuzhangxc
Copy link
Member Author

/run-pull-e2e-kind-br

@ti-chi-bot ti-chi-bot bot added the lgtm label Aug 23, 2024
Copy link
Contributor

ti-chi-bot bot commented Aug 23, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: WangLe1321

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

Copy link
Contributor

ti-chi-bot bot commented Aug 23, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-08-23 07:00:40.494600989 +0000 UTC m=+508035.629051111: ☑️ agreed by WangLe1321.

@ti-chi-bot ti-chi-bot bot added the approved label Aug 23, 2024
@csuzhangxc
Copy link
Member Author

/cherry-pick release-1.4

@ti-chi-bot
Copy link
Member

@csuzhangxc: once the present PR merges, I will cherry-pick it on top of release-1.4 in the new PR and assign it to you.

In response to this:

/cherry-pick release-1.4

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@csuzhangxc
Copy link
Member Author

/cherry-pick release-1.5

@ti-chi-bot
Copy link
Member

@csuzhangxc: once the present PR merges, I will cherry-pick it on top of release-1.5 in the new PR and assign it to you.

In response to this:

/cherry-pick release-1.5

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@csuzhangxc
Copy link
Member Author

/cherry-pick release-1.6

@ti-chi-bot
Copy link
Member

@csuzhangxc: once the present PR merges, I will cherry-pick it on top of release-1.6 in the new PR and assign it to you.

In response to this:

/cherry-pick release-1.6

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@csuzhangxc
Copy link
Member Author

/cherry-pick master

@ti-chi-bot
Copy link
Member

@csuzhangxc: once the present PR merges, I will cherry-pick it on top of master in the new PR and assign it to you.

In response to this:

/cherry-pick master

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@codecov-commenter
Copy link

codecov-commenter commented Aug 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 24.29%. Comparing base (e98d820) to head (a8acaa1).
Report is 1 commits behind head on v1.4.5-log.

❗ There is a different number of reports uploaded between BASE (e98d820) and HEAD (a8acaa1). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (e98d820) HEAD (a8acaa1)
unittest 1 0
Additional details and impacted files
@@               Coverage Diff               @@
##           v1.4.5-log    #5711       +/-   ##
===============================================
- Coverage       58.91%   24.29%   -34.62%     
===============================================
  Files             227      206       -21     
  Lines           26267    26433      +166     
===============================================
- Hits            15475     6422     -9053     
- Misses           9307    19151     +9844     
+ Partials         1485      860      -625     
Flag Coverage Δ
e2e 24.29% <ø> (?)
unittest ?

@csuzhangxc csuzhangxc merged commit 1867f39 into v1.4.5-log Aug 23, 2024
2 of 3 checks passed
@csuzhangxc csuzhangxc deleted the csuzhangxc/v1.4.5-log branch August 23, 2024 07:48
@ti-chi-bot
Copy link
Member

@csuzhangxc: new pull request created to branch release-1.4: #5712.

In response to this:

/cherry-pick release-1.4

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Member

@csuzhangxc: new pull request created to branch release-1.5: #5713.

In response to this:

/cherry-pick release-1.5

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Member

@csuzhangxc: new pull request created to branch release-1.6: #5714.

In response to this:

/cherry-pick release-1.6

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Member

@csuzhangxc: new pull request created to branch master: #5715.

In response to this:

/cherry-pick master

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

csuzhangxc added a commit that referenced this pull request Aug 23, 2024
Co-authored-by: csuzhangxc <csuzhangxc@gmail.com>
csuzhangxc added a commit that referenced this pull request Aug 23, 2024
Co-authored-by: csuzhangxc <csuzhangxc@gmail.com>
csuzhangxc added a commit that referenced this pull request Aug 23, 2024
Co-authored-by: csuzhangxc <csuzhangxc@gmail.com>
csuzhangxc added a commit that referenced this pull request Aug 23, 2024
Co-authored-by: csuzhangxc <csuzhangxc@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants