Skip to content

Commit

Permalink
add log
Browse files Browse the repository at this point in the history
Signed-off-by: joccau <zak.zhao@pingcap.com>
  • Loading branch information
joccau committed Nov 22, 2022
1 parent 02fe93a commit d90e199
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
14 changes: 11 additions & 3 deletions br/pkg/restore/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2007,7 +2007,7 @@ func (rc *Client) RestoreKVFiles(
// so we can simply skip the file that doesn't have the rule here.
onProgress(int64(len(files)))
summary.CollectInt("FileSkip", len(files))
log.Debug("skip file due to table id not matched", zap.Int64("tableId", files[0].TableId))
log.Debug("skip file due to table id not matched", zap.Int64("table-id", files[0].TableId))
skipFile += len(files)
} else {
rc.workerPool.ApplyOnErrorGroup(eg, func() error {
Expand All @@ -2016,8 +2016,16 @@ func (rc *Client) RestoreKVFiles(
onProgress(int64(len(files)))
updateStats(uint64(kvCount), size)
summary.CollectInt("File", len(files))
log.Info("import files done", zap.Int("batch count", len(files)), zap.Uint64("batch bytes", size),
zap.Duration("take", time.Since(fileStart)))
log.Info("import files done", zap.Int("batch-count", len(files)),
zap.Uint64("batch-size", size), zap.Duration("take", time.Since(fileStart)),
zap.Strings("filepath", func() []string {
filenames := make([]string, 0, len(files))
for _, f := range files {
filenames = append(filenames, f.Path+"; ")
}
return filenames
}()),
)
}()

return rc.fileImporter.ImportKVFiles(ectx, files, rule, rc.shiftStartTS, rc.startTS, rc.restoreTS, supportBatch)
Expand Down
16 changes: 4 additions & 12 deletions br/pkg/restore/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,11 +421,10 @@ func (importer *FileImporter) ImportKVFiles(
supportBatch bool,
) error {
var (
startTime = time.Now()
startKey []byte
endKey []byte
ranges = make([]kv.KeyRange, len(files))
err error
startKey []byte
endKey []byte
ranges = make([]kv.KeyRange, len(files))
err error
)

if !supportBatch && len(files) > 1 {
Expand Down Expand Up @@ -464,13 +463,6 @@ func (importer *FileImporter) ImportKVFiles(
}
return importer.ImportKVFileForRegion(ctx, subfiles, rule, shiftStartTS, startTS, restoreTS, r, supportBatch)
})

take := time.Since(startTime)
for _, file := range files {
log.Info("import file done",
zap.String("file", file.Path), zap.Stringer("take", take),
logutil.Key("fileStart", file.StartKey), logutil.Key("fileEnd", file.EndKey))
}
return errors.Trace(err)
}

Expand Down

0 comments on commit d90e199

Please sign in to comment.