-
Notifications
You must be signed in to change notification settings - Fork 101
Lightning: add a pre check before import starts. #999
Conversation
9e02ac5
to
c16890a
Compare
/rebuild |
pkg/lightning/config/config.go
Outdated
CaseSensitive bool `toml:"case-sensitive" json:"case-sensitive"` | ||
StrictFormat bool `toml:"strict-format" json:"strict-format"` | ||
DefaultFileRules bool `toml:"default-file-rules" json:"default-file-rules"` | ||
IgnoreColumns map[string][]string `toml:"ignore-columns" json:"ignore-columns"` |
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.
should use []IgnoreColumns
here?
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.
no, we need specify db.table
for this config.
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 rethinked about this , I think it's better to use the same rule as table filter
to support regexp
e634937
to
7a7abad
Compare
/run-integration-tests |
1983aa9
to
a4cf617
Compare
/run-integration-tests |
/run-all-tests |
@3pointer Please rebase your pr to make the cla check happy |
7b2dcc0
to
8ccce25
Compare
pkg/lightning/common/util.go
Outdated
func AskForConfirmation() bool { | ||
var response string | ||
fmt.Println("please type [y/N] to continue:") | ||
_, err := fmt.Scanln(&response) |
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.
have i missed something? i've never seen any design doc saying that supporting pre-check will turn Lightning into an interactive-CLI tool
looking at the changes to the test cases show that introducing interactivity will break a lot of Lightning use cases. also given the history of dmctl
I seriously doubt introducing interactivity is a good idea.
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.
+1
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 add the interactivity because I found lightning will start to import automatically even we had some warning in pre-check.
so the user had to kill lightning and start it again, and if the user(it was me) didn't fix the waring in one time. he must kill lightning and start again and again.
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 could make the checks fatal, and having --disable-checks=aaa,bbb,ccc
(or the opposite --enable-checks=xxx,yyy,zzz
) to toggle the checks. the error message to mention the corresponding CLI paramters and config.
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.
Ok, I made the checks fatal and reuse --check-requirements to disable the checks.
Because it's not necessary to skip some checks.
9700be9
to
75d3607
Compare
9700be9
to
6b3a8c2
Compare
6b3a8c2
to
e7f1ed5
Compare
e7f1ed5
to
d14e527
Compare
d14e527
to
95a5b3a
Compare
pkg/lightning/config/config.go
Outdated
CaseSensitive bool `toml:"case-sensitive" json:"case-sensitive"` | ||
StrictFormat bool `toml:"strict-format" json:"strict-format"` | ||
DefaultFileRules bool `toml:"default-file-rules" json:"default-file-rules"` | ||
IgnoreColumns map[string][]string `toml:"ignore-columns" json:"ignore-columns"` |
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 rethinked about this , I think it's better to use the same rule as table filter
to support regexp
pdStores = "/pd/api/v1/stores" | ||
pdReplicate = "/pd/api/v1/config/replicate" | ||
|
||
defaultCSVSize = 10 * units.GiB |
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.
does 1GiB already enough? I think 10GB is too large
return errors.New("no schema create sql files found. Please either set `mydumper.no-schema` to true or add schema sql file for each database") | ||
} | ||
// setup database schema | ||
if len(s.dbSchemas) != 0 { |
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.
if len(s.dbSchemas) != 0 { | |
if len(s.dbSchemas) != 0 || len(s.tableSchemas) != 0 { |
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.
LGTM
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 2a5564b
|
In response to a cherrypick label: new pull request created: #1192. |
What problem does this PR solve?
Add some checks before lightning start imports.
close #1107
What is changed and how it works?
checkRequirements
with PreCheck.restoreSchemas
check_info.go
Check List
Tests
Related changes
Release Note