diff --git a/dm/ctl/master/query_status.go b/dm/ctl/master/query_status.go index 085f9b97b1..4d7bae8fde 100644 --- a/dm/ctl/master/query_status.go +++ b/dm/ctl/master/query_status.go @@ -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, diff --git a/dm/ctl/master/query_status_test.go b/dm/ctl/master/query_status_test.go index e959841e3d..c47c1844c2 100644 --- a/dm/ctl/master/query_status_test.go +++ b/dm/ctl/master/query_status_test.go @@ -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) @@ -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 @@ -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"}, }, } diff --git a/tests/relay_interrupt/run.sh b/tests/relay_interrupt/run.sh index 9ef2cba582..413cf7869d 100644 --- a/tests/relay_interrupt/run.sh +++ b/tests/relay_interrupt/run.sh @@ -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"