Skip to content

Commit 93470fb

Browse files
authored
br: add status field for log status with json (pingcap#58465) (pingcap#58567)
close pingcap#57959
1 parent eee9702 commit 93470fb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

br/pkg/stream/stream_status.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,16 @@ func (t *TaskStatus) colorfulStatusString() string {
9797
return statusOK("NORMAL")
9898
}
9999

100+
func (t *TaskStatus) statusString() string {
101+
if t.paused && len(t.LastErrors) > 0 {
102+
return "ERROR"
103+
}
104+
if t.paused {
105+
return "PAUSE"
106+
}
107+
return "NORMAL"
108+
}
109+
100110
// GetCheckpoint calculates the checkpoint of the task.
101111
func (t TaskStatus) GetMinStoreCheckpoint() Checkpoint {
102112
initialized := false
@@ -194,6 +204,7 @@ func (p *printByJSON) PrintTasks() {
194204
Name string `json:"name"`
195205
StartTS uint64 `json:"start_ts,omitempty"`
196206
EndTS uint64 `json:"end_ts,omitempty"`
207+
Status string `json:"status"`
197208
TableFilter []string `json:"table_filter"`
198209
Progress []storeProgress `json:"progress"`
199210
Storage string `json:"storage"`
@@ -223,6 +234,7 @@ func (p *printByJSON) PrintTasks() {
223234
Name: t.Info.GetName(),
224235
StartTS: t.Info.GetStartTs(),
225236
EndTS: t.Info.GetEndTs(),
237+
Status: t.statusString(),
226238
TableFilter: t.Info.GetTableFilter(),
227239
Progress: sp,
228240
Storage: s.String(),

0 commit comments

Comments
 (0)