Skip to content

Commit

Permalink
log-backup: fix checkpoint display (#36166)
Browse files Browse the repository at this point in the history
fixed #36092
  • Loading branch information
YuJuncen authored Jul 13, 2022
1 parent 8997604 commit 2ff12e8
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions br/pkg/stream/stream_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ func (p *printByTable) AddTask(task TaskStatus) {
info := fmt.Sprintf("%s; gap=%s", pTime, gapColor.Sprint(gap))
return info
}
cp := task.GetMinStoreCheckpoint()
table.Add("checkpoint[global]", formatTS(cp.TS))
p.addCheckpoints(&task, table, formatTS)
for store, e := range task.LastErrors {
table.Add(fmt.Sprintf("error[store=%d]", store), e.ErrorCode)
Expand All @@ -147,21 +149,15 @@ func (p *printByTable) AddTask(task TaskStatus) {

func (p *printByTable) addCheckpoints(task *TaskStatus, table *glue.Table, formatTS func(uint64) string) {
cp := task.GetMinStoreCheckpoint()
items := make([][2]string, 0, len(task.Checkpoints))
if cp.Type() != CheckpointTypeGlobal {
for _, cp := range task.Checkpoints {
switch cp.Type() {
case CheckpointTypeStore:
items = append(items, [2]string{fmt.Sprintf("checkpoint[store=%d]", cp.ID), formatTS(cp.TS)})
table.Add(fmt.Sprintf("checkpoint[store=%d]", cp.ID), formatTS(cp.TS))
}
}
} else {
items = append(items, [2]string{"checkpoint[central-global]", formatTS(cp.TS)})
}

for _, item := range items {
table.Add(item[0], item[1])
}
}

func (p *printByTable) PrintTasks() {
Expand Down

0 comments on commit 2ff12e8

Please sign in to comment.