未验证 提交 daf25bcb 编写于 作者: B Bingyi Sun 提交者: GitHub

Add log when remove keys in garbage collector. (#15453)

Signed-off-by: Nsunby <bingyi.sun@zilliz.com>
Co-authored-by: Nsunby <bingyi.sun@zilliz.com>
上级 03bb9e72
......@@ -110,7 +110,7 @@ func (gc *garbageCollector) close() {
// scan load meta file info and compares OSS keys
// if missing found, performs gc cleanup
func (gc *garbageCollector) scan() {
var v, m, e int
var v, m int
valid := gc.meta.ListSegmentFiles()
vm := make(map[string]struct{})
for _, k := range valid {
......@@ -122,6 +122,7 @@ func (gc *garbageCollector) scan() {
prefixes = append(prefixes, path.Join(gc.option.rootPath, insertLogPrefix))
prefixes = append(prefixes, path.Join(gc.option.rootPath, statsLogPrefix))
prefixes = append(prefixes, path.Join(gc.option.rootPath, deltaLogPrefix))
var removedKeys []string
for _, prefix := range prefixes {
for info := range gc.option.cli.ListObjects(context.TODO(), gc.option.bucketName, minio.ListObjectsOptions{
......@@ -136,13 +137,13 @@ func (gc *garbageCollector) scan() {
m++
// not found in meta, check last modified time exceeds tolerance duration
if time.Since(info.LastModified) > gc.option.missingTolerance {
e++
// ignore error since it could be cleaned up next time
removedKeys = append(removedKeys, info.Key)
_ = gc.option.cli.RemoveObject(context.TODO(), gc.option.bucketName, info.Key, minio.RemoveObjectOptions{})
}
}
}
log.Warn("scan result", zap.Int("valid", v), zap.Int("missing", m), zap.Int("removed", e))
log.Warn("scan result", zap.Int("valid", v), zap.Int("missing", m), zap.Strings("removed keys", removedKeys))
}
func (gc *garbageCollector) clearEtcd() {
......
......@@ -163,7 +163,6 @@ func (m *meta) AddSegment(segment *SegmentInfo) error {
return nil
}
// Deprecated
// DropSegment remove segment with provided id, etcd persistence also removed
func (m *meta) DropSegment(segmentID UniqueID) error {
m.Lock()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册