From feaf8dfb9a969225d58ccc87ad0a211236eae082 Mon Sep 17 00:00:00 2001 From: Poorna Krishnamoorthy Date: Wed, 13 Jan 2021 11:52:28 -0800 Subject: [PATCH] Fix replication status reported on completion (#11273) Fixes: #11272 --- cmd/bucket-replication.go | 6 +++--- cmd/data-crawler.go | 2 +- docs/bucket/replication/README.md | 2 +- docs/zh_CN/bucket/replication/README.md | 2 +- pkg/bucket/replication/replication.go | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/bucket-replication.go b/cmd/bucket-replication.go index 4f12603e6..a2d584a19 100644 --- a/cmd/bucket-replication.go +++ b/cmd/bucket-replication.go @@ -180,7 +180,7 @@ func checkReplicateDelete(ctx context.Context, bucket string, dobj ObjectToDelet if gerr != nil { validReplStatus := false switch oi.ReplicationStatus { - case replication.Pending, replication.Complete, replication.Failed: + case replication.Pending, replication.Completed, replication.Failed: validReplStatus = true } if oi.DeleteMarker && validReplStatus { @@ -246,7 +246,7 @@ func replicateDelete(ctx context.Context, dobj DeletedObjectVersionInfo, objectA } } else { if dobj.VersionID == "" { - replicationStatus = string(replication.Complete) + replicationStatus = string(replication.Completed) } else { versionPurgeStatus = Complete } @@ -471,7 +471,7 @@ func replicateObject(ctx context.Context, objInfo ObjectInfo, objectAPI ObjectLa return } } - replicationStatus := replication.Complete + replicationStatus := replication.Completed if rtype != replicateAll { gr.Close() diff --git a/cmd/data-crawler.go b/cmd/data-crawler.go index 00570975f..05cbd8ec1 100644 --- a/cmd/data-crawler.go +++ b/cmd/data-crawler.go @@ -993,7 +993,7 @@ func (i *crawlItem) healReplication(ctx context.Context, o ObjectLayer, oi Objec case replication.Failed: sizeS.failedSize += oi.Size globalReplicationState.queueReplicaTask(oi) - case replication.Complete: + case replication.Completed, "COMPLETE": sizeS.replicatedSize += oi.Size case replication.Replica: sizeS.replicaSize += oi.Size diff --git a/docs/bucket/replication/README.md b/docs/bucket/replication/README.md index 29b9be491..c822d2694 100644 --- a/docs/bucket/replication/README.md +++ b/docs/bucket/replication/README.md @@ -119,7 +119,7 @@ The replication configuration follows [AWS S3 Spec](https://docs.aws.amazon.com/ When object locking is used in conjunction with replication, both source and destination buckets needs to have [object locking](https://docs.min.io/docs/minio-bucket-object-lock-guide.html) enabled. Similarly objects encrypted on the server side, will be replicated if destination also supports encryption. -Replication status can be seen in the metadata on the source and destination objects. On the source side, the `X-Amz-Replication-Status` changes from `PENDING` to `COMPLETE` or `FAILED` after replication attempt either succeeded or failed respectively. On the destination side, a `X-Amz-Replication-Status` status of `REPLICA` indicates that the object was replicated successfully. Any replication failures are automatically re-attempted during a periodic disk crawl cycle. +Replication status can be seen in the metadata on the source and destination objects. On the source side, the `X-Amz-Replication-Status` changes from `PENDING` to `COMPLETED` or `FAILED` after replication attempt either succeeded or failed respectively. On the destination side, a `X-Amz-Replication-Status` status of `REPLICA` indicates that the object was replicated successfully. Any replication failures are automatically re-attempted during a periodic disk crawl cycle. To perform bi-directional replication, repeat the above process on the target site - this time setting the source bucket as the replication target. diff --git a/docs/zh_CN/bucket/replication/README.md b/docs/zh_CN/bucket/replication/README.md index 2c845ce4d..2f0fcb5a9 100644 --- a/docs/zh_CN/bucket/replication/README.md +++ b/docs/zh_CN/bucket/replication/README.md @@ -73,7 +73,7 @@ Replication configuration applied successfully to myminio/srcbucket. 当对象锁定与复制结合使用时,源桶和目标桶都需要启用对象锁定。同理,如果目标也支持加密,则服务器端将复制加密的对象。 -复制状态可以在源和目标对象的元数据中看到。在源端,根据复制的结果是成功还是失败,`X-Amz-Replication-Status`会从`PENDING`变更为`COMPLETE`或者 `FAILED`状态。 在目标端,对象成功复制,`X-Amz-Replication-Status`会被设置为`REPLICA`状态。在定期的磁盘扫描周期中,任何复制失败都将自动重新尝试。 +复制状态可以在源和目标对象的元数据中看到。在源端,根据复制的结果是成功还是失败,`X-Amz-Replication-Status`会从`PENDING`变更为`COMPLETED`或者 `FAILED`状态。 在目标端,对象成功复制,`X-Amz-Replication-Status`会被设置为`REPLICA`状态。在定期的磁盘扫描周期中,任何复制失败都将自动重新尝试。 ![put](https://raw.githubusercontent.com/minio/minio/master/docs/zh_CN/bucket/replication/PUT_bucket_replication.png) diff --git a/pkg/bucket/replication/replication.go b/pkg/bucket/replication/replication.go index 673826d94..7336e230c 100644 --- a/pkg/bucket/replication/replication.go +++ b/pkg/bucket/replication/replication.go @@ -31,8 +31,8 @@ const ( // Pending - replication is pending. Pending StatusType = "PENDING" - // Complete - replication completed ok. - Complete StatusType = "COMPLETE" + // Completed - replication completed ok. + Completed StatusType = "COMPLETED" // Failed - replication failed. Failed StatusType = "FAILED"