metacache: Add trashcan (#10820)

Add trashcan that keeps recently updated lists after bucket deletion.
All caches were deleted once a bucket was deleted, so caches still running would report errors. Now they are canceled.
Fix `.minio.sys` not being transient.
This commit is contained in:
Klaus Post
2020-11-03 12:47:52 -08:00
committed by GitHub
parent 8c76e1353e
commit b9277c8030
6 changed files with 109 additions and 30 deletions
+7 -3
View File
@@ -91,9 +91,13 @@ func (z *erasureServerSets) listPath(ctx context.Context, o listPathOptions) (en
o.OldestCycle = globalNotificationSys.findEarliestCleanBloomFilter(ctx, path.Join(o.Bucket, o.BaseDir))
var cache metacache
rpc := globalNotificationSys.restClientFromHash(o.Bucket)
if rpc == nil {
if isReservedOrInvalidBucket(o.Bucket, false) {
rpc = nil
o.Transient = true
}
if rpc == nil || o.Transient {
// Local
cache = localMetacacheMgr.getBucket(ctx, o.Bucket).findCache(o)
cache = localMetacacheMgr.findCache(ctx, o)
} else {
c, err := rpc.GetMetacacheListing(ctx, o)
if err != nil {
@@ -103,8 +107,8 @@ func (z *erasureServerSets) listPath(ctx context.Context, o listPathOptions) (en
return entries, io.EOF
}
logger.LogIf(ctx, err)
cache = localMetacacheMgr.getTransient().findCache(o)
o.Transient = true
cache = localMetacacheMgr.findCache(ctx, o)
} else {
cache = *c
}