Pass encrypted etag as is for immediate tiering (#15925)

This commit is contained in:
Krishnan Parthasarathi 2022-10-21 14:40:50 -07:00 committed by GitHub
parent ac85c2af76
commit f6b2e89109
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -1580,6 +1580,7 @@ func (api objectAPIHandlers) CopyObjectHandler(w http.ResponseWriter, r *http.Re
} }
} }
origETag := objInfo.ETag
objInfo.ETag = getDecryptedETag(r.Header, objInfo, false) objInfo.ETag = getDecryptedETag(r.Header, objInfo, false)
response := generateCopyObjectResponse(objInfo.ETag, objInfo.ModTime) response := generateCopyObjectResponse(objInfo.ETag, objInfo.ModTime)
encodedSuccessResponse := encodeResponse(response) encodedSuccessResponse := encodeResponse(response)
@ -1612,6 +1613,7 @@ func (api objectAPIHandlers) CopyObjectHandler(w http.ResponseWriter, r *http.Re
if !remoteCallRequired && !globalTierConfigMgr.Empty() { if !remoteCallRequired && !globalTierConfigMgr.Empty() {
// Schedule object for immediate transition if eligible. // Schedule object for immediate transition if eligible.
objInfo.ETag = origETag
enqueueTransitionImmediate(objInfo) enqueueTransitionImmediate(objInfo)
// Remove the transitioned object whose object version is being overwritten. // Remove the transitioned object whose object version is being overwritten.
logger.LogIf(ctx, os.Sweep()) logger.LogIf(ctx, os.Sweep())
@ -1942,6 +1944,7 @@ func (api objectAPIHandlers) PutObjectHandler(w http.ResponseWriter, r *http.Req
} }
} }
origETag := objInfo.ETag
if kind, encrypted := crypto.IsEncrypted(objInfo.UserDefined); encrypted { if kind, encrypted := crypto.IsEncrypted(objInfo.UserDefined); encrypted {
switch kind { switch kind {
case crypto.S3: case crypto.S3:
@ -1988,6 +1991,7 @@ func (api objectAPIHandlers) PutObjectHandler(w http.ResponseWriter, r *http.Req
// Remove the transitioned object whose object version is being overwritten. // Remove the transitioned object whose object version is being overwritten.
if !globalTierConfigMgr.Empty() { if !globalTierConfigMgr.Empty() {
// Schedule object for immediate transition if eligible. // Schedule object for immediate transition if eligible.
objInfo.ETag = origETag
enqueueTransitionImmediate(objInfo) enqueueTransitionImmediate(objInfo)
logger.LogIf(ctx, os.Sweep()) logger.LogIf(ctx, os.Sweep())
} }