-
Notifications
You must be signed in to change notification settings - Fork 287
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
DM/Openapi: support start task by some conditions #5349
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 |
/cc @Ehco1996 @lance6716 |
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
safe_mode_time_duration: | ||
type: string | ||
example: "10s" | ||
description: time duration of safe 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.
we also support WaitTimeOnStop
in cliArgs now
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.
WaitTimeOnStop
is not in the requirement, maybe i will add later pr and add some integration test.
dm/syncer/syncer.go
Outdated
@@ -2185,7 +2185,7 @@ func (s *Syncer) initSafeModeExitTS(firstBinlogTS int64) error { | |||
return err | |||
} | |||
s.firstMeetBinlogTS = &firstBinlogTS | |||
exitTS := firstBinlogTS + int64(duration.Seconds()) | |||
exitTS := firstBinlogTS + int64(duration.Seconds())*1000 |
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 need *1000?
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.
yes, firstBinlogTS
which comes from Timestamp is the value of millisecond,but duration is second. i find it when i run integration 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.
you can use duration.Milliseconds() then
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.
https://dev.mysql.com/doc/internals/en/binlog-event-header.html this should be the unit of second, not millisecond 🤔
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.
sorry, I have tried again, the value is uint32
, i will fix back. I may modify this because I encounter another problem,the ts may be 0 when the event type is ROTATE_EVENT
and then i modify here and avoid 0, but here is wrong.
@@ -684,3 +681,18 @@ func genFilterRuleName(sourceName string, idx int) string { | |||
// NOTE that we don't have user input filter rule name in sub task config, so we make one by ourself | |||
return fmt.Sprintf("%s-filter-rule-%d", sourceName, idx) | |||
} | |||
|
|||
func OpenAPIStartTaskReqToTaskCliArgs(req openapi.StartTaskRequest) (*TaskCliArgs, error) { | |||
cliArgs := &TaskCliArgs{} |
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.
how about return nil when all cli agrs are empty?
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.
let me have a try.
…d-start-condition
…iflow into add-start-condition
…d-start-condition
…d-start-condition
…d-start-condition
/run-all-tests |
/run-all-tests |
/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 test later
openapi_task_check "get_task_list" 0 | ||
|
||
# incremental task use gtid | ||
prepare_database |
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.
test has source meta can exec
openapi_task_check "delete_task_with_force_success" "$task_name" | ||
openapi_task_check "get_task_list" 0 | ||
|
||
# incremental task use start_time |
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.
test has no source meta but has start time can exec
openapi_task_check "get_task_list" 0 | ||
|
||
# incremental task both gtid and start_time, start_time first | ||
prepare_database |
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.
test both has meta and start time, start time first.
openapi_task_check "get_task_list" 0 | ||
|
||
# incremental task no duration has error | ||
export GO_FAILPOINTS='github.com/pingcap/tiflow/dm/syncer/SafeModeInitPhaseSeconds=return(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.
test has no safe mode duration and has error
"query-status $task_name" \ | ||
"Duplicate entry" 2 | ||
|
||
# set duration and start 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.
test set duration and can exec
Codecov Report
Flags with carried forward coverage won't be shown. Click here to find out more. @@ Coverage Diff @@
## master #5349 +/- ##
================================================
- Coverage 56.1240% 55.6891% -0.4349%
================================================
Files 522 528 +6
Lines 65325 69430 +4105
================================================
+ Hits 36663 38665 +2002
- Misses 25094 27042 +1948
- Partials 3568 3723 +155 |
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 nice work
…d-start-condition
…d-start-condition
openapi_task_check "delete_task_with_force_success" "$task_name" | ||
openapi_task_check "get_task_list" 0 | ||
|
||
# incremental task use start_time, but time is after create table |
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.
test has start time but time is too late and return 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.
rest lgtm
dm/dm/master/openapi_controller.go
Outdated
@@ -705,10 +731,34 @@ func (s *Server) stopTask(ctx context.Context, taskName string, req openapi.Stop | |||
sourceNameList := openapi.SourceNameList(s.getTaskSourceNameList(taskName)) | |||
req.SourceNameList = &sourceNameList | |||
} | |||
// TODO(ehco): support stop req after https://github.com/pingcap/tiflow/pull/4601 merged | |||
// handle task cli args | |||
cliArgs, err := config.OpenAPIStopTasReqToTaskCliArgs(req) |
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.
cliArgs, err := config.OpenAPIStopTasReqToTaskCliArgs(req) | |
cliArgs, err := config.OpenAPIStopTaskReqToTaskCliArgs(req) |
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 plz fix typo before your merge
/run-all-tests |
/run-dm-integration-test |
1 similar comment
/run-dm-integration-test |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: dd14d08
|
/run-dm-integration-test |
2 similar comments
/run-dm-integration-test |
/run-dm-integration-test |
What problem does this PR solve?
Issue Number: close #5348
What is changed and how it works?
add
start_time
andsafe_mode_time_duration
in open api.Check List
Tests
Release note