tidb check 源码
tidb check 代码
文件路径:/br/pkg/backup/check.go
// Copyright 2020 PingCAP, Inc. Licensed under Apache-2.0.
package backup
import (
"encoding/hex"
"github.com/google/btree"
"github.com/pingcap/log"
"github.com/pingcap/tidb/br/pkg/rtree"
"go.uber.org/zap"
)
// checkDupFiles checks if there are any files are duplicated.
func checkDupFiles(rangeTree *rtree.RangeTree) {
// Name -> SHA256
files := make(map[string][]byte)
rangeTree.Ascend(func(i btree.Item) bool {
rg := i.(*rtree.Range)
for _, f := range rg.Files {
old, ok := files[f.Name]
if ok {
log.Error("dup file",
zap.String("Name", f.Name),
zap.String("SHA256_1", hex.EncodeToString(old)),
zap.String("SHA256_2", hex.EncodeToString(f.Sha256)),
)
} else {
files[f.Name] = f.Sha256
}
}
return true
})
}
相关信息
相关文章
0
赞
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦