-
Notifications
You must be signed in to change notification settings - Fork 282
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
validator(dm): support start from time & fix & integration test #5534
Conversation
[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. |
/run-all-tests |
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.
will review later
dm/dm/master/scheduler/scheduler.go
Outdated
// OperateValidationTask operate validator of subtask. | ||
// tasks: tasks need to operate | ||
// validatorStages: stage info of subtask validators | ||
// changedSubtaskCfgs: length should be 0 or equal to validatorStages |
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.
seems changedSubtaskCfgs can tolerate not the same length as validatorStages 🤔
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.
caller should and has make sure about this
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.
Will take a look at IT later.
return terror.Annotate(err, "error while parse start-time, expected in the format like '2006-01-02 15:04:05' or '2006-01-02T15:04:05'") | ||
} | ||
if _, err := utils.ParseStartTime(t.StartTime); err != nil { | ||
return terror.Annotate(err, "error while parse start-time, expected in the format like '2006-01-02 15:04:05' or '2006-01-02T15:04:05'") |
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 terror.Annotate(err, "error while parse start-time, expected in the format like '2006-01-02 15:04:05' or '2006-01-02T15:04:05'") | |
return terror.Annotate(err, "error while parsing start-time, expected formats are like '2006-01-02 15:04:05' or '2006-01-02T15:04:05'") |
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.
there are 2 other message below using error while parse
style which doesn't meets english grammar, will not change them in this pr. maybe during refactor.
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'll note it in the issue. (this error message will be presented to the users, it would better be grammatical valid and make sense).
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.
those string it not introduced in this pr, will move it into #5143
dm/dm/master/server.go
Outdated
// if user set mode or start-time explicitly, then we do start operation. | ||
// none of the target validators should have enabled | ||
if explicitModeOrStartTime && !noneEnabled { | ||
msg := fmt.Sprintf("some of target validator(%s) has already enabled.", enabledValidator) |
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 we list all the validators that have been enabled? Or maybe leave a workaround here (e.g. "please check validator's statuses by dmctl query-status
"). Otherwise, users might have to try over and over 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.
Should we list all the validators that have been enabled
not sure how often user start validator only on some subtask, we can enhance it later.
/run-all-tests |
ptal of fc1f258 too. fix bug that we initialized validator when expect stage is stopped(happens on failover), which may cause resource leak. |
/run-all-tests |
/run-all-tests |
/run-verify |
Codecov Report
Flags with carried forward coverage won't be shown. Click here to find out more. @@ Coverage Diff @@
## master #5534 +/- ##
================================================
+ Coverage 56.0768% 56.1761% +0.0993%
================================================
Files 535 528 -7
Lines 70143 69857 -286
================================================
- Hits 39334 39243 -91
+ Misses 27078 26883 -195
Partials 3731 3731 |
ptal |
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.
leave for lunch
} | ||
|
||
if op == StartValidationOp { | ||
args.explicitMode = cmd.Flags().Changed("mode") |
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.
since the default value of mode
is "", we in fact don't need this check. Also for start-time
.
I'm both OK with these two styles: if explicitMode {checkMode} or if mode != "" {checkMode}
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.
will leave it.
allEnabled, noneEnabled := true, true | ||
for taskName := range subTaskCfgs { | ||
for sourceID := range subTaskCfgs[taskName] { | ||
if s.scheduler.ValidatorEnabled(taskName, sourceID) { |
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 check for all subtasks is not atomic, is it safe that other RPC change the status?
seems it will break "changedSubtaskCfgs: length should be 0 or equal to validatorStages"
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.
changed to acquire subtask latch before check
/run-dm-integration-test |
/run-verify |
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
|
||
echo "--> (success) validation start: start validation without explicit mode for source 1" | ||
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||
"validation start -s $SOURCE_ID1 test" \ |
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.
Could you add a test case that specifies multiple sources? More than one source is valid too.
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 terror.Annotate(err, "error while parse start-time, expected in the format like '2006-01-02 15:04:05' or '2006-01-02T15:04:05'") | ||
} | ||
if _, err := utils.ParseStartTime(t.StartTime); err != nil { | ||
return terror.Annotate(err, "error while parse start-time, expected in the format like '2006-01-02 15:04:05' or '2006-01-02T15:04:05'") |
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'll note it in the issue. (this error message will be presented to the users, it would better be grammatical valid and make sense).
"\"unit\": \"Sync\"" 2 | ||
|
||
echo "--> (fail) validation start: missing mode value" | ||
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ |
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.
maybe also check the help message of validation xxx is readable, like "pause-task \[-s source ...\] \[task-name | task-file\] \[flags\]"
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 gains, cobra will just print cobra.Command.Use & cobra.Command.Short
/hold please unhold after addresss comments |
/unhold |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: fed53e2
|
/run-dm-integration-test |
What problem does this PR solve?
Issue Number: close #5449
What is changed and how it works?
this pr is large most due to change to
.proto
and testvalidation start --start-time
validation start
,validation start
can be used in 2 ways:mode
tovalidation status
binlog pos
Check List
Tests
Questions
Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?
Release note