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

Commit

Permalink
Merge branch 'master' into add_lock_file
Browse files Browse the repository at this point in the history
  • Loading branch information
3pointer authored Jun 17, 2020
2 parents a1263fd + b1bf32f commit ff52113
Show file tree
Hide file tree
Showing 19 changed files with 1,774 additions and 353 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ coverage.txt
docker/data/
docker/logs/
*.swp
.DS_Store
6 changes: 3 additions & 3 deletions cmd/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ func newCheckSumCommand() *cobra.Command {
zap.Uint64("totalBytes", file.GetTotalBytes()),
zap.Uint64("startVersion", file.GetStartVersion()),
zap.Uint64("endVersion", file.GetEndVersion()),
zap.Binary("startKey", file.GetStartKey()),
zap.Binary("endKey", file.GetEndKey()),
zap.Stringer("startKey", utils.WrapKey(file.GetStartKey())),
zap.Stringer("endKey", utils.WrapKey(file.GetEndKey())),
)

var data []byte
Expand Down Expand Up @@ -179,7 +179,7 @@ func newBackupMetaCommand() *cobra.Command {
log.Error(
"file ranges overlapped",
zap.Stringer("out", out),
zap.Stringer("file", file),
utils.ZapFile(file),
)
}
}
Expand Down
26 changes: 13 additions & 13 deletions pkg/backup/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/pingcap/log"
"github.com/pingcap/parser/model"
pd "github.com/pingcap/pd/v4/client"
"github.com/pingcap/tidb-tools/pkg/table-filter"
filter "github.com/pingcap/tidb-tools/pkg/table-filter"
"github.com/pingcap/tidb/distsql"
"github.com/pingcap/tidb/domain"
"github.com/pingcap/tidb/kv"
Expand Down Expand Up @@ -465,8 +465,8 @@ func (bc *Client) BackupRange(
}
}()
log.Info("backup started",
zap.Binary("StartKey", startKey),
zap.Binary("EndKey", endKey),
zap.Stringer("StartKey", utils.WrapKey(startKey)),
zap.Stringer("EndKey", utils.WrapKey(endKey)),
zap.Uint64("RateLimit", req.RateLimit),
zap.Uint32("Concurrency", req.Concurrency))
ctx, cancel := context.WithCancel(ctx)
Expand Down Expand Up @@ -508,8 +508,8 @@ func (bc *Client) BackupRange(
bc.backupMeta.RawRanges = append(bc.backupMeta.RawRanges,
&kvproto.RawRange{StartKey: startKey, EndKey: endKey, Cf: req.Cf})
log.Info("backup raw ranges",
zap.ByteString("startKey", startKey),
zap.ByteString("endKey", endKey),
zap.Stringer("startKey", utils.WrapKey(startKey)),
zap.Stringer("endKey", utils.WrapKey(endKey)),
zap.String("cf", req.Cf))
} else {
log.Info("backup time range",
Expand Down Expand Up @@ -545,10 +545,10 @@ func (bc *Client) findRegionLeader(
}
if region.Leader != nil {
log.Info("find leader",
zap.Reflect("Leader", region.Leader), zap.Binary("Key", key))
zap.Reflect("Leader", region.Leader), zap.Stringer("Key", utils.WrapKey(key)))
return region.Leader, nil
}
log.Warn("no region found", zap.Binary("Key", key))
log.Warn("no region found", zap.Stringer("Key", utils.WrapKey(key)))
time.Sleep(time.Millisecond * time.Duration(100*i))
continue
}
Expand Down Expand Up @@ -632,8 +632,8 @@ func (bc *Client) fineGrainedBackup(
zap.Reflect("error", resp.Error))
}
log.Info("put fine grained range",
zap.Binary("StartKey", resp.StartKey),
zap.Binary("EndKey", resp.EndKey),
zap.Stringer("StartKey", utils.WrapKey(resp.StartKey)),
zap.Stringer("EndKey", utils.WrapKey(resp.EndKey)),
)
rangeTree.Put(resp.StartKey, resp.EndKey, resp.Files)

Expand Down Expand Up @@ -784,8 +784,8 @@ func SendBackup(
respFn func(*kvproto.BackupResponse) error,
) error {
log.Info("try backup",
zap.Binary("StartKey", req.StartKey),
zap.Binary("EndKey", req.EndKey),
zap.Stringer("StartKey", utils.WrapKey(req.StartKey)),
zap.Stringer("EndKey", utils.WrapKey(req.EndKey)),
zap.Uint64("storeID", storeID),
)
ctx, cancel := context.WithCancel(ctx)
Expand All @@ -807,8 +807,8 @@ func SendBackup(
}
// TODO: handle errors in the resp.
log.Info("range backuped",
zap.Any("StartKey", resp.GetStartKey()),
zap.Any("EndKey", resp.GetEndKey()))
zap.Stringer("StartKey", utils.WrapKey(resp.GetStartKey())),
zap.Stringer("EndKey", utils.WrapKey(req.GetEndKey())))
err = respFn(resp)
if err != nil {
return err
Expand Down
Loading

0 comments on commit ff52113

Please sign in to comment.