-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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: skip CREATE DATABASE when downstream exists, and return error when parse failed #51801
Conversation
Signed-off-by: lance6716 <lance6716@gmail.com>
Hi @lance6716. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. 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 kubernetes/test-infra repository. |
/check-issue-triage-complete |
br/pkg/lightning/importer/import.go
Outdated
@@ -630,7 +630,8 @@ func (worker *restoreSchemaWorker) addJob(sqlStr string, job *schemaJob) error { | |||
zap.String("table", job.tblName), | |||
zap.String("statement", sqlStr), | |||
zap.Error(err)) | |||
job.stmts = []string{sqlStr} | |||
useStmt := common.SprintfWithIdentifiers("USE %s", job.dbName) | |||
job.stmts = []string{useStmt, sqlStr} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should return error if we cannot parse the sql, so user can see the real err that help diagnose. lightning version >= tidb-version in most case, so there shouldn't be cases that lightning cannot parse, but tidb can execute it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a cloud oncall, tiflow's version is lower than downstream TiDB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then we should update tiflow with latest tidb dependency
also the logic to use original sql is error prone when the unparsable sql already contains dbname that might be the one we want
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our rewrite logic will not change the error message if downstream can not execute them, the user still can see a meaningful error message which is reported by downstream TiDB's parser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i mean when the sql is unparsable by tiflow, but ok for tidb, then we might created it in the wrong db
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree update tiflow with latest tidb dependency
But since we already support the function of executing raw SQL even if it cannot be parsed, I think this PR can be fixed as a bug. Unless we firmly decide to remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should remove the fallback logic if tiflow can be newer than downstream TiDB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also agree with "update tiflow with latest tidb dependency"
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #51801 +/- ##
=================================================
- Coverage 70.7897% 54.4973% -16.2924%
=================================================
Files 1476 1591 +115
Lines 437887 613441 +175554
=================================================
+ Hits 309979 334309 +24330
- Misses 108554 256574 +148020
- Partials 19354 22558 +3204
Flags with carried forward coverage won't be shown. Click here to find out more.
|
/test pull-lightning-integration-test |
@lance6716: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
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 kubernetes/test-infra repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need a empty file in this pr?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The run_lightning
script needs a configuration file, otherwise it will report error. Empty file means default configuration.
Signed-off-by: lance6716 <lance6716@gmail.com>
Signed-off-by: lance6716 <lance6716@gmail.com>
/ok-to-test |
Signed-off-by: lance6716 <lance6716@gmail.com>
/test pull-lightning-integration-test |
@lance6716: The specified target(s) for
Use In response to this:
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 kubernetes/test-infra repository. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 3pointer, D3Hunter, okJiang 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 |
/cherry-pick release-6.5 |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@GMHDBJD: new pull request created to branch In response to this:
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. |
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created to branch |
What problem does this PR solve?
Issue Number: close #51800
Problem Summary:
What changed and how does it work?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.