Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log-backup: remove the timezone from log-date #36369

Merged
merged 13 commits into from
Jul 21, 2022
Merged
6 changes: 3 additions & 3 deletions br/pkg/stream/stream_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ func (p *printByTable) AddTask(task TaskStatus) {
table := p.console.CreateTable()
table.Add("name", task.Info.Name)
table.Add("status", task.colorfulStatusString())
table.Add("start", fmt.Sprint(oracle.GetTimeFromTS(task.Info.StartTs)))
table.Add("start", fmt.Sprint(oracle.GetTimeFromTS(task.Info.StartTs).Format("2006-01-02 15:04:05.999999999 -0700")))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe use a common function and add a unit test case to make sure the output of this common function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. PTAL

if task.Info.EndTs > 0 {
table.Add("end", fmt.Sprint(oracle.GetTimeFromTS(task.Info.EndTs)))
table.Add("end", fmt.Sprint(oracle.GetTimeFromTS(task.Info.EndTs).Format("2006-01-02 15:04:05.999999999 -0700")))
}
s := storage.FormatBackendURL(task.Info.GetStorage())
table.Add("storage", s.String())
Expand All @@ -133,7 +133,7 @@ func (p *printByTable) AddTask(task TaskStatus) {
if gap > 5*time.Minute {
gapColor = color.New(color.FgRed)
}
info := fmt.Sprintf("%s; gap=%s", pTime, gapColor.Sprint(gap))
info := fmt.Sprintf("%s; gap=%s", pTime.Format("2006-01-02 15:04:05.999999999 -0700"), gapColor.Sprint(gap))
return info
}
cp := task.GetMinStoreCheckpoint()
Expand Down
6 changes: 4 additions & 2 deletions br/pkg/task/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -575,10 +575,12 @@ func RunStreamMetadata(
return errors.Trace(err)
}

logMinDate := oracle.GetTimeFromTS(logMinTS).Format("2006-01-02 15:04:05.999999999 -0700")
logMaxDate := oracle.GetTimeFromTS(logMaxTS).Format("2006-01-02 15:04:05.999999999 -0700")
summary.Log(cmdName, zap.Uint64("log-min-ts", logMinTS),
zap.String("log-min-date", oracle.GetTimeFromTS(logMinTS).String()),
zap.String("log-min-date", logMinDate),
zap.Uint64("log-max-ts", logMaxTS),
zap.String("log-max-date", oracle.GetTimeFromTS(logMaxTS).String()),
zap.String("log-max-date", logMaxDate),
)
return nil
}
Expand Down