From 31d7cc2cd467e0c98b76d8a4518373f920abd97e Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Wed, 22 Sep 2021 19:17:09 -0700 Subject: [PATCH] erasure: Set fi.IsLatest when adding a new version (#13277) --- cmd/erasure-multipart.go | 3 +++ cmd/erasure-object.go | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/cmd/erasure-multipart.go b/cmd/erasure-multipart.go index aeea297ce..b07670078 100644 --- a/cmd/erasure-multipart.go +++ b/cmd/erasure-multipart.go @@ -950,6 +950,9 @@ func (er erasureObjects) CompleteMultipartUpload(ctx context.Context, bucket str } } + // we are adding a new version to this object under the namespace lock, so this is the latest version. + fi.IsLatest = true + // Success, return object info. return fi.ToObjectInfo(bucket, object), nil } diff --git a/cmd/erasure-object.go b/cmd/erasure-object.go index cf5ba8c37..c8af4aa97 100644 --- a/cmd/erasure-object.go +++ b/cmd/erasure-object.go @@ -134,6 +134,8 @@ func (er erasureObjects) CopyObject(ctx context.Context, srcBucket, srcObject, d return oi, toObjectErr(err, srcBucket, srcObject) } + // we are adding a new version to this object under the namespace lock, so this is the latest version. + fi.IsLatest = true return fi.ToObjectInfo(srcBucket, srcObject), nil } @@ -1001,6 +1003,9 @@ func (er erasureObjects) putObject(ctx context.Context, bucket string, object st fi.ReplicationState = opts.PutReplicationState() online = countOnlineDisks(onlineDisks) + // we are adding a new version to this object under the namespace lock, so this is the latest version. + fi.IsLatest = true + return fi.ToObjectInfo(bucket, object), nil }