Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Commit

Permalink
loader: fix typo (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddatsh authored and amyangfei committed Mar 20, 2019
1 parent 41907a0 commit b57feb4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions loader/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ type Loader struct {
closed sync2.AtomicBool

totalDataSize sync2.AtomicInt64
totalFileCount sync2.AtomicInt64 // schema + table + data
finishedDataSize sync2.AtomicInt64
metaBinlog sync2.AtomicString

Expand Down Expand Up @@ -645,6 +646,7 @@ func (l *Loader) initAndStartWorkerPool(ctx context.Context) error {
func (l *Loader) prepareDbFiles(files map[string]struct{}) error {
// reset some variables
l.db2Tables = make(map[string]Tables2DataFiles)
l.totalFileCount.Set(0) // reset
for file := range files {
if !strings.HasSuffix(file, "-schema-create.sql") {
continue
Expand All @@ -659,6 +661,7 @@ func (l *Loader) prepareDbFiles(files map[string]struct{}) error {
}

l.db2Tables[db] = make(Tables2DataFiles)
l.totalFileCount.Add(1) // for schema
}
}

Expand Down Expand Up @@ -698,6 +701,7 @@ func (l *Loader) prepareTableFiles(files map[string]struct{}) error {
}
tableCounter.WithLabelValues(l.cfg.Name).Inc()
tables[table] = make(DataFiles, 0, 16)
l.totalFileCount.Add(1) // for table
}

return nil
Expand Down Expand Up @@ -745,6 +749,7 @@ func (l *Loader) prepareDataFiles(files map[string]struct{}) error {
return errors.Trace(err)
}
l.totalDataSize.Add(size)
l.totalFileCount.Add(1) // for data

dataFiles = append(dataFiles, file)
dataFileCounter.WithLabelValues(l.cfg.Name).Inc()
Expand Down
3 changes: 2 additions & 1 deletion loader/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ func (l *Loader) PrintStatus(ctx context.Context) {

finishedSize := l.finishedDataSize.Get()
totalSize := l.totalDataSize.Get()
log.Infof("[loader] finished_bytes = %d, total_bytes = GetAllRestoringFiles%d, progress = %s", finishedSize, totalSize, percent(finishedSize, totalSize))
totalFileCount := l.totalFileCount.Get()
log.Infof("[loader] finished_bytes = %d, total_bytes = %d, total_file_count = %d, progress = %s", finishedSize, totalSize, totalFileCount, percent(finishedSize, totalSize))
progressGauge.WithLabelValues(l.cfg.Name).Set(float64(finishedSize) / float64(totalSize))
if done {
return
Expand Down

0 comments on commit b57feb4

Please sign in to comment.