From b15a441778d904446cc25d52d518b1253973777f Mon Sep 17 00:00:00 2001 From: Chunzhu Li Date: Thu, 14 Nov 2019 18:19:36 +0800 Subject: [PATCH 1/3] add more query status info --- dm/ctl/master/query_status.go | 3 +++ 1 file changed, 3 insertions(+) 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, From 197d1cd6022d1e11c466242f682ff487631e7659 Mon Sep 17 00:00:00 2001 From: Chunzhu Li Date: Thu, 14 Nov 2019 18:20:38 +0800 Subject: [PATCH 2/3] add more query status info --- dm/ctl/master/query_status_test.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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"}, }, } From cafe415a81084fb4727395c03b86f533f3814c5c Mon Sep 17 00:00:00 2001 From: Chunzhu Li Date: Thu, 14 Nov 2019 18:42:30 +0800 Subject: [PATCH 3/3] fix --- tests/relay_interrupt/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"