fix: when healing log path when we give up (#14079)

This commit is contained in:
Harshavardhana 2022-01-10 21:22:17 -08:00 committed by GitHub
parent 54a98773f8
commit 7ee2d1c339
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 2 deletions

View File

@ -219,7 +219,12 @@ func (er *erasureObjects) healErasureSet(ctx context.Context, buckets []string,
} }
healEntry := func(entry metaCacheEntry) { healEntry := func(entry metaCacheEntry) {
if entry.name == "" && len(entry.metadata) == 0 {
// ignore entries that don't have metadata.
return
}
if entry.isDir() { if entry.isDir() {
// ignore healing entry.name's with `/` suffix.
return return
} }
// We might land at .metacache, .trash, .multipart // We might land at .metacache, .trash, .multipart
@ -246,7 +251,7 @@ func (er *erasureObjects) healErasureSet(ctx context.Context, buckets []string,
}, madmin.HealItemObject) }, madmin.HealItemObject)
if err != nil { if err != nil {
tracker.ItemsFailed++ tracker.ItemsFailed++
logger.LogIf(ctx, err) logger.LogIf(ctx, fmt.Errorf("unable to heal object %s/%s: %w", bucket, entry.name, err))
} else { } else {
tracker.ItemsHealed++ tracker.ItemsHealed++
} }
@ -263,7 +268,11 @@ func (er *erasureObjects) healErasureSet(ctx context.Context, buckets []string,
// If not deleted, assume they failed. // If not deleted, assume they failed.
tracker.ItemsFailed++ tracker.ItemsFailed++
tracker.BytesFailed += uint64(version.Size) tracker.BytesFailed += uint64(version.Size)
logger.LogIf(ctx, err) if version.VersionID != "" {
logger.LogIf(ctx, fmt.Errorf("unable to heal object %s/%s-v(%s): %w", bucket, version.Name, version.VersionID, err))
} else {
logger.LogIf(ctx, fmt.Errorf("unable to heal object %s/%s: %w", bucket, version.Name, err))
}
} else { } else {
tracker.ItemsHealed++ tracker.ItemsHealed++
tracker.BytesDone += uint64(version.Size) tracker.BytesDone += uint64(version.Size)