Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

dmctl: optimize query-status info (#356) #357

Merged
merged 4 commits into from
Nov 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions dm/ctl/master/query_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ func wrapTaskResult(resp *pb.QueryStatusListResponse) *taskResult {
}
taskList := make([]*taskInfo, 0, len(taskStatusMap))
for curTaskName, taskStatus := range taskStatusMap {
if strings.HasPrefix(taskStatus, stageError) {
taskStatus += ". Please run `query-status " + curTaskName + "` to get more details."
}
taskList = append(taskList,
&taskInfo{
TaskName: curTaskName,
Expand Down
11 changes: 6 additions & 5 deletions dm/ctl/master/query_status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ func (t *testCtlMaster) TestWrapTaskResult(c *check.C) {
}},
},
}
extraInfo := ". Please run `query-status test` to get more details."
expectedResult := []*taskInfo{{
TaskName: "test",
TaskStatus: stageError + " - Some error occurred in subtask",
TaskStatus: stageError + " - Some error occurred in subtask" + extraInfo,
Workers: []string{"172.17.0.2:8262", "172.17.0.3:8262", "172.17.0.6:8262"},
}}
generateAndCheckTaskResult(c, resp, expectedResult)
Expand All @@ -96,15 +97,15 @@ func (t *testCtlMaster) TestWrapTaskResult(c *check.C) {
Result: &pb.ProcessResult{
Errors: []*pb.ProcessError{{Type: pb.ErrorType_CheckFailed}},
}}
expectedResult[0].TaskStatus = stageError + " - Relay status is " + stageError
expectedResult[0].TaskStatus = stageError + " - Relay status is " + stageError + extraInfo
generateAndCheckTaskResult(c, resp, expectedResult)
// relay status is Paused
resp.Workers[0].RelayStatus = &pb.RelayStatus{Stage: pb.Stage_Paused}
expectedResult[0].TaskStatus = stageError + " - Relay status is " + pb.Stage_Paused.String()
expectedResult[0].TaskStatus = stageError + " - Relay status is " + pb.Stage_Paused.String() + extraInfo
generateAndCheckTaskResult(c, resp, expectedResult)
// relay status is Stopped
resp.Workers[0].RelayStatus = &pb.RelayStatus{Stage: pb.Stage_Stopped}
expectedResult[0].TaskStatus = stageError + " - Relay status is " + pb.Stage_Stopped.String()
expectedResult[0].TaskStatus = stageError + " - Relay status is " + pb.Stage_Stopped.String() + extraInfo
generateAndCheckTaskResult(c, resp, expectedResult)

// one subtask is paused and no error occurs, should return paused
Expand Down Expand Up @@ -147,7 +148,7 @@ func (t *testCtlMaster) TestWrapTaskResult(c *check.C) {
Workers: []string{"172.17.0.2:8262", "172.17.0.3:8262", "172.17.0.6:8262"},
}, {
TaskName: "test2",
TaskStatus: stageError + " - Some error occurred in subtask",
TaskStatus: stageError + " - Some error occurred in subtask. Please run `query-status test2` to get more details.",
Workers: []string{"172.17.0.4:8262"},
},
}
Expand Down
2 changes: 1 addition & 1 deletion tests/relay_interrupt/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function run() {
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \
"query-status" \
"\"taskName\": \"test\"" 1 \
"\"taskStatus\": \"Error - Some error occurred in subtask\"" 1
"\"taskStatus\": \"Error - Some error occurred in subtask. Please run \`query-status test\` to get more details.\"" 1

echo "reset go failpoints, and need restart dm-worker"
echo "then resume task, task will recover success"
Expand Down