Dynamodb缺少并发请求的更新? [英] Dynamodb missing updates with concurrent requests?

查看:155
本文介绍了Dynamodb缺少并发请求的更新?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法一次多次更新单个项目.如果我多次尝试使用新属性更新商品,则这样:

I'm having trouble updating a single item many times at once. If I try to update an item with new attributes many times like so:

UpdateExpression: 'SET attribute.#uniqueId = :newAttribute'

并非所有更新都可以通过.我尝试发送20个具有唯一ID的更新,这仅导致15个新属性.这也发生在我的本地dynamodb实例中.我假设更新以某种方式在最后更新获胜"中相互覆盖.场景,但我不确定.我该如何解决?

not all of the updates go through. I tried sending 20 updates with unique ids and this resulted in only 15 new attributes. This also occurs in my local dynamodb instance. I assume that the updates are somehow overwriting each other in a "last update wins" scenario but I'm not sure. How can I solve this?

推荐答案

DynamoDB最终在更新时是一致的,因此竞争条件"会被更新.是可能的.如果您想要更严格的编写逻辑,请查看事务

DynamoDB is eventually consistent on update, so "race conditions" are possible. If you want more strict logic in writes, take a look at transactions

项目在交易过程中未锁定. DynamoDB事务 提供可序列化的隔离.如果在外部修改了项目 交易进行中,交易是 已取消,并引发异常,并详细说明了哪个项目或 物品导致了异常.

Items are not locked during a transaction. DynamoDB transactions provide serializable isolation. If an item is modified outside of a transaction while the transaction is in progress, the transaction is canceled and an exception is thrown with details about which item or items caused the exception.

这篇关于Dynamodb缺少并发请求的更新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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