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

dumpling : add a function for the variable call of dm #30033

Merged
merged 16 commits into from
Nov 29, 2021
19 changes: 19 additions & 0 deletions dumpling/export/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,25 @@ func (d *Dumper) runLogProgress(tctx *tcontext.Context) {
}
}

type Midparams struct {
TotalTables float64
CompletedTables float64
FinishedBytes float64
FinishedRows float64
EstimateTotalRows float64
}

func (d *Dumper) GetParameters() (midparams *Midparams) {
lichunzhu marked this conversation as resolved.
Show resolved Hide resolved
conf := d.conf
var mid *Midparams
lance6716 marked this conversation as resolved.
Show resolved Hide resolved
mid.TotalTables = float64(calculateTableCount(conf.Tables))
lichunzhu marked this conversation as resolved.
Show resolved Hide resolved
mid.CompletedTables = ReadCounter(finishedTablesCounter, conf.Labels)
lichunzhu marked this conversation as resolved.
Show resolved Hide resolved
mid.FinishedBytes = ReadGauge(finishedSizeGauge, conf.Labels)
mid.FinishedRows = ReadGauge(finishedRowsGauge, conf.Labels)
mid.EstimateTotalRows = ReadCounter(estimateTotalRowsCounter, conf.Labels)
return mid
}

func calculateTableCount(m DatabaseTables) int {
cnt := 0
for _, tables := range m {
Expand Down