mirror of
https://github.com/minio/minio.git
synced 2025-04-17 01:10:29 -04:00
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.
|
// No need to check cache for encrypted objects.
|
||||||
cachedResult = false
|
cachedResult = false
|
||||||
}
|
}
|
||||||
var update bool
|
|
||||||
if cachedResult {
|
if cachedResult {
|
||||||
rc := &cache.CondCheck{}
|
rc := &cache.CondCheck{}
|
||||||
h := r.Header.Clone()
|
h := r.Header.Clone()
|
||||||
@ -968,7 +967,7 @@ func (api objectAPIHandlers) headObjectHandler(ctx context.Context, objectAPI Ob
|
|||||||
}
|
}
|
||||||
rc.Init(bucket, object, h)
|
rc.Init(bucket, object, h)
|
||||||
|
|
||||||
ci, err := globalCacheConfig.Get(rc)
|
ci, _ := globalCacheConfig.Get(rc)
|
||||||
if ci != nil {
|
if ci != nil {
|
||||||
tgs, ok := ci.Metadata[xhttp.AmzObjectTagging]
|
tgs, ok := ci.Metadata[xhttp.AmzObjectTagging]
|
||||||
if ok {
|
if ok {
|
||||||
@ -1027,9 +1026,6 @@ func (api objectAPIHandlers) headObjectHandler(ctx context.Context, objectAPI Ob
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if errors.Is(err, cache.ErrKeyMissing) {
|
|
||||||
update = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
opts.FastGetObjInfo = 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 != "" {
|
if objInfo.UserTags != "" {
|
||||||
// Set this such that authorization policies can be applied on the object tags.
|
// 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
|
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.
|
// Validate pre-conditions if any.
|
||||||
if checkPreconditions(ctx, w, r, objInfo, opts) {
|
if checkPreconditions(ctx, w, r, objInfo, opts) {
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user