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

brie/: add GetVersion function for tidbGlueSession #22731

Merged
merged 9 commits into from
Feb 23, 2021

Conversation

lichunzhu
Copy link
Contributor

@lichunzhu lichunzhu commented Feb 4, 2021

What problem does this PR solve?

Issue Number: pingcap/br#698

Problem Summary: BR will add backup tool version in backup meta. We need a GetVersion method to distinguish TiDB and BR.

What is changed and how it works?

What's Changed: Add GetVersion method

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test
  • Integration test

Release note

  • No release note

@lichunzhu lichunzhu requested a review from a team as a code owner February 4, 2021 09:03
@lichunzhu lichunzhu requested review from qw4990 and removed request for a team February 4, 2021 09:03
@ti-srebot ti-srebot added the first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. label Feb 4, 2021
@lichunzhu
Copy link
Contributor Author

New Glue:

// Glue is an abstraction of TiDB function calls used in BR.
type Glue interface {
	GetDomain(store kv.Storage) (*domain.Domain, error)
	CreateSession(store kv.Storage) (Session, error)
	Open(path string, option pd.SecurityOption) (kv.Storage, error)

	// OwnsStorage returns whether the storage returned by Open() is owned
	// If this method returns false, the connection manager will never close the storage.
	OwnsStorage() bool

	StartProgress(ctx context.Context, cmdName string, total int64, redirectLog bool) Progress

	// Record records some information useful for log-less summary.
	Record(name string, value uint64)

	// GetVersion gets the code version to run backup/restore job
	GetVersion() string
}

@lichunzhu
Copy link
Contributor Author

/cc 3pointer,kennytm

@@ -465,3 +466,7 @@ func (gs *tidbGlueSession) Record(name string, value uint64) {
gs.info.archiveSize = value
}
}

func (gs *tidbGlueSession) GetVersion() string {
Copy link
Member

Choose a reason for hiding this comment

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

Please add a test to make sure it has consistent format in the future release.

@lance6716
Copy link
Contributor

could you refer the change of BR side here

@lichunzhu
Copy link
Contributor Author

could you refer the change of BR side here

Do you mean this?
#22731 (comment)

@github-actions github-actions bot added the sig/execution SIG execution label Feb 4, 2021
@lance6716
Copy link
Contributor

could you refer the change of BR side here

Do you mean this?
#22731 (comment)

br implementation of this method

@lichunzhu
Copy link
Contributor Author

lichunzhu commented Feb 4, 2021

could you refer the change of BR side here

Do you mean this?
#22731 (comment)

br implementation of this method

I paste the draft PR here. Without TiDB's update br can't merge this PR. https://github.com/pingcap/br/pull/734/files#diff-d811c98bfebfd509023db7c21e45d168e4866b44730fba1623cce73c165753e1R30

@lance6716
Copy link
Contributor

br implementation of this method

I paste the draft PR here. Without TiDB's update br can't merge this PR. https://github.com/pingcap/br/pull/734/files#diff-d811c98bfebfd509023db7c21e45d168e4866b44730fba1623cce73c165753e1R30

OK I see https://github.com/pingcap/br/pull/734/files#diff-e298c599e67840ea0aa474846beaeebe316116f45182c9bde55025d82bc82b4fR61

I think the unit test could also ensure there's TiDB at first line.

rest LGTM

overvenus
overvenus previously approved these changes Feb 18, 2021
Copy link
Member

@overvenus overvenus left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-srebot
Copy link
Contributor

@overvenus, Thanks for your review. The bot only counts LGTMs from Reviewers and higher roles, but you're still welcome to leave your comments. See the corresponding SIG page for more information. Related SIG: execution(slack).

@lichunzhu
Copy link
Contributor Author

https://github.com/pingcap/br/pull/734/files#diff-e298c599e67840ea0aa474846beaeebe316116f45182c9bde55025d82bc82b4fR61

I want to make sure the version info is added in backupmeta. Besides, we can add this test in pingcap/br#734.

@lance6716
Copy link
Contributor

lance6716 commented Feb 18, 2021

https://github.com/pingcap/br/pull/734/files#diff-e298c599e67840ea0aa474846beaeebe316116f45182c9bde55025d82bc82b4fR61

I want to make sure the version info is added in backupmeta. Besides, we can add this test in pingcap/br#734.

I mean as in PR description "distinguish TiDB and BR", should check first line there's enough message to distinguish

updated: could test in integration test of BR's PR

@lance6716
Copy link
Contributor

/lgtm

@ti-srebot
Copy link
Contributor

@lance6716, Thanks for your review. The bot only counts LGTMs from Reviewers and higher roles, but you're still welcome to leave your comments. See the corresponding SIG page for more information. Related SIG: execution(slack).

@ti-srebot
Copy link
Contributor

@kennytm, Thanks for your review. The bot only counts LGTMs from Reviewers and higher roles, but you're still welcome to leave your comments. See the corresponding SIG page for more information. Related SIG: execution(slack).

@kennytm
Copy link
Contributor

kennytm commented Feb 19, 2021

/cc crazycs520,AilinKid

@ti-chi-bot ti-chi-bot removed the sig/execution SIG execution label Feb 23, 2021
@lichunzhu
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

@lichunzhu: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

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

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

Commit hash: ab944e2

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Feb 23, 2021
@ti-chi-bot ti-chi-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 23, 2021
@lichunzhu
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

@lichunzhu: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

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.

@Rustin170506
Copy link
Member

/merge

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

@lichunzhu
Copy link
Contributor Author

/test unit-test

@Rustin170506
Copy link
Member

/run-unit-test

@ti-chi-bot
Copy link
Member

@lichunzhu: Your PR has out-of-dated, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

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.

@github-actions github-actions bot added the sig/execution SIG execution label Feb 23, 2021
@ti-chi-bot ti-chi-bot merged commit 339bc46 into pingcap:master Feb 23, 2021
@lichunzhu lichunzhu deleted the addBRIEGetVersion branch February 23, 2021 03:49
@lichunzhu
Copy link
Contributor Author

/label needs-cherry-pick-5.0-rc

@lichunzhu
Copy link
Contributor Author

/label needs-cherry-pick-4.0

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Mar 5, 2021
@ti-srebot
Copy link
Contributor

cherry pick to release-5.0-rc in PR #23142

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Mar 5, 2021
@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 in PR #23143

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. sig/execution SIG execution sig/migrate size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants