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

lightning,dumpling: make tidb version check more compitible #29500

Merged
merged 15 commits into from
Nov 7, 2021

Conversation

glorv
Copy link
Contributor

@glorv glorv commented Nov 5, 2021

What problem does this PR solve?

TiDB version string can be customized by set the corresponding config field. So parse the result from select verson() to get tidb release version is not correct in some case.

What is changed and how it works?

  • Try to exec select version() and parse the result as tidb version; If the query returns error, fallback to select version(); so we can still be compitible with MySQL/MariaDB.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
    • Run dumpling and lightning(local backend) with TiDB playground v5.2.2 (server-version = 'Test-5.7.22'), both can detect tidb version correctly and export/import successfully
    • Run dumpling and lightning (tidb backend) with MySQL 5.7.22, both can export/import successfully.
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Avoid version check failure when tidb version is customized.

@glorv glorv added component/lightning This issue is related to Lightning of TiDB. component/dumpling This is related to Dumpling of TiDB. labels Nov 5, 2021
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Nov 5, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • 3pointer
  • lichunzhu

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 release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 5, 2021
@@ -255,32 +267,59 @@ func FetchVersion(ctx context.Context, db utils.QueryExecutor) (string, error) {
type ServerType int

const (
// ServerTypeUnknown represents unknown server type
// version.ServerTypeUnknown represents unknown server type
Copy link
Contributor

Choose a reason for hiding this comment

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

🤔

{ServerTypeTiDB, consistencyTypeSnapshot, false},
{ServerTypeTiDB, consistencyTypeLock, true},
{version.ServerTypeUnknown, consistencyTypeNone, true},
{version.ServerTypeUnknown, consistencyTypeFlush, true},
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{version.ServerTypeUnknown, consistencyTypeFlush, true},
{version.ServerTypeMySQL, consistencyTypeFlush, true},

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 5, 2021
@glorv
Copy link
Contributor Author

glorv commented Nov 5, 2021

/hold

@ti-chi-bot ti-chi-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 5, 2021
@glorv
Copy link
Contributor Author

glorv commented Nov 5, 2021

/unhold

@ti-chi-bot ti-chi-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 5, 2021
Copy link
Contributor

@3pointer 3pointer 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-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Nov 5, 2021
glorv added a commit to glorv/tidb that referenced this pull request Nov 5, 2021
@glorv
Copy link
Contributor Author

glorv commented Nov 5, 2021

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 363e05a

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Nov 5, 2021
@ti-chi-bot ti-chi-bot removed the status/can-merge Indicates a PR has been approved by a committer. label Nov 5, 2021
@glorv
Copy link
Contributor Author

glorv commented Nov 5, 2021

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 5f91996

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Nov 5, 2021
@ti-chi-bot ti-chi-bot removed the status/can-merge Indicates a PR has been approved by a committer. label Nov 5, 2021
@glorv
Copy link
Contributor Author

glorv commented Nov 5, 2021

/run-check_dev

@glorv
Copy link
Contributor Author

glorv commented Nov 5, 2021

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 4219e51

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Nov 5, 2021
@glorv
Copy link
Contributor Author

glorv commented Nov 6, 2021

/merge

@ti-chi-bot
Copy link
Member

@glorv: Your PR was out of date, I have automatically updated it for you.

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

/run-all-tests

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.

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 ti-chi-bot merged commit 3537d7e into pingcap:master Nov 7, 2021
@glorv glorv deleted the tidb_version branch November 8, 2021 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/dumpling This is related to Dumpling of TiDB. component/lightning This issue is related to Lightning of TiDB. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 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.

5 participants