-
Notifications
You must be signed in to change notification settings - Fork 85
add err message for dumpling #377
base: master
Are you sure you want to change the base?
Conversation
[REVIEW NOTIFICATION] This pull request has not been approved. 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. |
v4/export/dump.go
Outdated
@@ -1074,6 +1075,13 @@ func resolveAutoConsistency(d *Dumper) error { | |||
return nil | |||
} | |||
|
|||
func validateResolveAutoConsistency(conf *Config) error { | |||
if conf.Consistency == consistencyTypeSnapshot || conf.Snapshot != "" { |
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.
function validateResolveAutoConsistency
should be checked after resolveAutoConsistency
.
if conf.Consistency == consistencyTypeSnapshot || conf.Snapshot != "" { | |
if conf.Consistency != consistencyTypeSnapshot && conf.Snapshot != "" { |
v4/export/dump.go
Outdated
@@ -1074,6 +1075,13 @@ func resolveAutoConsistency(d *Dumper) error { | |||
return nil | |||
} | |||
|
|||
func validateResolveAutoConsistency(conf *Config) error { | |||
if conf.Consistency == consistencyTypeSnapshot || conf.Snapshot != "" { | |||
return errors.New("can't specify both --consistency and --snapshot at the same time. snapshot consistency is not supported for this server") |
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.
return errors.New("can't specify both --consistency and --snapshot at the same time. snapshot consistency is not supported for this server") | |
return errors.Errorf("can't specify --snapshot when --consistency isn't snapshot, resolved consistency: %s", conf.Consistency) |
v4/export/dump.go
Outdated
@@ -60,6 +60,7 @@ func NewDumper(ctx context.Context, conf *Config) (*Dumper, error) { | |||
err := adjustConfig(conf, | |||
registerTLSConfig, | |||
validateSpecifiedSQL, | |||
validateResolveAutoConsistency, |
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.
Function validateResolveAutoConsistency
should be after resolveAutoConsistency
.
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.
Rest LGTM
v4/export/prepare_test.go
Outdated
testCases := []struct { | ||
confConsistency string | ||
confSnapshot string | ||
err error |
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.
It seems that using string here is enough.
What problem does this PR solve?
Close #370
What is changed and how it works?
Add error message when --consistency is lock and --snapshot parameter is provided.
Check List
Tests
Release note
No release note