mirror of https://github.com/minio/minio.git
fix: do not update metadata cache upon headObject() (#19929)
This commit is contained in:
parent
5a5046ce45
commit
62e6dc950d
|
@ -959,7 +959,6 @@ func (api objectAPIHandlers) headObjectHandler(ctx context.Context, objectAPI Ob
|
|||
// No need to check cache for encrypted objects.
|
||||
cachedResult = false
|
||||
}
|
||||
var update bool
|
||||
if cachedResult {
|
||||
rc := &cache.CondCheck{}
|
||||
h := r.Header.Clone()
|
||||
|
@ -968,7 +967,7 @@ func (api objectAPIHandlers) headObjectHandler(ctx context.Context, objectAPI Ob
|
|||
}
|
||||
rc.Init(bucket, object, h)
|
||||
|
||||
ci, err := globalCacheConfig.Get(rc)
|
||||
ci, _ := globalCacheConfig.Get(rc)
|
||||
if ci != nil {
|
||||
tgs, ok := ci.Metadata[xhttp.AmzObjectTagging]
|
||||
if ok {
|
||||
|
@ -1027,9 +1026,6 @@ func (api objectAPIHandlers) headObjectHandler(ctx context.Context, objectAPI Ob
|
|||
return
|
||||
}
|
||||
}
|
||||
if errors.Is(err, cache.ErrKeyMissing) {
|
||||
update = true
|
||||
}
|
||||
}
|
||||
|
||||
opts.FastGetObjInfo = true
|
||||
|
@ -1053,10 +1049,6 @@ func (api objectAPIHandlers) headObjectHandler(ctx context.Context, objectAPI Ob
|
|||
}
|
||||
}
|
||||
}
|
||||
if _, ok := crypto.IsEncrypted(objInfo.UserDefined); ok {
|
||||
// Never store encrypted objects in cache.
|
||||
update = false
|
||||
}
|
||||
|
||||
if objInfo.UserTags != "" {
|
||||
// Set this such that authorization policies can be applied on the object tags.
|
||||
|
@ -1137,24 +1129,6 @@ func (api objectAPIHandlers) headObjectHandler(ctx context.Context, objectAPI Ob
|
|||
return
|
||||
}
|
||||
|
||||
if update {
|
||||
asize, err := objInfo.GetActualSize()
|
||||
if err != nil {
|
||||
asize = objInfo.Size
|
||||
}
|
||||
|
||||
defer globalCacheConfig.Set(&cache.ObjectInfo{
|
||||
Key: objInfo.Name,
|
||||
Bucket: objInfo.Bucket,
|
||||
ETag: objInfo.ETag,
|
||||
ModTime: objInfo.ModTime,
|
||||
Expires: objInfo.ExpiresStr(),
|
||||
CacheControl: objInfo.CacheControl,
|
||||
Size: asize,
|
||||
Metadata: cleanReservedKeys(objInfo.UserDefined),
|
||||
})
|
||||
}
|
||||
|
||||
// Validate pre-conditions if any.
|
||||
if checkPreconditions(ctx, w, r, objInfo, opts) {
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue