ignore typed errors correctly in list cache layer (#10879)

bonus write bucket metadata cache with enough quorum

Possible fix for #10868
This commit is contained in:
Harshavardhana
2020-11-12 09:28:56 -08:00
committed by GitHub
parent f86d3538f6
commit ca88ca753c
4 changed files with 47 additions and 41 deletions

View File

@@ -102,14 +102,14 @@ func loadBucketMetaCache(ctx context.Context, bucket string) (*bucketMetacache,
err := objAPI.GetObject(GlobalContext, minioMetaBucket, pathJoin("buckets", bucket, ".metacache", "index.s2"), 0, -1, w, "", ObjectOptions{})
logger.LogIf(ctx, w.CloseWithError(err))
if err != nil {
if isErrObjectNotFound(err) {
switch err.(type) {
case ObjectNotFound:
err = nil
} else {
logger.LogIf(ctx, err)
}
if errors.Is(err, InsufficientReadQuorum{}) {
case InsufficientReadQuorum:
// Cache is likely lost. Clean up and return new.
return newBucketMetacache(bucket, true), nil
default:
logger.LogIf(ctx, err)
}
return newBucketMetacache(bucket, false), err
}