用于最终一致覆盖 PUT 的 S3 最后修改时间戳 [英] S3 last-modified timestamp for eventually-consistent overwrite PUTs

查看:18
本文介绍了用于最终一致覆盖 PUT 的 S3 最后修改时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

AWS S3 文档指出:

The AWS S3 docs state that:

Amazon S3 为覆盖所有区域的 PUTS 和 DELETES 提供最终一致性.

Amazon S3 offers eventual consistency for overwrite PUTS and DELETES in all regions.

http://docs.aws.amazon.com/AmazonS3/latest/dev/Introduction.html#ConsistencyModel

达到完全一致性的时间跨度可能会有所不同.在此期间,GET 请求可能会返回前一个对象或更新后的对象.

The timespan until full consistency is reached can vary. During this period GET requests may return the previous object or the udpated object.

我的问题是:

最后修改的时间戳什么时候更新?是在覆盖 PUT 成功后但之前达到完全一致性后立即更新,还是只有在达到完全一致性后才更新?

When is the last-modified timestamp updated? Is it updated immediately after the overwrite PUT succeeds but before full consistency is reached, or is it only updated after full consistency is achieved?

我怀疑是前者,但我找不到任何明确说明这一点的文档.

I suspect the former but I can't find any documentation which clearly states this.

推荐答案

Last-Modified 时间戳应与成功 PUT 请求.

The Last-Modified timestamp should match the Date value returned in the response headers from the successful PUT request.

据我所知,这没有明确记录,但可以从记录的内容中推导出来.

To my knowledge, this is not explicitly documented, but it can be derived from what is documented.

当您覆盖一个对象时,最终一致性模型可能会延迟覆盖的内容并不是覆盖本身——而是覆盖内容在给定 S3 节点上的可用性(S3 被复制到多个S3 区域内的节点).

When you overwrite an object, it's not the overwriting itself that may be delayed by the eventual consistency model -- it's the availability of the overwritten content at a given S3 node (S3 is replicated to multiple nodes within the S3 region).

Last-Modified 时间戳与元数据的其余部分一样,在对象创建时建立,此后不可变.

The Last-Modified timestamp, like the rest of the metadata, is established at the time of object creation and immutable, thereafter.

事实上,它根本不是对象的修改"时间,而是对象的创建时间.这种解释可能听起来很迂腐,但从最严格的意义上讲,它是准确的:S3 对象及其元数据实际上根本无法修改,只能被覆盖.当您在 S3 中覆盖"一个对象时,您实际上是在创建一个新对象,重用旧对象的键(路径+文件名).这个新对象在给定 S3 节点(复制)的可用性可能会被最终一致性模型延迟......而不是实际创建的新对象覆盖旧对象......因此,Last-Modified 没有理由受到复制延迟的影响(假设有复制延迟——有时最终一致性与直接一致性无法区分).

It is, in fact, not the "modification" time of the object at all, it is the creation time of the object. The explanation may sound pedantic, but it is accurate in the strictest sense: S3 objects and their metadata cannot in fact be modified at all, they can only be overwritten. When you "overwrite" an object in S3, what you are actually doing is creating a new object, reusing the old object's key (path+file name). The availability of this new object at a given S3 node (replication) is what may be delayed by the eventual consistency model... not the actual creation of the new object that overwrites the old one... hence there would be no reason for Last-Modified to be impacted by the replication delay (assuming there is a replication delay -- eventual consistency can at times be indistinguishable from immediate consistency).

这篇关于用于最终一致覆盖 PUT 的 S3 最后修改时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆